// 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" // 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" // 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" // EdgeProductCategory holds the string denoting the productcategory edge name in mutations. EdgeProductCategory = "productCategory" // Table holds the table name of the product in the database. Table = "products" // ProductCategoryTable is the table that holds the productCategory relation/edge. The primary key declared below. ProductCategoryTable = "product_category_products" // ProductCategoryInverseTable is the table name for the ProductCategory entity. // It exists in this package in order to avoid circular dependency with the "productcategory" package. ProductCategoryInverseTable = "product_categories" ) // Columns holds all SQL columns for product fields. var Columns = []string{ FieldID, FieldName, FieldDescription, FieldPrice, FieldOriginalPrice, FieldQuantity, FieldStatus, FieldCreatedAt, FieldUpdatedAt, } var ( // ProductCategoryPrimaryKey and ProductCategoryColumn2 are the table columns denoting the // primary key for the productCategory relation (M2M). ProductCategoryPrimaryKey = []string{"product_category_id", "product_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 // 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() } // 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() } // 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() } // ByProductCategoryCount orders the results by productCategory count. func ByProductCategoryCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newProductCategoryStep(), opts...) } } // ByProductCategory orders the results by productCategory terms. func ByProductCategory(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newProductCategoryStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newProductCategoryStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(ProductCategoryInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2M, true, ProductCategoryTable, ProductCategoryPrimaryKey...), ) }