Import
To begin, import thedgraph namespace from the SDK:
Dgraph APIs
The APIs in thedgraph namespace are below, organized by category.
We’re constantly introducing new APIs through ongoing development with early
users. Open an issue if you
have ideas on what would make Modus even more powerful for your next app!
Functions
execute
Execute a Dgraph query or mutation using a Dgraph Request object.Name of the host, as defined in the manifest.
alterSchema
Alter the schema of a Dgraph database.Name of the host, as defined in the manifest.
The schema to apply to the Dgraph database.
dropAttr
Drop an attribute from a Dgraph schema.Name of the host, as defined in the manifest.
The attribute to drop from the Dgraph schema.
dropAll
Drop all data from a Dgraph database.Name of the host, as defined in the manifest.
Objects
Request
A Dgraph request object, used to execute queries and mutations.new dgraph.Request(query, mutations)
Query
A Dgraph query object, used to execute queries.new dgraph.Query(query, variables)
Creates a new
Query object with the given query and variables. query
is a Dgraph Query Language (DQL) query string, and variables is a
Variables object.The DQL query to execute.
A map of query variables.
Variables
A Variables object used to set query variables in a Dgraph query.Variables.set(name, value)
Sets a query variable with the given
name and value. name is of type
string, and value can be of any type.Variables.toMap()
Returns a map of all query variables set in the
Variables object.Mutation
A Dgraph mutation object, used to execute mutations.new dgraph.Mutation(setJson, delJson, setNquads, delNquads, condition)
Creates a new
Mutation object with the given setJson, delJson,
setNquads, delNquads, and condition fields.A JSON string representing the data to set in the mutation.
A JSON string representing the data to delete in the mutation.
A string representing the data to set in the mutation in NQuads format.
A string representing the data to delete in the mutation in NQuads format.
A string representing the condition query for the mutation.