openmeter / ent /db /addon /addon.go
Leon4gr45's picture
Upload folder using huggingface_hub (part 3)
1c4c66b verified
Raw
History Blame Contribute Delete
10.8 kB
// Code generated by ent, DO NOT EDIT.
package addon
import (
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/openmeterio/openmeter/openmeter/productcatalog"
"github.com/openmeterio/openmeter/pkg/models"
)
const (
// Label holds the string label denoting the addon type in the database.
Label = "addon"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldNamespace holds the string denoting the namespace field in the database.
FieldNamespace = "namespace"
// FieldMetadata holds the string denoting the metadata field in the database.
FieldMetadata = "metadata"
// 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"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// 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"
// FieldKey holds the string denoting the key field in the database.
FieldKey = "key"
// FieldVersion holds the string denoting the version field in the database.
FieldVersion = "version"
// FieldCurrency holds the string denoting the currency field in the database.
FieldCurrency = "currency"
// FieldInstanceType holds the string denoting the instance_type field in the database.
FieldInstanceType = "instance_type"
// FieldEffectiveFrom holds the string denoting the effective_from field in the database.
FieldEffectiveFrom = "effective_from"
// FieldEffectiveTo holds the string denoting the effective_to field in the database.
FieldEffectiveTo = "effective_to"
// FieldAnnotations holds the string denoting the annotations field in the database.
FieldAnnotations = "annotations"
// EdgeRatecards holds the string denoting the ratecards edge name in mutations.
EdgeRatecards = "ratecards"
// EdgePlans holds the string denoting the plans edge name in mutations.
EdgePlans = "plans"
// EdgeSubscriptionAddons holds the string denoting the subscription_addons edge name in mutations.
EdgeSubscriptionAddons = "subscription_addons"
// Table holds the table name of the addon in the database.
Table = "addons"
// RatecardsTable is the table that holds the ratecards relation/edge.
RatecardsTable = "addon_rate_cards"
// RatecardsInverseTable is the table name for the AddonRateCard entity.
// It exists in this package in order to avoid circular dependency with the "addonratecard" package.
RatecardsInverseTable = "addon_rate_cards"
// RatecardsColumn is the table column denoting the ratecards relation/edge.
RatecardsColumn = "addon_id"
// PlansTable is the table that holds the plans relation/edge.
PlansTable = "plan_addons"
// PlansInverseTable is the table name for the PlanAddon entity.
// It exists in this package in order to avoid circular dependency with the "planaddon" package.
PlansInverseTable = "plan_addons"
// PlansColumn is the table column denoting the plans relation/edge.
PlansColumn = "addon_id"
// SubscriptionAddonsTable is the table that holds the subscription_addons relation/edge.
SubscriptionAddonsTable = "subscription_addons"
// SubscriptionAddonsInverseTable is the table name for the SubscriptionAddon entity.
// It exists in this package in order to avoid circular dependency with the "subscriptionaddon" package.
SubscriptionAddonsInverseTable = "subscription_addons"
// SubscriptionAddonsColumn is the table column denoting the subscription_addons relation/edge.
SubscriptionAddonsColumn = "addon_id"
)
// Columns holds all SQL columns for addon fields.
var Columns = []string{
FieldID,
FieldNamespace,
FieldMetadata,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeletedAt,
FieldName,
FieldDescription,
FieldKey,
FieldVersion,
FieldCurrency,
FieldInstanceType,
FieldEffectiveFrom,
FieldEffectiveTo,
FieldAnnotations,
}
// 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 (
// NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save.
NamespaceValidator func(string) error
// 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
// KeyValidator is a validator for the "key" field. It is called by the builders before save.
KeyValidator func(string) error
// VersionValidator is a validator for the "version" field. It is called by the builders before save.
VersionValidator func(int) error
// DefaultCurrency holds the default value on creation for the "currency" field.
DefaultCurrency string
// CurrencyValidator is a validator for the "currency" field. It is called by the builders before save.
CurrencyValidator func(string) error
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() string
// ValueScanner of all Addon fields.
ValueScanner struct {
Annotations field.TypeValueScanner[models.Annotations]
}
)
const DefaultInstanceType productcatalog.AddonInstanceType = "single"
// InstanceTypeValidator is a validator for the "instance_type" field enum values. It is called by the builders before save.
func InstanceTypeValidator(it productcatalog.AddonInstanceType) error {
switch it {
case "single", "multiple":
return nil
default:
return fmt.Errorf("addon: invalid enum value for instance_type field: %q", it)
}
}
// OrderOption defines the ordering options for the Addon 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()
}
// ByNamespace orders the results by the namespace field.
func ByNamespace(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNamespace, 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()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, 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()
}
// ByKey orders the results by the key field.
func ByKey(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldKey, opts...).ToFunc()
}
// ByVersion orders the results by the version field.
func ByVersion(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVersion, opts...).ToFunc()
}
// ByCurrency orders the results by the currency field.
func ByCurrency(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCurrency, opts...).ToFunc()
}
// ByInstanceType orders the results by the instance_type field.
func ByInstanceType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldInstanceType, opts...).ToFunc()
}
// ByEffectiveFrom orders the results by the effective_from field.
func ByEffectiveFrom(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEffectiveFrom, opts...).ToFunc()
}
// ByEffectiveTo orders the results by the effective_to field.
func ByEffectiveTo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEffectiveTo, opts...).ToFunc()
}
// ByAnnotations orders the results by the annotations field.
func ByAnnotations(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAnnotations, opts...).ToFunc()
}
// ByRatecardsCount orders the results by ratecards count.
func ByRatecardsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newRatecardsStep(), opts...)
}
}
// ByRatecards orders the results by ratecards terms.
func ByRatecards(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newRatecardsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByPlansCount orders the results by plans count.
func ByPlansCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newPlansStep(), opts...)
}
}
// ByPlans orders the results by plans terms.
func ByPlans(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newPlansStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// BySubscriptionAddonsCount orders the results by subscription_addons count.
func BySubscriptionAddonsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newSubscriptionAddonsStep(), opts...)
}
}
// BySubscriptionAddons orders the results by subscription_addons terms.
func BySubscriptionAddons(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newSubscriptionAddonsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newRatecardsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(RatecardsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, RatecardsTable, RatecardsColumn),
)
}
func newPlansStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(PlansInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, PlansTable, PlansColumn),
)
}
func newSubscriptionAddonsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(SubscriptionAddonsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, SubscriptionAddonsTable, SubscriptionAddonsColumn),
)
}