118 lines
3.7 KiB
Go
118 lines
3.7 KiB
Go
|
// Code generated by ent, DO NOT EDIT.
|
||
|
|
||
|
package verifytoken
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"entgo.io/ent/dialect/sql"
|
||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
// Label holds the string label denoting the verifytoken type in the database.
|
||
|
Label = "verify_token"
|
||
|
// 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"
|
||
|
// FieldToken holds the string denoting the token field in the database.
|
||
|
FieldToken = "token"
|
||
|
// FieldPurpose holds the string denoting the purpose field in the database.
|
||
|
FieldPurpose = "purpose"
|
||
|
// EdgeUser holds the string denoting the user edge name in mutations.
|
||
|
EdgeUser = "user"
|
||
|
// Table holds the table name of the verifytoken in the database.
|
||
|
Table = "verify_tokens"
|
||
|
// UserTable is the table that holds the user relation/edge.
|
||
|
UserTable = "verify_tokens"
|
||
|
// UserInverseTable is the table name for the User entity.
|
||
|
// It exists in this package in order to avoid circular dependency with the "user" package.
|
||
|
UserInverseTable = "users"
|
||
|
// UserColumn is the table column denoting the user relation/edge.
|
||
|
UserColumn = "user_id"
|
||
|
)
|
||
|
|
||
|
// Columns holds all SQL columns for verifytoken fields.
|
||
|
var Columns = []string{
|
||
|
FieldID,
|
||
|
FieldCreatedAt,
|
||
|
FieldExpiresAt,
|
||
|
FieldToken,
|
||
|
FieldPurpose,
|
||
|
}
|
||
|
|
||
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "verify_tokens"
|
||
|
// table and are not defined as standalone fields in the schema.
|
||
|
var ForeignKeys = []string{
|
||
|
"user_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
|
||
|
}
|
||
|
}
|
||
|
for i := range ForeignKeys {
|
||
|
if column == ForeignKeys[i] {
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||
|
DefaultCreatedAt func() time.Time
|
||
|
// TokenValidator is a validator for the "token" field. It is called by the builders before save.
|
||
|
TokenValidator func(string) error
|
||
|
// PurposeValidator is a validator for the "purpose" field. It is called by the builders before save.
|
||
|
PurposeValidator func(string) error
|
||
|
)
|
||
|
|
||
|
// OrderOption defines the ordering options for the VerifyToken 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()
|
||
|
}
|
||
|
|
||
|
// ByToken orders the results by the token field.
|
||
|
func ByToken(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldToken, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// ByPurpose orders the results by the purpose field.
|
||
|
func ByPurpose(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldPurpose, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// ByUserField orders the results by user field.
|
||
|
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||
|
return func(s *sql.Selector) {
|
||
|
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
|
||
|
}
|
||
|
}
|
||
|
func newUserStep() *sqlgraph.Step {
|
||
|
return sqlgraph.NewStep(
|
||
|
sqlgraph.From(Table, FieldID),
|
||
|
sqlgraph.To(UserInverseTable, FieldID),
|
||
|
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
|
||
|
)
|
||
|
}
|