97 lines
2.9 KiB
Go
97 lines
2.9 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package comments
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the comments type in the database.
|
|
Label = "comments"
|
|
// 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"
|
|
// FieldAuthorID holds the string denoting the author_id field in the database.
|
|
FieldAuthorID = "author_id"
|
|
// FieldContent holds the string denoting the content field in the database.
|
|
FieldContent = "content"
|
|
// FieldLikeCount holds the string denoting the like_count field in the database.
|
|
FieldLikeCount = "like_count"
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
FieldCreatedAt = "created_at"
|
|
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
|
|
FieldDeletedAt = "deleted_at"
|
|
// Table holds the table name of the comments in the database.
|
|
Table = "comments"
|
|
)
|
|
|
|
// Columns holds all SQL columns for comments fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldPostID,
|
|
FieldAuthorID,
|
|
FieldContent,
|
|
FieldLikeCount,
|
|
FieldCreatedAt,
|
|
FieldDeletedAt,
|
|
}
|
|
|
|
// 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 (
|
|
// DefaultLikeCount holds the default value on creation for the "like_count" field.
|
|
DefaultLikeCount int
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt func() time.Time
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Comments 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()
|
|
}
|
|
|
|
// ByAuthorID orders the results by the author_id field.
|
|
func ByAuthorID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldAuthorID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByContent orders the results by the content field.
|
|
func ByContent(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldContent, opts...).ToFunc()
|
|
}
|
|
|
|
// ByLikeCount orders the results by the like_count field.
|
|
func ByLikeCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldLikeCount, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByDeletedAt orders the results by the deleted_at field.
|
|
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
|
|
}
|