127 lines
4.2 KiB
Go
127 lines
4.2 KiB
Go
// ENT数据库文件,请勿编辑。
|
|
|
|
package cpschool
|
|
|
|
import (
|
|
"likedream-goframe/internal/framework/ent2"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the cpschool type in the database.
|
|
Label = "cp_school"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldCreateTime holds the string denoting the create_time field in the database.
|
|
FieldCreateTime = "create_time"
|
|
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
|
FieldUpdateTime = "update_time"
|
|
// FieldName holds the string denoting the name field in the database.
|
|
FieldName = "name"
|
|
// FieldNamePinyin holds the string denoting the name_pinyin field in the database.
|
|
FieldNamePinyin = "name_pinyin"
|
|
// FieldIconImg holds the string denoting the icon_img field in the database.
|
|
FieldIconImg = "icon_img"
|
|
// EdgeCpusers holds the string denoting the cpusers edge name in mutations.
|
|
EdgeCpusers = "cpusers"
|
|
// Table holds the table name of the cpschool in the database.
|
|
Table = "cp_schools"
|
|
// CpusersTable is the table that holds the cpusers relation/edge.
|
|
CpusersTable = "cp_users"
|
|
// CpusersInverseTable is the table name for the CpUser entity.
|
|
// It exists in this package in order to avoid circular dependency with the "cpuser" package.
|
|
CpusersInverseTable = "cp_users"
|
|
// CpusersColumn is the table column denoting the cpusers relation/edge.
|
|
CpusersColumn = "school_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for cpschool fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreateTime,
|
|
FieldUpdateTime,
|
|
FieldName,
|
|
FieldNamePinyin,
|
|
FieldIconImg,
|
|
}
|
|
|
|
// 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 _ "likedream-goframe/internal/ent/runtime"
|
|
var (
|
|
Hooks [1]ent.Hook
|
|
// DefaultCreateTime holds the default value on creation for the "create_time" field.
|
|
DefaultCreateTime func() *ent2.CustomTime
|
|
// DefaultUpdateTime holds the default value on creation for the "update_time" field.
|
|
DefaultUpdateTime func() *ent2.CustomTime
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the CpSchool 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()
|
|
}
|
|
|
|
// ByCreateTime orders the results by the create_time field.
|
|
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUpdateTime orders the results by the update_time field.
|
|
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
|
}
|
|
|
|
// ByName orders the results by the name field.
|
|
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByNamePinyin orders the results by the name_pinyin field.
|
|
func ByNamePinyin(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldNamePinyin, opts...).ToFunc()
|
|
}
|
|
|
|
// ByIconImg orders the results by the icon_img field.
|
|
func ByIconImg(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldIconImg, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCpusersCount orders the results by cpusers count.
|
|
func ByCpusersCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newCpusersStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByCpusers orders the results by cpusers terms.
|
|
func ByCpusers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newCpusersStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
func newCpusersStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(CpusersInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, CpusersTable, CpusersColumn),
|
|
)
|
|
}
|