New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dgraph Connector #1648

Open
marktani opened this Issue Jan 16, 2018 · 1 comment

Comments

Projects
None yet
4 participants
@marktani
Copy link
Contributor

marktani commented Jan 16, 2018

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

@MichelDiz

This comment has been minimized.

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 join this conversation on GitHub. Already have an account? Sign in to comment