Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Dgraph Connector #1648

Closed
marktani opened this issue Jan 16, 2018 · 1 comment
Closed

Dgraph Connector #1648

marktani opened this issue Jan 16, 2018 · 1 comment

Comments

@marktani
Copy link
Contributor

This feature requests serves as a central place to discuss development and progress for the Dgraph connector.

@MichelDiz
Copy link

MichelDiz commented Jan 19, 2018

PS. I notice that Prisma uses ".scala" - So, what I wrote is use-less, others languages shuld use gRPC directly.

Just to set - Dgraph has a JS cliente https://github.com/dgraph-io/dgraph-js

And usually I usually connect my applications like this:

const dgraph = require('dgraph-js');
const grpc = require('grpc');

const clientStub = new dgraph.DgraphClientStub(
  // addr: optional, default: "localhost:9080"admin
  '192.168.1.150:9080'
  // credentials: optional, default: grpc.credentials.createInsecure()//
  grpc.credentials.createInsecure()
);

const dgraph = new dgraph.DgraphClient(clientStub);

dgraph.setDebugMode(false);

 const schema = `
       name: string @index(exact, term) .
       username: string @index(exact, term) .
       displayName: string .
       email: string @index(exact) .
       userPhone: string @index(hash) .
       pass: password .
       age: int @index(int) .
       occupations: [string] @count @index(exact).
       home.geolocation: geo @index(geo) .
       lastAccessDate: string .
       friend: uid @count @reverse .
 `;

 const op = new dgraph.Operation();
 op.setSchema(schema);
 let setSchemaOp = async () => await dgraph.alter(op);

 setSchemaOp();

export default dgraph;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants