233 lines
8.9 KiB
Go
233 lines
8.9 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package product
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the product type in the database.
|
|
Label = "product"
|
|
// 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"
|
|
// FieldSummary holds the string denoting the summary field in the database.
|
|
FieldSummary = "summary"
|
|
// FieldDescription holds the string denoting the description field in the database.
|
|
FieldDescription = "description"
|
|
// FieldPrice holds the string denoting the price field in the database.
|
|
FieldPrice = "price"
|
|
// FieldOriginalPrice holds the string denoting the original_price field in the database.
|
|
FieldOriginalPrice = "original_price"
|
|
// FieldQuantity holds the string denoting the quantity field in the database.
|
|
FieldQuantity = "quantity"
|
|
// FieldStatus holds the string denoting the status field in the database.
|
|
FieldStatus = "status"
|
|
// FieldProductCategoryID holds the string denoting the product_category_id field in the database.
|
|
FieldProductCategoryID = "product_category_id"
|
|
// FieldBusinessID holds the string denoting the business_id field in the database.
|
|
FieldBusinessID = "business_id"
|
|
// FieldUserID holds the string denoting the user_id field in the database.
|
|
FieldUserID = "user_id"
|
|
// 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"
|
|
// EdgeProductCategories holds the string denoting the product_categories edge name in mutations.
|
|
EdgeProductCategories = "product_categories"
|
|
// EdgeBusinesses holds the string denoting the businesses edge name in mutations.
|
|
EdgeBusinesses = "businesses"
|
|
// EdgeUsers holds the string denoting the users edge name in mutations.
|
|
EdgeUsers = "users"
|
|
// Table holds the table name of the product in the database.
|
|
Table = "products"
|
|
// ProductCategoriesTable is the table that holds the product_categories relation/edge.
|
|
ProductCategoriesTable = "products"
|
|
// 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 = "product_category_id"
|
|
// BusinessesTable is the table that holds the businesses relation/edge.
|
|
BusinessesTable = "products"
|
|
// 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"
|
|
// BusinessesColumn is the table column denoting the businesses relation/edge.
|
|
BusinessesColumn = "business_id"
|
|
// UsersTable is the table that holds the users relation/edge.
|
|
UsersTable = "products"
|
|
// 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"
|
|
)
|
|
|
|
// Columns holds all SQL columns for product fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldName,
|
|
FieldSummary,
|
|
FieldDescription,
|
|
FieldPrice,
|
|
FieldOriginalPrice,
|
|
FieldQuantity,
|
|
FieldStatus,
|
|
FieldProductCategoryID,
|
|
FieldBusinessID,
|
|
FieldUserID,
|
|
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
|
|
// DefaultPrice holds the default value on creation for the "price" field.
|
|
DefaultPrice float64
|
|
// PriceValidator is a validator for the "price" field. It is called by the builders before save.
|
|
PriceValidator func(float64) error
|
|
// DefaultOriginalPrice holds the default value on creation for the "original_price" field.
|
|
DefaultOriginalPrice float64
|
|
// OriginalPriceValidator is a validator for the "original_price" field. It is called by the builders before save.
|
|
OriginalPriceValidator func(float64) error
|
|
// DefaultQuantity holds the default value on creation for the "quantity" field.
|
|
DefaultQuantity int
|
|
// QuantityValidator is a validator for the "quantity" field. It is called by the builders before save.
|
|
QuantityValidator func(int) error
|
|
// DefaultStatus holds the default value on creation for the "status" field.
|
|
DefaultStatus bool
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt time.Time
|
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
|
DefaultUpdatedAt 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 Product 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()
|
|
}
|
|
|
|
// BySummary orders the results by the summary field.
|
|
func BySummary(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldSummary, opts...).ToFunc()
|
|
}
|
|
|
|
// ByDescription orders the results by the description field.
|
|
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldDescription, opts...).ToFunc()
|
|
}
|
|
|
|
// ByPrice orders the results by the price field.
|
|
func ByPrice(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldPrice, opts...).ToFunc()
|
|
}
|
|
|
|
// ByOriginalPrice orders the results by the original_price field.
|
|
func ByOriginalPrice(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldOriginalPrice, opts...).ToFunc()
|
|
}
|
|
|
|
// ByQuantity orders the results by the quantity field.
|
|
func ByQuantity(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldQuantity, opts...).ToFunc()
|
|
}
|
|
|
|
// ByStatus orders the results by the status field.
|
|
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
|
}
|
|
|
|
// ByProductCategoryID orders the results by the product_category_id field.
|
|
func ByProductCategoryID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldProductCategoryID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByBusinessID orders the results by the business_id field.
|
|
func ByBusinessID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldBusinessID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUserID orders the results by the user_id field.
|
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUserID, 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()
|
|
}
|
|
|
|
// ByProductCategoriesField orders the results by product_categories field.
|
|
func ByProductCategoriesField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newProductCategoriesStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
|
|
// ByBusinessesField orders the results by businesses field.
|
|
func ByBusinessesField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newBusinessesStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
|
|
// ByUsersField orders the results by users field.
|
|
func ByUsersField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newUsersStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
func newProductCategoriesStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(ProductCategoriesInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, ProductCategoriesTable, ProductCategoriesColumn),
|
|
)
|
|
}
|
|
func newBusinessesStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(BusinessesInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, BusinessesTable, BusinessesColumn),
|
|
)
|
|
}
|
|
func newUsersStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(UsersInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, UsersTable, UsersColumn),
|
|
)
|
|
}
|