File size: 8,677 Bytes
63a69a8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | // 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),
)
}
|