Skip to content

Instantly share code, notes, and snippets.

@avishwakarma
Last active February 6, 2019 16:45
Show Gist options
  • Save avishwakarma/b261f291c61fd914463b400b255c168b to your computer and use it in GitHub Desktop.
Save avishwakarma/b261f291c61fd914463b400b255c168b to your computer and use it in GitHub Desktop.
DgraphKoa Generated Types, Inputs, Queries and Mutations
// Types
type Person {
id: ID!
name: String
children(
first: Int
after: Int
filter: PersonFilter
): [Person!]!
parents(
first: Int
after: Int
filter: PersonFilter
): [Person!]!
createdAt: DateTime!
updatedAt: DateTime!
}
type PersonMutationPayload {
person: Person
}
// Inputs
input PersonFilter {
AND: [PersonFilter!]
OR: [PersonFilter!]
name_eq: String
}
input CreatePersonMutationInput {
name: String
children: [PersonInput]
parents: [PersonInput]
}
input UpdatePersonMutationInput {
id: ID
name: String
children: [PersonInput]
parents: [PersonInput]
}
input DeletePersonMutationInput {
id: ID!
}
input AddPersonChildrenMutationInput {
id: ID!
children: [PersonInput!]!
}
input RemovePersonChildrenMutationInput {
id: ID!
children: [PersonInput!]!
}
input AddPersonParentsMutationInput {
id: ID!
parents: [PersonInput!]!
}
input RemovePersonParentsMutationInput {
id: ID!
parents: [PersonInput!]!
}
// Query
type Query {
person(id: ID!): Person
people(
first: Int
after: Int
filter: PersonFilter
): [Person!]!
}
// Mutations
type Mutation {
createPerson(input: CreatePersonMutationInput!): PersonMutationPayload
updatePerson(input: UpdatePersonMutationInput!): PersonMutationPayload
deletePerson(input: DeletePersonMutationInput!): PersonMutationPayload
addPersonChildren(input: AddPersonChildrenMutationInput!): PersonMutationPayload
removePersonChildren(input: RemovePersonChildrenMutationInput!): PersonMutationPayload
addPersonParents(input: AddPersonParentsMutationInput!): PersonMutationPayload
removePersonParents(input: RemovePersonParentsMutationInput!): PersonMutationPayload
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment