added spray patterns
This commit is contained in:
151
ent/spray.go
Normal file
151
ent/spray.go
Normal file
@@ -0,0 +1,151 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/spray"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// Spray is the model entity for the Spray schema.
|
||||
type Spray struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// Weapon holds the value of the "weapon" field.
|
||||
Weapon int `json:"weapon,omitempty"`
|
||||
// Spray holds the value of the "spray" field.
|
||||
Spray []byte `json:"spray,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the SprayQuery when eager-loading is set.
|
||||
Edges SprayEdges `json:"edges"`
|
||||
match_player_spray *int
|
||||
}
|
||||
|
||||
// SprayEdges holds the relations/edges for other nodes in the graph.
|
||||
type SprayEdges struct {
|
||||
// MatchPlayers holds the value of the match_players edge.
|
||||
MatchPlayers *MatchPlayer `json:"match_players,omitempty"`
|
||||
// loadedTypes holds the information for reporting if a
|
||||
// type was loaded (or requested) in eager-loading or not.
|
||||
loadedTypes [1]bool
|
||||
}
|
||||
|
||||
// MatchPlayersOrErr returns the MatchPlayers value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e SprayEdges) MatchPlayersOrErr() (*MatchPlayer, error) {
|
||||
if e.loadedTypes[0] {
|
||||
if e.MatchPlayers == nil {
|
||||
// The edge match_players was loaded in eager-loading,
|
||||
// but was not found.
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
return e.MatchPlayers, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "match_players"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Spray) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case spray.FieldSpray:
|
||||
values[i] = new([]byte)
|
||||
case spray.FieldID, spray.FieldWeapon:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case spray.ForeignKeys[0]: // match_player_spray
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Spray", columns[i])
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Spray fields.
|
||||
func (s *Spray) 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 spray.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
s.ID = int(value.Int64)
|
||||
case spray.FieldWeapon:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field weapon", values[i])
|
||||
} else if value.Valid {
|
||||
s.Weapon = int(value.Int64)
|
||||
}
|
||||
case spray.FieldSpray:
|
||||
if value, ok := values[i].(*[]byte); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field spray", values[i])
|
||||
} else if value != nil {
|
||||
s.Spray = *value
|
||||
}
|
||||
case spray.ForeignKeys[0]:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for edge-field match_player_spray", value)
|
||||
} else if value.Valid {
|
||||
s.match_player_spray = new(int)
|
||||
*s.match_player_spray = int(value.Int64)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// QueryMatchPlayers queries the "match_players" edge of the Spray entity.
|
||||
func (s *Spray) QueryMatchPlayers() *MatchPlayerQuery {
|
||||
return (&SprayClient{config: s.config}).QueryMatchPlayers(s)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Spray.
|
||||
// Note that you need to call Spray.Unwrap() before calling this method if this Spray
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (s *Spray) Update() *SprayUpdateOne {
|
||||
return (&SprayClient{config: s.config}).UpdateOne(s)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the Spray 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 (s *Spray) Unwrap() *Spray {
|
||||
tx, ok := s.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Spray is not a transactional entity")
|
||||
}
|
||||
s.config.driver = tx.drv
|
||||
return s
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (s *Spray) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Spray(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v", s.ID))
|
||||
builder.WriteString(", weapon=")
|
||||
builder.WriteString(fmt.Sprintf("%v", s.Weapon))
|
||||
builder.WriteString(", spray=")
|
||||
builder.WriteString(fmt.Sprintf("%v", s.Spray))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// Sprays is a parsable slice of Spray.
|
||||
type Sprays []*Spray
|
||||
|
||||
func (s Sprays) config(cfg config) {
|
||||
for _i := range s {
|
||||
s[_i].config = cfg
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user