109 lines
3.5 KiB
Go
109 lines
3.5 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package document
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the document type in the database.
|
|
Label = "document"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
FieldCreatedAt = "created_at"
|
|
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
|
FieldUpdatedAt = "updated_at"
|
|
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
|
|
FieldDeletedAt = "deleted_at"
|
|
// FieldTitle holds the string denoting the title field in the database.
|
|
FieldTitle = "title"
|
|
// FieldContent holds the string denoting the content field in the database.
|
|
FieldContent = "content"
|
|
// FieldLocked holds the string denoting the locked field in the database.
|
|
FieldLocked = "locked"
|
|
// Table holds the table name of the document in the database.
|
|
Table = "documents"
|
|
)
|
|
|
|
// Columns holds all SQL columns for document fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
FieldDeletedAt,
|
|
FieldTitle,
|
|
FieldContent,
|
|
FieldLocked,
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
// Note that the variables below are initialized by the runtime
|
|
// package on the initialization of the application. Therefore,
|
|
// it should be imported in the main as follows:
|
|
//
|
|
// import _ "voidraft/internal/models/ent/runtime"
|
|
var (
|
|
Hooks [2]ent.Hook
|
|
Interceptors [1]ent.Interceptor
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt func() string
|
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
|
DefaultUpdatedAt func() string
|
|
// TitleValidator is a validator for the "title" field. It is called by the builders before save.
|
|
TitleValidator func(string) error
|
|
// DefaultContent holds the default value on creation for the "content" field.
|
|
DefaultContent string
|
|
// DefaultLocked holds the default value on creation for the "locked" field.
|
|
DefaultLocked bool
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Document 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()
|
|
}
|
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUpdatedAt orders the results by the updated_at field.
|
|
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByDeletedAt orders the results by the deleted_at field.
|
|
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTitle orders the results by the title field.
|
|
func ByTitle(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTitle, opts...).ToFunc()
|
|
}
|
|
|
|
// ByContent orders the results by the content field.
|
|
func ByContent(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldContent, opts...).ToFunc()
|
|
}
|
|
|
|
// ByLocked orders the results by the locked field.
|
|
func ByLocked(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldLocked, opts...).ToFunc()
|
|
}
|