zkt24/z2/backend/ent/whitelist/whitelist.go
2024-04-25 13:51:47 +02:00

101 lines
3.3 KiB
Go

// Code generated by ent, DO NOT EDIT.
package whitelist
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the whitelist type in the database.
Label = "white_list"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// EdgeSponsor holds the string denoting the sponsor edge name in mutations.
EdgeSponsor = "Sponsor"
// EdgeAccount holds the string denoting the account edge name in mutations.
EdgeAccount = "Account"
// Table holds the table name of the whitelist in the database.
Table = "white_lists"
// SponsorTable is the table that holds the Sponsor relation/edge.
SponsorTable = "validators"
// SponsorInverseTable is the table name for the Validators entity.
// It exists in this package in order to avoid circular dependency with the "validators" package.
SponsorInverseTable = "validators"
// SponsorColumn is the table column denoting the Sponsor relation/edge.
SponsorColumn = "white_list_sponsor"
// AccountTable is the table that holds the Account relation/edge.
AccountTable = "keys"
// AccountInverseTable is the table name for the Key entity.
// It exists in this package in order to avoid circular dependency with the "key" package.
AccountInverseTable = "keys"
// AccountColumn is the table column denoting the Account relation/edge.
AccountColumn = "white_list_account"
)
// Columns holds all SQL columns for whitelist fields.
var Columns = []string{
FieldID,
}
// 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 WhiteList 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()
}
// BySponsorCount orders the results by Sponsor count.
func BySponsorCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newSponsorStep(), opts...)
}
}
// BySponsor orders the results by Sponsor terms.
func BySponsor(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newSponsorStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByAccountCount orders the results by Account count.
func ByAccountCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newAccountStep(), opts...)
}
}
// ByAccount orders the results by Account terms.
func ByAccount(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newAccountStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newSponsorStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(SponsorInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, SponsorTable, SponsorColumn),
)
}
func newAccountStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(AccountInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, AccountTable, AccountColumn),
)
}