105 lines
3.2 KiB
Go
105 lines
3.2 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package agekey
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the agekey type in the database.
|
|
Label = "age_key"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldKey holds the string denoting the key field in the database.
|
|
FieldKey = "key"
|
|
// FieldCreated holds the string denoting the created field in the database.
|
|
FieldCreated = "created"
|
|
// FieldUpdated holds the string denoting the updated field in the database.
|
|
FieldUpdated = "updated"
|
|
// FieldOwner holds the string denoting the owner field in the database.
|
|
FieldOwner = "owner"
|
|
// EdgeUser holds the string denoting the user edge name in mutations.
|
|
EdgeUser = "user"
|
|
// Table holds the table name of the agekey in the database.
|
|
Table = "age_keys"
|
|
// UserTable is the table that holds the user relation/edge.
|
|
UserTable = "age_keys"
|
|
// 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 = "owner"
|
|
)
|
|
|
|
// Columns holds all SQL columns for agekey fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldKey,
|
|
FieldCreated,
|
|
FieldUpdated,
|
|
FieldOwner,
|
|
}
|
|
|
|
// 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 (
|
|
// KeyValidator is a validator for the "key" field. It is called by the builders before save.
|
|
KeyValidator func([]byte) error
|
|
// DefaultCreated holds the default value on creation for the "created" field.
|
|
DefaultCreated func() time.Time
|
|
// DefaultUpdated holds the default value on creation for the "updated" field.
|
|
DefaultUpdated func() time.Time
|
|
// DefaultID holds the default value on creation for the "id" field.
|
|
DefaultID func() uuid.UUID
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the AgeKey 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()
|
|
}
|
|
|
|
// ByUpdated orders the results by the updated field.
|
|
func ByUpdated(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUpdated, opts...).ToFunc()
|
|
}
|
|
|
|
// ByOwner orders the results by the owner field.
|
|
func ByOwner(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldOwner, 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.O2O, true, UserTable, UserColumn),
|
|
)
|
|
}
|