371 lines
13 KiB
Go
371 lines
13 KiB
Go
// ENT数据库文件,请勿编辑。
|
|
|
|
package cptask
|
|
|
|
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 cptask type in the database.
|
|
Label = "cp_task"
|
|
// 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"
|
|
// FieldCpUserID holds the string denoting the cp_user_id field in the database.
|
|
FieldCpUserID = "cp_user_id"
|
|
// FieldUserID holds the string denoting the user_id field in the database.
|
|
FieldUserID = "user_id"
|
|
// FieldTaskType holds the string denoting the task_type field in the database.
|
|
FieldTaskType = "task_type"
|
|
// FieldTitle holds the string denoting the title field in the database.
|
|
FieldTitle = "title"
|
|
// FieldFrequency holds the string denoting the frequency field in the database.
|
|
FieldFrequency = "frequency"
|
|
// FieldTaskStatus holds the string denoting the task_status field in the database.
|
|
FieldTaskStatus = "task_status"
|
|
// FieldSuccessCount holds the string denoting the success_count field in the database.
|
|
FieldSuccessCount = "success_count"
|
|
// FieldFormData holds the string denoting the form_data field in the database.
|
|
FieldFormData = "form_data"
|
|
// FieldUsedImg holds the string denoting the used_img field in the database.
|
|
FieldUsedImg = "used_img"
|
|
// FieldStep holds the string denoting the step field in the database.
|
|
FieldStep = "step"
|
|
// FieldNotificationType holds the string denoting the notification_type field in the database.
|
|
FieldNotificationType = "notification_type"
|
|
// FieldExecuteHour holds the string denoting the execute_hour field in the database.
|
|
FieldExecuteHour = "execute_hour"
|
|
// FieldExecuteMinute holds the string denoting the execute_minute field in the database.
|
|
FieldExecuteMinute = "execute_minute"
|
|
// FieldNextExecuteTime holds the string denoting the next_execute_time field in the database.
|
|
FieldNextExecuteTime = "next_execute_time"
|
|
// FieldExecuteDays holds the string denoting the execute_days field in the database.
|
|
FieldExecuteDays = "execute_days"
|
|
// EdgeCpUser holds the string denoting the cp_user edge name in mutations.
|
|
EdgeCpUser = "cp_user"
|
|
// EdgeSysUser holds the string denoting the sys_user edge name in mutations.
|
|
EdgeSysUser = "sys_user"
|
|
// EdgeCpTaskLogs holds the string denoting the cp_task_logs edge name in mutations.
|
|
EdgeCpTaskLogs = "cp_task_logs"
|
|
// Table holds the table name of the cptask in the database.
|
|
Table = "cp_tasks"
|
|
// CpUserTable is the table that holds the cp_user relation/edge.
|
|
CpUserTable = "cp_tasks"
|
|
// CpUserInverseTable is the table name for the CpUser entity.
|
|
// It exists in this package in order to avoid circular dependency with the "cpuser" package.
|
|
CpUserInverseTable = "cp_users"
|
|
// CpUserColumn is the table column denoting the cp_user relation/edge.
|
|
CpUserColumn = "cp_user_id"
|
|
// SysUserTable is the table that holds the sys_user relation/edge.
|
|
SysUserTable = "cp_tasks"
|
|
// 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"
|
|
// CpTaskLogsTable is the table that holds the cp_task_logs relation/edge.
|
|
CpTaskLogsTable = "cp_task_logs"
|
|
// CpTaskLogsInverseTable is the table name for the CpTaskLog entity.
|
|
// It exists in this package in order to avoid circular dependency with the "cptasklog" package.
|
|
CpTaskLogsInverseTable = "cp_task_logs"
|
|
// CpTaskLogsColumn is the table column denoting the cp_task_logs relation/edge.
|
|
CpTaskLogsColumn = "cp_task_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for cptask fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreateTime,
|
|
FieldUpdateTime,
|
|
FieldCpUserID,
|
|
FieldUserID,
|
|
FieldTaskType,
|
|
FieldTitle,
|
|
FieldFrequency,
|
|
FieldTaskStatus,
|
|
FieldSuccessCount,
|
|
FieldFormData,
|
|
FieldUsedImg,
|
|
FieldStep,
|
|
FieldNotificationType,
|
|
FieldExecuteHour,
|
|
FieldExecuteMinute,
|
|
FieldNextExecuteTime,
|
|
FieldExecuteDays,
|
|
}
|
|
|
|
// 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
|
|
// TitleValidator is a validator for the "title" field. It is called by the builders before save.
|
|
TitleValidator func(string) error
|
|
// DefaultFrequency holds the default value on creation for the "frequency" field.
|
|
DefaultFrequency int
|
|
// DefaultSuccessCount holds the default value on creation for the "success_count" field.
|
|
DefaultSuccessCount int
|
|
)
|
|
|
|
// TaskType defines the type for the "task_type" enum field.
|
|
type TaskType string
|
|
|
|
// TaskType values.
|
|
const (
|
|
TaskTypeCollection TaskType = "collection"
|
|
TaskTypeSign TaskType = "sign"
|
|
TaskTypeSleepCheck TaskType = "sleep_check"
|
|
)
|
|
|
|
func (tt TaskType) String() string {
|
|
return string(tt)
|
|
}
|
|
|
|
// TaskTypeValidator is a validator for the "task_type" field enum values. It is called by the builders before save.
|
|
func TaskTypeValidator(tt TaskType) error {
|
|
switch tt {
|
|
case TaskTypeCollection, TaskTypeSign, TaskTypeSleepCheck:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("cptask: invalid enum value for task_type field: %q", tt)
|
|
}
|
|
}
|
|
|
|
// TaskStatus defines the type for the "task_status" enum field.
|
|
type TaskStatus string
|
|
|
|
// TaskStatus values.
|
|
const (
|
|
TaskStatusNotStart TaskStatus = "not_start"
|
|
TaskStatusDoing TaskStatus = "doing"
|
|
TaskStatusDone TaskStatus = "done"
|
|
TaskStatusFail TaskStatus = "fail"
|
|
TaskStatusPause TaskStatus = "pause"
|
|
TaskStatusQueue TaskStatus = "queue"
|
|
TaskStatusUnknown TaskStatus = "unknown"
|
|
)
|
|
|
|
func (ts TaskStatus) String() string {
|
|
return string(ts)
|
|
}
|
|
|
|
// TaskStatusValidator is a validator for the "task_status" field enum values. It is called by the builders before save.
|
|
func TaskStatusValidator(ts TaskStatus) error {
|
|
switch ts {
|
|
case TaskStatusNotStart, TaskStatusDoing, TaskStatusDone, TaskStatusFail, TaskStatusPause, TaskStatusQueue, TaskStatusUnknown:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("cptask: invalid enum value for task_status field: %q", ts)
|
|
}
|
|
}
|
|
|
|
// Step defines the type for the "step" enum field.
|
|
type Step string
|
|
|
|
// Step values.
|
|
const (
|
|
StepForm Step = "form"
|
|
StepExecute Step = "execute"
|
|
StepComplete Step = "complete"
|
|
)
|
|
|
|
func (s Step) String() string {
|
|
return string(s)
|
|
}
|
|
|
|
// StepValidator is a validator for the "step" field enum values. It is called by the builders before save.
|
|
func StepValidator(s Step) error {
|
|
switch s {
|
|
case StepForm, StepExecute, StepComplete:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("cptask: invalid enum value for step field: %q", s)
|
|
}
|
|
}
|
|
|
|
// NotificationType defines the type for the "notification_type" enum field.
|
|
type NotificationType string
|
|
|
|
// NotificationType values.
|
|
const (
|
|
NotificationTypeNone NotificationType = "none"
|
|
NotificationTypeCpUserEmail NotificationType = "cp_user_email"
|
|
NotificationTypeSystemUserEmail NotificationType = "system_user_email"
|
|
)
|
|
|
|
func (nt NotificationType) String() string {
|
|
return string(nt)
|
|
}
|
|
|
|
// NotificationTypeValidator is a validator for the "notification_type" field enum values. It is called by the builders before save.
|
|
func NotificationTypeValidator(nt NotificationType) error {
|
|
switch nt {
|
|
case NotificationTypeNone, NotificationTypeCpUserEmail, NotificationTypeSystemUserEmail:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("cptask: invalid enum value for notification_type field: %q", nt)
|
|
}
|
|
}
|
|
|
|
// OrderOption defines the ordering options for the CpTask 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()
|
|
}
|
|
|
|
// ByCpUserID orders the results by the cp_user_id field.
|
|
func ByCpUserID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCpUserID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUserID orders the results by the user_id field.
|
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTaskType orders the results by the task_type field.
|
|
func ByTaskType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTaskType, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTitle orders the results by the title field.
|
|
func ByTitle(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTitle, opts...).ToFunc()
|
|
}
|
|
|
|
// ByFrequency orders the results by the frequency field.
|
|
func ByFrequency(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldFrequency, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTaskStatus orders the results by the task_status field.
|
|
func ByTaskStatus(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTaskStatus, opts...).ToFunc()
|
|
}
|
|
|
|
// BySuccessCount orders the results by the success_count field.
|
|
func BySuccessCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldSuccessCount, opts...).ToFunc()
|
|
}
|
|
|
|
// ByFormData orders the results by the form_data field.
|
|
func ByFormData(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldFormData, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUsedImg orders the results by the used_img field.
|
|
func ByUsedImg(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUsedImg, opts...).ToFunc()
|
|
}
|
|
|
|
// ByStep orders the results by the step field.
|
|
func ByStep(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldStep, opts...).ToFunc()
|
|
}
|
|
|
|
// ByNotificationType orders the results by the notification_type field.
|
|
func ByNotificationType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldNotificationType, opts...).ToFunc()
|
|
}
|
|
|
|
// ByExecuteHour orders the results by the execute_hour field.
|
|
func ByExecuteHour(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldExecuteHour, opts...).ToFunc()
|
|
}
|
|
|
|
// ByExecuteMinute orders the results by the execute_minute field.
|
|
func ByExecuteMinute(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldExecuteMinute, opts...).ToFunc()
|
|
}
|
|
|
|
// ByNextExecuteTime orders the results by the next_execute_time field.
|
|
func ByNextExecuteTime(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldNextExecuteTime, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCpUserField orders the results by cp_user field.
|
|
func ByCpUserField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newCpUserStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
|
|
// 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...))
|
|
}
|
|
}
|
|
|
|
// ByCpTaskLogsCount orders the results by cp_task_logs count.
|
|
func ByCpTaskLogsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newCpTaskLogsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByCpTaskLogs orders the results by cp_task_logs terms.
|
|
func ByCpTaskLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newCpTaskLogsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
func newCpUserStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(CpUserInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, CpUserTable, CpUserColumn),
|
|
)
|
|
}
|
|
func newSysUserStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(SysUserInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, SysUserTable, SysUserColumn),
|
|
)
|
|
}
|
|
func newCpTaskLogsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(CpTaskLogsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, CpTaskLogsTable, CpTaskLogsColumn),
|
|
)
|
|
}
|