generated from matoszz/mitbgo-template
-
Notifications
You must be signed in to change notification settings - Fork 7
/
hushhistory.go
194 lines (168 loc) · 6.62 KB
/
hushhistory.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
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
// Code generated by ent, DO NOT EDIT.
package hushhistory
import (
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"github.com/99designs/gqlgen/graphql"
"github.com/datumforge/enthistory"
)
const (
// Label holds the string label denoting the hushhistory type in the database.
Label = "hush_history"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldHistoryTime holds the string denoting the history_time field in the database.
FieldHistoryTime = "history_time"
// FieldOperation holds the string denoting the operation field in the database.
FieldOperation = "operation"
// FieldRef holds the string denoting the ref field in the database.
FieldRef = "ref"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldCreatedBy holds the string denoting the created_by field in the database.
FieldCreatedBy = "created_by"
// FieldUpdatedBy holds the string denoting the updated_by field in the database.
FieldUpdatedBy = "updated_by"
// FieldMappingID holds the string denoting the mapping_id field in the database.
FieldMappingID = "mapping_id"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldDeletedBy holds the string denoting the deleted_by field in the database.
FieldDeletedBy = "deleted_by"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldKind holds the string denoting the kind field in the database.
FieldKind = "kind"
// FieldSecretName holds the string denoting the secret_name field in the database.
FieldSecretName = "secret_name"
// FieldSecretValue holds the string denoting the secret_value field in the database.
FieldSecretValue = "secret_value"
// Table holds the table name of the hushhistory in the database.
Table = "hush_history"
)
// Columns holds all SQL columns for hushhistory fields.
var Columns = []string{
FieldID,
FieldHistoryTime,
FieldOperation,
FieldRef,
FieldCreatedAt,
FieldUpdatedAt,
FieldCreatedBy,
FieldUpdatedBy,
FieldMappingID,
FieldDeletedAt,
FieldDeletedBy,
FieldName,
FieldDescription,
FieldKind,
FieldSecretName,
FieldSecretValue,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// DefaultHistoryTime holds the default value on creation for the "history_time" field.
DefaultHistoryTime func() time.Time
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// DefaultMappingID holds the default value on creation for the "mapping_id" field.
DefaultMappingID func() string
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() string
)
// OperationValidator is a validator for the "operation" field enum values. It is called by the builders before save.
func OperationValidator(o enthistory.OpType) error {
switch o.String() {
case "INSERT", "UPDATE", "DELETE":
return nil
default:
return fmt.Errorf("hushhistory: invalid enum value for operation field: %q", o)
}
}
// OrderOption defines the ordering options for the HushHistory queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByHistoryTime orders the results by the history_time field.
func ByHistoryTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldHistoryTime, opts...).ToFunc()
}
// ByOperation orders the results by the operation field.
func ByOperation(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOperation, opts...).ToFunc()
}
// ByRef orders the results by the ref field.
func ByRef(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRef, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByCreatedBy orders the results by the created_by field.
func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
}
// ByUpdatedBy orders the results by the updated_by field.
func ByUpdatedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedBy, opts...).ToFunc()
}
// ByMappingID orders the results by the mapping_id field.
func ByMappingID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMappingID, opts...).ToFunc()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByDeletedBy orders the results by the deleted_by field.
func ByDeletedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedBy, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByKind orders the results by the kind field.
func ByKind(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldKind, opts...).ToFunc()
}
// BySecretName orders the results by the secret_name field.
func BySecretName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSecretName, opts...).ToFunc()
}
// BySecretValue orders the results by the secret_value field.
func BySecretValue(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSecretValue, opts...).ToFunc()
}
var (
// enthistory.OpType must implement graphql.Marshaler.
_ graphql.Marshaler = (*enthistory.OpType)(nil)
// enthistory.OpType must implement graphql.Unmarshaler.
_ graphql.Unmarshaler = (*enthistory.OpType)(nil)
)