2022-08-31 07:49:08 +00:00
|
|
|
// Code generated by ent, DO NOT EDIT.
|
|
|
|
|
|
|
|
package ent
|
|
|
|
|
|
|
|
import (
|
2024-02-21 07:06:08 +00:00
|
|
|
"api/ent/user"
|
2022-08-31 07:49:08 +00:00
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
|
2024-02-21 07:06:08 +00:00
|
|
|
"entgo.io/ent"
|
2022-08-31 07:49:08 +00:00
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
)
|
|
|
|
|
|
|
|
// User is the model entity for the User schema.
|
|
|
|
type User struct {
|
|
|
|
config `json:"-"`
|
|
|
|
// ID of the ent.
|
|
|
|
ID int `json:"id,omitempty"`
|
|
|
|
// Username holds the value of the "username" field.
|
|
|
|
Username string `json:"username,omitempty"`
|
2023-04-13 07:50:11 +00:00
|
|
|
// Did holds the value of the "did" field.
|
|
|
|
Did string `json:"did,omitempty"`
|
2023-07-20 14:18:17 +00:00
|
|
|
// Member holds the value of the "member" field.
|
|
|
|
Member bool `json:"member,omitempty"`
|
|
|
|
// Book holds the value of the "book" field.
|
|
|
|
Book bool `json:"book,omitempty"`
|
|
|
|
// Manga holds the value of the "manga" field.
|
|
|
|
Manga bool `json:"manga,omitempty"`
|
|
|
|
// Badge holds the value of the "badge" field.
|
|
|
|
Badge bool `json:"badge,omitempty"`
|
2023-07-10 03:43:09 +00:00
|
|
|
// Bsky holds the value of the "bsky" field.
|
|
|
|
Bsky bool `json:"bsky,omitempty"`
|
|
|
|
// Mastodon holds the value of the "mastodon" field.
|
|
|
|
Mastodon bool `json:"mastodon,omitempty"`
|
2023-05-01 14:00:17 +00:00
|
|
|
// Delete holds the value of the "delete" field.
|
|
|
|
Delete bool `json:"delete,omitempty"`
|
2023-06-21 01:17:52 +00:00
|
|
|
// Handle holds the value of the "handle" field.
|
|
|
|
Handle bool `json:"handle,omitempty"`
|
2023-04-18 12:18:38 +00:00
|
|
|
// Token holds the value of the "token" field.
|
|
|
|
Token string `json:"-"`
|
2023-04-05 06:05:14 +00:00
|
|
|
// Password holds the value of the "password" field.
|
|
|
|
Password string `json:"-"`
|
2022-08-31 07:49:08 +00:00
|
|
|
// CreatedAt holds the value of the "created_at" field.
|
|
|
|
CreatedAt time.Time `json:"created_at,omitempty"`
|
|
|
|
// UpdatedAt holds the value of the "updated_at" field.
|
|
|
|
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
2023-05-24 09:36:44 +00:00
|
|
|
// RaidAt holds the value of the "raid_at" field.
|
|
|
|
RaidAt time.Time `json:"raid_at,omitempty"`
|
2023-09-10 08:53:30 +00:00
|
|
|
// ServerAt holds the value of the "server_at" field.
|
|
|
|
ServerAt time.Time `json:"server_at,omitempty"`
|
2023-07-23 14:40:24 +00:00
|
|
|
// EggAt holds the value of the "egg_at" field.
|
|
|
|
EggAt time.Time `json:"egg_at,omitempty"`
|
2023-05-24 09:36:44 +00:00
|
|
|
// Luck holds the value of the "luck" field.
|
|
|
|
Luck int `json:"luck,omitempty"`
|
|
|
|
// LuckAt holds the value of the "luck_at" field.
|
|
|
|
LuckAt time.Time `json:"luck_at,omitempty"`
|
|
|
|
// Like holds the value of the "like" field.
|
|
|
|
Like int `json:"like,omitempty"`
|
|
|
|
// LikeRank holds the value of the "like_rank" field.
|
|
|
|
LikeRank int `json:"like_rank,omitempty"`
|
|
|
|
// LikeAt holds the value of the "like_at" field.
|
|
|
|
LikeAt time.Time `json:"like_at,omitempty"`
|
2023-07-01 14:21:48 +00:00
|
|
|
// Fav holds the value of the "fav" field.
|
|
|
|
Fav int `json:"fav,omitempty"`
|
2023-05-24 09:36:44 +00:00
|
|
|
// Ten holds the value of the "ten" field.
|
|
|
|
Ten bool `json:"ten,omitempty"`
|
|
|
|
// TenSu holds the value of the "ten_su" field.
|
|
|
|
TenSu int `json:"ten_su,omitempty"`
|
|
|
|
// TenKai holds the value of the "ten_kai" field.
|
|
|
|
TenKai int `json:"ten_kai,omitempty"`
|
|
|
|
// Aiten holds the value of the "aiten" field.
|
|
|
|
Aiten int `json:"aiten,omitempty"`
|
|
|
|
// TenCard holds the value of the "ten_card" field.
|
|
|
|
TenCard string `json:"ten_card,omitempty"`
|
|
|
|
// TenDelete holds the value of the "ten_delete" field.
|
|
|
|
TenDelete string `json:"ten_delete,omitempty"`
|
|
|
|
// TenPost holds the value of the "ten_post" field.
|
|
|
|
TenPost string `json:"ten_post,omitempty"`
|
|
|
|
// TenGet holds the value of the "ten_get" field.
|
|
|
|
TenGet string `json:"ten_get,omitempty"`
|
|
|
|
// TenAt holds the value of the "ten_at" field.
|
|
|
|
TenAt time.Time `json:"ten_at,omitempty"`
|
2022-08-31 07:49:08 +00:00
|
|
|
// Next holds the value of the "next" field.
|
|
|
|
Next string `json:"next,omitempty"`
|
2023-09-10 08:53:30 +00:00
|
|
|
// Room holds the value of the "room" field.
|
|
|
|
Room int `json:"room,omitempty"`
|
2023-11-03 02:24:42 +00:00
|
|
|
// Model holds the value of the "model" field.
|
|
|
|
Model bool `json:"model,omitempty"`
|
|
|
|
// ModelAt holds the value of the "model_at" field.
|
|
|
|
ModelAt time.Time `json:"model_at,omitempty"`
|
|
|
|
// ModelAttack holds the value of the "model_attack" field.
|
|
|
|
ModelAttack int `json:"model_attack,omitempty"`
|
|
|
|
// ModelLimit holds the value of the "model_limit" field.
|
|
|
|
ModelLimit int `json:"model_limit,omitempty"`
|
|
|
|
// ModelSkill holds the value of the "model_skill" field.
|
|
|
|
ModelSkill int `json:"model_skill,omitempty"`
|
|
|
|
// ModelMode holds the value of the "model_mode" field.
|
|
|
|
ModelMode int `json:"model_mode,omitempty"`
|
|
|
|
// ModelCritical holds the value of the "model_critical" field.
|
|
|
|
ModelCritical int `json:"model_critical,omitempty"`
|
|
|
|
// ModelCriticalD holds the value of the "model_critical_d" field.
|
|
|
|
ModelCriticalD int `json:"model_critical_d,omitempty"`
|
|
|
|
// Game holds the value of the "game" field.
|
|
|
|
Game bool `json:"game,omitempty"`
|
|
|
|
// GameTest holds the value of the "game_test" field.
|
|
|
|
GameTest bool `json:"game_test,omitempty"`
|
|
|
|
// GameEnd holds the value of the "game_end" field.
|
|
|
|
GameEnd bool `json:"game_end,omitempty"`
|
|
|
|
// GameAccount holds the value of the "game_account" field.
|
|
|
|
GameAccount bool `json:"game_account,omitempty"`
|
|
|
|
// GameLv holds the value of the "game_lv" field.
|
|
|
|
GameLv int `json:"game_lv,omitempty"`
|
2022-08-31 07:49:08 +00:00
|
|
|
// Edges holds the relations/edges for other nodes in the graph.
|
|
|
|
// The values are being populated by the UserQuery when eager-loading is set.
|
2024-02-21 07:06:08 +00:00
|
|
|
Edges UserEdges `json:"edges"`
|
|
|
|
group_users *int
|
|
|
|
selectValues sql.SelectValues
|
2022-08-31 07:49:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// UserEdges holds the relations/edges for other nodes in the graph.
|
|
|
|
type UserEdges struct {
|
|
|
|
// Card holds the value of the card edge.
|
|
|
|
Card []*Card `json:"card,omitempty"`
|
2024-02-03 06:48:28 +00:00
|
|
|
// Ue holds the value of the ue edge.
|
|
|
|
Ue []*Ue `json:"ue,omitempty"`
|
2022-08-31 07:49:08 +00:00
|
|
|
// loadedTypes holds the information for reporting if a
|
|
|
|
// type was loaded (or requested) in eager-loading or not.
|
2024-02-03 06:48:28 +00:00
|
|
|
loadedTypes [2]bool
|
2022-08-31 07:49:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// CardOrErr returns the Card value or an error if the edge
|
|
|
|
// was not loaded in eager-loading.
|
|
|
|
func (e UserEdges) CardOrErr() ([]*Card, error) {
|
|
|
|
if e.loadedTypes[0] {
|
|
|
|
return e.Card, nil
|
|
|
|
}
|
|
|
|
return nil, &NotLoadedError{edge: "card"}
|
|
|
|
}
|
|
|
|
|
2024-02-03 06:48:28 +00:00
|
|
|
// UeOrErr returns the Ue value or an error if the edge
|
|
|
|
// was not loaded in eager-loading.
|
|
|
|
func (e UserEdges) UeOrErr() ([]*Ue, error) {
|
|
|
|
if e.loadedTypes[1] {
|
|
|
|
return e.Ue, nil
|
|
|
|
}
|
|
|
|
return nil, &NotLoadedError{edge: "ue"}
|
|
|
|
}
|
|
|
|
|
2022-08-31 07:49:08 +00:00
|
|
|
// scanValues returns the types for scanning values from sql.Rows.
|
|
|
|
func (*User) scanValues(columns []string) ([]any, error) {
|
|
|
|
values := make([]any, len(columns))
|
|
|
|
for i := range columns {
|
|
|
|
switch columns[i] {
|
2023-11-03 02:24:42 +00:00
|
|
|
case user.FieldMember, user.FieldBook, user.FieldManga, user.FieldBadge, user.FieldBsky, user.FieldMastodon, user.FieldDelete, user.FieldHandle, user.FieldTen, user.FieldModel, user.FieldGame, user.FieldGameTest, user.FieldGameEnd, user.FieldGameAccount:
|
2023-05-01 14:00:17 +00:00
|
|
|
values[i] = new(sql.NullBool)
|
2023-11-03 02:24:42 +00:00
|
|
|
case user.FieldID, user.FieldLuck, user.FieldLike, user.FieldLikeRank, user.FieldFav, user.FieldTenSu, user.FieldTenKai, user.FieldAiten, user.FieldRoom, user.FieldModelAttack, user.FieldModelLimit, user.FieldModelSkill, user.FieldModelMode, user.FieldModelCritical, user.FieldModelCriticalD, user.FieldGameLv:
|
2022-08-31 07:49:08 +00:00
|
|
|
values[i] = new(sql.NullInt64)
|
2023-05-24 09:36:44 +00:00
|
|
|
case user.FieldUsername, user.FieldDid, user.FieldToken, user.FieldPassword, user.FieldTenCard, user.FieldTenDelete, user.FieldTenPost, user.FieldTenGet, user.FieldNext:
|
2022-08-31 07:49:08 +00:00
|
|
|
values[i] = new(sql.NullString)
|
2023-11-03 02:24:42 +00:00
|
|
|
case user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldRaidAt, user.FieldServerAt, user.FieldEggAt, user.FieldLuckAt, user.FieldLikeAt, user.FieldTenAt, user.FieldModelAt:
|
2022-08-31 07:49:08 +00:00
|
|
|
values[i] = new(sql.NullTime)
|
|
|
|
case user.ForeignKeys[0]: // group_users
|
|
|
|
values[i] = new(sql.NullInt64)
|
|
|
|
default:
|
2024-02-21 07:06:08 +00:00
|
|
|
values[i] = new(sql.UnknownType)
|
2022-08-31 07:49:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return values, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
|
|
|
// to the User fields.
|
|
|
|
func (u *User) assignValues(columns []string, values []any) error {
|
|
|
|
if m, n := len(values), len(columns); m < n {
|
|
|
|
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
|
|
|
}
|
|
|
|
for i := range columns {
|
|
|
|
switch columns[i] {
|
|
|
|
case user.FieldID:
|
|
|
|
value, ok := values[i].(*sql.NullInt64)
|
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field id", value)
|
|
|
|
}
|
|
|
|
u.ID = int(value.Int64)
|
|
|
|
case user.FieldUsername:
|
|
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field username", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Username = value.String
|
|
|
|
}
|
2023-04-13 07:50:11 +00:00
|
|
|
case user.FieldDid:
|
|
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field did", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Did = value.String
|
|
|
|
}
|
2023-07-20 14:18:17 +00:00
|
|
|
case user.FieldMember:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field member", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Member = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldBook:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field book", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Book = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldManga:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field manga", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Manga = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldBadge:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field badge", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Badge = value.Bool
|
|
|
|
}
|
2023-07-10 03:43:09 +00:00
|
|
|
case user.FieldBsky:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field bsky", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Bsky = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldMastodon:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field mastodon", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Mastodon = value.Bool
|
|
|
|
}
|
2023-05-01 14:00:17 +00:00
|
|
|
case user.FieldDelete:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field delete", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Delete = value.Bool
|
|
|
|
}
|
2023-06-21 01:17:52 +00:00
|
|
|
case user.FieldHandle:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field handle", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Handle = value.Bool
|
|
|
|
}
|
2023-04-18 12:18:38 +00:00
|
|
|
case user.FieldToken:
|
|
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field token", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Token = value.String
|
|
|
|
}
|
2023-04-05 06:05:14 +00:00
|
|
|
case user.FieldPassword:
|
|
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field password", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Password = value.String
|
|
|
|
}
|
2022-08-31 07:49:08 +00:00
|
|
|
case user.FieldCreatedAt:
|
|
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.CreatedAt = value.Time
|
|
|
|
}
|
|
|
|
case user.FieldUpdatedAt:
|
|
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.UpdatedAt = value.Time
|
|
|
|
}
|
2023-05-24 09:36:44 +00:00
|
|
|
case user.FieldRaidAt:
|
|
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field raid_at", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.RaidAt = value.Time
|
|
|
|
}
|
2023-09-10 08:53:30 +00:00
|
|
|
case user.FieldServerAt:
|
|
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field server_at", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.ServerAt = value.Time
|
|
|
|
}
|
2023-07-23 14:40:24 +00:00
|
|
|
case user.FieldEggAt:
|
|
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field egg_at", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.EggAt = value.Time
|
|
|
|
}
|
2023-05-24 09:36:44 +00:00
|
|
|
case user.FieldLuck:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field luck", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Luck = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldLuckAt:
|
|
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field luck_at", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.LuckAt = value.Time
|
|
|
|
}
|
|
|
|
case user.FieldLike:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field like", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Like = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldLikeRank:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field like_rank", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.LikeRank = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldLikeAt:
|
|
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field like_at", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.LikeAt = value.Time
|
|
|
|
}
|
2023-07-01 14:21:48 +00:00
|
|
|
case user.FieldFav:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field fav", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Fav = int(value.Int64)
|
|
|
|
}
|
2023-05-24 09:36:44 +00:00
|
|
|
case user.FieldTen:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field ten", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Ten = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldTenSu:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field ten_su", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.TenSu = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldTenKai:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field ten_kai", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.TenKai = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldAiten:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field aiten", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Aiten = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldTenCard:
|
|
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field ten_card", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.TenCard = value.String
|
|
|
|
}
|
|
|
|
case user.FieldTenDelete:
|
|
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field ten_delete", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.TenDelete = value.String
|
|
|
|
}
|
|
|
|
case user.FieldTenPost:
|
|
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field ten_post", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.TenPost = value.String
|
|
|
|
}
|
|
|
|
case user.FieldTenGet:
|
|
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field ten_get", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.TenGet = value.String
|
|
|
|
}
|
|
|
|
case user.FieldTenAt:
|
|
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field ten_at", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.TenAt = value.Time
|
|
|
|
}
|
2022-08-31 07:49:08 +00:00
|
|
|
case user.FieldNext:
|
|
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field next", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Next = value.String
|
|
|
|
}
|
2023-09-10 08:53:30 +00:00
|
|
|
case user.FieldRoom:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field room", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Room = int(value.Int64)
|
|
|
|
}
|
2023-11-03 02:24:42 +00:00
|
|
|
case user.FieldModel:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field model", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Model = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldModelAt:
|
|
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field model_at", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.ModelAt = value.Time
|
|
|
|
}
|
|
|
|
case user.FieldModelAttack:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field model_attack", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.ModelAttack = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldModelLimit:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field model_limit", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.ModelLimit = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldModelSkill:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field model_skill", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.ModelSkill = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldModelMode:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field model_mode", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.ModelMode = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldModelCritical:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field model_critical", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.ModelCritical = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldModelCriticalD:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field model_critical_d", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.ModelCriticalD = int(value.Int64)
|
|
|
|
}
|
|
|
|
case user.FieldGame:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field game", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.Game = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldGameTest:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field game_test", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.GameTest = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldGameEnd:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field game_end", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.GameEnd = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldGameAccount:
|
|
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field game_account", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.GameAccount = value.Bool
|
|
|
|
}
|
|
|
|
case user.FieldGameLv:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for field game_lv", values[i])
|
|
|
|
} else if value.Valid {
|
|
|
|
u.GameLv = int(value.Int64)
|
|
|
|
}
|
2022-08-31 07:49:08 +00:00
|
|
|
case user.ForeignKeys[0]:
|
|
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
|
|
return fmt.Errorf("unexpected type %T for edge-field group_users", value)
|
|
|
|
} else if value.Valid {
|
|
|
|
u.group_users = new(int)
|
|
|
|
*u.group_users = int(value.Int64)
|
|
|
|
}
|
2024-02-21 07:06:08 +00:00
|
|
|
default:
|
|
|
|
u.selectValues.Set(columns[i], values[i])
|
2022-08-31 07:49:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-02-21 07:06:08 +00:00
|
|
|
// 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)
|
|
|
|
}
|
|
|
|
|
2022-08-31 07:49:08 +00:00
|
|
|
// QueryCard queries the "card" edge of the User entity.
|
|
|
|
func (u *User) QueryCard() *CardQuery {
|
|
|
|
return NewUserClient(u.config).QueryCard(u)
|
|
|
|
}
|
|
|
|
|
2024-02-03 06:48:28 +00:00
|
|
|
// QueryUe queries the "ue" edge of the User entity.
|
|
|
|
func (u *User) QueryUe() *UeQuery {
|
|
|
|
return NewUserClient(u.config).QueryUe(u)
|
|
|
|
}
|
|
|
|
|
2022-08-31 07:49:08 +00:00
|
|
|
// Update returns a builder for updating this User.
|
|
|
|
// Note that you need to call User.Unwrap() before calling this method if this User
|
|
|
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
|
|
|
func (u *User) Update() *UserUpdateOne {
|
|
|
|
return NewUserClient(u.config).UpdateOne(u)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unwrap unwraps the User entity that was returned from a transaction after it was closed,
|
|
|
|
// so that all future queries will be executed through the driver which created the transaction.
|
|
|
|
func (u *User) Unwrap() *User {
|
|
|
|
_tx, ok := u.config.driver.(*txDriver)
|
|
|
|
if !ok {
|
|
|
|
panic("ent: User is not a transactional entity")
|
|
|
|
}
|
|
|
|
u.config.driver = _tx.drv
|
|
|
|
return u
|
|
|
|
}
|
|
|
|
|
|
|
|
// String implements the fmt.Stringer.
|
|
|
|
func (u *User) String() string {
|
|
|
|
var builder strings.Builder
|
|
|
|
builder.WriteString("User(")
|
|
|
|
builder.WriteString(fmt.Sprintf("id=%v, ", u.ID))
|
|
|
|
builder.WriteString("username=")
|
|
|
|
builder.WriteString(u.Username)
|
|
|
|
builder.WriteString(", ")
|
2023-04-13 07:50:11 +00:00
|
|
|
builder.WriteString("did=")
|
|
|
|
builder.WriteString(u.Did)
|
|
|
|
builder.WriteString(", ")
|
2023-07-20 14:18:17 +00:00
|
|
|
builder.WriteString("member=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Member))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("book=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Book))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("manga=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Manga))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("badge=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Badge))
|
|
|
|
builder.WriteString(", ")
|
2023-07-10 03:43:09 +00:00
|
|
|
builder.WriteString("bsky=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Bsky))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("mastodon=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Mastodon))
|
|
|
|
builder.WriteString(", ")
|
2023-05-01 14:00:17 +00:00
|
|
|
builder.WriteString("delete=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Delete))
|
|
|
|
builder.WriteString(", ")
|
2023-06-21 01:17:52 +00:00
|
|
|
builder.WriteString("handle=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Handle))
|
|
|
|
builder.WriteString(", ")
|
2023-04-18 12:18:38 +00:00
|
|
|
builder.WriteString("token=<sensitive>")
|
|
|
|
builder.WriteString(", ")
|
2023-04-05 06:05:14 +00:00
|
|
|
builder.WriteString("password=<sensitive>")
|
|
|
|
builder.WriteString(", ")
|
2022-08-31 07:49:08 +00:00
|
|
|
builder.WriteString("created_at=")
|
|
|
|
builder.WriteString(u.CreatedAt.Format(time.ANSIC))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("updated_at=")
|
|
|
|
builder.WriteString(u.UpdatedAt.Format(time.ANSIC))
|
|
|
|
builder.WriteString(", ")
|
2023-05-24 09:36:44 +00:00
|
|
|
builder.WriteString("raid_at=")
|
|
|
|
builder.WriteString(u.RaidAt.Format(time.ANSIC))
|
|
|
|
builder.WriteString(", ")
|
2023-09-10 08:53:30 +00:00
|
|
|
builder.WriteString("server_at=")
|
|
|
|
builder.WriteString(u.ServerAt.Format(time.ANSIC))
|
|
|
|
builder.WriteString(", ")
|
2023-07-23 14:40:24 +00:00
|
|
|
builder.WriteString("egg_at=")
|
|
|
|
builder.WriteString(u.EggAt.Format(time.ANSIC))
|
|
|
|
builder.WriteString(", ")
|
2023-05-24 09:36:44 +00:00
|
|
|
builder.WriteString("luck=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Luck))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("luck_at=")
|
|
|
|
builder.WriteString(u.LuckAt.Format(time.ANSIC))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("like=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Like))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("like_rank=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.LikeRank))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("like_at=")
|
|
|
|
builder.WriteString(u.LikeAt.Format(time.ANSIC))
|
|
|
|
builder.WriteString(", ")
|
2023-07-01 14:21:48 +00:00
|
|
|
builder.WriteString("fav=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Fav))
|
|
|
|
builder.WriteString(", ")
|
2023-05-24 09:36:44 +00:00
|
|
|
builder.WriteString("ten=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Ten))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("ten_su=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.TenSu))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("ten_kai=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.TenKai))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("aiten=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Aiten))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("ten_card=")
|
|
|
|
builder.WriteString(u.TenCard)
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("ten_delete=")
|
|
|
|
builder.WriteString(u.TenDelete)
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("ten_post=")
|
|
|
|
builder.WriteString(u.TenPost)
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("ten_get=")
|
|
|
|
builder.WriteString(u.TenGet)
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("ten_at=")
|
|
|
|
builder.WriteString(u.TenAt.Format(time.ANSIC))
|
|
|
|
builder.WriteString(", ")
|
2022-08-31 07:49:08 +00:00
|
|
|
builder.WriteString("next=")
|
|
|
|
builder.WriteString(u.Next)
|
2023-09-10 08:53:30 +00:00
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("room=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Room))
|
2023-11-03 02:24:42 +00:00
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("model=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Model))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("model_at=")
|
|
|
|
builder.WriteString(u.ModelAt.Format(time.ANSIC))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("model_attack=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.ModelAttack))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("model_limit=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.ModelLimit))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("model_skill=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.ModelSkill))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("model_mode=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.ModelMode))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("model_critical=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.ModelCritical))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("model_critical_d=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.ModelCriticalD))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("game=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.Game))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("game_test=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.GameTest))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("game_end=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.GameEnd))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("game_account=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.GameAccount))
|
|
|
|
builder.WriteString(", ")
|
|
|
|
builder.WriteString("game_lv=")
|
|
|
|
builder.WriteString(fmt.Sprintf("%v", u.GameLv))
|
2022-08-31 07:49:08 +00:00
|
|
|
builder.WriteByte(')')
|
|
|
|
return builder.String()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Users is a parsable slice of User.
|
|
|
|
type Users []*User
|