Files

102 lines
3.2 KiB
Go
Raw Permalink Normal View History

2025-06-25 15:25:18 +08:00
// Code generated by ent, DO NOT EDIT.
package invitecode
import (
"time"
"entgo.io/ent/dialect/sql"
"github.com/chaitin/MonkeyCode/backend/consts"
2025-06-25 15:25:18 +08:00
)
const (
// Label holds the string label denoting the invitecode type in the database.
Label = "invite_code"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldAdminID holds the string denoting the admin_id field in the database.
FieldAdminID = "admin_id"
// FieldCode holds the string denoting the code field in the database.
FieldCode = "code"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
2025-06-25 15:25:18 +08:00
// 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"
// FieldExpiredAt holds the string denoting the expired_at field in the database.
FieldExpiredAt = "expired_at"
2025-06-25 15:25:18 +08:00
// Table holds the table name of the invitecode in the database.
Table = "invite_codes"
)
// Columns holds all SQL columns for invitecode fields.
var Columns = []string{
FieldID,
FieldAdminID,
FieldCode,
FieldStatus,
2025-06-25 15:25:18 +08:00
FieldCreatedAt,
FieldUpdatedAt,
FieldExpiredAt,
2025-06-25 15:25:18 +08:00
}
// 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 (
// DefaultStatus holds the default value on creation for the "status" field.
DefaultStatus consts.InviteCodeStatus
2025-06-25 15:25:18 +08:00
// 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 InviteCode 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()
}
// ByAdminID orders the results by the admin_id field.
func ByAdminID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAdminID, opts...).ToFunc()
}
// ByCode orders the results by the code field.
func ByCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCode, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
2025-06-25 15:25:18 +08:00
// 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()
}
// ByExpiredAt orders the results by the expired_at field.
func ByExpiredAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldExpiredAt, opts...).ToFunc()
}