Files
polaris/ent/importlist/importlist.go
2024-09-02 23:47:19 +08:00

108 lines
2.9 KiB
Go

// Code generated by ent, DO NOT EDIT.
package importlist
import (
"fmt"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the importlist type in the database.
Label = "import_list"
// 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"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldURL holds the string denoting the url field in the database.
FieldURL = "url"
// FieldQulity holds the string denoting the qulity field in the database.
FieldQulity = "qulity"
// FieldStorageID holds the string denoting the storage_id field in the database.
FieldStorageID = "storage_id"
// FieldSettings holds the string denoting the settings field in the database.
FieldSettings = "settings"
// Table holds the table name of the importlist in the database.
Table = "import_lists"
)
// Columns holds all SQL columns for importlist fields.
var Columns = []string{
FieldID,
FieldName,
FieldType,
FieldURL,
FieldQulity,
FieldStorageID,
FieldSettings,
}
// 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
}
// Type defines the type for the "type" enum field.
type Type string
// Type values.
const (
TypePlex Type = "plex"
TypeDoulist Type = "doulist"
)
func (_type Type) String() string {
return string(_type)
}
// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.
func TypeValidator(_type Type) error {
switch _type {
case TypePlex, TypeDoulist:
return nil
default:
return fmt.Errorf("importlist: invalid enum value for type field: %q", _type)
}
}
// OrderOption defines the ordering options for the ImportList 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()
}
// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldType, opts...).ToFunc()
}
// ByURL orders the results by the url field.
func ByURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldURL, opts...).ToFunc()
}
// ByQulity orders the results by the qulity field.
func ByQulity(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldQulity, opts...).ToFunc()
}
// ByStorageID orders the results by the storage_id field.
func ByStorageID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStorageID, opts...).ToFunc()
}