online-order/ent/business/business.go
2023-10-27 13:21:58 +03:30

154 lines
5.4 KiB
Go

// Code generated by ent, DO NOT EDIT.
package business
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the business type in the database.
Label = "business"
// 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"
// FieldSlug holds the string denoting the slug field in the database.
FieldSlug = "slug"
// FieldBotID holds the string denoting the bot_id field in the database.
FieldBotID = "bot_id"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldCompany holds the string denoting the company field in the database.
FieldCompany = "company"
// FieldAboutUs holds the string denoting the about_us field in the database.
FieldAboutUs = "about_us"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// EdgeBusinessCategory holds the string denoting the businesscategory edge name in mutations.
EdgeBusinessCategory = "businessCategory"
// Table holds the table name of the business in the database.
Table = "businesses"
// BusinessCategoryTable is the table that holds the businessCategory relation/edge. The primary key declared below.
BusinessCategoryTable = "business_category_businesses"
// BusinessCategoryInverseTable is the table name for the BusinessCategory entity.
// It exists in this package in order to avoid circular dependency with the "businesscategory" package.
BusinessCategoryInverseTable = "business_categories"
)
// Columns holds all SQL columns for business fields.
var Columns = []string{
FieldID,
FieldName,
FieldSlug,
FieldBotID,
FieldDescription,
FieldCompany,
FieldAboutUs,
FieldCreatedAt,
FieldUpdatedAt,
}
var (
// BusinessCategoryPrimaryKey and BusinessCategoryColumn2 are the table columns denoting the
// primary key for the businessCategory relation (M2M).
BusinessCategoryPrimaryKey = []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
// DefaultCompany holds the default value on creation for the "company" field.
DefaultCompany string
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
)
// OrderOption defines the ordering options for the Business 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()
}
// BySlug orders the results by the slug field.
func BySlug(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSlug, opts...).ToFunc()
}
// ByBotID orders the results by the bot_id field.
func ByBotID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBotID, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByCompany orders the results by the company field.
func ByCompany(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCompany, opts...).ToFunc()
}
// ByAboutUs orders the results by the about_us field.
func ByAboutUs(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAboutUs, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByBusinessCategoryCount orders the results by businessCategory count.
func ByBusinessCategoryCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newBusinessCategoryStep(), opts...)
}
}
// ByBusinessCategory orders the results by businessCategory terms.
func ByBusinessCategory(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newBusinessCategoryStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newBusinessCategoryStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(BusinessCategoryInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, BusinessCategoryTable, BusinessCategoryPrimaryKey...),
)
}