// Code generated by ent, DO NOT EDIT. package userloginlog import ( "fmt" "time" "entgo.io/ent/dialect/sql" ) const ( // Label holds the string label denoting the userloginlog type in the database. Label = "user_login_log" // 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" // FieldUserID holds the string denoting the user_id field in the database. FieldUserID = "user_id" // FieldLoginTime holds the string denoting the login_time field in the database. FieldLoginTime = "login_time" // FieldLoginIP holds the string denoting the login_ip field in the database. FieldLoginIP = "login_ip" // FieldLoginLocation holds the string denoting the login_location field in the database. FieldLoginLocation = "login_location" // FieldLoginType holds the string denoting the login_type field in the database. FieldLoginType = "login_type" // FieldLoginPlatform holds the string denoting the login_platform field in the database. FieldLoginPlatform = "login_platform" // FieldLoginResult holds the string denoting the login_result field in the database. FieldLoginResult = "login_result" // FieldFailureReason holds the string denoting the failure_reason field in the database. FieldFailureReason = "failure_reason" // FieldSessionID holds the string denoting the session_id field in the database. FieldSessionID = "session_id" // FieldLatencyMs holds the string denoting the latency_ms field in the database. FieldLatencyMs = "latency_ms" // FieldAuthID holds the string denoting the auth_id field in the database. FieldAuthID = "auth_id" // FieldAdditionalData holds the string denoting the additional_data field in the database. FieldAdditionalData = "additional_data" // Table holds the table name of the userloginlog in the database. Table = "user_login_logs" ) // Columns holds all SQL columns for userloginlog fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, FieldStatus, FieldTenantID, FieldDeletedAt, FieldUserID, FieldLoginTime, FieldLoginIP, FieldLoginLocation, FieldLoginType, FieldLoginPlatform, FieldLoginResult, FieldFailureReason, FieldSessionID, FieldLatencyMs, FieldAuthID, FieldAdditionalData, } // 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 // DefaultLoginTime holds the default value on creation for the "login_time" field. DefaultLoginTime func() time.Time // LoginIPValidator is a validator for the "login_ip" field. It is called by the builders before save. LoginIPValidator func(string) error // LoginLocationValidator is a validator for the "login_location" field. It is called by the builders before save. LoginLocationValidator func(string) error // DefaultLoginResult holds the default value on creation for the "login_result" field. DefaultLoginResult bool // FailureReasonValidator is a validator for the "failure_reason" field. It is called by the builders before save. FailureReasonValidator func(string) error // SessionIDValidator is a validator for the "session_id" field. It is called by the builders before save. SessionIDValidator func(string) error ) // LoginType defines the type for the "login_type" enum field. type LoginType string // LoginTypePassword is the default value of the LoginType enum. const DefaultLoginType = LoginTypePassword // LoginType values. const ( LoginTypePassword LoginType = "password" LoginTypeSmsCode LoginType = "sms_code" LoginTypeEmailCode LoginType = "email_code" LoginTypeWechat LoginType = "wechat" LoginTypeAlipay LoginType = "alipay" LoginTypeApple LoginType = "apple" LoginTypeGoogle LoginType = "google" LoginTypeOtherThirdParty LoginType = "other_third_party" ) func (lt LoginType) String() string { return string(lt) } // LoginTypeValidator is a validator for the "login_type" field enum values. It is called by the builders before save. func LoginTypeValidator(lt LoginType) error { switch lt { case LoginTypePassword, LoginTypeSmsCode, LoginTypeEmailCode, LoginTypeWechat, LoginTypeAlipay, LoginTypeApple, LoginTypeGoogle, LoginTypeOtherThirdParty: return nil default: return fmt.Errorf("userloginlog: invalid enum value for login_type field: %q", lt) } } // LoginPlatform defines the type for the "login_platform" enum field. type LoginPlatform string // LoginPlatformAndroid is the default value of the LoginPlatform enum. const DefaultLoginPlatform = LoginPlatformAndroid // LoginPlatform values. const ( LoginPlatformIos LoginPlatform = "ios" LoginPlatformAndroid LoginPlatform = "android" ) func (lp LoginPlatform) String() string { return string(lp) } // LoginPlatformValidator is a validator for the "login_platform" field enum values. It is called by the builders before save. func LoginPlatformValidator(lp LoginPlatform) error { switch lp { case LoginPlatformIos, LoginPlatformAndroid: return nil default: return fmt.Errorf("userloginlog: invalid enum value for login_platform field: %q", lp) } } // OrderOption defines the ordering options for the UserLoginLog 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() } // ByUserID orders the results by the user_id field. func ByUserID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUserID, opts...).ToFunc() } // ByLoginTime orders the results by the login_time field. func ByLoginTime(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginTime, opts...).ToFunc() } // ByLoginIP orders the results by the login_ip field. func ByLoginIP(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginIP, opts...).ToFunc() } // ByLoginLocation orders the results by the login_location field. func ByLoginLocation(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginLocation, opts...).ToFunc() } // ByLoginType orders the results by the login_type field. func ByLoginType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginType, opts...).ToFunc() } // ByLoginPlatform orders the results by the login_platform field. func ByLoginPlatform(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginPlatform, opts...).ToFunc() } // ByLoginResult orders the results by the login_result field. func ByLoginResult(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLoginResult, opts...).ToFunc() } // ByFailureReason orders the results by the failure_reason field. func ByFailureReason(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldFailureReason, opts...).ToFunc() } // BySessionID orders the results by the session_id field. func BySessionID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSessionID, opts...).ToFunc() } // ByLatencyMs orders the results by the latency_ms field. func ByLatencyMs(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldLatencyMs, opts...).ToFunc() } // ByAuthID orders the results by the auth_id field. func ByAuthID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAuthID, opts...).ToFunc() }