accountserver/ent/email/email.go

122 lines
3.9 KiB
Go
Raw Normal View History

2024-08-19 13:55:36 +02:00
// Code generated by ent, DO NOT EDIT.
package email
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the email type in the database.
Label = "email"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldEmail holds the string denoting the email field in the database.
FieldEmail = "email"
// FieldPrimary holds the string denoting the primary field in the database.
FieldPrimary = "primary"
// FieldVerified holds the string denoting the verified field in the database.
FieldVerified = "verified"
// FieldVerificationCode holds the string denoting the verification_code field in the database.
FieldVerificationCode = "verification_code"
// FieldResetCode holds the string denoting the reset_code field in the database.
FieldResetCode = "reset_code"
2024-09-03 15:56:34 +02:00
// EdgeAccount holds the string denoting the account edge name in mutations.
EdgeAccount = "account"
2024-08-19 13:55:36 +02:00
// Table holds the table name of the email in the database.
Table = "emails"
2024-09-03 15:56:34 +02:00
// AccountTable is the table that holds the account relation/edge.
AccountTable = "emails"
// AccountInverseTable is the table name for the Account entity.
2024-08-19 13:55:36 +02:00
// It exists in this package in order to avoid circular dependency with the "account" package.
2024-09-03 15:56:34 +02:00
AccountInverseTable = "accounts"
// AccountColumn is the table column denoting the account relation/edge.
AccountColumn = "account_emails"
2024-08-19 13:55:36 +02:00
)
// Columns holds all SQL columns for email fields.
var Columns = []string{
FieldID,
FieldEmail,
FieldPrimary,
FieldVerified,
FieldVerificationCode,
FieldResetCode,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "emails"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"account_emails",
}
// 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
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}
var (
// DefaultPrimary holds the default value on creation for the "primary" field.
DefaultPrimary bool
// DefaultVerified holds the default value on creation for the "verified" field.
DefaultVerified bool
)
// OrderOption defines the ordering options for the Email 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()
}
// ByEmail orders the results by the email field.
func ByEmail(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEmail, opts...).ToFunc()
}
// ByPrimary orders the results by the primary field.
func ByPrimary(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPrimary, opts...).ToFunc()
}
// ByVerified orders the results by the verified field.
func ByVerified(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVerified, opts...).ToFunc()
}
// ByVerificationCode orders the results by the verification_code field.
func ByVerificationCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVerificationCode, opts...).ToFunc()
}
// ByResetCode orders the results by the reset_code field.
func ByResetCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldResetCode, opts...).ToFunc()
}
2024-09-03 15:56:34 +02:00
// ByAccountField orders the results by account field.
func ByAccountField(field string, opts ...sql.OrderTermOption) OrderOption {
2024-08-19 13:55:36 +02:00
return func(s *sql.Selector) {
2024-09-03 15:56:34 +02:00
sqlgraph.OrderByNeighborTerms(s, newAccountStep(), sql.OrderByField(field, opts...))
2024-08-19 13:55:36 +02:00
}
}
2024-09-03 15:56:34 +02:00
func newAccountStep() *sqlgraph.Step {
2024-08-19 13:55:36 +02:00
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
2024-09-03 15:56:34 +02:00
sqlgraph.To(AccountInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, AccountTable, AccountColumn),
2024-08-19 13:55:36 +02:00
)
}