mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-02-04 07:43:28 +08:00
feat(backend): add basic backend code
This commit is contained in:
82
backend/db/invitecode/invitecode.go
Normal file
82
backend/db/invitecode/invitecode.go
Normal file
@@ -0,0 +1,82 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package invitecode
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
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"
|
||||
// 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 invitecode in the database.
|
||||
Table = "invite_codes"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for invitecode fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldAdminID,
|
||||
FieldCode,
|
||||
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 (
|
||||
// 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()
|
||||
}
|
||||
|
||||
// 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()
|
||||
}
|
||||
276
backend/db/invitecode/where.go
Normal file
276
backend/db/invitecode/where.go
Normal file
@@ -0,0 +1,276 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package invitecode
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"github.com/chaitin/MonkeyCode/backend/db/predicate"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// AdminID applies equality check predicate on the "admin_id" field. It's identical to AdminIDEQ.
|
||||
func AdminID(v uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldAdminID, v))
|
||||
}
|
||||
|
||||
// Code applies equality check predicate on the "code" field. It's identical to CodeEQ.
|
||||
func Code(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldCode, v))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
func CreatedAt(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
|
||||
func UpdatedAt(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// AdminIDEQ applies the EQ predicate on the "admin_id" field.
|
||||
func AdminIDEQ(v uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldAdminID, v))
|
||||
}
|
||||
|
||||
// AdminIDNEQ applies the NEQ predicate on the "admin_id" field.
|
||||
func AdminIDNEQ(v uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNEQ(FieldAdminID, v))
|
||||
}
|
||||
|
||||
// AdminIDIn applies the In predicate on the "admin_id" field.
|
||||
func AdminIDIn(vs ...uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldIn(FieldAdminID, vs...))
|
||||
}
|
||||
|
||||
// AdminIDNotIn applies the NotIn predicate on the "admin_id" field.
|
||||
func AdminIDNotIn(vs ...uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNotIn(FieldAdminID, vs...))
|
||||
}
|
||||
|
||||
// AdminIDGT applies the GT predicate on the "admin_id" field.
|
||||
func AdminIDGT(v uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGT(FieldAdminID, v))
|
||||
}
|
||||
|
||||
// AdminIDGTE applies the GTE predicate on the "admin_id" field.
|
||||
func AdminIDGTE(v uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGTE(FieldAdminID, v))
|
||||
}
|
||||
|
||||
// AdminIDLT applies the LT predicate on the "admin_id" field.
|
||||
func AdminIDLT(v uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLT(FieldAdminID, v))
|
||||
}
|
||||
|
||||
// AdminIDLTE applies the LTE predicate on the "admin_id" field.
|
||||
func AdminIDLTE(v uuid.UUID) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLTE(FieldAdminID, v))
|
||||
}
|
||||
|
||||
// CodeEQ applies the EQ predicate on the "code" field.
|
||||
func CodeEQ(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeNEQ applies the NEQ predicate on the "code" field.
|
||||
func CodeNEQ(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNEQ(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeIn applies the In predicate on the "code" field.
|
||||
func CodeIn(vs ...string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldIn(FieldCode, vs...))
|
||||
}
|
||||
|
||||
// CodeNotIn applies the NotIn predicate on the "code" field.
|
||||
func CodeNotIn(vs ...string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNotIn(FieldCode, vs...))
|
||||
}
|
||||
|
||||
// CodeGT applies the GT predicate on the "code" field.
|
||||
func CodeGT(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGT(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeGTE applies the GTE predicate on the "code" field.
|
||||
func CodeGTE(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGTE(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeLT applies the LT predicate on the "code" field.
|
||||
func CodeLT(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLT(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeLTE applies the LTE predicate on the "code" field.
|
||||
func CodeLTE(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLTE(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeContains applies the Contains predicate on the "code" field.
|
||||
func CodeContains(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldContains(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeHasPrefix applies the HasPrefix predicate on the "code" field.
|
||||
func CodeHasPrefix(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldHasPrefix(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeHasSuffix applies the HasSuffix predicate on the "code" field.
|
||||
func CodeHasSuffix(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldHasSuffix(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeEqualFold applies the EqualFold predicate on the "code" field.
|
||||
func CodeEqualFold(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEqualFold(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeContainsFold applies the ContainsFold predicate on the "code" field.
|
||||
func CodeContainsFold(v string) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldContainsFold(FieldCode, v))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
||||
func CreatedAtNEQ(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNotIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
||||
func CreatedAtGT(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
||||
func CreatedAtGTE(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
||||
func CreatedAtLT(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
||||
func CreatedAtLTE(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
|
||||
func UpdatedAtNEQ(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldNotIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
|
||||
func UpdatedAtGT(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
|
||||
func UpdatedAtGTE(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldGTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
|
||||
func UpdatedAtLT(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
|
||||
func UpdatedAtLTE(v time.Time) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.InviteCode) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.InviteCode) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.InviteCode) predicate.InviteCode {
|
||||
return predicate.InviteCode(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user