Something went wrong. Try again.
Self-hosted file management and sharing system, supports multiple storage providers. forked from tdvorak.tngl.sh/cloudreve
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190// Code generated by ent, DO NOT EDIT.
package giftcode
import ( "fmt" "time"
"entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph")
const ( // Label holds the string label denoting the giftcode type in the database. Label = "gift_code" // FieldID holds the string denoting the id field in the database. FieldID = "id" // 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" // FieldCode holds the string denoting the code field in the database. FieldCode = "code" // FieldType holds the string denoting the type field in the database. FieldType = "type" // FieldAmount holds the string denoting the amount field in the database. FieldAmount = "amount" // FieldDuration holds the string denoting the duration field in the database. FieldDuration = "duration" // FieldUsedByID holds the string denoting the used_by_id field in the database. FieldUsedByID = "used_by_id" // FieldUsedAt holds the string denoting the used_at field in the database. FieldUsedAt = "used_at" // FieldDes holds the string denoting the des field in the database. FieldDes = "des" // EdgeRedeemer holds the string denoting the redeemer edge name in mutations. EdgeRedeemer = "redeemer" // Table holds the table name of the giftcode in the database. Table = "gift_codes" // RedeemerTable is the table that holds the redeemer relation/edge. RedeemerTable = "gift_codes" // RedeemerInverseTable is the table name for the User entity. // It exists in this package in order to avoid circular dependency with the "user" package. RedeemerInverseTable = "users" // RedeemerColumn is the table column denoting the redeemer relation/edge. RedeemerColumn = "used_by_id")
// Columns holds all SQL columns for giftcode fields.var Columns = []string{ FieldID, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, FieldCode, FieldType, FieldAmount, FieldDuration, FieldUsedByID, FieldUsedAt, FieldDes,}
// 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}
// Note that the variables below are initialized by the runtime// package on the initialization of the application. Therefore,// it should be imported in the main as follows://// import _ "github.com/cloudreve/Cloudreve/v4/ent/runtime"var ( Hooks [1]ent.Hook Interceptors [1]ent.Interceptor // 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)
// Type defines the type for the "type" enum field.type Type string
// Type values.const ( TypePoints Type = "points" TypeStorage Type = "storage" TypeGroup Type = "group" TypeTraffic Type = "traffic" TypeStreamTraffic Type = "stream_traffic")
func (_type Type) String() string { return string(_type)}
// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.func TypeValidator(_type Type) error { switch _type { case TypePoints, TypeStorage, TypeGroup, TypeTraffic, TypeStreamTraffic: return nil default: return fmt.Errorf("giftcode: invalid enum value for type field: %q", _type) }}
// OrderOption defines the ordering options for the GiftCode 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()}
// 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()}
// ByCode orders the results by the code field.func ByCode(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCode, opts...).ToFunc()}
// ByType orders the results by the type field.func ByType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldType, opts...).ToFunc()}
// ByAmount orders the results by the amount field.func ByAmount(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAmount, opts...).ToFunc()}
// ByDuration orders the results by the duration field.func ByDuration(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDuration, opts...).ToFunc()}
// ByUsedByID orders the results by the used_by_id field.func ByUsedByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUsedByID, opts...).ToFunc()}
// ByUsedAt orders the results by the used_at field.func ByUsedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUsedAt, opts...).ToFunc()}
// ByDes orders the results by the des field.func ByDes(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDes, opts...).ToFunc()}
// ByRedeemerField orders the results by redeemer field.func ByRedeemerField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newRedeemerStep(), sql.OrderByField(field, opts...)) }}func newRedeemerStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(RedeemerInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, RedeemerTable, RedeemerColumn), )}