Files
polaris/ent/blacklist/blacklist.go
2025-04-22 18:18:32 +08:00

122 lines
3.4 KiB
Go

// Code generated by ent, DO NOT EDIT.
package blacklist
import (
"fmt"
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the blacklist type in the database.
Label = "blacklist"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldTorrentHash holds the string denoting the torrent_hash field in the database.
FieldTorrentHash = "torrent_hash"
// FieldTorrentName holds the string denoting the torrent_name field in the database.
FieldTorrentName = "torrent_name"
// FieldMediaID holds the string denoting the media_id field in the database.
FieldMediaID = "media_id"
// FieldCreateTime holds the string denoting the create_time field in the database.
FieldCreateTime = "create_time"
// FieldNotes holds the string denoting the notes field in the database.
FieldNotes = "notes"
// Table holds the table name of the blacklist in the database.
Table = "blacklists"
)
// Columns holds all SQL columns for blacklist fields.
var Columns = []string{
FieldID,
FieldType,
FieldTorrentHash,
FieldTorrentName,
FieldMediaID,
FieldCreateTime,
FieldNotes,
}
// 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
)
// Type defines the type for the "type" enum field.
type Type string
// TypeTorrent is the default value of the Type enum.
const DefaultType = TypeTorrent
// Type values.
const (
TypeMedia Type = "media"
TypeTorrent Type = "torrent"
)
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 TypeMedia, TypeTorrent:
return nil
default:
return fmt.Errorf("blacklist: invalid enum value for type field: %q", _type)
}
}
// OrderOption defines the ordering options for the Blacklist 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()
}
// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldType, opts...).ToFunc()
}
// ByTorrentHash orders the results by the torrent_hash field.
func ByTorrentHash(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTorrentHash, opts...).ToFunc()
}
// ByTorrentName orders the results by the torrent_name field.
func ByTorrentName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTorrentName, opts...).ToFunc()
}
// ByMediaID orders the results by the media_id field.
func ByMediaID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMediaID, opts...).ToFunc()
}
// ByCreateTime orders the results by the create_time field.
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
}
// ByNotes orders the results by the notes field.
func ByNotes(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNotes, opts...).ToFunc()
}