openmeter / ent /db /chargeusagebasedrunpayment /chargeusagebasedrunpayment.go
Leon4gr45's picture
Upload folder using huggingface_hub (part 4)
63a69a8 verified
Raw
History Blame Contribute Delete
8.68 kB
// Code generated by ent, DO NOT EDIT.
package chargeusagebasedrunpayment
import (
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/openmeterio/openmeter/openmeter/billing/charges/models/payment"
)
const (
// Label holds the string label denoting the chargeusagebasedrunpayment type in the database.
Label = "charge_usage_based_run_payment"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// 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"
// FieldServicePeriodFrom holds the string denoting the service_period_from field in the database.
FieldServicePeriodFrom = "service_period_from"
// FieldServicePeriodTo holds the string denoting the service_period_to field in the database.
FieldServicePeriodTo = "service_period_to"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldAmount holds the string denoting the amount field in the database.
FieldAmount = "amount"
// FieldAuthorizedTransactionGroupID holds the string denoting the authorized_transaction_group_id field in the database.
FieldAuthorizedTransactionGroupID = "authorized_transaction_group_id"
// FieldAuthorizedAt holds the string denoting the authorized_at field in the database.
FieldAuthorizedAt = "authorized_at"
// FieldSettledTransactionGroupID holds the string denoting the settled_transaction_group_id field in the database.
FieldSettledTransactionGroupID = "settled_transaction_group_id"
// FieldSettledAt holds the string denoting the settled_at field in the database.
FieldSettledAt = "settled_at"
// 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"
// FieldAnnotations holds the string denoting the annotations field in the database.
FieldAnnotations = "annotations"
// FieldRunID holds the string denoting the run_id field in the database.
FieldRunID = "run_id"
// EdgeRun holds the string denoting the run edge name in mutations.
EdgeRun = "run"
// Table holds the table name of the chargeusagebasedrunpayment in the database.
Table = "charge_usage_based_run_payments"
// RunTable is the table that holds the run relation/edge.
RunTable = "charge_usage_based_run_payments"
// RunInverseTable is the table name for the ChargeUsageBasedRuns entity.
// It exists in this package in order to avoid circular dependency with the "chargeusagebasedruns" package.
RunInverseTable = "charge_usage_based_runs"
// RunColumn is the table column denoting the run relation/edge.
RunColumn = "run_id"
)
// Columns holds all SQL columns for chargeusagebasedrunpayment fields.
var Columns = []string{
FieldID,
FieldLineID,
FieldInvoiceID,
FieldServicePeriodFrom,
FieldServicePeriodTo,
FieldStatus,
FieldAmount,
FieldAuthorizedTransactionGroupID,
FieldAuthorizedAt,
FieldSettledTransactionGroupID,
FieldSettledAt,
FieldNamespace,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeletedAt,
FieldAnnotations,
FieldRunID,
}
// 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 (
// AuthorizedTransactionGroupIDValidator is a validator for the "authorized_transaction_group_id" field. It is called by the builders before save.
AuthorizedTransactionGroupIDValidator func(string) error
// SettledTransactionGroupIDValidator is a validator for the "settled_transaction_group_id" field. It is called by the builders before save.
SettledTransactionGroupIDValidator func(string) error
// 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
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() string
)
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
func StatusValidator(s payment.Status) error {
switch s {
case "authorized", "settled":
return nil
default:
return fmt.Errorf("chargeusagebasedrunpayment: invalid enum value for status field: %q", s)
}
}
// OrderOption defines the ordering options for the ChargeUsageBasedRunPayment 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()
}
// 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()
}
// ByServicePeriodFrom orders the results by the service_period_from field.
func ByServicePeriodFrom(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldServicePeriodFrom, opts...).ToFunc()
}
// ByServicePeriodTo orders the results by the service_period_to field.
func ByServicePeriodTo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldServicePeriodTo, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByAmount orders the results by the amount field.
func ByAmount(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAmount, opts...).ToFunc()
}
// ByAuthorizedTransactionGroupID orders the results by the authorized_transaction_group_id field.
func ByAuthorizedTransactionGroupID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAuthorizedTransactionGroupID, opts...).ToFunc()
}
// ByAuthorizedAt orders the results by the authorized_at field.
func ByAuthorizedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAuthorizedAt, opts...).ToFunc()
}
// BySettledTransactionGroupID orders the results by the settled_transaction_group_id field.
func BySettledTransactionGroupID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSettledTransactionGroupID, opts...).ToFunc()
}
// BySettledAt orders the results by the settled_at field.
func BySettledAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSettledAt, 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()
}
// ByRunID orders the results by the run_id field.
func ByRunID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRunID, opts...).ToFunc()
}
// ByRunField orders the results by run field.
func ByRunField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newRunStep(), sql.OrderByField(field, opts...))
}
}
func newRunStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(RunInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2O, true, RunTable, RunColumn),
)
}