mirror of https://github.com/cloudreve/Cloudreve
139 lines
4.6 KiB
Go
139 lines
4.6 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package directlink
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the directlink type in the database.
|
|
Label = "direct_link"
|
|
// 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"
|
|
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
|
FieldUpdatedAt = "updated_at"
|
|
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
|
|
FieldDeletedAt = "deleted_at"
|
|
// FieldName holds the string denoting the name field in the database.
|
|
FieldName = "name"
|
|
// FieldDownloads holds the string denoting the downloads field in the database.
|
|
FieldDownloads = "downloads"
|
|
// FieldFileID holds the string denoting the file_id field in the database.
|
|
FieldFileID = "file_id"
|
|
// FieldSpeed holds the string denoting the speed field in the database.
|
|
FieldSpeed = "speed"
|
|
// EdgeFile holds the string denoting the file edge name in mutations.
|
|
EdgeFile = "file"
|
|
// Table holds the table name of the directlink in the database.
|
|
Table = "direct_links"
|
|
// FileTable is the table that holds the file relation/edge.
|
|
FileTable = "direct_links"
|
|
// FileInverseTable is the table name for the File entity.
|
|
// It exists in this package in order to avoid circular dependency with the "file" package.
|
|
FileInverseTable = "files"
|
|
// FileColumn is the table column denoting the file relation/edge.
|
|
FileColumn = "file_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for directlink fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
FieldDeletedAt,
|
|
FieldName,
|
|
FieldDownloads,
|
|
FieldFileID,
|
|
FieldSpeed,
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
// Note that the variables below are initialized by the runtime
|
|
// package on the initialization of the application. Therefore,
|
|
// it should be imported in the main as follows:
|
|
//
|
|
// import _ "github.com/cloudreve/Cloudreve/v4/ent/runtime"
|
|
var (
|
|
Hooks [1]ent.Hook
|
|
Interceptors [1]ent.Interceptor
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt func() time.Time
|
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
|
DefaultUpdatedAt func() time.Time
|
|
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
|
UpdateDefaultUpdatedAt func() time.Time
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the DirectLink 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()
|
|
}
|
|
|
|
// ByUpdatedAt orders the results by the updated_at field.
|
|
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByDeletedAt orders the results by the deleted_at field.
|
|
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByName orders the results by the name field.
|
|
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByDownloads orders the results by the downloads field.
|
|
func ByDownloads(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldDownloads, opts...).ToFunc()
|
|
}
|
|
|
|
// ByFileID orders the results by the file_id field.
|
|
func ByFileID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldFileID, opts...).ToFunc()
|
|
}
|
|
|
|
// BySpeed orders the results by the speed field.
|
|
func BySpeed(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldSpeed, opts...).ToFunc()
|
|
}
|
|
|
|
// ByFileField orders the results by file field.
|
|
func ByFileField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newFileStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
func newFileStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(FileInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, FileTable, FileColumn),
|
|
)
|
|
}
|