102 lines
3.2 KiB
Go
102 lines
3.2 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 user
|
|
|
|
import (
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the user type in the database.
|
|
Label = "user"
|
|
// 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"
|
|
// FieldFirstName holds the string denoting the first_name field in the database.
|
|
FieldFirstName = "first_name"
|
|
// FieldLastName holds the string denoting the last_name field in the database.
|
|
FieldLastName = "last_name"
|
|
// FieldTags holds the string denoting the tags field in the database.
|
|
FieldTags = "tags"
|
|
// EdgeCards holds the string denoting the cards edge name in mutations.
|
|
EdgeCards = "cards"
|
|
// Table holds the table name of the user in the database.
|
|
Table = "users"
|
|
// CardsTable is the table that holds the cards relation/edge.
|
|
CardsTable = "cards"
|
|
// CardsInverseTable is the table name for the Card entity.
|
|
// It exists in this package in order to avoid circular dependency with the "card" package.
|
|
CardsInverseTable = "cards"
|
|
// CardsColumn is the table column denoting the cards relation/edge.
|
|
CardsColumn = "owner_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for user fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldAge,
|
|
FieldFirstName,
|
|
FieldLastName,
|
|
FieldTags,
|
|
}
|
|
|
|
// 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
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// OrderOption defines the ordering options for the User 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()
|
|
}
|
|
|
|
// ByFirstName orders the results by the first_name field.
|
|
func ByFirstName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldFirstName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByLastName orders the results by the last_name field.
|
|
func ByLastName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldLastName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCardsCount orders the results by cards count.
|
|
func ByCardsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newCardsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByCards orders the results by cards terms.
|
|
func ByCards(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newCardsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
func newCardsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(CardsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, CardsTable, CardsColumn),
|
|
)
|
|
}
|