730 lines
26 KiB
Go
730 lines
26 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"api/ent/user"
|
|
"fmt"
|
|
"strings"
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"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"`
|
|
// Did holds the value of the "did" field.
|
|
Did string `json:"did,omitempty"`
|
|
// 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"`
|
|
// 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"`
|
|
// Delete holds the value of the "delete" field.
|
|
Delete bool `json:"delete,omitempty"`
|
|
// Handle holds the value of the "handle" field.
|
|
Handle bool `json:"handle,omitempty"`
|
|
// Token holds the value of the "token" field.
|
|
Token string `json:"-"`
|
|
// Password holds the value of the "password" field.
|
|
Password string `json:"-"`
|
|
// 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"`
|
|
// RaidAt holds the value of the "raid_at" field.
|
|
RaidAt time.Time `json:"raid_at,omitempty"`
|
|
// ServerAt holds the value of the "server_at" field.
|
|
ServerAt time.Time `json:"server_at,omitempty"`
|
|
// EggAt holds the value of the "egg_at" field.
|
|
EggAt time.Time `json:"egg_at,omitempty"`
|
|
// 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"`
|
|
// Fav holds the value of the "fav" field.
|
|
Fav int `json:"fav,omitempty"`
|
|
// 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"`
|
|
// Next holds the value of the "next" field.
|
|
Next string `json:"next,omitempty"`
|
|
// Room holds the value of the "room" field.
|
|
Room int `json:"room,omitempty"`
|
|
// 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"`
|
|
// Coin holds the value of the "coin" field.
|
|
Coin int `json:"coin,omitempty"`
|
|
// CoinOpen holds the value of the "coin_open" field.
|
|
CoinOpen bool `json:"coin_open,omitempty"`
|
|
// CoinAt holds the value of the "coin_at" field.
|
|
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
|
|
selectValues sql.SelectValues
|
|
}
|
|
|
|
// 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"`
|
|
// Ue holds the value of the ue edge.
|
|
Ue []*Ue `json:"ue,omitempty"`
|
|
// Ma holds the value of the ma edge.
|
|
Ma []*Ma `json:"ma,omitempty"`
|
|
// Sev holds the value of the sev edge.
|
|
Sev []*Sev `json:"sev,omitempty"`
|
|
// loadedTypes holds the information for reporting if a
|
|
// type was loaded (or requested) in eager-loading or not.
|
|
loadedTypes [4]bool
|
|
}
|
|
|
|
// 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"}
|
|
}
|
|
|
|
// 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"}
|
|
}
|
|
|
|
// MaOrErr returns the Ma value or an error if the edge
|
|
// was not loaded in eager-loading.
|
|
func (e UserEdges) MaOrErr() ([]*Ma, error) {
|
|
if e.loadedTypes[2] {
|
|
return e.Ma, nil
|
|
}
|
|
return nil, &NotLoadedError{edge: "ma"}
|
|
}
|
|
|
|
// SevOrErr returns the Sev value or an error if the edge
|
|
// was not loaded in eager-loading.
|
|
func (e UserEdges) SevOrErr() ([]*Sev, error) {
|
|
if e.loadedTypes[3] {
|
|
return e.Sev, nil
|
|
}
|
|
return nil, &NotLoadedError{edge: "sev"}
|
|
}
|
|
|
|
// 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] {
|
|
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, user.FieldCoinOpen:
|
|
values[i] = new(sql.NullBool)
|
|
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, user.FieldCoin:
|
|
values[i] = new(sql.NullInt64)
|
|
case user.FieldUsername, user.FieldDid, user.FieldToken, user.FieldPassword, user.FieldTenCard, user.FieldTenDelete, user.FieldTenPost, user.FieldTenGet, user.FieldNext:
|
|
values[i] = new(sql.NullString)
|
|
case user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldRaidAt, user.FieldServerAt, user.FieldEggAt, user.FieldLuckAt, user.FieldLikeAt, user.FieldTenAt, user.FieldModelAt, user.FieldCoinAt:
|
|
values[i] = new(sql.NullTime)
|
|
case user.ForeignKeys[0]: // group_users
|
|
values[i] = new(sql.NullInt64)
|
|
default:
|
|
values[i] = new(sql.UnknownType)
|
|
}
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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)
|
|
}
|
|
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
|
|
}
|
|
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
|
|
}
|
|
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)
|
|
}
|
|
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)
|
|
}
|
|
case user.FieldCoin:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field coin", values[i])
|
|
} else if value.Valid {
|
|
u.Coin = int(value.Int64)
|
|
}
|
|
case user.FieldCoinOpen:
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
return fmt.Errorf("unexpected type %T for field coin_open", values[i])
|
|
} else if value.Valid {
|
|
u.CoinOpen = value.Bool
|
|
}
|
|
case user.FieldCoinAt:
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
return fmt.Errorf("unexpected type %T for field coin_at", values[i])
|
|
} else if value.Valid {
|
|
u.CoinAt = value.Time
|
|
}
|
|
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)
|
|
}
|
|
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)
|
|
}
|
|
|
|
// QueryUe queries the "ue" edge of the User entity.
|
|
func (u *User) QueryUe() *UeQuery {
|
|
return NewUserClient(u.config).QueryUe(u)
|
|
}
|
|
|
|
// QueryMa queries the "ma" edge of the User entity.
|
|
func (u *User) QueryMa() *MaQuery {
|
|
return NewUserClient(u.config).QueryMa(u)
|
|
}
|
|
|
|
// QuerySev queries the "sev" edge of the User entity.
|
|
func (u *User) QuerySev() *SevQuery {
|
|
return NewUserClient(u.config).QuerySev(u)
|
|
}
|
|
|
|
// 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(", ")
|
|
builder.WriteString("did=")
|
|
builder.WriteString(u.Did)
|
|
builder.WriteString(", ")
|
|
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(", ")
|
|
builder.WriteString("bsky=")
|
|
builder.WriteString(fmt.Sprintf("%v", u.Bsky))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("mastodon=")
|
|
builder.WriteString(fmt.Sprintf("%v", u.Mastodon))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("delete=")
|
|
builder.WriteString(fmt.Sprintf("%v", u.Delete))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("handle=")
|
|
builder.WriteString(fmt.Sprintf("%v", u.Handle))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("token=<sensitive>")
|
|
builder.WriteString(", ")
|
|
builder.WriteString("password=<sensitive>")
|
|
builder.WriteString(", ")
|
|
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(", ")
|
|
builder.WriteString("raid_at=")
|
|
builder.WriteString(u.RaidAt.Format(time.ANSIC))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("server_at=")
|
|
builder.WriteString(u.ServerAt.Format(time.ANSIC))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("egg_at=")
|
|
builder.WriteString(u.EggAt.Format(time.ANSIC))
|
|
builder.WriteString(", ")
|
|
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(", ")
|
|
builder.WriteString("fav=")
|
|
builder.WriteString(fmt.Sprintf("%v", u.Fav))
|
|
builder.WriteString(", ")
|
|
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(", ")
|
|
builder.WriteString("next=")
|
|
builder.WriteString(u.Next)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("room=")
|
|
builder.WriteString(fmt.Sprintf("%v", u.Room))
|
|
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))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("coin=")
|
|
builder.WriteString(fmt.Sprintf("%v", u.Coin))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("coin_open=")
|
|
builder.WriteString(fmt.Sprintf("%v", u.CoinOpen))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("coin_at=")
|
|
builder.WriteString(u.CoinAt.Format(time.ANSIC))
|
|
builder.WriteByte(')')
|
|
return builder.String()
|
|
}
|
|
|
|
// Users is a parsable slice of User.
|
|
type Users []*User
|