180 lines
10 KiB
Go
180 lines
10 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gitserver.in/patialtech/rano/db/ent/accesscontrol"
|
|
"gitserver.in/patialtech/rano/db/ent/audit"
|
|
"gitserver.in/patialtech/rano/db/ent/schema"
|
|
"gitserver.in/patialtech/rano/db/ent/user"
|
|
"gitserver.in/patialtech/rano/db/ent/usersession"
|
|
)
|
|
|
|
// 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() {
|
|
accesscontrolFields := schema.AccessControl{}.Fields()
|
|
_ = accesscontrolFields
|
|
// accesscontrolDescCreatedAt is the schema descriptor for created_at field.
|
|
accesscontrolDescCreatedAt := accesscontrolFields[1].Descriptor()
|
|
// accesscontrol.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
accesscontrol.DefaultCreatedAt = accesscontrolDescCreatedAt.Default.(func() time.Time)
|
|
// accesscontrolDescUpdatedAt is the schema descriptor for updated_at field.
|
|
accesscontrolDescUpdatedAt := accesscontrolFields[2].Descriptor()
|
|
// accesscontrol.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
|
accesscontrol.DefaultUpdatedAt = accesscontrolDescUpdatedAt.Default.(func() time.Time)
|
|
// accesscontrol.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
accesscontrol.UpdateDefaultUpdatedAt = accesscontrolDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
// accesscontrolDescPtype is the schema descriptor for ptype field.
|
|
accesscontrolDescPtype := accesscontrolFields[3].Descriptor()
|
|
// accesscontrol.DefaultPtype holds the default value on creation for the ptype field.
|
|
accesscontrol.DefaultPtype = accesscontrolDescPtype.Default.(string)
|
|
// accesscontrolDescV0 is the schema descriptor for v0 field.
|
|
accesscontrolDescV0 := accesscontrolFields[4].Descriptor()
|
|
// accesscontrol.DefaultV0 holds the default value on creation for the v0 field.
|
|
accesscontrol.DefaultV0 = accesscontrolDescV0.Default.(string)
|
|
// accesscontrolDescV1 is the schema descriptor for v1 field.
|
|
accesscontrolDescV1 := accesscontrolFields[5].Descriptor()
|
|
// accesscontrol.DefaultV1 holds the default value on creation for the v1 field.
|
|
accesscontrol.DefaultV1 = accesscontrolDescV1.Default.(string)
|
|
// accesscontrolDescV2 is the schema descriptor for v2 field.
|
|
accesscontrolDescV2 := accesscontrolFields[6].Descriptor()
|
|
// accesscontrol.DefaultV2 holds the default value on creation for the v2 field.
|
|
accesscontrol.DefaultV2 = accesscontrolDescV2.Default.(string)
|
|
// accesscontrolDescV3 is the schema descriptor for v3 field.
|
|
accesscontrolDescV3 := accesscontrolFields[7].Descriptor()
|
|
// accesscontrol.DefaultV3 holds the default value on creation for the v3 field.
|
|
accesscontrol.DefaultV3 = accesscontrolDescV3.Default.(string)
|
|
// accesscontrolDescV4 is the schema descriptor for v4 field.
|
|
accesscontrolDescV4 := accesscontrolFields[8].Descriptor()
|
|
// accesscontrol.DefaultV4 holds the default value on creation for the v4 field.
|
|
accesscontrol.DefaultV4 = accesscontrolDescV4.Default.(string)
|
|
// accesscontrolDescV5 is the schema descriptor for v5 field.
|
|
accesscontrolDescV5 := accesscontrolFields[9].Descriptor()
|
|
// accesscontrol.DefaultV5 holds the default value on creation for the v5 field.
|
|
accesscontrol.DefaultV5 = accesscontrolDescV5.Default.(string)
|
|
auditFields := schema.Audit{}.Fields()
|
|
_ = auditFields
|
|
// auditDescCreatedAt is the schema descriptor for created_at field.
|
|
auditDescCreatedAt := auditFields[1].Descriptor()
|
|
// audit.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
audit.DefaultCreatedAt = auditDescCreatedAt.Default.(func() time.Time)
|
|
// auditDescEntName is the schema descriptor for ent_name field.
|
|
auditDescEntName := auditFields[2].Descriptor()
|
|
// audit.EntNameValidator is a validator for the "ent_name" field. It is called by the builders before save.
|
|
audit.EntNameValidator = auditDescEntName.Validators[0].(func(string) error)
|
|
// auditDescEntID is the schema descriptor for ent_id field.
|
|
auditDescEntID := auditFields[3].Descriptor()
|
|
// audit.EntIDValidator is a validator for the "ent_id" field. It is called by the builders before save.
|
|
audit.EntIDValidator = auditDescEntID.Validators[0].(func(int64) error)
|
|
// auditDescDescription is the schema descriptor for description field.
|
|
auditDescDescription := auditFields[5].Descriptor()
|
|
// audit.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
|
|
audit.DescriptionValidator = auditDescDescription.Validators[0].(func(string) error)
|
|
// auditDescIP is the schema descriptor for ip field.
|
|
auditDescIP := auditFields[6].Descriptor()
|
|
// audit.IPValidator is a validator for the "ip" field. It is called by the builders before save.
|
|
audit.IPValidator = auditDescIP.Validators[0].(func(string) error)
|
|
// auditDescUserName is the schema descriptor for user_name field.
|
|
auditDescUserName := auditFields[7].Descriptor()
|
|
// audit.UserNameValidator is a validator for the "user_name" field. It is called by the builders before save.
|
|
audit.UserNameValidator = auditDescUserName.Validators[0].(func(string) error)
|
|
userFields := schema.User{}.Fields()
|
|
_ = userFields
|
|
// 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)
|
|
// user.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
|
user.UpdateDefaultUpdatedAt = userDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
// userDescEmail is the schema descriptor for email field.
|
|
userDescEmail := userFields[3].Descriptor()
|
|
// user.EmailValidator is a validator for the "email" field. It is called by the builders before save.
|
|
user.EmailValidator = userDescEmail.Validators[0].(func(string) error)
|
|
// userDescEmailVerified is the schema descriptor for email_verified field.
|
|
userDescEmailVerified := userFields[4].Descriptor()
|
|
// user.DefaultEmailVerified holds the default value on creation for the email_verified field.
|
|
user.DefaultEmailVerified = userDescEmailVerified.Default.(bool)
|
|
// userDescPhone is the schema descriptor for phone field.
|
|
userDescPhone := userFields[5].Descriptor()
|
|
// user.PhoneValidator is a validator for the "phone" field. It is called by the builders before save.
|
|
user.PhoneValidator = userDescPhone.Validators[0].(func(string) error)
|
|
// userDescPhoneVerified is the schema descriptor for phone_verified field.
|
|
userDescPhoneVerified := userFields[6].Descriptor()
|
|
// user.DefaultPhoneVerified holds the default value on creation for the phone_verified field.
|
|
user.DefaultPhoneVerified = userDescPhoneVerified.Default.(bool)
|
|
// userDescPwdSalt is the schema descriptor for pwd_salt field.
|
|
userDescPwdSalt := userFields[7].Descriptor()
|
|
// user.PwdSaltValidator is a validator for the "pwd_salt" field. It is called by the builders before save.
|
|
user.PwdSaltValidator = func() func(string) error {
|
|
validators := userDescPwdSalt.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(pwd_salt string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(pwd_salt); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// userDescPwdHash is the schema descriptor for pwd_hash field.
|
|
userDescPwdHash := userFields[8].Descriptor()
|
|
// user.PwdHashValidator is a validator for the "pwd_hash" field. It is called by the builders before save.
|
|
user.PwdHashValidator = func() func(string) error {
|
|
validators := userDescPwdHash.Validators
|
|
fns := [...]func(string) error{
|
|
validators[0].(func(string) error),
|
|
validators[1].(func(string) error),
|
|
}
|
|
return func(pwd_hash string) error {
|
|
for _, fn := range fns {
|
|
if err := fn(pwd_hash); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
}()
|
|
// userDescLoginFailedCount is the schema descriptor for login_failed_count field.
|
|
userDescLoginFailedCount := userFields[9].Descriptor()
|
|
// user.DefaultLoginFailedCount holds the default value on creation for the login_failed_count field.
|
|
user.DefaultLoginFailedCount = userDescLoginFailedCount.Default.(uint8)
|
|
// userDescFirstName is the schema descriptor for first_name field.
|
|
userDescFirstName := userFields[12].Descriptor()
|
|
// user.FirstNameValidator is a validator for the "first_name" field. It is called by the builders before save.
|
|
user.FirstNameValidator = userDescFirstName.Validators[0].(func(string) error)
|
|
// userDescMiddleName is the schema descriptor for middle_name field.
|
|
userDescMiddleName := userFields[13].Descriptor()
|
|
// user.MiddleNameValidator is a validator for the "middle_name" field. It is called by the builders before save.
|
|
user.MiddleNameValidator = userDescMiddleName.Validators[0].(func(string) error)
|
|
// userDescLastName is the schema descriptor for last_name field.
|
|
userDescLastName := userFields[14].Descriptor()
|
|
// user.LastNameValidator is a validator for the "last_name" field. It is called by the builders before save.
|
|
user.LastNameValidator = userDescLastName.Validators[0].(func(string) error)
|
|
usersessionFields := schema.UserSession{}.Fields()
|
|
_ = usersessionFields
|
|
// usersessionDescInvalidated is the schema descriptor for invalidated field.
|
|
usersessionDescInvalidated := usersessionFields[3].Descriptor()
|
|
// usersession.DefaultInvalidated holds the default value on creation for the invalidated field.
|
|
usersession.DefaultInvalidated = usersessionDescInvalidated.Default.(bool)
|
|
// usersessionDescUserAgent is the schema descriptor for user_agent field.
|
|
usersessionDescUserAgent := usersessionFields[4].Descriptor()
|
|
// usersession.UserAgentValidator is a validator for the "user_agent" field. It is called by the builders before save.
|
|
usersession.UserAgentValidator = usersessionDescUserAgent.Validators[0].(func(string) error)
|
|
// usersessionDescIP is the schema descriptor for ip field.
|
|
usersessionDescIP := usersessionFields[5].Descriptor()
|
|
// usersession.IPValidator is a validator for the "ip" field. It is called by the builders before save.
|
|
usersession.IPValidator = usersessionDescIP.Validators[0].(func(string) error)
|
|
}
|