openmeter / ent /db /chargeusagebasedruns /chargeusagebasedruns.go
Leon4gr45's picture
Upload folder using huggingface_hub (part 4)
63a69a8 verified
Raw
History Blame Contribute Delete
22.1 kB
// Code generated by ent, DO NOT EDIT.
package chargeusagebasedruns
import (
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/openmeterio/openmeter/openmeter/billing/charges/usagebased"
)
const (
// Label holds the string label denoting the chargeusagebasedruns type in the database.
Label = "charge_usage_based_runs"
// 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"
// 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"
// FieldAmount holds the string denoting the amount field in the database.
FieldAmount = "amount"
// FieldTaxesTotal holds the string denoting the taxes_total field in the database.
FieldTaxesTotal = "taxes_total"
// FieldTaxesInclusiveTotal holds the string denoting the taxes_inclusive_total field in the database.
FieldTaxesInclusiveTotal = "taxes_inclusive_total"
// FieldTaxesExclusiveTotal holds the string denoting the taxes_exclusive_total field in the database.
FieldTaxesExclusiveTotal = "taxes_exclusive_total"
// FieldChargesTotal holds the string denoting the charges_total field in the database.
FieldChargesTotal = "charges_total"
// FieldDiscountsTotal holds the string denoting the discounts_total field in the database.
FieldDiscountsTotal = "discounts_total"
// FieldCreditsTotal holds the string denoting the credits_total field in the database.
FieldCreditsTotal = "credits_total"
// FieldTotal holds the string denoting the total field in the database.
FieldTotal = "total"
// FieldChargeID holds the string denoting the charge_id field in the database.
FieldChargeID = "charge_id"
// FieldFeatureID holds the string denoting the feature_id field in the database.
FieldFeatureID = "feature_id"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldInitialType holds the string denoting the initial_type field in the database.
FieldInitialType = "initial_type"
// FieldStoredAtLt holds the string denoting the stored_at_lt field in the database.
FieldStoredAtLt = "stored_at_lt"
// FieldServicePeriodTo holds the string denoting the service_period_to field in the database.
FieldServicePeriodTo = "service_period_to"
// FieldDetailedLinesPresent holds the string denoting the detailed_lines_present field in the database.
FieldDetailedLinesPresent = "detailed_lines_present"
// FieldLineID holds the string denoting the line_id field in the database.
FieldLineID = "line_id"
// FieldInvoiceID holds the string denoting the invoice_id field in the database.
FieldInvoiceID = "invoice_id"
// FieldMeteredQuantity holds the string denoting the metered_quantity field in the database.
FieldMeteredQuantity = "metered_quantity"
// FieldNoFiatTransactionRequired holds the string denoting the no_fiat_transaction_required field in the database.
FieldNoFiatTransactionRequired = "no_fiat_transaction_required"
// EdgeUsageBased holds the string denoting the usage_based edge name in mutations.
EdgeUsageBased = "usage_based"
// EdgeFeature holds the string denoting the feature edge name in mutations.
EdgeFeature = "feature"
// EdgeBillingInvoiceLine holds the string denoting the billing_invoice_line edge name in mutations.
EdgeBillingInvoiceLine = "billing_invoice_line"
// EdgeBillingInvoice holds the string denoting the billing_invoice edge name in mutations.
EdgeBillingInvoice = "billing_invoice"
// EdgeCreditAllocations holds the string denoting the credit_allocations edge name in mutations.
EdgeCreditAllocations = "credit_allocations"
// EdgeDetailedLines holds the string denoting the detailed_lines edge name in mutations.
EdgeDetailedLines = "detailed_lines"
// EdgeCorrectedDetailedLines holds the string denoting the corrected_detailed_lines edge name in mutations.
EdgeCorrectedDetailedLines = "corrected_detailed_lines"
// EdgeInvoicedUsage holds the string denoting the invoiced_usage edge name in mutations.
EdgeInvoicedUsage = "invoiced_usage"
// EdgePayment holds the string denoting the payment edge name in mutations.
EdgePayment = "payment"
// Table holds the table name of the chargeusagebasedruns in the database.
Table = "charge_usage_based_runs"
// UsageBasedTable is the table that holds the usage_based relation/edge.
UsageBasedTable = "charge_usage_based_runs"
// UsageBasedInverseTable is the table name for the ChargeUsageBased entity.
// It exists in this package in order to avoid circular dependency with the "chargeusagebased" package.
UsageBasedInverseTable = "charge_usage_based"
// UsageBasedColumn is the table column denoting the usage_based relation/edge.
UsageBasedColumn = "charge_id"
// FeatureTable is the table that holds the feature relation/edge.
FeatureTable = "charge_usage_based_runs"
// FeatureInverseTable is the table name for the Feature entity.
// It exists in this package in order to avoid circular dependency with the "dbfeature" package.
FeatureInverseTable = "features"
// FeatureColumn is the table column denoting the feature relation/edge.
FeatureColumn = "feature_id"
// BillingInvoiceLineTable is the table that holds the billing_invoice_line relation/edge.
BillingInvoiceLineTable = "charge_usage_based_runs"
// BillingInvoiceLineInverseTable is the table name for the BillingInvoiceLine entity.
// It exists in this package in order to avoid circular dependency with the "billinginvoiceline" package.
BillingInvoiceLineInverseTable = "billing_invoice_lines"
// BillingInvoiceLineColumn is the table column denoting the billing_invoice_line relation/edge.
BillingInvoiceLineColumn = "line_id"
// BillingInvoiceTable is the table that holds the billing_invoice relation/edge.
BillingInvoiceTable = "charge_usage_based_runs"
// BillingInvoiceInverseTable is the table name for the BillingInvoice entity.
// It exists in this package in order to avoid circular dependency with the "billinginvoice" package.
BillingInvoiceInverseTable = "billing_invoices"
// BillingInvoiceColumn is the table column denoting the billing_invoice relation/edge.
BillingInvoiceColumn = "invoice_id"
// CreditAllocationsTable is the table that holds the credit_allocations relation/edge.
CreditAllocationsTable = "charge_usage_based_run_credit_allocations"
// CreditAllocationsInverseTable is the table name for the ChargeUsageBasedRunCreditAllocations entity.
// It exists in this package in order to avoid circular dependency with the "chargeusagebasedruncreditallocations" package.
CreditAllocationsInverseTable = "charge_usage_based_run_credit_allocations"
// CreditAllocationsColumn is the table column denoting the credit_allocations relation/edge.
CreditAllocationsColumn = "run_id"
// DetailedLinesTable is the table that holds the detailed_lines relation/edge.
DetailedLinesTable = "charge_usage_based_run_detailed_line"
// DetailedLinesInverseTable is the table name for the ChargeUsageBasedRunDetailedLine entity.
// It exists in this package in order to avoid circular dependency with the "chargeusagebasedrundetailedline" package.
DetailedLinesInverseTable = "charge_usage_based_run_detailed_line"
// DetailedLinesColumn is the table column denoting the detailed_lines relation/edge.
DetailedLinesColumn = "run_id"
// CorrectedDetailedLinesTable is the table that holds the corrected_detailed_lines relation/edge.
CorrectedDetailedLinesTable = "charge_usage_based_run_detailed_line"
// CorrectedDetailedLinesInverseTable is the table name for the ChargeUsageBasedRunDetailedLine entity.
// It exists in this package in order to avoid circular dependency with the "chargeusagebasedrundetailedline" package.
CorrectedDetailedLinesInverseTable = "charge_usage_based_run_detailed_line"
// CorrectedDetailedLinesColumn is the table column denoting the corrected_detailed_lines relation/edge.
CorrectedDetailedLinesColumn = "corrects_run_id"
// InvoicedUsageTable is the table that holds the invoiced_usage relation/edge.
InvoicedUsageTable = "charge_usage_based_run_invoiced_usages"
// InvoicedUsageInverseTable is the table name for the ChargeUsageBasedRunInvoicedUsage entity.
// It exists in this package in order to avoid circular dependency with the "chargeusagebasedruninvoicedusage" package.
InvoicedUsageInverseTable = "charge_usage_based_run_invoiced_usages"
// InvoicedUsageColumn is the table column denoting the invoiced_usage relation/edge.
InvoicedUsageColumn = "run_id"
// PaymentTable is the table that holds the payment relation/edge.
PaymentTable = "charge_usage_based_run_payments"
// PaymentInverseTable is the table name for the ChargeUsageBasedRunPayment entity.
// It exists in this package in order to avoid circular dependency with the "chargeusagebasedrunpayment" package.
PaymentInverseTable = "charge_usage_based_run_payments"
// PaymentColumn is the table column denoting the payment relation/edge.
PaymentColumn = "run_id"
)
// Columns holds all SQL columns for chargeusagebasedruns fields.
var Columns = []string{
FieldID,
FieldNamespace,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeletedAt,
FieldAmount,
FieldTaxesTotal,
FieldTaxesInclusiveTotal,
FieldTaxesExclusiveTotal,
FieldChargesTotal,
FieldDiscountsTotal,
FieldCreditsTotal,
FieldTotal,
FieldChargeID,
FieldFeatureID,
FieldType,
FieldInitialType,
FieldStoredAtLt,
FieldServicePeriodTo,
FieldDetailedLinesPresent,
FieldLineID,
FieldInvoiceID,
FieldMeteredQuantity,
FieldNoFiatTransactionRequired,
}
// 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
// FeatureIDValidator is a validator for the "feature_id" field. It is called by the builders before save.
FeatureIDValidator func(string) error
// LineIDValidator is a validator for the "line_id" field. It is called by the builders before save.
LineIDValidator func(string) error
// InvoiceIDValidator is a validator for the "invoice_id" field. It is called by the builders before save.
InvoiceIDValidator func(string) error
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() string
)
// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.
func TypeValidator(_type usagebased.RealizationRunType) error {
switch _type {
case "final_realization", "partial_invoice", "invalid_due_to_unsupported_credit_note":
return nil
default:
return fmt.Errorf("chargeusagebasedruns: invalid enum value for type field: %q", _type)
}
}
// InitialTypeValidator is a validator for the "initial_type" field enum values. It is called by the builders before save.
func InitialTypeValidator(it usagebased.RealizationRunType) error {
switch it {
case "final_realization", "partial_invoice", "invalid_due_to_unsupported_credit_note":
return nil
default:
return fmt.Errorf("chargeusagebasedruns: invalid enum value for initial_type field: %q", it)
}
}
// OrderOption defines the ordering options for the ChargeUsageBasedRuns 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()
}
// ByAmount orders the results by the amount field.
func ByAmount(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAmount, opts...).ToFunc()
}
// ByTaxesTotal orders the results by the taxes_total field.
func ByTaxesTotal(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTaxesTotal, opts...).ToFunc()
}
// ByTaxesInclusiveTotal orders the results by the taxes_inclusive_total field.
func ByTaxesInclusiveTotal(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTaxesInclusiveTotal, opts...).ToFunc()
}
// ByTaxesExclusiveTotal orders the results by the taxes_exclusive_total field.
func ByTaxesExclusiveTotal(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTaxesExclusiveTotal, opts...).ToFunc()
}
// ByChargesTotal orders the results by the charges_total field.
func ByChargesTotal(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChargesTotal, opts...).ToFunc()
}
// ByDiscountsTotal orders the results by the discounts_total field.
func ByDiscountsTotal(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDiscountsTotal, opts...).ToFunc()
}
// ByCreditsTotal orders the results by the credits_total field.
func ByCreditsTotal(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreditsTotal, opts...).ToFunc()
}
// ByTotal orders the results by the total field.
func ByTotal(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTotal, opts...).ToFunc()
}
// ByChargeID orders the results by the charge_id field.
func ByChargeID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChargeID, opts...).ToFunc()
}
// ByFeatureID orders the results by the feature_id field.
func ByFeatureID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFeatureID, opts...).ToFunc()
}
// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldType, opts...).ToFunc()
}
// ByInitialType orders the results by the initial_type field.
func ByInitialType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldInitialType, opts...).ToFunc()
}
// ByStoredAtLt orders the results by the stored_at_lt field.
func ByStoredAtLt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStoredAtLt, opts...).ToFunc()
}
// ByServicePeriodTo orders the results by the service_period_to field.
func ByServicePeriodTo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldServicePeriodTo, opts...).ToFunc()
}
// ByDetailedLinesPresent orders the results by the detailed_lines_present field.
func ByDetailedLinesPresent(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDetailedLinesPresent, opts...).ToFunc()
}
// ByLineID orders the results by the line_id field.
func ByLineID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldLineID, opts...).ToFunc()
}
// ByInvoiceID orders the results by the invoice_id field.
func ByInvoiceID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldInvoiceID, opts...).ToFunc()
}
// ByMeteredQuantity orders the results by the metered_quantity field.
func ByMeteredQuantity(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMeteredQuantity, opts...).ToFunc()
}
// ByNoFiatTransactionRequired orders the results by the no_fiat_transaction_required field.
func ByNoFiatTransactionRequired(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNoFiatTransactionRequired, opts...).ToFunc()
}
// ByUsageBasedField orders the results by usage_based field.
func ByUsageBasedField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUsageBasedStep(), sql.OrderByField(field, opts...))
}
}
// ByFeatureField orders the results by feature field.
func ByFeatureField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newFeatureStep(), sql.OrderByField(field, opts...))
}
}
// ByBillingInvoiceLineField orders the results by billing_invoice_line field.
func ByBillingInvoiceLineField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceLineStep(), sql.OrderByField(field, opts...))
}
}
// ByBillingInvoiceField orders the results by billing_invoice field.
func ByBillingInvoiceField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceStep(), sql.OrderByField(field, opts...))
}
}
// ByCreditAllocationsCount orders the results by credit_allocations count.
func ByCreditAllocationsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newCreditAllocationsStep(), opts...)
}
}
// ByCreditAllocations orders the results by credit_allocations terms.
func ByCreditAllocations(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newCreditAllocationsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByDetailedLinesCount orders the results by detailed_lines count.
func ByDetailedLinesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newDetailedLinesStep(), opts...)
}
}
// ByDetailedLines orders the results by detailed_lines terms.
func ByDetailedLines(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newDetailedLinesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByCorrectedDetailedLinesCount orders the results by corrected_detailed_lines count.
func ByCorrectedDetailedLinesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newCorrectedDetailedLinesStep(), opts...)
}
}
// ByCorrectedDetailedLines orders the results by corrected_detailed_lines terms.
func ByCorrectedDetailedLines(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newCorrectedDetailedLinesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByInvoicedUsageField orders the results by invoiced_usage field.
func ByInvoicedUsageField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newInvoicedUsageStep(), sql.OrderByField(field, opts...))
}
}
// ByPaymentField orders the results by payment field.
func ByPaymentField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newPaymentStep(), sql.OrderByField(field, opts...))
}
}
func newUsageBasedStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UsageBasedInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, UsageBasedTable, UsageBasedColumn),
)
}
func newFeatureStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(FeatureInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, FeatureTable, FeatureColumn),
)
}
func newBillingInvoiceLineStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(BillingInvoiceLineInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2O, true, BillingInvoiceLineTable, BillingInvoiceLineColumn),
)
}
func newBillingInvoiceStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(BillingInvoiceInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceTable, BillingInvoiceColumn),
)
}
func newCreditAllocationsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(CreditAllocationsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, CreditAllocationsTable, CreditAllocationsColumn),
)
}
func newDetailedLinesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(DetailedLinesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, DetailedLinesTable, DetailedLinesColumn),
)
}
func newCorrectedDetailedLinesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(CorrectedDetailedLinesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, CorrectedDetailedLinesTable, CorrectedDetailedLinesColumn),
)
}
func newInvoicedUsageStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(InvoicedUsageInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, InvoicedUsageTable, InvoicedUsageColumn),
)
}
func newPaymentStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(PaymentInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, PaymentTable, PaymentColumn),
)
}