1
0
This commit is contained in:
syui 2024-02-22 04:08:34 +09:00
parent d62d7b61d0
commit bd3b582150
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
16 changed files with 1650 additions and 33 deletions

View File

@ -129,7 +129,7 @@ var (
{Name: "ten_post", Type: field.TypeString, Nullable: true},
{Name: "ten_get", Type: field.TypeString, Nullable: true},
{Name: "ten_at", Type: field.TypeTime, Nullable: true},
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20240220"},
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20240222"},
{Name: "room", Type: field.TypeInt, Nullable: true},
{Name: "model", Type: field.TypeBool, Nullable: true},
{Name: "model_at", Type: field.TypeTime, Nullable: true},
@ -144,6 +144,9 @@ var (
{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: "coin", Type: field.TypeInt, Nullable: true},
{Name: "coin_open", Type: field.TypeBool, Nullable: true, Default: false},
{Name: "coin_at", Type: field.TypeTime, Nullable: true},
{Name: "group_users", Type: field.TypeInt, Nullable: true},
}
// UsersTable holds the schema information for the "users" table.
@ -154,7 +157,7 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "users_groups_users",
Columns: []*schema.Column{UsersColumns[48]},
Columns: []*schema.Column{UsersColumns[51]},
RefColumns: []*schema.Column{GroupsColumns[0]},
OnDelete: schema.SetNull,
},

View File

@ -3819,6 +3819,10 @@ type UserMutation struct {
game_account *bool
game_lv *int
addgame_lv *int
coin *int
addcoin *int
coin_open *bool
coin_at *time.Time
clearedFields map[string]struct{}
card map[int]struct{}
removedcard map[int]struct{}
@ -6521,6 +6525,174 @@ func (m *UserMutation) ResetGameLv() {
delete(m.clearedFields, user.FieldGameLv)
}
// SetCoin sets the "coin" field.
func (m *UserMutation) SetCoin(i int) {
m.coin = &i
m.addcoin = nil
}
// Coin returns the value of the "coin" field in the mutation.
func (m *UserMutation) Coin() (r int, exists bool) {
v := m.coin
if v == nil {
return
}
return *v, true
}
// OldCoin returns the old "coin" field's value of the User entity.
// If the User object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *UserMutation) OldCoin(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCoin is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCoin requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCoin: %w", err)
}
return oldValue.Coin, nil
}
// AddCoin adds i to the "coin" field.
func (m *UserMutation) AddCoin(i int) {
if m.addcoin != nil {
*m.addcoin += i
} else {
m.addcoin = &i
}
}
// AddedCoin returns the value that was added to the "coin" field in this mutation.
func (m *UserMutation) AddedCoin() (r int, exists bool) {
v := m.addcoin
if v == nil {
return
}
return *v, true
}
// ClearCoin clears the value of the "coin" field.
func (m *UserMutation) ClearCoin() {
m.coin = nil
m.addcoin = nil
m.clearedFields[user.FieldCoin] = struct{}{}
}
// CoinCleared returns if the "coin" field was cleared in this mutation.
func (m *UserMutation) CoinCleared() bool {
_, ok := m.clearedFields[user.FieldCoin]
return ok
}
// ResetCoin resets all changes to the "coin" field.
func (m *UserMutation) ResetCoin() {
m.coin = nil
m.addcoin = nil
delete(m.clearedFields, user.FieldCoin)
}
// SetCoinOpen sets the "coin_open" field.
func (m *UserMutation) SetCoinOpen(b bool) {
m.coin_open = &b
}
// CoinOpen returns the value of the "coin_open" field in the mutation.
func (m *UserMutation) CoinOpen() (r bool, exists bool) {
v := m.coin_open
if v == nil {
return
}
return *v, true
}
// OldCoinOpen returns the old "coin_open" field's value of the User entity.
// If the User object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *UserMutation) OldCoinOpen(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCoinOpen is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCoinOpen requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCoinOpen: %w", err)
}
return oldValue.CoinOpen, nil
}
// ClearCoinOpen clears the value of the "coin_open" field.
func (m *UserMutation) ClearCoinOpen() {
m.coin_open = nil
m.clearedFields[user.FieldCoinOpen] = struct{}{}
}
// CoinOpenCleared returns if the "coin_open" field was cleared in this mutation.
func (m *UserMutation) CoinOpenCleared() bool {
_, ok := m.clearedFields[user.FieldCoinOpen]
return ok
}
// ResetCoinOpen resets all changes to the "coin_open" field.
func (m *UserMutation) ResetCoinOpen() {
m.coin_open = nil
delete(m.clearedFields, user.FieldCoinOpen)
}
// SetCoinAt sets the "coin_at" field.
func (m *UserMutation) SetCoinAt(t time.Time) {
m.coin_at = &t
}
// CoinAt returns the value of the "coin_at" field in the mutation.
func (m *UserMutation) CoinAt() (r time.Time, exists bool) {
v := m.coin_at
if v == nil {
return
}
return *v, true
}
// OldCoinAt returns the old "coin_at" field's value of the User entity.
// If the User object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *UserMutation) OldCoinAt(ctx context.Context) (v time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCoinAt is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCoinAt requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCoinAt: %w", err)
}
return oldValue.CoinAt, nil
}
// ClearCoinAt clears the value of the "coin_at" field.
func (m *UserMutation) ClearCoinAt() {
m.coin_at = nil
m.clearedFields[user.FieldCoinAt] = struct{}{}
}
// CoinAtCleared returns if the "coin_at" field was cleared in this mutation.
func (m *UserMutation) CoinAtCleared() bool {
_, ok := m.clearedFields[user.FieldCoinAt]
return ok
}
// ResetCoinAt resets all changes to the "coin_at" field.
func (m *UserMutation) ResetCoinAt() {
m.coin_at = nil
delete(m.clearedFields, user.FieldCoinAt)
}
// AddCardIDs adds the "card" edge to the Card entity by ids.
func (m *UserMutation) AddCardIDs(ids ...int) {
if m.card == nil {
@ -6663,7 +6835,7 @@ func (m *UserMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *UserMutation) Fields() []string {
fields := make([]string, 0, 47)
fields := make([]string, 0, 50)
if m.username != nil {
fields = append(fields, user.FieldUsername)
}
@ -6805,6 +6977,15 @@ func (m *UserMutation) Fields() []string {
if m.game_lv != nil {
fields = append(fields, user.FieldGameLv)
}
if m.coin != nil {
fields = append(fields, user.FieldCoin)
}
if m.coin_open != nil {
fields = append(fields, user.FieldCoinOpen)
}
if m.coin_at != nil {
fields = append(fields, user.FieldCoinAt)
}
return fields
}
@ -6907,6 +7088,12 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) {
return m.GameAccount()
case user.FieldGameLv:
return m.GameLv()
case user.FieldCoin:
return m.Coin()
case user.FieldCoinOpen:
return m.CoinOpen()
case user.FieldCoinAt:
return m.CoinAt()
}
return nil, false
}
@ -7010,6 +7197,12 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er
return m.OldGameAccount(ctx)
case user.FieldGameLv:
return m.OldGameLv(ctx)
case user.FieldCoin:
return m.OldCoin(ctx)
case user.FieldCoinOpen:
return m.OldCoinOpen(ctx)
case user.FieldCoinAt:
return m.OldCoinAt(ctx)
}
return nil, fmt.Errorf("unknown User field %s", name)
}
@ -7348,6 +7541,27 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
}
m.SetGameLv(v)
return nil
case user.FieldCoin:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCoin(v)
return nil
case user.FieldCoinOpen:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCoinOpen(v)
return nil
case user.FieldCoinAt:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCoinAt(v)
return nil
}
return fmt.Errorf("unknown User field %s", name)
}
@ -7401,6 +7615,9 @@ func (m *UserMutation) AddedFields() []string {
if m.addgame_lv != nil {
fields = append(fields, user.FieldGameLv)
}
if m.addcoin != nil {
fields = append(fields, user.FieldCoin)
}
return fields
}
@ -7439,6 +7656,8 @@ func (m *UserMutation) AddedField(name string) (ent.Value, bool) {
return m.AddedModelCriticalD()
case user.FieldGameLv:
return m.AddedGameLv()
case user.FieldCoin:
return m.AddedCoin()
}
return nil, false
}
@ -7553,6 +7772,13 @@ func (m *UserMutation) AddField(name string, value ent.Value) error {
}
m.AddGameLv(v)
return nil
case user.FieldCoin:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddCoin(v)
return nil
}
return fmt.Errorf("unknown User numeric field %s", name)
}
@ -7696,6 +7922,15 @@ func (m *UserMutation) ClearedFields() []string {
if m.FieldCleared(user.FieldGameLv) {
fields = append(fields, user.FieldGameLv)
}
if m.FieldCleared(user.FieldCoin) {
fields = append(fields, user.FieldCoin)
}
if m.FieldCleared(user.FieldCoinOpen) {
fields = append(fields, user.FieldCoinOpen)
}
if m.FieldCleared(user.FieldCoinAt) {
fields = append(fields, user.FieldCoinAt)
}
return fields
}
@ -7845,6 +8080,15 @@ func (m *UserMutation) ClearField(name string) error {
case user.FieldGameLv:
m.ClearGameLv()
return nil
case user.FieldCoin:
m.ClearCoin()
return nil
case user.FieldCoinOpen:
m.ClearCoinOpen()
return nil
case user.FieldCoinAt:
m.ClearCoinAt()
return nil
}
return fmt.Errorf("unknown User nullable field %s", name)
}
@ -7994,6 +8238,15 @@ func (m *UserMutation) ResetField(name string) error {
case user.FieldGameLv:
m.ResetGameLv()
return nil
case user.FieldCoin:
m.ResetCoin()
return nil
case user.FieldCoinOpen:
m.ResetCoinOpen()
return nil
case user.FieldCoinAt:
m.ResetCoinAt()
return nil
}
return fmt.Errorf("unknown User field %s", name)
}

View File

@ -765,9 +765,27 @@ func (s *CardOwnerRead) encodeFields(e *jx.Encoder) {
s.GameLv.Encode(e)
}
}
{
if s.Coin.Set {
e.FieldStart("coin")
s.Coin.Encode(e)
}
}
{
if s.CoinOpen.Set {
e.FieldStart("coin_open")
s.CoinOpen.Encode(e)
}
}
{
if s.CoinAt.Set {
e.FieldStart("coin_at")
s.CoinAt.Encode(e, json.EncodeDateTime)
}
}
}
var jsonFieldsNameOfCardOwnerRead = [46]string{
var jsonFieldsNameOfCardOwnerRead = [49]string{
0: "id",
1: "username",
2: "did",
@ -814,6 +832,9 @@ var jsonFieldsNameOfCardOwnerRead = [46]string{
43: "game_end",
44: "game_account",
45: "game_lv",
46: "coin",
47: "coin_open",
48: "coin_at",
}
// Decode decodes CardOwnerRead from json.
@ -821,7 +842,7 @@ func (s *CardOwnerRead) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode CardOwnerRead to nil")
}
var requiredBitSet [6]uint8
var requiredBitSet [7]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -1289,6 +1310,36 @@ func (s *CardOwnerRead) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"game_lv\"")
}
case "coin":
if err := func() error {
s.Coin.Reset()
if err := s.Coin.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin\"")
}
case "coin_open":
if err := func() error {
s.CoinOpen.Reset()
if err := s.CoinOpen.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_open\"")
}
case "coin_at":
if err := func() error {
s.CoinAt.Reset()
if err := s.CoinAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_at\"")
}
default:
return d.Skip()
}
@ -1298,13 +1349,14 @@ func (s *CardOwnerRead) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [6]uint8{
for i, mask := range [7]uint8{
0b00000011,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -2944,6 +2996,24 @@ func (s *CreateUserReq) encodeFields(e *jx.Encoder) {
s.GameLv.Encode(e)
}
}
{
if s.Coin.Set {
e.FieldStart("coin")
s.Coin.Encode(e)
}
}
{
if s.CoinOpen.Set {
e.FieldStart("coin_open")
s.CoinOpen.Encode(e)
}
}
{
if s.CoinAt.Set {
e.FieldStart("coin_at")
s.CoinAt.Encode(e, json.EncodeDateTime)
}
}
{
if s.Card != nil {
e.FieldStart("card")
@ -2966,7 +3036,7 @@ func (s *CreateUserReq) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfCreateUserReq = [49]string{
var jsonFieldsNameOfCreateUserReq = [52]string{
0: "username",
1: "did",
2: "member",
@ -3014,8 +3084,11 @@ var jsonFieldsNameOfCreateUserReq = [49]string{
44: "game_end",
45: "game_account",
46: "game_lv",
47: "card",
48: "ue",
47: "coin",
48: "coin_open",
49: "coin_at",
50: "card",
51: "ue",
}
// Decode decodes CreateUserReq from json.
@ -3501,6 +3574,36 @@ func (s *CreateUserReq) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"game_lv\"")
}
case "coin":
if err := func() error {
s.Coin.Reset()
if err := s.Coin.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin\"")
}
case "coin_open":
if err := func() error {
s.CoinOpen.Reset()
if err := s.CoinOpen.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_open\"")
}
case "coin_at":
if err := func() error {
s.CoinAt.Reset()
if err := s.CoinAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_at\"")
}
case "card":
if err := func() error {
s.Card = make([]int, 0)
@ -4344,9 +4447,27 @@ func (s *GroupUsersList) encodeFields(e *jx.Encoder) {
s.GameLv.Encode(e)
}
}
{
if s.Coin.Set {
e.FieldStart("coin")
s.Coin.Encode(e)
}
}
{
if s.CoinOpen.Set {
e.FieldStart("coin_open")
s.CoinOpen.Encode(e)
}
}
{
if s.CoinAt.Set {
e.FieldStart("coin_at")
s.CoinAt.Encode(e, json.EncodeDateTime)
}
}
}
var jsonFieldsNameOfGroupUsersList = [46]string{
var jsonFieldsNameOfGroupUsersList = [49]string{
0: "id",
1: "username",
2: "did",
@ -4393,6 +4514,9 @@ var jsonFieldsNameOfGroupUsersList = [46]string{
43: "game_end",
44: "game_account",
45: "game_lv",
46: "coin",
47: "coin_open",
48: "coin_at",
}
// Decode decodes GroupUsersList from json.
@ -4400,7 +4524,7 @@ func (s *GroupUsersList) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode GroupUsersList to nil")
}
var requiredBitSet [6]uint8
var requiredBitSet [7]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -4868,6 +4992,36 @@ func (s *GroupUsersList) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"game_lv\"")
}
case "coin":
if err := func() error {
s.Coin.Reset()
if err := s.Coin.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin\"")
}
case "coin_open":
if err := func() error {
s.CoinOpen.Reset()
if err := s.CoinOpen.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_open\"")
}
case "coin_at":
if err := func() error {
s.CoinAt.Reset()
if err := s.CoinAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_at\"")
}
default:
return d.Skip()
}
@ -4877,13 +5031,14 @@ func (s *GroupUsersList) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [6]uint8{
for i, mask := range [7]uint8{
0b00000011,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -7014,9 +7169,27 @@ func (s *UeOwnerRead) encodeFields(e *jx.Encoder) {
s.GameLv.Encode(e)
}
}
{
if s.Coin.Set {
e.FieldStart("coin")
s.Coin.Encode(e)
}
}
{
if s.CoinOpen.Set {
e.FieldStart("coin_open")
s.CoinOpen.Encode(e)
}
}
{
if s.CoinAt.Set {
e.FieldStart("coin_at")
s.CoinAt.Encode(e, json.EncodeDateTime)
}
}
}
var jsonFieldsNameOfUeOwnerRead = [46]string{
var jsonFieldsNameOfUeOwnerRead = [49]string{
0: "id",
1: "username",
2: "did",
@ -7063,6 +7236,9 @@ var jsonFieldsNameOfUeOwnerRead = [46]string{
43: "game_end",
44: "game_account",
45: "game_lv",
46: "coin",
47: "coin_open",
48: "coin_at",
}
// Decode decodes UeOwnerRead from json.
@ -7070,7 +7246,7 @@ func (s *UeOwnerRead) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode UeOwnerRead to nil")
}
var requiredBitSet [6]uint8
var requiredBitSet [7]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -7538,6 +7714,36 @@ func (s *UeOwnerRead) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"game_lv\"")
}
case "coin":
if err := func() error {
s.Coin.Reset()
if err := s.Coin.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin\"")
}
case "coin_open":
if err := func() error {
s.CoinOpen.Reset()
if err := s.CoinOpen.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_open\"")
}
case "coin_at":
if err := func() error {
s.CoinAt.Reset()
if err := s.CoinAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_at\"")
}
default:
return d.Skip()
}
@ -7547,13 +7753,14 @@ func (s *UeOwnerRead) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [6]uint8{
for i, mask := range [7]uint8{
0b00000011,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -9292,6 +9499,24 @@ func (s *UpdateUserReq) encodeFields(e *jx.Encoder) {
s.GameLv.Encode(e)
}
}
{
if s.Coin.Set {
e.FieldStart("coin")
s.Coin.Encode(e)
}
}
{
if s.CoinOpen.Set {
e.FieldStart("coin_open")
s.CoinOpen.Encode(e)
}
}
{
if s.CoinAt.Set {
e.FieldStart("coin_at")
s.CoinAt.Encode(e, json.EncodeDateTime)
}
}
{
if s.Card != nil {
e.FieldStart("card")
@ -9314,7 +9539,7 @@ func (s *UpdateUserReq) encodeFields(e *jx.Encoder) {
}
}
var jsonFieldsNameOfUpdateUserReq = [46]string{
var jsonFieldsNameOfUpdateUserReq = [49]string{
0: "did",
1: "member",
2: "book",
@ -9359,8 +9584,11 @@ var jsonFieldsNameOfUpdateUserReq = [46]string{
41: "game_end",
42: "game_account",
43: "game_lv",
44: "card",
45: "ue",
44: "coin",
45: "coin_open",
46: "coin_at",
47: "card",
48: "ue",
}
// Decode decodes UpdateUserReq from json.
@ -9811,6 +10039,36 @@ func (s *UpdateUserReq) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"game_lv\"")
}
case "coin":
if err := func() error {
s.Coin.Reset()
if err := s.Coin.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin\"")
}
case "coin_open":
if err := func() error {
s.CoinOpen.Reset()
if err := s.CoinOpen.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_open\"")
}
case "coin_at":
if err := func() error {
s.CoinAt.Reset()
if err := s.CoinAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_at\"")
}
case "card":
if err := func() error {
s.Card = make([]int, 0)
@ -10390,9 +10648,27 @@ func (s *UserCreate) encodeFields(e *jx.Encoder) {
s.GameLv.Encode(e)
}
}
{
if s.Coin.Set {
e.FieldStart("coin")
s.Coin.Encode(e)
}
}
{
if s.CoinOpen.Set {
e.FieldStart("coin_open")
s.CoinOpen.Encode(e)
}
}
{
if s.CoinAt.Set {
e.FieldStart("coin_at")
s.CoinAt.Encode(e, json.EncodeDateTime)
}
}
}
var jsonFieldsNameOfUserCreate = [46]string{
var jsonFieldsNameOfUserCreate = [49]string{
0: "id",
1: "username",
2: "did",
@ -10439,6 +10715,9 @@ var jsonFieldsNameOfUserCreate = [46]string{
43: "game_end",
44: "game_account",
45: "game_lv",
46: "coin",
47: "coin_open",
48: "coin_at",
}
// Decode decodes UserCreate from json.
@ -10446,7 +10725,7 @@ func (s *UserCreate) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode UserCreate to nil")
}
var requiredBitSet [6]uint8
var requiredBitSet [7]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -10914,6 +11193,36 @@ func (s *UserCreate) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"game_lv\"")
}
case "coin":
if err := func() error {
s.Coin.Reset()
if err := s.Coin.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin\"")
}
case "coin_open":
if err := func() error {
s.CoinOpen.Reset()
if err := s.CoinOpen.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_open\"")
}
case "coin_at":
if err := func() error {
s.CoinAt.Reset()
if err := s.CoinAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_at\"")
}
default:
return d.Skip()
}
@ -10923,13 +11232,14 @@ func (s *UserCreate) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [6]uint8{
for i, mask := range [7]uint8{
0b00000011,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -11258,9 +11568,27 @@ func (s *UserList) encodeFields(e *jx.Encoder) {
s.GameLv.Encode(e)
}
}
{
if s.Coin.Set {
e.FieldStart("coin")
s.Coin.Encode(e)
}
}
{
if s.CoinOpen.Set {
e.FieldStart("coin_open")
s.CoinOpen.Encode(e)
}
}
{
if s.CoinAt.Set {
e.FieldStart("coin_at")
s.CoinAt.Encode(e, json.EncodeDateTime)
}
}
}
var jsonFieldsNameOfUserList = [46]string{
var jsonFieldsNameOfUserList = [49]string{
0: "id",
1: "username",
2: "did",
@ -11307,6 +11635,9 @@ var jsonFieldsNameOfUserList = [46]string{
43: "game_end",
44: "game_account",
45: "game_lv",
46: "coin",
47: "coin_open",
48: "coin_at",
}
// Decode decodes UserList from json.
@ -11314,7 +11645,7 @@ func (s *UserList) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode UserList to nil")
}
var requiredBitSet [6]uint8
var requiredBitSet [7]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -11782,6 +12113,36 @@ func (s *UserList) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"game_lv\"")
}
case "coin":
if err := func() error {
s.Coin.Reset()
if err := s.Coin.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin\"")
}
case "coin_open":
if err := func() error {
s.CoinOpen.Reset()
if err := s.CoinOpen.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_open\"")
}
case "coin_at":
if err := func() error {
s.CoinAt.Reset()
if err := s.CoinAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_at\"")
}
default:
return d.Skip()
}
@ -11791,13 +12152,14 @@ func (s *UserList) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [6]uint8{
for i, mask := range [7]uint8{
0b00000011,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -12126,9 +12488,27 @@ func (s *UserRead) encodeFields(e *jx.Encoder) {
s.GameLv.Encode(e)
}
}
{
if s.Coin.Set {
e.FieldStart("coin")
s.Coin.Encode(e)
}
}
{
if s.CoinOpen.Set {
e.FieldStart("coin_open")
s.CoinOpen.Encode(e)
}
}
{
if s.CoinAt.Set {
e.FieldStart("coin_at")
s.CoinAt.Encode(e, json.EncodeDateTime)
}
}
}
var jsonFieldsNameOfUserRead = [46]string{
var jsonFieldsNameOfUserRead = [49]string{
0: "id",
1: "username",
2: "did",
@ -12175,6 +12555,9 @@ var jsonFieldsNameOfUserRead = [46]string{
43: "game_end",
44: "game_account",
45: "game_lv",
46: "coin",
47: "coin_open",
48: "coin_at",
}
// Decode decodes UserRead from json.
@ -12182,7 +12565,7 @@ func (s *UserRead) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode UserRead to nil")
}
var requiredBitSet [6]uint8
var requiredBitSet [7]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -12650,6 +13033,36 @@ func (s *UserRead) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"game_lv\"")
}
case "coin":
if err := func() error {
s.Coin.Reset()
if err := s.Coin.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin\"")
}
case "coin_open":
if err := func() error {
s.CoinOpen.Reset()
if err := s.CoinOpen.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_open\"")
}
case "coin_at":
if err := func() error {
s.CoinAt.Reset()
if err := s.CoinAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_at\"")
}
default:
return d.Skip()
}
@ -12659,13 +13072,14 @@ func (s *UserRead) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [6]uint8{
for i, mask := range [7]uint8{
0b00000011,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
@ -13382,9 +13796,27 @@ func (s *UserUpdate) encodeFields(e *jx.Encoder) {
s.GameLv.Encode(e)
}
}
{
if s.Coin.Set {
e.FieldStart("coin")
s.Coin.Encode(e)
}
}
{
if s.CoinOpen.Set {
e.FieldStart("coin_open")
s.CoinOpen.Encode(e)
}
}
{
if s.CoinAt.Set {
e.FieldStart("coin_at")
s.CoinAt.Encode(e, json.EncodeDateTime)
}
}
}
var jsonFieldsNameOfUserUpdate = [46]string{
var jsonFieldsNameOfUserUpdate = [49]string{
0: "id",
1: "username",
2: "did",
@ -13431,6 +13863,9 @@ var jsonFieldsNameOfUserUpdate = [46]string{
43: "game_end",
44: "game_account",
45: "game_lv",
46: "coin",
47: "coin_open",
48: "coin_at",
}
// Decode decodes UserUpdate from json.
@ -13438,7 +13873,7 @@ func (s *UserUpdate) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode UserUpdate to nil")
}
var requiredBitSet [6]uint8
var requiredBitSet [7]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
@ -13906,6 +14341,36 @@ func (s *UserUpdate) Decode(d *jx.Decoder) error {
}(); err != nil {
return errors.Wrap(err, "decode field \"game_lv\"")
}
case "coin":
if err := func() error {
s.Coin.Reset()
if err := s.Coin.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin\"")
}
case "coin_open":
if err := func() error {
s.CoinOpen.Reset()
if err := s.CoinOpen.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_open\"")
}
case "coin_at":
if err := func() error {
s.CoinAt.Reset()
if err := s.CoinAt.Decode(d, json.DecodeDateTime); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"coin_at\"")
}
default:
return d.Skip()
}
@ -13915,13 +14380,14 @@ func (s *UserUpdate) Decode(d *jx.Decoder) error {
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [6]uint8{
for i, mask := range [7]uint8{
0b00000011,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.

View File

@ -264,6 +264,9 @@ type CardOwnerRead struct {
GameEnd OptBool `json:"game_end"`
GameAccount OptBool `json:"game_account"`
GameLv OptInt `json:"game_lv"`
Coin OptInt `json:"coin"`
CoinOpen OptBool `json:"coin_open"`
CoinAt OptDateTime `json:"coin_at"`
}
// GetID returns the value of ID.
@ -496,6 +499,21 @@ func (s *CardOwnerRead) GetGameLv() OptInt {
return s.GameLv
}
// GetCoin returns the value of Coin.
func (s *CardOwnerRead) GetCoin() OptInt {
return s.Coin
}
// GetCoinOpen returns the value of CoinOpen.
func (s *CardOwnerRead) GetCoinOpen() OptBool {
return s.CoinOpen
}
// GetCoinAt returns the value of CoinAt.
func (s *CardOwnerRead) GetCoinAt() OptDateTime {
return s.CoinAt
}
// SetID sets the value of ID.
func (s *CardOwnerRead) SetID(val int) {
s.ID = val
@ -726,6 +744,21 @@ func (s *CardOwnerRead) SetGameLv(val OptInt) {
s.GameLv = val
}
// SetCoin sets the value of Coin.
func (s *CardOwnerRead) SetCoin(val OptInt) {
s.Coin = val
}
// SetCoinOpen sets the value of CoinOpen.
func (s *CardOwnerRead) SetCoinOpen(val OptBool) {
s.CoinOpen = val
}
// SetCoinAt sets the value of CoinAt.
func (s *CardOwnerRead) SetCoinAt(val OptDateTime) {
s.CoinAt = val
}
func (*CardOwnerRead) readCardOwnerRes() {}
// Ref: #/components/schemas/CardRead
@ -1369,6 +1402,9 @@ type CreateUserReq struct {
GameEnd OptBool `json:"game_end"`
GameAccount OptBool `json:"game_account"`
GameLv OptInt `json:"game_lv"`
Coin OptInt `json:"coin"`
CoinOpen OptBool `json:"coin_open"`
CoinAt OptDateTime `json:"coin_at"`
Card []int `json:"card"`
Ue []int `json:"ue"`
}
@ -1608,6 +1644,21 @@ func (s *CreateUserReq) GetGameLv() OptInt {
return s.GameLv
}
// GetCoin returns the value of Coin.
func (s *CreateUserReq) GetCoin() OptInt {
return s.Coin
}
// GetCoinOpen returns the value of CoinOpen.
func (s *CreateUserReq) GetCoinOpen() OptBool {
return s.CoinOpen
}
// GetCoinAt returns the value of CoinAt.
func (s *CreateUserReq) GetCoinAt() OptDateTime {
return s.CoinAt
}
// GetCard returns the value of Card.
func (s *CreateUserReq) GetCard() []int {
return s.Card
@ -1853,6 +1904,21 @@ func (s *CreateUserReq) SetGameLv(val OptInt) {
s.GameLv = val
}
// SetCoin sets the value of Coin.
func (s *CreateUserReq) SetCoin(val OptInt) {
s.Coin = val
}
// SetCoinOpen sets the value of CoinOpen.
func (s *CreateUserReq) SetCoinOpen(val OptBool) {
s.CoinOpen = val
}
// SetCoinAt sets the value of CoinAt.
func (s *CreateUserReq) SetCoinAt(val OptDateTime) {
s.CoinAt = val
}
// SetCard sets the value of Card.
func (s *CreateUserReq) SetCard(val []int) {
s.Card = val
@ -2047,6 +2113,9 @@ type GroupUsersList struct {
GameEnd OptBool `json:"game_end"`
GameAccount OptBool `json:"game_account"`
GameLv OptInt `json:"game_lv"`
Coin OptInt `json:"coin"`
CoinOpen OptBool `json:"coin_open"`
CoinAt OptDateTime `json:"coin_at"`
}
// GetID returns the value of ID.
@ -2279,6 +2348,21 @@ func (s *GroupUsersList) GetGameLv() OptInt {
return s.GameLv
}
// GetCoin returns the value of Coin.
func (s *GroupUsersList) GetCoin() OptInt {
return s.Coin
}
// GetCoinOpen returns the value of CoinOpen.
func (s *GroupUsersList) GetCoinOpen() OptBool {
return s.CoinOpen
}
// GetCoinAt returns the value of CoinAt.
func (s *GroupUsersList) GetCoinAt() OptDateTime {
return s.CoinAt
}
// SetID sets the value of ID.
func (s *GroupUsersList) SetID(val int) {
s.ID = val
@ -2509,6 +2593,21 @@ func (s *GroupUsersList) SetGameLv(val OptInt) {
s.GameLv = val
}
// SetCoin sets the value of Coin.
func (s *GroupUsersList) SetCoin(val OptInt) {
s.Coin = val
}
// SetCoinOpen sets the value of CoinOpen.
func (s *GroupUsersList) SetCoinOpen(val OptBool) {
s.CoinOpen = val
}
// SetCoinAt sets the value of CoinAt.
func (s *GroupUsersList) SetCoinAt(val OptDateTime) {
s.CoinAt = val
}
type ListCardOKApplicationJSON []CardList
func (*ListCardOKApplicationJSON) listCardRes() {}
@ -3419,6 +3518,9 @@ type UeOwnerRead struct {
GameEnd OptBool `json:"game_end"`
GameAccount OptBool `json:"game_account"`
GameLv OptInt `json:"game_lv"`
Coin OptInt `json:"coin"`
CoinOpen OptBool `json:"coin_open"`
CoinAt OptDateTime `json:"coin_at"`
}
// GetID returns the value of ID.
@ -3651,6 +3753,21 @@ func (s *UeOwnerRead) GetGameLv() OptInt {
return s.GameLv
}
// GetCoin returns the value of Coin.
func (s *UeOwnerRead) GetCoin() OptInt {
return s.Coin
}
// GetCoinOpen returns the value of CoinOpen.
func (s *UeOwnerRead) GetCoinOpen() OptBool {
return s.CoinOpen
}
// GetCoinAt returns the value of CoinAt.
func (s *UeOwnerRead) GetCoinAt() OptDateTime {
return s.CoinAt
}
// SetID sets the value of ID.
func (s *UeOwnerRead) SetID(val int) {
s.ID = val
@ -3881,6 +3998,21 @@ func (s *UeOwnerRead) SetGameLv(val OptInt) {
s.GameLv = val
}
// SetCoin sets the value of Coin.
func (s *UeOwnerRead) SetCoin(val OptInt) {
s.Coin = val
}
// SetCoinOpen sets the value of CoinOpen.
func (s *UeOwnerRead) SetCoinOpen(val OptBool) {
s.CoinOpen = val
}
// SetCoinAt sets the value of CoinAt.
func (s *UeOwnerRead) SetCoinAt(val OptDateTime) {
s.CoinAt = val
}
func (*UeOwnerRead) readUeOwnerRes() {}
// Ref: #/components/schemas/UeRead
@ -4664,6 +4796,9 @@ type UpdateUserReq struct {
GameEnd OptBool `json:"game_end"`
GameAccount OptBool `json:"game_account"`
GameLv OptInt `json:"game_lv"`
Coin OptInt `json:"coin"`
CoinOpen OptBool `json:"coin_open"`
CoinAt OptDateTime `json:"coin_at"`
Card []int `json:"card"`
Ue []int `json:"ue"`
}
@ -4888,6 +5023,21 @@ func (s *UpdateUserReq) GetGameLv() OptInt {
return s.GameLv
}
// GetCoin returns the value of Coin.
func (s *UpdateUserReq) GetCoin() OptInt {
return s.Coin
}
// GetCoinOpen returns the value of CoinOpen.
func (s *UpdateUserReq) GetCoinOpen() OptBool {
return s.CoinOpen
}
// GetCoinAt returns the value of CoinAt.
func (s *UpdateUserReq) GetCoinAt() OptDateTime {
return s.CoinAt
}
// GetCard returns the value of Card.
func (s *UpdateUserReq) GetCard() []int {
return s.Card
@ -5118,6 +5268,21 @@ func (s *UpdateUserReq) SetGameLv(val OptInt) {
s.GameLv = val
}
// SetCoin sets the value of Coin.
func (s *UpdateUserReq) SetCoin(val OptInt) {
s.Coin = val
}
// SetCoinOpen sets the value of CoinOpen.
func (s *UpdateUserReq) SetCoinOpen(val OptBool) {
s.CoinOpen = val
}
// SetCoinAt sets the value of CoinAt.
func (s *UpdateUserReq) SetCoinAt(val OptDateTime) {
s.CoinAt = val
}
// SetCard sets the value of Card.
func (s *UpdateUserReq) SetCard(val []int) {
s.Card = val
@ -5279,6 +5444,9 @@ type UserCreate struct {
GameEnd OptBool `json:"game_end"`
GameAccount OptBool `json:"game_account"`
GameLv OptInt `json:"game_lv"`
Coin OptInt `json:"coin"`
CoinOpen OptBool `json:"coin_open"`
CoinAt OptDateTime `json:"coin_at"`
}
// GetID returns the value of ID.
@ -5511,6 +5679,21 @@ func (s *UserCreate) GetGameLv() OptInt {
return s.GameLv
}
// GetCoin returns the value of Coin.
func (s *UserCreate) GetCoin() OptInt {
return s.Coin
}
// GetCoinOpen returns the value of CoinOpen.
func (s *UserCreate) GetCoinOpen() OptBool {
return s.CoinOpen
}
// GetCoinAt returns the value of CoinAt.
func (s *UserCreate) GetCoinAt() OptDateTime {
return s.CoinAt
}
// SetID sets the value of ID.
func (s *UserCreate) SetID(val int) {
s.ID = val
@ -5741,6 +5924,21 @@ func (s *UserCreate) SetGameLv(val OptInt) {
s.GameLv = val
}
// SetCoin sets the value of Coin.
func (s *UserCreate) SetCoin(val OptInt) {
s.Coin = val
}
// SetCoinOpen sets the value of CoinOpen.
func (s *UserCreate) SetCoinOpen(val OptBool) {
s.CoinOpen = val
}
// SetCoinAt sets the value of CoinAt.
func (s *UserCreate) SetCoinAt(val OptDateTime) {
s.CoinAt = val
}
func (*UserCreate) createUserRes() {}
// Ref: #/components/schemas/UserList
@ -5791,6 +5989,9 @@ type UserList struct {
GameEnd OptBool `json:"game_end"`
GameAccount OptBool `json:"game_account"`
GameLv OptInt `json:"game_lv"`
Coin OptInt `json:"coin"`
CoinOpen OptBool `json:"coin_open"`
CoinAt OptDateTime `json:"coin_at"`
}
// GetID returns the value of ID.
@ -6023,6 +6224,21 @@ func (s *UserList) GetGameLv() OptInt {
return s.GameLv
}
// GetCoin returns the value of Coin.
func (s *UserList) GetCoin() OptInt {
return s.Coin
}
// GetCoinOpen returns the value of CoinOpen.
func (s *UserList) GetCoinOpen() OptBool {
return s.CoinOpen
}
// GetCoinAt returns the value of CoinAt.
func (s *UserList) GetCoinAt() OptDateTime {
return s.CoinAt
}
// SetID sets the value of ID.
func (s *UserList) SetID(val int) {
s.ID = val
@ -6253,6 +6469,21 @@ func (s *UserList) SetGameLv(val OptInt) {
s.GameLv = val
}
// SetCoin sets the value of Coin.
func (s *UserList) SetCoin(val OptInt) {
s.Coin = val
}
// SetCoinOpen sets the value of CoinOpen.
func (s *UserList) SetCoinOpen(val OptBool) {
s.CoinOpen = val
}
// SetCoinAt sets the value of CoinAt.
func (s *UserList) SetCoinAt(val OptDateTime) {
s.CoinAt = val
}
// Ref: #/components/schemas/UserRead
type UserRead struct {
ID int `json:"id"`
@ -6301,6 +6532,9 @@ type UserRead struct {
GameEnd OptBool `json:"game_end"`
GameAccount OptBool `json:"game_account"`
GameLv OptInt `json:"game_lv"`
Coin OptInt `json:"coin"`
CoinOpen OptBool `json:"coin_open"`
CoinAt OptDateTime `json:"coin_at"`
}
// GetID returns the value of ID.
@ -6533,6 +6767,21 @@ func (s *UserRead) GetGameLv() OptInt {
return s.GameLv
}
// GetCoin returns the value of Coin.
func (s *UserRead) GetCoin() OptInt {
return s.Coin
}
// GetCoinOpen returns the value of CoinOpen.
func (s *UserRead) GetCoinOpen() OptBool {
return s.CoinOpen
}
// GetCoinAt returns the value of CoinAt.
func (s *UserRead) GetCoinAt() OptDateTime {
return s.CoinAt
}
// SetID sets the value of ID.
func (s *UserRead) SetID(val int) {
s.ID = val
@ -6763,6 +7012,21 @@ func (s *UserRead) SetGameLv(val OptInt) {
s.GameLv = val
}
// SetCoin sets the value of Coin.
func (s *UserRead) SetCoin(val OptInt) {
s.Coin = val
}
// SetCoinOpen sets the value of CoinOpen.
func (s *UserRead) SetCoinOpen(val OptBool) {
s.CoinOpen = val
}
// SetCoinAt sets the value of CoinAt.
func (s *UserRead) SetCoinAt(val OptDateTime) {
s.CoinAt = val
}
func (*UserRead) readUserRes() {}
// Ref: #/components/schemas/User_UeList
@ -7015,6 +7279,9 @@ type UserUpdate struct {
GameEnd OptBool `json:"game_end"`
GameAccount OptBool `json:"game_account"`
GameLv OptInt `json:"game_lv"`
Coin OptInt `json:"coin"`
CoinOpen OptBool `json:"coin_open"`
CoinAt OptDateTime `json:"coin_at"`
}
// GetID returns the value of ID.
@ -7247,6 +7514,21 @@ func (s *UserUpdate) GetGameLv() OptInt {
return s.GameLv
}
// GetCoin returns the value of Coin.
func (s *UserUpdate) GetCoin() OptInt {
return s.Coin
}
// GetCoinOpen returns the value of CoinOpen.
func (s *UserUpdate) GetCoinOpen() OptBool {
return s.CoinOpen
}
// GetCoinAt returns the value of CoinAt.
func (s *UserUpdate) GetCoinAt() OptDateTime {
return s.CoinAt
}
// SetID sets the value of ID.
func (s *UserUpdate) SetID(val int) {
s.ID = val
@ -7477,4 +7759,19 @@ func (s *UserUpdate) SetGameLv(val OptInt) {
s.GameLv = val
}
// SetCoin sets the value of Coin.
func (s *UserUpdate) SetCoin(val OptInt) {
s.Coin = val
}
// SetCoinOpen sets the value of CoinOpen.
func (s *UserUpdate) SetCoinOpen(val OptBool) {
s.CoinOpen = val
}
// SetCoinAt sets the value of CoinAt.
func (s *UserUpdate) SetCoinAt(val OptDateTime) {
s.CoinAt = val
}
func (*UserUpdate) updateUserRes() {}

View File

@ -939,6 +939,15 @@ func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (Crea
if v, ok := req.GameLv.Get(); ok {
b.SetGameLv(v)
}
if v, ok := req.Coin.Get(); ok {
b.SetCoin(v)
}
if v, ok := req.CoinOpen.Get(); ok {
b.SetCoinOpen(v)
}
if v, ok := req.CoinAt.Get(); ok {
b.SetCoinAt(v)
}
// Add all fields.
//b.SetUsername(req.Username)
@ -1142,6 +1151,15 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
if v, ok := req.GameLv.Get(); ok {
b.SetGameLv(v)
}
if v, ok := req.Coin.Get(); ok {
b.SetCoin(v)
}
if v, ok := req.CoinOpen.Get(); ok {
b.SetCoinOpen(v)
}
if v, ok := req.CoinAt.Get(); ok {
b.SetCoinAt(v)
}
// Add all edges.
if req.Card != nil {
b.ClearCard().AddCardIDs(req.Card...)

View File

@ -195,6 +195,9 @@ func NewCardOwnerRead(e *ent.User) *CardOwnerRead {
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
ret.Coin = NewOptInt(e.Coin)
ret.CoinOpen = NewOptBool(e.CoinOpen)
ret.CoinAt = NewOptDateTime(e.CoinAt)
return &ret
}
@ -379,6 +382,9 @@ func NewGroupUsersList(e *ent.User) *GroupUsersList {
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
ret.Coin = NewOptInt(e.Coin)
ret.CoinOpen = NewOptBool(e.CoinOpen)
ret.CoinAt = NewOptDateTime(e.CoinAt)
return &ret
}
@ -627,6 +633,9 @@ func NewUeOwnerRead(e *ent.User) *UeOwnerRead {
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
ret.Coin = NewOptInt(e.Coin)
ret.CoinOpen = NewOptBool(e.CoinOpen)
ret.CoinAt = NewOptDateTime(e.CoinAt)
return &ret
}
@ -699,6 +708,9 @@ func NewUserCreate(e *ent.User) *UserCreate {
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
ret.Coin = NewOptInt(e.Coin)
ret.CoinOpen = NewOptBool(e.CoinOpen)
ret.CoinAt = NewOptDateTime(e.CoinAt)
return &ret
}
@ -771,6 +783,9 @@ func NewUserList(e *ent.User) *UserList {
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
ret.Coin = NewOptInt(e.Coin)
ret.CoinOpen = NewOptBool(e.CoinOpen)
ret.CoinAt = NewOptDateTime(e.CoinAt)
return &ret
}
@ -843,6 +858,9 @@ func NewUserRead(e *ent.User) *UserRead {
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
ret.Coin = NewOptInt(e.Coin)
ret.CoinOpen = NewOptBool(e.CoinOpen)
ret.CoinAt = NewOptDateTime(e.CoinAt)
return &ret
}
@ -915,6 +933,9 @@ func NewUserUpdate(e *ent.User) *UserUpdate {
ret.GameEnd = NewOptBool(e.GameEnd)
ret.GameAccount = NewOptBool(e.GameAccount)
ret.GameLv = NewOptInt(e.GameLv)
ret.Coin = NewOptInt(e.Coin)
ret.CoinOpen = NewOptBool(e.CoinOpen)
ret.CoinAt = NewOptDateTime(e.CoinAt)
return &ret
}

View File

@ -1326,6 +1326,16 @@
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
},
"card": {
"type": "array",
"items": {
@ -1616,6 +1626,16 @@
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
},
"card": {
"type": "array",
"items": {
@ -2156,6 +2176,16 @@
},
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
@ -2397,6 +2427,16 @@
},
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
@ -2879,6 +2919,16 @@
},
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
@ -3042,6 +3092,16 @@
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
},
"card": {
"type": "array",
"items": {
@ -3210,6 +3270,16 @@
},
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
@ -3366,6 +3436,16 @@
},
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
@ -3522,6 +3602,16 @@
},
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
@ -3678,6 +3768,16 @@
},
"game_lv": {
"type": "integer"
},
"coin": {
"type": "integer"
},
"coin_open": {
"type": "boolean"
},
"coin_at": {
"type": "string",
"format": "date-time"
}
},
"required": [

View File

@ -185,4 +185,12 @@ func init() {
userDescGameAccount := userFields[45].Descriptor()
// user.DefaultGameAccount holds the default value on creation for the game_account field.
user.DefaultGameAccount = userDescGameAccount.Default.(bool)
// userDescCoinOpen is the schema descriptor for coin_open field.
userDescCoinOpen := userFields[48].Descriptor()
// user.DefaultCoinOpen holds the default value on creation for the coin_open field.
user.DefaultCoinOpen = userDescCoinOpen.Default.(bool)
// userDescCoinAt is the schema descriptor for coin_at field.
userDescCoinAt := userFields[49].Descriptor()
// user.DefaultCoinAt holds the default value on creation for the coin_at field.
user.DefaultCoinAt = userDescCoinAt.Default.(func() time.Time)
}

View File

@ -217,6 +217,20 @@ func (User) Fields() []ent.Field {
field.Int("game_lv").
Optional(),
field.Int("coin").
Optional(),
field.Bool("coin_open").
Default(false).
Optional(),
field.Time("coin_at").
Optional().
Default(func() time.Time {
return time.Now().In(jst)
}),
}
}

View File

@ -110,6 +110,12 @@ type User struct {
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"`
@ -150,13 +156,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, user.FieldModel, user.FieldGame, user.FieldGameTest, user.FieldGameEnd, user.FieldGameAccount:
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:
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:
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)
@ -463,6 +469,24 @@ func (u *User) assignValues(columns []string, values []any) error {
} 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)
@ -646,6 +670,15 @@ func (u *User) String() string {
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()
}

View File

@ -105,6 +105,12 @@ const (
FieldGameAccount = "game_account"
// FieldGameLv holds the string denoting the game_lv field in the database.
FieldGameLv = "game_lv"
// FieldCoin holds the string denoting the coin field in the database.
FieldCoin = "coin"
// FieldCoinOpen holds the string denoting the coin_open field in the database.
FieldCoinOpen = "coin_open"
// FieldCoinAt holds the string denoting the coin_at field in the database.
FieldCoinAt = "coin_at"
// EdgeCard holds the string denoting the card edge name in mutations.
EdgeCard = "card"
// EdgeUe holds the string denoting the ue edge name in mutations.
@ -177,6 +183,9 @@ var Columns = []string{
FieldGameEnd,
FieldGameAccount,
FieldGameLv,
FieldCoin,
FieldCoinOpen,
FieldCoinAt,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "users"
@ -249,4 +258,8 @@ var (
DefaultGameEnd bool
// DefaultGameAccount holds the default value on creation for the "game_account" field.
DefaultGameAccount bool
// DefaultCoinOpen holds the default value on creation for the "coin_open" field.
DefaultCoinOpen bool
// DefaultCoinAt holds the default value on creation for the "coin_at" field.
DefaultCoinAt func() time.Time
)

View File

@ -290,6 +290,21 @@ func GameLv(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldGameLv, v))
}
// Coin applies equality check predicate on the "coin" field. It's identical to CoinEQ.
func Coin(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldCoin, v))
}
// CoinOpen applies equality check predicate on the "coin_open" field. It's identical to CoinOpenEQ.
func CoinOpen(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldCoinOpen, v))
}
// CoinAt applies equality check predicate on the "coin_at" field. It's identical to CoinAtEQ.
func CoinAt(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldCoinAt, v))
}
// UsernameEQ applies the EQ predicate on the "username" field.
func UsernameEQ(v string) predicate.User {
return predicate.User(sql.FieldEQ(FieldUsername, v))
@ -2425,6 +2440,126 @@ func GameLvNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldGameLv))
}
// CoinEQ applies the EQ predicate on the "coin" field.
func CoinEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldCoin, v))
}
// CoinNEQ applies the NEQ predicate on the "coin" field.
func CoinNEQ(v int) predicate.User {
return predicate.User(sql.FieldNEQ(FieldCoin, v))
}
// CoinIn applies the In predicate on the "coin" field.
func CoinIn(vs ...int) predicate.User {
return predicate.User(sql.FieldIn(FieldCoin, vs...))
}
// CoinNotIn applies the NotIn predicate on the "coin" field.
func CoinNotIn(vs ...int) predicate.User {
return predicate.User(sql.FieldNotIn(FieldCoin, vs...))
}
// CoinGT applies the GT predicate on the "coin" field.
func CoinGT(v int) predicate.User {
return predicate.User(sql.FieldGT(FieldCoin, v))
}
// CoinGTE applies the GTE predicate on the "coin" field.
func CoinGTE(v int) predicate.User {
return predicate.User(sql.FieldGTE(FieldCoin, v))
}
// CoinLT applies the LT predicate on the "coin" field.
func CoinLT(v int) predicate.User {
return predicate.User(sql.FieldLT(FieldCoin, v))
}
// CoinLTE applies the LTE predicate on the "coin" field.
func CoinLTE(v int) predicate.User {
return predicate.User(sql.FieldLTE(FieldCoin, v))
}
// CoinIsNil applies the IsNil predicate on the "coin" field.
func CoinIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldCoin))
}
// CoinNotNil applies the NotNil predicate on the "coin" field.
func CoinNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldCoin))
}
// CoinOpenEQ applies the EQ predicate on the "coin_open" field.
func CoinOpenEQ(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldCoinOpen, v))
}
// CoinOpenNEQ applies the NEQ predicate on the "coin_open" field.
func CoinOpenNEQ(v bool) predicate.User {
return predicate.User(sql.FieldNEQ(FieldCoinOpen, v))
}
// CoinOpenIsNil applies the IsNil predicate on the "coin_open" field.
func CoinOpenIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldCoinOpen))
}
// CoinOpenNotNil applies the NotNil predicate on the "coin_open" field.
func CoinOpenNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldCoinOpen))
}
// CoinAtEQ applies the EQ predicate on the "coin_at" field.
func CoinAtEQ(v time.Time) predicate.User {
return predicate.User(sql.FieldEQ(FieldCoinAt, v))
}
// CoinAtNEQ applies the NEQ predicate on the "coin_at" field.
func CoinAtNEQ(v time.Time) predicate.User {
return predicate.User(sql.FieldNEQ(FieldCoinAt, v))
}
// CoinAtIn applies the In predicate on the "coin_at" field.
func CoinAtIn(vs ...time.Time) predicate.User {
return predicate.User(sql.FieldIn(FieldCoinAt, vs...))
}
// CoinAtNotIn applies the NotIn predicate on the "coin_at" field.
func CoinAtNotIn(vs ...time.Time) predicate.User {
return predicate.User(sql.FieldNotIn(FieldCoinAt, vs...))
}
// CoinAtGT applies the GT predicate on the "coin_at" field.
func CoinAtGT(v time.Time) predicate.User {
return predicate.User(sql.FieldGT(FieldCoinAt, v))
}
// CoinAtGTE applies the GTE predicate on the "coin_at" field.
func CoinAtGTE(v time.Time) predicate.User {
return predicate.User(sql.FieldGTE(FieldCoinAt, v))
}
// CoinAtLT applies the LT predicate on the "coin_at" field.
func CoinAtLT(v time.Time) predicate.User {
return predicate.User(sql.FieldLT(FieldCoinAt, v))
}
// CoinAtLTE applies the LTE predicate on the "coin_at" field.
func CoinAtLTE(v time.Time) predicate.User {
return predicate.User(sql.FieldLTE(FieldCoinAt, v))
}
// CoinAtIsNil applies the IsNil predicate on the "coin_at" field.
func CoinAtIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldCoinAt))
}
// CoinAtNotNil applies the NotNil predicate on the "coin_at" field.
func CoinAtNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldCoinAt))
}
// HasCard applies the HasEdge predicate on the "card" edge.
func HasCard() predicate.User {
return predicate.User(func(s *sql.Selector) {

View File

@ -664,6 +664,48 @@ func (uc *UserCreate) SetNillableGameLv(i *int) *UserCreate {
return uc
}
// SetCoin sets the "coin" field.
func (uc *UserCreate) SetCoin(i int) *UserCreate {
uc.mutation.SetCoin(i)
return uc
}
// SetNillableCoin sets the "coin" field if the given value is not nil.
func (uc *UserCreate) SetNillableCoin(i *int) *UserCreate {
if i != nil {
uc.SetCoin(*i)
}
return uc
}
// SetCoinOpen sets the "coin_open" field.
func (uc *UserCreate) SetCoinOpen(b bool) *UserCreate {
uc.mutation.SetCoinOpen(b)
return uc
}
// SetNillableCoinOpen sets the "coin_open" field if the given value is not nil.
func (uc *UserCreate) SetNillableCoinOpen(b *bool) *UserCreate {
if b != nil {
uc.SetCoinOpen(*b)
}
return uc
}
// SetCoinAt sets the "coin_at" field.
func (uc *UserCreate) SetCoinAt(t time.Time) *UserCreate {
uc.mutation.SetCoinAt(t)
return uc
}
// SetNillableCoinAt sets the "coin_at" field if the given value is not nil.
func (uc *UserCreate) SetNillableCoinAt(t *time.Time) *UserCreate {
if t != nil {
uc.SetCoinAt(*t)
}
return uc
}
// AddCardIDs adds the "card" edge to the Card entity by IDs.
func (uc *UserCreate) AddCardIDs(ids ...int) *UserCreate {
uc.mutation.AddCardIDs(ids...)
@ -817,6 +859,14 @@ func (uc *UserCreate) defaults() {
v := user.DefaultGameAccount
uc.mutation.SetGameAccount(v)
}
if _, ok := uc.mutation.CoinOpen(); !ok {
v := user.DefaultCoinOpen
uc.mutation.SetCoinOpen(v)
}
if _, ok := uc.mutation.CoinAt(); !ok {
v := user.DefaultCoinAt()
uc.mutation.SetCoinAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
@ -1051,6 +1101,18 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
_spec.SetField(user.FieldGameLv, field.TypeInt, value)
_node.GameLv = value
}
if value, ok := uc.mutation.Coin(); ok {
_spec.SetField(user.FieldCoin, field.TypeInt, value)
_node.Coin = value
}
if value, ok := uc.mutation.CoinOpen(); ok {
_spec.SetField(user.FieldCoinOpen, field.TypeBool, value)
_node.CoinOpen = value
}
if value, ok := uc.mutation.CoinAt(); ok {
_spec.SetField(user.FieldCoinAt, field.TypeTime, value)
_node.CoinAt = value
}
if nodes := uc.mutation.CardIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,

View File

@ -1015,6 +1015,73 @@ func (uu *UserUpdate) ClearGameLv() *UserUpdate {
return uu
}
// SetCoin sets the "coin" field.
func (uu *UserUpdate) SetCoin(i int) *UserUpdate {
uu.mutation.ResetCoin()
uu.mutation.SetCoin(i)
return uu
}
// SetNillableCoin sets the "coin" field if the given value is not nil.
func (uu *UserUpdate) SetNillableCoin(i *int) *UserUpdate {
if i != nil {
uu.SetCoin(*i)
}
return uu
}
// AddCoin adds i to the "coin" field.
func (uu *UserUpdate) AddCoin(i int) *UserUpdate {
uu.mutation.AddCoin(i)
return uu
}
// ClearCoin clears the value of the "coin" field.
func (uu *UserUpdate) ClearCoin() *UserUpdate {
uu.mutation.ClearCoin()
return uu
}
// SetCoinOpen sets the "coin_open" field.
func (uu *UserUpdate) SetCoinOpen(b bool) *UserUpdate {
uu.mutation.SetCoinOpen(b)
return uu
}
// SetNillableCoinOpen sets the "coin_open" field if the given value is not nil.
func (uu *UserUpdate) SetNillableCoinOpen(b *bool) *UserUpdate {
if b != nil {
uu.SetCoinOpen(*b)
}
return uu
}
// ClearCoinOpen clears the value of the "coin_open" field.
func (uu *UserUpdate) ClearCoinOpen() *UserUpdate {
uu.mutation.ClearCoinOpen()
return uu
}
// SetCoinAt sets the "coin_at" field.
func (uu *UserUpdate) SetCoinAt(t time.Time) *UserUpdate {
uu.mutation.SetCoinAt(t)
return uu
}
// SetNillableCoinAt sets the "coin_at" field if the given value is not nil.
func (uu *UserUpdate) SetNillableCoinAt(t *time.Time) *UserUpdate {
if t != nil {
uu.SetCoinAt(*t)
}
return uu
}
// ClearCoinAt clears the value of the "coin_at" field.
func (uu *UserUpdate) ClearCoinAt() *UserUpdate {
uu.mutation.ClearCoinAt()
return uu
}
// AddCardIDs adds the "card" edge to the Card entity by IDs.
func (uu *UserUpdate) AddCardIDs(ids ...int) *UserUpdate {
uu.mutation.AddCardIDs(ids...)
@ -1440,6 +1507,27 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
if uu.mutation.GameLvCleared() {
_spec.ClearField(user.FieldGameLv, field.TypeInt)
}
if value, ok := uu.mutation.Coin(); ok {
_spec.SetField(user.FieldCoin, field.TypeInt, value)
}
if value, ok := uu.mutation.AddedCoin(); ok {
_spec.AddField(user.FieldCoin, field.TypeInt, value)
}
if uu.mutation.CoinCleared() {
_spec.ClearField(user.FieldCoin, field.TypeInt)
}
if value, ok := uu.mutation.CoinOpen(); ok {
_spec.SetField(user.FieldCoinOpen, field.TypeBool, value)
}
if uu.mutation.CoinOpenCleared() {
_spec.ClearField(user.FieldCoinOpen, field.TypeBool)
}
if value, ok := uu.mutation.CoinAt(); ok {
_spec.SetField(user.FieldCoinAt, field.TypeTime, value)
}
if uu.mutation.CoinAtCleared() {
_spec.ClearField(user.FieldCoinAt, field.TypeTime)
}
if uu.mutation.CardCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
@ -2535,6 +2623,73 @@ func (uuo *UserUpdateOne) ClearGameLv() *UserUpdateOne {
return uuo
}
// SetCoin sets the "coin" field.
func (uuo *UserUpdateOne) SetCoin(i int) *UserUpdateOne {
uuo.mutation.ResetCoin()
uuo.mutation.SetCoin(i)
return uuo
}
// SetNillableCoin sets the "coin" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableCoin(i *int) *UserUpdateOne {
if i != nil {
uuo.SetCoin(*i)
}
return uuo
}
// AddCoin adds i to the "coin" field.
func (uuo *UserUpdateOne) AddCoin(i int) *UserUpdateOne {
uuo.mutation.AddCoin(i)
return uuo
}
// ClearCoin clears the value of the "coin" field.
func (uuo *UserUpdateOne) ClearCoin() *UserUpdateOne {
uuo.mutation.ClearCoin()
return uuo
}
// SetCoinOpen sets the "coin_open" field.
func (uuo *UserUpdateOne) SetCoinOpen(b bool) *UserUpdateOne {
uuo.mutation.SetCoinOpen(b)
return uuo
}
// SetNillableCoinOpen sets the "coin_open" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableCoinOpen(b *bool) *UserUpdateOne {
if b != nil {
uuo.SetCoinOpen(*b)
}
return uuo
}
// ClearCoinOpen clears the value of the "coin_open" field.
func (uuo *UserUpdateOne) ClearCoinOpen() *UserUpdateOne {
uuo.mutation.ClearCoinOpen()
return uuo
}
// SetCoinAt sets the "coin_at" field.
func (uuo *UserUpdateOne) SetCoinAt(t time.Time) *UserUpdateOne {
uuo.mutation.SetCoinAt(t)
return uuo
}
// SetNillableCoinAt sets the "coin_at" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableCoinAt(t *time.Time) *UserUpdateOne {
if t != nil {
uuo.SetCoinAt(*t)
}
return uuo
}
// ClearCoinAt clears the value of the "coin_at" field.
func (uuo *UserUpdateOne) ClearCoinAt() *UserUpdateOne {
uuo.mutation.ClearCoinAt()
return uuo
}
// AddCardIDs adds the "card" edge to the Card entity by IDs.
func (uuo *UserUpdateOne) AddCardIDs(ids ...int) *UserUpdateOne {
uuo.mutation.AddCardIDs(ids...)
@ -2990,6 +3145,27 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
if uuo.mutation.GameLvCleared() {
_spec.ClearField(user.FieldGameLv, field.TypeInt)
}
if value, ok := uuo.mutation.Coin(); ok {
_spec.SetField(user.FieldCoin, field.TypeInt, value)
}
if value, ok := uuo.mutation.AddedCoin(); ok {
_spec.AddField(user.FieldCoin, field.TypeInt, value)
}
if uuo.mutation.CoinCleared() {
_spec.ClearField(user.FieldCoin, field.TypeInt)
}
if value, ok := uuo.mutation.CoinOpen(); ok {
_spec.SetField(user.FieldCoinOpen, field.TypeBool, value)
}
if uuo.mutation.CoinOpenCleared() {
_spec.ClearField(user.FieldCoinOpen, field.TypeBool)
}
if value, ok := uuo.mutation.CoinAt(); ok {
_spec.SetField(user.FieldCoinAt, field.TypeTime, value)
}
if uuo.mutation.CoinAtCleared() {
_spec.ClearField(user.FieldCoinAt, field.TypeTime)
}
if uuo.mutation.CardCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -939,6 +939,15 @@ func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (Crea
if v, ok := req.GameLv.Get(); ok {
b.SetGameLv(v)
}
if v, ok := req.Coin.Get(); ok {
b.SetCoin(v)
}
if v, ok := req.CoinOpen.Get(); ok {
b.SetCoinOpen(v)
}
if v, ok := req.CoinAt.Get(); ok {
b.SetCoinAt(v)
}
// Add all fields.
//b.SetUsername(req.Username)
@ -1142,6 +1151,15 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
if v, ok := req.GameLv.Get(); ok {
b.SetGameLv(v)
}
if v, ok := req.Coin.Get(); ok {
b.SetCoin(v)
}
if v, ok := req.CoinOpen.Get(); ok {
b.SetCoinOpen(v)
}
if v, ok := req.CoinAt.Get(); ok {
b.SetCoinAt(v)
}
// Add all edges.
if req.Card != nil {
b.ClearCard().AddCardIDs(req.Card...)