regenerate ent

This commit is contained in:
2025-10-26 05:09:47 +01:00
parent 5358d9dd0f
commit ab8b0b983c
46 changed files with 6050 additions and 5607 deletions

View File

@@ -44,12 +44,10 @@ type WeaponEdges struct {
// StatOrErr returns the Stat value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e WeaponEdges) StatOrErr() (*MatchPlayer, error) {
if e.loadedTypes[0] {
if e.Stat == nil {
// Edge was loaded but was not found.
return nil, &NotFoundError{label: matchplayer.Label}
}
if e.Stat != nil {
return e.Stat, nil
} else if e.loadedTypes[0] {
return nil, &NotFoundError{label: matchplayer.Label}
}
return nil, &NotLoadedError{edge: "stat"}
}
@@ -72,7 +70,7 @@ func (*Weapon) scanValues(columns []string) ([]any, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Weapon fields.
func (w *Weapon) assignValues(columns []string, values []any) error {
func (_m *Weapon) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
@@ -83,40 +81,40 @@ func (w *Weapon) assignValues(columns []string, values []any) error {
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
w.ID = int(value.Int64)
_m.ID = int(value.Int64)
case weapon.FieldVictim:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field victim", values[i])
} else if value.Valid {
w.Victim = uint64(value.Int64)
_m.Victim = uint64(value.Int64)
}
case weapon.FieldDmg:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field dmg", values[i])
} else if value.Valid {
w.Dmg = uint(value.Int64)
_m.Dmg = uint(value.Int64)
}
case weapon.FieldEqType:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field eq_type", values[i])
} else if value.Valid {
w.EqType = int(value.Int64)
_m.EqType = int(value.Int64)
}
case weapon.FieldHitGroup:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field hit_group", values[i])
} else if value.Valid {
w.HitGroup = int(value.Int64)
_m.HitGroup = int(value.Int64)
}
case weapon.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for edge-field match_player_weapon_stats", value)
} else if value.Valid {
w.match_player_weapon_stats = new(int)
*w.match_player_weapon_stats = int(value.Int64)
_m.match_player_weapon_stats = new(int)
*_m.match_player_weapon_stats = int(value.Int64)
}
default:
w.selectValues.Set(columns[i], values[i])
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
@@ -124,49 +122,49 @@ func (w *Weapon) assignValues(columns []string, values []any) error {
// Value returns the ent.Value that was dynamically selected and assigned to the Weapon.
// This includes values selected through modifiers, order, etc.
func (w *Weapon) Value(name string) (ent.Value, error) {
return w.selectValues.Get(name)
func (_m *Weapon) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// QueryStat queries the "stat" edge of the Weapon entity.
func (w *Weapon) QueryStat() *MatchPlayerQuery {
return NewWeaponClient(w.config).QueryStat(w)
func (_m *Weapon) QueryStat() *MatchPlayerQuery {
return NewWeaponClient(_m.config).QueryStat(_m)
}
// Update returns a builder for updating this Weapon.
// Note that you need to call Weapon.Unwrap() before calling this method if this Weapon
// was returned from a transaction, and the transaction was committed or rolled back.
func (w *Weapon) Update() *WeaponUpdateOne {
return NewWeaponClient(w.config).UpdateOne(w)
func (_m *Weapon) Update() *WeaponUpdateOne {
return NewWeaponClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Weapon entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (w *Weapon) Unwrap() *Weapon {
_tx, ok := w.config.driver.(*txDriver)
func (_m *Weapon) Unwrap() *Weapon {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Weapon is not a transactional entity")
}
w.config.driver = _tx.drv
return w
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (w *Weapon) String() string {
func (_m *Weapon) String() string {
var builder strings.Builder
builder.WriteString("Weapon(")
builder.WriteString(fmt.Sprintf("id=%v, ", w.ID))
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("victim=")
builder.WriteString(fmt.Sprintf("%v", w.Victim))
builder.WriteString(fmt.Sprintf("%v", _m.Victim))
builder.WriteString(", ")
builder.WriteString("dmg=")
builder.WriteString(fmt.Sprintf("%v", w.Dmg))
builder.WriteString(fmt.Sprintf("%v", _m.Dmg))
builder.WriteString(", ")
builder.WriteString("eq_type=")
builder.WriteString(fmt.Sprintf("%v", w.EqType))
builder.WriteString(fmt.Sprintf("%v", _m.EqType))
builder.WriteString(", ")
builder.WriteString("hit_group=")
builder.WriteString(fmt.Sprintf("%v", w.HitGroup))
builder.WriteString(fmt.Sprintf("%v", _m.HitGroup))
builder.WriteByte(')')
return builder.String()
}