-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
user.go
120 lines (112 loc) · 5.13 KB
/
user.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
// Code generated by ent, DO NOT EDIT.
package user
import (
"time"
"github.com/google/uuid"
)
const (
// Label holds the string label denoting the user type in the database.
Label = "user"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldUsername holds the string denoting the username field in the database.
FieldUsername = "username"
// FieldPassword holds the string denoting the password field in the database.
FieldPassword = "password"
// FieldRole holds the string denoting the role field in the database.
FieldRole = "role"
// 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"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// EdgeTokens holds the string denoting the tokens edge name in mutations.
EdgeTokens = "tokens"
// EdgeSubscribedFeeds holds the string denoting the subscribed_feeds edge name in mutations.
EdgeSubscribedFeeds = "subscribed_feeds"
// EdgeReadItems holds the string denoting the read_items edge name in mutations.
EdgeReadItems = "read_items"
// EdgeSubscriptions holds the string denoting the subscriptions edge name in mutations.
EdgeSubscriptions = "subscriptions"
// EdgeReads holds the string denoting the reads edge name in mutations.
EdgeReads = "reads"
// Table holds the table name of the user in the database.
Table = "users"
// TokensTable is the table that holds the tokens relation/edge.
TokensTable = "tokens"
// TokensInverseTable is the table name for the Token entity.
// It exists in this package in order to avoid circular dependency with the "token" package.
TokensInverseTable = "tokens"
// TokensColumn is the table column denoting the tokens relation/edge.
TokensColumn = "user_tokens"
// SubscribedFeedsTable is the table that holds the subscribed_feeds relation/edge. The primary key declared below.
SubscribedFeedsTable = "subscriptions"
// SubscribedFeedsInverseTable is the table name for the Feed entity.
// It exists in this package in order to avoid circular dependency with the "feed" package.
SubscribedFeedsInverseTable = "feeds"
// ReadItemsTable is the table that holds the read_items relation/edge. The primary key declared below.
ReadItemsTable = "reads"
// ReadItemsInverseTable is the table name for the Item entity.
// It exists in this package in order to avoid circular dependency with the "item" package.
ReadItemsInverseTable = "items"
// SubscriptionsTable is the table that holds the subscriptions relation/edge.
SubscriptionsTable = "subscriptions"
// SubscriptionsInverseTable is the table name for the Subscription entity.
// It exists in this package in order to avoid circular dependency with the "subscription" package.
SubscriptionsInverseTable = "subscriptions"
// SubscriptionsColumn is the table column denoting the subscriptions relation/edge.
SubscriptionsColumn = "user_id"
// ReadsTable is the table that holds the reads relation/edge.
ReadsTable = "reads"
// ReadsInverseTable is the table name for the Read entity.
// It exists in this package in order to avoid circular dependency with the "read" package.
ReadsInverseTable = "reads"
// ReadsColumn is the table column denoting the reads relation/edge.
ReadsColumn = "user_id"
)
// Columns holds all SQL columns for user fields.
var Columns = []string{
FieldID,
FieldUsername,
FieldPassword,
FieldRole,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeletedAt,
}
var (
// SubscribedFeedsPrimaryKey and SubscribedFeedsColumn2 are the table columns denoting the
// primary key for the subscribed_feeds relation (M2M).
SubscribedFeedsPrimaryKey = []string{"user_id", "feed_id"}
// ReadItemsPrimaryKey and ReadItemsColumn2 are the table columns denoting the
// primary key for the read_items relation (M2M).
ReadItemsPrimaryKey = []string{"user_id", "item_id"}
)
// 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 (
// UsernameValidator is a validator for the "username" field. It is called by the builders before save.
UsernameValidator func(string) error
// PasswordValidator is a validator for the "password" field. It is called by the builders before save.
PasswordValidator func(string) error
// DefaultRole holds the default value on creation for the "role" field.
DefaultRole string
// RoleValidator is a validator for the "role" field. It is called by the builders before save.
RoleValidator func(string) error
// 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
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() uuid.UUID
)