Skip to content

Commit

Permalink
entgql: support for edge schema with one field ID (#347)
Browse files Browse the repository at this point in the history
* entgql: support for edge schema with one field ID

* entgql: update example schema for ID field

* entgql: run go generate

* entgql: remove edge fields and edges from WhereInput

* entgql: run go generate

* entgql: remove edge field from EdgeSchema node

* entgql: run go generate

* entgql: update tests

* entgql: keep edge fields for node

* entgql: run go generate

* entgql: enable the mutations on User for EdgeSchema

* entgql: skip EdgeSchema edge from mutations

* entgql: run go generate

* entgql: update schema tests
  • Loading branch information
giautm authored Jun 29, 2022
1 parent a5926d0 commit e738ef8
Show file tree
Hide file tree
Showing 65 changed files with 7,429 additions and 270 deletions.
59 changes: 59 additions & 0 deletions entgql/internal/todo/ent.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,54 @@ input CreateTodoInput {
secretID: ID
}
"""
CreateUserInput is used for create User object.
Input was generated by ent.
"""
input CreateUserInput {
name: String
groupIDs: [ID!]
friendIDs: [ID!]
}
"""
Define a Relay Cursor type:
https://relay.dev/graphql/connections.htm#sec-Cursor
"""
scalar Cursor
type Friendship implements Node {
id: ID!
createdAt: Time!
userID: ID!
friendID: ID!
user: User!
friend: User!
}
"""
FriendshipWhereInput is used for filtering Friendship objects.
Input was generated by ent.
"""
input FriendshipWhereInput {
not: FriendshipWhereInput
and: [FriendshipWhereInput!]
or: [FriendshipWhereInput!]
"""id field predicates"""
id: ID
idNEQ: ID
idIn: [ID!]
idNotIn: [ID!]
idGT: ID
idGTE: ID
idLT: ID
idLTE: ID
"""created_at field predicates"""
createdAt: Time
createdAtNEQ: Time
createdAtIn: [Time!]
createdAtNotIn: [Time!]
createdAtGT: Time
createdAtGTE: Time
createdAtLT: Time
createdAtLTE: Time
}
type Group implements Node {
id: ID!
name: String!
Expand Down Expand Up @@ -434,6 +478,17 @@ input TodoWhereInput {
hasCategory: Boolean
hasCategoryWith: [CategoryWhereInput!]
}
"""
UpdateUserInput is used for update User object.
Input was generated by ent.
"""
input UpdateUserInput {
name: String
addGroupIDs: [ID!]
removeGroupIDs: [ID!]
addFriendIDs: [ID!]
removeFriendIDs: [ID!]
}
type User implements Node {
id: ID!
name: String!
Expand All @@ -454,6 +509,7 @@ type User implements Node {
where: GroupWhereInput
): GroupConnection!
friends: [User!]
friendships: [Friendship!]
}
"""A connection to a list of items."""
type UserConnection {
Expand Down Expand Up @@ -508,4 +564,7 @@ input UserWhereInput {
"""friends edge predicates"""
hasFriends: Boolean
hasFriendsWith: [UserWhereInput!]
"""friendships edge predicates"""
hasFriendships: Boolean
hasFriendshipsWith: [FriendshipWhereInput!]
}
77 changes: 77 additions & 0 deletions entgql/internal/todo/ent/gql_collection.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions entgql/internal/todo/ent/gql_edge.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions entgql/internal/todo/ent/gql_mutation_input.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e738ef8

Please sign in to comment.