TinySkin/db/ent/user/user.go
2023-09-08 19:34:31 +08:00

165 lines
5.8 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"
// FieldRegIP holds the string denoting the reg_ip field in the database.
FieldRegIP = "reg_ip"
// 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"
// EdgeCreatedTexture holds the string denoting the created_texture edge name in mutations.
EdgeCreatedTexture = "created_texture"
// 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"
// Table holds the table name of the user in the database.
Table = "users"
// CreatedTextureTable is the table that holds the created_texture relation/edge.
CreatedTextureTable = "textures"
// CreatedTextureInverseTable is the table name for the Texture entity.
// It exists in this package in order to avoid circular dependency with the "texture" package.
CreatedTextureInverseTable = "textures"
// CreatedTextureColumn is the table column denoting the created_texture relation/edge.
CreatedTextureColumn = "texture_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 = "user_tokens"
// 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"
)
// Columns holds all SQL columns for user fields.
var Columns = []string{
FieldID,
FieldEmail,
FieldPassword,
FieldSalt,
FieldRegIP,
FieldState,
FieldRegTime,
}
// 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
}
// 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()
}
// ByRegIP orders the results by the reg_ip field.
func ByRegIP(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRegIP, 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()
}
// ByCreatedTextureCount orders the results by created_texture count.
func ByCreatedTextureCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newCreatedTextureStep(), opts...)
}
}
// ByCreatedTexture orders the results by created_texture terms.
func ByCreatedTexture(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newCreatedTextureStep(), 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...))
}
}
func newCreatedTextureStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(CreatedTextureInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, CreatedTextureTable, CreatedTextureColumn),
)
}
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.O2O, false, TokenTable, TokenColumn),
)
}