Options
All
  • Public
  • Public/Protected
  • All
Menu

External module Validate

Index

Functions

xValidateNodeExists

  • xValidateNodeExists(uid: any, txn: Txn): Promise<Boolean>

xValidateNodeExistsTxn

  • xValidateNodeExistsTxn(uid: string, dgraphClient: DgraphClient): Promise<Boolean>

xValidateNodeLinks

  • Validates nodeA is linked to the specified edge name on nodeB

    const users = [
    {
      uid: '_:user1',
      username: 'user1',
      addresses: [{
        uid: '_:user1address1',
        postcode: 2444
      }]
    },
    {
      uid: '_:user2',
      username: 'user2',
      addresses: [
        {
          uid: '_:user2address1',
          postcode: 2000
        },
        {
          uid: '_:user2address2',
          postcode: 2000
        }
      ]
    }];
    const params = {
     node: user1uid,
     edgename: 'addresses',
     linkednodesuids: [user1addressuid]
    };
    // this will return true as user1 does have address 1
    const result = await xvalidatenodelinkstxn(params, dgraphclient);

    Parameters

    Returns Promise<boolean>

xValidateNodeLinksTxn

  • xValidateNodeLinksTxn(params: IValidateNodeLinks, dgraphClient: DgraphClient): Promise<boolean>

xValidateNodePredicates

  • Validates a node has the specified attributes

    const users = [
     { username: 'user1', age: 33, street: '123 state'},
     { username: 'user2', age: 35},
     { username: 'user3'}
    ];
    
    // will return true username is a predicate for every user
    const result = await xValidateNodePredicatesTxn({
        nodes: userUids,
        predicates: ['username']
    }, dgraphClient);

    Parameters

    Returns Promise<boolean>

xValidateNodePredicatesTxn

Generated using TypeDoc