2022-08-31 07:49:08 +00:00
|
|
|
// Code generated by ent, DO NOT EDIT.
|
2022-08-31 06:18:14 +00:00
|
|
|
|
|
|
|
package ent
|
|
|
|
|
|
|
|
import (
|
2022-08-31 07:49:08 +00:00
|
|
|
"t/ent/card"
|
2023-04-05 06:05:14 +00:00
|
|
|
"t/ent/group"
|
2022-08-31 06:18:14 +00:00
|
|
|
"t/ent/schema"
|
2022-08-31 07:49:08 +00:00
|
|
|
"t/ent/user"
|
2022-08-31 06:18:14 +00:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 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() {
|
2022-08-31 07:49:08 +00:00
|
|
|
cardFields := schema.Card{}.Fields()
|
|
|
|
_ = cardFields
|
2023-04-05 06:05:14 +00:00
|
|
|
// cardDescPassword is the schema descriptor for password field.
|
|
|
|
cardDescPassword := cardFields[0].Descriptor()
|
|
|
|
// card.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
|
|
card.PasswordValidator = cardDescPassword.Validators[0].(func(string) error)
|
2022-08-31 07:49:08 +00:00
|
|
|
// cardDescCard is the schema descriptor for card field.
|
2023-04-05 06:05:14 +00:00
|
|
|
cardDescCard := cardFields[1].Descriptor()
|
2022-08-31 07:49:08 +00:00
|
|
|
// card.DefaultCard holds the default value on creation for the card field.
|
|
|
|
card.DefaultCard = cardDescCard.Default.(func() int)
|
|
|
|
// cardDescStatus is the schema descriptor for status field.
|
2023-04-05 06:05:14 +00:00
|
|
|
cardDescStatus := cardFields[2].Descriptor()
|
2022-08-31 07:49:08 +00:00
|
|
|
// card.DefaultStatus holds the default value on creation for the status field.
|
|
|
|
card.DefaultStatus = cardDescStatus.Default.(func() string)
|
|
|
|
// cardDescCp is the schema descriptor for cp field.
|
2023-04-05 06:05:14 +00:00
|
|
|
cardDescCp := cardFields[3].Descriptor()
|
2022-08-31 07:49:08 +00:00
|
|
|
// card.DefaultCp holds the default value on creation for the cp field.
|
|
|
|
card.DefaultCp = cardDescCp.Default.(func() int)
|
|
|
|
// cardDescURL is the schema descriptor for url field.
|
2023-04-05 06:05:14 +00:00
|
|
|
cardDescURL := cardFields[4].Descriptor()
|
2022-08-31 07:49:08 +00:00
|
|
|
// card.DefaultURL holds the default value on creation for the url field.
|
|
|
|
card.DefaultURL = cardDescURL.Default.(string)
|
|
|
|
// cardDescCreatedAt is the schema descriptor for created_at field.
|
2023-04-05 06:05:14 +00:00
|
|
|
cardDescCreatedAt := cardFields[5].Descriptor()
|
2022-08-31 07:49:08 +00:00
|
|
|
// card.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
|
|
card.DefaultCreatedAt = cardDescCreatedAt.Default.(func() time.Time)
|
2023-04-05 06:05:14 +00:00
|
|
|
groupFields := schema.Group{}.Fields()
|
|
|
|
_ = groupFields
|
|
|
|
// groupDescPassword is the schema descriptor for password field.
|
|
|
|
groupDescPassword := groupFields[1].Descriptor()
|
|
|
|
// group.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
|
|
group.PasswordValidator = groupDescPassword.Validators[0].(func(string) error)
|
2022-08-31 07:49:08 +00:00
|
|
|
userFields := schema.User{}.Fields()
|
|
|
|
_ = userFields
|
|
|
|
// userDescUsername is the schema descriptor for username field.
|
|
|
|
userDescUsername := userFields[0].Descriptor()
|
|
|
|
// user.UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
|
|
|
user.UsernameValidator = func() func(string) error {
|
|
|
|
validators := userDescUsername.Validators
|
2022-08-31 06:18:14 +00:00
|
|
|
fns := [...]func(string) error{
|
|
|
|
validators[0].(func(string) error),
|
|
|
|
validators[1].(func(string) error),
|
|
|
|
}
|
2022-08-31 07:49:08 +00:00
|
|
|
return func(username string) error {
|
2022-08-31 06:18:14 +00:00
|
|
|
for _, fn := range fns {
|
2022-08-31 07:49:08 +00:00
|
|
|
if err := fn(username); err != nil {
|
2022-08-31 06:18:14 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}()
|
2023-05-01 14:00:17 +00:00
|
|
|
// userDescDelete is the schema descriptor for delete field.
|
|
|
|
userDescDelete := userFields[2].Descriptor()
|
|
|
|
// user.DefaultDelete holds the default value on creation for the delete field.
|
|
|
|
user.DefaultDelete = userDescDelete.Default.(bool)
|
2023-04-05 06:05:14 +00:00
|
|
|
// userDescPassword is the schema descriptor for password field.
|
2023-05-01 14:00:17 +00:00
|
|
|
userDescPassword := userFields[4].Descriptor()
|
2023-04-05 06:05:14 +00:00
|
|
|
// user.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
|
|
user.PasswordValidator = userDescPassword.Validators[0].(func(string) error)
|
2022-08-31 07:49:08 +00:00
|
|
|
// userDescCreatedAt is the schema descriptor for created_at field.
|
2023-05-01 14:00:17 +00:00
|
|
|
userDescCreatedAt := userFields[5].Descriptor()
|
2022-08-31 07:49:08 +00:00
|
|
|
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
|
|
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)
|
|
|
|
// userDescUpdatedAt is the schema descriptor for updated_at field.
|
2023-05-01 14:00:17 +00:00
|
|
|
userDescUpdatedAt := userFields[6].Descriptor()
|
2022-08-31 07:49:08 +00:00
|
|
|
// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
|
|
user.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() time.Time)
|
|
|
|
// userDescNext is the schema descriptor for next field.
|
2023-05-01 14:00:17 +00:00
|
|
|
userDescNext := userFields[7].Descriptor()
|
2022-08-31 07:49:08 +00:00
|
|
|
// user.DefaultNext holds the default value on creation for the next field.
|
|
|
|
user.DefaultNext = userDescNext.Default.(string)
|
2022-08-31 06:18:14 +00:00
|
|
|
}
|