manager/ent/account/account.go

159 lines
5.2 KiB
Go
Raw Normal View History

2025-02-06 09:31:49 +01:00
// Code generated by ent, DO NOT EDIT.
2022-04-08 21:26:25 +02:00
package account
import (
"time"
2025-02-06 09:31:49 +01:00
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
2022-04-08 21:26:25 +02:00
)
const (
// Label holds the string label denoting the account type in the database.
Label = "account"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreated holds the string denoting the created field in the database.
FieldCreated = "created"
// FieldModified holds the string denoting the modified field in the database.
FieldModified = "modified"
// FieldUsername holds the string denoting the username field in the database.
FieldUsername = "username"
// FieldPassword holds the string denoting the password field in the database.
FieldPassword = "password"
// FieldSuper holds the string denoting the super field in the database.
FieldSuper = "super"
// FieldActive holds the string denoting the active field in the database.
FieldActive = "active"
// EdgeDomains holds the string denoting the domains edge name in mutations.
EdgeDomains = "domains"
// EdgeLogs holds the string denoting the logs edge name in mutations.
EdgeLogs = "logs"
// Table holds the table name of the account in the database.
Table = "accounts"
// DomainsTable is the table that holds the domains relation/edge. The primary key declared below.
DomainsTable = "account_domains"
// DomainsInverseTable is the table name for the Domain entity.
// It exists in this package in order to avoid circular dependency with the "domain" package.
DomainsInverseTable = "domains"
// LogsTable is the table that holds the logs relation/edge.
LogsTable = "logentries"
// LogsInverseTable is the table name for the Logentry entity.
// It exists in this package in order to avoid circular dependency with the "logentry" package.
LogsInverseTable = "logentries"
// LogsColumn is the table column denoting the logs relation/edge.
LogsColumn = "account_id"
)
// Columns holds all SQL columns for account fields.
var Columns = []string{
FieldID,
FieldCreated,
FieldModified,
FieldUsername,
FieldPassword,
FieldSuper,
FieldActive,
}
var (
// DomainsPrimaryKey and DomainsColumn2 are the table columns denoting the
// primary key for the domains relation (M2M).
DomainsPrimaryKey = []string{"account_id", "domain_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 (
// DefaultCreated holds the default value on creation for the "created" field.
DefaultCreated func() time.Time
// DefaultModified holds the default value on creation for the "modified" field.
DefaultModified func() time.Time
// UpdateDefaultModified holds the default value on update for the "modified" field.
UpdateDefaultModified func() time.Time
)
2025-02-06 09:31:49 +01:00
// OrderOption defines the ordering options for the Account 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()
}
// ByCreated orders the results by the created field.
func ByCreated(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreated, opts...).ToFunc()
}
// ByModified orders the results by the modified field.
func ByModified(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldModified, opts...).ToFunc()
}
// ByUsername orders the results by the username field.
func ByUsername(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUsername, opts...).ToFunc()
}
// BySuper orders the results by the super field.
func BySuper(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSuper, opts...).ToFunc()
}
// ByActive orders the results by the active field.
func ByActive(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldActive, opts...).ToFunc()
}
// ByDomainsCount orders the results by domains count.
func ByDomainsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newDomainsStep(), opts...)
}
}
// ByDomains orders the results by domains terms.
func ByDomains(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newDomainsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByLogsCount orders the results by logs count.
func ByLogsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newLogsStep(), opts...)
}
}
// ByLogs orders the results by logs terms.
func ByLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newLogsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newDomainsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(DomainsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, DomainsTable, DomainsPrimaryKey...),
)
}
func newLogsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(LogsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, LogsTable, LogsColumn),
)
}