1
0
api/ent/runtime.go
2023-04-06 12:39:26 +09:00

71 lines
2.9 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"t/ent/card"
"t/ent/schema"
"t/ent/user"
"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() {
cardFields := schema.Card{}.Fields()
_ = cardFields
// cardDescCard is the schema descriptor for card field.
cardDescCard := cardFields[0].Descriptor()
// 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.
cardDescStatus := cardFields[1].Descriptor()
// 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.
cardDescCp := cardFields[2].Descriptor()
// 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.
cardDescURL := cardFields[3].Descriptor()
// 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.
cardDescCreatedAt := cardFields[4].Descriptor()
// card.DefaultCreatedAt holds the default value on creation for the created_at field.
card.DefaultCreatedAt = cardDescCreatedAt.Default.(func() time.Time)
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
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(username string) error {
for _, fn := range fns {
if err := fn(username); err != nil {
return err
}
}
return nil
}
}()
// userDescCreatedAt is the schema descriptor for created_at field.
userDescCreatedAt := userFields[1].Descriptor()
// 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.
userDescUpdatedAt := userFields[2].Descriptor()
// 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.
userDescNext := userFields[3].Descriptor()
// user.DefaultNext holds the default value on creation for the next field.
user.DefaultNext = userDescNext.Default.(string)
}