353 lines
11 KiB
Go
353 lines
11 KiB
Go
// ENT数据库文件,请勿编辑。
|
|
|
|
package courseentity
|
|
|
|
import (
|
|
"fmt"
|
|
"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 courseentity type in the database.
|
|
Label = "course_entity"
|
|
// 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"
|
|
// FieldUserID holds the string denoting the user_id field in the database.
|
|
FieldUserID = "user_id"
|
|
// FieldUsername holds the string denoting the username field in the database.
|
|
FieldUsername = "username"
|
|
// FieldPassword holds the string denoting the password field in the database.
|
|
FieldPassword = "password"
|
|
// FieldType holds the string denoting the type field in the database.
|
|
FieldType = "type"
|
|
// FieldCourseName holds the string denoting the course_name field in the database.
|
|
FieldCourseName = "course_name"
|
|
// FieldCourseID holds the string denoting the course_id field in the database.
|
|
FieldCourseID = "course_id"
|
|
// FieldNeed holds the string denoting the need field in the database.
|
|
FieldNeed = "need"
|
|
// FieldStatus holds the string denoting the status field in the database.
|
|
FieldStatus = "status"
|
|
// FieldTaskCount holds the string denoting the task_count field in the database.
|
|
FieldTaskCount = "task_count"
|
|
// FieldSuccessCount holds the string denoting the success_count field in the database.
|
|
FieldSuccessCount = "success_count"
|
|
// FieldExamState holds the string denoting the exam_state field in the database.
|
|
FieldExamState = "exam_state"
|
|
// FieldViolence holds the string denoting the violence field in the database.
|
|
FieldViolence = "violence"
|
|
// FieldNodes holds the string denoting the nodes field in the database.
|
|
FieldNodes = "nodes"
|
|
// FieldCompletedNodes holds the string denoting the completed_nodes field in the database.
|
|
FieldCompletedNodes = "completed_nodes"
|
|
// FieldDesc holds the string denoting the desc field in the database.
|
|
FieldDesc = "desc"
|
|
// EdgeSysUser holds the string denoting the sys_user edge name in mutations.
|
|
EdgeSysUser = "sys_user"
|
|
// Table holds the table name of the courseentity in the database.
|
|
Table = "course_entity"
|
|
// SysUserTable is the table that holds the sys_user relation/edge.
|
|
SysUserTable = "course_entity"
|
|
// SysUserInverseTable is the table name for the SysUser entity.
|
|
// It exists in this package in order to avoid circular dependency with the "sysuser" package.
|
|
SysUserInverseTable = "sys_user"
|
|
// SysUserColumn is the table column denoting the sys_user relation/edge.
|
|
SysUserColumn = "user_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for courseentity fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreateTime,
|
|
FieldUpdateTime,
|
|
FieldUserID,
|
|
FieldUsername,
|
|
FieldPassword,
|
|
FieldType,
|
|
FieldCourseName,
|
|
FieldCourseID,
|
|
FieldNeed,
|
|
FieldStatus,
|
|
FieldTaskCount,
|
|
FieldSuccessCount,
|
|
FieldExamState,
|
|
FieldViolence,
|
|
FieldNodes,
|
|
FieldCompletedNodes,
|
|
FieldDesc,
|
|
}
|
|
|
|
// 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
|
|
// DefaultTaskCount holds the default value on creation for the "task_count" field.
|
|
DefaultTaskCount int
|
|
// DefaultSuccessCount holds the default value on creation for the "success_count" field.
|
|
DefaultSuccessCount int
|
|
)
|
|
|
|
// Type defines the type for the "type" enum field.
|
|
type Type string
|
|
|
|
// Type values.
|
|
const (
|
|
TypeXxt Type = "xxt"
|
|
TypeSmarteduSc Type = "smartedu_sc"
|
|
)
|
|
|
|
func (_type Type) String() string {
|
|
return string(_type)
|
|
}
|
|
|
|
// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.
|
|
func TypeValidator(_type Type) error {
|
|
switch _type {
|
|
case TypeXxt, TypeSmarteduSc:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("courseentity: invalid enum value for type field: %q", _type)
|
|
}
|
|
}
|
|
|
|
// Need defines the type for the "need" enum field.
|
|
type Need string
|
|
|
|
// Need values.
|
|
const (
|
|
NeedTask Need = "task"
|
|
NeedExam Need = "exam"
|
|
NeedAll Need = "all"
|
|
)
|
|
|
|
func (n Need) String() string {
|
|
return string(n)
|
|
}
|
|
|
|
// NeedValidator is a validator for the "need" field enum values. It is called by the builders before save.
|
|
func NeedValidator(n Need) error {
|
|
switch n {
|
|
case NeedTask, NeedExam, NeedAll:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("courseentity: invalid enum value for need field: %q", n)
|
|
}
|
|
}
|
|
|
|
// Status defines the type for the "status" enum field.
|
|
type Status string
|
|
|
|
// StatusNotStart is the default value of the Status enum.
|
|
const DefaultStatus = StatusNotStart
|
|
|
|
// Status values.
|
|
const (
|
|
StatusNotStart Status = "not_start"
|
|
StatusWaiting Status = "waiting"
|
|
StatusDoing Status = "doing"
|
|
StatusDone Status = "done"
|
|
StatusFail Status = "fail"
|
|
StatusPause Status = "pause"
|
|
)
|
|
|
|
func (s Status) String() string {
|
|
return string(s)
|
|
}
|
|
|
|
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
|
|
func StatusValidator(s Status) error {
|
|
switch s {
|
|
case StatusNotStart, StatusWaiting, StatusDoing, StatusDone, StatusFail, StatusPause:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("courseentity: invalid enum value for status field: %q", s)
|
|
}
|
|
}
|
|
|
|
// ExamState defines the type for the "exam_state" enum field.
|
|
type ExamState string
|
|
|
|
// ExamStateNotStart is the default value of the ExamState enum.
|
|
const DefaultExamState = ExamStateNotStart
|
|
|
|
// ExamState values.
|
|
const (
|
|
ExamStateNotStart ExamState = "not_start"
|
|
ExamStateWaiting ExamState = "waiting"
|
|
ExamStateDoing ExamState = "doing"
|
|
ExamStateDone ExamState = "done"
|
|
ExamStateFail ExamState = "fail"
|
|
)
|
|
|
|
func (es ExamState) String() string {
|
|
return string(es)
|
|
}
|
|
|
|
// ExamStateValidator is a validator for the "exam_state" field enum values. It is called by the builders before save.
|
|
func ExamStateValidator(es ExamState) error {
|
|
switch es {
|
|
case ExamStateNotStart, ExamStateWaiting, ExamStateDoing, ExamStateDone, ExamStateFail:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("courseentity: invalid enum value for exam_state field: %q", es)
|
|
}
|
|
}
|
|
|
|
// Violence defines the type for the "violence" enum field.
|
|
type Violence string
|
|
|
|
// ViolenceNo is the default value of the Violence enum.
|
|
const DefaultViolence = ViolenceNo
|
|
|
|
// Violence values.
|
|
const (
|
|
ViolenceNo Violence = "no"
|
|
ViolenceYes Violence = "yes"
|
|
)
|
|
|
|
func (v Violence) String() string {
|
|
return string(v)
|
|
}
|
|
|
|
// ViolenceValidator is a validator for the "violence" field enum values. It is called by the builders before save.
|
|
func ViolenceValidator(v Violence) error {
|
|
switch v {
|
|
case ViolenceNo, ViolenceYes:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("courseentity: invalid enum value for violence field: %q", v)
|
|
}
|
|
}
|
|
|
|
// OrderOption defines the ordering options for the CourseEntity 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()
|
|
}
|
|
|
|
// ByUserID orders the results by the user_id field.
|
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUsername orders the results by the username field.
|
|
func ByUsername(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUsername, opts...).ToFunc()
|
|
}
|
|
|
|
// ByPassword orders the results by the password field.
|
|
func ByPassword(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldPassword, opts...).ToFunc()
|
|
}
|
|
|
|
// ByType orders the results by the type field.
|
|
func ByType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldType, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCourseName orders the results by the course_name field.
|
|
func ByCourseName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCourseName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCourseID orders the results by the course_id field.
|
|
func ByCourseID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCourseID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByNeed orders the results by the need field.
|
|
func ByNeed(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldNeed, opts...).ToFunc()
|
|
}
|
|
|
|
// ByStatus orders the results by the status field.
|
|
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTaskCount orders the results by the task_count field.
|
|
func ByTaskCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTaskCount, opts...).ToFunc()
|
|
}
|
|
|
|
// BySuccessCount orders the results by the success_count field.
|
|
func BySuccessCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldSuccessCount, opts...).ToFunc()
|
|
}
|
|
|
|
// ByExamState orders the results by the exam_state field.
|
|
func ByExamState(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldExamState, opts...).ToFunc()
|
|
}
|
|
|
|
// ByViolence orders the results by the violence field.
|
|
func ByViolence(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldViolence, opts...).ToFunc()
|
|
}
|
|
|
|
// ByNodes orders the results by the nodes field.
|
|
func ByNodes(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldNodes, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCompletedNodes orders the results by the completed_nodes field.
|
|
func ByCompletedNodes(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCompletedNodes, opts...).ToFunc()
|
|
}
|
|
|
|
// ByDesc orders the results by the desc field.
|
|
func ByDesc(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldDesc, opts...).ToFunc()
|
|
}
|
|
|
|
// BySysUserField orders the results by sys_user field.
|
|
func BySysUserField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newSysUserStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
func newSysUserStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(SysUserInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, SysUserTable, SysUserColumn),
|
|
)
|
|
}
|