Files

126 lines
4.3 KiB
Go

// Code generated by ent, DO NOT EDIT.
package personalaccesstoken
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 personalaccesstoken type in the database.
Label = "personal_access_token"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreateTime holds the string denoting the create_time field in the database.
FieldCreateTime = "create_time"
// FieldUpdateTime holds the string denoting the update_time field in the database.
FieldUpdateTime = "update_time"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldPublisherID holds the string denoting the publisher_id field in the database.
FieldPublisherID = "publisher_id"
// FieldToken holds the string denoting the token field in the database.
FieldToken = "token"
// EdgePublisher holds the string denoting the publisher edge name in mutations.
EdgePublisher = "publisher"
// Table holds the table name of the personalaccesstoken in the database.
Table = "personal_access_tokens"
// PublisherTable is the table that holds the publisher relation/edge.
PublisherTable = "personal_access_tokens"
// PublisherInverseTable is the table name for the Publisher entity.
// It exists in this package in order to avoid circular dependency with the "publisher" package.
PublisherInverseTable = "publishers"
// PublisherColumn is the table column denoting the publisher relation/edge.
PublisherColumn = "publisher_id"
)
// Columns holds all SQL columns for personalaccesstoken fields.
var Columns = []string{
FieldID,
FieldCreateTime,
FieldUpdateTime,
FieldName,
FieldDescription,
FieldPublisherID,
FieldToken,
}
// 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 (
// DefaultCreateTime holds the default value on creation for the "create_time" field.
DefaultCreateTime func() time.Time
// DefaultUpdateTime holds the default value on creation for the "update_time" field.
DefaultUpdateTime func() time.Time
// UpdateDefaultUpdateTime holds the default value on update for the "update_time" field.
UpdateDefaultUpdateTime 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 PersonalAccessToken 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()
}
// ByCreateTime orders the results by the create_time field.
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
}
// ByUpdateTime orders the results by the update_time field.
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByPublisherID orders the results by the publisher_id field.
func ByPublisherID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPublisherID, opts...).ToFunc()
}
// ByToken orders the results by the token field.
func ByToken(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldToken, opts...).ToFunc()
}
// ByPublisherField orders the results by publisher field.
func ByPublisherField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newPublisherStep(), sql.OrderByField(field, opts...))
}
}
func newPublisherStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(PublisherInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, PublisherTable, PublisherColumn),
)
}