personal-site/ent/runtime/runtime.go

76 lines
3.4 KiB
Go

// Code generated by ent, DO NOT EDIT.
package runtime
import (
"time"
"github.com/camzawacki/personal-site/ent/passwordtoken"
"github.com/camzawacki/personal-site/ent/schema"
"github.com/camzawacki/personal-site/ent/user"
)
// 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() {
passwordtokenHooks := schema.PasswordToken{}.Hooks()
passwordtoken.Hooks[0] = passwordtokenHooks[0]
passwordtokenFields := schema.PasswordToken{}.Fields()
_ = passwordtokenFields
// passwordtokenDescToken is the schema descriptor for token field.
passwordtokenDescToken := passwordtokenFields[0].Descriptor()
// passwordtoken.TokenValidator is a validator for the "token" field. It is called by the builders before save.
passwordtoken.TokenValidator = passwordtokenDescToken.Validators[0].(func(string) error)
// passwordtokenDescCreatedAt is the schema descriptor for created_at field.
passwordtokenDescCreatedAt := passwordtokenFields[2].Descriptor()
// passwordtoken.DefaultCreatedAt holds the default value on creation for the created_at field.
passwordtoken.DefaultCreatedAt = passwordtokenDescCreatedAt.Default.(func() time.Time)
userHooks := schema.User{}.Hooks()
user.Hooks[0] = userHooks[0]
userFields := schema.User{}.Fields()
_ = userFields
// userDescName is the schema descriptor for name field.
userDescName := userFields[0].Descriptor()
// user.NameValidator is a validator for the "name" field. It is called by the builders before save.
user.NameValidator = userDescName.Validators[0].(func(string) error)
// userDescEmail is the schema descriptor for email field.
userDescEmail := userFields[1].Descriptor()
// user.EmailValidator is a validator for the "email" field. It is called by the builders before save.
user.EmailValidator = func() func(string) error {
validators := userDescEmail.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(email string) error {
for _, fn := range fns {
if err := fn(email); err != nil {
return err
}
}
return nil
}
}()
// userDescPassword is the schema descriptor for password field.
userDescPassword := userFields[2].Descriptor()
// 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)
// userDescVerified is the schema descriptor for verified field.
userDescVerified := userFields[3].Descriptor()
// user.DefaultVerified holds the default value on creation for the verified field.
user.DefaultVerified = userDescVerified.Default.(bool)
// userDescAdmin is the schema descriptor for admin field.
userDescAdmin := userFields[4].Descriptor()
// user.DefaultAdmin holds the default value on creation for the admin field.
user.DefaultAdmin = userDescAdmin.Default.(bool)
// userDescCreatedAt is the schema descriptor for created_at field.
userDescCreatedAt := userFields[5].Descriptor()
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)
}
const (
Version = "v0.14.5" // Version of ent codegen.
Sum = "h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=" // Sum of ent codegen.
)