prisma / prisma1

💾 Database Tools incl. ORM, Migrations and Admin UI (Postgres, MySQL & MongoDB) [deprecated]

Home Page:https://v1.prisma.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dgraph Connector

marktani opened this issue · comments

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

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;