Options
All
  • Public
  • Public/Protected
  • All
Menu

External module SetSchema

Index

Functions

Functions

xSetSchemaAlt

  • xSetSchemaAlt(schema: string, dgraphClient: DgraphClient, _dgraph?: any): Promise<Payload>
  • Quickly set the schema

    Example

    const {dgraphClient} = await xSetupForTest();
    
    const schema = `
    name: string @index(fulltext) .
    email: string @index(exact) .
    friend: uid .`;
    
    await xSetSchemaAlt(schema, dgraphClient);
    
    // effectively a one line statement for
    const op = new _dgraph.Operation();
    op.setSchema(schema);
    return dgraphClient.alter(op);
    

    Parameters

    • schema: string
    • dgraphClient: DgraphClient
    • Default value _dgraph: any = dgraph

    Returns Promise<Payload>

Generated using TypeDoc