Files
polaris/ent/storage/storage.go
2025-04-22 16:58:26 +08:00

140 lines
4.3 KiB
Go

// Code generated by ent, DO NOT EDIT.
package storage
import (
"fmt"
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the storage type in the database.
Label = "storage"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldImplementation holds the string denoting the implementation field in the database.
FieldImplementation = "implementation"
// FieldTvPath holds the string denoting the tv_path field in the database.
FieldTvPath = "tv_path"
// FieldMoviePath holds the string denoting the movie_path field in the database.
FieldMoviePath = "movie_path"
// FieldSettings holds the string denoting the settings field in the database.
FieldSettings = "settings"
// FieldDeleted holds the string denoting the deleted field in the database.
FieldDeleted = "deleted"
// FieldDefault holds the string denoting the default field in the database.
FieldDefault = "default"
// FieldCreateTime holds the string denoting the create_time field in the database.
FieldCreateTime = "create_time"
// Table holds the table name of the storage in the database.
Table = "storages"
)
// Columns holds all SQL columns for storage fields.
var Columns = []string{
FieldID,
FieldName,
FieldImplementation,
FieldTvPath,
FieldMoviePath,
FieldSettings,
FieldDeleted,
FieldDefault,
FieldCreateTime,
}
// 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 (
// DefaultDeleted holds the default value on creation for the "deleted" field.
DefaultDeleted bool
// DefaultDefault holds the default value on creation for the "default" field.
DefaultDefault bool
// DefaultCreateTime holds the default value on creation for the "create_time" field.
DefaultCreateTime func() time.Time
)
// Implementation defines the type for the "implementation" enum field.
type Implementation string
// Implementation values.
const (
ImplementationWebdav Implementation = "webdav"
ImplementationLocal Implementation = "local"
ImplementationAlist Implementation = "alist"
)
func (i Implementation) String() string {
return string(i)
}
// ImplementationValidator is a validator for the "implementation" field enum values. It is called by the builders before save.
func ImplementationValidator(i Implementation) error {
switch i {
case ImplementationWebdav, ImplementationLocal, ImplementationAlist:
return nil
default:
return fmt.Errorf("storage: invalid enum value for implementation field: %q", i)
}
}
// OrderOption defines the ordering options for the Storage 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()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByImplementation orders the results by the implementation field.
func ByImplementation(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldImplementation, opts...).ToFunc()
}
// ByTvPath orders the results by the tv_path field.
func ByTvPath(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTvPath, opts...).ToFunc()
}
// ByMoviePath orders the results by the movie_path field.
func ByMoviePath(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMoviePath, opts...).ToFunc()
}
// BySettings orders the results by the settings field.
func BySettings(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSettings, opts...).ToFunc()
}
// ByDeleted orders the results by the deleted field.
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
}
// ByDefault orders the results by the default field.
func ByDefault(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDefault, opts...).ToFunc()
}
// ByCreateTime orders the results by the create_time field.
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
}