mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-02-03 15:23:30 +08:00
191 lines
6.7 KiB
Go
191 lines
6.7 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package user
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"github.com/chaitin/MonkeyCode/backend/consts"
|
|
)
|
|
|
|
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"
|
|
// FieldUsername holds the string denoting the username field in the database.
|
|
FieldUsername = "username"
|
|
// FieldPassword holds the string denoting the password field in the database.
|
|
FieldPassword = "password"
|
|
// FieldEmail holds the string denoting the email field in the database.
|
|
FieldEmail = "email"
|
|
// FieldStatus holds the string denoting the status field in the database.
|
|
FieldStatus = "status"
|
|
// 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"
|
|
// EdgeRecords holds the string denoting the records edge name in mutations.
|
|
EdgeRecords = "records"
|
|
// EdgeLoginHistories holds the string denoting the login_histories edge name in mutations.
|
|
EdgeLoginHistories = "login_histories"
|
|
// EdgeModels holds the string denoting the models edge name in mutations.
|
|
EdgeModels = "models"
|
|
// Table holds the table name of the user in the database.
|
|
Table = "users"
|
|
// RecordsTable is the table that holds the records relation/edge.
|
|
RecordsTable = "records"
|
|
// RecordsInverseTable is the table name for the Record entity.
|
|
// It exists in this package in order to avoid circular dependency with the "record" package.
|
|
RecordsInverseTable = "records"
|
|
// RecordsColumn is the table column denoting the records relation/edge.
|
|
RecordsColumn = "user_id"
|
|
// LoginHistoriesTable is the table that holds the login_histories relation/edge.
|
|
LoginHistoriesTable = "user_login_histories"
|
|
// LoginHistoriesInverseTable is the table name for the UserLoginHistory entity.
|
|
// It exists in this package in order to avoid circular dependency with the "userloginhistory" package.
|
|
LoginHistoriesInverseTable = "user_login_histories"
|
|
// LoginHistoriesColumn is the table column denoting the login_histories relation/edge.
|
|
LoginHistoriesColumn = "user_login_histories"
|
|
// ModelsTable is the table that holds the models relation/edge.
|
|
ModelsTable = "models"
|
|
// ModelsInverseTable is the table name for the Model entity.
|
|
// It exists in this package in order to avoid circular dependency with the "model" package.
|
|
ModelsInverseTable = "models"
|
|
// ModelsColumn is the table column denoting the models relation/edge.
|
|
ModelsColumn = "user_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for user fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldUsername,
|
|
FieldPassword,
|
|
FieldEmail,
|
|
FieldStatus,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
}
|
|
|
|
// 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 (
|
|
// DefaultStatus holds the default value on creation for the "status" field.
|
|
DefaultStatus consts.UserStatus
|
|
// 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
|
|
)
|
|
|
|
// 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()
|
|
}
|
|
|
|
// ByUsername orders the results by the username field.
|
|
func ByUsername(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUsername, opts...).ToFunc()
|
|
}
|
|
|
|
// ByPassword orders the results by the password field.
|
|
func ByPassword(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldPassword, opts...).ToFunc()
|
|
}
|
|
|
|
// ByEmail orders the results by the email field.
|
|
func ByEmail(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldEmail, opts...).ToFunc()
|
|
}
|
|
|
|
// ByStatus orders the results by the status field.
|
|
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldStatus, 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()
|
|
}
|
|
|
|
// ByRecordsCount orders the results by records count.
|
|
func ByRecordsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newRecordsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByRecords orders the results by records terms.
|
|
func ByRecords(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newRecordsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByLoginHistoriesCount orders the results by login_histories count.
|
|
func ByLoginHistoriesCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newLoginHistoriesStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByLoginHistories orders the results by login_histories terms.
|
|
func ByLoginHistories(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newLoginHistoriesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByModelsCount orders the results by models count.
|
|
func ByModelsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newModelsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByModels orders the results by models terms.
|
|
func ByModels(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newModelsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
func newRecordsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(RecordsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, RecordsTable, RecordsColumn),
|
|
)
|
|
}
|
|
func newLoginHistoriesStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(LoginHistoriesInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, LoginHistoriesTable, LoginHistoriesColumn),
|
|
)
|
|
}
|
|
func newModelsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(ModelsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, ModelsTable, ModelsColumn),
|
|
)
|
|
}
|