1
0

fix planet float

This commit is contained in:
2024-08-01 07:01:19 +09:00
parent 4c0c396086
commit 9222892c61
14 changed files with 553 additions and 110 deletions

View File

@@ -7642,8 +7642,8 @@ type UserMutation struct {
addcoin *int
coin_open *bool
coin_at *time.Time
planet *int
addplanet *int
planet *float64
addplanet *float64
planet_at *time.Time
login *bool
login_at *time.Time
@@ -10721,13 +10721,13 @@ func (m *UserMutation) ResetCoinAt() {
}
// SetPlanet sets the "planet" field.
func (m *UserMutation) SetPlanet(i int) {
m.planet = &i
func (m *UserMutation) SetPlanet(f float64) {
m.planet = &f
m.addplanet = nil
}
// Planet returns the value of the "planet" field in the mutation.
func (m *UserMutation) Planet() (r int, exists bool) {
func (m *UserMutation) Planet() (r float64, exists bool) {
v := m.planet
if v == nil {
return
@@ -10738,7 +10738,7 @@ func (m *UserMutation) Planet() (r int, exists bool) {
// OldPlanet returns the old "planet" 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) OldPlanet(ctx context.Context) (v int, err error) {
func (m *UserMutation) OldPlanet(ctx context.Context) (v float64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldPlanet is only allowed on UpdateOne operations")
}
@@ -10752,17 +10752,17 @@ func (m *UserMutation) OldPlanet(ctx context.Context) (v int, err error) {
return oldValue.Planet, nil
}
// AddPlanet adds i to the "planet" field.
func (m *UserMutation) AddPlanet(i int) {
// AddPlanet adds f to the "planet" field.
func (m *UserMutation) AddPlanet(f float64) {
if m.addplanet != nil {
*m.addplanet += i
*m.addplanet += f
} else {
m.addplanet = &i
m.addplanet = &f
}
}
// AddedPlanet returns the value that was added to the "planet" field in this mutation.
func (m *UserMutation) AddedPlanet() (r int, exists bool) {
func (m *UserMutation) AddedPlanet() (r float64, exists bool) {
v := m.addplanet
if v == nil {
return
@@ -12293,7 +12293,7 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
m.SetCoinAt(v)
return nil
case user.FieldPlanet:
v, ok := value.(int)
v, ok := value.(float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
@@ -12615,7 +12615,7 @@ func (m *UserMutation) AddField(name string, value ent.Value) error {
m.AddCoin(v)
return nil
case user.FieldPlanet:
v, ok := value.(int)
v, ok := value.(float64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}