authentication.go•5.83 kB
// Code generated by ent, DO NOT EDIT.
package authentication
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/rs/xid"
)
const (
// Label holds the string label denoting the authentication type in the database.
Label = "authentication"
// 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"
// FieldExpiresAt holds the string denoting the expires_at field in the database.
FieldExpiresAt = "expires_at"
// FieldService holds the string denoting the service field in the database.
FieldService = "service"
// FieldTokenType holds the string denoting the token_type field in the database.
FieldTokenType = "token_type"
// FieldIdentifier holds the string denoting the identifier field in the database.
FieldIdentifier = "identifier"
// FieldToken holds the string denoting the token field in the database.
FieldToken = "token"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldDisabled holds the string denoting the disabled field in the database.
FieldDisabled = "disabled"
// FieldMetadata holds the string denoting the metadata field in the database.
FieldMetadata = "metadata"
// FieldAccountAuthentication holds the string denoting the account_authentication field in the database.
FieldAccountAuthentication = "account_authentication"
// EdgeAccount holds the string denoting the account edge name in mutations.
EdgeAccount = "account"
// Table holds the table name of the authentication in the database.
Table = "authentications"
// AccountTable is the table that holds the account relation/edge.
AccountTable = "authentications"
// AccountInverseTable is the table name for the Account entity.
// It exists in this package in order to avoid circular dependency with the "account" package.
AccountInverseTable = "accounts"
// AccountColumn is the table column denoting the account relation/edge.
AccountColumn = "account_authentication"
)
// Columns holds all SQL columns for authentication fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldExpiresAt,
FieldService,
FieldTokenType,
FieldIdentifier,
FieldToken,
FieldName,
FieldDisabled,
FieldMetadata,
FieldAccountAuthentication,
}
// 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
// ServiceValidator is a validator for the "service" field. It is called by the builders before save.
ServiceValidator func(string) error
// TokenTypeValidator is a validator for the "token_type" field. It is called by the builders before save.
TokenTypeValidator func(string) error
// TokenValidator is a validator for the "token" field. It is called by the builders before save.
TokenValidator func(string) error
// DefaultDisabled holds the default value on creation for the "disabled" field.
DefaultDisabled bool
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() xid.ID
// IDValidator is a validator for the "id" field. It is called by the builders before save.
IDValidator func(string) error
)
// OrderOption defines the ordering options for the Authentication 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()
}
// ByExpiresAt orders the results by the expires_at field.
func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
}
// ByService orders the results by the service field.
func ByService(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldService, opts...).ToFunc()
}
// ByTokenType orders the results by the token_type field.
func ByTokenType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTokenType, opts...).ToFunc()
}
// ByIdentifier orders the results by the identifier field.
func ByIdentifier(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIdentifier, opts...).ToFunc()
}
// ByToken orders the results by the token field.
func ByToken(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldToken, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByDisabled orders the results by the disabled field.
func ByDisabled(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDisabled, opts...).ToFunc()
}
// ByAccountAuthentication orders the results by the account_authentication field.
func ByAccountAuthentication(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAccountAuthentication, opts...).ToFunc()
}
// ByAccountField orders the results by account field.
func ByAccountField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newAccountStep(), sql.OrderByField(field, opts...))
}
}
func newAccountStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(AccountInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, AccountTable, AccountColumn),
)
}