name change
This commit is contained in:
.gitignoreProcfilebuild.zsh
ent
card.go
go.modgo.summain.gorun.zshcard
card_create.gocard_delete.gocard_query.gocard_update.goclient.goent.goenttest
group.gogroup
group_create.gogroup_delete.gogroup_query.gogroup_update.gohook
migrate
mutation.googent
runtime.goruntime
ue.goue
ue_create.goue_delete.goue_query.goue_update.gouser.gouser
user_create.gouser_delete.gouser_query.gouser_update.goscpt
card_account_change.zshcard_account_change_fix.zshcard_account_delete.zshcard_account_select_delete.zshcard_add.zshcard_add_16.zshcard_add_45.zshcard_add_book1.zshcard_add_change.zshcard_author_first.zshcard_day.zshcard_delete.zshcard_did_change.zshcard_fav_first.zshcard_fav_second.zshcard_limit.zshcard_limit_all.zshcard_limit_loop.zshcard_limit_select.zshcard_search.zshcard_sqlite.zshcard_test.zshgame_account.zshmodel_account.zshmodel_account_all.zshtest.zshue_add_test.zshuser_did.zshuser_json.zsh
tmp
20
ent/card.go
20
ent/card.go
@@ -3,12 +3,13 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/user"
|
||||
"fmt"
|
||||
"strings"
|
||||
"t/ent/card"
|
||||
"t/ent/user"
|
||||
"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 (
|
||||
@@ -93,6 +96,80 @@ var (
|
||||
DefaultCp func() int
|
||||
// DefaultURL holds the default value on creation for the "url" field.
|
||||
DefaultURL string
|
||||
// DefaultAuthor holds the default value on creation for the "author" field.
|
||||
DefaultAuthor string
|
||||
// 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),
|
||||
)
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
package card
|
||||
|
||||
import (
|
||||
"t/ent/predicate"
|
||||
"api/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
@@ -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)
|
||||
|
@@ -3,11 +3,11 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"t/ent/card"
|
||||
"t/ent/user"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -219,6 +219,10 @@ func (cc *CardCreate) defaults() {
|
||||
v := card.DefaultURL
|
||||
cc.mutation.SetURL(v)
|
||||
}
|
||||
if _, ok := cc.mutation.Author(); !ok {
|
||||
v := card.DefaultAuthor
|
||||
cc.mutation.SetAuthor(v)
|
||||
}
|
||||
if _, ok := cc.mutation.CreatedAt(); !ok {
|
||||
v := card.DefaultCreatedAt()
|
||||
cc.mutation.SetCreatedAt(v)
|
||||
@@ -348,8 +352,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 {
|
||||
|
@@ -3,9 +3,9 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/predicate"
|
||||
"context"
|
||||
"t/ent/card"
|
||||
"t/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
|
@@ -3,12 +3,12 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/predicate"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"t/ent/card"
|
||||
"t/ent/predicate"
|
||||
"t/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -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(),
|
||||
|
@@ -3,12 +3,12 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/predicate"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"t/ent/card"
|
||||
"t/ent/predicate"
|
||||
"t/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
|
@@ -8,12 +8,12 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"t/ent/migrate"
|
||||
"api/ent/migrate"
|
||||
|
||||
"t/ent/card"
|
||||
"t/ent/group"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
"api/ent/card"
|
||||
"api/ent/group"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
|
68
ent/ent.go
68
ent/ent.go
@@ -3,14 +3,15 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/group"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"t/ent/card"
|
||||
"t/ent/group"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
"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 ""
|
||||
}
|
||||
|
@@ -3,12 +3,12 @@
|
||||
package enttest
|
||||
|
||||
import (
|
||||
"api/ent"
|
||||
"context"
|
||||
"t/ent"
|
||||
// required by schema hooks.
|
||||
_ "t/ent/runtime"
|
||||
_ "api/ent/runtime"
|
||||
|
||||
"t/ent/migrate"
|
||||
"api/ent/migrate"
|
||||
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
)
|
||||
|
16
ent/group.go
16
ent/group.go
@@ -3,10 +3,11 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/group"
|
||||
"fmt"
|
||||
"strings"
|
||||
"t/ent/group"
|
||||
|
||||
"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),
|
||||
)
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"t/ent/predicate"
|
||||
"api/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -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)
|
||||
|
@@ -3,11 +3,11 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/group"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"t/ent/group"
|
||||
"t/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
@@ -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 {
|
||||
|
@@ -3,9 +3,9 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/group"
|
||||
"api/ent/predicate"
|
||||
"context"
|
||||
"t/ent/group"
|
||||
"t/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
|
@@ -3,13 +3,13 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/group"
|
||||
"api/ent/predicate"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"math"
|
||||
"t/ent/group"
|
||||
"t/ent/predicate"
|
||||
"t/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -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)
|
||||
}
|
||||
|
@@ -3,12 +3,12 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/group"
|
||||
"api/ent/predicate"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"t/ent/group"
|
||||
"t/ent/predicate"
|
||||
"t/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
|
@@ -3,9 +3,9 @@
|
||||
package hook
|
||||
|
||||
import (
|
||||
"api/ent"
|
||||
"context"
|
||||
"fmt"
|
||||
"t/ent"
|
||||
)
|
||||
|
||||
// The CardFunc type is an adapter to allow the use of ordinary
|
||||
|
@@ -19,7 +19,7 @@ var (
|
||||
{Name: "cp", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "url", Type: field.TypeString, Nullable: true, Default: "https://card.syui.ai"},
|
||||
{Name: "count", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "author", Type: field.TypeString, Nullable: true},
|
||||
{Name: "author", Type: field.TypeString, Nullable: true, Default: "yui"},
|
||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "user_card", Type: field.TypeInt},
|
||||
}
|
||||
@@ -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: "20240213"},
|
||||
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20240221"},
|
||||
{Name: "room", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "model", Type: field.TypeBool, Nullable: true},
|
||||
{Name: "model_at", Type: field.TypeTime, Nullable: true},
|
||||
|
@@ -3,15 +3,15 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/group"
|
||||
"api/ent/predicate"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"t/ent/card"
|
||||
"t/ent/group"
|
||||
"t/ent/predicate"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
|
@@ -6,11 +6,11 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"t/ent"
|
||||
"t/ent/card"
|
||||
"t/ent/group"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
"api/ent"
|
||||
"api/ent/card"
|
||||
"api/ent/group"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"os"
|
||||
"github.com/go-faster/jx"
|
||||
)
|
||||
@@ -198,8 +198,8 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
|
||||
|
||||
// DeleteCard handles DELETE /cards/{id} requests.
|
||||
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
|
||||
err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
|
||||
//err := h.client.Card.DeleteOneID(0).Exec(ctx)
|
||||
//err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
|
||||
err := h.client.Card.DeleteOneID(0).Exec(ctx)
|
||||
if err != nil {
|
||||
switch {
|
||||
case ent.IsNotFound(err):
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
package ogent
|
||||
|
||||
import "t/ent"
|
||||
import "api/ent"
|
||||
|
||||
func NewCardCreate(e *ent.Card) *CardCreate {
|
||||
if e == nil {
|
||||
|
@@ -1,13 +1,18 @@
|
||||
// +build tools
|
||||
// +build tools
|
||||
// +build tools
|
||||
// +build tools
|
||||
// +build tools
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"t/ent/card"
|
||||
"t/ent/group"
|
||||
"t/ent/schema"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
"api/ent/card"
|
||||
"api/ent/group"
|
||||
"api/ent/schema"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -41,6 +46,10 @@ func init() {
|
||||
cardDescURL := cardFields[6].Descriptor()
|
||||
// card.DefaultURL holds the default value on creation for the url field.
|
||||
card.DefaultURL = cardDescURL.Default.(string)
|
||||
// cardDescAuthor is the schema descriptor for author field.
|
||||
cardDescAuthor := cardFields[8].Descriptor()
|
||||
// card.DefaultAuthor holds the default value on creation for the author field.
|
||||
card.DefaultAuthor = cardDescAuthor.Default.(string)
|
||||
// cardDescCreatedAt is the schema descriptor for created_at field.
|
||||
cardDescCreatedAt := cardFields[9].Descriptor()
|
||||
// card.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
|
@@ -2,9 +2,9 @@
|
||||
|
||||
package runtime
|
||||
|
||||
// The schema-stitching logic is generated in t/ent/runtime.go
|
||||
// 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.
|
||||
)
|
||||
|
20
ent/ue.go
20
ent/ue.go
@@ -3,12 +3,13 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"fmt"
|
||||
"strings"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
"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),
|
||||
)
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
package ue
|
||||
|
||||
import (
|
||||
"t/ent/predicate"
|
||||
"api/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
@@ -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)
|
||||
|
@@ -3,11 +3,11 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -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 {
|
||||
|
@@ -3,9 +3,9 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/predicate"
|
||||
"api/ent/ue"
|
||||
"context"
|
||||
"t/ent/predicate"
|
||||
"t/ent/ue"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
|
@@ -3,12 +3,12 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/predicate"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"t/ent/predicate"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -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(),
|
||||
|
@@ -3,12 +3,12 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/predicate"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"t/ent/predicate"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
|
18
ent/user.go
18
ent/user.go
@@ -3,11 +3,12 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/user"
|
||||
"fmt"
|
||||
"strings"
|
||||
"t/ent/user"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
@@ -112,8 +113,9 @@ type User struct {
|
||||
GameLv int `json:"game_lv,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.
|
||||
@@ -161,7 +163,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
|
||||
@@ -470,11 +472,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)
|
||||
|
288
ent/user/user.go
288
ent/user/user.go
@@ -4,6 +4,9 @@ package user
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -250,3 +253,288 @@ var (
|
||||
// DefaultGameAccount holds the default value on creation for the "game_account" field.
|
||||
DefaultGameAccount bool
|
||||
)
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
// 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),
|
||||
)
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"t/ent/predicate"
|
||||
"api/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
@@ -2439,11 +2439,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)
|
||||
@@ -2466,11 +2462,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)
|
||||
|
@@ -3,12 +3,12 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"t/ent/card"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -1110,8 +1110,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 {
|
||||
|
@@ -3,9 +3,9 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/predicate"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"t/ent/predicate"
|
||||
"t/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
|
@@ -3,14 +3,14 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/predicate"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"math"
|
||||
"t/ent/card"
|
||||
"t/ent/predicate"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -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)
|
||||
}
|
||||
|
@@ -3,13 +3,13 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"api/ent/card"
|
||||
"api/ent/predicate"
|
||||
"api/ent/ue"
|
||||
"api/ent/user"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"t/ent/card"
|
||||
"t/ent/predicate"
|
||||
"t/ent/ue"
|
||||
"t/ent/user"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
|
Reference in New Issue
Block a user