1
0

add model

This commit is contained in:
syui 2023-11-03 11:24:42 +09:00
parent a35e67d683
commit ca01557445
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
27 changed files with 7092 additions and 355 deletions

View File

@ -5,6 +5,7 @@ cd $d
su=5000
go generate ./...
cp -rf $d/ent/openapi.json $d/tmp/
sed -i '' "s/255/$su/g" $d/ent/ogent/oas_parameters_gen.go
sed -i '' "s/255/$su/g" $d/ent/openapi.json

View File

@ -91,8 +91,21 @@ 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: "20230911"},
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20231231"},
{Name: "room", Type: field.TypeInt, Nullable: true},
{Name: "model", Type: field.TypeBool, Nullable: true},
{Name: "model_at", Type: field.TypeTime, Nullable: true},
{Name: "model_attack", Type: field.TypeInt, Nullable: true},
{Name: "model_limit", Type: field.TypeInt, Nullable: true},
{Name: "model_skill", Type: field.TypeInt, Nullable: true},
{Name: "model_mode", Type: field.TypeInt, Nullable: true},
{Name: "model_critical", Type: field.TypeInt, Nullable: true},
{Name: "model_critical_d", Type: field.TypeInt, Nullable: true},
{Name: "game", Type: field.TypeBool, Nullable: true, Default: false},
{Name: "game_test", Type: field.TypeBool, Nullable: true, Default: false},
{Name: "game_end", Type: field.TypeBool, Nullable: true, Default: false},
{Name: "game_account", Type: field.TypeBool, Nullable: true, Default: false},
{Name: "game_lv", Type: field.TypeInt, Nullable: true},
{Name: "group_users", Type: field.TypeInt, Nullable: true},
}
// UsersTable holds the schema information for the "users" table.
@ -103,7 +116,7 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "users_groups_users",
Columns: []*schema.Column{UsersColumns[35]},
Columns: []*schema.Column{UsersColumns[48]},
RefColumns: []*schema.Column{GroupsColumns[0]},
OnDelete: schema.SetNull,
},

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -915,7 +915,7 @@ func encodeReadGroupResponse(response ReadGroupRes, w http.ResponseWriter, span
}
func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "*")
switch response := response.(type) {
case *UserRead:
w.Header().Set("Content-Type", "application/json")

File diff suppressed because it is too large Load Diff

View File

@ -603,6 +603,46 @@ func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (Crea
if v, ok := req.Next.Get(); ok {
b.SetNext(v)
}
if v, ok := req.Model.Get(); ok {
b.SetModel(v)
}
if v, ok := req.ModelAt.Get(); ok {
b.SetModelAt(v)
}
if v, ok := req.ModelAttack.Get(); ok {
b.SetModelAttack(v)
}
if v, ok := req.ModelCriticalD.Get(); ok {
b.SetModelCriticalD(v)
}
if v, ok := req.ModelCritical.Get(); ok {
b.SetModelCritical(v)
}
if v, ok := req.ModelLimit.Get(); ok {
b.SetModelLimit(v)
}
if v, ok := req.ModelSkill.Get(); ok {
b.SetModelSkill(v)
}
if v, ok := req.ModelMode.Get(); ok {
b.SetModelMode(v)
}
if v, ok := req.Game.Get(); ok {
b.SetGame(v)
}
if v, ok := req.GameTest.Get(); ok {
b.SetGameTest(v)
}
if v, ok := req.GameEnd.Get(); ok {
b.SetGameEnd(v)
}
if v, ok := req.GameAccount.Get(); ok {
b.SetGameAccount(v)
}
if v, ok := req.GameLv.Get(); ok {
b.SetGameLv(v)
}
// Add all edges.
b.AddCardIDs(req.Card...)
// Persist to storage.
@ -760,6 +800,45 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
if v, ok := req.Next.Get(); ok {
b.SetNext(v)
}
if v, ok := req.Model.Get(); ok {
b.SetModel(v)
}
if v, ok := req.ModelAt.Get(); ok {
b.SetModelAt(v)
}
if v, ok := req.ModelAttack.Get(); ok {
b.SetModelAttack(v)
}
if v, ok := req.ModelCriticalD.Get(); ok {
b.SetModelCriticalD(v)
}
if v, ok := req.ModelCritical.Get(); ok {
b.SetModelCritical(v)
}
if v, ok := req.ModelLimit.Get(); ok {
b.SetModelLimit(v)
}
if v, ok := req.ModelSkill.Get(); ok {
b.SetModelSkill(v)
}
if v, ok := req.ModelMode.Get(); ok {
b.SetModelMode(v)
}
if v, ok := req.Game.Get(); ok {
b.SetGame(v)
}
if v, ok := req.GameTest.Get(); ok {
b.SetGameTest(v)
}
if v, ok := req.GameEnd.Get(); ok {
b.SetGameEnd(v)
}
if v, ok := req.GameAccount.Get(); ok {
b.SetGameAccount(v)
}
if v, ok := req.GameLv.Get(); ok {
b.SetGameLv(v)
}
// Add all edges.
if req.Card != nil {
b.ClearCard().AddCardIDs(req.Card...)

View File

@ -182,6 +182,19 @@ func NewCardOwnerRead(e *ent.User) *CardOwnerRead {
ret.TenAt = NewOptDateTime(e.TenAt)
ret.Next = NewOptString(e.Next)
ret.Room = NewOptInt(e.Room)
ret.Model = NewOptBool(e.Model)
ret.ModelAt = NewOptDateTime(e.ModelAt)
ret.ModelAttack = NewOptInt(e.ModelAttack)
ret.ModelLimit = NewOptInt(e.ModelLimit)
ret.ModelSkill = NewOptInt(e.ModelSkill)
ret.ModelMode = NewOptInt(e.ModelMode)
ret.ModelCritical = NewOptInt(e.ModelCritical)
ret.ModelCriticalD = NewOptInt(e.ModelCriticalD)
ret.Game = NewOptBool(e.Game)
ret.GameTest = NewOptBool(e.GameTest)
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
return &ret
}
@ -353,6 +366,19 @@ func NewGroupUsersList(e *ent.User) *GroupUsersList {
ret.TenAt = NewOptDateTime(e.TenAt)
ret.Next = NewOptString(e.Next)
ret.Room = NewOptInt(e.Room)
ret.Model = NewOptBool(e.Model)
ret.ModelAt = NewOptDateTime(e.ModelAt)
ret.ModelAttack = NewOptInt(e.ModelAttack)
ret.ModelLimit = NewOptInt(e.ModelLimit)
ret.ModelSkill = NewOptInt(e.ModelSkill)
ret.ModelMode = NewOptInt(e.ModelMode)
ret.ModelCritical = NewOptInt(e.ModelCritical)
ret.ModelCriticalD = NewOptInt(e.ModelCriticalD)
ret.Game = NewOptBool(e.Game)
ret.GameTest = NewOptBool(e.GameTest)
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
return &ret
}
@ -412,6 +438,19 @@ func NewUserCreate(e *ent.User) *UserCreate {
ret.TenAt = NewOptDateTime(e.TenAt)
ret.Next = NewOptString(e.Next)
ret.Room = NewOptInt(e.Room)
ret.Model = NewOptBool(e.Model)
ret.ModelAt = NewOptDateTime(e.ModelAt)
ret.ModelAttack = NewOptInt(e.ModelAttack)
ret.ModelLimit = NewOptInt(e.ModelLimit)
ret.ModelSkill = NewOptInt(e.ModelSkill)
ret.ModelMode = NewOptInt(e.ModelMode)
ret.ModelCritical = NewOptInt(e.ModelCritical)
ret.ModelCriticalD = NewOptInt(e.ModelCriticalD)
ret.Game = NewOptBool(e.Game)
ret.GameTest = NewOptBool(e.GameTest)
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
return &ret
}
@ -471,6 +510,19 @@ func NewUserList(e *ent.User) *UserList {
ret.TenAt = NewOptDateTime(e.TenAt)
ret.Next = NewOptString(e.Next)
ret.Room = NewOptInt(e.Room)
ret.Model = NewOptBool(e.Model)
ret.ModelAt = NewOptDateTime(e.ModelAt)
ret.ModelAttack = NewOptInt(e.ModelAttack)
ret.ModelLimit = NewOptInt(e.ModelLimit)
ret.ModelSkill = NewOptInt(e.ModelSkill)
ret.ModelMode = NewOptInt(e.ModelMode)
ret.ModelCritical = NewOptInt(e.ModelCritical)
ret.ModelCriticalD = NewOptInt(e.ModelCriticalD)
ret.Game = NewOptBool(e.Game)
ret.GameTest = NewOptBool(e.GameTest)
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
return &ret
}
@ -530,6 +582,19 @@ func NewUserRead(e *ent.User) *UserRead {
ret.TenAt = NewOptDateTime(e.TenAt)
ret.Next = NewOptString(e.Next)
ret.Room = NewOptInt(e.Room)
ret.Model = NewOptBool(e.Model)
ret.ModelAt = NewOptDateTime(e.ModelAt)
ret.ModelAttack = NewOptInt(e.ModelAttack)
ret.ModelLimit = NewOptInt(e.ModelLimit)
ret.ModelSkill = NewOptInt(e.ModelSkill)
ret.ModelMode = NewOptInt(e.ModelMode)
ret.ModelCritical = NewOptInt(e.ModelCritical)
ret.ModelCriticalD = NewOptInt(e.ModelCriticalD)
ret.Game = NewOptBool(e.Game)
ret.GameTest = NewOptBool(e.GameTest)
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
return &ret
}
@ -589,6 +654,19 @@ func NewUserUpdate(e *ent.User) *UserUpdate {
ret.TenAt = NewOptDateTime(e.TenAt)
ret.Next = NewOptString(e.Next)
ret.Room = NewOptInt(e.Room)
ret.Model = NewOptBool(e.Model)
ret.ModelAt = NewOptDateTime(e.ModelAt)
ret.ModelAttack = NewOptInt(e.ModelAttack)
ret.ModelLimit = NewOptInt(e.ModelLimit)
ret.ModelSkill = NewOptInt(e.ModelSkill)
ret.ModelMode = NewOptInt(e.ModelMode)
ret.ModelCritical = NewOptInt(e.ModelCritical)
ret.ModelCriticalD = NewOptInt(e.ModelCriticalD)
ret.Game = NewOptBool(e.Game)
ret.GameTest = NewOptBool(e.GameTest)
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
return &ret
}

View File

@ -885,6 +885,46 @@
"room": {
"type": "integer"
},
"model": {
"type": "boolean"
},
"model_at": {
"type": "string",
"format": "date-time"
},
"model_attack": {
"type": "integer"
},
"model_limit": {
"type": "integer"
},
"model_skill": {
"type": "integer"
},
"model_mode": {
"type": "integer"
},
"model_critical": {
"type": "integer"
},
"model_critical_d": {
"type": "integer"
},
"game": {
"type": "boolean"
},
"game_test": {
"type": "boolean"
},
"game_end": {
"type": "boolean"
},
"game_account": {
"type": "boolean"
},
"game_lv": {
"type": "integer"
},
"card": {
"type": "array",
"items": {
@ -1129,6 +1169,46 @@
"room": {
"type": "integer"
},
"model": {
"type": "boolean"
},
"model_at": {
"type": "string",
"format": "date-time"
},
"model_attack": {
"type": "integer"
},
"model_limit": {
"type": "integer"
},
"model_skill": {
"type": "integer"
},
"model_mode": {
"type": "integer"
},
"model_critical": {
"type": "integer"
},
"model_critical_d": {
"type": "integer"
},
"game": {
"type": "boolean"
},
"game_test": {
"type": "boolean"
},
"game_end": {
"type": "boolean"
},
"game_account": {
"type": "boolean"
},
"game_lv": {
"type": "integer"
},
"card": {
"type": "array",
"items": {
@ -1559,6 +1639,46 @@
},
"room": {
"type": "integer"
},
"model": {
"type": "boolean"
},
"model_at": {
"type": "string",
"format": "date-time"
},
"model_attack": {
"type": "integer"
},
"model_limit": {
"type": "integer"
},
"model_skill": {
"type": "integer"
},
"model_mode": {
"type": "integer"
},
"model_critical": {
"type": "integer"
},
"model_critical_d": {
"type": "integer"
},
"game": {
"type": "boolean"
},
"game_test": {
"type": "boolean"
},
"game_end": {
"type": "boolean"
},
"game_account": {
"type": "boolean"
},
"game_lv": {
"type": "integer"
}
},
"required": [
@ -1760,6 +1880,46 @@
},
"room": {
"type": "integer"
},
"model": {
"type": "boolean"
},
"model_at": {
"type": "string",
"format": "date-time"
},
"model_attack": {
"type": "integer"
},
"model_limit": {
"type": "integer"
},
"model_skill": {
"type": "integer"
},
"model_mode": {
"type": "integer"
},
"model_critical": {
"type": "integer"
},
"model_critical_d": {
"type": "integer"
},
"game": {
"type": "boolean"
},
"game_test": {
"type": "boolean"
},
"game_end": {
"type": "boolean"
},
"game_account": {
"type": "boolean"
},
"game_lv": {
"type": "integer"
}
},
"required": [
@ -1883,6 +2043,46 @@
"room": {
"type": "integer"
},
"model": {
"type": "boolean"
},
"model_at": {
"type": "string",
"format": "date-time"
},
"model_attack": {
"type": "integer"
},
"model_limit": {
"type": "integer"
},
"model_skill": {
"type": "integer"
},
"model_mode": {
"type": "integer"
},
"model_critical": {
"type": "integer"
},
"model_critical_d": {
"type": "integer"
},
"game": {
"type": "boolean"
},
"game_test": {
"type": "boolean"
},
"game_end": {
"type": "boolean"
},
"game_account": {
"type": "boolean"
},
"game_lv": {
"type": "integer"
},
"card": {
"type": "array",
"items": {
@ -2005,6 +2205,46 @@
},
"room": {
"type": "integer"
},
"model": {
"type": "boolean"
},
"model_at": {
"type": "string",
"format": "date-time"
},
"model_attack": {
"type": "integer"
},
"model_limit": {
"type": "integer"
},
"model_skill": {
"type": "integer"
},
"model_mode": {
"type": "integer"
},
"model_critical": {
"type": "integer"
},
"model_critical_d": {
"type": "integer"
},
"game": {
"type": "boolean"
},
"game_test": {
"type": "boolean"
},
"game_end": {
"type": "boolean"
},
"game_account": {
"type": "boolean"
},
"game_lv": {
"type": "integer"
}
},
"required": [
@ -2121,6 +2361,46 @@
},
"room": {
"type": "integer"
},
"model": {
"type": "boolean"
},
"model_at": {
"type": "string",
"format": "date-time"
},
"model_attack": {
"type": "integer"
},
"model_limit": {
"type": "integer"
},
"model_skill": {
"type": "integer"
},
"model_mode": {
"type": "integer"
},
"model_critical": {
"type": "integer"
},
"model_critical_d": {
"type": "integer"
},
"game": {
"type": "boolean"
},
"game_test": {
"type": "boolean"
},
"game_end": {
"type": "boolean"
},
"game_account": {
"type": "boolean"
},
"game_lv": {
"type": "integer"
}
},
"required": [
@ -2237,6 +2517,46 @@
},
"room": {
"type": "integer"
},
"model": {
"type": "boolean"
},
"model_at": {
"type": "string",
"format": "date-time"
},
"model_attack": {
"type": "integer"
},
"model_limit": {
"type": "integer"
},
"model_skill": {
"type": "integer"
},
"model_mode": {
"type": "integer"
},
"model_critical": {
"type": "integer"
},
"model_critical_d": {
"type": "integer"
},
"game": {
"type": "boolean"
},
"game_test": {
"type": "boolean"
},
"game_end": {
"type": "boolean"
},
"game_account": {
"type": "boolean"
},
"game_lv": {
"type": "integer"
}
},
"required": [
@ -2353,6 +2673,46 @@
},
"room": {
"type": "integer"
},
"model": {
"type": "boolean"
},
"model_at": {
"type": "string",
"format": "date-time"
},
"model_attack": {
"type": "integer"
},
"model_limit": {
"type": "integer"
},
"model_skill": {
"type": "integer"
},
"model_mode": {
"type": "integer"
},
"model_critical": {
"type": "integer"
},
"model_critical_d": {
"type": "integer"
},
"game": {
"type": "boolean"
},
"game_test": {
"type": "boolean"
},
"game_end": {
"type": "boolean"
},
"game_account": {
"type": "boolean"
},
"game_lv": {
"type": "integer"
}
},
"required": [

View File

@ -142,4 +142,24 @@ func init() {
userDescNext := userFields[32].Descriptor()
// user.DefaultNext holds the default value on creation for the next field.
user.DefaultNext = userDescNext.Default.(string)
// userDescModelAt is the schema descriptor for model_at field.
userDescModelAt := userFields[35].Descriptor()
// user.DefaultModelAt holds the default value on creation for the model_at field.
user.DefaultModelAt = userDescModelAt.Default.(func() time.Time)
// userDescGame is the schema descriptor for game field.
userDescGame := userFields[42].Descriptor()
// user.DefaultGame holds the default value on creation for the game field.
user.DefaultGame = userDescGame.Default.(bool)
// userDescGameTest is the schema descriptor for game_test field.
userDescGameTest := userFields[43].Descriptor()
// user.DefaultGameTest holds the default value on creation for the game_test field.
user.DefaultGameTest = userDescGameTest.Default.(bool)
// userDescGameEnd is the schema descriptor for game_end field.
userDescGameEnd := userFields[44].Descriptor()
// user.DefaultGameEnd holds the default value on creation for the game_end field.
user.DefaultGameEnd = userDescGameEnd.Default.(bool)
// userDescGameAccount is the schema descriptor for game_account field.
userDescGameAccount := userFields[45].Descriptor()
// user.DefaultGameAccount holds the default value on creation for the game_account field.
user.DefaultGameAccount = userDescGameAccount.Default.(bool)
}

View File

@ -58,6 +58,7 @@ func (Card) Fields() []ent.Field {
card = 6
}
//var card = rand.Intn(91)
return card
}).
Optional(),

View File

@ -171,6 +171,51 @@ func (User) Fields() []ent.Field {
field.Int("room").
Optional(),
field.Bool("model").
Optional(),
field.Time("model_at").
Optional().
Default(func() time.Time {
return time.Now().In(jst)
}),
field.Int("model_attack").
Optional(),
field.Int("model_limit").
Optional(),
field.Int("model_skill").
Optional(),
field.Int("model_mode").
Optional(),
field.Int("model_critical").
Optional(),
field.Int("model_critical_d").
Optional(),
field.Bool("game").
Default(false).
Optional(),
field.Bool("game_test").
Default(false).
Optional(),
field.Bool("game_end").
Default(false).
Optional(),
field.Bool("game_account").
Default(false).
Optional(),
field.Int("game_lv").
Optional(),
}
}

View File

@ -84,6 +84,32 @@ type User struct {
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"`
// 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"`
@ -113,13 +139,13 @@ 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:
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:
values[i] = new(sql.NullBool)
case user.FieldID, user.FieldLuck, user.FieldLike, user.FieldLikeRank, user.FieldFav, user.FieldTenSu, user.FieldTenKai, user.FieldAiten, user.FieldRoom:
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:
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:
case user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldRaidAt, user.FieldServerAt, user.FieldEggAt, user.FieldLuckAt, user.FieldLikeAt, user.FieldTenAt, user.FieldModelAt:
values[i] = new(sql.NullTime)
case user.ForeignKeys[0]: // group_users
values[i] = new(sql.NullInt64)
@ -348,6 +374,84 @@ func (u *User) assignValues(columns []string, values []any) error {
} 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.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for edge-field group_users", value)
@ -487,6 +591,45 @@ func (u *User) String() string {
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.WriteByte(')')
return builder.String()
}

View File

@ -79,6 +79,32 @@ const (
FieldNext = "next"
// FieldRoom holds the string denoting the room field in the database.
FieldRoom = "room"
// FieldModel holds the string denoting the model field in the database.
FieldModel = "model"
// FieldModelAt holds the string denoting the model_at field in the database.
FieldModelAt = "model_at"
// FieldModelAttack holds the string denoting the model_attack field in the database.
FieldModelAttack = "model_attack"
// FieldModelLimit holds the string denoting the model_limit field in the database.
FieldModelLimit = "model_limit"
// FieldModelSkill holds the string denoting the model_skill field in the database.
FieldModelSkill = "model_skill"
// FieldModelMode holds the string denoting the model_mode field in the database.
FieldModelMode = "model_mode"
// FieldModelCritical holds the string denoting the model_critical field in the database.
FieldModelCritical = "model_critical"
// FieldModelCriticalD holds the string denoting the model_critical_d field in the database.
FieldModelCriticalD = "model_critical_d"
// FieldGame holds the string denoting the game field in the database.
FieldGame = "game"
// FieldGameTest holds the string denoting the game_test field in the database.
FieldGameTest = "game_test"
// FieldGameEnd holds the string denoting the game_end field in the database.
FieldGameEnd = "game_end"
// FieldGameAccount holds the string denoting the game_account field in the database.
FieldGameAccount = "game_account"
// FieldGameLv holds the string denoting the game_lv field in the database.
FieldGameLv = "game_lv"
// EdgeCard holds the string denoting the card edge name in mutations.
EdgeCard = "card"
// Table holds the table name of the user in the database.
@ -129,6 +155,19 @@ var Columns = []string{
FieldTenAt,
FieldNext,
FieldRoom,
FieldModel,
FieldModelAt,
FieldModelAttack,
FieldModelLimit,
FieldModelSkill,
FieldModelMode,
FieldModelCritical,
FieldModelCriticalD,
FieldGame,
FieldGameTest,
FieldGameEnd,
FieldGameAccount,
FieldGameLv,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "users"
@ -191,4 +230,14 @@ var (
DefaultTenAt func() time.Time
// DefaultNext holds the default value on creation for the "next" field.
DefaultNext string
// DefaultModelAt holds the default value on creation for the "model_at" field.
DefaultModelAt func() time.Time
// DefaultGame holds the default value on creation for the "game" field.
DefaultGame bool
// DefaultGameTest holds the default value on creation for the "game_test" field.
DefaultGameTest bool
// DefaultGameEnd holds the default value on creation for the "game_end" field.
DefaultGameEnd bool
// DefaultGameAccount holds the default value on creation for the "game_account" field.
DefaultGameAccount bool
)

View File

@ -225,6 +225,71 @@ func Room(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldRoom, v))
}
// Model applies equality check predicate on the "model" field. It's identical to ModelEQ.
func Model(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldModel, v))
}
// ModelAt applies equality check predicate on the "model_at" field. It's identical to ModelAtEQ.
func ModelAt(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelAt, v))
}
// ModelAttack applies equality check predicate on the "model_attack" field. It's identical to ModelAttackEQ.
func ModelAttack(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelAttack, v))
}
// ModelLimit applies equality check predicate on the "model_limit" field. It's identical to ModelLimitEQ.
func ModelLimit(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelLimit, v))
}
// ModelSkill applies equality check predicate on the "model_skill" field. It's identical to ModelSkillEQ.
func ModelSkill(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelSkill, v))
}
// ModelMode applies equality check predicate on the "model_mode" field. It's identical to ModelModeEQ.
func ModelMode(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelMode, v))
}
// ModelCritical applies equality check predicate on the "model_critical" field. It's identical to ModelCriticalEQ.
func ModelCritical(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelCritical, v))
}
// ModelCriticalD applies equality check predicate on the "model_critical_d" field. It's identical to ModelCriticalDEQ.
func ModelCriticalD(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelCriticalD, v))
}
// Game applies equality check predicate on the "game" field. It's identical to GameEQ.
func Game(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldGame, v))
}
// GameTest applies equality check predicate on the "game_test" field. It's identical to GameTestEQ.
func GameTest(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldGameTest, v))
}
// GameEnd applies equality check predicate on the "game_end" field. It's identical to GameEndEQ.
func GameEnd(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldGameEnd, v))
}
// GameAccount applies equality check predicate on the "game_account" field. It's identical to GameAccountEQ.
func GameAccount(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldGameAccount, v))
}
// GameLv applies equality check predicate on the "game_lv" field. It's identical to GameLvEQ.
func GameLv(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldGameLv, v))
}
// UsernameEQ applies the EQ predicate on the "username" field.
func UsernameEQ(v string) predicate.User {
return predicate.User(sql.FieldEQ(FieldUsername, v))
@ -1860,6 +1925,506 @@ func RoomNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldRoom))
}
// ModelEQ applies the EQ predicate on the "model" field.
func ModelEQ(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldModel, v))
}
// ModelNEQ applies the NEQ predicate on the "model" field.
func ModelNEQ(v bool) predicate.User {
return predicate.User(sql.FieldNEQ(FieldModel, v))
}
// ModelIsNil applies the IsNil predicate on the "model" field.
func ModelIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldModel))
}
// ModelNotNil applies the NotNil predicate on the "model" field.
func ModelNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldModel))
}
// ModelAtEQ applies the EQ predicate on the "model_at" field.
func ModelAtEQ(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelAt, v))
}
// ModelAtNEQ applies the NEQ predicate on the "model_at" field.
func ModelAtNEQ(v time.Time) predicate.User {
return predicate.User(sql.FieldNEQ(FieldModelAt, v))
}
// ModelAtIn applies the In predicate on the "model_at" field.
func ModelAtIn(vs ...time.Time) predicate.User {
return predicate.User(sql.FieldIn(FieldModelAt, vs...))
}
// ModelAtNotIn applies the NotIn predicate on the "model_at" field.
func ModelAtNotIn(vs ...time.Time) predicate.User {
return predicate.User(sql.FieldNotIn(FieldModelAt, vs...))
}
// ModelAtGT applies the GT predicate on the "model_at" field.
func ModelAtGT(v time.Time) predicate.User {
return predicate.User(sql.FieldGT(FieldModelAt, v))
}
// ModelAtGTE applies the GTE predicate on the "model_at" field.
func ModelAtGTE(v time.Time) predicate.User {
return predicate.User(sql.FieldGTE(FieldModelAt, v))
}
// ModelAtLT applies the LT predicate on the "model_at" field.
func ModelAtLT(v time.Time) predicate.User {
return predicate.User(sql.FieldLT(FieldModelAt, v))
}
// ModelAtLTE applies the LTE predicate on the "model_at" field.
func ModelAtLTE(v time.Time) predicate.User {
return predicate.User(sql.FieldLTE(FieldModelAt, v))
}
// ModelAtIsNil applies the IsNil predicate on the "model_at" field.
func ModelAtIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldModelAt))
}
// ModelAtNotNil applies the NotNil predicate on the "model_at" field.
func ModelAtNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldModelAt))
}
// ModelAttackEQ applies the EQ predicate on the "model_attack" field.
func ModelAttackEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelAttack, v))
}
// ModelAttackNEQ applies the NEQ predicate on the "model_attack" field.
func ModelAttackNEQ(v int) predicate.User {
return predicate.User(sql.FieldNEQ(FieldModelAttack, v))
}
// ModelAttackIn applies the In predicate on the "model_attack" field.
func ModelAttackIn(vs ...int) predicate.User {
return predicate.User(sql.FieldIn(FieldModelAttack, vs...))
}
// ModelAttackNotIn applies the NotIn predicate on the "model_attack" field.
func ModelAttackNotIn(vs ...int) predicate.User {
return predicate.User(sql.FieldNotIn(FieldModelAttack, vs...))
}
// ModelAttackGT applies the GT predicate on the "model_attack" field.
func ModelAttackGT(v int) predicate.User {
return predicate.User(sql.FieldGT(FieldModelAttack, v))
}
// ModelAttackGTE applies the GTE predicate on the "model_attack" field.
func ModelAttackGTE(v int) predicate.User {
return predicate.User(sql.FieldGTE(FieldModelAttack, v))
}
// ModelAttackLT applies the LT predicate on the "model_attack" field.
func ModelAttackLT(v int) predicate.User {
return predicate.User(sql.FieldLT(FieldModelAttack, v))
}
// ModelAttackLTE applies the LTE predicate on the "model_attack" field.
func ModelAttackLTE(v int) predicate.User {
return predicate.User(sql.FieldLTE(FieldModelAttack, v))
}
// ModelAttackIsNil applies the IsNil predicate on the "model_attack" field.
func ModelAttackIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldModelAttack))
}
// ModelAttackNotNil applies the NotNil predicate on the "model_attack" field.
func ModelAttackNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldModelAttack))
}
// ModelLimitEQ applies the EQ predicate on the "model_limit" field.
func ModelLimitEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelLimit, v))
}
// ModelLimitNEQ applies the NEQ predicate on the "model_limit" field.
func ModelLimitNEQ(v int) predicate.User {
return predicate.User(sql.FieldNEQ(FieldModelLimit, v))
}
// ModelLimitIn applies the In predicate on the "model_limit" field.
func ModelLimitIn(vs ...int) predicate.User {
return predicate.User(sql.FieldIn(FieldModelLimit, vs...))
}
// ModelLimitNotIn applies the NotIn predicate on the "model_limit" field.
func ModelLimitNotIn(vs ...int) predicate.User {
return predicate.User(sql.FieldNotIn(FieldModelLimit, vs...))
}
// ModelLimitGT applies the GT predicate on the "model_limit" field.
func ModelLimitGT(v int) predicate.User {
return predicate.User(sql.FieldGT(FieldModelLimit, v))
}
// ModelLimitGTE applies the GTE predicate on the "model_limit" field.
func ModelLimitGTE(v int) predicate.User {
return predicate.User(sql.FieldGTE(FieldModelLimit, v))
}
// ModelLimitLT applies the LT predicate on the "model_limit" field.
func ModelLimitLT(v int) predicate.User {
return predicate.User(sql.FieldLT(FieldModelLimit, v))
}
// ModelLimitLTE applies the LTE predicate on the "model_limit" field.
func ModelLimitLTE(v int) predicate.User {
return predicate.User(sql.FieldLTE(FieldModelLimit, v))
}
// ModelLimitIsNil applies the IsNil predicate on the "model_limit" field.
func ModelLimitIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldModelLimit))
}
// ModelLimitNotNil applies the NotNil predicate on the "model_limit" field.
func ModelLimitNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldModelLimit))
}
// ModelSkillEQ applies the EQ predicate on the "model_skill" field.
func ModelSkillEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelSkill, v))
}
// ModelSkillNEQ applies the NEQ predicate on the "model_skill" field.
func ModelSkillNEQ(v int) predicate.User {
return predicate.User(sql.FieldNEQ(FieldModelSkill, v))
}
// ModelSkillIn applies the In predicate on the "model_skill" field.
func ModelSkillIn(vs ...int) predicate.User {
return predicate.User(sql.FieldIn(FieldModelSkill, vs...))
}
// ModelSkillNotIn applies the NotIn predicate on the "model_skill" field.
func ModelSkillNotIn(vs ...int) predicate.User {
return predicate.User(sql.FieldNotIn(FieldModelSkill, vs...))
}
// ModelSkillGT applies the GT predicate on the "model_skill" field.
func ModelSkillGT(v int) predicate.User {
return predicate.User(sql.FieldGT(FieldModelSkill, v))
}
// ModelSkillGTE applies the GTE predicate on the "model_skill" field.
func ModelSkillGTE(v int) predicate.User {
return predicate.User(sql.FieldGTE(FieldModelSkill, v))
}
// ModelSkillLT applies the LT predicate on the "model_skill" field.
func ModelSkillLT(v int) predicate.User {
return predicate.User(sql.FieldLT(FieldModelSkill, v))
}
// ModelSkillLTE applies the LTE predicate on the "model_skill" field.
func ModelSkillLTE(v int) predicate.User {
return predicate.User(sql.FieldLTE(FieldModelSkill, v))
}
// ModelSkillIsNil applies the IsNil predicate on the "model_skill" field.
func ModelSkillIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldModelSkill))
}
// ModelSkillNotNil applies the NotNil predicate on the "model_skill" field.
func ModelSkillNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldModelSkill))
}
// ModelModeEQ applies the EQ predicate on the "model_mode" field.
func ModelModeEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelMode, v))
}
// ModelModeNEQ applies the NEQ predicate on the "model_mode" field.
func ModelModeNEQ(v int) predicate.User {
return predicate.User(sql.FieldNEQ(FieldModelMode, v))
}
// ModelModeIn applies the In predicate on the "model_mode" field.
func ModelModeIn(vs ...int) predicate.User {
return predicate.User(sql.FieldIn(FieldModelMode, vs...))
}
// ModelModeNotIn applies the NotIn predicate on the "model_mode" field.
func ModelModeNotIn(vs ...int) predicate.User {
return predicate.User(sql.FieldNotIn(FieldModelMode, vs...))
}
// ModelModeGT applies the GT predicate on the "model_mode" field.
func ModelModeGT(v int) predicate.User {
return predicate.User(sql.FieldGT(FieldModelMode, v))
}
// ModelModeGTE applies the GTE predicate on the "model_mode" field.
func ModelModeGTE(v int) predicate.User {
return predicate.User(sql.FieldGTE(FieldModelMode, v))
}
// ModelModeLT applies the LT predicate on the "model_mode" field.
func ModelModeLT(v int) predicate.User {
return predicate.User(sql.FieldLT(FieldModelMode, v))
}
// ModelModeLTE applies the LTE predicate on the "model_mode" field.
func ModelModeLTE(v int) predicate.User {
return predicate.User(sql.FieldLTE(FieldModelMode, v))
}
// ModelModeIsNil applies the IsNil predicate on the "model_mode" field.
func ModelModeIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldModelMode))
}
// ModelModeNotNil applies the NotNil predicate on the "model_mode" field.
func ModelModeNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldModelMode))
}
// ModelCriticalEQ applies the EQ predicate on the "model_critical" field.
func ModelCriticalEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelCritical, v))
}
// ModelCriticalNEQ applies the NEQ predicate on the "model_critical" field.
func ModelCriticalNEQ(v int) predicate.User {
return predicate.User(sql.FieldNEQ(FieldModelCritical, v))
}
// ModelCriticalIn applies the In predicate on the "model_critical" field.
func ModelCriticalIn(vs ...int) predicate.User {
return predicate.User(sql.FieldIn(FieldModelCritical, vs...))
}
// ModelCriticalNotIn applies the NotIn predicate on the "model_critical" field.
func ModelCriticalNotIn(vs ...int) predicate.User {
return predicate.User(sql.FieldNotIn(FieldModelCritical, vs...))
}
// ModelCriticalGT applies the GT predicate on the "model_critical" field.
func ModelCriticalGT(v int) predicate.User {
return predicate.User(sql.FieldGT(FieldModelCritical, v))
}
// ModelCriticalGTE applies the GTE predicate on the "model_critical" field.
func ModelCriticalGTE(v int) predicate.User {
return predicate.User(sql.FieldGTE(FieldModelCritical, v))
}
// ModelCriticalLT applies the LT predicate on the "model_critical" field.
func ModelCriticalLT(v int) predicate.User {
return predicate.User(sql.FieldLT(FieldModelCritical, v))
}
// ModelCriticalLTE applies the LTE predicate on the "model_critical" field.
func ModelCriticalLTE(v int) predicate.User {
return predicate.User(sql.FieldLTE(FieldModelCritical, v))
}
// ModelCriticalIsNil applies the IsNil predicate on the "model_critical" field.
func ModelCriticalIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldModelCritical))
}
// ModelCriticalNotNil applies the NotNil predicate on the "model_critical" field.
func ModelCriticalNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldModelCritical))
}
// ModelCriticalDEQ applies the EQ predicate on the "model_critical_d" field.
func ModelCriticalDEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldModelCriticalD, v))
}
// ModelCriticalDNEQ applies the NEQ predicate on the "model_critical_d" field.
func ModelCriticalDNEQ(v int) predicate.User {
return predicate.User(sql.FieldNEQ(FieldModelCriticalD, v))
}
// ModelCriticalDIn applies the In predicate on the "model_critical_d" field.
func ModelCriticalDIn(vs ...int) predicate.User {
return predicate.User(sql.FieldIn(FieldModelCriticalD, vs...))
}
// ModelCriticalDNotIn applies the NotIn predicate on the "model_critical_d" field.
func ModelCriticalDNotIn(vs ...int) predicate.User {
return predicate.User(sql.FieldNotIn(FieldModelCriticalD, vs...))
}
// ModelCriticalDGT applies the GT predicate on the "model_critical_d" field.
func ModelCriticalDGT(v int) predicate.User {
return predicate.User(sql.FieldGT(FieldModelCriticalD, v))
}
// ModelCriticalDGTE applies the GTE predicate on the "model_critical_d" field.
func ModelCriticalDGTE(v int) predicate.User {
return predicate.User(sql.FieldGTE(FieldModelCriticalD, v))
}
// ModelCriticalDLT applies the LT predicate on the "model_critical_d" field.
func ModelCriticalDLT(v int) predicate.User {
return predicate.User(sql.FieldLT(FieldModelCriticalD, v))
}
// ModelCriticalDLTE applies the LTE predicate on the "model_critical_d" field.
func ModelCriticalDLTE(v int) predicate.User {
return predicate.User(sql.FieldLTE(FieldModelCriticalD, v))
}
// ModelCriticalDIsNil applies the IsNil predicate on the "model_critical_d" field.
func ModelCriticalDIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldModelCriticalD))
}
// ModelCriticalDNotNil applies the NotNil predicate on the "model_critical_d" field.
func ModelCriticalDNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldModelCriticalD))
}
// GameEQ applies the EQ predicate on the "game" field.
func GameEQ(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldGame, v))
}
// GameNEQ applies the NEQ predicate on the "game" field.
func GameNEQ(v bool) predicate.User {
return predicate.User(sql.FieldNEQ(FieldGame, v))
}
// GameIsNil applies the IsNil predicate on the "game" field.
func GameIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldGame))
}
// GameNotNil applies the NotNil predicate on the "game" field.
func GameNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldGame))
}
// GameTestEQ applies the EQ predicate on the "game_test" field.
func GameTestEQ(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldGameTest, v))
}
// GameTestNEQ applies the NEQ predicate on the "game_test" field.
func GameTestNEQ(v bool) predicate.User {
return predicate.User(sql.FieldNEQ(FieldGameTest, v))
}
// GameTestIsNil applies the IsNil predicate on the "game_test" field.
func GameTestIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldGameTest))
}
// GameTestNotNil applies the NotNil predicate on the "game_test" field.
func GameTestNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldGameTest))
}
// GameEndEQ applies the EQ predicate on the "game_end" field.
func GameEndEQ(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldGameEnd, v))
}
// GameEndNEQ applies the NEQ predicate on the "game_end" field.
func GameEndNEQ(v bool) predicate.User {
return predicate.User(sql.FieldNEQ(FieldGameEnd, v))
}
// GameEndIsNil applies the IsNil predicate on the "game_end" field.
func GameEndIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldGameEnd))
}
// GameEndNotNil applies the NotNil predicate on the "game_end" field.
func GameEndNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldGameEnd))
}
// GameAccountEQ applies the EQ predicate on the "game_account" field.
func GameAccountEQ(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldGameAccount, v))
}
// GameAccountNEQ applies the NEQ predicate on the "game_account" field.
func GameAccountNEQ(v bool) predicate.User {
return predicate.User(sql.FieldNEQ(FieldGameAccount, v))
}
// GameAccountIsNil applies the IsNil predicate on the "game_account" field.
func GameAccountIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldGameAccount))
}
// GameAccountNotNil applies the NotNil predicate on the "game_account" field.
func GameAccountNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldGameAccount))
}
// GameLvEQ applies the EQ predicate on the "game_lv" field.
func GameLvEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldGameLv, v))
}
// GameLvNEQ applies the NEQ predicate on the "game_lv" field.
func GameLvNEQ(v int) predicate.User {
return predicate.User(sql.FieldNEQ(FieldGameLv, v))
}
// GameLvIn applies the In predicate on the "game_lv" field.
func GameLvIn(vs ...int) predicate.User {
return predicate.User(sql.FieldIn(FieldGameLv, vs...))
}
// GameLvNotIn applies the NotIn predicate on the "game_lv" field.
func GameLvNotIn(vs ...int) predicate.User {
return predicate.User(sql.FieldNotIn(FieldGameLv, vs...))
}
// GameLvGT applies the GT predicate on the "game_lv" field.
func GameLvGT(v int) predicate.User {
return predicate.User(sql.FieldGT(FieldGameLv, v))
}
// GameLvGTE applies the GTE predicate on the "game_lv" field.
func GameLvGTE(v int) predicate.User {
return predicate.User(sql.FieldGTE(FieldGameLv, v))
}
// GameLvLT applies the LT predicate on the "game_lv" field.
func GameLvLT(v int) predicate.User {
return predicate.User(sql.FieldLT(FieldGameLv, v))
}
// GameLvLTE applies the LTE predicate on the "game_lv" field.
func GameLvLTE(v int) predicate.User {
return predicate.User(sql.FieldLTE(FieldGameLv, v))
}
// GameLvIsNil applies the IsNil predicate on the "game_lv" field.
func GameLvIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldGameLv))
}
// GameLvNotNil applies the NotNil predicate on the "game_lv" field.
func GameLvNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldGameLv))
}
// HasCard applies the HasEdge predicate on the "card" edge.
func HasCard() predicate.User {
return predicate.User(func(s *sql.Selector) {

View File

@ -481,6 +481,188 @@ func (uc *UserCreate) SetNillableRoom(i *int) *UserCreate {
return uc
}
// SetModel sets the "model" field.
func (uc *UserCreate) SetModel(b bool) *UserCreate {
uc.mutation.SetModel(b)
return uc
}
// SetNillableModel sets the "model" field if the given value is not nil.
func (uc *UserCreate) SetNillableModel(b *bool) *UserCreate {
if b != nil {
uc.SetModel(*b)
}
return uc
}
// SetModelAt sets the "model_at" field.
func (uc *UserCreate) SetModelAt(t time.Time) *UserCreate {
uc.mutation.SetModelAt(t)
return uc
}
// SetNillableModelAt sets the "model_at" field if the given value is not nil.
func (uc *UserCreate) SetNillableModelAt(t *time.Time) *UserCreate {
if t != nil {
uc.SetModelAt(*t)
}
return uc
}
// SetModelAttack sets the "model_attack" field.
func (uc *UserCreate) SetModelAttack(i int) *UserCreate {
uc.mutation.SetModelAttack(i)
return uc
}
// SetNillableModelAttack sets the "model_attack" field if the given value is not nil.
func (uc *UserCreate) SetNillableModelAttack(i *int) *UserCreate {
if i != nil {
uc.SetModelAttack(*i)
}
return uc
}
// SetModelLimit sets the "model_limit" field.
func (uc *UserCreate) SetModelLimit(i int) *UserCreate {
uc.mutation.SetModelLimit(i)
return uc
}
// SetNillableModelLimit sets the "model_limit" field if the given value is not nil.
func (uc *UserCreate) SetNillableModelLimit(i *int) *UserCreate {
if i != nil {
uc.SetModelLimit(*i)
}
return uc
}
// SetModelSkill sets the "model_skill" field.
func (uc *UserCreate) SetModelSkill(i int) *UserCreate {
uc.mutation.SetModelSkill(i)
return uc
}
// SetNillableModelSkill sets the "model_skill" field if the given value is not nil.
func (uc *UserCreate) SetNillableModelSkill(i *int) *UserCreate {
if i != nil {
uc.SetModelSkill(*i)
}
return uc
}
// SetModelMode sets the "model_mode" field.
func (uc *UserCreate) SetModelMode(i int) *UserCreate {
uc.mutation.SetModelMode(i)
return uc
}
// SetNillableModelMode sets the "model_mode" field if the given value is not nil.
func (uc *UserCreate) SetNillableModelMode(i *int) *UserCreate {
if i != nil {
uc.SetModelMode(*i)
}
return uc
}
// SetModelCritical sets the "model_critical" field.
func (uc *UserCreate) SetModelCritical(i int) *UserCreate {
uc.mutation.SetModelCritical(i)
return uc
}
// SetNillableModelCritical sets the "model_critical" field if the given value is not nil.
func (uc *UserCreate) SetNillableModelCritical(i *int) *UserCreate {
if i != nil {
uc.SetModelCritical(*i)
}
return uc
}
// SetModelCriticalD sets the "model_critical_d" field.
func (uc *UserCreate) SetModelCriticalD(i int) *UserCreate {
uc.mutation.SetModelCriticalD(i)
return uc
}
// SetNillableModelCriticalD sets the "model_critical_d" field if the given value is not nil.
func (uc *UserCreate) SetNillableModelCriticalD(i *int) *UserCreate {
if i != nil {
uc.SetModelCriticalD(*i)
}
return uc
}
// SetGame sets the "game" field.
func (uc *UserCreate) SetGame(b bool) *UserCreate {
uc.mutation.SetGame(b)
return uc
}
// SetNillableGame sets the "game" field if the given value is not nil.
func (uc *UserCreate) SetNillableGame(b *bool) *UserCreate {
if b != nil {
uc.SetGame(*b)
}
return uc
}
// SetGameTest sets the "game_test" field.
func (uc *UserCreate) SetGameTest(b bool) *UserCreate {
uc.mutation.SetGameTest(b)
return uc
}
// SetNillableGameTest sets the "game_test" field if the given value is not nil.
func (uc *UserCreate) SetNillableGameTest(b *bool) *UserCreate {
if b != nil {
uc.SetGameTest(*b)
}
return uc
}
// SetGameEnd sets the "game_end" field.
func (uc *UserCreate) SetGameEnd(b bool) *UserCreate {
uc.mutation.SetGameEnd(b)
return uc
}
// SetNillableGameEnd sets the "game_end" field if the given value is not nil.
func (uc *UserCreate) SetNillableGameEnd(b *bool) *UserCreate {
if b != nil {
uc.SetGameEnd(*b)
}
return uc
}
// SetGameAccount sets the "game_account" field.
func (uc *UserCreate) SetGameAccount(b bool) *UserCreate {
uc.mutation.SetGameAccount(b)
return uc
}
// SetNillableGameAccount sets the "game_account" field if the given value is not nil.
func (uc *UserCreate) SetNillableGameAccount(b *bool) *UserCreate {
if b != nil {
uc.SetGameAccount(*b)
}
return uc
}
// SetGameLv sets the "game_lv" field.
func (uc *UserCreate) SetGameLv(i int) *UserCreate {
uc.mutation.SetGameLv(i)
return uc
}
// SetNillableGameLv sets the "game_lv" field if the given value is not nil.
func (uc *UserCreate) SetNillableGameLv(i *int) *UserCreate {
if i != nil {
uc.SetGameLv(*i)
}
return uc
}
// AddCardIDs adds the "card" edge to the Card entity by IDs.
func (uc *UserCreate) AddCardIDs(ids ...int) *UserCreate {
uc.mutation.AddCardIDs(ids...)
@ -599,6 +781,26 @@ func (uc *UserCreate) defaults() {
v := user.DefaultNext
uc.mutation.SetNext(v)
}
if _, ok := uc.mutation.ModelAt(); !ok {
v := user.DefaultModelAt()
uc.mutation.SetModelAt(v)
}
if _, ok := uc.mutation.Game(); !ok {
v := user.DefaultGame
uc.mutation.SetGame(v)
}
if _, ok := uc.mutation.GameTest(); !ok {
v := user.DefaultGameTest
uc.mutation.SetGameTest(v)
}
if _, ok := uc.mutation.GameEnd(); !ok {
v := user.DefaultGameEnd
uc.mutation.SetGameEnd(v)
}
if _, ok := uc.mutation.GameAccount(); !ok {
v := user.DefaultGameAccount
uc.mutation.SetGameAccount(v)
}
}
// check runs all checks and user-defined validators on the builder.
@ -781,6 +983,58 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
_spec.SetField(user.FieldRoom, field.TypeInt, value)
_node.Room = value
}
if value, ok := uc.mutation.Model(); ok {
_spec.SetField(user.FieldModel, field.TypeBool, value)
_node.Model = value
}
if value, ok := uc.mutation.ModelAt(); ok {
_spec.SetField(user.FieldModelAt, field.TypeTime, value)
_node.ModelAt = value
}
if value, ok := uc.mutation.ModelAttack(); ok {
_spec.SetField(user.FieldModelAttack, field.TypeInt, value)
_node.ModelAttack = value
}
if value, ok := uc.mutation.ModelLimit(); ok {
_spec.SetField(user.FieldModelLimit, field.TypeInt, value)
_node.ModelLimit = value
}
if value, ok := uc.mutation.ModelSkill(); ok {
_spec.SetField(user.FieldModelSkill, field.TypeInt, value)
_node.ModelSkill = value
}
if value, ok := uc.mutation.ModelMode(); ok {
_spec.SetField(user.FieldModelMode, field.TypeInt, value)
_node.ModelMode = value
}
if value, ok := uc.mutation.ModelCritical(); ok {
_spec.SetField(user.FieldModelCritical, field.TypeInt, value)
_node.ModelCritical = value
}
if value, ok := uc.mutation.ModelCriticalD(); ok {
_spec.SetField(user.FieldModelCriticalD, field.TypeInt, value)
_node.ModelCriticalD = value
}
if value, ok := uc.mutation.Game(); ok {
_spec.SetField(user.FieldGame, field.TypeBool, value)
_node.Game = value
}
if value, ok := uc.mutation.GameTest(); ok {
_spec.SetField(user.FieldGameTest, field.TypeBool, value)
_node.GameTest = value
}
if value, ok := uc.mutation.GameEnd(); ok {
_spec.SetField(user.FieldGameEnd, field.TypeBool, value)
_node.GameEnd = value
}
if value, ok := uc.mutation.GameAccount(); ok {
_spec.SetField(user.FieldGameAccount, field.TypeBool, value)
_node.GameAccount = value
}
if value, ok := uc.mutation.GameLv(); ok {
_spec.SetField(user.FieldGameLv, field.TypeInt, value)
_node.GameLv = value
}
if nodes := uc.mutation.CardIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,

View File

@ -705,6 +705,315 @@ func (uu *UserUpdate) ClearRoom() *UserUpdate {
return uu
}
// SetModel sets the "model" field.
func (uu *UserUpdate) SetModel(b bool) *UserUpdate {
uu.mutation.SetModel(b)
return uu
}
// SetNillableModel sets the "model" field if the given value is not nil.
func (uu *UserUpdate) SetNillableModel(b *bool) *UserUpdate {
if b != nil {
uu.SetModel(*b)
}
return uu
}
// ClearModel clears the value of the "model" field.
func (uu *UserUpdate) ClearModel() *UserUpdate {
uu.mutation.ClearModel()
return uu
}
// SetModelAt sets the "model_at" field.
func (uu *UserUpdate) SetModelAt(t time.Time) *UserUpdate {
uu.mutation.SetModelAt(t)
return uu
}
// SetNillableModelAt sets the "model_at" field if the given value is not nil.
func (uu *UserUpdate) SetNillableModelAt(t *time.Time) *UserUpdate {
if t != nil {
uu.SetModelAt(*t)
}
return uu
}
// ClearModelAt clears the value of the "model_at" field.
func (uu *UserUpdate) ClearModelAt() *UserUpdate {
uu.mutation.ClearModelAt()
return uu
}
// SetModelAttack sets the "model_attack" field.
func (uu *UserUpdate) SetModelAttack(i int) *UserUpdate {
uu.mutation.ResetModelAttack()
uu.mutation.SetModelAttack(i)
return uu
}
// SetNillableModelAttack sets the "model_attack" field if the given value is not nil.
func (uu *UserUpdate) SetNillableModelAttack(i *int) *UserUpdate {
if i != nil {
uu.SetModelAttack(*i)
}
return uu
}
// AddModelAttack adds i to the "model_attack" field.
func (uu *UserUpdate) AddModelAttack(i int) *UserUpdate {
uu.mutation.AddModelAttack(i)
return uu
}
// ClearModelAttack clears the value of the "model_attack" field.
func (uu *UserUpdate) ClearModelAttack() *UserUpdate {
uu.mutation.ClearModelAttack()
return uu
}
// SetModelLimit sets the "model_limit" field.
func (uu *UserUpdate) SetModelLimit(i int) *UserUpdate {
uu.mutation.ResetModelLimit()
uu.mutation.SetModelLimit(i)
return uu
}
// SetNillableModelLimit sets the "model_limit" field if the given value is not nil.
func (uu *UserUpdate) SetNillableModelLimit(i *int) *UserUpdate {
if i != nil {
uu.SetModelLimit(*i)
}
return uu
}
// AddModelLimit adds i to the "model_limit" field.
func (uu *UserUpdate) AddModelLimit(i int) *UserUpdate {
uu.mutation.AddModelLimit(i)
return uu
}
// ClearModelLimit clears the value of the "model_limit" field.
func (uu *UserUpdate) ClearModelLimit() *UserUpdate {
uu.mutation.ClearModelLimit()
return uu
}
// SetModelSkill sets the "model_skill" field.
func (uu *UserUpdate) SetModelSkill(i int) *UserUpdate {
uu.mutation.ResetModelSkill()
uu.mutation.SetModelSkill(i)
return uu
}
// SetNillableModelSkill sets the "model_skill" field if the given value is not nil.
func (uu *UserUpdate) SetNillableModelSkill(i *int) *UserUpdate {
if i != nil {
uu.SetModelSkill(*i)
}
return uu
}
// AddModelSkill adds i to the "model_skill" field.
func (uu *UserUpdate) AddModelSkill(i int) *UserUpdate {
uu.mutation.AddModelSkill(i)
return uu
}
// ClearModelSkill clears the value of the "model_skill" field.
func (uu *UserUpdate) ClearModelSkill() *UserUpdate {
uu.mutation.ClearModelSkill()
return uu
}
// SetModelMode sets the "model_mode" field.
func (uu *UserUpdate) SetModelMode(i int) *UserUpdate {
uu.mutation.ResetModelMode()
uu.mutation.SetModelMode(i)
return uu
}
// SetNillableModelMode sets the "model_mode" field if the given value is not nil.
func (uu *UserUpdate) SetNillableModelMode(i *int) *UserUpdate {
if i != nil {
uu.SetModelMode(*i)
}
return uu
}
// AddModelMode adds i to the "model_mode" field.
func (uu *UserUpdate) AddModelMode(i int) *UserUpdate {
uu.mutation.AddModelMode(i)
return uu
}
// ClearModelMode clears the value of the "model_mode" field.
func (uu *UserUpdate) ClearModelMode() *UserUpdate {
uu.mutation.ClearModelMode()
return uu
}
// SetModelCritical sets the "model_critical" field.
func (uu *UserUpdate) SetModelCritical(i int) *UserUpdate {
uu.mutation.ResetModelCritical()
uu.mutation.SetModelCritical(i)
return uu
}
// SetNillableModelCritical sets the "model_critical" field if the given value is not nil.
func (uu *UserUpdate) SetNillableModelCritical(i *int) *UserUpdate {
if i != nil {
uu.SetModelCritical(*i)
}
return uu
}
// AddModelCritical adds i to the "model_critical" field.
func (uu *UserUpdate) AddModelCritical(i int) *UserUpdate {
uu.mutation.AddModelCritical(i)
return uu
}
// ClearModelCritical clears the value of the "model_critical" field.
func (uu *UserUpdate) ClearModelCritical() *UserUpdate {
uu.mutation.ClearModelCritical()
return uu
}
// SetModelCriticalD sets the "model_critical_d" field.
func (uu *UserUpdate) SetModelCriticalD(i int) *UserUpdate {
uu.mutation.ResetModelCriticalD()
uu.mutation.SetModelCriticalD(i)
return uu
}
// SetNillableModelCriticalD sets the "model_critical_d" field if the given value is not nil.
func (uu *UserUpdate) SetNillableModelCriticalD(i *int) *UserUpdate {
if i != nil {
uu.SetModelCriticalD(*i)
}
return uu
}
// AddModelCriticalD adds i to the "model_critical_d" field.
func (uu *UserUpdate) AddModelCriticalD(i int) *UserUpdate {
uu.mutation.AddModelCriticalD(i)
return uu
}
// ClearModelCriticalD clears the value of the "model_critical_d" field.
func (uu *UserUpdate) ClearModelCriticalD() *UserUpdate {
uu.mutation.ClearModelCriticalD()
return uu
}
// SetGame sets the "game" field.
func (uu *UserUpdate) SetGame(b bool) *UserUpdate {
uu.mutation.SetGame(b)
return uu
}
// SetNillableGame sets the "game" field if the given value is not nil.
func (uu *UserUpdate) SetNillableGame(b *bool) *UserUpdate {
if b != nil {
uu.SetGame(*b)
}
return uu
}
// ClearGame clears the value of the "game" field.
func (uu *UserUpdate) ClearGame() *UserUpdate {
uu.mutation.ClearGame()
return uu
}
// SetGameTest sets the "game_test" field.
func (uu *UserUpdate) SetGameTest(b bool) *UserUpdate {
uu.mutation.SetGameTest(b)
return uu
}
// SetNillableGameTest sets the "game_test" field if the given value is not nil.
func (uu *UserUpdate) SetNillableGameTest(b *bool) *UserUpdate {
if b != nil {
uu.SetGameTest(*b)
}
return uu
}
// ClearGameTest clears the value of the "game_test" field.
func (uu *UserUpdate) ClearGameTest() *UserUpdate {
uu.mutation.ClearGameTest()
return uu
}
// SetGameEnd sets the "game_end" field.
func (uu *UserUpdate) SetGameEnd(b bool) *UserUpdate {
uu.mutation.SetGameEnd(b)
return uu
}
// SetNillableGameEnd sets the "game_end" field if the given value is not nil.
func (uu *UserUpdate) SetNillableGameEnd(b *bool) *UserUpdate {
if b != nil {
uu.SetGameEnd(*b)
}
return uu
}
// ClearGameEnd clears the value of the "game_end" field.
func (uu *UserUpdate) ClearGameEnd() *UserUpdate {
uu.mutation.ClearGameEnd()
return uu
}
// SetGameAccount sets the "game_account" field.
func (uu *UserUpdate) SetGameAccount(b bool) *UserUpdate {
uu.mutation.SetGameAccount(b)
return uu
}
// SetNillableGameAccount sets the "game_account" field if the given value is not nil.
func (uu *UserUpdate) SetNillableGameAccount(b *bool) *UserUpdate {
if b != nil {
uu.SetGameAccount(*b)
}
return uu
}
// ClearGameAccount clears the value of the "game_account" field.
func (uu *UserUpdate) ClearGameAccount() *UserUpdate {
uu.mutation.ClearGameAccount()
return uu
}
// SetGameLv sets the "game_lv" field.
func (uu *UserUpdate) SetGameLv(i int) *UserUpdate {
uu.mutation.ResetGameLv()
uu.mutation.SetGameLv(i)
return uu
}
// SetNillableGameLv sets the "game_lv" field if the given value is not nil.
func (uu *UserUpdate) SetNillableGameLv(i *int) *UserUpdate {
if i != nil {
uu.SetGameLv(*i)
}
return uu
}
// AddGameLv adds i to the "game_lv" field.
func (uu *UserUpdate) AddGameLv(i int) *UserUpdate {
uu.mutation.AddGameLv(i)
return uu
}
// ClearGameLv clears the value of the "game_lv" field.
func (uu *UserUpdate) ClearGameLv() *UserUpdate {
uu.mutation.ClearGameLv()
return uu
}
// AddCardIDs adds the "card" edge to the Card entity by IDs.
func (uu *UserUpdate) AddCardIDs(ids ...int) *UserUpdate {
uu.mutation.AddCardIDs(ids...)
@ -995,6 +1304,105 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
if uu.mutation.RoomCleared() {
_spec.ClearField(user.FieldRoom, field.TypeInt)
}
if value, ok := uu.mutation.Model(); ok {
_spec.SetField(user.FieldModel, field.TypeBool, value)
}
if uu.mutation.ModelCleared() {
_spec.ClearField(user.FieldModel, field.TypeBool)
}
if value, ok := uu.mutation.ModelAt(); ok {
_spec.SetField(user.FieldModelAt, field.TypeTime, value)
}
if uu.mutation.ModelAtCleared() {
_spec.ClearField(user.FieldModelAt, field.TypeTime)
}
if value, ok := uu.mutation.ModelAttack(); ok {
_spec.SetField(user.FieldModelAttack, field.TypeInt, value)
}
if value, ok := uu.mutation.AddedModelAttack(); ok {
_spec.AddField(user.FieldModelAttack, field.TypeInt, value)
}
if uu.mutation.ModelAttackCleared() {
_spec.ClearField(user.FieldModelAttack, field.TypeInt)
}
if value, ok := uu.mutation.ModelLimit(); ok {
_spec.SetField(user.FieldModelLimit, field.TypeInt, value)
}
if value, ok := uu.mutation.AddedModelLimit(); ok {
_spec.AddField(user.FieldModelLimit, field.TypeInt, value)
}
if uu.mutation.ModelLimitCleared() {
_spec.ClearField(user.FieldModelLimit, field.TypeInt)
}
if value, ok := uu.mutation.ModelSkill(); ok {
_spec.SetField(user.FieldModelSkill, field.TypeInt, value)
}
if value, ok := uu.mutation.AddedModelSkill(); ok {
_spec.AddField(user.FieldModelSkill, field.TypeInt, value)
}
if uu.mutation.ModelSkillCleared() {
_spec.ClearField(user.FieldModelSkill, field.TypeInt)
}
if value, ok := uu.mutation.ModelMode(); ok {
_spec.SetField(user.FieldModelMode, field.TypeInt, value)
}
if value, ok := uu.mutation.AddedModelMode(); ok {
_spec.AddField(user.FieldModelMode, field.TypeInt, value)
}
if uu.mutation.ModelModeCleared() {
_spec.ClearField(user.FieldModelMode, field.TypeInt)
}
if value, ok := uu.mutation.ModelCritical(); ok {
_spec.SetField(user.FieldModelCritical, field.TypeInt, value)
}
if value, ok := uu.mutation.AddedModelCritical(); ok {
_spec.AddField(user.FieldModelCritical, field.TypeInt, value)
}
if uu.mutation.ModelCriticalCleared() {
_spec.ClearField(user.FieldModelCritical, field.TypeInt)
}
if value, ok := uu.mutation.ModelCriticalD(); ok {
_spec.SetField(user.FieldModelCriticalD, field.TypeInt, value)
}
if value, ok := uu.mutation.AddedModelCriticalD(); ok {
_spec.AddField(user.FieldModelCriticalD, field.TypeInt, value)
}
if uu.mutation.ModelCriticalDCleared() {
_spec.ClearField(user.FieldModelCriticalD, field.TypeInt)
}
if value, ok := uu.mutation.Game(); ok {
_spec.SetField(user.FieldGame, field.TypeBool, value)
}
if uu.mutation.GameCleared() {
_spec.ClearField(user.FieldGame, field.TypeBool)
}
if value, ok := uu.mutation.GameTest(); ok {
_spec.SetField(user.FieldGameTest, field.TypeBool, value)
}
if uu.mutation.GameTestCleared() {
_spec.ClearField(user.FieldGameTest, field.TypeBool)
}
if value, ok := uu.mutation.GameEnd(); ok {
_spec.SetField(user.FieldGameEnd, field.TypeBool, value)
}
if uu.mutation.GameEndCleared() {
_spec.ClearField(user.FieldGameEnd, field.TypeBool)
}
if value, ok := uu.mutation.GameAccount(); ok {
_spec.SetField(user.FieldGameAccount, field.TypeBool, value)
}
if uu.mutation.GameAccountCleared() {
_spec.ClearField(user.FieldGameAccount, field.TypeBool)
}
if value, ok := uu.mutation.GameLv(); ok {
_spec.SetField(user.FieldGameLv, field.TypeInt, value)
}
if value, ok := uu.mutation.AddedGameLv(); ok {
_spec.AddField(user.FieldGameLv, field.TypeInt, value)
}
if uu.mutation.GameLvCleared() {
_spec.ClearField(user.FieldGameLv, field.TypeInt)
}
if uu.mutation.CardCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
@ -1736,6 +2144,315 @@ func (uuo *UserUpdateOne) ClearRoom() *UserUpdateOne {
return uuo
}
// SetModel sets the "model" field.
func (uuo *UserUpdateOne) SetModel(b bool) *UserUpdateOne {
uuo.mutation.SetModel(b)
return uuo
}
// SetNillableModel sets the "model" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableModel(b *bool) *UserUpdateOne {
if b != nil {
uuo.SetModel(*b)
}
return uuo
}
// ClearModel clears the value of the "model" field.
func (uuo *UserUpdateOne) ClearModel() *UserUpdateOne {
uuo.mutation.ClearModel()
return uuo
}
// SetModelAt sets the "model_at" field.
func (uuo *UserUpdateOne) SetModelAt(t time.Time) *UserUpdateOne {
uuo.mutation.SetModelAt(t)
return uuo
}
// SetNillableModelAt sets the "model_at" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableModelAt(t *time.Time) *UserUpdateOne {
if t != nil {
uuo.SetModelAt(*t)
}
return uuo
}
// ClearModelAt clears the value of the "model_at" field.
func (uuo *UserUpdateOne) ClearModelAt() *UserUpdateOne {
uuo.mutation.ClearModelAt()
return uuo
}
// SetModelAttack sets the "model_attack" field.
func (uuo *UserUpdateOne) SetModelAttack(i int) *UserUpdateOne {
uuo.mutation.ResetModelAttack()
uuo.mutation.SetModelAttack(i)
return uuo
}
// SetNillableModelAttack sets the "model_attack" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableModelAttack(i *int) *UserUpdateOne {
if i != nil {
uuo.SetModelAttack(*i)
}
return uuo
}
// AddModelAttack adds i to the "model_attack" field.
func (uuo *UserUpdateOne) AddModelAttack(i int) *UserUpdateOne {
uuo.mutation.AddModelAttack(i)
return uuo
}
// ClearModelAttack clears the value of the "model_attack" field.
func (uuo *UserUpdateOne) ClearModelAttack() *UserUpdateOne {
uuo.mutation.ClearModelAttack()
return uuo
}
// SetModelLimit sets the "model_limit" field.
func (uuo *UserUpdateOne) SetModelLimit(i int) *UserUpdateOne {
uuo.mutation.ResetModelLimit()
uuo.mutation.SetModelLimit(i)
return uuo
}
// SetNillableModelLimit sets the "model_limit" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableModelLimit(i *int) *UserUpdateOne {
if i != nil {
uuo.SetModelLimit(*i)
}
return uuo
}
// AddModelLimit adds i to the "model_limit" field.
func (uuo *UserUpdateOne) AddModelLimit(i int) *UserUpdateOne {
uuo.mutation.AddModelLimit(i)
return uuo
}
// ClearModelLimit clears the value of the "model_limit" field.
func (uuo *UserUpdateOne) ClearModelLimit() *UserUpdateOne {
uuo.mutation.ClearModelLimit()
return uuo
}
// SetModelSkill sets the "model_skill" field.
func (uuo *UserUpdateOne) SetModelSkill(i int) *UserUpdateOne {
uuo.mutation.ResetModelSkill()
uuo.mutation.SetModelSkill(i)
return uuo
}
// SetNillableModelSkill sets the "model_skill" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableModelSkill(i *int) *UserUpdateOne {
if i != nil {
uuo.SetModelSkill(*i)
}
return uuo
}
// AddModelSkill adds i to the "model_skill" field.
func (uuo *UserUpdateOne) AddModelSkill(i int) *UserUpdateOne {
uuo.mutation.AddModelSkill(i)
return uuo
}
// ClearModelSkill clears the value of the "model_skill" field.
func (uuo *UserUpdateOne) ClearModelSkill() *UserUpdateOne {
uuo.mutation.ClearModelSkill()
return uuo
}
// SetModelMode sets the "model_mode" field.
func (uuo *UserUpdateOne) SetModelMode(i int) *UserUpdateOne {
uuo.mutation.ResetModelMode()
uuo.mutation.SetModelMode(i)
return uuo
}
// SetNillableModelMode sets the "model_mode" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableModelMode(i *int) *UserUpdateOne {
if i != nil {
uuo.SetModelMode(*i)
}
return uuo
}
// AddModelMode adds i to the "model_mode" field.
func (uuo *UserUpdateOne) AddModelMode(i int) *UserUpdateOne {
uuo.mutation.AddModelMode(i)
return uuo
}
// ClearModelMode clears the value of the "model_mode" field.
func (uuo *UserUpdateOne) ClearModelMode() *UserUpdateOne {
uuo.mutation.ClearModelMode()
return uuo
}
// SetModelCritical sets the "model_critical" field.
func (uuo *UserUpdateOne) SetModelCritical(i int) *UserUpdateOne {
uuo.mutation.ResetModelCritical()
uuo.mutation.SetModelCritical(i)
return uuo
}
// SetNillableModelCritical sets the "model_critical" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableModelCritical(i *int) *UserUpdateOne {
if i != nil {
uuo.SetModelCritical(*i)
}
return uuo
}
// AddModelCritical adds i to the "model_critical" field.
func (uuo *UserUpdateOne) AddModelCritical(i int) *UserUpdateOne {
uuo.mutation.AddModelCritical(i)
return uuo
}
// ClearModelCritical clears the value of the "model_critical" field.
func (uuo *UserUpdateOne) ClearModelCritical() *UserUpdateOne {
uuo.mutation.ClearModelCritical()
return uuo
}
// SetModelCriticalD sets the "model_critical_d" field.
func (uuo *UserUpdateOne) SetModelCriticalD(i int) *UserUpdateOne {
uuo.mutation.ResetModelCriticalD()
uuo.mutation.SetModelCriticalD(i)
return uuo
}
// SetNillableModelCriticalD sets the "model_critical_d" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableModelCriticalD(i *int) *UserUpdateOne {
if i != nil {
uuo.SetModelCriticalD(*i)
}
return uuo
}
// AddModelCriticalD adds i to the "model_critical_d" field.
func (uuo *UserUpdateOne) AddModelCriticalD(i int) *UserUpdateOne {
uuo.mutation.AddModelCriticalD(i)
return uuo
}
// ClearModelCriticalD clears the value of the "model_critical_d" field.
func (uuo *UserUpdateOne) ClearModelCriticalD() *UserUpdateOne {
uuo.mutation.ClearModelCriticalD()
return uuo
}
// SetGame sets the "game" field.
func (uuo *UserUpdateOne) SetGame(b bool) *UserUpdateOne {
uuo.mutation.SetGame(b)
return uuo
}
// SetNillableGame sets the "game" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableGame(b *bool) *UserUpdateOne {
if b != nil {
uuo.SetGame(*b)
}
return uuo
}
// ClearGame clears the value of the "game" field.
func (uuo *UserUpdateOne) ClearGame() *UserUpdateOne {
uuo.mutation.ClearGame()
return uuo
}
// SetGameTest sets the "game_test" field.
func (uuo *UserUpdateOne) SetGameTest(b bool) *UserUpdateOne {
uuo.mutation.SetGameTest(b)
return uuo
}
// SetNillableGameTest sets the "game_test" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableGameTest(b *bool) *UserUpdateOne {
if b != nil {
uuo.SetGameTest(*b)
}
return uuo
}
// ClearGameTest clears the value of the "game_test" field.
func (uuo *UserUpdateOne) ClearGameTest() *UserUpdateOne {
uuo.mutation.ClearGameTest()
return uuo
}
// SetGameEnd sets the "game_end" field.
func (uuo *UserUpdateOne) SetGameEnd(b bool) *UserUpdateOne {
uuo.mutation.SetGameEnd(b)
return uuo
}
// SetNillableGameEnd sets the "game_end" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableGameEnd(b *bool) *UserUpdateOne {
if b != nil {
uuo.SetGameEnd(*b)
}
return uuo
}
// ClearGameEnd clears the value of the "game_end" field.
func (uuo *UserUpdateOne) ClearGameEnd() *UserUpdateOne {
uuo.mutation.ClearGameEnd()
return uuo
}
// SetGameAccount sets the "game_account" field.
func (uuo *UserUpdateOne) SetGameAccount(b bool) *UserUpdateOne {
uuo.mutation.SetGameAccount(b)
return uuo
}
// SetNillableGameAccount sets the "game_account" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableGameAccount(b *bool) *UserUpdateOne {
if b != nil {
uuo.SetGameAccount(*b)
}
return uuo
}
// ClearGameAccount clears the value of the "game_account" field.
func (uuo *UserUpdateOne) ClearGameAccount() *UserUpdateOne {
uuo.mutation.ClearGameAccount()
return uuo
}
// SetGameLv sets the "game_lv" field.
func (uuo *UserUpdateOne) SetGameLv(i int) *UserUpdateOne {
uuo.mutation.ResetGameLv()
uuo.mutation.SetGameLv(i)
return uuo
}
// SetNillableGameLv sets the "game_lv" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableGameLv(i *int) *UserUpdateOne {
if i != nil {
uuo.SetGameLv(*i)
}
return uuo
}
// AddGameLv adds i to the "game_lv" field.
func (uuo *UserUpdateOne) AddGameLv(i int) *UserUpdateOne {
uuo.mutation.AddGameLv(i)
return uuo
}
// ClearGameLv clears the value of the "game_lv" field.
func (uuo *UserUpdateOne) ClearGameLv() *UserUpdateOne {
uuo.mutation.ClearGameLv()
return uuo
}
// AddCardIDs adds the "card" edge to the Card entity by IDs.
func (uuo *UserUpdateOne) AddCardIDs(ids ...int) *UserUpdateOne {
uuo.mutation.AddCardIDs(ids...)
@ -2056,6 +2773,105 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
if uuo.mutation.RoomCleared() {
_spec.ClearField(user.FieldRoom, field.TypeInt)
}
if value, ok := uuo.mutation.Model(); ok {
_spec.SetField(user.FieldModel, field.TypeBool, value)
}
if uuo.mutation.ModelCleared() {
_spec.ClearField(user.FieldModel, field.TypeBool)
}
if value, ok := uuo.mutation.ModelAt(); ok {
_spec.SetField(user.FieldModelAt, field.TypeTime, value)
}
if uuo.mutation.ModelAtCleared() {
_spec.ClearField(user.FieldModelAt, field.TypeTime)
}
if value, ok := uuo.mutation.ModelAttack(); ok {
_spec.SetField(user.FieldModelAttack, field.TypeInt, value)
}
if value, ok := uuo.mutation.AddedModelAttack(); ok {
_spec.AddField(user.FieldModelAttack, field.TypeInt, value)
}
if uuo.mutation.ModelAttackCleared() {
_spec.ClearField(user.FieldModelAttack, field.TypeInt)
}
if value, ok := uuo.mutation.ModelLimit(); ok {
_spec.SetField(user.FieldModelLimit, field.TypeInt, value)
}
if value, ok := uuo.mutation.AddedModelLimit(); ok {
_spec.AddField(user.FieldModelLimit, field.TypeInt, value)
}
if uuo.mutation.ModelLimitCleared() {
_spec.ClearField(user.FieldModelLimit, field.TypeInt)
}
if value, ok := uuo.mutation.ModelSkill(); ok {
_spec.SetField(user.FieldModelSkill, field.TypeInt, value)
}
if value, ok := uuo.mutation.AddedModelSkill(); ok {
_spec.AddField(user.FieldModelSkill, field.TypeInt, value)
}
if uuo.mutation.ModelSkillCleared() {
_spec.ClearField(user.FieldModelSkill, field.TypeInt)
}
if value, ok := uuo.mutation.ModelMode(); ok {
_spec.SetField(user.FieldModelMode, field.TypeInt, value)
}
if value, ok := uuo.mutation.AddedModelMode(); ok {
_spec.AddField(user.FieldModelMode, field.TypeInt, value)
}
if uuo.mutation.ModelModeCleared() {
_spec.ClearField(user.FieldModelMode, field.TypeInt)
}
if value, ok := uuo.mutation.ModelCritical(); ok {
_spec.SetField(user.FieldModelCritical, field.TypeInt, value)
}
if value, ok := uuo.mutation.AddedModelCritical(); ok {
_spec.AddField(user.FieldModelCritical, field.TypeInt, value)
}
if uuo.mutation.ModelCriticalCleared() {
_spec.ClearField(user.FieldModelCritical, field.TypeInt)
}
if value, ok := uuo.mutation.ModelCriticalD(); ok {
_spec.SetField(user.FieldModelCriticalD, field.TypeInt, value)
}
if value, ok := uuo.mutation.AddedModelCriticalD(); ok {
_spec.AddField(user.FieldModelCriticalD, field.TypeInt, value)
}
if uuo.mutation.ModelCriticalDCleared() {
_spec.ClearField(user.FieldModelCriticalD, field.TypeInt)
}
if value, ok := uuo.mutation.Game(); ok {
_spec.SetField(user.FieldGame, field.TypeBool, value)
}
if uuo.mutation.GameCleared() {
_spec.ClearField(user.FieldGame, field.TypeBool)
}
if value, ok := uuo.mutation.GameTest(); ok {
_spec.SetField(user.FieldGameTest, field.TypeBool, value)
}
if uuo.mutation.GameTestCleared() {
_spec.ClearField(user.FieldGameTest, field.TypeBool)
}
if value, ok := uuo.mutation.GameEnd(); ok {
_spec.SetField(user.FieldGameEnd, field.TypeBool, value)
}
if uuo.mutation.GameEndCleared() {
_spec.ClearField(user.FieldGameEnd, field.TypeBool)
}
if value, ok := uuo.mutation.GameAccount(); ok {
_spec.SetField(user.FieldGameAccount, field.TypeBool, value)
}
if uuo.mutation.GameAccountCleared() {
_spec.ClearField(user.FieldGameAccount, field.TypeBool)
}
if value, ok := uuo.mutation.GameLv(); ok {
_spec.SetField(user.FieldGameLv, field.TypeInt, value)
}
if value, ok := uuo.mutation.AddedGameLv(); ok {
_spec.AddField(user.FieldGameLv, field.TypeInt, value)
}
if uuo.mutation.GameLvCleared() {
_spec.ClearField(user.FieldGameLv, field.TypeInt)
}
if uuo.mutation.CardCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,

21
tmp/card_account_change_fix.zsh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/zsh
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
if [ -z "$1" ];then
exit
fi
if [ -z "$2" ];then
did=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.did == \"$1\")"|jq -r .id`
echo $did
exit
fi
echo old-id new-id
read
echo account delete $1 token
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":true,\"token\":\"$token\"}" -s $host/users/$1
echo account refresh $2 token
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":false,\"token\":\"$token\"}" -s $host/users/$2

View File

@ -8,5 +8,12 @@ if [ -z "$1" ];then
fi
id=$1
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":true,\"token\":\"$token\"}" -s $host/users/$id
s=$2
if [ -n "$2" ];then
s=$2
else
s=true
fi
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":$s,\"token\":\"$token\"}" -s $host/users/$id

View File

@ -9,8 +9,9 @@ fi
echo username
read
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
card=2
cp=$(($RANDOM % 500 + 300))
s=3d
skill=3d
card=7
cp=$(($RANDOM % 1000 + 400))
s=yui
skill=model
st=$s
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards

View File

@ -20,7 +20,7 @@ n=$((n - 1))
if [ -n "$1" ];then
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
if [ "ai" = "$1" ] || [ "yui" = "$1" ];then
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\",\"ten_at\":\"$updated_at_n\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"ten_kai\":0,\"ten\": false}" -s $host/users/$id
curl -X PATCH -H "Content-Type: application/json" -d "{\"token\":\"$token\", \"ten_su\": 0}" -s $host/users/$id
else
curl -X PATCH -H "Content-Type: application/json" -d "{\"ten_at\":\"$updated_at_n\", \"token\": \"$token\", \"raid_at\":\"$raid_at_n\"}" -s $host/users/$id
#curl -X PATCH -H "Content-Type: application/json" -d "{\"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"luck_at\": \"$updated_at_n\",\"egg_at\": \"$updated_at_n\", \"token\": \"$token\"}" -s $host/users/$id
@ -33,6 +33,10 @@ for ((i=0;i<=$n;i++))
do
name=`echo $data|jq ".[$i]"|jq -r .username`
id=`echo $data|jq ".[$i]"|jq -r .id`
echo "{\"username\":\"$name\",\"id\":\"$id\"}"
if [ $n -ne $i ];then
echo ","
fi
echo "{\"updated_at\":\"$updated_at_n\"} -s $host/users/$id"
if [ "ai" = "$1" ];then
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"luck\": 7}" -s $host/users/$id

13
tmp/game_account.zsh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/zsh
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
username=ai
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$username\")"|jq -r .id`
curl -sL $host/users/$id
read
echo $id
o=false
echo $o
curl -X PATCH -H "Content-Type: application/json" -d "{\"game\":true, \"game_test\":$o, \"game_end\":$o, \"token\":\"$token\"}" -s $host/users/$id

14
tmp/model_account.zsh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/zsh
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
if [ -z "$1" ];then
exit
fi
echo username
read
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
echo $id
read
curl -X PATCH -H "Content-Type: application/json" -d "{\"model_mode\":1, \"model_skill\":1,\"model_attack\":1,\"model_limit\":1,\"model_critical\":1,\"model_critical_d\":10, \"model\":true,\"token\":\"$token\"}" -s $host/users/$id

33
tmp/model_account_all.zsh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/zsh
case $OSTYPE in
darwin*)
alias date="/opt/homebrew/bin/gdate"
;;
esac
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
host_users="$host/users?itemsPerPage=2550"
updated_at_n=`date --iso-8601=seconds -d '1 days ago'`
now_at=`date --iso-8601=seconds`
raid_at_n=`date --iso-8601=seconds -d '1 days ago'`
data=`curl -sL "$host_users"|jq .`
nd=`date +"%Y%m%d"`
n=`echo $data|jq length`
n=$((n - 1))
for ((i=0;i<=$n;i++))
do
name=`echo $data|jq ".[$i]"|jq -r .username`
id=`echo $data|jq ".[$i]"|jq -r .id`
model=`echo $data|jq ".[$i]"|jq -r .model`
#echo $model
if [ "$model" = false ];then
card=`curl -sL "$host/users/$id/card?itemsPerPage=2550"|jq -r ".[]|select(.skill == \"model\")"`
if [ -n "$card" ];then
echo "\n[${id}] $name"
curl -X PATCH -H "Content-Type: application/json" -d "{\"model\":true,\"model_limit\": 1,\"token\":\"$token\"}" -s $host/users/$id
fi
fi
done

View File

@ -915,7 +915,7 @@ func encodeReadGroupResponse(response ReadGroupRes, w http.ResponseWriter, span
}
func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
w.Header().Set("Access-Control-Allow-Origin", "*")
switch response := response.(type) {
case *UserRead:
w.Header().Set("Content-Type", "application/json")

View File

@ -603,6 +603,46 @@ func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (Crea
if v, ok := req.Next.Get(); ok {
b.SetNext(v)
}
if v, ok := req.Model.Get(); ok {
b.SetModel(v)
}
if v, ok := req.ModelAt.Get(); ok {
b.SetModelAt(v)
}
if v, ok := req.ModelAttack.Get(); ok {
b.SetModelAttack(v)
}
if v, ok := req.ModelCriticalD.Get(); ok {
b.SetModelCriticalD(v)
}
if v, ok := req.ModelCritical.Get(); ok {
b.SetModelCritical(v)
}
if v, ok := req.ModelLimit.Get(); ok {
b.SetModelLimit(v)
}
if v, ok := req.ModelSkill.Get(); ok {
b.SetModelSkill(v)
}
if v, ok := req.ModelMode.Get(); ok {
b.SetModelMode(v)
}
if v, ok := req.Game.Get(); ok {
b.SetGame(v)
}
if v, ok := req.GameTest.Get(); ok {
b.SetGameTest(v)
}
if v, ok := req.GameEnd.Get(); ok {
b.SetGameEnd(v)
}
if v, ok := req.GameAccount.Get(); ok {
b.SetGameAccount(v)
}
if v, ok := req.GameLv.Get(); ok {
b.SetGameLv(v)
}
// Add all edges.
b.AddCardIDs(req.Card...)
// Persist to storage.
@ -760,6 +800,45 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
if v, ok := req.Next.Get(); ok {
b.SetNext(v)
}
if v, ok := req.Model.Get(); ok {
b.SetModel(v)
}
if v, ok := req.ModelAt.Get(); ok {
b.SetModelAt(v)
}
if v, ok := req.ModelAttack.Get(); ok {
b.SetModelAttack(v)
}
if v, ok := req.ModelCriticalD.Get(); ok {
b.SetModelCriticalD(v)
}
if v, ok := req.ModelCritical.Get(); ok {
b.SetModelCritical(v)
}
if v, ok := req.ModelLimit.Get(); ok {
b.SetModelLimit(v)
}
if v, ok := req.ModelSkill.Get(); ok {
b.SetModelSkill(v)
}
if v, ok := req.ModelMode.Get(); ok {
b.SetModelMode(v)
}
if v, ok := req.Game.Get(); ok {
b.SetGame(v)
}
if v, ok := req.GameTest.Get(); ok {
b.SetGameTest(v)
}
if v, ok := req.GameEnd.Get(); ok {
b.SetGameEnd(v)
}
if v, ok := req.GameAccount.Get(); ok {
b.SetGameAccount(v)
}
if v, ok := req.GameLv.Get(); ok {
b.SetGameLv(v)
}
// Add all edges.
if req.Card != nil {
b.ClearCard().AddCardIDs(req.Card...)

35
tmp/user_json.zsh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/zsh
case $OSTYPE in
darwin*)
alias date="/opt/homebrew/bin/gdate"
;;
esac
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
host_users="$host/users?itemsPerPage=2550"
data=`curl -sL "$host_users"|jq .`
n=`echo $data|jq length`
n=$((n - 1))
f=/Volumes/ssd/project/yui/Content/user.json
if [ -f $f ];then
rm $f
fi
echo "{" >! $f
for ((i=0;i<=$n;i++))
do
name=`echo $data|jq ".[$i]"|jq -r .username`
id=`echo $data|jq ".[$i]"|jq -r .id`
j="\"$name\":$id"
j="\"$name\":\"$id\""
if [ $n -ne $i ];then
j="${j},"
fi
echo $j
echo $j >> $f
done
echo "}" >> $f