160 lines
5.0 KiB
Go
160 lines
5.0 KiB
Go
// Copyright 2019-present Facebook Inc. All rights reserved.
|
|
// This source code is licensed under the Apache 2.0 license found
|
|
// in the LICENSE file in the root directory of this source tree.
|
|
|
|
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package pet
|
|
|
|
import (
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the pet type in the database.
|
|
Label = "pet"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldAge holds the string denoting the age field in the database.
|
|
FieldAge = "age"
|
|
// FieldName holds the string denoting the name field in the database.
|
|
FieldName = "name"
|
|
// FieldUUID holds the string denoting the uuid field in the database.
|
|
FieldUUID = "uuid"
|
|
// FieldNickname holds the string denoting the nickname field in the database.
|
|
FieldNickname = "nickname"
|
|
// FieldTrained holds the string denoting the trained field in the database.
|
|
FieldTrained = "trained"
|
|
// FieldOptionalTime holds the string denoting the optional_time field in the database.
|
|
FieldOptionalTime = "optional_time"
|
|
// EdgeTeam holds the string denoting the team edge name in mutations.
|
|
EdgeTeam = "team"
|
|
// EdgeOwner holds the string denoting the owner edge name in mutations.
|
|
EdgeOwner = "owner"
|
|
// Table holds the table name of the pet in the database.
|
|
Table = "pet"
|
|
// TeamTable is the table that holds the team relation/edge.
|
|
TeamTable = "pet"
|
|
// TeamInverseTable is the table name for the User entity.
|
|
// It exists in this package in order to avoid circular dependency with the "user" package.
|
|
TeamInverseTable = "users"
|
|
// TeamColumn is the table column denoting the team relation/edge.
|
|
TeamColumn = "user_team"
|
|
// OwnerTable is the table that holds the owner relation/edge.
|
|
OwnerTable = "pet"
|
|
// OwnerInverseTable is the table name for the User entity.
|
|
// It exists in this package in order to avoid circular dependency with the "user" package.
|
|
OwnerInverseTable = "users"
|
|
// OwnerColumn is the table column denoting the owner relation/edge.
|
|
OwnerColumn = "user_pets"
|
|
)
|
|
|
|
// Columns holds all SQL columns for pet fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldAge,
|
|
FieldName,
|
|
FieldUUID,
|
|
FieldNickname,
|
|
FieldTrained,
|
|
FieldOptionalTime,
|
|
}
|
|
|
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "pet"
|
|
// table and are not defined as standalone fields in the schema.
|
|
var ForeignKeys = []string{
|
|
"user_pets",
|
|
"user_team",
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
var (
|
|
// DefaultAge holds the default value on creation for the "age" field.
|
|
DefaultAge float64
|
|
// DefaultTrained holds the default value on creation for the "trained" field.
|
|
DefaultTrained bool
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Pet 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()
|
|
}
|
|
|
|
// ByAge orders the results by the age field.
|
|
func ByAge(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldAge, opts...).ToFunc()
|
|
}
|
|
|
|
// ByName orders the results by the name field.
|
|
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUUID orders the results by the uuid field.
|
|
func ByUUID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUUID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByNickname orders the results by the nickname field.
|
|
func ByNickname(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldNickname, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTrained orders the results by the trained field.
|
|
func ByTrained(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTrained, opts...).ToFunc()
|
|
}
|
|
|
|
// ByOptionalTime orders the results by the optional_time field.
|
|
func ByOptionalTime(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldOptionalTime, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTeamField orders the results by team field.
|
|
func ByTeamField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newTeamStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
|
|
// ByOwnerField orders the results by owner field.
|
|
func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
func newTeamStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2O, true, TeamTable, TeamColumn),
|
|
)
|
|
}
|
|
func newOwnerStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(OwnerInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
|
|
)
|
|
}
|
|
|
|
// comment from another template.
|