Files
csgowtfd/ent/weapon/weapon.go

107 lines
3.2 KiB
Go

// Code generated by ent, DO NOT EDIT.
package weapon
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the weapon type in the database.
Label = "weapon"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldVictim holds the string denoting the victim field in the database.
FieldVictim = "victim"
// FieldDmg holds the string denoting the dmg field in the database.
FieldDmg = "dmg"
// FieldEqType holds the string denoting the eq_type field in the database.
FieldEqType = "eq_type"
// FieldHitGroup holds the string denoting the hit_group field in the database.
FieldHitGroup = "hit_group"
// EdgeStat holds the string denoting the stat edge name in mutations.
EdgeStat = "stat"
// Table holds the table name of the weapon in the database.
Table = "weapons"
// StatTable is the table that holds the stat relation/edge.
StatTable = "weapons"
// StatInverseTable is the table name for the MatchPlayer entity.
// It exists in this package in order to avoid circular dependency with the "matchplayer" package.
StatInverseTable = "match_players"
// StatColumn is the table column denoting the stat relation/edge.
StatColumn = "match_player_weapon_stats"
)
// Columns holds all SQL columns for weapon fields.
var Columns = []string{
FieldID,
FieldVictim,
FieldDmg,
FieldEqType,
FieldHitGroup,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "weapons"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"match_player_weapon_stats",
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}
// OrderOption defines the ordering options for the Weapon queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByVictim orders the results by the victim field.
func ByVictim(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVictim, opts...).ToFunc()
}
// ByDmg orders the results by the dmg field.
func ByDmg(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDmg, opts...).ToFunc()
}
// ByEqType orders the results by the eq_type field.
func ByEqType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEqType, opts...).ToFunc()
}
// ByHitGroup orders the results by the hit_group field.
func ByHitGroup(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldHitGroup, opts...).ToFunc()
}
// ByStatField orders the results by stat field.
func ByStatField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newStatStep(), sql.OrderByField(field, opts...))
}
}
func newStatStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(StatInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, StatTable, StatColumn),
)
}