// Code generated by ent, DO NOT EDIT. package user import ( "fmt" "time" "entgo.io/ent/dialect/sql" ) const ( // Label holds the string label denoting the user type in the database. Label = "user" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // FieldStatus holds the string denoting the status field in the database. FieldStatus = "status" // FieldTenantID holds the string denoting the tenant_id field in the database. FieldTenantID = "tenant_id" // FieldDeletedAt holds the string denoting the deleted_at field in the database. FieldDeletedAt = "deleted_at" // FieldUsername holds the string denoting the username field in the database. FieldUsername = "username" // FieldEmail holds the string denoting the email field in the database. FieldEmail = "email" // FieldMobile holds the string denoting the mobile field in the database. FieldMobile = "mobile" // FieldPasswordHash holds the string denoting the password_hash field in the database. FieldPasswordHash = "password_hash" // FieldSalt holds the string denoting the salt field in the database. FieldSalt = "salt" // FieldNickname holds the string denoting the nickname field in the database. FieldNickname = "nickname" // FieldAvatar holds the string denoting the avatar field in the database. FieldAvatar = "avatar" // FieldGender holds the string denoting the gender field in the database. FieldGender = "gender" // FieldBirthday holds the string denoting the birthday field in the database. FieldBirthday = "birthday" // FieldAccountStatus holds the string denoting the account_status field in the database. FieldAccountStatus = "account_status" // FieldIsVerified holds the string denoting the is_verified field in the database. FieldIsVerified = "is_verified" // FieldRegisteredLoginIP holds the string denoting the registered_login_ip field in the database. FieldRegisteredLoginIP = "registered_login_ip" // FieldLoginAttempts holds the string denoting the login_attempts field in the database. FieldLoginAttempts = "login_attempts" // FieldMetadata holds the string denoting the metadata field in the database. FieldMetadata = "metadata" // FieldRegistrationSource holds the string denoting the registration_source field in the database. FieldRegistrationSource = "registration_source" // Table holds the table name of the user in the database. Table = "user" ) // Columns holds all SQL columns for user fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, FieldStatus, FieldTenantID, FieldDeletedAt, FieldUsername, FieldEmail, FieldMobile, FieldPasswordHash, FieldSalt, FieldNickname, FieldAvatar, FieldGender, FieldBirthday, FieldAccountStatus, FieldIsVerified, FieldRegisteredLoginIP, FieldLoginAttempts, FieldMetadata, FieldRegistrationSource, } // ValidColumn reports if the column name is valid (part of the table columns). func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } return false } var ( // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. DefaultUpdatedAt func() time.Time // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. UpdateDefaultUpdatedAt func() time.Time // DefaultStatus holds the default value on creation for the "status" field. DefaultStatus uint8 // DefaultTenantID holds the default value on creation for the "tenant_id" field. DefaultTenantID uint64 // UsernameValidator is a validator for the "username" field. It is called by the builders before save. UsernameValidator func(string) error // EmailValidator is a validator for the "email" field. It is called by the builders before save. EmailValidator func(string) error // MobileValidator is a validator for the "mobile" field. It is called by the builders before save. MobileValidator func(string) error // PasswordHashValidator is a validator for the "password_hash" field. It is called by the builders before save. PasswordHashValidator func(string) error // SaltValidator is a validator for the "salt" field. It is called by the builders before save. SaltValidator func(string) error // DefaultNickname holds the default value on creation for the "nickname" field. DefaultNickname string // NicknameValidator is a validator for the "nickname" field. It is called by the builders before save. NicknameValidator func(string) error // AvatarValidator is a validator for the "avatar" field. It is called by the builders before save. AvatarValidator func(string) error // DefaultIsVerified holds the default value on creation for the "is_verified" field. DefaultIsVerified uint32 // RegisteredLoginIPValidator is a validator for the "registered_login_ip" field. It is called by the builders before save. RegisteredLoginIPValidator func(string) error // DefaultLoginAttempts holds the default value on creation for the "login_attempts" field. DefaultLoginAttempts int64 // RegistrationSourceValidator is a validator for the "registration_source" field. It is called by the builders before save. RegistrationSourceValidator func(string) error ) // Gender defines the type for the "gender" enum field. type Gender string // GenderUnknown is the default value of the Gender enum. const DefaultGender = GenderUnknown // Gender values. const ( GenderUnknown Gender = "unknown" GenderMale Gender = "male" GenderFemale Gender = "female" GenderOther Gender = "other" ) func (ge Gender) String() string { return string(ge) } // GenderValidator is a validator for the "gender" field enum values. It is called by the builders before save. func GenderValidator(ge Gender) error { switch ge { case GenderUnknown, GenderMale, GenderFemale, GenderOther: return nil default: return fmt.Errorf("user: invalid enum value for gender field: %q", ge) } } // AccountStatus defines the type for the "account_status" enum field. type AccountStatus string // AccountStatusUnverified is the default value of the AccountStatus enum. const DefaultAccountStatus = AccountStatusUnverified // AccountStatus values. const ( AccountStatusUnverified AccountStatus = "unverified" AccountStatusActive AccountStatus = "active" AccountStatusLocked AccountStatus = "locked" AccountStatusDisabled AccountStatus = "disabled" ) func (as AccountStatus) String() string { return string(as) } // AccountStatusValidator is a validator for the "account_status" field enum values. It is called by the builders before save. func AccountStatusValidator(as AccountStatus) error { switch as { case AccountStatusUnverified, AccountStatusActive, AccountStatusLocked, AccountStatusDisabled: return nil default: return fmt.Errorf("user: invalid enum value for account_status field: %q", as) } } // OrderOption defines the ordering options for the User queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } // ByUpdatedAt orders the results by the updated_at field. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() } // ByStatus orders the results by the status field. func ByStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStatus, opts...).ToFunc() } // ByTenantID orders the results by the tenant_id field. func ByTenantID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldTenantID, opts...).ToFunc() } // ByDeletedAt orders the results by the deleted_at field. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDeletedAt, opts...).ToFunc() } // ByUsername orders the results by the username field. func ByUsername(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUsername, opts...).ToFunc() } // ByEmail orders the results by the email field. func ByEmail(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldEmail, opts...).ToFunc() } // ByMobile orders the results by the mobile field. func ByMobile(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMobile, opts...).ToFunc() } // ByPasswordHash orders the results by the password_hash field. func ByPasswordHash(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPasswordHash, opts...).ToFunc() } // BySalt orders the results by the salt field. func BySalt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSalt, opts...).ToFunc() } // ByNickname orders the results by the nickname field. func ByNickname(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldNickname, opts...).ToFunc() } // ByAvatar orders the results by the avatar field. func ByAvatar(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAvatar, opts...).ToFunc() } // ByGender orders the results by the gender field. func ByGender(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldGender, opts...).ToFunc() } // ByBirthday orders the results by the birthday field. func ByBirthday(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldBirthday, opts...).ToFunc() } // ByAccountStatus orders the results by the account_status field. func ByAccountStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAccountStatus, opts...).ToFunc() } // ByIsVerified orders the results by the is_verified field. func ByIsVerified(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldIsVerified, opts...).ToFunc() } // ByRegisteredLoginIP orders the results by the registered_login_ip field. func ByRegisteredLoginIP(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldRegisteredLoginIP, opts...).ToFunc() } // ByLoginAttempts orders the results by the login_attempts field. func ByLoginAttempts(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginAttempts, opts...).ToFunc() } // ByRegistrationSource orders the results by the registration_source field. func ByRegistrationSource(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldRegistrationSource, opts...).ToFunc() }