fix game story
This commit is contained in:
364
ent/mutation.go
364
ent/mutation.go
@@ -5117,6 +5117,9 @@ type UeMutation struct {
|
||||
game_lv *string
|
||||
game_exp *string
|
||||
game_id *string
|
||||
game_story *int
|
||||
addgame_story *int
|
||||
game_ep *string
|
||||
created_at *time.Time
|
||||
clearedFields map[string]struct{}
|
||||
owner *int
|
||||
@@ -6471,6 +6474,125 @@ func (m *UeMutation) ResetGameID() {
|
||||
delete(m.clearedFields, ue.FieldGameID)
|
||||
}
|
||||
|
||||
// SetGameStory sets the "game_story" field.
|
||||
func (m *UeMutation) SetGameStory(i int) {
|
||||
m.game_story = &i
|
||||
m.addgame_story = nil
|
||||
}
|
||||
|
||||
// GameStory returns the value of the "game_story" field in the mutation.
|
||||
func (m *UeMutation) GameStory() (r int, exists bool) {
|
||||
v := m.game_story
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldGameStory returns the old "game_story" 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) OldGameStory(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldGameStory is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldGameStory requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldGameStory: %w", err)
|
||||
}
|
||||
return oldValue.GameStory, nil
|
||||
}
|
||||
|
||||
// AddGameStory adds i to the "game_story" field.
|
||||
func (m *UeMutation) AddGameStory(i int) {
|
||||
if m.addgame_story != nil {
|
||||
*m.addgame_story += i
|
||||
} else {
|
||||
m.addgame_story = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedGameStory returns the value that was added to the "game_story" field in this mutation.
|
||||
func (m *UeMutation) AddedGameStory() (r int, exists bool) {
|
||||
v := m.addgame_story
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ClearGameStory clears the value of the "game_story" field.
|
||||
func (m *UeMutation) ClearGameStory() {
|
||||
m.game_story = nil
|
||||
m.addgame_story = nil
|
||||
m.clearedFields[ue.FieldGameStory] = struct{}{}
|
||||
}
|
||||
|
||||
// GameStoryCleared returns if the "game_story" field was cleared in this mutation.
|
||||
func (m *UeMutation) GameStoryCleared() bool {
|
||||
_, ok := m.clearedFields[ue.FieldGameStory]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetGameStory resets all changes to the "game_story" field.
|
||||
func (m *UeMutation) ResetGameStory() {
|
||||
m.game_story = nil
|
||||
m.addgame_story = nil
|
||||
delete(m.clearedFields, ue.FieldGameStory)
|
||||
}
|
||||
|
||||
// SetGameEp sets the "game_ep" field.
|
||||
func (m *UeMutation) SetGameEp(s string) {
|
||||
m.game_ep = &s
|
||||
}
|
||||
|
||||
// GameEp returns the value of the "game_ep" field in the mutation.
|
||||
func (m *UeMutation) GameEp() (r string, exists bool) {
|
||||
v := m.game_ep
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldGameEp returns the old "game_ep" 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) OldGameEp(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldGameEp is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldGameEp requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldGameEp: %w", err)
|
||||
}
|
||||
return oldValue.GameEp, nil
|
||||
}
|
||||
|
||||
// ClearGameEp clears the value of the "game_ep" field.
|
||||
func (m *UeMutation) ClearGameEp() {
|
||||
m.game_ep = nil
|
||||
m.clearedFields[ue.FieldGameEp] = struct{}{}
|
||||
}
|
||||
|
||||
// GameEpCleared returns if the "game_ep" field was cleared in this mutation.
|
||||
func (m *UeMutation) GameEpCleared() bool {
|
||||
_, ok := m.clearedFields[ue.FieldGameEp]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetGameEp resets all changes to the "game_ep" field.
|
||||
func (m *UeMutation) ResetGameEp() {
|
||||
m.game_ep = nil
|
||||
delete(m.clearedFields, ue.FieldGameEp)
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (m *UeMutation) SetCreatedAt(t time.Time) {
|
||||
m.created_at = &t
|
||||
@@ -6593,7 +6715,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, 22)
|
||||
fields := make([]string, 0, 24)
|
||||
if m._limit != nil {
|
||||
fields = append(fields, ue.FieldLimit)
|
||||
}
|
||||
@@ -6657,6 +6779,12 @@ func (m *UeMutation) Fields() []string {
|
||||
if m.game_id != nil {
|
||||
fields = append(fields, ue.FieldGameID)
|
||||
}
|
||||
if m.game_story != nil {
|
||||
fields = append(fields, ue.FieldGameStory)
|
||||
}
|
||||
if m.game_ep != nil {
|
||||
fields = append(fields, ue.FieldGameEp)
|
||||
}
|
||||
if m.created_at != nil {
|
||||
fields = append(fields, ue.FieldCreatedAt)
|
||||
}
|
||||
@@ -6710,6 +6838,10 @@ func (m *UeMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.GameExp()
|
||||
case ue.FieldGameID:
|
||||
return m.GameID()
|
||||
case ue.FieldGameStory:
|
||||
return m.GameStory()
|
||||
case ue.FieldGameEp:
|
||||
return m.GameEp()
|
||||
case ue.FieldCreatedAt:
|
||||
return m.CreatedAt()
|
||||
}
|
||||
@@ -6763,6 +6895,10 @@ func (m *UeMutation) OldField(ctx context.Context, name string) (ent.Value, erro
|
||||
return m.OldGameExp(ctx)
|
||||
case ue.FieldGameID:
|
||||
return m.OldGameID(ctx)
|
||||
case ue.FieldGameStory:
|
||||
return m.OldGameStory(ctx)
|
||||
case ue.FieldGameEp:
|
||||
return m.OldGameEp(ctx)
|
||||
case ue.FieldCreatedAt:
|
||||
return m.OldCreatedAt(ctx)
|
||||
}
|
||||
@@ -6921,6 +7057,20 @@ func (m *UeMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetGameID(v)
|
||||
return nil
|
||||
case ue.FieldGameStory:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetGameStory(v)
|
||||
return nil
|
||||
case ue.FieldGameEp:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetGameEp(v)
|
||||
return nil
|
||||
case ue.FieldCreatedAt:
|
||||
v, ok := value.(time.Time)
|
||||
if !ok {
|
||||
@@ -6969,6 +7119,9 @@ func (m *UeMutation) AddedFields() []string {
|
||||
if m.addlocation_n != nil {
|
||||
fields = append(fields, ue.FieldLocationN)
|
||||
}
|
||||
if m.addgame_story != nil {
|
||||
fields = append(fields, ue.FieldGameStory)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -6999,6 +7152,8 @@ func (m *UeMutation) AddedField(name string) (ent.Value, bool) {
|
||||
return m.AddedLocationZ()
|
||||
case ue.FieldLocationN:
|
||||
return m.AddedLocationN()
|
||||
case ue.FieldGameStory:
|
||||
return m.AddedGameStory()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -7085,6 +7240,13 @@ func (m *UeMutation) AddField(name string, value ent.Value) error {
|
||||
}
|
||||
m.AddLocationN(v)
|
||||
return nil
|
||||
case ue.FieldGameStory:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddGameStory(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Ue numeric field %s", name)
|
||||
}
|
||||
@@ -7153,6 +7315,12 @@ func (m *UeMutation) ClearedFields() []string {
|
||||
if m.FieldCleared(ue.FieldGameID) {
|
||||
fields = append(fields, ue.FieldGameID)
|
||||
}
|
||||
if m.FieldCleared(ue.FieldGameStory) {
|
||||
fields = append(fields, ue.FieldGameStory)
|
||||
}
|
||||
if m.FieldCleared(ue.FieldGameEp) {
|
||||
fields = append(fields, ue.FieldGameEp)
|
||||
}
|
||||
if m.FieldCleared(ue.FieldCreatedAt) {
|
||||
fields = append(fields, ue.FieldCreatedAt)
|
||||
}
|
||||
@@ -7230,6 +7398,12 @@ func (m *UeMutation) ClearField(name string) error {
|
||||
case ue.FieldGameID:
|
||||
m.ClearGameID()
|
||||
return nil
|
||||
case ue.FieldGameStory:
|
||||
m.ClearGameStory()
|
||||
return nil
|
||||
case ue.FieldGameEp:
|
||||
m.ClearGameEp()
|
||||
return nil
|
||||
case ue.FieldCreatedAt:
|
||||
m.ClearCreatedAt()
|
||||
return nil
|
||||
@@ -7304,6 +7478,12 @@ func (m *UeMutation) ResetField(name string) error {
|
||||
case ue.FieldGameID:
|
||||
m.ResetGameID()
|
||||
return nil
|
||||
case ue.FieldGameStory:
|
||||
m.ResetGameStory()
|
||||
return nil
|
||||
case ue.FieldGameEp:
|
||||
m.ResetGameEp()
|
||||
return nil
|
||||
case ue.FieldCreatedAt:
|
||||
m.ResetCreatedAt()
|
||||
return nil
|
||||
@@ -7455,6 +7635,9 @@ type UserMutation struct {
|
||||
addgame_lv *int
|
||||
game_exp *int
|
||||
addgame_exp *int
|
||||
game_story *int
|
||||
addgame_story *int
|
||||
game_limit *bool
|
||||
coin *int
|
||||
addcoin *int
|
||||
coin_open *bool
|
||||
@@ -10237,6 +10420,125 @@ func (m *UserMutation) ResetGameExp() {
|
||||
delete(m.clearedFields, user.FieldGameExp)
|
||||
}
|
||||
|
||||
// SetGameStory sets the "game_story" field.
|
||||
func (m *UserMutation) SetGameStory(i int) {
|
||||
m.game_story = &i
|
||||
m.addgame_story = nil
|
||||
}
|
||||
|
||||
// GameStory returns the value of the "game_story" field in the mutation.
|
||||
func (m *UserMutation) GameStory() (r int, exists bool) {
|
||||
v := m.game_story
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldGameStory returns the old "game_story" 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) OldGameStory(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldGameStory is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldGameStory requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldGameStory: %w", err)
|
||||
}
|
||||
return oldValue.GameStory, nil
|
||||
}
|
||||
|
||||
// AddGameStory adds i to the "game_story" field.
|
||||
func (m *UserMutation) AddGameStory(i int) {
|
||||
if m.addgame_story != nil {
|
||||
*m.addgame_story += i
|
||||
} else {
|
||||
m.addgame_story = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedGameStory returns the value that was added to the "game_story" field in this mutation.
|
||||
func (m *UserMutation) AddedGameStory() (r int, exists bool) {
|
||||
v := m.addgame_story
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ClearGameStory clears the value of the "game_story" field.
|
||||
func (m *UserMutation) ClearGameStory() {
|
||||
m.game_story = nil
|
||||
m.addgame_story = nil
|
||||
m.clearedFields[user.FieldGameStory] = struct{}{}
|
||||
}
|
||||
|
||||
// GameStoryCleared returns if the "game_story" field was cleared in this mutation.
|
||||
func (m *UserMutation) GameStoryCleared() bool {
|
||||
_, ok := m.clearedFields[user.FieldGameStory]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetGameStory resets all changes to the "game_story" field.
|
||||
func (m *UserMutation) ResetGameStory() {
|
||||
m.game_story = nil
|
||||
m.addgame_story = nil
|
||||
delete(m.clearedFields, user.FieldGameStory)
|
||||
}
|
||||
|
||||
// SetGameLimit sets the "game_limit" field.
|
||||
func (m *UserMutation) SetGameLimit(b bool) {
|
||||
m.game_limit = &b
|
||||
}
|
||||
|
||||
// GameLimit returns the value of the "game_limit" field in the mutation.
|
||||
func (m *UserMutation) GameLimit() (r bool, exists bool) {
|
||||
v := m.game_limit
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldGameLimit returns the old "game_limit" 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) OldGameLimit(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldGameLimit is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldGameLimit requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldGameLimit: %w", err)
|
||||
}
|
||||
return oldValue.GameLimit, nil
|
||||
}
|
||||
|
||||
// ClearGameLimit clears the value of the "game_limit" field.
|
||||
func (m *UserMutation) ClearGameLimit() {
|
||||
m.game_limit = nil
|
||||
m.clearedFields[user.FieldGameLimit] = struct{}{}
|
||||
}
|
||||
|
||||
// GameLimitCleared returns if the "game_limit" field was cleared in this mutation.
|
||||
func (m *UserMutation) GameLimitCleared() bool {
|
||||
_, ok := m.clearedFields[user.FieldGameLimit]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetGameLimit resets all changes to the "game_limit" field.
|
||||
func (m *UserMutation) ResetGameLimit() {
|
||||
m.game_limit = nil
|
||||
delete(m.clearedFields, user.FieldGameLimit)
|
||||
}
|
||||
|
||||
// SetCoin sets the "coin" field.
|
||||
func (m *UserMutation) SetCoin(i int) {
|
||||
m.coin = &i
|
||||
@@ -10655,7 +10957,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, 51)
|
||||
fields := make([]string, 0, 53)
|
||||
if m.username != nil {
|
||||
fields = append(fields, user.FieldUsername)
|
||||
}
|
||||
@@ -10800,6 +11102,12 @@ func (m *UserMutation) Fields() []string {
|
||||
if m.game_exp != nil {
|
||||
fields = append(fields, user.FieldGameExp)
|
||||
}
|
||||
if m.game_story != nil {
|
||||
fields = append(fields, user.FieldGameStory)
|
||||
}
|
||||
if m.game_limit != nil {
|
||||
fields = append(fields, user.FieldGameLimit)
|
||||
}
|
||||
if m.coin != nil {
|
||||
fields = append(fields, user.FieldCoin)
|
||||
}
|
||||
@@ -10913,6 +11221,10 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.GameLv()
|
||||
case user.FieldGameExp:
|
||||
return m.GameExp()
|
||||
case user.FieldGameStory:
|
||||
return m.GameStory()
|
||||
case user.FieldGameLimit:
|
||||
return m.GameLimit()
|
||||
case user.FieldCoin:
|
||||
return m.Coin()
|
||||
case user.FieldCoinOpen:
|
||||
@@ -11024,6 +11336,10 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er
|
||||
return m.OldGameLv(ctx)
|
||||
case user.FieldGameExp:
|
||||
return m.OldGameExp(ctx)
|
||||
case user.FieldGameStory:
|
||||
return m.OldGameStory(ctx)
|
||||
case user.FieldGameLimit:
|
||||
return m.OldGameLimit(ctx)
|
||||
case user.FieldCoin:
|
||||
return m.OldCoin(ctx)
|
||||
case user.FieldCoinOpen:
|
||||
@@ -11375,6 +11691,20 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetGameExp(v)
|
||||
return nil
|
||||
case user.FieldGameStory:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetGameStory(v)
|
||||
return nil
|
||||
case user.FieldGameLimit:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetGameLimit(v)
|
||||
return nil
|
||||
case user.FieldCoin:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
@@ -11452,6 +11782,9 @@ func (m *UserMutation) AddedFields() []string {
|
||||
if m.addgame_exp != nil {
|
||||
fields = append(fields, user.FieldGameExp)
|
||||
}
|
||||
if m.addgame_story != nil {
|
||||
fields = append(fields, user.FieldGameStory)
|
||||
}
|
||||
if m.addcoin != nil {
|
||||
fields = append(fields, user.FieldCoin)
|
||||
}
|
||||
@@ -11495,6 +11828,8 @@ func (m *UserMutation) AddedField(name string) (ent.Value, bool) {
|
||||
return m.AddedGameLv()
|
||||
case user.FieldGameExp:
|
||||
return m.AddedGameExp()
|
||||
case user.FieldGameStory:
|
||||
return m.AddedGameStory()
|
||||
case user.FieldCoin:
|
||||
return m.AddedCoin()
|
||||
}
|
||||
@@ -11618,6 +11953,13 @@ func (m *UserMutation) AddField(name string, value ent.Value) error {
|
||||
}
|
||||
m.AddGameExp(v)
|
||||
return nil
|
||||
case user.FieldGameStory:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddGameStory(v)
|
||||
return nil
|
||||
case user.FieldCoin:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
@@ -11771,6 +12113,12 @@ func (m *UserMutation) ClearedFields() []string {
|
||||
if m.FieldCleared(user.FieldGameExp) {
|
||||
fields = append(fields, user.FieldGameExp)
|
||||
}
|
||||
if m.FieldCleared(user.FieldGameStory) {
|
||||
fields = append(fields, user.FieldGameStory)
|
||||
}
|
||||
if m.FieldCleared(user.FieldGameLimit) {
|
||||
fields = append(fields, user.FieldGameLimit)
|
||||
}
|
||||
if m.FieldCleared(user.FieldCoin) {
|
||||
fields = append(fields, user.FieldCoin)
|
||||
}
|
||||
@@ -11932,6 +12280,12 @@ func (m *UserMutation) ClearField(name string) error {
|
||||
case user.FieldGameExp:
|
||||
m.ClearGameExp()
|
||||
return nil
|
||||
case user.FieldGameStory:
|
||||
m.ClearGameStory()
|
||||
return nil
|
||||
case user.FieldGameLimit:
|
||||
m.ClearGameLimit()
|
||||
return nil
|
||||
case user.FieldCoin:
|
||||
m.ClearCoin()
|
||||
return nil
|
||||
@@ -12093,6 +12447,12 @@ func (m *UserMutation) ResetField(name string) error {
|
||||
case user.FieldGameExp:
|
||||
m.ResetGameExp()
|
||||
return nil
|
||||
case user.FieldGameStory:
|
||||
m.ResetGameStory()
|
||||
return nil
|
||||
case user.FieldGameLimit:
|
||||
m.ResetGameLimit()
|
||||
return nil
|
||||
case user.FieldCoin:
|
||||
m.ResetCoin()
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user