-
Notifications
You must be signed in to change notification settings - Fork 0
/
filetype.go
93 lines (76 loc) · 2.3 KB
/
filetype.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
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
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by entc, DO NOT EDIT.
package filetype
import (
"fmt"
)
const (
// Label holds the string label denoting the filetype type in the database.
Label = "file_type"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldState holds the string denoting the state field in the database.
FieldState = "state"
// EdgeFiles holds the string denoting the files edge name in mutations.
EdgeFiles = "files"
// FilesLabel holds the string label denoting the files edge type in the database.
FilesLabel = "file_type_files"
)
// Type defines the type for the "type" enum field.
type Type string
// TypePNG is the default value of the Type enum.
const DefaultType = TypePNG
// Type values.
const (
TypePNG Type = "png"
TypeSVG Type = "svg"
TypeJPG Type = "jpg"
)
func (_type Type) String() string {
return string(_type)
}
// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.
func TypeValidator(_type Type) error {
switch _type {
case TypePNG, TypeSVG, TypeJPG:
return nil
default:
return fmt.Errorf("filetype: invalid enum value for type field: %q", _type)
}
}
// State defines the type for the "state" enum field.
type State string
// StateOn is the default value of the State enum.
const DefaultState = StateOn
// State values.
const (
StateOn State = "ON"
StateOff State = "OFF"
)
func (s State) String() string {
return string(s)
}
// StateValidator is a validator for the "state" field enum values. It is called by the builders before save.
func StateValidator(s State) error {
switch s {
case StateOn, StateOff:
return nil
default:
return fmt.Errorf("filetype: invalid enum value for state field: %q", s)
}
}
// Ptr returns a new pointer to the enum value.
func (_type Type) Ptr() *Type {
return &_type
}
// Ptr returns a new pointer to the enum value.
func (s State) Ptr() *State {
return &s
}
// comment from another template.