-
Notifications
You must be signed in to change notification settings - Fork 0
/
input_object.go
43 lines (36 loc) · 947 Bytes
/
input_object.go
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
package gql
// InputObject ...
type InputObject struct {
Name string
Description string
Fields InputFields
}
// InputFields contains InputObjectFields
type InputFields []*InputObjectField
// Get returns the InputObjectField with the given name
func (i InputFields) Get(name string) *InputObjectField {
for _, f := range i {
if f.Name == name {
return f
}
}
return nil
}
// InputObjectField describes a field of an InputObject
type InputObjectField struct {
Name string
Type Type
Description string
}
// Unwrap is defined to implement the Type interface
func (o *InputObject) Unwrap() Type {
return nil
}
// Kind returns the kind of the type, which is InputObjectTypeDefinition
func (o *InputObject) Kind() TypeDefinition {
return InputObjectTypeDefinition
}
// Validate runs a check if everything is okay with the Type
func (o *InputObject) Validate(ctx *ValidationContext) error {
return nil
}