Files
validator/OmCTF-2025/services/block_game/backend/codegen/ent/runtime.go

63 lines
2.6 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"time"
"omctf.ru/block-game-backend/codegen/ent/level"
"omctf.ru/block-game-backend/codegen/ent/setting"
"omctf.ru/block-game-backend/codegen/ent/user"
"omctf.ru/block-game-backend/schema"
)
// 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() {
levelFields := schema.Level{}.Fields()
_ = levelFields
// levelDescName is the schema descriptor for name field.
levelDescName := levelFields[0].Descriptor()
// level.NameValidator is a validator for the "name" field. It is called by the builders before save.
level.NameValidator = levelDescName.Validators[0].(func(string) error)
// levelDescCreatedAt is the schema descriptor for createdAt field.
levelDescCreatedAt := levelFields[5].Descriptor()
// level.DefaultCreatedAt holds the default value on creation for the createdAt field.
level.DefaultCreatedAt = levelDescCreatedAt.Default.(func() time.Time)
settingFields := schema.Setting{}.Fields()
_ = settingFields
// settingDescKey is the schema descriptor for key field.
settingDescKey := settingFields[0].Descriptor()
// setting.KeyValidator is a validator for the "key" field. It is called by the builders before save.
setting.KeyValidator = settingDescKey.Validators[0].(func(string) error)
// settingDescValue is the schema descriptor for value field.
settingDescValue := settingFields[1].Descriptor()
// setting.ValueValidator is a validator for the "value" field. It is called by the builders before save.
setting.ValueValidator = settingDescValue.Validators[0].(func(string) error)
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 = userDescUsername.Validators[0].(func(string) error)
// userDescPassword is the schema descriptor for password field.
userDescPassword := userFields[1].Descriptor()
// user.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
user.PasswordValidator = func() func(string) error {
validators := userDescPassword.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(password string) error {
for _, fn := range fns {
if err := fn(password); err != nil {
return err
}
}
return nil
}
}()
}