Files
csgowtfd/ent/spray/spray.go

86 lines
2.6 KiB
Go

// Code generated by ent, DO NOT EDIT.
package spray
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the spray type in the database.
Label = "spray"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldWeapon holds the string denoting the weapon field in the database.
FieldWeapon = "weapon"
// FieldSpray holds the string denoting the spray field in the database.
FieldSpray = "spray"
// EdgeMatchPlayers holds the string denoting the match_players edge name in mutations.
EdgeMatchPlayers = "match_players"
// Table holds the table name of the spray in the database.
Table = "sprays"
// MatchPlayersTable is the table that holds the match_players relation/edge.
MatchPlayersTable = "sprays"
// MatchPlayersInverseTable is the table name for the MatchPlayer entity.
// It exists in this package in order to avoid circular dependency with the "matchplayer" package.
MatchPlayersInverseTable = "match_players"
// MatchPlayersColumn is the table column denoting the match_players relation/edge.
MatchPlayersColumn = "match_player_spray"
)
// Columns holds all SQL columns for spray fields.
var Columns = []string{
FieldID,
FieldWeapon,
FieldSpray,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "sprays"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"match_player_spray",
}
// 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 Spray 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()
}
// ByWeapon orders the results by the weapon field.
func ByWeapon(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldWeapon, opts...).ToFunc()
}
// ByMatchPlayersField orders the results by match_players field.
func ByMatchPlayersField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newMatchPlayersStep(), sql.OrderByField(field, opts...))
}
}
func newMatchPlayersStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(MatchPlayersInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayersTable, MatchPlayersColumn),
)
}