-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels_gen.go
More file actions
164 lines (135 loc) · 3.25 KB
/
Copy pathmodels_gen.go
File metadata and controls
164 lines (135 loc) · 3.25 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package fsgraph
import (
fmt "fmt"
io "io"
strconv "strconv"
)
// a generic file
type File interface {
IsFile()
}
// the contents of a file
type FileContents struct {
Data string `json:"data"`
Next *Int64 `json:"next"`
Encoding Encoding `json:"encoding"`
Warning *string `json:"warning"`
}
// a representation of the file's mode
type FileMode struct {
Type FileType `json:"type"`
Perm int `json:"perm"`
Sticky bool `json:"sticky"`
}
type OKResult struct {
S string `json:"s"`
Warning *string `json:"warning"`
}
func (OKResult) IsResult() {}
// a generic result of an operation
type Result interface {
IsResult()
}
// file contents (read) or write encoding
type Encoding string
const (
EncodingAuto Encoding = "auto"
EncodingUtf8 Encoding = "utf8"
EncodingBase64 Encoding = "base64"
)
func (e Encoding) IsValid() bool {
switch e {
case EncodingAuto, EncodingUtf8, EncodingBase64:
return true
}
return false
}
func (e Encoding) String() string {
return string(e)
}
func (e *Encoding) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Encoding(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Encoding", str)
}
return nil
}
func (e Encoding) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// specifies how a file is to be opened
type FileOpen string
const (
// create file if it doesn't exist
FileOpenCreate FileOpen = "create"
// file must not exist
FileOpenNew FileOpen = "new"
// truncate the file if it exists
FileOpenTruncate FileOpen = "truncate"
// writes will be appended to the end of the file
FileOpenAppend FileOpen = "append"
)
func (e FileOpen) IsValid() bool {
switch e {
case FileOpenCreate, FileOpenNew, FileOpenTruncate, FileOpenAppend:
return true
}
return false
}
func (e FileOpen) String() string {
return string(e)
}
func (e *FileOpen) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = FileOpen(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid FileOpen", str)
}
return nil
}
func (e FileOpen) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type FileType string
const (
FileTypeRegular FileType = "regular"
FileTypeDir FileType = "dir"
FileTypeSymlink FileType = "symlink"
FileTypeNamedPipe FileType = "namedPipe"
FileTypeSocket FileType = "socket"
FileTypeDevice FileType = "device"
FileTypeCharDevice FileType = "charDevice"
FileTypeIrregular FileType = "irregular"
)
func (e FileType) IsValid() bool {
switch e {
case FileTypeRegular, FileTypeDir, FileTypeSymlink, FileTypeNamedPipe, FileTypeSocket, FileTypeDevice, FileTypeCharDevice, FileTypeIrregular:
return true
}
return false
}
func (e FileType) String() string {
return string(e)
}
func (e *FileType) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = FileType(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid FileType", str)
}
return nil
}
func (e FileType) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}