From e047575364b25d0c4157f5ab10b04e7513ccd2f0 Mon Sep 17 00:00:00 2001 From: syui Date: Sat, 1 Jun 2024 23:35:34 +0900 Subject: [PATCH] fix ue integer float r error --- ent/migrate/schema.go | 7 +- ent/mutation.go | 221 +++++++++++++++++++- ent/ogent/oas_json_gen.go | 391 +++++++++++++++++++++++++++++++++-- ent/ogent/oas_schemas_gen.go | 231 +++++++++++++++++++++ ent/ogent/ogent.go | 19 ++ ent/ogent/responses.go | 15 ++ ent/openapi.json | 72 +++++++ ent/runtime.go | 2 +- ent/schema/ue.go | 9 + ent/ue.go | 35 +++- ent/ue/ue.go | 24 +++ ent/ue/where.go | 240 +++++++++++++++++++++ ent/ue_create.go | 54 +++++ ent/ue_update.go | 156 ++++++++++++++ tmp/ogent/ogent.go | 19 ++ 15 files changed, 1473 insertions(+), 22 deletions(-) diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index c30a590..7254f88 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -150,6 +150,9 @@ var ( {Name: "location_z", Type: field.TypeInt, Nullable: true}, {Name: "location_n", Type: field.TypeInt, Nullable: true}, {Name: "author", Type: field.TypeString, Nullable: true}, + {Name: "game_lv", Type: field.TypeString, Nullable: true}, + {Name: "game_exp", Type: field.TypeString, Nullable: true}, + {Name: "game_id", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "user_ue", Type: field.TypeInt}, } @@ -161,7 +164,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "ues_users_ue", - Columns: []*schema.Column{UesColumns[20]}, + Columns: []*schema.Column{UesColumns[23]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.NoAction, }, @@ -202,7 +205,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: "20240516"}, + {Name: "next", Type: field.TypeString, Nullable: true, Default: "20240531"}, {Name: "room", Type: field.TypeInt, Nullable: true}, {Name: "model", Type: field.TypeBool, Nullable: true}, {Name: "model_at", Type: field.TypeTime, Nullable: true}, diff --git a/ent/mutation.go b/ent/mutation.go index 9159404..ff1ea21 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -5114,6 +5114,9 @@ type UeMutation struct { location_n *int addlocation_n *int author *string + game_lv *string + game_exp *string + game_id *string created_at *time.Time clearedFields map[string]struct{} owner *int @@ -6321,6 +6324,153 @@ func (m *UeMutation) ResetAuthor() { delete(m.clearedFields, ue.FieldAuthor) } +// SetGameLv sets the "game_lv" field. +func (m *UeMutation) SetGameLv(s string) { + m.game_lv = &s +} + +// GameLv returns the value of the "game_lv" field in the mutation. +func (m *UeMutation) GameLv() (r string, exists bool) { + v := m.game_lv + if v == nil { + return + } + return *v, true +} + +// OldGameLv returns the old "game_lv" field's value of the Ue entity. +// If the Ue 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 *UeMutation) OldGameLv(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldGameLv is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldGameLv requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldGameLv: %w", err) + } + return oldValue.GameLv, nil +} + +// ClearGameLv clears the value of the "game_lv" field. +func (m *UeMutation) ClearGameLv() { + m.game_lv = nil + m.clearedFields[ue.FieldGameLv] = struct{}{} +} + +// GameLvCleared returns if the "game_lv" field was cleared in this mutation. +func (m *UeMutation) GameLvCleared() bool { + _, ok := m.clearedFields[ue.FieldGameLv] + return ok +} + +// ResetGameLv resets all changes to the "game_lv" field. +func (m *UeMutation) ResetGameLv() { + m.game_lv = nil + delete(m.clearedFields, ue.FieldGameLv) +} + +// SetGameExp sets the "game_exp" field. +func (m *UeMutation) SetGameExp(s string) { + m.game_exp = &s +} + +// GameExp returns the value of the "game_exp" field in the mutation. +func (m *UeMutation) GameExp() (r string, exists bool) { + v := m.game_exp + if v == nil { + return + } + return *v, true +} + +// OldGameExp returns the old "game_exp" field's value of the Ue entity. +// If the Ue 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 *UeMutation) OldGameExp(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldGameExp is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldGameExp requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldGameExp: %w", err) + } + return oldValue.GameExp, nil +} + +// ClearGameExp clears the value of the "game_exp" field. +func (m *UeMutation) ClearGameExp() { + m.game_exp = nil + m.clearedFields[ue.FieldGameExp] = struct{}{} +} + +// GameExpCleared returns if the "game_exp" field was cleared in this mutation. +func (m *UeMutation) GameExpCleared() bool { + _, ok := m.clearedFields[ue.FieldGameExp] + return ok +} + +// ResetGameExp resets all changes to the "game_exp" field. +func (m *UeMutation) ResetGameExp() { + m.game_exp = nil + delete(m.clearedFields, ue.FieldGameExp) +} + +// SetGameID sets the "game_id" field. +func (m *UeMutation) SetGameID(s string) { + m.game_id = &s +} + +// GameID returns the value of the "game_id" field in the mutation. +func (m *UeMutation) GameID() (r string, exists bool) { + v := m.game_id + if v == nil { + return + } + return *v, true +} + +// OldGameID returns the old "game_id" field's value of the Ue entity. +// If the Ue 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 *UeMutation) OldGameID(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldGameID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldGameID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldGameID: %w", err) + } + return oldValue.GameID, nil +} + +// ClearGameID clears the value of the "game_id" field. +func (m *UeMutation) ClearGameID() { + m.game_id = nil + m.clearedFields[ue.FieldGameID] = struct{}{} +} + +// GameIDCleared returns if the "game_id" field was cleared in this mutation. +func (m *UeMutation) GameIDCleared() bool { + _, ok := m.clearedFields[ue.FieldGameID] + return ok +} + +// ResetGameID resets all changes to the "game_id" field. +func (m *UeMutation) ResetGameID() { + m.game_id = nil + delete(m.clearedFields, ue.FieldGameID) +} + // SetCreatedAt sets the "created_at" field. func (m *UeMutation) SetCreatedAt(t time.Time) { m.created_at = &t @@ -6443,7 +6593,7 @@ func (m *UeMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *UeMutation) Fields() []string { - fields := make([]string, 0, 19) + fields := make([]string, 0, 22) if m._limit != nil { fields = append(fields, ue.FieldLimit) } @@ -6498,6 +6648,15 @@ func (m *UeMutation) Fields() []string { if m.author != nil { fields = append(fields, ue.FieldAuthor) } + if m.game_lv != nil { + fields = append(fields, ue.FieldGameLv) + } + if m.game_exp != nil { + fields = append(fields, ue.FieldGameExp) + } + if m.game_id != nil { + fields = append(fields, ue.FieldGameID) + } if m.created_at != nil { fields = append(fields, ue.FieldCreatedAt) } @@ -6545,6 +6704,12 @@ func (m *UeMutation) Field(name string) (ent.Value, bool) { return m.LocationN() case ue.FieldAuthor: return m.Author() + case ue.FieldGameLv: + return m.GameLv() + case ue.FieldGameExp: + return m.GameExp() + case ue.FieldGameID: + return m.GameID() case ue.FieldCreatedAt: return m.CreatedAt() } @@ -6592,6 +6757,12 @@ func (m *UeMutation) OldField(ctx context.Context, name string) (ent.Value, erro return m.OldLocationN(ctx) case ue.FieldAuthor: return m.OldAuthor(ctx) + case ue.FieldGameLv: + return m.OldGameLv(ctx) + case ue.FieldGameExp: + return m.OldGameExp(ctx) + case ue.FieldGameID: + return m.OldGameID(ctx) case ue.FieldCreatedAt: return m.OldCreatedAt(ctx) } @@ -6729,6 +6900,27 @@ func (m *UeMutation) SetField(name string, value ent.Value) error { } m.SetAuthor(v) return nil + case ue.FieldGameLv: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetGameLv(v) + return nil + case ue.FieldGameExp: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetGameExp(v) + return nil + case ue.FieldGameID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetGameID(v) + return nil case ue.FieldCreatedAt: v, ok := value.(time.Time) if !ok { @@ -6952,6 +7144,15 @@ func (m *UeMutation) ClearedFields() []string { if m.FieldCleared(ue.FieldAuthor) { fields = append(fields, ue.FieldAuthor) } + if m.FieldCleared(ue.FieldGameLv) { + fields = append(fields, ue.FieldGameLv) + } + if m.FieldCleared(ue.FieldGameExp) { + fields = append(fields, ue.FieldGameExp) + } + if m.FieldCleared(ue.FieldGameID) { + fields = append(fields, ue.FieldGameID) + } if m.FieldCleared(ue.FieldCreatedAt) { fields = append(fields, ue.FieldCreatedAt) } @@ -7020,6 +7221,15 @@ func (m *UeMutation) ClearField(name string) error { case ue.FieldAuthor: m.ClearAuthor() return nil + case ue.FieldGameLv: + m.ClearGameLv() + return nil + case ue.FieldGameExp: + m.ClearGameExp() + return nil + case ue.FieldGameID: + m.ClearGameID() + return nil case ue.FieldCreatedAt: m.ClearCreatedAt() return nil @@ -7085,6 +7295,15 @@ func (m *UeMutation) ResetField(name string) error { case ue.FieldAuthor: m.ResetAuthor() return nil + case ue.FieldGameLv: + m.ResetGameLv() + return nil + case ue.FieldGameExp: + m.ResetGameExp() + return nil + case ue.FieldGameID: + m.ResetGameID() + return nil case ue.FieldCreatedAt: m.ResetCreatedAt() return nil diff --git a/ent/ogent/oas_json_gen.go b/ent/ogent/oas_json_gen.go index 083652b..9fe4d9a 100644 --- a/ent/ogent/oas_json_gen.go +++ b/ent/ogent/oas_json_gen.go @@ -3194,6 +3194,24 @@ func (s *CreateUeReq) encodeFields(e *jx.Encoder) { s.Author.Encode(e) } } + { + if s.GameLv.Set { + e.FieldStart("game_lv") + s.GameLv.Encode(e) + } + } + { + if s.GameExp.Set { + e.FieldStart("game_exp") + s.GameExp.Encode(e) + } + } + { + if s.GameID.Set { + e.FieldStart("game_id") + s.GameID.Encode(e) + } + } { if s.CreatedAt.Set { e.FieldStart("created_at") @@ -3207,7 +3225,7 @@ func (s *CreateUeReq) encodeFields(e *jx.Encoder) { } } -var jsonFieldsNameOfCreateUeReq = [20]string{ +var jsonFieldsNameOfCreateUeReq = [23]string{ 0: "limit", 1: "limit_boss", 2: "limit_item", @@ -3226,8 +3244,11 @@ var jsonFieldsNameOfCreateUeReq = [20]string{ 15: "location_z", 16: "location_n", 17: "author", - 18: "created_at", - 19: "owner", + 18: "game_lv", + 19: "game_exp", + 20: "game_id", + 21: "created_at", + 22: "owner", } // Decode decodes CreateUeReq from json. @@ -3421,6 +3442,36 @@ func (s *CreateUeReq) Decode(d *jx.Decoder) error { }(); err != nil { return errors.Wrap(err, "decode field \"author\"") } + case "game_lv": + if err := func() error { + s.GameLv.Reset() + if err := s.GameLv.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_lv\"") + } + case "game_exp": + if err := func() error { + s.GameExp.Reset() + if err := s.GameExp.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_exp\"") + } + case "game_id": + if err := func() error { + s.GameID.Reset() + if err := s.GameID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_id\"") + } case "created_at": if err := func() error { s.CreatedAt.Reset() @@ -3432,7 +3483,7 @@ func (s *CreateUeReq) Decode(d *jx.Decoder) error { return errors.Wrap(err, "decode field \"created_at\"") } case "owner": - requiredBitSet[2] |= 1 << 3 + requiredBitSet[2] |= 1 << 6 if err := func() error { v, err := d.Int() s.Owner = int(v) @@ -3455,7 +3506,7 @@ func (s *CreateUeReq) Decode(d *jx.Decoder) error { for i, mask := range [3]uint8{ 0b00001000, 0b00000000, - 0b00001000, + 0b01000000, } { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { // Mask only required fields and check equality to mask using XOR. @@ -12010,6 +12061,24 @@ func (s *UeCreate) encodeFields(e *jx.Encoder) { s.Author.Encode(e) } } + { + if s.GameLv.Set { + e.FieldStart("game_lv") + s.GameLv.Encode(e) + } + } + { + if s.GameExp.Set { + e.FieldStart("game_exp") + s.GameExp.Encode(e) + } + } + { + if s.GameID.Set { + e.FieldStart("game_id") + s.GameID.Encode(e) + } + } { if s.CreatedAt.Set { e.FieldStart("created_at") @@ -12018,7 +12087,7 @@ func (s *UeCreate) encodeFields(e *jx.Encoder) { } } -var jsonFieldsNameOfUeCreate = [18]string{ +var jsonFieldsNameOfUeCreate = [21]string{ 0: "id", 1: "limit", 2: "limit_boss", @@ -12036,7 +12105,10 @@ var jsonFieldsNameOfUeCreate = [18]string{ 14: "location_z", 15: "location_n", 16: "author", - 17: "created_at", + 17: "game_lv", + 18: "game_exp", + 19: "game_id", + 20: "created_at", } // Decode decodes UeCreate from json. @@ -12220,6 +12292,36 @@ func (s *UeCreate) Decode(d *jx.Decoder) error { }(); err != nil { return errors.Wrap(err, "decode field \"author\"") } + case "game_lv": + if err := func() error { + s.GameLv.Reset() + if err := s.GameLv.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_lv\"") + } + case "game_exp": + if err := func() error { + s.GameExp.Reset() + if err := s.GameExp.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_exp\"") + } + case "game_id": + if err := func() error { + s.GameID.Reset() + if err := s.GameID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_id\"") + } case "created_at": if err := func() error { s.CreatedAt.Reset() @@ -12398,6 +12500,24 @@ func (s *UeList) encodeFields(e *jx.Encoder) { s.Author.Encode(e) } } + { + if s.GameLv.Set { + e.FieldStart("game_lv") + s.GameLv.Encode(e) + } + } + { + if s.GameExp.Set { + e.FieldStart("game_exp") + s.GameExp.Encode(e) + } + } + { + if s.GameID.Set { + e.FieldStart("game_id") + s.GameID.Encode(e) + } + } { if s.CreatedAt.Set { e.FieldStart("created_at") @@ -12406,7 +12526,7 @@ func (s *UeList) encodeFields(e *jx.Encoder) { } } -var jsonFieldsNameOfUeList = [18]string{ +var jsonFieldsNameOfUeList = [21]string{ 0: "id", 1: "limit", 2: "limit_boss", @@ -12424,7 +12544,10 @@ var jsonFieldsNameOfUeList = [18]string{ 14: "location_z", 15: "location_n", 16: "author", - 17: "created_at", + 17: "game_lv", + 18: "game_exp", + 19: "game_id", + 20: "created_at", } // Decode decodes UeList from json. @@ -12608,6 +12731,36 @@ func (s *UeList) Decode(d *jx.Decoder) error { }(); err != nil { return errors.Wrap(err, "decode field \"author\"") } + case "game_lv": + if err := func() error { + s.GameLv.Reset() + if err := s.GameLv.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_lv\"") + } + case "game_exp": + if err := func() error { + s.GameExp.Reset() + if err := s.GameExp.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_exp\"") + } + case "game_id": + if err := func() error { + s.GameID.Reset() + if err := s.GameID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_id\"") + } case "created_at": if err := func() error { s.CreatedAt.Reset() @@ -13706,6 +13859,24 @@ func (s *UeRead) encodeFields(e *jx.Encoder) { s.Author.Encode(e) } } + { + if s.GameLv.Set { + e.FieldStart("game_lv") + s.GameLv.Encode(e) + } + } + { + if s.GameExp.Set { + e.FieldStart("game_exp") + s.GameExp.Encode(e) + } + } + { + if s.GameID.Set { + e.FieldStart("game_id") + s.GameID.Encode(e) + } + } { if s.CreatedAt.Set { e.FieldStart("created_at") @@ -13714,7 +13885,7 @@ func (s *UeRead) encodeFields(e *jx.Encoder) { } } -var jsonFieldsNameOfUeRead = [18]string{ +var jsonFieldsNameOfUeRead = [21]string{ 0: "id", 1: "limit", 2: "limit_boss", @@ -13732,7 +13903,10 @@ var jsonFieldsNameOfUeRead = [18]string{ 14: "location_z", 15: "location_n", 16: "author", - 17: "created_at", + 17: "game_lv", + 18: "game_exp", + 19: "game_id", + 20: "created_at", } // Decode decodes UeRead from json. @@ -13916,6 +14090,36 @@ func (s *UeRead) Decode(d *jx.Decoder) error { }(); err != nil { return errors.Wrap(err, "decode field \"author\"") } + case "game_lv": + if err := func() error { + s.GameLv.Reset() + if err := s.GameLv.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_lv\"") + } + case "game_exp": + if err := func() error { + s.GameExp.Reset() + if err := s.GameExp.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_exp\"") + } + case "game_id": + if err := func() error { + s.GameID.Reset() + if err := s.GameID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_id\"") + } case "created_at": if err := func() error { s.CreatedAt.Reset() @@ -14094,6 +14298,24 @@ func (s *UeUpdate) encodeFields(e *jx.Encoder) { s.Author.Encode(e) } } + { + if s.GameLv.Set { + e.FieldStart("game_lv") + s.GameLv.Encode(e) + } + } + { + if s.GameExp.Set { + e.FieldStart("game_exp") + s.GameExp.Encode(e) + } + } + { + if s.GameID.Set { + e.FieldStart("game_id") + s.GameID.Encode(e) + } + } { if s.CreatedAt.Set { e.FieldStart("created_at") @@ -14102,7 +14324,7 @@ func (s *UeUpdate) encodeFields(e *jx.Encoder) { } } -var jsonFieldsNameOfUeUpdate = [18]string{ +var jsonFieldsNameOfUeUpdate = [21]string{ 0: "id", 1: "limit", 2: "limit_boss", @@ -14120,7 +14342,10 @@ var jsonFieldsNameOfUeUpdate = [18]string{ 14: "location_z", 15: "location_n", 16: "author", - 17: "created_at", + 17: "game_lv", + 18: "game_exp", + 19: "game_id", + 20: "created_at", } // Decode decodes UeUpdate from json. @@ -14304,6 +14529,36 @@ func (s *UeUpdate) Decode(d *jx.Decoder) error { }(); err != nil { return errors.Wrap(err, "decode field \"author\"") } + case "game_lv": + if err := func() error { + s.GameLv.Reset() + if err := s.GameLv.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_lv\"") + } + case "game_exp": + if err := func() error { + s.GameExp.Reset() + if err := s.GameExp.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_exp\"") + } + case "game_id": + if err := func() error { + s.GameID.Reset() + if err := s.GameID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_id\"") + } case "created_at": if err := func() error { s.CreatedAt.Reset() @@ -15428,6 +15683,24 @@ func (s *UpdateUeReq) encodeFields(e *jx.Encoder) { s.Author.Encode(e) } } + { + if s.GameLv.Set { + e.FieldStart("game_lv") + s.GameLv.Encode(e) + } + } + { + if s.GameExp.Set { + e.FieldStart("game_exp") + s.GameExp.Encode(e) + } + } + { + if s.GameID.Set { + e.FieldStart("game_id") + s.GameID.Encode(e) + } + } { if s.Owner.Set { e.FieldStart("owner") @@ -15436,7 +15709,7 @@ func (s *UpdateUeReq) encodeFields(e *jx.Encoder) { } } -var jsonFieldsNameOfUpdateUeReq = [18]string{ +var jsonFieldsNameOfUpdateUeReq = [21]string{ 0: "limit", 1: "limit_boss", 2: "limit_item", @@ -15454,7 +15727,10 @@ var jsonFieldsNameOfUpdateUeReq = [18]string{ 14: "location_z", 15: "location_n", 16: "author", - 17: "owner", + 17: "game_lv", + 18: "game_exp", + 19: "game_id", + 20: "owner", } // Decode decodes UpdateUeReq from json. @@ -15635,6 +15911,36 @@ func (s *UpdateUeReq) Decode(d *jx.Decoder) error { }(); err != nil { return errors.Wrap(err, "decode field \"author\"") } + case "game_lv": + if err := func() error { + s.GameLv.Reset() + if err := s.GameLv.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_lv\"") + } + case "game_exp": + if err := func() error { + s.GameExp.Reset() + if err := s.GameExp.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_exp\"") + } + case "game_id": + if err := func() error { + s.GameID.Reset() + if err := s.GameID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_id\"") + } case "owner": if err := func() error { s.Owner.Reset() @@ -20462,6 +20768,24 @@ func (s *UserUeList) encodeFields(e *jx.Encoder) { s.Author.Encode(e) } } + { + if s.GameLv.Set { + e.FieldStart("game_lv") + s.GameLv.Encode(e) + } + } + { + if s.GameExp.Set { + e.FieldStart("game_exp") + s.GameExp.Encode(e) + } + } + { + if s.GameID.Set { + e.FieldStart("game_id") + s.GameID.Encode(e) + } + } { if s.CreatedAt.Set { e.FieldStart("created_at") @@ -20470,7 +20794,7 @@ func (s *UserUeList) encodeFields(e *jx.Encoder) { } } -var jsonFieldsNameOfUserUeList = [18]string{ +var jsonFieldsNameOfUserUeList = [21]string{ 0: "id", 1: "limit", 2: "limit_boss", @@ -20488,7 +20812,10 @@ var jsonFieldsNameOfUserUeList = [18]string{ 14: "location_z", 15: "location_n", 16: "author", - 17: "created_at", + 17: "game_lv", + 18: "game_exp", + 19: "game_id", + 20: "created_at", } // Decode decodes UserUeList from json. @@ -20672,6 +20999,36 @@ func (s *UserUeList) Decode(d *jx.Decoder) error { }(); err != nil { return errors.Wrap(err, "decode field \"author\"") } + case "game_lv": + if err := func() error { + s.GameLv.Reset() + if err := s.GameLv.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_lv\"") + } + case "game_exp": + if err := func() error { + s.GameExp.Reset() + if err := s.GameExp.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_exp\"") + } + case "game_id": + if err := func() error { + s.GameID.Reset() + if err := s.GameID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"game_id\"") + } case "created_at": if err := func() error { s.CreatedAt.Reset() diff --git a/ent/ogent/oas_schemas_gen.go b/ent/ogent/oas_schemas_gen.go index e78b8f0..fa090f4 100644 --- a/ent/ogent/oas_schemas_gen.go +++ b/ent/ogent/oas_schemas_gen.go @@ -1563,6 +1563,9 @@ type CreateUeReq struct { LocationZ OptInt `json:"location_z"` LocationN OptInt `json:"location_n"` Author OptString `json:"author"` + GameLv OptString `json:"game_lv"` + GameExp OptString `json:"game_exp"` + GameID OptString `json:"game_id"` CreatedAt OptDateTime `json:"created_at"` Owner int `json:"owner"` } @@ -1657,6 +1660,21 @@ func (s *CreateUeReq) GetAuthor() OptString { return s.Author } +// GetGameLv returns the value of GameLv. +func (s *CreateUeReq) GetGameLv() OptString { + return s.GameLv +} + +// GetGameExp returns the value of GameExp. +func (s *CreateUeReq) GetGameExp() OptString { + return s.GameExp +} + +// GetGameID returns the value of GameID. +func (s *CreateUeReq) GetGameID() OptString { + return s.GameID +} + // GetCreatedAt returns the value of CreatedAt. func (s *CreateUeReq) GetCreatedAt() OptDateTime { return s.CreatedAt @@ -1757,6 +1775,21 @@ func (s *CreateUeReq) SetAuthor(val OptString) { s.Author = val } +// SetGameLv sets the value of GameLv. +func (s *CreateUeReq) SetGameLv(val OptString) { + s.GameLv = val +} + +// SetGameExp sets the value of GameExp. +func (s *CreateUeReq) SetGameExp(val OptString) { + s.GameExp = val +} + +// SetGameID sets the value of GameID. +func (s *CreateUeReq) SetGameID(val OptString) { + s.GameID = val +} + // SetCreatedAt sets the value of CreatedAt. func (s *CreateUeReq) SetCreatedAt(val OptDateTime) { s.CreatedAt = val @@ -6184,6 +6217,9 @@ type UeCreate struct { LocationZ OptInt `json:"location_z"` LocationN OptInt `json:"location_n"` Author OptString `json:"author"` + GameLv OptString `json:"game_lv"` + GameExp OptString `json:"game_exp"` + GameID OptString `json:"game_id"` CreatedAt OptDateTime `json:"created_at"` } @@ -6272,6 +6308,21 @@ func (s *UeCreate) GetAuthor() OptString { return s.Author } +// GetGameLv returns the value of GameLv. +func (s *UeCreate) GetGameLv() OptString { + return s.GameLv +} + +// GetGameExp returns the value of GameExp. +func (s *UeCreate) GetGameExp() OptString { + return s.GameExp +} + +// GetGameID returns the value of GameID. +func (s *UeCreate) GetGameID() OptString { + return s.GameID +} + // GetCreatedAt returns the value of CreatedAt. func (s *UeCreate) GetCreatedAt() OptDateTime { return s.CreatedAt @@ -6362,6 +6413,21 @@ func (s *UeCreate) SetAuthor(val OptString) { s.Author = val } +// SetGameLv sets the value of GameLv. +func (s *UeCreate) SetGameLv(val OptString) { + s.GameLv = val +} + +// SetGameExp sets the value of GameExp. +func (s *UeCreate) SetGameExp(val OptString) { + s.GameExp = val +} + +// SetGameID sets the value of GameID. +func (s *UeCreate) SetGameID(val OptString) { + s.GameID = val +} + // SetCreatedAt sets the value of CreatedAt. func (s *UeCreate) SetCreatedAt(val OptDateTime) { s.CreatedAt = val @@ -6388,6 +6454,9 @@ type UeList struct { LocationZ OptInt `json:"location_z"` LocationN OptInt `json:"location_n"` Author OptString `json:"author"` + GameLv OptString `json:"game_lv"` + GameExp OptString `json:"game_exp"` + GameID OptString `json:"game_id"` CreatedAt OptDateTime `json:"created_at"` } @@ -6476,6 +6545,21 @@ func (s *UeList) GetAuthor() OptString { return s.Author } +// GetGameLv returns the value of GameLv. +func (s *UeList) GetGameLv() OptString { + return s.GameLv +} + +// GetGameExp returns the value of GameExp. +func (s *UeList) GetGameExp() OptString { + return s.GameExp +} + +// GetGameID returns the value of GameID. +func (s *UeList) GetGameID() OptString { + return s.GameID +} + // GetCreatedAt returns the value of CreatedAt. func (s *UeList) GetCreatedAt() OptDateTime { return s.CreatedAt @@ -6566,6 +6650,21 @@ func (s *UeList) SetAuthor(val OptString) { s.Author = val } +// SetGameLv sets the value of GameLv. +func (s *UeList) SetGameLv(val OptString) { + s.GameLv = val +} + +// SetGameExp sets the value of GameExp. +func (s *UeList) SetGameExp(val OptString) { + s.GameExp = val +} + +// SetGameID sets the value of GameID. +func (s *UeList) SetGameID(val OptString) { + s.GameID = val +} + // SetCreatedAt sets the value of CreatedAt. func (s *UeList) SetCreatedAt(val OptDateTime) { s.CreatedAt = val @@ -7135,6 +7234,9 @@ type UeRead struct { LocationZ OptInt `json:"location_z"` LocationN OptInt `json:"location_n"` Author OptString `json:"author"` + GameLv OptString `json:"game_lv"` + GameExp OptString `json:"game_exp"` + GameID OptString `json:"game_id"` CreatedAt OptDateTime `json:"created_at"` } @@ -7223,6 +7325,21 @@ func (s *UeRead) GetAuthor() OptString { return s.Author } +// GetGameLv returns the value of GameLv. +func (s *UeRead) GetGameLv() OptString { + return s.GameLv +} + +// GetGameExp returns the value of GameExp. +func (s *UeRead) GetGameExp() OptString { + return s.GameExp +} + +// GetGameID returns the value of GameID. +func (s *UeRead) GetGameID() OptString { + return s.GameID +} + // GetCreatedAt returns the value of CreatedAt. func (s *UeRead) GetCreatedAt() OptDateTime { return s.CreatedAt @@ -7313,6 +7430,21 @@ func (s *UeRead) SetAuthor(val OptString) { s.Author = val } +// SetGameLv sets the value of GameLv. +func (s *UeRead) SetGameLv(val OptString) { + s.GameLv = val +} + +// SetGameExp sets the value of GameExp. +func (s *UeRead) SetGameExp(val OptString) { + s.GameExp = val +} + +// SetGameID sets the value of GameID. +func (s *UeRead) SetGameID(val OptString) { + s.GameID = val +} + // SetCreatedAt sets the value of CreatedAt. func (s *UeRead) SetCreatedAt(val OptDateTime) { s.CreatedAt = val @@ -7339,6 +7471,9 @@ type UeUpdate struct { LocationZ OptInt `json:"location_z"` LocationN OptInt `json:"location_n"` Author OptString `json:"author"` + GameLv OptString `json:"game_lv"` + GameExp OptString `json:"game_exp"` + GameID OptString `json:"game_id"` CreatedAt OptDateTime `json:"created_at"` } @@ -7427,6 +7562,21 @@ func (s *UeUpdate) GetAuthor() OptString { return s.Author } +// GetGameLv returns the value of GameLv. +func (s *UeUpdate) GetGameLv() OptString { + return s.GameLv +} + +// GetGameExp returns the value of GameExp. +func (s *UeUpdate) GetGameExp() OptString { + return s.GameExp +} + +// GetGameID returns the value of GameID. +func (s *UeUpdate) GetGameID() OptString { + return s.GameID +} + // GetCreatedAt returns the value of CreatedAt. func (s *UeUpdate) GetCreatedAt() OptDateTime { return s.CreatedAt @@ -7517,6 +7667,21 @@ func (s *UeUpdate) SetAuthor(val OptString) { s.Author = val } +// SetGameLv sets the value of GameLv. +func (s *UeUpdate) SetGameLv(val OptString) { + s.GameLv = val +} + +// SetGameExp sets the value of GameExp. +func (s *UeUpdate) SetGameExp(val OptString) { + s.GameExp = val +} + +// SetGameID sets the value of GameID. +func (s *UeUpdate) SetGameID(val OptString) { + s.GameID = val +} + // SetCreatedAt sets the value of CreatedAt. func (s *UeUpdate) SetCreatedAt(val OptDateTime) { s.CreatedAt = val @@ -8038,6 +8203,9 @@ type UpdateUeReq struct { LocationZ OptInt `json:"location_z"` LocationN OptInt `json:"location_n"` Author OptString `json:"author"` + GameLv OptString `json:"game_lv"` + GameExp OptString `json:"game_exp"` + GameID OptString `json:"game_id"` Owner OptInt `json:"owner"` } @@ -8126,6 +8294,21 @@ func (s *UpdateUeReq) GetAuthor() OptString { return s.Author } +// GetGameLv returns the value of GameLv. +func (s *UpdateUeReq) GetGameLv() OptString { + return s.GameLv +} + +// GetGameExp returns the value of GameExp. +func (s *UpdateUeReq) GetGameExp() OptString { + return s.GameExp +} + +// GetGameID returns the value of GameID. +func (s *UpdateUeReq) GetGameID() OptString { + return s.GameID +} + // GetOwner returns the value of Owner. func (s *UpdateUeReq) GetOwner() OptInt { return s.Owner @@ -8216,6 +8399,21 @@ func (s *UpdateUeReq) SetAuthor(val OptString) { s.Author = val } +// SetGameLv sets the value of GameLv. +func (s *UpdateUeReq) SetGameLv(val OptString) { + s.GameLv = val +} + +// SetGameExp sets the value of GameExp. +func (s *UpdateUeReq) SetGameExp(val OptString) { + s.GameExp = val +} + +// SetGameID sets the value of GameID. +func (s *UpdateUeReq) SetGameID(val OptString) { + s.GameID = val +} + // SetOwner sets the value of Owner. func (s *UpdateUeReq) SetOwner(val OptInt) { s.Owner = val @@ -10911,6 +11109,9 @@ type UserUeList struct { LocationZ OptInt `json:"location_z"` LocationN OptInt `json:"location_n"` Author OptString `json:"author"` + GameLv OptString `json:"game_lv"` + GameExp OptString `json:"game_exp"` + GameID OptString `json:"game_id"` CreatedAt OptDateTime `json:"created_at"` } @@ -10999,6 +11200,21 @@ func (s *UserUeList) GetAuthor() OptString { return s.Author } +// GetGameLv returns the value of GameLv. +func (s *UserUeList) GetGameLv() OptString { + return s.GameLv +} + +// GetGameExp returns the value of GameExp. +func (s *UserUeList) GetGameExp() OptString { + return s.GameExp +} + +// GetGameID returns the value of GameID. +func (s *UserUeList) GetGameID() OptString { + return s.GameID +} + // GetCreatedAt returns the value of CreatedAt. func (s *UserUeList) GetCreatedAt() OptDateTime { return s.CreatedAt @@ -11089,6 +11305,21 @@ func (s *UserUeList) SetAuthor(val OptString) { s.Author = val } +// SetGameLv sets the value of GameLv. +func (s *UserUeList) SetGameLv(val OptString) { + s.GameLv = val +} + +// SetGameExp sets the value of GameExp. +func (s *UserUeList) SetGameExp(val OptString) { + s.GameExp = val +} + +// SetGameID sets the value of GameID. +func (s *UserUeList) SetGameID(val OptString) { + s.GameID = val +} + // SetCreatedAt sets the value of CreatedAt. func (s *UserUeList) SetCreatedAt(val OptDateTime) { s.CreatedAt = val diff --git a/ent/ogent/ogent.go b/ent/ogent/ogent.go index a63e3d4..d560c21 100644 --- a/ent/ogent/ogent.go +++ b/ent/ogent/ogent.go @@ -1165,6 +1165,16 @@ func (h *OgentHandler) CreateUe(ctx context.Context, req *CreateUeReq) (CreateUe if v, ok := req.CreatedAt.Get(); ok { b.SetCreatedAt(v) } + if v, ok := req.GameExp.Get(); ok { + b.SetLvPoint(v) + } + if v, ok := req.GameLv.Get(); ok { + b.SetLvPoint(v) + } + if v, ok := req.GameId.Get(); ok { + b.SetLvPoint(v) + } + // Add all edges. //b.SetOwnerID(req.Owner) if req.Password == password { @@ -1284,6 +1294,15 @@ func (h *OgentHandler) UpdateUe(ctx context.Context, req *UpdateUeReq, params Up if v, ok := req.Author.Get(); ok { b.SetAuthor(v) } + if v, ok := req.GameExp.Get(); ok { + b.SetLvPoint(v) + } + if v, ok := req.GameLv.Get(); ok { + b.SetLvPoint(v) + } + if v, ok := req.GameId.Get(); ok { + b.SetLvPoint(v) + } // Add all edges. //if v, ok := req.Owner.Get(); ok { // b.SetOwnerID(v) diff --git a/ent/ogent/responses.go b/ent/ogent/responses.go index ecde777..08942fd 100644 --- a/ent/ogent/responses.go +++ b/ent/ogent/responses.go @@ -918,6 +918,9 @@ func NewUeCreate(e *ent.Ue) *UeCreate { ret.LocationZ = NewOptInt(e.LocationZ) ret.LocationN = NewOptInt(e.LocationN) ret.Author = NewOptString(e.Author) + ret.GameLv = NewOptString(e.GameLv) + ret.GameExp = NewOptString(e.GameExp) + ret.GameID = NewOptString(e.GameID) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret } @@ -962,6 +965,9 @@ func NewUeList(e *ent.Ue) *UeList { ret.LocationZ = NewOptInt(e.LocationZ) ret.LocationN = NewOptInt(e.LocationN) ret.Author = NewOptString(e.Author) + ret.GameLv = NewOptString(e.GameLv) + ret.GameExp = NewOptString(e.GameExp) + ret.GameID = NewOptString(e.GameID) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret } @@ -1006,6 +1012,9 @@ func NewUeRead(e *ent.Ue) *UeRead { ret.LocationZ = NewOptInt(e.LocationZ) ret.LocationN = NewOptInt(e.LocationN) ret.Author = NewOptString(e.Author) + ret.GameLv = NewOptString(e.GameLv) + ret.GameExp = NewOptString(e.GameExp) + ret.GameID = NewOptString(e.GameID) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret } @@ -1050,6 +1059,9 @@ func NewUeUpdate(e *ent.Ue) *UeUpdate { ret.LocationZ = NewOptInt(e.LocationZ) ret.LocationN = NewOptInt(e.LocationN) ret.Author = NewOptString(e.Author) + ret.GameLv = NewOptString(e.GameLv) + ret.GameExp = NewOptString(e.GameExp) + ret.GameID = NewOptString(e.GameID) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret } @@ -1589,6 +1601,9 @@ func NewUserUeList(e *ent.Ue) *UserUeList { ret.LocationZ = NewOptInt(e.LocationZ) ret.LocationN = NewOptInt(e.LocationN) ret.Author = NewOptString(e.Author) + ret.GameLv = NewOptString(e.GameLv) + ret.GameExp = NewOptString(e.GameExp) + ret.GameID = NewOptString(e.GameID) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret } diff --git a/ent/openapi.json b/ent/openapi.json index e1bb213..9edfb63 100644 --- a/ent/openapi.json +++ b/ent/openapi.json @@ -1617,6 +1617,15 @@ "author": { "type": "string" }, + "game_lv": { + "type": "string" + }, + "game_exp": { + "type": "string" + }, + "game_id": { + "type": "string" + }, "created_at": { "type": "string", "format": "date-time" @@ -1813,6 +1822,15 @@ "author": { "type": "string" }, + "game_lv": { + "type": "string" + }, + "game_exp": { + "type": "string" + }, + "game_id": { + "type": "string" + }, "owner": { "type": "integer" } @@ -4393,6 +4411,15 @@ "author": { "type": "string" }, + "game_lv": { + "type": "string" + }, + "game_exp": { + "type": "string" + }, + "game_id": { + "type": "string" + }, "created_at": { "type": "string", "format": "date-time" @@ -4461,6 +4488,15 @@ "author": { "type": "string" }, + "game_lv": { + "type": "string" + }, + "game_exp": { + "type": "string" + }, + "game_id": { + "type": "string" + }, "created_at": { "type": "string", "format": "date-time" @@ -4524,6 +4560,15 @@ "author": { "type": "string" }, + "game_lv": { + "type": "string" + }, + "game_exp": { + "type": "string" + }, + "game_id": { + "type": "string" + }, "created_at": { "type": "string", "format": "date-time" @@ -4587,6 +4632,15 @@ "author": { "type": "string" }, + "game_lv": { + "type": "string" + }, + "game_exp": { + "type": "string" + }, + "game_id": { + "type": "string" + }, "created_at": { "type": "string", "format": "date-time" @@ -4650,6 +4704,15 @@ "author": { "type": "string" }, + "game_lv": { + "type": "string" + }, + "game_exp": { + "type": "string" + }, + "game_id": { + "type": "string" + }, "created_at": { "type": "string", "format": "date-time" @@ -5895,6 +5958,15 @@ "author": { "type": "string" }, + "game_lv": { + "type": "string" + }, + "game_exp": { + "type": "string" + }, + "game_id": { + "type": "string" + }, "created_at": { "type": "string", "format": "date-time" diff --git a/ent/runtime.go b/ent/runtime.go index 6655d7b..b09fd75 100644 --- a/ent/runtime.go +++ b/ent/runtime.go @@ -100,7 +100,7 @@ func init() { // ue.PasswordValidator is a validator for the "password" field. It is called by the builders before save. ue.PasswordValidator = ueDescPassword.Validators[0].(func(string) error) // ueDescCreatedAt is the schema descriptor for created_at field. - ueDescCreatedAt := ueFields[18].Descriptor() + ueDescCreatedAt := ueFields[21].Descriptor() // ue.DefaultCreatedAt holds the default value on creation for the created_at field. ue.DefaultCreatedAt = ueDescCreatedAt.Default.(func() time.Time) userFields := schema.User{}.Fields() diff --git a/ent/schema/ue.go b/ent/schema/ue.go index 80a6b05..eab1919 100644 --- a/ent/schema/ue.go +++ b/ent/schema/ue.go @@ -75,6 +75,15 @@ func (Ue) Fields() []ent.Field { field.String("author"). Optional(), + field.String("game_lv"). + Optional(), + + field.String("game_exp"). + Optional(), + + field.String("game_id"). + Optional(), + field.Time("created_at"). Immutable(). Optional(). diff --git a/ent/ue.go b/ent/ue.go index ffbd4be..14fea0b 100644 --- a/ent/ue.go +++ b/ent/ue.go @@ -54,6 +54,12 @@ type Ue struct { LocationN int `json:"location_n,omitempty"` // Author holds the value of the "author" field. Author string `json:"author,omitempty"` + // GameLv holds the value of the "game_lv" field. + GameLv string `json:"game_lv,omitempty"` + // GameExp holds the value of the "game_exp" field. + GameExp string `json:"game_exp,omitempty"` + // GameID holds the value of the "game_id" field. + GameID string `json:"game_id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // Edges holds the relations/edges for other nodes in the graph. @@ -94,7 +100,7 @@ func (*Ue) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullBool) case ue.FieldID, ue.FieldLv, ue.FieldLvPoint, ue.FieldModel, ue.FieldSword, ue.FieldCard, ue.FieldCp, ue.FieldCount, ue.FieldLocationX, ue.FieldLocationY, ue.FieldLocationZ, ue.FieldLocationN: values[i] = new(sql.NullInt64) - case ue.FieldPassword, ue.FieldMode, ue.FieldToken, ue.FieldAuthor: + case ue.FieldPassword, ue.FieldMode, ue.FieldToken, ue.FieldAuthor, ue.FieldGameLv, ue.FieldGameExp, ue.FieldGameID: values[i] = new(sql.NullString) case ue.FieldCreatedAt: values[i] = new(sql.NullTime) @@ -229,6 +235,24 @@ func (u *Ue) assignValues(columns []string, values []any) error { } else if value.Valid { u.Author = value.String } + case ue.FieldGameLv: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field game_lv", values[i]) + } else if value.Valid { + u.GameLv = value.String + } + case ue.FieldGameExp: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field game_exp", values[i]) + } else if value.Valid { + u.GameExp = value.String + } + case ue.FieldGameID: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field game_id", values[i]) + } else if value.Valid { + u.GameID = value.String + } case ue.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) @@ -335,6 +359,15 @@ func (u *Ue) String() string { builder.WriteString("author=") builder.WriteString(u.Author) builder.WriteString(", ") + builder.WriteString("game_lv=") + builder.WriteString(u.GameLv) + builder.WriteString(", ") + builder.WriteString("game_exp=") + builder.WriteString(u.GameExp) + builder.WriteString(", ") + builder.WriteString("game_id=") + builder.WriteString(u.GameID) + builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(u.CreatedAt.Format(time.ANSIC)) builder.WriteByte(')') diff --git a/ent/ue/ue.go b/ent/ue/ue.go index 2b13e13..a4f89fe 100644 --- a/ent/ue/ue.go +++ b/ent/ue/ue.go @@ -50,6 +50,12 @@ const ( FieldLocationN = "location_n" // FieldAuthor holds the string denoting the author field in the database. FieldAuthor = "author" + // FieldGameLv holds the string denoting the game_lv field in the database. + FieldGameLv = "game_lv" + // FieldGameExp holds the string denoting the game_exp field in the database. + FieldGameExp = "game_exp" + // FieldGameID holds the string denoting the game_id field in the database. + FieldGameID = "game_id" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // EdgeOwner holds the string denoting the owner edge name in mutations. @@ -86,6 +92,9 @@ var Columns = []string{ FieldLocationZ, FieldLocationN, FieldAuthor, + FieldGameLv, + FieldGameExp, + FieldGameID, FieldCreatedAt, } @@ -221,6 +230,21 @@ func ByAuthor(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAuthor, opts...).ToFunc() } +// ByGameLv orders the results by the game_lv field. +func ByGameLv(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldGameLv, opts...).ToFunc() +} + +// ByGameExp orders the results by the game_exp field. +func ByGameExp(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldGameExp, opts...).ToFunc() +} + +// ByGameID orders the results by the game_id field. +func ByGameID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldGameID, opts...).ToFunc() +} + // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() diff --git a/ent/ue/where.go b/ent/ue/where.go index 886b7a0..cdc4744 100644 --- a/ent/ue/where.go +++ b/ent/ue/where.go @@ -145,6 +145,21 @@ func Author(v string) predicate.Ue { return predicate.Ue(sql.FieldEQ(FieldAuthor, v)) } +// GameLv applies equality check predicate on the "game_lv" field. It's identical to GameLvEQ. +func GameLv(v string) predicate.Ue { + return predicate.Ue(sql.FieldEQ(FieldGameLv, v)) +} + +// GameExp applies equality check predicate on the "game_exp" field. It's identical to GameExpEQ. +func GameExp(v string) predicate.Ue { + return predicate.Ue(sql.FieldEQ(FieldGameExp, v)) +} + +// GameID applies equality check predicate on the "game_id" field. It's identical to GameIDEQ. +func GameID(v string) predicate.Ue { + return predicate.Ue(sql.FieldEQ(FieldGameID, v)) +} + // CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. func CreatedAt(v time.Time) predicate.Ue { return predicate.Ue(sql.FieldEQ(FieldCreatedAt, v)) @@ -1050,6 +1065,231 @@ func AuthorContainsFold(v string) predicate.Ue { return predicate.Ue(sql.FieldContainsFold(FieldAuthor, v)) } +// GameLvEQ applies the EQ predicate on the "game_lv" field. +func GameLvEQ(v string) predicate.Ue { + return predicate.Ue(sql.FieldEQ(FieldGameLv, v)) +} + +// GameLvNEQ applies the NEQ predicate on the "game_lv" field. +func GameLvNEQ(v string) predicate.Ue { + return predicate.Ue(sql.FieldNEQ(FieldGameLv, v)) +} + +// GameLvIn applies the In predicate on the "game_lv" field. +func GameLvIn(vs ...string) predicate.Ue { + return predicate.Ue(sql.FieldIn(FieldGameLv, vs...)) +} + +// GameLvNotIn applies the NotIn predicate on the "game_lv" field. +func GameLvNotIn(vs ...string) predicate.Ue { + return predicate.Ue(sql.FieldNotIn(FieldGameLv, vs...)) +} + +// GameLvGT applies the GT predicate on the "game_lv" field. +func GameLvGT(v string) predicate.Ue { + return predicate.Ue(sql.FieldGT(FieldGameLv, v)) +} + +// GameLvGTE applies the GTE predicate on the "game_lv" field. +func GameLvGTE(v string) predicate.Ue { + return predicate.Ue(sql.FieldGTE(FieldGameLv, v)) +} + +// GameLvLT applies the LT predicate on the "game_lv" field. +func GameLvLT(v string) predicate.Ue { + return predicate.Ue(sql.FieldLT(FieldGameLv, v)) +} + +// GameLvLTE applies the LTE predicate on the "game_lv" field. +func GameLvLTE(v string) predicate.Ue { + return predicate.Ue(sql.FieldLTE(FieldGameLv, v)) +} + +// GameLvContains applies the Contains predicate on the "game_lv" field. +func GameLvContains(v string) predicate.Ue { + return predicate.Ue(sql.FieldContains(FieldGameLv, v)) +} + +// GameLvHasPrefix applies the HasPrefix predicate on the "game_lv" field. +func GameLvHasPrefix(v string) predicate.Ue { + return predicate.Ue(sql.FieldHasPrefix(FieldGameLv, v)) +} + +// GameLvHasSuffix applies the HasSuffix predicate on the "game_lv" field. +func GameLvHasSuffix(v string) predicate.Ue { + return predicate.Ue(sql.FieldHasSuffix(FieldGameLv, v)) +} + +// GameLvIsNil applies the IsNil predicate on the "game_lv" field. +func GameLvIsNil() predicate.Ue { + return predicate.Ue(sql.FieldIsNull(FieldGameLv)) +} + +// GameLvNotNil applies the NotNil predicate on the "game_lv" field. +func GameLvNotNil() predicate.Ue { + return predicate.Ue(sql.FieldNotNull(FieldGameLv)) +} + +// GameLvEqualFold applies the EqualFold predicate on the "game_lv" field. +func GameLvEqualFold(v string) predicate.Ue { + return predicate.Ue(sql.FieldEqualFold(FieldGameLv, v)) +} + +// GameLvContainsFold applies the ContainsFold predicate on the "game_lv" field. +func GameLvContainsFold(v string) predicate.Ue { + return predicate.Ue(sql.FieldContainsFold(FieldGameLv, v)) +} + +// GameExpEQ applies the EQ predicate on the "game_exp" field. +func GameExpEQ(v string) predicate.Ue { + return predicate.Ue(sql.FieldEQ(FieldGameExp, v)) +} + +// GameExpNEQ applies the NEQ predicate on the "game_exp" field. +func GameExpNEQ(v string) predicate.Ue { + return predicate.Ue(sql.FieldNEQ(FieldGameExp, v)) +} + +// GameExpIn applies the In predicate on the "game_exp" field. +func GameExpIn(vs ...string) predicate.Ue { + return predicate.Ue(sql.FieldIn(FieldGameExp, vs...)) +} + +// GameExpNotIn applies the NotIn predicate on the "game_exp" field. +func GameExpNotIn(vs ...string) predicate.Ue { + return predicate.Ue(sql.FieldNotIn(FieldGameExp, vs...)) +} + +// GameExpGT applies the GT predicate on the "game_exp" field. +func GameExpGT(v string) predicate.Ue { + return predicate.Ue(sql.FieldGT(FieldGameExp, v)) +} + +// GameExpGTE applies the GTE predicate on the "game_exp" field. +func GameExpGTE(v string) predicate.Ue { + return predicate.Ue(sql.FieldGTE(FieldGameExp, v)) +} + +// GameExpLT applies the LT predicate on the "game_exp" field. +func GameExpLT(v string) predicate.Ue { + return predicate.Ue(sql.FieldLT(FieldGameExp, v)) +} + +// GameExpLTE applies the LTE predicate on the "game_exp" field. +func GameExpLTE(v string) predicate.Ue { + return predicate.Ue(sql.FieldLTE(FieldGameExp, v)) +} + +// GameExpContains applies the Contains predicate on the "game_exp" field. +func GameExpContains(v string) predicate.Ue { + return predicate.Ue(sql.FieldContains(FieldGameExp, v)) +} + +// GameExpHasPrefix applies the HasPrefix predicate on the "game_exp" field. +func GameExpHasPrefix(v string) predicate.Ue { + return predicate.Ue(sql.FieldHasPrefix(FieldGameExp, v)) +} + +// GameExpHasSuffix applies the HasSuffix predicate on the "game_exp" field. +func GameExpHasSuffix(v string) predicate.Ue { + return predicate.Ue(sql.FieldHasSuffix(FieldGameExp, v)) +} + +// GameExpIsNil applies the IsNil predicate on the "game_exp" field. +func GameExpIsNil() predicate.Ue { + return predicate.Ue(sql.FieldIsNull(FieldGameExp)) +} + +// GameExpNotNil applies the NotNil predicate on the "game_exp" field. +func GameExpNotNil() predicate.Ue { + return predicate.Ue(sql.FieldNotNull(FieldGameExp)) +} + +// GameExpEqualFold applies the EqualFold predicate on the "game_exp" field. +func GameExpEqualFold(v string) predicate.Ue { + return predicate.Ue(sql.FieldEqualFold(FieldGameExp, v)) +} + +// GameExpContainsFold applies the ContainsFold predicate on the "game_exp" field. +func GameExpContainsFold(v string) predicate.Ue { + return predicate.Ue(sql.FieldContainsFold(FieldGameExp, v)) +} + +// GameIDEQ applies the EQ predicate on the "game_id" field. +func GameIDEQ(v string) predicate.Ue { + return predicate.Ue(sql.FieldEQ(FieldGameID, v)) +} + +// GameIDNEQ applies the NEQ predicate on the "game_id" field. +func GameIDNEQ(v string) predicate.Ue { + return predicate.Ue(sql.FieldNEQ(FieldGameID, v)) +} + +// GameIDIn applies the In predicate on the "game_id" field. +func GameIDIn(vs ...string) predicate.Ue { + return predicate.Ue(sql.FieldIn(FieldGameID, vs...)) +} + +// GameIDNotIn applies the NotIn predicate on the "game_id" field. +func GameIDNotIn(vs ...string) predicate.Ue { + return predicate.Ue(sql.FieldNotIn(FieldGameID, vs...)) +} + +// GameIDGT applies the GT predicate on the "game_id" field. +func GameIDGT(v string) predicate.Ue { + return predicate.Ue(sql.FieldGT(FieldGameID, v)) +} + +// GameIDGTE applies the GTE predicate on the "game_id" field. +func GameIDGTE(v string) predicate.Ue { + return predicate.Ue(sql.FieldGTE(FieldGameID, v)) +} + +// GameIDLT applies the LT predicate on the "game_id" field. +func GameIDLT(v string) predicate.Ue { + return predicate.Ue(sql.FieldLT(FieldGameID, v)) +} + +// GameIDLTE applies the LTE predicate on the "game_id" field. +func GameIDLTE(v string) predicate.Ue { + return predicate.Ue(sql.FieldLTE(FieldGameID, v)) +} + +// GameIDContains applies the Contains predicate on the "game_id" field. +func GameIDContains(v string) predicate.Ue { + return predicate.Ue(sql.FieldContains(FieldGameID, v)) +} + +// GameIDHasPrefix applies the HasPrefix predicate on the "game_id" field. +func GameIDHasPrefix(v string) predicate.Ue { + return predicate.Ue(sql.FieldHasPrefix(FieldGameID, v)) +} + +// GameIDHasSuffix applies the HasSuffix predicate on the "game_id" field. +func GameIDHasSuffix(v string) predicate.Ue { + return predicate.Ue(sql.FieldHasSuffix(FieldGameID, v)) +} + +// GameIDIsNil applies the IsNil predicate on the "game_id" field. +func GameIDIsNil() predicate.Ue { + return predicate.Ue(sql.FieldIsNull(FieldGameID)) +} + +// GameIDNotNil applies the NotNil predicate on the "game_id" field. +func GameIDNotNil() predicate.Ue { + return predicate.Ue(sql.FieldNotNull(FieldGameID)) +} + +// GameIDEqualFold applies the EqualFold predicate on the "game_id" field. +func GameIDEqualFold(v string) predicate.Ue { + return predicate.Ue(sql.FieldEqualFold(FieldGameID, v)) +} + +// GameIDContainsFold applies the ContainsFold predicate on the "game_id" field. +func GameIDContainsFold(v string) predicate.Ue { + return predicate.Ue(sql.FieldContainsFold(FieldGameID, v)) +} + // CreatedAtEQ applies the EQ predicate on the "created_at" field. func CreatedAtEQ(v time.Time) predicate.Ue { return predicate.Ue(sql.FieldEQ(FieldCreatedAt, v)) diff --git a/ent/ue_create.go b/ent/ue_create.go index b5f4c2d..b078595 100644 --- a/ent/ue_create.go +++ b/ent/ue_create.go @@ -265,6 +265,48 @@ func (uc *UeCreate) SetNillableAuthor(s *string) *UeCreate { return uc } +// SetGameLv sets the "game_lv" field. +func (uc *UeCreate) SetGameLv(s string) *UeCreate { + uc.mutation.SetGameLv(s) + return uc +} + +// SetNillableGameLv sets the "game_lv" field if the given value is not nil. +func (uc *UeCreate) SetNillableGameLv(s *string) *UeCreate { + if s != nil { + uc.SetGameLv(*s) + } + return uc +} + +// SetGameExp sets the "game_exp" field. +func (uc *UeCreate) SetGameExp(s string) *UeCreate { + uc.mutation.SetGameExp(s) + return uc +} + +// SetNillableGameExp sets the "game_exp" field if the given value is not nil. +func (uc *UeCreate) SetNillableGameExp(s *string) *UeCreate { + if s != nil { + uc.SetGameExp(*s) + } + return uc +} + +// SetGameID sets the "game_id" field. +func (uc *UeCreate) SetGameID(s string) *UeCreate { + uc.mutation.SetGameID(s) + return uc +} + +// SetNillableGameID sets the "game_id" field if the given value is not nil. +func (uc *UeCreate) SetNillableGameID(s *string) *UeCreate { + if s != nil { + uc.SetGameID(*s) + } + return uc +} + // SetCreatedAt sets the "created_at" field. func (uc *UeCreate) SetCreatedAt(t time.Time) *UeCreate { uc.mutation.SetCreatedAt(t) @@ -454,6 +496,18 @@ func (uc *UeCreate) createSpec() (*Ue, *sqlgraph.CreateSpec) { _spec.SetField(ue.FieldAuthor, field.TypeString, value) _node.Author = value } + if value, ok := uc.mutation.GameLv(); ok { + _spec.SetField(ue.FieldGameLv, field.TypeString, value) + _node.GameLv = value + } + if value, ok := uc.mutation.GameExp(); ok { + _spec.SetField(ue.FieldGameExp, field.TypeString, value) + _node.GameExp = value + } + if value, ok := uc.mutation.GameID(); ok { + _spec.SetField(ue.FieldGameID, field.TypeString, value) + _node.GameID = value + } if value, ok := uc.mutation.CreatedAt(); ok { _spec.SetField(ue.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value diff --git a/ent/ue_update.go b/ent/ue_update.go index 318636a..ac57265 100644 --- a/ent/ue_update.go +++ b/ent/ue_update.go @@ -445,6 +445,66 @@ func (uu *UeUpdate) ClearAuthor() *UeUpdate { return uu } +// SetGameLv sets the "game_lv" field. +func (uu *UeUpdate) SetGameLv(s string) *UeUpdate { + uu.mutation.SetGameLv(s) + return uu +} + +// SetNillableGameLv sets the "game_lv" field if the given value is not nil. +func (uu *UeUpdate) SetNillableGameLv(s *string) *UeUpdate { + if s != nil { + uu.SetGameLv(*s) + } + return uu +} + +// ClearGameLv clears the value of the "game_lv" field. +func (uu *UeUpdate) ClearGameLv() *UeUpdate { + uu.mutation.ClearGameLv() + return uu +} + +// SetGameExp sets the "game_exp" field. +func (uu *UeUpdate) SetGameExp(s string) *UeUpdate { + uu.mutation.SetGameExp(s) + return uu +} + +// SetNillableGameExp sets the "game_exp" field if the given value is not nil. +func (uu *UeUpdate) SetNillableGameExp(s *string) *UeUpdate { + if s != nil { + uu.SetGameExp(*s) + } + return uu +} + +// ClearGameExp clears the value of the "game_exp" field. +func (uu *UeUpdate) ClearGameExp() *UeUpdate { + uu.mutation.ClearGameExp() + return uu +} + +// SetGameID sets the "game_id" field. +func (uu *UeUpdate) SetGameID(s string) *UeUpdate { + uu.mutation.SetGameID(s) + return uu +} + +// SetNillableGameID sets the "game_id" field if the given value is not nil. +func (uu *UeUpdate) SetNillableGameID(s *string) *UeUpdate { + if s != nil { + uu.SetGameID(*s) + } + return uu +} + +// ClearGameID clears the value of the "game_id" field. +func (uu *UeUpdate) ClearGameID() *UeUpdate { + uu.mutation.ClearGameID() + return uu +} + // SetOwnerID sets the "owner" edge to the User entity by ID. func (uu *UeUpdate) SetOwnerID(id int) *UeUpdate { uu.mutation.SetOwnerID(id) @@ -649,6 +709,24 @@ func (uu *UeUpdate) sqlSave(ctx context.Context) (n int, err error) { if uu.mutation.AuthorCleared() { _spec.ClearField(ue.FieldAuthor, field.TypeString) } + if value, ok := uu.mutation.GameLv(); ok { + _spec.SetField(ue.FieldGameLv, field.TypeString, value) + } + if uu.mutation.GameLvCleared() { + _spec.ClearField(ue.FieldGameLv, field.TypeString) + } + if value, ok := uu.mutation.GameExp(); ok { + _spec.SetField(ue.FieldGameExp, field.TypeString, value) + } + if uu.mutation.GameExpCleared() { + _spec.ClearField(ue.FieldGameExp, field.TypeString) + } + if value, ok := uu.mutation.GameID(); ok { + _spec.SetField(ue.FieldGameID, field.TypeString, value) + } + if uu.mutation.GameIDCleared() { + _spec.ClearField(ue.FieldGameID, field.TypeString) + } if uu.mutation.CreatedAtCleared() { _spec.ClearField(ue.FieldCreatedAt, field.TypeTime) } @@ -1118,6 +1196,66 @@ func (uuo *UeUpdateOne) ClearAuthor() *UeUpdateOne { return uuo } +// SetGameLv sets the "game_lv" field. +func (uuo *UeUpdateOne) SetGameLv(s string) *UeUpdateOne { + uuo.mutation.SetGameLv(s) + return uuo +} + +// SetNillableGameLv sets the "game_lv" field if the given value is not nil. +func (uuo *UeUpdateOne) SetNillableGameLv(s *string) *UeUpdateOne { + if s != nil { + uuo.SetGameLv(*s) + } + return uuo +} + +// ClearGameLv clears the value of the "game_lv" field. +func (uuo *UeUpdateOne) ClearGameLv() *UeUpdateOne { + uuo.mutation.ClearGameLv() + return uuo +} + +// SetGameExp sets the "game_exp" field. +func (uuo *UeUpdateOne) SetGameExp(s string) *UeUpdateOne { + uuo.mutation.SetGameExp(s) + return uuo +} + +// SetNillableGameExp sets the "game_exp" field if the given value is not nil. +func (uuo *UeUpdateOne) SetNillableGameExp(s *string) *UeUpdateOne { + if s != nil { + uuo.SetGameExp(*s) + } + return uuo +} + +// ClearGameExp clears the value of the "game_exp" field. +func (uuo *UeUpdateOne) ClearGameExp() *UeUpdateOne { + uuo.mutation.ClearGameExp() + return uuo +} + +// SetGameID sets the "game_id" field. +func (uuo *UeUpdateOne) SetGameID(s string) *UeUpdateOne { + uuo.mutation.SetGameID(s) + return uuo +} + +// SetNillableGameID sets the "game_id" field if the given value is not nil. +func (uuo *UeUpdateOne) SetNillableGameID(s *string) *UeUpdateOne { + if s != nil { + uuo.SetGameID(*s) + } + return uuo +} + +// ClearGameID clears the value of the "game_id" field. +func (uuo *UeUpdateOne) ClearGameID() *UeUpdateOne { + uuo.mutation.ClearGameID() + return uuo +} + // SetOwnerID sets the "owner" edge to the User entity by ID. func (uuo *UeUpdateOne) SetOwnerID(id int) *UeUpdateOne { uuo.mutation.SetOwnerID(id) @@ -1352,6 +1490,24 @@ func (uuo *UeUpdateOne) sqlSave(ctx context.Context) (_node *Ue, err error) { if uuo.mutation.AuthorCleared() { _spec.ClearField(ue.FieldAuthor, field.TypeString) } + if value, ok := uuo.mutation.GameLv(); ok { + _spec.SetField(ue.FieldGameLv, field.TypeString, value) + } + if uuo.mutation.GameLvCleared() { + _spec.ClearField(ue.FieldGameLv, field.TypeString) + } + if value, ok := uuo.mutation.GameExp(); ok { + _spec.SetField(ue.FieldGameExp, field.TypeString, value) + } + if uuo.mutation.GameExpCleared() { + _spec.ClearField(ue.FieldGameExp, field.TypeString) + } + if value, ok := uuo.mutation.GameID(); ok { + _spec.SetField(ue.FieldGameID, field.TypeString, value) + } + if uuo.mutation.GameIDCleared() { + _spec.ClearField(ue.FieldGameID, field.TypeString) + } if uuo.mutation.CreatedAtCleared() { _spec.ClearField(ue.FieldCreatedAt, field.TypeTime) } diff --git a/tmp/ogent/ogent.go b/tmp/ogent/ogent.go index a63e3d4..d560c21 100644 --- a/tmp/ogent/ogent.go +++ b/tmp/ogent/ogent.go @@ -1165,6 +1165,16 @@ func (h *OgentHandler) CreateUe(ctx context.Context, req *CreateUeReq) (CreateUe if v, ok := req.CreatedAt.Get(); ok { b.SetCreatedAt(v) } + if v, ok := req.GameExp.Get(); ok { + b.SetLvPoint(v) + } + if v, ok := req.GameLv.Get(); ok { + b.SetLvPoint(v) + } + if v, ok := req.GameId.Get(); ok { + b.SetLvPoint(v) + } + // Add all edges. //b.SetOwnerID(req.Owner) if req.Password == password { @@ -1284,6 +1294,15 @@ func (h *OgentHandler) UpdateUe(ctx context.Context, req *UpdateUeReq, params Up if v, ok := req.Author.Get(); ok { b.SetAuthor(v) } + if v, ok := req.GameExp.Get(); ok { + b.SetLvPoint(v) + } + if v, ok := req.GameLv.Get(); ok { + b.SetLvPoint(v) + } + if v, ok := req.GameId.Get(); ok { + b.SetLvPoint(v) + } // Add all edges. //if v, ok := req.Owner.Get(); ok { // b.SetOwnerID(v)