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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
// Code generated by "string-enumer -t TrimSize -t ColorType -t Quality -t Binding -t Paper -t Finish -t Linen -t Foil --text -o ./pkgid_gen.go ."; DO NOT EDIT.
package lulu
import (
"fmt"
)
// validBindingValues contains a map of all valid Binding values for easy lookup
var validBindingValues = map[Binding]struct{}{
Perfect: {},
Coil: {},
SaddleStitch: {},
CaseWrap: {},
LinenWrap: {},
WireO: {},
}
// Valid validates if a value is a valid Binding
func (v Binding) Valid() bool {
_, ok := validBindingValues[v]
return ok
}
// BindingValues returns a list of all (valid) Binding values
func BindingValues() []Binding {
return []Binding{
Perfect,
Coil,
SaddleStitch,
CaseWrap,
LinenWrap,
WireO,
}
}
// UnmarshalText takes a text, verifies that it is a correct Binding and unmarshals it
func (v *Binding) UnmarshalText(text []byte) error {
if valid := Binding(text).Valid(); !valid {
return fmt.Errorf("not valid value for Binding: %s", text)
}
*v = Binding(text)
return nil
}
// validColorTypeValues contains a map of all valid ColorType values for easy lookup
var validColorTypeValues = map[ColorType]struct{}{
Mono: {},
Color: {},
}
// Valid validates if a value is a valid ColorType
func (v ColorType) Valid() bool {
_, ok := validColorTypeValues[v]
return ok
}
// ColorTypeValues returns a list of all (valid) ColorType values
func ColorTypeValues() []ColorType {
return []ColorType{
Mono,
Color,
}
}
// UnmarshalText takes a text, verifies that it is a correct ColorType and unmarshals it
func (v *ColorType) UnmarshalText(text []byte) error {
if valid := ColorType(text).Valid(); !valid {
return fmt.Errorf("not valid value for ColorType: %s", text)
}
*v = ColorType(text)
return nil
}
// validFinishValues contains a map of all valid Finish values for easy lookup
var validFinishValues = map[Finish]struct{}{
Gloss: {},
Matte: {},
Unlaminated: {},
}
// Valid validates if a value is a valid Finish
func (v Finish) Valid() bool {
_, ok := validFinishValues[v]
return ok
}
// FinishValues returns a list of all (valid) Finish values
func FinishValues() []Finish {
return []Finish{
Gloss,
Matte,
Unlaminated,
}
}
// UnmarshalText takes a text, verifies that it is a correct Finish and unmarshals it
func (v *Finish) UnmarshalText(text []byte) error {
if valid := Finish(text).Valid(); !valid {
return fmt.Errorf("not valid value for Finish: %s", text)
}
*v = Finish(text)
return nil
}
// validFoilValues contains a map of all valid Foil values for easy lookup
var validFoilValues = map[Foil]struct{}{
GoldFoil: {},
BlackFoil: {},
WhiteFoil: {},
NoFoil: {},
}
// Valid validates if a value is a valid Foil
func (v Foil) Valid() bool {
_, ok := validFoilValues[v]
return ok
}
// FoilValues returns a list of all (valid) Foil values
func FoilValues() []Foil {
return []Foil{
GoldFoil,
BlackFoil,
WhiteFoil,
NoFoil,
}
}
// UnmarshalText takes a text, verifies that it is a correct Foil and unmarshals it
func (v *Foil) UnmarshalText(text []byte) error {
if valid := Foil(text).Valid(); !valid {
return fmt.Errorf("not valid value for Foil: %s", text)
}
*v = Foil(text)
return nil
}
// validLinenValues contains a map of all valid Linen values for easy lookup
var validLinenValues = map[Linen]struct{}{
RedLinen: {},
NavyLinen: {},
BlackLinen: {},
GrayLinen: {},
TanLinen: {},
ForestLinen: {},
InteriorCoverPrint: {},
NoLinen: {},
}
// Valid validates if a value is a valid Linen
func (v Linen) Valid() bool {
_, ok := validLinenValues[v]
return ok
}
// LinenValues returns a list of all (valid) Linen values
func LinenValues() []Linen {
return []Linen{
RedLinen,
NavyLinen,
BlackLinen,
GrayLinen,
TanLinen,
ForestLinen,
InteriorCoverPrint,
NoLinen,
}
}
// UnmarshalText takes a text, verifies that it is a correct Linen and unmarshals it
func (v *Linen) UnmarshalText(text []byte) error {
if valid := Linen(text).Valid(); !valid {
return fmt.Errorf("not valid value for Linen: %s", text)
}
*v = Linen(text)
return nil
}
// validPaperValues contains a map of all valid Paper values for easy lookup
var validPaperValues = map[Paper]struct{}{
P60UncoatedWhite: {},
P60UncoatedCream: {},
P70CoatedWhite: {},
P80CoatedWhite: {},
P100CoatedWhite: {},
}
// Valid validates if a value is a valid Paper
func (v Paper) Valid() bool {
_, ok := validPaperValues[v]
return ok
}
// PaperValues returns a list of all (valid) Paper values
func PaperValues() []Paper {
return []Paper{
P60UncoatedWhite,
P60UncoatedCream,
P70CoatedWhite,
P80CoatedWhite,
P100CoatedWhite,
}
}
// UnmarshalText takes a text, verifies that it is a correct Paper and unmarshals it
func (v *Paper) UnmarshalText(text []byte) error {
if valid := Paper(text).Valid(); !valid {
return fmt.Errorf("not valid value for Paper: %s", text)
}
*v = Paper(text)
return nil
}
// validQualityValues contains a map of all valid Quality values for easy lookup
var validQualityValues = map[Quality]struct{}{
Premium: {},
Standard: {},
}
// Valid validates if a value is a valid Quality
func (v Quality) Valid() bool {
_, ok := validQualityValues[v]
return ok
}
// QualityValues returns a list of all (valid) Quality values
func QualityValues() []Quality {
return []Quality{
Premium,
Standard,
}
}
// UnmarshalText takes a text, verifies that it is a correct Quality and unmarshals it
func (v *Quality) UnmarshalText(text []byte) error {
if valid := Quality(text).Valid(); !valid {
return fmt.Errorf("not valid value for Quality: %s", text)
}
*v = Quality(text)
return nil
}
// validTrimSizeValues contains a map of all valid TrimSize values for easy lookup
var validTrimSizeValues = map[TrimSize]struct{}{
Pocketbook: {},
Novella: {},
Digest: {},
A5: {},
UsTrade: {},
Royal: {},
Comic: {},
SmallSquare: {},
Executive: {},
CrownQuatro: {},
Square: {},
A4: {},
UsLetter: {},
Landscape: {},
UsLetterLandscape: {},
A4Landscape: {},
}
// Valid validates if a value is a valid TrimSize
func (v TrimSize) Valid() bool {
_, ok := validTrimSizeValues[v]
return ok
}
// TrimSizeValues returns a list of all (valid) TrimSize values
func TrimSizeValues() []TrimSize {
return []TrimSize{
Pocketbook,
Novella,
Digest,
A5,
UsTrade,
Royal,
Comic,
SmallSquare,
Executive,
CrownQuatro,
Square,
A4,
UsLetter,
Landscape,
UsLetterLandscape,
A4Landscape,
}
}
// UnmarshalText takes a text, verifies that it is a correct TrimSize and unmarshals it
func (v *TrimSize) UnmarshalText(text []byte) error {
if valid := TrimSize(text).Valid(); !valid {
return fmt.Errorf("not valid value for TrimSize: %s", text)
}
*v = TrimSize(text)
return nil
}
|