online-order/ent/business/business.go

292 lines
11 KiB
Go
Raw Permalink Normal View History

2023-10-27 09:51:58 +00:00
// 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"
// FieldAboutUs holds the string denoting the about_us field in the database.
FieldAboutUs = "about_us"
2023-10-28 23:12:07 +00:00
// FieldBusinessCategoryID holds the string denoting the business_category_id field in the database.
FieldBusinessCategoryID = "business_category_id"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
2023-10-27 09:51:58 +00:00
// 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"
2023-10-28 23:12:07 +00:00
// EdgeBusinessCategories holds the string denoting the business_categories edge name in mutations.
EdgeBusinessCategories = "business_categories"
// EdgeUsers holds the string denoting the users edge name in mutations.
EdgeUsers = "users"
// EdgeProducts holds the string denoting the products edge name in mutations.
EdgeProducts = "products"
// EdgeProductCategories holds the string denoting the product_categories edge name in mutations.
EdgeProductCategories = "product_categories"
// EdgeDomains holds the string denoting the domains edge name in mutations.
EdgeDomains = "domains"
// EdgeBusinessConfigs holds the string denoting the business_configs edge name in mutations.
EdgeBusinessConfigs = "business_configs"
2023-10-27 09:51:58 +00:00
// Table holds the table name of the business in the database.
Table = "businesses"
2023-10-28 23:12:07 +00:00
// BusinessCategoriesTable is the table that holds the business_categories relation/edge.
BusinessCategoriesTable = "businesses"
// BusinessCategoriesInverseTable is the table name for the BusinessCategory entity.
2023-10-27 09:51:58 +00:00
// It exists in this package in order to avoid circular dependency with the "businesscategory" package.
2023-10-28 23:12:07 +00:00
BusinessCategoriesInverseTable = "business_categories"
// BusinessCategoriesColumn is the table column denoting the business_categories relation/edge.
BusinessCategoriesColumn = "business_category_id"
// UsersTable is the table that holds the users relation/edge.
UsersTable = "businesses"
// UsersInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
UsersInverseTable = "users"
// UsersColumn is the table column denoting the users relation/edge.
UsersColumn = "user_id"
// ProductsTable is the table that holds the products relation/edge.
ProductsTable = "products"
// ProductsInverseTable is the table name for the Product entity.
// It exists in this package in order to avoid circular dependency with the "product" package.
ProductsInverseTable = "products"
// ProductsColumn is the table column denoting the products relation/edge.
ProductsColumn = "business_id"
// ProductCategoriesTable is the table that holds the product_categories relation/edge.
ProductCategoriesTable = "product_categories"
// ProductCategoriesInverseTable is the table name for the ProductCategory entity.
// It exists in this package in order to avoid circular dependency with the "productcategory" package.
ProductCategoriesInverseTable = "product_categories"
// ProductCategoriesColumn is the table column denoting the product_categories relation/edge.
ProductCategoriesColumn = "business_id"
// DomainsTable is the table that holds the domains relation/edge.
DomainsTable = "domains"
// DomainsInverseTable is the table name for the Domain entity.
// It exists in this package in order to avoid circular dependency with the "domain" package.
DomainsInverseTable = "domains"
// DomainsColumn is the table column denoting the domains relation/edge.
DomainsColumn = "business_id"
// BusinessConfigsTable is the table that holds the business_configs relation/edge.
BusinessConfigsTable = "business_configs"
// BusinessConfigsInverseTable is the table name for the BusinessConfig entity.
// It exists in this package in order to avoid circular dependency with the "businessconfig" package.
BusinessConfigsInverseTable = "business_configs"
// BusinessConfigsColumn is the table column denoting the business_configs relation/edge.
BusinessConfigsColumn = "business_id"
2023-10-27 09:51:58 +00:00
)
// Columns holds all SQL columns for business fields.
var Columns = []string{
FieldID,
FieldName,
FieldSlug,
FieldBotID,
FieldDescription,
FieldAboutUs,
2023-10-28 23:12:07 +00:00
FieldBusinessCategoryID,
FieldUserID,
2023-10-27 09:51:58 +00:00
FieldCreatedAt,
FieldUpdatedAt,
}
// 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
// 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()
}
// ByAboutUs orders the results by the about_us field.
func ByAboutUs(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAboutUs, opts...).ToFunc()
}
2023-10-28 23:12:07 +00:00
// ByBusinessCategoryID orders the results by the business_category_id field.
func ByBusinessCategoryID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBusinessCategoryID, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
2023-10-27 09:51:58 +00:00
// 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()
}
2023-10-28 23:12:07 +00:00
// ByBusinessCategoriesField orders the results by business_categories field.
func ByBusinessCategoriesField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newBusinessCategoriesStep(), sql.OrderByField(field, opts...))
}
}
// ByUsersField orders the results by users field.
func ByUsersField(field string, opts ...sql.OrderTermOption) OrderOption {
2023-10-27 09:51:58 +00:00
return func(s *sql.Selector) {
2023-10-28 23:12:07 +00:00
sqlgraph.OrderByNeighborTerms(s, newUsersStep(), sql.OrderByField(field, opts...))
2023-10-27 09:51:58 +00:00
}
}
2023-10-28 23:12:07 +00:00
// ByProductsCount orders the results by products count.
func ByProductsCount(opts ...sql.OrderTermOption) OrderOption {
2023-10-27 09:51:58 +00:00
return func(s *sql.Selector) {
2023-10-28 23:12:07 +00:00
sqlgraph.OrderByNeighborsCount(s, newProductsStep(), opts...)
2023-10-27 09:51:58 +00:00
}
}
2023-10-28 23:12:07 +00:00
// ByProducts orders the results by products terms.
func ByProducts(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newProductsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByProductCategoriesCount orders the results by product_categories count.
func ByProductCategoriesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newProductCategoriesStep(), opts...)
}
}
// ByProductCategories orders the results by product_categories terms.
func ByProductCategories(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newProductCategoriesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByDomainsCount orders the results by domains count.
func ByDomainsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newDomainsStep(), opts...)
}
}
// ByDomains orders the results by domains terms.
func ByDomains(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newDomainsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByBusinessConfigsCount orders the results by business_configs count.
func ByBusinessConfigsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newBusinessConfigsStep(), opts...)
}
}
// ByBusinessConfigs orders the results by business_configs terms.
func ByBusinessConfigs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newBusinessConfigsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newBusinessCategoriesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(BusinessCategoriesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, BusinessCategoriesTable, BusinessCategoriesColumn),
)
}
func newUsersStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UsersInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, UsersTable, UsersColumn),
)
}
func newProductsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ProductsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, ProductsTable, ProductsColumn),
)
}
func newProductCategoriesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ProductCategoriesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, ProductCategoriesTable, ProductCategoriesColumn),
)
}
func newDomainsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(DomainsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, DomainsTable, DomainsColumn),
)
}
func newBusinessConfigsStep() *sqlgraph.Step {
2023-10-27 09:51:58 +00:00
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
2023-10-28 23:12:07 +00:00
sqlgraph.To(BusinessConfigsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, BusinessConfigsTable, BusinessConfigsColumn),
2023-10-27 09:51:58 +00:00
)
}