forked from suyuan32/simple-admin-member-rpc
/
runtime.go
184 lines (180 loc) · 11 KB
/
runtime.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
// Code generated by ent, DO NOT EDIT.
package ent
import (
"time"
uuid "github.com/gofrs/uuid/v5"
"github.com/iot-synergy/synergy-member-rpc/ent/comment"
"github.com/iot-synergy/synergy-member-rpc/ent/member"
"github.com/iot-synergy/synergy-member-rpc/ent/memberrank"
"github.com/iot-synergy/synergy-member-rpc/ent/oauthprovider"
"github.com/iot-synergy/synergy-member-rpc/ent/reply"
"github.com/iot-synergy/synergy-member-rpc/ent/schema"
"github.com/iot-synergy/synergy-member-rpc/ent/token"
)
// The init function reads all schema descriptors with runtime code
// (default values, validators, hooks and policies) and stitches it
// to their package variables.
func init() {
commentMixin := schema.Comment{}.Mixin()
commentMixinFields0 := commentMixin[0].Fields()
_ = commentMixinFields0
commentFields := schema.Comment{}.Fields()
_ = commentFields
// commentDescCreatedAt is the schema descriptor for created_at field.
commentDescCreatedAt := commentMixinFields0[1].Descriptor()
// comment.DefaultCreatedAt holds the default value on creation for the created_at field.
comment.DefaultCreatedAt = commentDescCreatedAt.Default.(func() time.Time)
// commentDescUpdatedAt is the schema descriptor for updated_at field.
commentDescUpdatedAt := commentMixinFields0[2].Descriptor()
// comment.DefaultUpdatedAt holds the default value on creation for the updated_at field.
comment.DefaultUpdatedAt = commentDescUpdatedAt.Default.(func() time.Time)
// comment.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
comment.UpdateDefaultUpdatedAt = commentDescUpdatedAt.UpdateDefault.(func() time.Time)
// commentDescTitle is the schema descriptor for title field.
commentDescTitle := commentFields[0].Descriptor()
// comment.DefaultTitle holds the default value on creation for the title field.
comment.DefaultTitle = commentDescTitle.Default.(string)
// commentDescContent is the schema descriptor for content field.
commentDescContent := commentFields[1].Descriptor()
// comment.DefaultContent holds the default value on creation for the content field.
comment.DefaultContent = commentDescContent.Default.(string)
// commentDescMemberId is the schema descriptor for memberId field.
commentDescMemberId := commentFields[2].Descriptor()
// comment.MemberIdValidator is a validator for the "memberId" field. It is called by the builders before save.
comment.MemberIdValidator = commentDescMemberId.Validators[0].(func(string) error)
// commentDescCreateTime is the schema descriptor for create_time field.
commentDescCreateTime := commentFields[3].Descriptor()
// comment.DefaultCreateTime holds the default value on creation for the create_time field.
comment.DefaultCreateTime = commentDescCreateTime.Default.(time.Time)
// commentDescUpdateTime is the schema descriptor for update_time field.
commentDescUpdateTime := commentFields[4].Descriptor()
// comment.DefaultUpdateTime holds the default value on creation for the update_time field.
comment.DefaultUpdateTime = commentDescUpdateTime.Default.(time.Time)
// commentDescIsReply is the schema descriptor for is_reply field.
commentDescIsReply := commentFields[5].Descriptor()
// comment.DefaultIsReply holds the default value on creation for the is_reply field.
comment.DefaultIsReply = commentDescIsReply.Default.(bool)
memberMixin := schema.Member{}.Mixin()
memberMixinFields0 := memberMixin[0].Fields()
_ = memberMixinFields0
memberMixinFields1 := memberMixin[1].Fields()
_ = memberMixinFields1
memberFields := schema.Member{}.Fields()
_ = memberFields
// memberDescCreatedAt is the schema descriptor for created_at field.
memberDescCreatedAt := memberMixinFields0[1].Descriptor()
// member.DefaultCreatedAt holds the default value on creation for the created_at field.
member.DefaultCreatedAt = memberDescCreatedAt.Default.(func() time.Time)
// memberDescUpdatedAt is the schema descriptor for updated_at field.
memberDescUpdatedAt := memberMixinFields0[2].Descriptor()
// member.DefaultUpdatedAt holds the default value on creation for the updated_at field.
member.DefaultUpdatedAt = memberDescUpdatedAt.Default.(func() time.Time)
// member.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
member.UpdateDefaultUpdatedAt = memberDescUpdatedAt.UpdateDefault.(func() time.Time)
// memberDescStatus is the schema descriptor for status field.
memberDescStatus := memberMixinFields1[0].Descriptor()
// member.DefaultStatus holds the default value on creation for the status field.
member.DefaultStatus = memberDescStatus.Default.(uint8)
// memberDescRankID is the schema descriptor for rank_id field.
memberDescRankID := memberFields[4].Descriptor()
// member.DefaultRankID holds the default value on creation for the rank_id field.
member.DefaultRankID = memberDescRankID.Default.(uint64)
// memberDescAvatar is the schema descriptor for avatar field.
memberDescAvatar := memberFields[7].Descriptor()
// member.DefaultAvatar holds the default value on creation for the avatar field.
member.DefaultAvatar = memberDescAvatar.Default.(string)
// memberDescExpiredAt is the schema descriptor for expired_at field.
memberDescExpiredAt := memberFields[9].Descriptor()
// member.DefaultExpiredAt holds the default value on creation for the expired_at field.
member.DefaultExpiredAt = memberDescExpiredAt.Default.(time.Time)
// memberDescID is the schema descriptor for id field.
memberDescID := memberMixinFields0[0].Descriptor()
// member.DefaultID holds the default value on creation for the id field.
member.DefaultID = memberDescID.Default.(func() uuid.UUID)
memberrankMixin := schema.MemberRank{}.Mixin()
memberrankMixinFields0 := memberrankMixin[0].Fields()
_ = memberrankMixinFields0
memberrankFields := schema.MemberRank{}.Fields()
_ = memberrankFields
// memberrankDescCreatedAt is the schema descriptor for created_at field.
memberrankDescCreatedAt := memberrankMixinFields0[1].Descriptor()
// memberrank.DefaultCreatedAt holds the default value on creation for the created_at field.
memberrank.DefaultCreatedAt = memberrankDescCreatedAt.Default.(func() time.Time)
// memberrankDescUpdatedAt is the schema descriptor for updated_at field.
memberrankDescUpdatedAt := memberrankMixinFields0[2].Descriptor()
// memberrank.DefaultUpdatedAt holds the default value on creation for the updated_at field.
memberrank.DefaultUpdatedAt = memberrankDescUpdatedAt.Default.(func() time.Time)
// memberrank.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
memberrank.UpdateDefaultUpdatedAt = memberrankDescUpdatedAt.UpdateDefault.(func() time.Time)
oauthproviderMixin := schema.OauthProvider{}.Mixin()
oauthproviderMixinFields0 := oauthproviderMixin[0].Fields()
_ = oauthproviderMixinFields0
oauthproviderFields := schema.OauthProvider{}.Fields()
_ = oauthproviderFields
// oauthproviderDescCreatedAt is the schema descriptor for created_at field.
oauthproviderDescCreatedAt := oauthproviderMixinFields0[1].Descriptor()
// oauthprovider.DefaultCreatedAt holds the default value on creation for the created_at field.
oauthprovider.DefaultCreatedAt = oauthproviderDescCreatedAt.Default.(func() time.Time)
// oauthproviderDescUpdatedAt is the schema descriptor for updated_at field.
oauthproviderDescUpdatedAt := oauthproviderMixinFields0[2].Descriptor()
// oauthprovider.DefaultUpdatedAt holds the default value on creation for the updated_at field.
oauthprovider.DefaultUpdatedAt = oauthproviderDescUpdatedAt.Default.(func() time.Time)
// oauthprovider.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
oauthprovider.UpdateDefaultUpdatedAt = oauthproviderDescUpdatedAt.UpdateDefault.(func() time.Time)
replyMixin := schema.Reply{}.Mixin()
replyMixinFields0 := replyMixin[0].Fields()
_ = replyMixinFields0
replyFields := schema.Reply{}.Fields()
_ = replyFields
// replyDescCreatedAt is the schema descriptor for created_at field.
replyDescCreatedAt := replyMixinFields0[1].Descriptor()
// reply.DefaultCreatedAt holds the default value on creation for the created_at field.
reply.DefaultCreatedAt = replyDescCreatedAt.Default.(func() time.Time)
// replyDescUpdatedAt is the schema descriptor for updated_at field.
replyDescUpdatedAt := replyMixinFields0[2].Descriptor()
// reply.DefaultUpdatedAt holds the default value on creation for the updated_at field.
reply.DefaultUpdatedAt = replyDescUpdatedAt.Default.(func() time.Time)
// reply.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
reply.UpdateDefaultUpdatedAt = replyDescUpdatedAt.UpdateDefault.(func() time.Time)
// replyDescAdminId is the schema descriptor for adminId field.
replyDescAdminId := replyFields[2].Descriptor()
// reply.AdminIdValidator is a validator for the "adminId" field. It is called by the builders before save.
reply.AdminIdValidator = replyDescAdminId.Validators[0].(func(string) error)
// replyDescCreateTime is the schema descriptor for create_time field.
replyDescCreateTime := replyFields[4].Descriptor()
// reply.DefaultCreateTime holds the default value on creation for the create_time field.
reply.DefaultCreateTime = replyDescCreateTime.Default.(time.Time)
// replyDescUpdateTime is the schema descriptor for update_time field.
replyDescUpdateTime := replyFields[5].Descriptor()
// reply.DefaultUpdateTime holds the default value on creation for the update_time field.
reply.DefaultUpdateTime = replyDescUpdateTime.Default.(time.Time)
tokenMixin := schema.Token{}.Mixin()
tokenMixinFields0 := tokenMixin[0].Fields()
_ = tokenMixinFields0
tokenMixinFields1 := tokenMixin[1].Fields()
_ = tokenMixinFields1
tokenFields := schema.Token{}.Fields()
_ = tokenFields
// tokenDescCreatedAt is the schema descriptor for created_at field.
tokenDescCreatedAt := tokenMixinFields0[1].Descriptor()
// token.DefaultCreatedAt holds the default value on creation for the created_at field.
token.DefaultCreatedAt = tokenDescCreatedAt.Default.(func() time.Time)
// tokenDescUpdatedAt is the schema descriptor for updated_at field.
tokenDescUpdatedAt := tokenMixinFields0[2].Descriptor()
// token.DefaultUpdatedAt holds the default value on creation for the updated_at field.
token.DefaultUpdatedAt = tokenDescUpdatedAt.Default.(func() time.Time)
// token.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
token.UpdateDefaultUpdatedAt = tokenDescUpdatedAt.UpdateDefault.(func() time.Time)
// tokenDescStatus is the schema descriptor for status field.
tokenDescStatus := tokenMixinFields1[0].Descriptor()
// token.DefaultStatus holds the default value on creation for the status field.
token.DefaultStatus = tokenDescStatus.Default.(uint8)
// tokenDescUsername is the schema descriptor for username field.
tokenDescUsername := tokenFields[2].Descriptor()
// token.DefaultUsername holds the default value on creation for the username field.
token.DefaultUsername = tokenDescUsername.Default.(string)
// tokenDescID is the schema descriptor for id field.
tokenDescID := tokenMixinFields0[0].Descriptor()
// token.DefaultID holds the default value on creation for the id field.
token.DefaultID = tokenDescID.Default.(func() uuid.UUID)
}