All Projects → avishwakarma → dgraph-orm

avishwakarma / dgraph-orm

Licence: MIT license
Simplified schema creation, queries and mutations for Dgraph.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to dgraph-orm

dgraph
Dgraph Dart client which communicates with the server using gRPC.
Stars: ✭ 27 (-42.55%)
Mutual labels:  dgraph, dgraph-client
dgraph graphql go
A GraphQL + Dgraph + Go + HTTP based backend service demo.
Stars: ✭ 49 (+4.26%)
Mutual labels:  dgraph
graphql-sample-apps
This repository contains sample GraphQL applications powered by Dgraph.
Stars: ✭ 65 (+38.3%)
Mutual labels:  dgraph
graphoverflow
Run the entire StackOverflow on Dgraph. Work in progress.
Stars: ✭ 117 (+148.94%)
Mutual labels:  dgraph
unigraph-dev
A local-first and universal knowledge graph, personal search engine, and workspace for your life.
Stars: ✭ 512 (+989.36%)
Mutual labels:  dgraph
Dgraph-dotnet
.Net client for Dgraph
Stars: ✭ 41 (-12.77%)
Mutual labels:  dgraph
graphql-backend-template-dgraph
Dgraph GraphQL Editor template for backend using very fast dgraph golang database server under the hood
Stars: ✭ 45 (-4.26%)
Mutual labels:  dgraph
spark-dgraph-connector
A connector for Apache Spark and PySpark to Dgraph databases.
Stars: ✭ 36 (-23.4%)
Mutual labels:  dgraph
pandora
Small box of pandora to prototype your app with ready for use backend. This is just my compilation of different solutions occasionally applied in hackathons and challenges
Stars: ✭ 26 (-44.68%)
Mutual labels:  dgraph
dgraph-bench
A benchmark program for dgraph.
Stars: ✭ 27 (-42.55%)
Mutual labels:  dgraph
exdgraph
gRPC based Elixir Dgraph client. Under development.
Stars: ✭ 112 (+138.3%)
Mutual labels:  dgraph
dqlx
A DGraph Query Builder
Stars: ✭ 41 (-12.77%)
Mutual labels:  dgraph
Awesome-Dgraph
A list of media, code and info about Dgraph.
Stars: ✭ 20 (-57.45%)
Mutual labels:  dgraph
transform-graphql
⚙️ Transformer function to transform GraphQL Directives. Create model CRUD directive for example
Stars: ✭ 23 (-51.06%)
Mutual labels:  dgraph

dgraph-orm

Simplified schema creation, queries and mutations for Dgraph.

Installation

npm install dgraph-orm

Depending on the version of Dgraph that you are connecting to, you will have to use a different version.

Dgraph version dgraph-orm version
1.0.X 1.X.Y
1.1.X 2.X.Y

Note: Only API breakage from v1.X.Y to v2.X.Y is in dependency -dgraph-js. Function DgraphClient.newTxn().mutate() returns a messages.Assigned type in v1.X but a messages.Response type in v2.X.

Full Documentation

https://avishwakarma.github.io/dgraph-orm

Your first schema and model

import dgraph from 'dgraph-orm';

const UserSchema = new dgraph.Schema('user', {
  name: {
    type: dgraph.Types.STRING,
    index: true,
    token: {
      term: true
    }
  },
  email: {
    type: dgraph.Types.STRING,
    index: true,
    unique: true,
    token: {
      exact: true
    }
  },
  password: dgraph.Types.PASSWORD,
  bio: dgraph.Types.STRING,
  friend: {
    type: dgraph.Types.UID,
    model: 'user', // related model name
    count: true,
    reverse: true
  }
});

/**
 * Set and create model out of the schema
 */
const User = dgraph.model(UserSchema);

/**
 * Creates a new user with passed fields
 *
 * Returns the created user along with the generated uid
 */
const user = await User.create({
  name: 'Ashok Vishwakarma',
  email: '[email protected]',
  bio: 'My bio ...'
});

console.log(user);
// {
//    uid: '0x1',
//    name: 'Ashok Vishwakarma',
//    email: '[email protected]',
//    bio: 'My bio ...'
// }

For the full documentation please visit the below link

https://ashokvishwakarma.github.io/dgraph-orm

Futute releases

  • Other geo queries within, intersects
  • Group by
  • Aggregation

Contribution

Issues and pull requests are welcome for

  • Unit test cases
  • Feature and query method implementation
  • Bug fixes

Author

my_pic

Ashok Vishwakarma

LinkedInTwitterMedium

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].