generated from matoszz/mitbgo-template
-
Notifications
You must be signed in to change notification settings - Fork 7
/
orgmembershiphistory.go
198 lines (171 loc) · 6.71 KB
/
orgmembershiphistory.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
195
196
197
198
// Code generated by ent, DO NOT EDIT.
package orgmembershiphistory
import (
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"github.com/99designs/gqlgen/graphql"
"github.com/datumforge/datum/internal/ent/enums"
"github.com/datumforge/enthistory"
)
const (
// Label holds the string label denoting the orgmembershiphistory type in the database.
Label = "org_membership_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"
// FieldRole holds the string denoting the role field in the database.
FieldRole = "role"
// FieldOrganizationID holds the string denoting the organization_id field in the database.
FieldOrganizationID = "organization_id"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// Table holds the table name of the orgmembershiphistory in the database.
Table = "org_membership_history"
)
// Columns holds all SQL columns for orgmembershiphistory fields.
var Columns = []string{
FieldID,
FieldHistoryTime,
FieldOperation,
FieldRef,
FieldCreatedAt,
FieldUpdatedAt,
FieldCreatedBy,
FieldUpdatedBy,
FieldMappingID,
FieldDeletedAt,
FieldDeletedBy,
FieldRole,
FieldOrganizationID,
FieldUserID,
}
// 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("orgmembershiphistory: invalid enum value for operation field: %q", o)
}
}
const DefaultRole enums.Role = "MEMBER"
// RoleValidator is a validator for the "role" field enum values. It is called by the builders before save.
func RoleValidator(r enums.Role) error {
switch r.String() {
case "ADMIN", "MEMBER", "USER", "OWNER":
return nil
default:
return fmt.Errorf("orgmembershiphistory: invalid enum value for role field: %q", r)
}
}
// OrderOption defines the ordering options for the OrgMembershipHistory 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()
}
// ByRole orders the results by the role field.
func ByRole(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRole, opts...).ToFunc()
}
// ByOrganizationID orders the results by the organization_id field.
func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, 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)
)
var (
// enums.Role must implement graphql.Marshaler.
_ graphql.Marshaler = (*enums.Role)(nil)
// enums.Role must implement graphql.Unmarshaler.
_ graphql.Unmarshaler = (*enums.Role)(nil)
)