TinySkin/db/ent/user/user.go
2023-09-03 17:00:10 +08:00

192 lines
6.6 KiB
Go

// Code generated by ent, DO NOT EDIT.
package user
import (
"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"
// FieldEmail holds the string denoting the email field in the database.
FieldEmail = "email"
// FieldPassword holds the string denoting the password field in the database.
FieldPassword = "password"
// FieldSalt holds the string denoting the salt field in the database.
FieldSalt = "salt"
// FieldState holds the string denoting the state field in the database.
FieldState = "state"
// FieldRegTime holds the string denoting the reg_time field in the database.
FieldRegTime = "reg_time"
// EdgeCreatedSkin holds the string denoting the created_skin edge name in mutations.
EdgeCreatedSkin = "created_skin"
// EdgeProfile holds the string denoting the profile edge name in mutations.
EdgeProfile = "profile"
// EdgeToken holds the string denoting the token edge name in mutations.
EdgeToken = "token"
// EdgeSkin holds the string denoting the skin edge name in mutations.
EdgeSkin = "skin"
// Table holds the table name of the user in the database.
Table = "users"
// CreatedSkinTable is the table that holds the created_skin relation/edge.
CreatedSkinTable = "skins"
// CreatedSkinInverseTable is the table name for the Skin entity.
// It exists in this package in order to avoid circular dependency with the "skin" package.
CreatedSkinInverseTable = "skins"
// CreatedSkinColumn is the table column denoting the created_skin relation/edge.
CreatedSkinColumn = "skin_created_user"
// ProfileTable is the table that holds the profile relation/edge.
ProfileTable = "user_profiles"
// ProfileInverseTable is the table name for the UserProfile entity.
// It exists in this package in order to avoid circular dependency with the "userprofile" package.
ProfileInverseTable = "user_profiles"
// ProfileColumn is the table column denoting the profile relation/edge.
ProfileColumn = "user_profile"
// TokenTable is the table that holds the token relation/edge.
TokenTable = "users"
// TokenInverseTable is the table name for the UserToken entity.
// It exists in this package in order to avoid circular dependency with the "usertoken" package.
TokenInverseTable = "user_tokens"
// TokenColumn is the table column denoting the token relation/edge.
TokenColumn = "user_token"
// SkinTable is the table that holds the skin relation/edge.
SkinTable = "users"
// SkinInverseTable is the table name for the Skin entity.
// It exists in this package in order to avoid circular dependency with the "skin" package.
SkinInverseTable = "skins"
// SkinColumn is the table column denoting the skin relation/edge.
SkinColumn = "user_skin"
)
// Columns holds all SQL columns for user fields.
var Columns = []string{
FieldID,
FieldEmail,
FieldPassword,
FieldSalt,
FieldState,
FieldRegTime,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "users"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"user_token",
"user_skin",
}
// 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
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}
// 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()
}
// ByEmail orders the results by the email field.
func ByEmail(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEmail, opts...).ToFunc()
}
// ByPassword orders the results by the password field.
func ByPassword(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPassword, opts...).ToFunc()
}
// BySalt orders the results by the salt field.
func BySalt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSalt, opts...).ToFunc()
}
// ByState orders the results by the state field.
func ByState(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldState, opts...).ToFunc()
}
// ByRegTime orders the results by the reg_time field.
func ByRegTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRegTime, opts...).ToFunc()
}
// ByCreatedSkinCount orders the results by created_skin count.
func ByCreatedSkinCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newCreatedSkinStep(), opts...)
}
}
// ByCreatedSkin orders the results by created_skin terms.
func ByCreatedSkin(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newCreatedSkinStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByProfileField orders the results by profile field.
func ByProfileField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newProfileStep(), sql.OrderByField(field, opts...))
}
}
// ByTokenField orders the results by token field.
func ByTokenField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTokenStep(), sql.OrderByField(field, opts...))
}
}
// BySkinField orders the results by skin field.
func BySkinField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newSkinStep(), sql.OrderByField(field, opts...))
}
}
func newCreatedSkinStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(CreatedSkinInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, CreatedSkinTable, CreatedSkinColumn),
)
}
func newProfileStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ProfileInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, ProfileTable, ProfileColumn),
)
}
func newTokenStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TokenInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, TokenTable, TokenColumn),
)
}
func newSkinStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(SkinInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, SkinTable, SkinColumn),
)
}