81 lines
2.4 KiB
Go
81 lines
2.4 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package favorites
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the favorites type in the database.
|
|
Label = "favorites"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldUserID holds the string denoting the user_id field in the database.
|
|
FieldUserID = "user_id"
|
|
// FieldTargetType holds the string denoting the target_type field in the database.
|
|
FieldTargetType = "target_type"
|
|
// FieldTargetID holds the string denoting the target_id field in the database.
|
|
FieldTargetID = "target_id"
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
FieldCreatedAt = "created_at"
|
|
// Table holds the table name of the favorites in the database.
|
|
Table = "favorites"
|
|
)
|
|
|
|
// Columns holds all SQL columns for favorites fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldUserID,
|
|
FieldTargetType,
|
|
FieldTargetID,
|
|
FieldCreatedAt,
|
|
}
|
|
|
|
// 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 (
|
|
// TargetTypeValidator is a validator for the "target_type" field. It is called by the builders before save.
|
|
TargetTypeValidator func(string) error
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt func() time.Time
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Favorites 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()
|
|
}
|
|
|
|
// ByUserID orders the results by the user_id field.
|
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTargetType orders the results by the target_type field.
|
|
func ByTargetType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTargetType, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTargetID orders the results by the target_id field.
|
|
func ByTargetID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTargetID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
}
|