A native GraphQL API for Dgraph

diggy

Dgraph is an open-source, distributed, graph database and now it comes with a native GraphQL API.

Step 1: Give us the types in your schema.
type Product {
    productID: ID!
    name: String @search(by: [term])
    reviews: [Review] @hasInverse(field: about)
}

type Review {
    id: ID!
    about: Product! @hasInverse(field: reviews)
    by: Customer! @hasInverse(field: reviews)
    comment: String @search(by: [fulltext])
    rating: Int @search
}

type Customer {
    custID: ID!
    name: String @search(by: [hash, regexp])
    reviews: [Review] @hasInverse(field: by)
}
Step 2: You get a full, idiomatic GraphQL API.
{
  queryReview(
    filter: { rating: {gt: 3} },    # search
    order: { desc: rating },        # sort
    first: 3
  ) {
    rating
    about {
      productID
      name
    }
    by (filter: {
      name: { regexp: "adg" }
    }) {
      name
    }
  }
}

Step 3: Enjoy!

Get started