-
Notifications
You must be signed in to change notification settings - Fork 896
/
fieldtype.go
145 lines (134 loc) · 6.45 KB
/
fieldtype.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
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
// 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 fieldtype
import (
"fmt"
)
const (
// Label holds the string label denoting the fieldtype type in the database.
Label = "field_type"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldInt holds the string denoting the int field in the database.
FieldInt = "int"
// FieldInt8 holds the string denoting the int8 field in the database.
FieldInt8 = "int8"
// FieldInt16 holds the string denoting the int16 field in the database.
FieldInt16 = "int16"
// FieldInt32 holds the string denoting the int32 field in the database.
FieldInt32 = "int32"
// FieldInt64 holds the string denoting the int64 field in the database.
FieldInt64 = "int64"
// FieldOptionalInt holds the string denoting the optional_int field in the database.
FieldOptionalInt = "optional_int"
// FieldOptionalInt8 holds the string denoting the optional_int8 field in the database.
FieldOptionalInt8 = "optional_int8"
// FieldOptionalInt16 holds the string denoting the optional_int16 field in the database.
FieldOptionalInt16 = "optional_int16"
// FieldOptionalInt32 holds the string denoting the optional_int32 field in the database.
FieldOptionalInt32 = "optional_int32"
// FieldOptionalInt64 holds the string denoting the optional_int64 field in the database.
FieldOptionalInt64 = "optional_int64"
// FieldNillableInt holds the string denoting the nillable_int field in the database.
FieldNillableInt = "nillable_int"
// FieldNillableInt8 holds the string denoting the nillable_int8 field in the database.
FieldNillableInt8 = "nillable_int8"
// FieldNillableInt16 holds the string denoting the nillable_int16 field in the database.
FieldNillableInt16 = "nillable_int16"
// FieldNillableInt32 holds the string denoting the nillable_int32 field in the database.
FieldNillableInt32 = "nillable_int32"
// FieldNillableInt64 holds the string denoting the nillable_int64 field in the database.
FieldNillableInt64 = "nillable_int64"
// FieldValidateOptionalInt32 holds the string denoting the validate_optional_int32 field in the database.
FieldValidateOptionalInt32 = "validate_optional_int32"
// FieldOptionalUint holds the string denoting the optional_uint field in the database.
FieldOptionalUint = "optional_uint"
// FieldOptionalUint8 holds the string denoting the optional_uint8 field in the database.
FieldOptionalUint8 = "optional_uint8"
// FieldOptionalUint16 holds the string denoting the optional_uint16 field in the database.
FieldOptionalUint16 = "optional_uint16"
// FieldOptionalUint32 holds the string denoting the optional_uint32 field in the database.
FieldOptionalUint32 = "optional_uint32"
// FieldOptionalUint64 holds the string denoting the optional_uint64 field in the database.
FieldOptionalUint64 = "optional_uint64"
// FieldState holds the string denoting the state field in the database.
FieldState = "state"
// FieldOptionalFloat holds the string denoting the optional_float field in the database.
FieldOptionalFloat = "optional_float"
// FieldOptionalFloat32 holds the string denoting the optional_float32 field in the database.
FieldOptionalFloat32 = "optional_float32"
// FieldDatetime holds the string denoting the datetime field in the database.
FieldDatetime = "datetime"
// FieldDecimal holds the string denoting the decimal field in the database.
FieldDecimal = "decimal"
// FieldDir holds the string denoting the dir field in the database.
FieldDir = "dir"
// FieldNdir holds the string denoting the ndir field in the database.
FieldNdir = "ndir"
// FieldStr holds the string denoting the str field in the database.
FieldStr = "str"
// FieldNullStr holds the string denoting the null_str field in the database.
FieldNullStr = "null_str"
// FieldLink holds the string denoting the link field in the database.
FieldLink = "link"
// FieldNullLink holds the string denoting the null_link field in the database.
FieldNullLink = "null_link"
// FieldActive holds the string denoting the active field in the database.
FieldActive = "active"
// FieldNullActive holds the string denoting the null_active field in the database.
FieldNullActive = "null_active"
// FieldDeleted holds the string denoting the deleted field in the database.
FieldDeleted = "deleted"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldIP holds the string denoting the ip field in the database.
FieldIP = "ip"
// FieldNullInt64 holds the string denoting the null_int64 field in the database.
FieldNullInt64 = "null_int64"
// FieldSchemaInt holds the string denoting the schema_int field in the database.
FieldSchemaInt = "schema_int"
// FieldSchemaInt8 holds the string denoting the schema_int8 field in the database.
FieldSchemaInt8 = "schema_int8"
// FieldSchemaInt64 holds the string denoting the schema_int64 field in the database.
FieldSchemaInt64 = "schema_int64"
// FieldSchemaFloat holds the string denoting the schema_float field in the database.
FieldSchemaFloat = "schema_float"
// FieldSchemaFloat32 holds the string denoting the schema_float32 field in the database.
FieldSchemaFloat32 = "schema_float32"
// FieldNullFloat holds the string denoting the null_float field in the database.
FieldNullFloat = "null_float"
)
var (
// ValidateOptionalInt32Validator is a validator for the "validate_optional_int32" field. It is called by the builders before save.
ValidateOptionalInt32Validator func(int32) error
// NdirValidator is a validator for the "ndir" field. It is called by the builders before save.
NdirValidator func(string) error
// LinkValidator is a validator for the "link" field. It is called by the builders before save.
LinkValidator func(string) error
)
// State defines the type for the state enum field.
type State string
// State values.
const (
StateOn State = "on"
StateOff State = "off"
)
func (s State) String() string {
return string(s)
}
// StateValidator is a validator for the "s" 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("fieldtype: invalid enum value for state field: %q", s)
}
}
// Ptr returns a new pointer to the enum value.
func (s State) Ptr() *State {
return &s
}
// comment from another template.