-
Notifications
You must be signed in to change notification settings - Fork 0
/
ent.graphql
138 lines (130 loc) · 3.69 KB
/
ent.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
directive @goField(forceResolver: Boolean, name: String) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION
directive @goModel(model: String, models: [String!]) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION
"""
CreateTodoInput is used for create Todo object.
Input was generated by ent.
"""
input CreateTodoInput {
text: String!
createdAt: Time
status: TodoStatus
priority: Int
parentID: ID
childIDs: [ID!]
}
"""
Define a Relay Cursor type:
https://relay.dev/graphql/connections.htm#sec-Cursor
"""
scalar Cursor
"""
An object with an ID.
Follows the [Relay Global Object Identification Specification](https://relay.dev/graphql/objectidentification.htm)
"""
interface Node @goModel(model: "github.com/pannpers/tutorial-ent/ent.Noder") {
"""The id of the object."""
id: ID!
}
"""Possible directions in which to order a list of items when provided an `orderBy` argument."""
enum OrderDirection {
"""Specifies an ascending order for a given `orderBy` argument."""
ASC
"""Specifies a descending order for a given `orderBy` argument."""
DESC
}
"""
Information about pagination in a connection.
https://relay.dev/graphql/connections.htm#sec-undefined.PageInfo
"""
type PageInfo {
"""When paginating forwards, are there more items?"""
hasNextPage: Boolean!
"""When paginating backwards, are there more items?"""
hasPreviousPage: Boolean!
"""When paginating backwards, the cursor to continue."""
startCursor: Cursor
"""When paginating forwards, the cursor to continue."""
endCursor: Cursor
}
type Query {
"""Fetches an object given its ID."""
node(
"""ID of the object."""
id: ID!
): Node
"""Lookup nodes by a list of IDs."""
nodes(
"""The list of node IDs."""
ids: [ID!]!
): [Node]!
todos(
"""Returns the elements in the list that come after the specified cursor."""
after: Cursor
"""Returns the first _n_ elements from the list."""
first: Int
"""Returns the elements in the list that come before the specified cursor."""
before: Cursor
"""Returns the last _n_ elements from the list."""
last: Int
"""Ordering options for Todos returned from the connection."""
orderBy: [TodoOrder!]
): TodoConnection!
}
"""The builtin Time type"""
scalar Time
type Todo implements Node {
id: ID!
text: String!
createdAt: Time!
status: TodoStatus!
priority: Int!
parent: Todo
children(
"""Returns the elements in the list that come after the specified cursor."""
after: Cursor
"""Returns the first _n_ elements from the list."""
first: Int
"""Returns the elements in the list that come before the specified cursor."""
before: Cursor
"""Returns the last _n_ elements from the list."""
last: Int
"""Ordering options for Todos returned from the connection."""
orderBy: [TodoOrder!]
): TodoConnection!
}
"""A connection to a list of items."""
type TodoConnection {
"""A list of edges."""
edges: [TodoEdge]
"""Information to aid in pagination."""
pageInfo: PageInfo!
"""Identifies the total count of items in the connection."""
totalCount: Int!
}
"""An edge in a connection."""
type TodoEdge {
"""The item at the end of the edge."""
node: Todo
"""A cursor for use in pagination."""
cursor: Cursor!
}
"""Ordering options for Todo connections"""
input TodoOrder {
"""The ordering direction."""
direction: OrderDirection! = ASC
"""The field by which to order Todos."""
field: TodoOrderField!
}
"""Properties by which Todo connections can be ordered."""
enum TodoOrderField {
TEXT
CREATED_AT
STATUS
PRIORITY
CHILDREN_COUNT
}
"""TodoStatus is enum for the field status"""
enum TodoStatus @goModel(model: "github.com/pannpers/tutorial-ent/ent/todo.Status") {
IN_PROGRESS
COMPLETED
}