mirror of
https://github.com/simon-ding/polaris.git
synced 2026-03-01 07:00:47 +08:00
81 lines
2.0 KiB
Go
81 lines
2.0 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package blocklist
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the blocklist type in the database.
|
|
Label = "blocklist"
|
|
// 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"
|
|
// FieldValue holds the string denoting the value field in the database.
|
|
FieldValue = "value"
|
|
// Table holds the table name of the blocklist in the database.
|
|
Table = "blocklists"
|
|
)
|
|
|
|
// Columns holds all SQL columns for blocklist fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldType,
|
|
FieldValue,
|
|
}
|
|
|
|
// 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 (
|
|
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("blocklist: invalid enum value for type field: %q", _type)
|
|
}
|
|
}
|
|
|
|
// OrderOption defines the ordering options for the Blocklist 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()
|
|
}
|
|
|
|
// ByValue orders the results by the value field.
|
|
func ByValue(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldValue, opts...).ToFunc()
|
|
}
|