online-order/ent/businesscategory/businesscategory.go

106 lines
3.4 KiB
Go
Raw Normal View History

2023-10-27 09:51:58 +00:00
// Code generated by ent, DO NOT EDIT.
package businesscategory
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the businesscategory type in the database.
Label = "business_category"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldSlug holds the string denoting the slug field in the database.
FieldSlug = "slug"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// EdgeBusinesses holds the string denoting the businesses edge name in mutations.
EdgeBusinesses = "businesses"
// Table holds the table name of the businesscategory in the database.
Table = "business_categories"
// BusinessesTable is the table that holds the businesses relation/edge. The primary key declared below.
BusinessesTable = "business_category_businesses"
// BusinessesInverseTable is the table name for the Business entity.
// It exists in this package in order to avoid circular dependency with the "business" package.
BusinessesInverseTable = "businesses"
)
// Columns holds all SQL columns for businesscategory fields.
var Columns = []string{
FieldID,
FieldSlug,
FieldName,
FieldDescription,
}
var (
// BusinessesPrimaryKey and BusinessesColumn2 are the table columns denoting the
// primary key for the businesses relation (M2M).
BusinessesPrimaryKey = []string{"business_category_id", "business_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
}
}
return false
}
var (
// DefaultName holds the default value on creation for the "name" field.
DefaultName string
// DefaultDescription holds the default value on creation for the "description" field.
DefaultDescription string
)
// OrderOption defines the ordering options for the BusinessCategory 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()
}
// BySlug orders the results by the slug field.
func BySlug(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSlug, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByBusinessesCount orders the results by businesses count.
func ByBusinessesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newBusinessesStep(), opts...)
}
}
// ByBusinesses orders the results by businesses terms.
func ByBusinesses(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newBusinessesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newBusinessesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(BusinessesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, BusinessesTable, BusinessesPrimaryKey...),
)
}