update go
This commit is contained in:
16
ent/card.go
16
ent/card.go
@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@ -39,8 +40,9 @@ type Card struct {
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the CardQuery when eager-loading is set.
|
||||
Edges CardEdges `json:"edges"`
|
||||
user_card *int
|
||||
Edges CardEdges `json:"edges"`
|
||||
user_card *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// CardEdges holds the relations/edges for other nodes in the graph.
|
||||
@ -79,7 +81,7 @@ func (*Card) scanValues(columns []string) ([]any, error) {
|
||||
case card.ForeignKeys[0]: // user_card
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Card", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@ -166,11 +168,19 @@ func (c *Card) assignValues(columns []string, values []any) error {
|
||||
c.user_card = new(int)
|
||||
*c.user_card = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
c.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Card.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (c *Card) Value(name string) (ent.Value, error) {
|
||||
return c.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryOwner queries the "owner" edge of the Card entity.
|
||||
func (c *Card) QueryOwner() *UserQuery {
|
||||
return NewCardClient(c.config).QueryOwner(c)
|
||||
|
@ -4,6 +4,9 @@ package card
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -96,3 +99,75 @@ var (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Card 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()
|
||||
}
|
||||
|
||||
// ByPassword orders the results by the password field.
|
||||
func ByPassword(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPassword, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCard orders the results by the card field.
|
||||
func ByCard(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCard, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySkill orders the results by the skill field.
|
||||
func BySkill(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSkill, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatus orders the results by the status field.
|
||||
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByToken orders the results by the token field.
|
||||
func ByToken(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldToken, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCp orders the results by the cp field.
|
||||
func ByCp(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCp, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByURL orders the results by the url field.
|
||||
func ByURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldURL, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCount orders the results by the count field.
|
||||
func ByCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAuthor orders the results by the author field.
|
||||
func ByAuthor(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAuthor, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreatedAt orders the results by the created_at field.
|
||||
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByOwnerField orders the results by owner field.
|
||||
func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newOwnerStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(OwnerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
|
||||
)
|
||||
}
|
||||
|
@ -759,11 +759,7 @@ func HasOwner() predicate.Card {
|
||||
// HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates).
|
||||
func HasOwnerWith(preds ...predicate.User) predicate.Card {
|
||||
return predicate.Card(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(OwnerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
|
||||
)
|
||||
step := newOwnerStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@ -348,8 +348,8 @@ func (ccb *CardCreateBulk) Save(ctx context.Context) ([]*Card, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
type CardQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []card.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Card
|
||||
withOwner *UserQuery
|
||||
@ -55,7 +55,7 @@ func (cq *CardQuery) Unique(unique bool) *CardQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (cq *CardQuery) Order(o ...OrderFunc) *CardQuery {
|
||||
func (cq *CardQuery) Order(o ...card.OrderOption) *CardQuery {
|
||||
cq.order = append(cq.order, o...)
|
||||
return cq
|
||||
}
|
||||
@ -271,7 +271,7 @@ func (cq *CardQuery) Clone() *CardQuery {
|
||||
return &CardQuery{
|
||||
config: cq.config,
|
||||
ctx: cq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, cq.order...),
|
||||
order: append([]card.OrderOption{}, cq.order...),
|
||||
inters: append([]Interceptor{}, cq.inters...),
|
||||
predicates: append([]predicate.Card{}, cq.predicates...),
|
||||
withOwner: cq.withOwner.Clone(),
|
||||
|
60
ent/ent.go
60
ent/ent.go
@ -11,6 +11,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
@ -63,36 +64,32 @@ func NewTxContext(parent context.Context, tx *Tx) context.Context {
|
||||
}
|
||||
|
||||
// OrderFunc applies an ordering on the sql selector.
|
||||
// Deprecated: Use Asc/Desc functions or the package builders instead.
|
||||
type OrderFunc func(*sql.Selector)
|
||||
|
||||
// columnChecker returns a function indicates if the column exists in the given column.
|
||||
func columnChecker(table string) func(string) error {
|
||||
checks := map[string]func(string) bool{
|
||||
card.Table: card.ValidColumn,
|
||||
group.Table: group.ValidColumn,
|
||||
ue.Table: ue.ValidColumn,
|
||||
user.Table: user.ValidColumn,
|
||||
}
|
||||
check, ok := checks[table]
|
||||
if !ok {
|
||||
return func(string) error {
|
||||
return fmt.Errorf("unknown table %q", table)
|
||||
}
|
||||
}
|
||||
return func(column string) error {
|
||||
if !check(column) {
|
||||
return fmt.Errorf("unknown column %q for table %q", column, table)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
var (
|
||||
initCheck sync.Once
|
||||
columnCheck sql.ColumnCheck
|
||||
)
|
||||
|
||||
// columnChecker checks if the column exists in the given table.
|
||||
func checkColumn(table, column string) error {
|
||||
initCheck.Do(func() {
|
||||
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
|
||||
card.Table: card.ValidColumn,
|
||||
group.Table: group.ValidColumn,
|
||||
ue.Table: ue.ValidColumn,
|
||||
user.Table: user.ValidColumn,
|
||||
})
|
||||
})
|
||||
return columnCheck(table, column)
|
||||
}
|
||||
|
||||
// Asc applies the given fields in ASC order.
|
||||
func Asc(fields ...string) OrderFunc {
|
||||
func Asc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
check := columnChecker(s.TableName())
|
||||
for _, f := range fields {
|
||||
if err := check(f); err != nil {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Asc(s.C(f)))
|
||||
@ -101,11 +98,10 @@ func Asc(fields ...string) OrderFunc {
|
||||
}
|
||||
|
||||
// Desc applies the given fields in DESC order.
|
||||
func Desc(fields ...string) OrderFunc {
|
||||
func Desc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
check := columnChecker(s.TableName())
|
||||
for _, f := range fields {
|
||||
if err := check(f); err != nil {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Desc(s.C(f)))
|
||||
@ -137,8 +133,7 @@ func Count() AggregateFunc {
|
||||
// Max applies the "max" aggregation function on the given field of each group.
|
||||
func Max(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@ -149,8 +144,7 @@ func Max(field string) AggregateFunc {
|
||||
// Mean applies the "mean" aggregation function on the given field of each group.
|
||||
func Mean(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@ -161,8 +155,7 @@ func Mean(field string) AggregateFunc {
|
||||
// Min applies the "min" aggregation function on the given field of each group.
|
||||
func Min(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@ -173,8 +166,7 @@ func Min(field string) AggregateFunc {
|
||||
// Sum applies the "sum" aggregation function on the given field of each group.
|
||||
func Sum(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
|
14
ent/group.go
14
ent/group.go
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@ -21,7 +22,8 @@ type Group struct {
|
||||
Password string `json:"-"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the GroupQuery when eager-loading is set.
|
||||
Edges GroupEdges `json:"edges"`
|
||||
Edges GroupEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// GroupEdges holds the relations/edges for other nodes in the graph.
|
||||
@ -52,7 +54,7 @@ func (*Group) scanValues(columns []string) ([]any, error) {
|
||||
case group.FieldName, group.FieldPassword:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Group", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@ -84,11 +86,19 @@ func (gr *Group) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
gr.Password = value.String
|
||||
}
|
||||
default:
|
||||
gr.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Group.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (gr *Group) Value(name string) (ent.Value, error) {
|
||||
return gr.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryUsers queries the "users" edge of the Group entity.
|
||||
func (gr *Group) QueryUsers() *UserQuery {
|
||||
return NewGroupClient(gr.config).QueryUsers(gr)
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
package group
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the group type in the database.
|
||||
Label = "group"
|
||||
@ -45,3 +50,42 @@ var (
|
||||
// PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
||||
PasswordValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Group 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()
|
||||
}
|
||||
|
||||
// ByName orders the results by the name field.
|
||||
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPassword orders the results by the password field.
|
||||
func ByPassword(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPassword, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUsersCount orders the results by users count.
|
||||
func ByUsersCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newUsersStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByUsers orders the results by users terms.
|
||||
func ByUsers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newUsersStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newUsersStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(UsersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, UsersTable, UsersColumn),
|
||||
)
|
||||
}
|
||||
|
@ -208,11 +208,7 @@ func HasUsers() predicate.Group {
|
||||
// HasUsersWith applies the HasEdge predicate on the "users" edge with a given conditions (other predicates).
|
||||
func HasUsersWith(preds ...predicate.User) predicate.Group {
|
||||
return predicate.Group(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(UsersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, UsersTable, UsersColumn),
|
||||
)
|
||||
step := newUsersStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@ -168,8 +168,8 @@ func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, gcb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
type GroupQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []group.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Group
|
||||
withUsers *UserQuery
|
||||
@ -55,7 +55,7 @@ func (gq *GroupQuery) Unique(unique bool) *GroupQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (gq *GroupQuery) Order(o ...OrderFunc) *GroupQuery {
|
||||
func (gq *GroupQuery) Order(o ...group.OrderOption) *GroupQuery {
|
||||
gq.order = append(gq.order, o...)
|
||||
return gq
|
||||
}
|
||||
@ -271,7 +271,7 @@ func (gq *GroupQuery) Clone() *GroupQuery {
|
||||
return &GroupQuery{
|
||||
config: gq.config,
|
||||
ctx: gq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, gq.order...),
|
||||
order: append([]group.OrderOption{}, gq.order...),
|
||||
inters: append([]Interceptor{}, gq.inters...),
|
||||
predicates: append([]predicate.Group{}, gq.predicates...),
|
||||
withUsers: gq.withUsers.Clone(),
|
||||
@ -414,7 +414,7 @@ func (gq *GroupQuery) loadUsers(ctx context.Context, query *UserQuery, nodes []*
|
||||
}
|
||||
query.withFKs = true
|
||||
query.Where(predicate.User(func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(group.UsersColumn, fks...))
|
||||
s.Where(sql.InValues(s.C(group.UsersColumn), fks...))
|
||||
}))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
@ -427,7 +427,7 @@ func (gq *GroupQuery) loadUsers(ctx context.Context, query *UserQuery, nodes []*
|
||||
}
|
||||
node, ok := nodeids[*fk]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "group_users" returned %v for node %v`, *fk, n.ID)
|
||||
return fmt.Errorf(`unexpected referenced foreign-key "group_users" returned %v for node %v`, *fk, n.ID)
|
||||
}
|
||||
assign(node, n)
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ var (
|
||||
{Name: "ten_post", Type: field.TypeString, Nullable: true},
|
||||
{Name: "ten_get", Type: field.TypeString, Nullable: true},
|
||||
{Name: "ten_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20240222"},
|
||||
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20240327"},
|
||||
{Name: "room", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "model", Type: field.TypeBool, Nullable: true},
|
||||
{Name: "model_at", Type: field.TypeTime, Nullable: true},
|
||||
|
@ -5,6 +5,6 @@ package runtime
|
||||
// The schema-stitching logic is generated in api/ent/runtime.go
|
||||
|
||||
const (
|
||||
Version = "v0.11.10" // Version of ent codegen.
|
||||
Sum = "h1:iqn32ybY5HRW3xSAyMNdNKpZhKgMf1Zunsej9yPKUI8=" // Sum of ent codegen.
|
||||
Version = "v0.12.2" // Version of ent codegen.
|
||||
Sum = "h1:Ndl/JvCX76xCtUDlrUfMnOKBRodAtxE5yfGYxjbOxmM=" // Sum of ent codegen.
|
||||
)
|
||||
|
16
ent/ue.go
16
ent/ue.go
@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@ -57,8 +58,9 @@ type Ue struct {
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the UeQuery when eager-loading is set.
|
||||
Edges UeEdges `json:"edges"`
|
||||
user_ue *int
|
||||
Edges UeEdges `json:"edges"`
|
||||
user_ue *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// UeEdges holds the relations/edges for other nodes in the graph.
|
||||
@ -99,7 +101,7 @@ func (*Ue) scanValues(columns []string) ([]any, error) {
|
||||
case ue.ForeignKeys[0]: // user_ue
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Ue", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@ -240,11 +242,19 @@ func (u *Ue) assignValues(columns []string, values []any) error {
|
||||
u.user_ue = new(int)
|
||||
*u.user_ue = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
u.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Ue.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (u *Ue) Value(name string) (ent.Value, error) {
|
||||
return u.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryOwner queries the "owner" edge of the Ue entity.
|
||||
func (u *Ue) QueryOwner() *UserQuery {
|
||||
return NewUeClient(u.config).QueryOwner(u)
|
||||
|
120
ent/ue/ue.go
120
ent/ue/ue.go
@ -4,6 +4,9 @@ package ue
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -119,3 +122,120 @@ var (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Ue 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()
|
||||
}
|
||||
|
||||
// ByLimit orders the results by the limit field.
|
||||
func ByLimit(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLimit, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLimitBoss orders the results by the limit_boss field.
|
||||
func ByLimitBoss(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLimitBoss, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLimitItem orders the results by the limit_item field.
|
||||
func ByLimitItem(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLimitItem, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPassword orders the results by the password field.
|
||||
func ByPassword(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPassword, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLv orders the results by the lv field.
|
||||
func ByLv(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLv, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLvPoint orders the results by the lv_point field.
|
||||
func ByLvPoint(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLvPoint, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModel orders the results by the model field.
|
||||
func ByModel(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModel, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySword orders the results by the sword field.
|
||||
func BySword(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSword, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCard orders the results by the card field.
|
||||
func ByCard(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCard, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMode orders the results by the mode field.
|
||||
func ByMode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByToken orders the results by the token field.
|
||||
func ByToken(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldToken, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCp orders the results by the cp field.
|
||||
func ByCp(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCp, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCount orders the results by the count field.
|
||||
func ByCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLocationX orders the results by the location_x field.
|
||||
func ByLocationX(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLocationX, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLocationY orders the results by the location_y field.
|
||||
func ByLocationY(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLocationY, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLocationZ orders the results by the location_z field.
|
||||
func ByLocationZ(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLocationZ, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLocationN orders the results by the location_n field.
|
||||
func ByLocationN(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLocationN, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAuthor orders the results by the author field.
|
||||
func ByAuthor(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAuthor, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreatedAt orders the results by the created_at field.
|
||||
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByOwnerField orders the results by owner field.
|
||||
func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newOwnerStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(OwnerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
|
||||
)
|
||||
}
|
||||
|
@ -1114,11 +1114,7 @@ func HasOwner() predicate.Ue {
|
||||
// HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates).
|
||||
func HasOwnerWith(preds ...predicate.User) predicate.Ue {
|
||||
return predicate.Ue(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(OwnerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
|
||||
)
|
||||
step := newOwnerStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@ -502,8 +502,8 @@ func (ucb *UeCreateBulk) Save(ctx context.Context) ([]*Ue, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
type UeQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []ue.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Ue
|
||||
withOwner *UserQuery
|
||||
@ -55,7 +55,7 @@ func (uq *UeQuery) Unique(unique bool) *UeQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (uq *UeQuery) Order(o ...OrderFunc) *UeQuery {
|
||||
func (uq *UeQuery) Order(o ...ue.OrderOption) *UeQuery {
|
||||
uq.order = append(uq.order, o...)
|
||||
return uq
|
||||
}
|
||||
@ -271,7 +271,7 @@ func (uq *UeQuery) Clone() *UeQuery {
|
||||
return &UeQuery{
|
||||
config: uq.config,
|
||||
ctx: uq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, uq.order...),
|
||||
order: append([]ue.OrderOption{}, uq.order...),
|
||||
inters: append([]Interceptor{}, uq.inters...),
|
||||
predicates: append([]predicate.Ue{}, uq.predicates...),
|
||||
withOwner: uq.withOwner.Clone(),
|
||||
|
16
ent/user.go
16
ent/user.go
@ -8,6 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@ -118,8 +119,9 @@ type User struct {
|
||||
CoinAt time.Time `json:"coin_at,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the UserQuery when eager-loading is set.
|
||||
Edges UserEdges `json:"edges"`
|
||||
group_users *int
|
||||
Edges UserEdges `json:"edges"`
|
||||
group_users *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// UserEdges holds the relations/edges for other nodes in the graph.
|
||||
@ -167,7 +169,7 @@ func (*User) scanValues(columns []string) ([]any, error) {
|
||||
case user.ForeignKeys[0]: // group_users
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type User", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@ -494,11 +496,19 @@ func (u *User) assignValues(columns []string, values []any) error {
|
||||
u.group_users = new(int)
|
||||
*u.group_users = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
u.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the User.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (u *User) Value(name string) (ent.Value, error) {
|
||||
return u.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryCard queries the "card" edge of the User entity.
|
||||
func (u *User) QueryCard() *CardQuery {
|
||||
return NewUserClient(u.config).QueryCard(u)
|
||||
|
303
ent/user/user.go
303
ent/user/user.go
@ -4,6 +4,9 @@ package user
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -263,3 +266,303 @@ var (
|
||||
// DefaultCoinAt holds the default value on creation for the "coin_at" field.
|
||||
DefaultCoinAt func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the User 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()
|
||||
}
|
||||
|
||||
// ByUsername orders the results by the username field.
|
||||
func ByUsername(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUsername, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDid orders the results by the did field.
|
||||
func ByDid(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDid, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMember orders the results by the member field.
|
||||
func ByMember(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMember, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBook orders the results by the book field.
|
||||
func ByBook(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBook, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByManga orders the results by the manga field.
|
||||
func ByManga(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldManga, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBadge orders the results by the badge field.
|
||||
func ByBadge(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBadge, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBsky orders the results by the bsky field.
|
||||
func ByBsky(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBsky, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMastodon orders the results by the mastodon field.
|
||||
func ByMastodon(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMastodon, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDelete orders the results by the delete field.
|
||||
func ByDelete(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDelete, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHandle orders the results by the handle field.
|
||||
func ByHandle(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHandle, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByToken orders the results by the token field.
|
||||
func ByToken(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldToken, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPassword orders the results by the password field.
|
||||
func ByPassword(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPassword, 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()
|
||||
}
|
||||
|
||||
// ByRaidAt orders the results by the raid_at field.
|
||||
func ByRaidAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRaidAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByServerAt orders the results by the server_at field.
|
||||
func ByServerAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldServerAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByEggAt orders the results by the egg_at field.
|
||||
func ByEggAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldEggAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLuck orders the results by the luck field.
|
||||
func ByLuck(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLuck, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLuckAt orders the results by the luck_at field.
|
||||
func ByLuckAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLuckAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLike orders the results by the like field.
|
||||
func ByLike(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLike, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLikeRank orders the results by the like_rank field.
|
||||
func ByLikeRank(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLikeRank, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLikeAt orders the results by the like_at field.
|
||||
func ByLikeAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLikeAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFav orders the results by the fav field.
|
||||
func ByFav(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFav, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTen orders the results by the ten field.
|
||||
func ByTen(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTen, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTenSu orders the results by the ten_su field.
|
||||
func ByTenSu(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTenSu, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTenKai orders the results by the ten_kai field.
|
||||
func ByTenKai(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTenKai, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAiten orders the results by the aiten field.
|
||||
func ByAiten(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAiten, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTenCard orders the results by the ten_card field.
|
||||
func ByTenCard(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTenCard, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTenDelete orders the results by the ten_delete field.
|
||||
func ByTenDelete(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTenDelete, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTenPost orders the results by the ten_post field.
|
||||
func ByTenPost(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTenPost, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTenGet orders the results by the ten_get field.
|
||||
func ByTenGet(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTenGet, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTenAt orders the results by the ten_at field.
|
||||
func ByTenAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTenAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByNext orders the results by the next field.
|
||||
func ByNext(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldNext, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRoom orders the results by the room field.
|
||||
func ByRoom(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRoom, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModel orders the results by the model field.
|
||||
func ByModel(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModel, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModelAt orders the results by the model_at field.
|
||||
func ByModelAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModelAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModelAttack orders the results by the model_attack field.
|
||||
func ByModelAttack(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModelAttack, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModelLimit orders the results by the model_limit field.
|
||||
func ByModelLimit(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModelLimit, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModelSkill orders the results by the model_skill field.
|
||||
func ByModelSkill(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModelSkill, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModelMode orders the results by the model_mode field.
|
||||
func ByModelMode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModelMode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModelCritical orders the results by the model_critical field.
|
||||
func ByModelCritical(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModelCritical, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModelCriticalD orders the results by the model_critical_d field.
|
||||
func ByModelCriticalD(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModelCriticalD, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGame orders the results by the game field.
|
||||
func ByGame(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGame, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGameTest orders the results by the game_test field.
|
||||
func ByGameTest(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGameTest, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGameEnd orders the results by the game_end field.
|
||||
func ByGameEnd(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGameEnd, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGameAccount orders the results by the game_account field.
|
||||
func ByGameAccount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGameAccount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGameLv orders the results by the game_lv field.
|
||||
func ByGameLv(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGameLv, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCoin orders the results by the coin field.
|
||||
func ByCoin(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCoin, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCoinOpen orders the results by the coin_open field.
|
||||
func ByCoinOpen(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCoinOpen, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCoinAt orders the results by the coin_at field.
|
||||
func ByCoinAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCoinAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCardCount orders the results by card count.
|
||||
func ByCardCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newCardStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByCard orders the results by card terms.
|
||||
func ByCard(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newCardStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByUeCount orders the results by ue count.
|
||||
func ByUeCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newUeStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByUe orders the results by ue terms.
|
||||
func ByUe(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newUeStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newCardStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(CardInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, CardTable, CardColumn),
|
||||
)
|
||||
}
|
||||
func newUeStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(UeInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, UeTable, UeColumn),
|
||||
)
|
||||
}
|
||||
|
@ -2574,11 +2574,7 @@ func HasCard() predicate.User {
|
||||
// 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),
|
||||
)
|
||||
step := newCardStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@ -2601,11 +2597,7 @@ func HasUe() predicate.User {
|
||||
// HasUeWith applies the HasEdge predicate on the "ue" edge with a given conditions (other predicates).
|
||||
func HasUeWith(preds ...predicate.Ue) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(UeInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, UeTable, UeColumn),
|
||||
)
|
||||
step := newUeStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@ -1172,8 +1172,8 @@ func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
type UserQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []user.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.User
|
||||
withCard *CardQuery
|
||||
@ -58,7 +58,7 @@ func (uq *UserQuery) Unique(unique bool) *UserQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery {
|
||||
func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery {
|
||||
uq.order = append(uq.order, o...)
|
||||
return uq
|
||||
}
|
||||
@ -296,7 +296,7 @@ func (uq *UserQuery) Clone() *UserQuery {
|
||||
return &UserQuery{
|
||||
config: uq.config,
|
||||
ctx: uq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, uq.order...),
|
||||
order: append([]user.OrderOption{}, uq.order...),
|
||||
inters: append([]Interceptor{}, uq.inters...),
|
||||
predicates: append([]predicate.User{}, uq.predicates...),
|
||||
withCard: uq.withCard.Clone(),
|
||||
@ -463,7 +463,7 @@ func (uq *UserQuery) loadCard(ctx context.Context, query *CardQuery, nodes []*Us
|
||||
}
|
||||
query.withFKs = true
|
||||
query.Where(predicate.Card(func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(user.CardColumn, fks...))
|
||||
s.Where(sql.InValues(s.C(user.CardColumn), fks...))
|
||||
}))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
@ -476,7 +476,7 @@ func (uq *UserQuery) loadCard(ctx context.Context, query *CardQuery, nodes []*Us
|
||||
}
|
||||
node, ok := nodeids[*fk]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "user_card" returned %v for node %v`, *fk, n.ID)
|
||||
return fmt.Errorf(`unexpected referenced foreign-key "user_card" returned %v for node %v`, *fk, n.ID)
|
||||
}
|
||||
assign(node, n)
|
||||
}
|
||||
@ -494,7 +494,7 @@ func (uq *UserQuery) loadUe(ctx context.Context, query *UeQuery, nodes []*User,
|
||||
}
|
||||
query.withFKs = true
|
||||
query.Where(predicate.Ue(func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(user.UeColumn, fks...))
|
||||
s.Where(sql.InValues(s.C(user.UeColumn), fks...))
|
||||
}))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
@ -507,7 +507,7 @@ func (uq *UserQuery) loadUe(ctx context.Context, query *UeQuery, nodes []*User,
|
||||
}
|
||||
node, ok := nodeids[*fk]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "user_ue" returned %v for node %v`, *fk, n.ID)
|
||||
return fmt.Errorf(`unexpected referenced foreign-key "user_ue" returned %v for node %v`, *fk, n.ID)
|
||||
}
|
||||
assign(node, n)
|
||||
}
|
||||
|
Reference in New Issue
Block a user