first gen
This commit is contained in:
74
ent/user/user.go
Normal file
74
ent/user/user.go
Normal file
@ -0,0 +1,74 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package user
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the user type in the database.
|
||||
Label = "user"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldUsername holds the string denoting the username field in the database.
|
||||
FieldUsername = "username"
|
||||
// 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"
|
||||
// FieldNext holds the string denoting the next field in the database.
|
||||
FieldNext = "next"
|
||||
// EdgeCard holds the string denoting the card edge name in mutations.
|
||||
EdgeCard = "card"
|
||||
// Table holds the table name of the user in the database.
|
||||
Table = "users"
|
||||
// CardTable is the table that holds the card relation/edge.
|
||||
CardTable = "cards"
|
||||
// CardInverseTable is the table name for the Card entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "card" package.
|
||||
CardInverseTable = "cards"
|
||||
// CardColumn is the table column denoting the card relation/edge.
|
||||
CardColumn = "user_card"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for user fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldUsername,
|
||||
FieldCreatedAt,
|
||||
FieldUpdatedAt,
|
||||
FieldNext,
|
||||
}
|
||||
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "users"
|
||||
// table and are not defined as standalone fields in the schema.
|
||||
var ForeignKeys = []string{
|
||||
"group_users",
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
for i := range ForeignKeys {
|
||||
if column == ForeignKeys[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
||||
UsernameValidator 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
|
||||
// DefaultNext holds the default value on creation for the "next" field.
|
||||
DefaultNext string
|
||||
)
|
375
ent/user/where.go
Normal file
375
ent/user/where.go
Normal file
@ -0,0 +1,375 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package user
|
||||
|
||||
import (
|
||||
"t/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Username applies equality check predicate on the "username" field. It's identical to UsernameEQ.
|
||||
func Username(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldUsername, v))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
func CreatedAt(v time.Time) predicate.User {
|
||||
return predicate.User(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.User {
|
||||
return predicate.User(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// Next applies equality check predicate on the "next" field. It's identical to NextEQ.
|
||||
func Next(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldNext, v))
|
||||
}
|
||||
|
||||
// UsernameEQ applies the EQ predicate on the "username" field.
|
||||
func UsernameEQ(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameNEQ applies the NEQ predicate on the "username" field.
|
||||
func UsernameNEQ(v string) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameIn applies the In predicate on the "username" field.
|
||||
func UsernameIn(vs ...string) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldUsername, vs...))
|
||||
}
|
||||
|
||||
// UsernameNotIn applies the NotIn predicate on the "username" field.
|
||||
func UsernameNotIn(vs ...string) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldUsername, vs...))
|
||||
}
|
||||
|
||||
// UsernameGT applies the GT predicate on the "username" field.
|
||||
func UsernameGT(v string) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameGTE applies the GTE predicate on the "username" field.
|
||||
func UsernameGTE(v string) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameLT applies the LT predicate on the "username" field.
|
||||
func UsernameLT(v string) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameLTE applies the LTE predicate on the "username" field.
|
||||
func UsernameLTE(v string) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameContains applies the Contains predicate on the "username" field.
|
||||
func UsernameContains(v string) predicate.User {
|
||||
return predicate.User(sql.FieldContains(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameHasPrefix applies the HasPrefix predicate on the "username" field.
|
||||
func UsernameHasPrefix(v string) predicate.User {
|
||||
return predicate.User(sql.FieldHasPrefix(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameHasSuffix applies the HasSuffix predicate on the "username" field.
|
||||
func UsernameHasSuffix(v string) predicate.User {
|
||||
return predicate.User(sql.FieldHasSuffix(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameEqualFold applies the EqualFold predicate on the "username" field.
|
||||
func UsernameEqualFold(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEqualFold(FieldUsername, v))
|
||||
}
|
||||
|
||||
// UsernameContainsFold applies the ContainsFold predicate on the "username" field.
|
||||
func UsernameContainsFold(v string) predicate.User {
|
||||
return predicate.User(sql.FieldContainsFold(FieldUsername, v))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
||||
func CreatedAtNEQ(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
||||
func CreatedAtGT(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
||||
func CreatedAtGTE(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
||||
func CreatedAtLT(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
||||
func CreatedAtLTE(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
|
||||
func CreatedAtIsNil() predicate.User {
|
||||
return predicate.User(sql.FieldIsNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
|
||||
func CreatedAtNotNil() predicate.User {
|
||||
return predicate.User(sql.FieldNotNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
|
||||
func UpdatedAtNEQ(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
|
||||
func UpdatedAtGT(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
|
||||
func UpdatedAtGTE(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
|
||||
func UpdatedAtLT(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
|
||||
func UpdatedAtLTE(v time.Time) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||
func UpdatedAtIsNil() predicate.User {
|
||||
return predicate.User(sql.FieldIsNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||
func UpdatedAtNotNil() predicate.User {
|
||||
return predicate.User(sql.FieldNotNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// NextEQ applies the EQ predicate on the "next" field.
|
||||
func NextEQ(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextNEQ applies the NEQ predicate on the "next" field.
|
||||
func NextNEQ(v string) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextIn applies the In predicate on the "next" field.
|
||||
func NextIn(vs ...string) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldNext, vs...))
|
||||
}
|
||||
|
||||
// NextNotIn applies the NotIn predicate on the "next" field.
|
||||
func NextNotIn(vs ...string) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldNext, vs...))
|
||||
}
|
||||
|
||||
// NextGT applies the GT predicate on the "next" field.
|
||||
func NextGT(v string) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextGTE applies the GTE predicate on the "next" field.
|
||||
func NextGTE(v string) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextLT applies the LT predicate on the "next" field.
|
||||
func NextLT(v string) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextLTE applies the LTE predicate on the "next" field.
|
||||
func NextLTE(v string) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextContains applies the Contains predicate on the "next" field.
|
||||
func NextContains(v string) predicate.User {
|
||||
return predicate.User(sql.FieldContains(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextHasPrefix applies the HasPrefix predicate on the "next" field.
|
||||
func NextHasPrefix(v string) predicate.User {
|
||||
return predicate.User(sql.FieldHasPrefix(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextHasSuffix applies the HasSuffix predicate on the "next" field.
|
||||
func NextHasSuffix(v string) predicate.User {
|
||||
return predicate.User(sql.FieldHasSuffix(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextIsNil applies the IsNil predicate on the "next" field.
|
||||
func NextIsNil() predicate.User {
|
||||
return predicate.User(sql.FieldIsNull(FieldNext))
|
||||
}
|
||||
|
||||
// NextNotNil applies the NotNil predicate on the "next" field.
|
||||
func NextNotNil() predicate.User {
|
||||
return predicate.User(sql.FieldNotNull(FieldNext))
|
||||
}
|
||||
|
||||
// NextEqualFold applies the EqualFold predicate on the "next" field.
|
||||
func NextEqualFold(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEqualFold(FieldNext, v))
|
||||
}
|
||||
|
||||
// NextContainsFold applies the ContainsFold predicate on the "next" field.
|
||||
func NextContainsFold(v string) predicate.User {
|
||||
return predicate.User(sql.FieldContainsFold(FieldNext, v))
|
||||
}
|
||||
|
||||
// HasCard applies the HasEdge predicate on the "card" edge.
|
||||
func HasCard() predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, CardTable, CardColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasCardWith applies the HasEdge predicate on the "card" edge with a given conditions (other predicates).
|
||||
func HasCardWith(preds ...predicate.Card) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(CardInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, CardTable, CardColumn),
|
||||
)
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.User) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for _, p := range predicates {
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.User) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for i, p := range predicates {
|
||||
if i > 0 {
|
||||
s1.Or()
|
||||
}
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.User) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
p(s.Not())
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user