...
1 package singlefile
2
3 import (
4 "context"
5 "fmt"
6 "io"
7 )
8
9 type ForcedResolver struct {
10 Field Circle
11 }
12
13 type ModelMethods struct{}
14
15 func (m ModelMethods) NoContext() bool {
16 return true
17 }
18
19 func (m ModelMethods) WithContext(_ context.Context) bool {
20 return true
21 }
22
23 type Errors struct{}
24
25 type Error struct {
26 ID string
27 }
28
29 func (Error) ErrorOnRequiredField() (string, error) {
30 return "", fmt.Errorf("boom")
31 }
32
33 func (Error) ErrorOnNonRequiredField() (string, error) {
34 return "", fmt.Errorf("boom")
35 }
36
37 func (Error) NilOnRequiredField() *string {
38 return nil
39 }
40
41 type EmbeddedPointerModel struct {
42 *EmbeddedPointer
43 ID string
44 }
45
46 type EmbeddedPointer struct {
47 Title string
48 }
49
50 type MarshalPanic string
51
52 func (m *MarshalPanic) UnmarshalGQL(v interface{}) error {
53 panic("BOOM")
54 }
55
56 func (m MarshalPanic) MarshalGQL(w io.Writer) {
57 panic("BOOM")
58 }
59
60 type Panics struct{}
61
62 func (p *Panics) FieldFuncMarshal(ctx context.Context, u []MarshalPanic) []MarshalPanic {
63 return []MarshalPanic{MarshalPanic("aa"), MarshalPanic("bb")}
64 }
65
66 type Autobind struct {
67 Int int
68 Int32 int32
69 Int64 int64
70
71 IdStr string
72 IdInt int
73 }
74
75 type OverlappingFields struct {
76 Foo int
77 NewFoo int
78 }
79
80 type ObjectDirectivesWithCustomGoModel struct {
81 NullableText string
82 }
83
84 type FallbackToStringEncoding string
85
86 const (
87 FallbackToStringEncodingA FallbackToStringEncoding = "A"
88 FallbackToStringEncodingB FallbackToStringEncoding = "B"
89 FallbackToStringEncodingC FallbackToStringEncoding = "C"
90 )
91
92 type Primitive int
93
94 func (p Primitive) Squared() int {
95 return int(p) * int(p)
96 }
97
98 type PrimitiveString string
99
100 func (s PrimitiveString) Doubled() string {
101 return string(s) + string(s)
102 }
103
104 type Bytes []byte
105
View as plain text