added spray patterns
This commit is contained in:
169
ent/weapon.go
Normal file
169
ent/weapon.go
Normal file
@@ -0,0 +1,169 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/weapon"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// Weapon is the model entity for the Weapon schema.
|
||||
type Weapon struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// Victim holds the value of the "victim" field.
|
||||
Victim uint64 `json:"victim,omitempty"`
|
||||
// Dmg holds the value of the "dmg" field.
|
||||
Dmg uint `json:"dmg,omitempty"`
|
||||
// EqType holds the value of the "eq_type" field.
|
||||
EqType int `json:"eq_type,omitempty"`
|
||||
// HitGroup holds the value of the "hit_group" field.
|
||||
HitGroup int `json:"hit_group,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the WeaponQuery when eager-loading is set.
|
||||
Edges WeaponEdges `json:"edges"`
|
||||
match_player_weapon_stats *int
|
||||
}
|
||||
|
||||
// WeaponEdges holds the relations/edges for other nodes in the graph.
|
||||
type WeaponEdges struct {
|
||||
// Stat holds the value of the stat edge.
|
||||
Stat *MatchPlayer `json:"stat,omitempty"`
|
||||
// loadedTypes holds the information for reporting if a
|
||||
// type was loaded (or requested) in eager-loading or not.
|
||||
loadedTypes [1]bool
|
||||
}
|
||||
|
||||
// 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 {
|
||||
// The edge stat was loaded in eager-loading,
|
||||
// but was not found.
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
return e.Stat, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "stat"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Weapon) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case weapon.FieldID, weapon.FieldVictim, weapon.FieldDmg, weapon.FieldEqType, weapon.FieldHitGroup:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case weapon.ForeignKeys[0]: // match_player_weapon_stats
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Weapon", columns[i])
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Weapon fields.
|
||||
func (w *Weapon) assignValues(columns []string, values []interface{}) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case weapon.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
w.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)
|
||||
}
|
||||
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)
|
||||
}
|
||||
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)
|
||||
}
|
||||
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)
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// QueryStat queries the "stat" edge of the Weapon entity.
|
||||
func (w *Weapon) QueryStat() *MatchPlayerQuery {
|
||||
return (&WeaponClient{config: w.config}).QueryStat(w)
|
||||
}
|
||||
|
||||
// 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 (&WeaponClient{config: w.config}).UpdateOne(w)
|
||||
}
|
||||
|
||||
// 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)
|
||||
if !ok {
|
||||
panic("ent: Weapon is not a transactional entity")
|
||||
}
|
||||
w.config.driver = tx.drv
|
||||
return w
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (w *Weapon) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Weapon(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v", w.ID))
|
||||
builder.WriteString(", victim=")
|
||||
builder.WriteString(fmt.Sprintf("%v", w.Victim))
|
||||
builder.WriteString(", dmg=")
|
||||
builder.WriteString(fmt.Sprintf("%v", w.Dmg))
|
||||
builder.WriteString(", eq_type=")
|
||||
builder.WriteString(fmt.Sprintf("%v", w.EqType))
|
||||
builder.WriteString(", hit_group=")
|
||||
builder.WriteString(fmt.Sprintf("%v", w.HitGroup))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// Weapons is a parsable slice of Weapon.
|
||||
type Weapons []*Weapon
|
||||
|
||||
func (w Weapons) config(cfg config) {
|
||||
for _i := range w {
|
||||
w[_i].config = cfg
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user