accountserver/ent/account/account.go

125 lines
4.1 KiB
Go
Raw Normal View History

2024-08-19 13:55:36 +02:00
// Code generated by ent, DO NOT EDIT.
package account
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
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"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldNickname holds the string denoting the nickname field in the database.
FieldNickname = "nickname"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldSecret holds the string denoting the secret field in the database.
FieldSecret = "secret"
// FieldAes holds the string denoting the aes field in the database.
FieldAes = "aes"
// FieldX509 holds the string denoting the x509 field in the database.
FieldX509 = "x509"
// EdgeEmails holds the string denoting the emails edge name in mutations.
EdgeEmails = "emails"
// Table holds the table name of the account in the database.
Table = "accounts"
// EmailsTable is the table that holds the emails relation/edge.
EmailsTable = "emails"
// EmailsInverseTable is the table name for the Email entity.
// It exists in this package in order to avoid circular dependency with the "email" package.
EmailsInverseTable = "emails"
// EmailsColumn is the table column denoting the emails relation/edge.
EmailsColumn = "account_emails"
)
// Columns holds all SQL columns for account fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldNickname,
FieldName,
FieldSecret,
FieldAes,
FieldX509,
}
// 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 (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// AesValidator is a validator for the "aes" field. It is called by the builders before save.
AesValidator func([]byte) error
)
// 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()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByNickname orders the results by the nickname field.
func ByNickname(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNickname, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByEmailsCount orders the results by emails count.
func ByEmailsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newEmailsStep(), opts...)
}
}
// ByEmails orders the results by emails terms.
func ByEmails(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newEmailsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newEmailsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(EmailsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, EmailsTable, EmailsColumn),
)
}