Files

71 lines
1.9 KiB
Go

// Code generated by ent, DO NOT EDIT.
package postlikes
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the postlikes type in the database.
Label = "post_likes"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldPostID holds the string denoting the post_id field in the database.
FieldPostID = "post_id"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// Table holds the table name of the postlikes in the database.
Table = "post_likes"
)
// Columns holds all SQL columns for postlikes fields.
var Columns = []string{
FieldID,
FieldPostID,
FieldUserID,
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 (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
)
// OrderOption defines the ordering options for the PostLikes 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()
}
// ByPostID orders the results by the post_id field.
func ByPostID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPostID, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}