89 lines
2.6 KiB
Go
89 lines
2.6 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package user
|
|
|
|
import (
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
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"
|
|
// FieldTelegramID holds the string denoting the telegram_id field in the database.
|
|
FieldTelegramID = "telegram_id"
|
|
// EdgeLinks holds the string denoting the links edge name in mutations.
|
|
EdgeLinks = "links"
|
|
// Table holds the table name of the user in the database.
|
|
Table = "users"
|
|
// LinksTable is the table that holds the links relation/edge. The primary key declared below.
|
|
LinksTable = "user_links"
|
|
// LinksInverseTable is the table name for the Link entity.
|
|
// It exists in this package in order to avoid circular dependency with the "link" package.
|
|
LinksInverseTable = "links"
|
|
)
|
|
|
|
// Columns holds all SQL columns for user fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldTelegramID,
|
|
}
|
|
|
|
var (
|
|
// LinksPrimaryKey and LinksColumn2 are the table columns denoting the
|
|
// primary key for the links relation (M2M).
|
|
LinksPrimaryKey = []string{"user_id", "link_id"}
|
|
)
|
|
|
|
// 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
|
|
}
|
|
|
|
var (
|
|
// DefaultID holds the default value on creation for the "id" field.
|
|
DefaultID func() uuid.UUID
|
|
)
|
|
|
|
// 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()
|
|
}
|
|
|
|
// ByTelegramID orders the results by the telegram_id field.
|
|
func ByTelegramID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTelegramID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByLinksCount orders the results by links count.
|
|
func ByLinksCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newLinksStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByLinks orders the results by links terms.
|
|
func ByLinks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newLinksStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
func newLinksStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(LinksInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, LinksTable, LinksPrimaryKey...),
|
|
)
|
|
}
|