Files
MonkeyCode/backend/db/billingrecord/billingrecord.go
2025-06-25 15:56:22 +08:00

136 lines
4.6 KiB
Go

// Code generated by ent, DO NOT EDIT.
package billingrecord
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the billingrecord type in the database.
Label = "billing_record"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldTenantID holds the string denoting the tenant_id field in the database.
FieldTenantID = "tenant_id"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldModel holds the string denoting the model field in the database.
FieldModel = "model"
// FieldOperation holds the string denoting the operation field in the database.
FieldOperation = "operation"
// FieldInputTokens holds the string denoting the input_tokens field in the database.
FieldInputTokens = "input_tokens"
// FieldOutputTokens holds the string denoting the output_tokens field in the database.
FieldOutputTokens = "output_tokens"
// FieldCost holds the string denoting the cost field in the database.
FieldCost = "cost"
// FieldRequestTime holds the string denoting the request_time field in the database.
FieldRequestTime = "request_time"
// 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"
// Table holds the table name of the billingrecord in the database.
Table = "billing_records"
)
// Columns holds all SQL columns for billingrecord fields.
var Columns = []string{
FieldID,
FieldTenantID,
FieldUserID,
FieldModel,
FieldOperation,
FieldInputTokens,
FieldOutputTokens,
FieldCost,
FieldRequestTime,
FieldMetadata,
FieldCreatedAt,
FieldUpdatedAt,
}
// 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 (
// DefaultRequestTime holds the default value on creation for the "request_time" field.
DefaultRequestTime func() time.Time
// 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
)
// OrderOption defines the ordering options for the BillingRecord 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()
}
// ByTenantID orders the results by the tenant_id field.
func ByTenantID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTenantID, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// ByModel orders the results by the model field.
func ByModel(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldModel, opts...).ToFunc()
}
// ByOperation orders the results by the operation field.
func ByOperation(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOperation, opts...).ToFunc()
}
// ByInputTokens orders the results by the input_tokens field.
func ByInputTokens(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldInputTokens, opts...).ToFunc()
}
// ByOutputTokens orders the results by the output_tokens field.
func ByOutputTokens(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOutputTokens, opts...).ToFunc()
}
// ByCost orders the results by the cost field.
func ByCost(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCost, opts...).ToFunc()
}
// ByRequestTime orders the results by the request_time field.
func ByRequestTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRequestTime, 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()
}