// Code generated by ent, DO NOT EDIT. package user import ( "fmt" "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" ) 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" // FieldEmail holds the string denoting the email field in the database. FieldEmail = "email" // FieldEmailVerified holds the string denoting the email_verified field in the database. FieldEmailVerified = "email_verified" // FieldPhone holds the string denoting the phone field in the database. FieldPhone = "phone" // FieldPhoneVerified holds the string denoting the phone_verified field in the database. FieldPhoneVerified = "phone_verified" // FieldPwdSalt holds the string denoting the pwd_salt field in the database. FieldPwdSalt = "pwd_salt" // FieldPwdHash holds the string denoting the pwd_hash field in the database. FieldPwdHash = "pwd_hash" // FieldLoginFailedCount holds the string denoting the login_failed_count field in the database. FieldLoginFailedCount = "login_failed_count" // FieldLoginAttemptOn holds the string denoting the login_attempt_on field in the database. FieldLoginAttemptOn = "login_attempt_on" // FieldLoginLockedUntil holds the string denoting the login_locked_until field in the database. FieldLoginLockedUntil = "login_locked_until" // FieldFirstName holds the string denoting the first_name field in the database. FieldFirstName = "first_name" // FieldMiddleName holds the string denoting the middle_name field in the database. FieldMiddleName = "middle_name" // FieldLastName holds the string denoting the last_name field in the database. FieldLastName = "last_name" // FieldStatus holds the string denoting the status field in the database. FieldStatus = "status" // EdgeSessions holds the string denoting the sessions edge name in mutations. EdgeSessions = "sessions" // EdgeAuditLogs holds the string denoting the audit_logs edge name in mutations. EdgeAuditLogs = "audit_logs" // EdgeVerifyTokens holds the string denoting the verify_tokens edge name in mutations. EdgeVerifyTokens = "verify_tokens" // Table holds the table name of the user in the database. Table = "users" // SessionsTable is the table that holds the sessions relation/edge. SessionsTable = "user_sessions" // SessionsInverseTable is the table name for the UserSession entity. // It exists in this package in order to avoid circular dependency with the "usersession" package. SessionsInverseTable = "user_sessions" // SessionsColumn is the table column denoting the sessions relation/edge. SessionsColumn = "user_id" // AuditLogsTable is the table that holds the audit_logs relation/edge. AuditLogsTable = "audits" // AuditLogsInverseTable is the table name for the Audit entity. // It exists in this package in order to avoid circular dependency with the "audit" package. AuditLogsInverseTable = "audits" // AuditLogsColumn is the table column denoting the audit_logs relation/edge. AuditLogsColumn = "user_id" // VerifyTokensTable is the table that holds the verify_tokens relation/edge. VerifyTokensTable = "verify_tokens" // VerifyTokensInverseTable is the table name for the VerifyToken entity. // It exists in this package in order to avoid circular dependency with the "verifytoken" package. VerifyTokensInverseTable = "verify_tokens" // VerifyTokensColumn is the table column denoting the verify_tokens relation/edge. VerifyTokensColumn = "user_id" ) // Columns holds all SQL columns for user fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, FieldEmail, FieldEmailVerified, FieldPhone, FieldPhoneVerified, FieldPwdSalt, FieldPwdHash, FieldLoginFailedCount, FieldLoginAttemptOn, FieldLoginLockedUntil, FieldFirstName, FieldMiddleName, FieldLastName, FieldStatus, } // 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 // EmailValidator is a validator for the "email" field. It is called by the builders before save. EmailValidator func(string) error // DefaultEmailVerified holds the default value on creation for the "email_verified" field. DefaultEmailVerified bool // PhoneValidator is a validator for the "phone" field. It is called by the builders before save. PhoneValidator func(string) error // DefaultPhoneVerified holds the default value on creation for the "phone_verified" field. DefaultPhoneVerified bool // PwdSaltValidator is a validator for the "pwd_salt" field. It is called by the builders before save. PwdSaltValidator func(string) error // PwdHashValidator is a validator for the "pwd_hash" field. It is called by the builders before save. PwdHashValidator func(string) error // DefaultLoginFailedCount holds the default value on creation for the "login_failed_count" field. DefaultLoginFailedCount uint8 // FirstNameValidator is a validator for the "first_name" field. It is called by the builders before save. FirstNameValidator func(string) error // MiddleNameValidator is a validator for the "middle_name" field. It is called by the builders before save. MiddleNameValidator func(string) error // LastNameValidator is a validator for the "last_name" field. It is called by the builders before save. LastNameValidator func(string) error ) // Status defines the type for the "status" enum field. type Status string // StatusPending is the default value of the Status enum. const DefaultStatus = StatusPending // Status values. const ( StatusPending Status = "Pending" StatusActive Status = "Active" StatusInActive Status = "InActive" ) func (s Status) String() string { return string(s) } // StatusValidator is a validator for the "status" field enum values. It is called by the builders before save. func StatusValidator(s Status) error { switch s { case StatusPending, StatusActive, StatusInActive: return nil default: return fmt.Errorf("user: invalid enum value for status field: %q", s) } } // 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() } // ByEmail orders the results by the email field. func ByEmail(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldEmail, opts...).ToFunc() } // ByEmailVerified orders the results by the email_verified field. func ByEmailVerified(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldEmailVerified, opts...).ToFunc() } // ByPhone orders the results by the phone field. func ByPhone(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPhone, opts...).ToFunc() } // ByPhoneVerified orders the results by the phone_verified field. func ByPhoneVerified(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPhoneVerified, opts...).ToFunc() } // ByPwdSalt orders the results by the pwd_salt field. func ByPwdSalt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPwdSalt, opts...).ToFunc() } // ByPwdHash orders the results by the pwd_hash field. func ByPwdHash(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPwdHash, opts...).ToFunc() } // ByLoginFailedCount orders the results by the login_failed_count field. func ByLoginFailedCount(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginFailedCount, opts...).ToFunc() } // ByLoginAttemptOn orders the results by the login_attempt_on field. func ByLoginAttemptOn(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginAttemptOn, opts...).ToFunc() } // ByLoginLockedUntil orders the results by the login_locked_until field. func ByLoginLockedUntil(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginLockedUntil, opts...).ToFunc() } // ByFirstName orders the results by the first_name field. func ByFirstName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldFirstName, opts...).ToFunc() } // ByMiddleName orders the results by the middle_name field. func ByMiddleName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMiddleName, opts...).ToFunc() } // ByLastName orders the results by the last_name field. func ByLastName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLastName, opts...).ToFunc() } // ByStatus orders the results by the status field. func ByStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStatus, opts...).ToFunc() } // BySessionsCount orders the results by sessions count. func BySessionsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newSessionsStep(), opts...) } } // BySessions orders the results by sessions terms. func BySessions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSessionsStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByAuditLogsCount orders the results by audit_logs count. func ByAuditLogsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newAuditLogsStep(), opts...) } } // ByAuditLogs orders the results by audit_logs terms. func ByAuditLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newAuditLogsStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByVerifyTokensCount orders the results by verify_tokens count. func ByVerifyTokensCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newVerifyTokensStep(), opts...) } } // ByVerifyTokens orders the results by verify_tokens terms. func ByVerifyTokens(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newVerifyTokensStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newSessionsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SessionsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, SessionsTable, SessionsColumn), ) } func newAuditLogsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(AuditLogsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, AuditLogsTable, AuditLogsColumn), ) } func newVerifyTokensStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(VerifyTokensInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, VerifyTokensTable, VerifyTokensColumn), ) }