added roundstats with eco info, switched to avatar hash
This commit is contained in:
169
ent/roundstats.go
Normal file
169
ent/roundstats.go
Normal file
@@ -0,0 +1,169 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/roundstats"
|
||||
"csgowtfd/ent/stats"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// RoundStats is the model entity for the RoundStats schema.
|
||||
type RoundStats struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// Round holds the value of the "round" field.
|
||||
Round uint `json:"round,omitempty"`
|
||||
// Bank holds the value of the "bank" field.
|
||||
Bank uint `json:"bank,omitempty"`
|
||||
// Equipment holds the value of the "equipment" field.
|
||||
Equipment uint `json:"equipment,omitempty"`
|
||||
// Spent holds the value of the "spent" field.
|
||||
Spent uint `json:"spent,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the RoundStatsQuery when eager-loading is set.
|
||||
Edges RoundStatsEdges `json:"edges"`
|
||||
stats_round_stats *int
|
||||
}
|
||||
|
||||
// RoundStatsEdges holds the relations/edges for other nodes in the graph.
|
||||
type RoundStatsEdges struct {
|
||||
// Stat holds the value of the stat edge.
|
||||
Stat *Stats `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 RoundStatsEdges) StatOrErr() (*Stats, 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: stats.Label}
|
||||
}
|
||||
return e.Stat, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "stat"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*RoundStats) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case roundstats.FieldID, roundstats.FieldRound, roundstats.FieldBank, roundstats.FieldEquipment, roundstats.FieldSpent:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case roundstats.ForeignKeys[0]: // stats_round_stats
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type RoundStats", columns[i])
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the RoundStats fields.
|
||||
func (rs *RoundStats) 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 roundstats.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
rs.ID = int(value.Int64)
|
||||
case roundstats.FieldRound:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field round", values[i])
|
||||
} else if value.Valid {
|
||||
rs.Round = uint(value.Int64)
|
||||
}
|
||||
case roundstats.FieldBank:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field bank", values[i])
|
||||
} else if value.Valid {
|
||||
rs.Bank = uint(value.Int64)
|
||||
}
|
||||
case roundstats.FieldEquipment:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field equipment", values[i])
|
||||
} else if value.Valid {
|
||||
rs.Equipment = uint(value.Int64)
|
||||
}
|
||||
case roundstats.FieldSpent:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field spent", values[i])
|
||||
} else if value.Valid {
|
||||
rs.Spent = uint(value.Int64)
|
||||
}
|
||||
case roundstats.ForeignKeys[0]:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for edge-field stats_round_stats", value)
|
||||
} else if value.Valid {
|
||||
rs.stats_round_stats = new(int)
|
||||
*rs.stats_round_stats = int(value.Int64)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// QueryStat queries the "stat" edge of the RoundStats entity.
|
||||
func (rs *RoundStats) QueryStat() *StatsQuery {
|
||||
return (&RoundStatsClient{config: rs.config}).QueryStat(rs)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this RoundStats.
|
||||
// Note that you need to call RoundStats.Unwrap() before calling this method if this RoundStats
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (rs *RoundStats) Update() *RoundStatsUpdateOne {
|
||||
return (&RoundStatsClient{config: rs.config}).UpdateOne(rs)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the RoundStats 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 (rs *RoundStats) Unwrap() *RoundStats {
|
||||
tx, ok := rs.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: RoundStats is not a transactional entity")
|
||||
}
|
||||
rs.config.driver = tx.drv
|
||||
return rs
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (rs *RoundStats) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("RoundStats(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v", rs.ID))
|
||||
builder.WriteString(", round=")
|
||||
builder.WriteString(fmt.Sprintf("%v", rs.Round))
|
||||
builder.WriteString(", bank=")
|
||||
builder.WriteString(fmt.Sprintf("%v", rs.Bank))
|
||||
builder.WriteString(", equipment=")
|
||||
builder.WriteString(fmt.Sprintf("%v", rs.Equipment))
|
||||
builder.WriteString(", spent=")
|
||||
builder.WriteString(fmt.Sprintf("%v", rs.Spent))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// RoundStatsSlice is a parsable slice of RoundStats.
|
||||
type RoundStatsSlice []*RoundStats
|
||||
|
||||
func (rs RoundStatsSlice) config(cfg config) {
|
||||
for _i := range rs {
|
||||
rs[_i].config = cfg
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user