167 lines
5.6 KiB
Go
167 lines
5.6 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package postcontent
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the postcontent type in the database.
|
|
Label = "post_content"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldLanguageCode holds the string denoting the language_code field in the database.
|
|
FieldLanguageCode = "language_code"
|
|
// FieldTitle holds the string denoting the title field in the database.
|
|
FieldTitle = "title"
|
|
// FieldContentMarkdown holds the string denoting the content_markdown field in the database.
|
|
FieldContentMarkdown = "content_markdown"
|
|
// FieldSummary holds the string denoting the summary field in the database.
|
|
FieldSummary = "summary"
|
|
// FieldMetaKeywords holds the string denoting the meta_keywords field in the database.
|
|
FieldMetaKeywords = "meta_keywords"
|
|
// FieldMetaDescription holds the string denoting the meta_description field in the database.
|
|
FieldMetaDescription = "meta_description"
|
|
// FieldSlug holds the string denoting the slug field in the database.
|
|
FieldSlug = "slug"
|
|
// EdgePost holds the string denoting the post edge name in mutations.
|
|
EdgePost = "post"
|
|
// Table holds the table name of the postcontent in the database.
|
|
Table = "post_contents"
|
|
// PostTable is the table that holds the post relation/edge.
|
|
PostTable = "post_contents"
|
|
// PostInverseTable is the table name for the Post entity.
|
|
// It exists in this package in order to avoid circular dependency with the "post" package.
|
|
PostInverseTable = "posts"
|
|
// PostColumn is the table column denoting the post relation/edge.
|
|
PostColumn = "post_contents"
|
|
)
|
|
|
|
// Columns holds all SQL columns for postcontent fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldLanguageCode,
|
|
FieldTitle,
|
|
FieldContentMarkdown,
|
|
FieldSummary,
|
|
FieldMetaKeywords,
|
|
FieldMetaDescription,
|
|
FieldSlug,
|
|
}
|
|
|
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "post_contents"
|
|
// table and are not defined as standalone fields in the schema.
|
|
var ForeignKeys = []string{
|
|
"post_contents",
|
|
}
|
|
|
|
// 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
|
|
}
|
|
}
|
|
for i := range ForeignKeys {
|
|
if column == ForeignKeys[i] {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
var (
|
|
// TitleValidator is a validator for the "title" field. It is called by the builders before save.
|
|
TitleValidator func(string) error
|
|
// ContentMarkdownValidator is a validator for the "content_markdown" field. It is called by the builders before save.
|
|
ContentMarkdownValidator func(string) error
|
|
// SummaryValidator is a validator for the "summary" field. It is called by the builders before save.
|
|
SummaryValidator func(string) error
|
|
// SlugValidator is a validator for the "slug" field. It is called by the builders before save.
|
|
SlugValidator func(string) error
|
|
)
|
|
|
|
// LanguageCode defines the type for the "language_code" enum field.
|
|
type LanguageCode string
|
|
|
|
// LanguageCode values.
|
|
const (
|
|
LanguageCodeEN LanguageCode = "en"
|
|
LanguageCodeZH_HANS LanguageCode = "zh-Hans"
|
|
LanguageCodeZH_HANT LanguageCode = "zh-Hant"
|
|
)
|
|
|
|
func (lc LanguageCode) String() string {
|
|
return string(lc)
|
|
}
|
|
|
|
// LanguageCodeValidator is a validator for the "language_code" field enum values. It is called by the builders before save.
|
|
func LanguageCodeValidator(lc LanguageCode) error {
|
|
switch lc {
|
|
case LanguageCodeEN, LanguageCodeZH_HANS, LanguageCodeZH_HANT:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("postcontent: invalid enum value for language_code field: %q", lc)
|
|
}
|
|
}
|
|
|
|
// OrderOption defines the ordering options for the PostContent 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()
|
|
}
|
|
|
|
// ByLanguageCode orders the results by the language_code field.
|
|
func ByLanguageCode(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldLanguageCode, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTitle orders the results by the title field.
|
|
func ByTitle(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTitle, opts...).ToFunc()
|
|
}
|
|
|
|
// ByContentMarkdown orders the results by the content_markdown field.
|
|
func ByContentMarkdown(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldContentMarkdown, opts...).ToFunc()
|
|
}
|
|
|
|
// BySummary orders the results by the summary field.
|
|
func BySummary(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldSummary, opts...).ToFunc()
|
|
}
|
|
|
|
// ByMetaKeywords orders the results by the meta_keywords field.
|
|
func ByMetaKeywords(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldMetaKeywords, opts...).ToFunc()
|
|
}
|
|
|
|
// ByMetaDescription orders the results by the meta_description field.
|
|
func ByMetaDescription(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldMetaDescription, opts...).ToFunc()
|
|
}
|
|
|
|
// BySlug orders the results by the slug field.
|
|
func BySlug(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldSlug, opts...).ToFunc()
|
|
}
|
|
|
|
// ByPostField orders the results by post field.
|
|
func ByPostField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newPostStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
func newPostStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(PostInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, PostTable, PostColumn),
|
|
)
|
|
}
|