TinySkin/db/ent/texture/texture.go
2023-09-08 19:03:03 +08:00

100 lines
3.1 KiB
Go

// Code generated by ent, DO NOT EDIT.
package texture
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the texture type in the database.
Label = "texture"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldTextureHash holds the string denoting the texture_hash field in the database.
FieldTextureHash = "texture_hash"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldVariant holds the string denoting the variant field in the database.
FieldVariant = "variant"
// EdgeCreatedUser holds the string denoting the created_user edge name in mutations.
EdgeCreatedUser = "created_user"
// Table holds the table name of the texture in the database.
Table = "textures"
// CreatedUserTable is the table that holds the created_user relation/edge.
CreatedUserTable = "textures"
// CreatedUserInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
CreatedUserInverseTable = "users"
// CreatedUserColumn is the table column denoting the created_user relation/edge.
CreatedUserColumn = "texture_created_user"
)
// Columns holds all SQL columns for texture fields.
var Columns = []string{
FieldID,
FieldTextureHash,
FieldType,
FieldVariant,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "textures"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"texture_created_user",
"user_profile_texture",
}
// 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 Texture 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()
}
// ByTextureHash orders the results by the texture_hash field.
func ByTextureHash(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTextureHash, opts...).ToFunc()
}
// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldType, opts...).ToFunc()
}
// ByVariant orders the results by the variant field.
func ByVariant(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVariant, opts...).ToFunc()
}
// ByCreatedUserField orders the results by created_user field.
func ByCreatedUserField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newCreatedUserStep(), sql.OrderByField(field, opts...))
}
}
func newCreatedUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(CreatedUserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, CreatedUserTable, CreatedUserColumn),
)
}