TinySkin/db/ent/userprofile/userprofile.go
thehrz 145bb045e9
Some checks failed
CI / deploy (push) Failing after 2m53s
fork from xmdhs/authlib-skin
2025-01-24 16:57:58 +08:00

155 lines
5.2 KiB
Go

// Code generated by ent, DO NOT EDIT.
package userprofile
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the userprofile type in the database.
Label = "user_profile"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldUUID holds the string denoting the uuid field in the database.
FieldUUID = "uuid"
// EdgeUser holds the string denoting the user edge name in mutations.
EdgeUser = "user"
// EdgeTexture holds the string denoting the texture edge name in mutations.
EdgeTexture = "texture"
// EdgeUsertexture holds the string denoting the usertexture edge name in mutations.
EdgeUsertexture = "usertexture"
// Table holds the table name of the userprofile in the database.
Table = "user_profiles"
// UserTable is the table that holds the user relation/edge.
UserTable = "user_profiles"
// UserInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
UserInverseTable = "users"
// UserColumn is the table column denoting the user relation/edge.
UserColumn = "user_profile"
// TextureTable is the table that holds the texture relation/edge. The primary key declared below.
TextureTable = "user_textures"
// TextureInverseTable is the table name for the Texture entity.
// It exists in this package in order to avoid circular dependency with the "texture" package.
TextureInverseTable = "textures"
// UsertextureTable is the table that holds the usertexture relation/edge.
UsertextureTable = "user_textures"
// UsertextureInverseTable is the table name for the UserTexture entity.
// It exists in this package in order to avoid circular dependency with the "usertexture" package.
UsertextureInverseTable = "user_textures"
// UsertextureColumn is the table column denoting the usertexture relation/edge.
UsertextureColumn = "user_profile_id"
)
// Columns holds all SQL columns for userprofile fields.
var Columns = []string{
FieldID,
FieldName,
FieldUUID,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "user_profiles"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"user_profile",
}
var (
// TexturePrimaryKey and TextureColumn2 are the table columns denoting the
// primary key for the texture relation (M2M).
TexturePrimaryKey = []string{"texture_id", "user_profile_id"}
)
// 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 UserProfile 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()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByUUID orders the results by the uuid field.
func ByUUID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUUID, opts...).ToFunc()
}
// ByUserField orders the results by user field.
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
}
}
// ByTextureCount orders the results by texture count.
func ByTextureCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newTextureStep(), opts...)
}
}
// ByTexture orders the results by texture terms.
func ByTexture(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTextureStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByUsertextureCount orders the results by usertexture count.
func ByUsertextureCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newUsertextureStep(), opts...)
}
}
// ByUsertexture orders the results by usertexture terms.
func ByUsertexture(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUsertextureStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2O, true, UserTable, UserColumn),
)
}
func newTextureStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TextureInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, TextureTable, TexturePrimaryKey...),
)
}
func newUsertextureStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UsertextureInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, UsertextureTable, UsertextureColumn),
)
}