Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6840b69f1a | |||
| 1ae2601209 | |||
| 07444f70df | |||
| 1bc04c74f3 | |||
| dcb5cd8a4e | |||
| 0d7d4c11a0 | |||
| e4d07874eb | |||
| ae9984460f |
+6
-1
@@ -37,4 +37,9 @@ fromName = "今日校园系统"
|
||||
accessKey = "dzckoE1UlZe8XFItWQDI"
|
||||
secretKey = "f8UZdnDohtwZk5HInT1Cw1QCztSGnFuPPqfSSjzu"
|
||||
baseUrl = "http://s3.out"
|
||||
bucket = "likedream"
|
||||
bucket = "likedream"
|
||||
|
||||
[cpdaily]
|
||||
appVersion = "5.7.0"
|
||||
systemVersion = "iOS 17"
|
||||
calVersion = "3.0.0"
|
||||
@@ -31,6 +31,7 @@ type MenuAddReq struct {
|
||||
Route string `json:"route"`
|
||||
Component string `json:"component"`
|
||||
Hidden bool `json:"hidden"`
|
||||
KeepAlive bool `json:"keepAlive"`
|
||||
Icon string `json:"icon"`
|
||||
Order uint `json:"order"`
|
||||
ParentId int64 `json:"parentId"`
|
||||
|
||||
@@ -16,6 +16,7 @@ type UserMenuRes struct {
|
||||
Route string `json:"route"`
|
||||
Component string `json:"component"`
|
||||
Hidden bool `json:"hidden"`
|
||||
KeepAlive bool `json:"keepAlive"`
|
||||
Icon string `json:"icon"`
|
||||
Children []*UserMenuRes `json:"children"`
|
||||
Order uint `json:"order"`
|
||||
|
||||
@@ -42,10 +42,10 @@ func NewImageClassifier(modelPath, classesPath string) (*ImageClassifier, error)
|
||||
dir = filepath.Join(dir, "onnxruntime.so")
|
||||
break
|
||||
}
|
||||
logger.Logger.Info("初始化onnx:", zap.String("绝对路径", absPath), zap.String("父文件夹", dir))
|
||||
ort.SetSharedLibraryPath(dir)
|
||||
err = ort.InitializeEnvironment()
|
||||
if err != nil {
|
||||
logger.Logger.Info("初始化onnx:", zap.String("绝对路径", absPath), zap.String("父文件夹", dir))
|
||||
return nil, fmt.Errorf("初始化ONNX Runtime失败: %v", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -174,9 +174,9 @@ func (c *CpdailyCasLogin) Login(ctx context.Context, schoolDetail *school.School
|
||||
if saltValue != "" {
|
||||
salt = saltValue
|
||||
} else {
|
||||
saltMatches := saltRegexp.FindAllString(string(loginPageBytes), -1)
|
||||
if len(saltMatches) > 0 {
|
||||
salt = saltMatches[0]
|
||||
saltMatches := saltRegexp.FindStringSubmatch(string(loginPageBytes))
|
||||
if len(saltMatches) > 1 {
|
||||
salt = saltMatches[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,6 +237,7 @@ func (c *CpdailyCasLogin) Login(ctx context.Context, schoolDetail *school.School
|
||||
if isCasNeedKickOut(doc) {
|
||||
kickoutResponse := submitCasKickOut(ctx, loginResponseUrl.String(), doc, c.client)
|
||||
handleCasLoginSuccess(ctx, kickoutResponse, schoolDetail, username, password, c.client)
|
||||
return
|
||||
}
|
||||
|
||||
message := getCasErrorMessage(doc)
|
||||
|
||||
@@ -605,9 +605,9 @@ func (c *CpdailySleepCheckTask) FillCustomForm(ctx context.Context, form map[str
|
||||
} else {
|
||||
// 否则,填充查寝其他参数
|
||||
if signInstanceWidVar := rows["signInstanceWid"]; signInstanceWidVar != nil {
|
||||
resultForm["signInstanceWid"] = gvar.New(signInstanceWidVar.String())
|
||||
resultForm["SignInstanceWid"] = gvar.New(signInstanceWidVar.String())
|
||||
} else {
|
||||
resultForm["signInstanceWid"] = gvar.New("")
|
||||
resultForm["SignInstanceWid"] = gvar.New("")
|
||||
}
|
||||
|
||||
// 查找 isMalposition 参数
|
||||
@@ -676,7 +676,6 @@ func (c *CpdailySleepCheckTask) Submit(ctx context.Context, form map[string]*gva
|
||||
sign := taskhelper.GetSubmitSign(submitData)
|
||||
|
||||
submitData["sign"] = gvar.New(sign)
|
||||
utils.OkOrPanic(errors.NewBusinessError(503, "临时拦截"), oops.WithContext(ctx).Wrap)
|
||||
response, e := c.client.R().
|
||||
SetBody(submitData).
|
||||
WithContext(ctx).
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
var Cpdaily = resty.New().
|
||||
SetCookieJar(nil).
|
||||
SetTimeout(30 * time.Second).
|
||||
SetDoNotParseResponse(true)
|
||||
SetDoNotParseResponse(true).
|
||||
SetTLSClientConfig(&tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
})
|
||||
|
||||
func init() {
|
||||
if !utils.IsDebug() {
|
||||
Cpdaily.SetDebug(false)
|
||||
} else {
|
||||
Cpdaily.SetProxy("http://127.0.0.1:9000").
|
||||
SetTLSClientConfig(&tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
})
|
||||
Cpdaily.SetProxy("http://127.0.0.1:9000")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package errors
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBusinessError(t *testing.T) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
of, b := Of[*BusinessError](err.(error))
|
||||
t.Log(of, b)
|
||||
t.Log("ok")
|
||||
}
|
||||
}()
|
||||
err := NewBusinessError(503, "调试错误")
|
||||
panic(err)
|
||||
}
|
||||
func Of[T error](input error) (T, bool) {
|
||||
var ret T
|
||||
if errors.As(input, &ret) {
|
||||
return ret, true
|
||||
}
|
||||
|
||||
return ret, false
|
||||
}
|
||||
@@ -575,7 +575,8 @@ func (c *CpSchoolClient) QueryCpusers(_m *CpSchool) *CpUserQuery {
|
||||
|
||||
// Hooks returns the client hooks.
|
||||
func (c *CpSchoolClient) Hooks() []Hook {
|
||||
return c.hooks.CpSchool
|
||||
hooks := c.hooks.CpSchool
|
||||
return append(hooks[:len(hooks):len(hooks)], cpschool.Hooks[:]...)
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
@@ -765,7 +766,8 @@ func (c *CpTaskClient) QueryCpTaskLogs(_m *CpTask) *CpTaskLogQuery {
|
||||
|
||||
// Hooks returns the client hooks.
|
||||
func (c *CpTaskClient) Hooks() []Hook {
|
||||
return c.hooks.CpTask
|
||||
hooks := c.hooks.CpTask
|
||||
return append(hooks[:len(hooks):len(hooks)], cptask.Hooks[:]...)
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
@@ -955,7 +957,8 @@ func (c *CpTaskLogClient) QueryCpUser(_m *CpTaskLog) *CpUserQuery {
|
||||
|
||||
// Hooks returns the client hooks.
|
||||
func (c *CpTaskLogClient) Hooks() []Hook {
|
||||
return c.hooks.CpTaskLog
|
||||
hooks := c.hooks.CpTaskLog
|
||||
return append(hooks[:len(hooks):len(hooks)], cptasklog.Hooks[:]...)
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
@@ -1164,7 +1167,8 @@ func (c *CpUserClient) QuerySchool(_m *CpUser) *CpSchoolQuery {
|
||||
|
||||
// Hooks returns the client hooks.
|
||||
func (c *CpUserClient) Hooks() []Hook {
|
||||
return c.hooks.CpUser
|
||||
hooks := c.hooks.CpUser
|
||||
return append(hooks[:len(hooks):len(hooks)], cpuser.Hooks[:]...)
|
||||
}
|
||||
|
||||
// Interceptors returns the client interceptors.
|
||||
|
||||
@@ -5,6 +5,7 @@ package ent
|
||||
import (
|
||||
"fmt"
|
||||
"likedream-goframe/internal/ent/cpschool"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
@@ -16,6 +17,10 @@ type CpSchool struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID string `json:"id,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *ent2.CustomTime `json:"updateTime"`
|
||||
// Name holds the value of the "name" field.
|
||||
Name string `json:"name,omitempty"`
|
||||
// NamePinyin holds the value of the "name_pinyin" field.
|
||||
@@ -52,6 +57,8 @@ func (*CpSchool) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case cpschool.FieldCreateTime, cpschool.FieldUpdateTime:
|
||||
values[i] = new(ent2.CustomTime)
|
||||
case cpschool.FieldID, cpschool.FieldName, cpschool.FieldNamePinyin, cpschool.FieldIconImg:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
@@ -75,6 +82,18 @@ func (_m *CpSchool) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
_m.ID = value.String
|
||||
}
|
||||
case cpschool.FieldCreateTime:
|
||||
if value, ok := values[i].(*ent2.CustomTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value != nil {
|
||||
_m.CreateTime = value
|
||||
}
|
||||
case cpschool.FieldUpdateTime:
|
||||
if value, ok := values[i].(*ent2.CustomTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value != nil {
|
||||
_m.UpdateTime = value
|
||||
}
|
||||
case cpschool.FieldName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field name", values[i])
|
||||
@@ -134,6 +153,12 @@ func (_m *CpSchool) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("CpSchool(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.CreateTime))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UpdateTime))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("name=")
|
||||
builder.WriteString(_m.Name)
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
package cpschool
|
||||
|
||||
import (
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
@@ -12,6 +15,10 @@ const (
|
||||
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.
|
||||
@@ -34,6 +41,8 @@ const (
|
||||
// Columns holds all SQL columns for cpschool fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldCreateTime,
|
||||
FieldUpdateTime,
|
||||
FieldName,
|
||||
FieldNamePinyin,
|
||||
FieldIconImg,
|
||||
@@ -49,6 +58,19 @@ func ValidColumn(column string) bool {
|
||||
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)
|
||||
|
||||
@@ -57,6 +79,16 @@ 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()
|
||||
|
||||
@@ -5,6 +5,7 @@ package cpschool
|
||||
import (
|
||||
"likedream-goframe/internal/ent/internal"
|
||||
"likedream-goframe/internal/ent/predicate"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -65,6 +66,16 @@ func IDContainsFold(id string) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldContainsFold(FieldID, id))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
|
||||
func Name(v string) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldEQ(FieldName, v))
|
||||
@@ -80,6 +91,146 @@ func IconImg(v string) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldEQ(FieldIconImg, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...*ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...*ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeContains applies the Contains predicate on the "create_time" field.
|
||||
func CreateTimeContains(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldContains(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeHasPrefix applies the HasPrefix predicate on the "create_time" field.
|
||||
func CreateTimeHasPrefix(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldHasPrefix(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeHasSuffix applies the HasSuffix predicate on the "create_time" field.
|
||||
func CreateTimeHasSuffix(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldHasSuffix(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeEqualFold applies the EqualFold predicate on the "create_time" field.
|
||||
func CreateTimeEqualFold(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldEqualFold(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeContainsFold applies the ContainsFold predicate on the "create_time" field.
|
||||
func CreateTimeContainsFold(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldContainsFold(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...*ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...*ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v *ent2.CustomTime) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeContains applies the Contains predicate on the "update_time" field.
|
||||
func UpdateTimeContains(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldContains(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeHasPrefix applies the HasPrefix predicate on the "update_time" field.
|
||||
func UpdateTimeHasPrefix(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldHasPrefix(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeHasSuffix applies the HasSuffix predicate on the "update_time" field.
|
||||
func UpdateTimeHasSuffix(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldHasSuffix(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeEqualFold applies the EqualFold predicate on the "update_time" field.
|
||||
func UpdateTimeEqualFold(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldEqualFold(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeContainsFold applies the ContainsFold predicate on the "update_time" field.
|
||||
func UpdateTimeContainsFold(v *ent2.CustomTime) predicate.CpSchool {
|
||||
vc := v.String()
|
||||
return predicate.CpSchool(sql.FieldContainsFold(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.CpSchool {
|
||||
return predicate.CpSchool(sql.FieldEQ(FieldName, v))
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"likedream-goframe/internal/ent/cpschool"
|
||||
"likedream-goframe/internal/ent/cpuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
@@ -23,6 +24,18 @@ type CpSchoolCreate struct {
|
||||
conflict []sql.ConflictOption
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *CpSchoolCreate) SetCreateTime(v *ent2.CustomTime) *CpSchoolCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *CpSchoolCreate) SetUpdateTime(v *ent2.CustomTime) *CpSchoolCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (_c *CpSchoolCreate) SetName(v string) *CpSchoolCreate {
|
||||
_c.mutation.SetName(v)
|
||||
@@ -77,6 +90,9 @@ func (_c *CpSchoolCreate) Mutation() *CpSchoolMutation {
|
||||
|
||||
// Save creates the CpSchool in the database.
|
||||
func (_c *CpSchoolCreate) Save(ctx context.Context) (*CpSchool, error) {
|
||||
if err := _c.defaults(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
@@ -102,8 +118,33 @@ func (_c *CpSchoolCreate) ExecX(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (_c *CpSchoolCreate) defaults() error {
|
||||
if _, ok := _c.mutation.CreateTime(); !ok {
|
||||
if cpschool.DefaultCreateTime == nil {
|
||||
return fmt.Errorf("ent: uninitialized cpschool.DefaultCreateTime (forgotten import ent/runtime?)")
|
||||
}
|
||||
v := cpschool.DefaultCreateTime()
|
||||
_c.mutation.SetCreateTime(v)
|
||||
}
|
||||
if _, ok := _c.mutation.UpdateTime(); !ok {
|
||||
if cpschool.DefaultUpdateTime == nil {
|
||||
return fmt.Errorf("ent: uninitialized cpschool.DefaultUpdateTime (forgotten import ent/runtime?)")
|
||||
}
|
||||
v := cpschool.DefaultUpdateTime()
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_c *CpSchoolCreate) check() error {
|
||||
if _, ok := _c.mutation.CreateTime(); !ok {
|
||||
return &ValidationError{Name: "create_time", err: errors.New(`ent: missing required field "CpSchool.create_time"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.UpdateTime(); !ok {
|
||||
return &ValidationError{Name: "update_time", err: errors.New(`ent: missing required field "CpSchool.update_time"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Name(); !ok {
|
||||
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "CpSchool.name"`)}
|
||||
}
|
||||
@@ -147,6 +188,14 @@ func (_c *CpSchoolCreate) createSpec() (*CpSchool, *sqlgraph.CreateSpec) {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(cpschool.FieldCreateTime, field.TypeString, value)
|
||||
_node.CreateTime = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cpschool.FieldUpdateTime, field.TypeString, value)
|
||||
_node.UpdateTime = value
|
||||
}
|
||||
if value, ok := _c.mutation.Name(); ok {
|
||||
_spec.SetField(cpschool.FieldName, field.TypeString, value)
|
||||
_node.Name = value
|
||||
@@ -183,7 +232,7 @@ func (_c *CpSchoolCreate) createSpec() (*CpSchool, *sqlgraph.CreateSpec) {
|
||||
// of the `INSERT` statement. For example:
|
||||
//
|
||||
// client.CpSchool.Create().
|
||||
// SetName(v).
|
||||
// SetCreateTime(v).
|
||||
// OnConflict(
|
||||
// // Update the row with the new values
|
||||
// // the was proposed for insertion.
|
||||
@@ -192,7 +241,7 @@ func (_c *CpSchoolCreate) createSpec() (*CpSchool, *sqlgraph.CreateSpec) {
|
||||
// // Override some of the fields with custom
|
||||
// // update values.
|
||||
// Update(func(u *ent.CpSchoolUpsert) {
|
||||
// SetName(v+v).
|
||||
// SetCreateTime(v+v).
|
||||
// }).
|
||||
// Exec(ctx)
|
||||
func (_c *CpSchoolCreate) OnConflict(opts ...sql.ConflictOption) *CpSchoolUpsertOne {
|
||||
@@ -228,6 +277,18 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpSchoolUpsert) SetUpdateTime(v *ent2.CustomTime) *CpSchoolUpsert {
|
||||
u.Set(cpschool.FieldUpdateTime, v)
|
||||
return u
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpSchoolUpsert) UpdateUpdateTime() *CpSchoolUpsert {
|
||||
u.SetExcluded(cpschool.FieldUpdateTime)
|
||||
return u
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (u *CpSchoolUpsert) SetName(v string) *CpSchoolUpsert {
|
||||
u.Set(cpschool.FieldName, v)
|
||||
@@ -287,6 +348,9 @@ func (u *CpSchoolUpsertOne) UpdateNewValues() *CpSchoolUpsertOne {
|
||||
if _, exists := u.create.mutation.ID(); exists {
|
||||
s.SetIgnore(cpschool.FieldID)
|
||||
}
|
||||
if _, exists := u.create.mutation.CreateTime(); exists {
|
||||
s.SetIgnore(cpschool.FieldCreateTime)
|
||||
}
|
||||
}))
|
||||
return u
|
||||
}
|
||||
@@ -318,6 +382,20 @@ func (u *CpSchoolUpsertOne) Update(set func(*CpSchoolUpsert)) *CpSchoolUpsertOne
|
||||
return u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpSchoolUpsertOne) SetUpdateTime(v *ent2.CustomTime) *CpSchoolUpsertOne {
|
||||
return u.Update(func(s *CpSchoolUpsert) {
|
||||
s.SetUpdateTime(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpSchoolUpsertOne) UpdateUpdateTime() *CpSchoolUpsertOne {
|
||||
return u.Update(func(s *CpSchoolUpsert) {
|
||||
s.UpdateUpdateTime()
|
||||
})
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (u *CpSchoolUpsertOne) SetName(v string) *CpSchoolUpsertOne {
|
||||
return u.Update(func(s *CpSchoolUpsert) {
|
||||
@@ -424,6 +502,7 @@ func (_c *CpSchoolCreateBulk) Save(ctx context.Context) ([]*CpSchool, error) {
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
builder.defaults()
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*CpSchoolMutation)
|
||||
if !ok {
|
||||
@@ -502,7 +581,7 @@ func (_c *CpSchoolCreateBulk) ExecX(ctx context.Context) {
|
||||
// // Override some of the fields with custom
|
||||
// // update values.
|
||||
// Update(func(u *ent.CpSchoolUpsert) {
|
||||
// SetName(v+v).
|
||||
// SetCreateTime(v+v).
|
||||
// }).
|
||||
// Exec(ctx)
|
||||
func (_c *CpSchoolCreateBulk) OnConflict(opts ...sql.ConflictOption) *CpSchoolUpsertBulk {
|
||||
@@ -549,6 +628,9 @@ func (u *CpSchoolUpsertBulk) UpdateNewValues() *CpSchoolUpsertBulk {
|
||||
if _, exists := b.mutation.ID(); exists {
|
||||
s.SetIgnore(cpschool.FieldID)
|
||||
}
|
||||
if _, exists := b.mutation.CreateTime(); exists {
|
||||
s.SetIgnore(cpschool.FieldCreateTime)
|
||||
}
|
||||
}
|
||||
}))
|
||||
return u
|
||||
@@ -581,6 +663,20 @@ func (u *CpSchoolUpsertBulk) Update(set func(*CpSchoolUpsert)) *CpSchoolUpsertBu
|
||||
return u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpSchoolUpsertBulk) SetUpdateTime(v *ent2.CustomTime) *CpSchoolUpsertBulk {
|
||||
return u.Update(func(s *CpSchoolUpsert) {
|
||||
s.SetUpdateTime(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpSchoolUpsertBulk) UpdateUpdateTime() *CpSchoolUpsertBulk {
|
||||
return u.Update(func(s *CpSchoolUpsert) {
|
||||
s.UpdateUpdateTime()
|
||||
})
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (u *CpSchoolUpsertBulk) SetName(v string) *CpSchoolUpsertBulk {
|
||||
return u.Update(func(s *CpSchoolUpsert) {
|
||||
|
||||
@@ -307,12 +307,12 @@ func (_q *CpSchoolQuery) WithCpusers(opts ...func(*CpUserQuery)) *CpSchoolQuery
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// Name string `json:"name,omitempty"`
|
||||
// CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.CpSchool.Query().
|
||||
// GroupBy(cpschool.FieldName).
|
||||
// GroupBy(cpschool.FieldCreateTime).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *CpSchoolQuery) GroupBy(field string, fields ...string) *CpSchoolGroupBy {
|
||||
@@ -330,11 +330,11 @@ func (_q *CpSchoolQuery) GroupBy(field string, fields ...string) *CpSchoolGroupB
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// Name string `json:"name,omitempty"`
|
||||
// CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// }
|
||||
//
|
||||
// client.CpSchool.Query().
|
||||
// Select(cpschool.FieldName).
|
||||
// Select(cpschool.FieldCreateTime).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *CpSchoolQuery) Select(fields ...string) *CpSchoolSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"likedream-goframe/internal/ent/cpuser"
|
||||
"likedream-goframe/internal/ent/internal"
|
||||
"likedream-goframe/internal/ent/predicate"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -30,6 +31,12 @@ func (_u *CpSchoolUpdate) Where(ps ...predicate.CpSchool) *CpSchoolUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *CpSchoolUpdate) SetUpdateTime(v *ent2.CustomTime) *CpSchoolUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (_u *CpSchoolUpdate) SetName(v string) *CpSchoolUpdate {
|
||||
_u.mutation.SetName(v)
|
||||
@@ -161,6 +168,9 @@ func (_u *CpSchoolUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cpschool.FieldUpdateTime, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Name(); ok {
|
||||
_spec.SetField(cpschool.FieldName, field.TypeString, value)
|
||||
}
|
||||
@@ -245,6 +255,12 @@ type CpSchoolUpdateOne struct {
|
||||
modifiers []func(*sql.UpdateBuilder)
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *CpSchoolUpdateOne) SetUpdateTime(v *ent2.CustomTime) *CpSchoolUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (_u *CpSchoolUpdateOne) SetName(v string) *CpSchoolUpdateOne {
|
||||
_u.mutation.SetName(v)
|
||||
@@ -406,6 +422,9 @@ func (_u *CpSchoolUpdateOne) sqlSave(ctx context.Context) (_node *CpSchool, err
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cpschool.FieldUpdateTime, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Name(); ok {
|
||||
_spec.SetField(cpschool.FieldName, field.TypeString, value)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"likedream-goframe/internal/ent/cptask"
|
||||
"likedream-goframe/internal/ent/cpuser"
|
||||
"likedream-goframe/internal/ent/sysuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
@@ -18,6 +19,10 @@ type CpTask struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *ent2.CustomTime `json:"updateTime"`
|
||||
// CpUserID holds the value of the "cp_user_id" field.
|
||||
CpUserID int64 `json:"cp_user_id,omitempty"`
|
||||
// UserID holds the value of the "user_id" field.
|
||||
@@ -100,6 +105,8 @@ func (*CpTask) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case cptask.FieldCreateTime, cptask.FieldUpdateTime:
|
||||
values[i] = new(ent2.CustomTime)
|
||||
case cptask.FieldID, cptask.FieldCpUserID, cptask.FieldUserID, cptask.FieldFrequency, cptask.FieldSuccessCount, cptask.FieldExecuteHour, cptask.FieldExecuteMinute, cptask.FieldNextExecuteTime:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case cptask.FieldTaskType, cptask.FieldTitle, cptask.FieldTaskStatus, cptask.FieldFormData, cptask.FieldStep, cptask.FieldNotificationType:
|
||||
@@ -125,6 +132,18 @@ func (_m *CpTask) assignValues(columns []string, values []any) error {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case cptask.FieldCreateTime:
|
||||
if value, ok := values[i].(*ent2.CustomTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value != nil {
|
||||
_m.CreateTime = value
|
||||
}
|
||||
case cptask.FieldUpdateTime:
|
||||
if value, ok := values[i].(*ent2.CustomTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value != nil {
|
||||
_m.UpdateTime = value
|
||||
}
|
||||
case cptask.FieldCpUserID:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field cp_user_id", values[i])
|
||||
@@ -257,6 +276,12 @@ func (_m *CpTask) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("CpTask(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.CreateTime))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UpdateTime))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("cp_user_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.CpUserID))
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -4,7 +4,9 @@ package cptask
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
@@ -14,6 +16,10 @@ const (
|
||||
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.
|
||||
@@ -74,6 +80,8 @@ const (
|
||||
// Columns holds all SQL columns for cptask fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldCreateTime,
|
||||
FieldUpdateTime,
|
||||
FieldCpUserID,
|
||||
FieldUserID,
|
||||
FieldTaskType,
|
||||
@@ -99,7 +107,17 @@ func ValidColumn(column string) bool {
|
||||
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.
|
||||
@@ -215,6 +233,16 @@ 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()
|
||||
|
||||
@@ -5,6 +5,7 @@ package cptask
|
||||
import (
|
||||
"likedream-goframe/internal/ent/internal"
|
||||
"likedream-goframe/internal/ent/predicate"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -55,6 +56,16 @@ func IDLTE(id int64) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// CpUserID applies equality check predicate on the "cp_user_id" field. It's identical to CpUserIDEQ.
|
||||
func CpUserID(v int64) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldEQ(FieldCpUserID, v))
|
||||
@@ -100,6 +111,146 @@ func NextExecuteTime(v int64) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldEQ(FieldNextExecuteTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...*ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...*ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeContains applies the Contains predicate on the "create_time" field.
|
||||
func CreateTimeContains(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldContains(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeHasPrefix applies the HasPrefix predicate on the "create_time" field.
|
||||
func CreateTimeHasPrefix(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldHasPrefix(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeHasSuffix applies the HasSuffix predicate on the "create_time" field.
|
||||
func CreateTimeHasSuffix(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldHasSuffix(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeEqualFold applies the EqualFold predicate on the "create_time" field.
|
||||
func CreateTimeEqualFold(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldEqualFold(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeContainsFold applies the ContainsFold predicate on the "create_time" field.
|
||||
func CreateTimeContainsFold(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldContainsFold(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...*ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...*ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v *ent2.CustomTime) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeContains applies the Contains predicate on the "update_time" field.
|
||||
func UpdateTimeContains(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldContains(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeHasPrefix applies the HasPrefix predicate on the "update_time" field.
|
||||
func UpdateTimeHasPrefix(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldHasPrefix(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeHasSuffix applies the HasSuffix predicate on the "update_time" field.
|
||||
func UpdateTimeHasSuffix(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldHasSuffix(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeEqualFold applies the EqualFold predicate on the "update_time" field.
|
||||
func UpdateTimeEqualFold(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldEqualFold(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeContainsFold applies the ContainsFold predicate on the "update_time" field.
|
||||
func UpdateTimeContainsFold(v *ent2.CustomTime) predicate.CpTask {
|
||||
vc := v.String()
|
||||
return predicate.CpTask(sql.FieldContainsFold(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// CpUserIDEQ applies the EQ predicate on the "cp_user_id" field.
|
||||
func CpUserIDEQ(v int64) predicate.CpTask {
|
||||
return predicate.CpTask(sql.FieldEQ(FieldCpUserID, v))
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"likedream-goframe/internal/ent/cptasklog"
|
||||
"likedream-goframe/internal/ent/cpuser"
|
||||
"likedream-goframe/internal/ent/sysuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -24,6 +25,18 @@ type CpTaskCreate struct {
|
||||
conflict []sql.ConflictOption
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *CpTaskCreate) SetCreateTime(v *ent2.CustomTime) *CpTaskCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *CpTaskCreate) SetUpdateTime(v *ent2.CustomTime) *CpTaskCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCpUserID sets the "cp_user_id" field.
|
||||
func (_c *CpTaskCreate) SetCpUserID(v int64) *CpTaskCreate {
|
||||
_c.mutation.SetCpUserID(v)
|
||||
@@ -188,7 +201,9 @@ func (_c *CpTaskCreate) Mutation() *CpTaskMutation {
|
||||
|
||||
// Save creates the CpTask in the database.
|
||||
func (_c *CpTaskCreate) Save(ctx context.Context) (*CpTask, error) {
|
||||
_c.defaults()
|
||||
if err := _c.defaults(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
@@ -215,7 +230,21 @@ func (_c *CpTaskCreate) ExecX(ctx context.Context) {
|
||||
}
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (_c *CpTaskCreate) defaults() {
|
||||
func (_c *CpTaskCreate) defaults() error {
|
||||
if _, ok := _c.mutation.CreateTime(); !ok {
|
||||
if cptask.DefaultCreateTime == nil {
|
||||
return fmt.Errorf("ent: uninitialized cptask.DefaultCreateTime (forgotten import ent/runtime?)")
|
||||
}
|
||||
v := cptask.DefaultCreateTime()
|
||||
_c.mutation.SetCreateTime(v)
|
||||
}
|
||||
if _, ok := _c.mutation.UpdateTime(); !ok {
|
||||
if cptask.DefaultUpdateTime == nil {
|
||||
return fmt.Errorf("ent: uninitialized cptask.DefaultUpdateTime (forgotten import ent/runtime?)")
|
||||
}
|
||||
v := cptask.DefaultUpdateTime()
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
}
|
||||
if _, ok := _c.mutation.Frequency(); !ok {
|
||||
v := cptask.DefaultFrequency
|
||||
_c.mutation.SetFrequency(v)
|
||||
@@ -224,10 +253,17 @@ func (_c *CpTaskCreate) defaults() {
|
||||
v := cptask.DefaultSuccessCount
|
||||
_c.mutation.SetSuccessCount(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_c *CpTaskCreate) check() error {
|
||||
if _, ok := _c.mutation.CreateTime(); !ok {
|
||||
return &ValidationError{Name: "create_time", err: errors.New(`ent: missing required field "CpTask.create_time"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.UpdateTime(); !ok {
|
||||
return &ValidationError{Name: "update_time", err: errors.New(`ent: missing required field "CpTask.update_time"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.CpUserID(); !ok {
|
||||
return &ValidationError{Name: "cp_user_id", err: errors.New(`ent: missing required field "CpTask.cp_user_id"`)}
|
||||
}
|
||||
@@ -314,6 +350,14 @@ func (_c *CpTaskCreate) createSpec() (*CpTask, *sqlgraph.CreateSpec) {
|
||||
)
|
||||
_spec.Schema = _c.schemaConfig.CpTask
|
||||
_spec.OnConflict = _c.conflict
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(cptask.FieldCreateTime, field.TypeString, value)
|
||||
_node.CreateTime = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cptask.FieldUpdateTime, field.TypeString, value)
|
||||
_node.UpdateTime = value
|
||||
}
|
||||
if value, ok := _c.mutation.TaskType(); ok {
|
||||
_spec.SetField(cptask.FieldTaskType, field.TypeEnum, value)
|
||||
_node.TaskType = value
|
||||
@@ -418,7 +462,7 @@ func (_c *CpTaskCreate) createSpec() (*CpTask, *sqlgraph.CreateSpec) {
|
||||
// of the `INSERT` statement. For example:
|
||||
//
|
||||
// client.CpTask.Create().
|
||||
// SetCpUserID(v).
|
||||
// SetCreateTime(v).
|
||||
// OnConflict(
|
||||
// // Update the row with the new values
|
||||
// // the was proposed for insertion.
|
||||
@@ -427,7 +471,7 @@ func (_c *CpTaskCreate) createSpec() (*CpTask, *sqlgraph.CreateSpec) {
|
||||
// // Override some of the fields with custom
|
||||
// // update values.
|
||||
// Update(func(u *ent.CpTaskUpsert) {
|
||||
// SetCpUserID(v+v).
|
||||
// SetCreateTime(v+v).
|
||||
// }).
|
||||
// Exec(ctx)
|
||||
func (_c *CpTaskCreate) OnConflict(opts ...sql.ConflictOption) *CpTaskUpsertOne {
|
||||
@@ -463,6 +507,18 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpTaskUpsert) SetUpdateTime(v *ent2.CustomTime) *CpTaskUpsert {
|
||||
u.Set(cptask.FieldUpdateTime, v)
|
||||
return u
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpTaskUpsert) UpdateUpdateTime() *CpTaskUpsert {
|
||||
u.SetExcluded(cptask.FieldUpdateTime)
|
||||
return u
|
||||
}
|
||||
|
||||
// SetCpUserID sets the "cp_user_id" field.
|
||||
func (u *CpTaskUpsert) SetCpUserID(v int64) *CpTaskUpsert {
|
||||
u.Set(cptask.FieldCpUserID, v)
|
||||
@@ -683,6 +739,11 @@ func (u *CpTaskUpsert) ClearNextExecuteTime() *CpTaskUpsert {
|
||||
// Exec(ctx)
|
||||
func (u *CpTaskUpsertOne) UpdateNewValues() *CpTaskUpsertOne {
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
||||
if _, exists := u.create.mutation.CreateTime(); exists {
|
||||
s.SetIgnore(cptask.FieldCreateTime)
|
||||
}
|
||||
}))
|
||||
return u
|
||||
}
|
||||
|
||||
@@ -713,6 +774,20 @@ func (u *CpTaskUpsertOne) Update(set func(*CpTaskUpsert)) *CpTaskUpsertOne {
|
||||
return u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpTaskUpsertOne) SetUpdateTime(v *ent2.CustomTime) *CpTaskUpsertOne {
|
||||
return u.Update(func(s *CpTaskUpsert) {
|
||||
s.SetUpdateTime(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpTaskUpsertOne) UpdateUpdateTime() *CpTaskUpsertOne {
|
||||
return u.Update(func(s *CpTaskUpsert) {
|
||||
s.UpdateUpdateTime()
|
||||
})
|
||||
}
|
||||
|
||||
// SetCpUserID sets the "cp_user_id" field.
|
||||
func (u *CpTaskUpsertOne) SetCpUserID(v int64) *CpTaskUpsertOne {
|
||||
return u.Update(func(s *CpTaskUpsert) {
|
||||
@@ -1093,7 +1168,7 @@ func (_c *CpTaskCreateBulk) ExecX(ctx context.Context) {
|
||||
// // Override some of the fields with custom
|
||||
// // update values.
|
||||
// Update(func(u *ent.CpTaskUpsert) {
|
||||
// SetCpUserID(v+v).
|
||||
// SetCreateTime(v+v).
|
||||
// }).
|
||||
// Exec(ctx)
|
||||
func (_c *CpTaskCreateBulk) OnConflict(opts ...sql.ConflictOption) *CpTaskUpsertBulk {
|
||||
@@ -1132,6 +1207,13 @@ type CpTaskUpsertBulk struct {
|
||||
// Exec(ctx)
|
||||
func (u *CpTaskUpsertBulk) UpdateNewValues() *CpTaskUpsertBulk {
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
||||
for _, b := range u.create.builders {
|
||||
if _, exists := b.mutation.CreateTime(); exists {
|
||||
s.SetIgnore(cptask.FieldCreateTime)
|
||||
}
|
||||
}
|
||||
}))
|
||||
return u
|
||||
}
|
||||
|
||||
@@ -1162,6 +1244,20 @@ func (u *CpTaskUpsertBulk) Update(set func(*CpTaskUpsert)) *CpTaskUpsertBulk {
|
||||
return u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpTaskUpsertBulk) SetUpdateTime(v *ent2.CustomTime) *CpTaskUpsertBulk {
|
||||
return u.Update(func(s *CpTaskUpsert) {
|
||||
s.SetUpdateTime(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpTaskUpsertBulk) UpdateUpdateTime() *CpTaskUpsertBulk {
|
||||
return u.Update(func(s *CpTaskUpsert) {
|
||||
s.UpdateUpdateTime()
|
||||
})
|
||||
}
|
||||
|
||||
// SetCpUserID sets the "cp_user_id" field.
|
||||
func (u *CpTaskUpsertBulk) SetCpUserID(v int64) *CpTaskUpsertBulk {
|
||||
return u.Update(func(s *CpTaskUpsert) {
|
||||
|
||||
@@ -385,12 +385,12 @@ func (_q *CpTaskQuery) WithCpTaskLogs(opts ...func(*CpTaskLogQuery)) *CpTaskQuer
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// CpUserID int64 `json:"cp_user_id,omitempty"`
|
||||
// CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.CpTask.Query().
|
||||
// GroupBy(cptask.FieldCpUserID).
|
||||
// GroupBy(cptask.FieldCreateTime).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *CpTaskQuery) GroupBy(field string, fields ...string) *CpTaskGroupBy {
|
||||
@@ -408,11 +408,11 @@ func (_q *CpTaskQuery) GroupBy(field string, fields ...string) *CpTaskGroupBy {
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// CpUserID int64 `json:"cp_user_id,omitempty"`
|
||||
// CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// }
|
||||
//
|
||||
// client.CpTask.Query().
|
||||
// Select(cptask.FieldCpUserID).
|
||||
// Select(cptask.FieldCreateTime).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *CpTaskQuery) Select(fields ...string) *CpTaskSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"likedream-goframe/internal/ent/internal"
|
||||
"likedream-goframe/internal/ent/predicate"
|
||||
"likedream-goframe/internal/ent/sysuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -32,6 +33,12 @@ func (_u *CpTaskUpdate) Where(ps ...predicate.CpTask) *CpTaskUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *CpTaskUpdate) SetUpdateTime(v *ent2.CustomTime) *CpTaskUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCpUserID sets the "cp_user_id" field.
|
||||
func (_u *CpTaskUpdate) SetCpUserID(v int64) *CpTaskUpdate {
|
||||
_u.mutation.SetCpUserID(v)
|
||||
@@ -423,6 +430,9 @@ func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cptask.FieldUpdateTime, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.TaskType(); ok {
|
||||
_spec.SetField(cptask.FieldTaskType, field.TypeEnum, value)
|
||||
}
|
||||
@@ -617,6 +627,12 @@ type CpTaskUpdateOne struct {
|
||||
modifiers []func(*sql.UpdateBuilder)
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *CpTaskUpdateOne) SetUpdateTime(v *ent2.CustomTime) *CpTaskUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCpUserID sets the "cp_user_id" field.
|
||||
func (_u *CpTaskUpdateOne) SetCpUserID(v int64) *CpTaskUpdateOne {
|
||||
_u.mutation.SetCpUserID(v)
|
||||
@@ -1038,6 +1054,9 @@ func (_u *CpTaskUpdateOne) sqlSave(ctx context.Context) (_node *CpTask, err erro
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cptask.FieldUpdateTime, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.TaskType(); ok {
|
||||
_spec.SetField(cptask.FieldTaskType, field.TypeEnum, value)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"likedream-goframe/internal/ent/cptasklog"
|
||||
"likedream-goframe/internal/ent/cpuser"
|
||||
"likedream-goframe/internal/ent/sysuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
@@ -19,6 +20,10 @@ type CpTaskLog struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *ent2.CustomTime `json:"updateTime"`
|
||||
// CpTaskID holds the value of the "cp_task_id" field.
|
||||
CpTaskID int64 `json:"cp_task_id,omitempty"`
|
||||
// SystemUserID holds the value of the "system_user_id" field.
|
||||
@@ -88,6 +93,8 @@ func (*CpTaskLog) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case cptasklog.FieldCreateTime, cptasklog.FieldUpdateTime:
|
||||
values[i] = new(ent2.CustomTime)
|
||||
case cptasklog.FieldIsSuccess:
|
||||
values[i] = new(sql.NullBool)
|
||||
case cptasklog.FieldID, cptasklog.FieldCpTaskID, cptasklog.FieldSystemUserID, cptasklog.FieldCpUserID:
|
||||
@@ -115,6 +122,18 @@ func (_m *CpTaskLog) assignValues(columns []string, values []any) error {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case cptasklog.FieldCreateTime:
|
||||
if value, ok := values[i].(*ent2.CustomTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value != nil {
|
||||
_m.CreateTime = value
|
||||
}
|
||||
case cptasklog.FieldUpdateTime:
|
||||
if value, ok := values[i].(*ent2.CustomTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value != nil {
|
||||
_m.UpdateTime = value
|
||||
}
|
||||
case cptasklog.FieldCpTaskID:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field cp_task_id", values[i])
|
||||
@@ -202,6 +221,12 @@ func (_m *CpTaskLog) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("CpTaskLog(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.CreateTime))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UpdateTime))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("cp_task_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.CpTaskID))
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
package cptasklog
|
||||
|
||||
import (
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
@@ -12,6 +15,10 @@ const (
|
||||
Label = "cp_task_log"
|
||||
// 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"
|
||||
// FieldCpTaskID holds the string denoting the cp_task_id field in the database.
|
||||
FieldCpTaskID = "cp_task_id"
|
||||
// FieldSystemUserID holds the string denoting the system_user_id field in the database.
|
||||
@@ -58,6 +65,8 @@ const (
|
||||
// Columns holds all SQL columns for cptasklog fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldCreateTime,
|
||||
FieldUpdateTime,
|
||||
FieldCpTaskID,
|
||||
FieldSystemUserID,
|
||||
FieldCpUserID,
|
||||
@@ -76,6 +85,19 @@ func ValidColumn(column string) bool {
|
||||
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 CpTaskLog queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
@@ -84,6 +106,16 @@ 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()
|
||||
}
|
||||
|
||||
// ByCpTaskID orders the results by the cp_task_id field.
|
||||
func ByCpTaskID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCpTaskID, opts...).ToFunc()
|
||||
|
||||
@@ -5,6 +5,7 @@ package cptasklog
|
||||
import (
|
||||
"likedream-goframe/internal/ent/internal"
|
||||
"likedream-goframe/internal/ent/predicate"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -55,6 +56,16 @@ func IDLTE(id int64) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// CpTaskID applies equality check predicate on the "cp_task_id" field. It's identical to CpTaskIDEQ.
|
||||
func CpTaskID(v int64) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldEQ(FieldCpTaskID, v))
|
||||
@@ -85,6 +96,146 @@ func RealName(v string) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldEQ(FieldRealName, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...*ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...*ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeContains applies the Contains predicate on the "create_time" field.
|
||||
func CreateTimeContains(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldContains(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeHasPrefix applies the HasPrefix predicate on the "create_time" field.
|
||||
func CreateTimeHasPrefix(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldHasPrefix(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeHasSuffix applies the HasSuffix predicate on the "create_time" field.
|
||||
func CreateTimeHasSuffix(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldHasSuffix(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeEqualFold applies the EqualFold predicate on the "create_time" field.
|
||||
func CreateTimeEqualFold(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldEqualFold(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeContainsFold applies the ContainsFold predicate on the "create_time" field.
|
||||
func CreateTimeContainsFold(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldContainsFold(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...*ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...*ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeContains applies the Contains predicate on the "update_time" field.
|
||||
func UpdateTimeContains(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldContains(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeHasPrefix applies the HasPrefix predicate on the "update_time" field.
|
||||
func UpdateTimeHasPrefix(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldHasPrefix(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeHasSuffix applies the HasSuffix predicate on the "update_time" field.
|
||||
func UpdateTimeHasSuffix(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldHasSuffix(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeEqualFold applies the EqualFold predicate on the "update_time" field.
|
||||
func UpdateTimeEqualFold(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldEqualFold(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeContainsFold applies the ContainsFold predicate on the "update_time" field.
|
||||
func UpdateTimeContainsFold(v *ent2.CustomTime) predicate.CpTaskLog {
|
||||
vc := v.String()
|
||||
return predicate.CpTaskLog(sql.FieldContainsFold(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// CpTaskIDEQ applies the EQ predicate on the "cp_task_id" field.
|
||||
func CpTaskIDEQ(v int64) predicate.CpTaskLog {
|
||||
return predicate.CpTaskLog(sql.FieldEQ(FieldCpTaskID, v))
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"likedream-goframe/internal/ent/cptasklog"
|
||||
"likedream-goframe/internal/ent/cpuser"
|
||||
"likedream-goframe/internal/ent/sysuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -24,6 +25,18 @@ type CpTaskLogCreate struct {
|
||||
conflict []sql.ConflictOption
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *CpTaskLogCreate) SetCreateTime(v *ent2.CustomTime) *CpTaskLogCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *CpTaskLogCreate) SetUpdateTime(v *ent2.CustomTime) *CpTaskLogCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCpTaskID sets the "cp_task_id" field.
|
||||
func (_c *CpTaskLogCreate) SetCpTaskID(v int64) *CpTaskLogCreate {
|
||||
_c.mutation.SetCpTaskID(v)
|
||||
@@ -98,6 +111,9 @@ func (_c *CpTaskLogCreate) Mutation() *CpTaskLogMutation {
|
||||
|
||||
// Save creates the CpTaskLog in the database.
|
||||
func (_c *CpTaskLogCreate) Save(ctx context.Context) (*CpTaskLog, error) {
|
||||
if err := _c.defaults(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
@@ -123,8 +139,33 @@ func (_c *CpTaskLogCreate) ExecX(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (_c *CpTaskLogCreate) defaults() error {
|
||||
if _, ok := _c.mutation.CreateTime(); !ok {
|
||||
if cptasklog.DefaultCreateTime == nil {
|
||||
return fmt.Errorf("ent: uninitialized cptasklog.DefaultCreateTime (forgotten import ent/runtime?)")
|
||||
}
|
||||
v := cptasklog.DefaultCreateTime()
|
||||
_c.mutation.SetCreateTime(v)
|
||||
}
|
||||
if _, ok := _c.mutation.UpdateTime(); !ok {
|
||||
if cptasklog.DefaultUpdateTime == nil {
|
||||
return fmt.Errorf("ent: uninitialized cptasklog.DefaultUpdateTime (forgotten import ent/runtime?)")
|
||||
}
|
||||
v := cptasklog.DefaultUpdateTime()
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_c *CpTaskLogCreate) check() error {
|
||||
if _, ok := _c.mutation.CreateTime(); !ok {
|
||||
return &ValidationError{Name: "create_time", err: errors.New(`ent: missing required field "CpTaskLog.create_time"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.UpdateTime(); !ok {
|
||||
return &ValidationError{Name: "update_time", err: errors.New(`ent: missing required field "CpTaskLog.update_time"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.CpTaskID(); !ok {
|
||||
return &ValidationError{Name: "cp_task_id", err: errors.New(`ent: missing required field "CpTaskLog.cp_task_id"`)}
|
||||
}
|
||||
@@ -174,6 +215,14 @@ func (_c *CpTaskLogCreate) createSpec() (*CpTaskLog, *sqlgraph.CreateSpec) {
|
||||
)
|
||||
_spec.Schema = _c.schemaConfig.CpTaskLog
|
||||
_spec.OnConflict = _c.conflict
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(cptasklog.FieldCreateTime, field.TypeString, value)
|
||||
_node.CreateTime = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cptasklog.FieldUpdateTime, field.TypeString, value)
|
||||
_node.UpdateTime = value
|
||||
}
|
||||
if value, ok := _c.mutation.IsSuccess(); ok {
|
||||
_spec.SetField(cptasklog.FieldIsSuccess, field.TypeBool, value)
|
||||
_node.IsSuccess = value
|
||||
@@ -247,7 +296,7 @@ func (_c *CpTaskLogCreate) createSpec() (*CpTaskLog, *sqlgraph.CreateSpec) {
|
||||
// of the `INSERT` statement. For example:
|
||||
//
|
||||
// client.CpTaskLog.Create().
|
||||
// SetCpTaskID(v).
|
||||
// SetCreateTime(v).
|
||||
// OnConflict(
|
||||
// // Update the row with the new values
|
||||
// // the was proposed for insertion.
|
||||
@@ -256,7 +305,7 @@ func (_c *CpTaskLogCreate) createSpec() (*CpTaskLog, *sqlgraph.CreateSpec) {
|
||||
// // Override some of the fields with custom
|
||||
// // update values.
|
||||
// Update(func(u *ent.CpTaskLogUpsert) {
|
||||
// SetCpTaskID(v+v).
|
||||
// SetCreateTime(v+v).
|
||||
// }).
|
||||
// Exec(ctx)
|
||||
func (_c *CpTaskLogCreate) OnConflict(opts ...sql.ConflictOption) *CpTaskLogUpsertOne {
|
||||
@@ -292,6 +341,18 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpTaskLogUpsert) SetUpdateTime(v *ent2.CustomTime) *CpTaskLogUpsert {
|
||||
u.Set(cptasklog.FieldUpdateTime, v)
|
||||
return u
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpTaskLogUpsert) UpdateUpdateTime() *CpTaskLogUpsert {
|
||||
u.SetExcluded(cptasklog.FieldUpdateTime)
|
||||
return u
|
||||
}
|
||||
|
||||
// SetCpTaskID sets the "cp_task_id" field.
|
||||
func (u *CpTaskLogUpsert) SetCpTaskID(v int64) *CpTaskLogUpsert {
|
||||
u.Set(cptasklog.FieldCpTaskID, v)
|
||||
@@ -386,6 +447,11 @@ func (u *CpTaskLogUpsert) ClearRealName() *CpTaskLogUpsert {
|
||||
// Exec(ctx)
|
||||
func (u *CpTaskLogUpsertOne) UpdateNewValues() *CpTaskLogUpsertOne {
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
||||
if _, exists := u.create.mutation.CreateTime(); exists {
|
||||
s.SetIgnore(cptasklog.FieldCreateTime)
|
||||
}
|
||||
}))
|
||||
return u
|
||||
}
|
||||
|
||||
@@ -416,6 +482,20 @@ func (u *CpTaskLogUpsertOne) Update(set func(*CpTaskLogUpsert)) *CpTaskLogUpsert
|
||||
return u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpTaskLogUpsertOne) SetUpdateTime(v *ent2.CustomTime) *CpTaskLogUpsertOne {
|
||||
return u.Update(func(s *CpTaskLogUpsert) {
|
||||
s.SetUpdateTime(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpTaskLogUpsertOne) UpdateUpdateTime() *CpTaskLogUpsertOne {
|
||||
return u.Update(func(s *CpTaskLogUpsert) {
|
||||
s.UpdateUpdateTime()
|
||||
})
|
||||
}
|
||||
|
||||
// SetCpTaskID sets the "cp_task_id" field.
|
||||
func (u *CpTaskLogUpsertOne) SetCpTaskID(v int64) *CpTaskLogUpsertOne {
|
||||
return u.Update(func(s *CpTaskLogUpsert) {
|
||||
@@ -566,6 +646,7 @@ func (_c *CpTaskLogCreateBulk) Save(ctx context.Context) ([]*CpTaskLog, error) {
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
builder.defaults()
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*CpTaskLogMutation)
|
||||
if !ok {
|
||||
@@ -648,7 +729,7 @@ func (_c *CpTaskLogCreateBulk) ExecX(ctx context.Context) {
|
||||
// // Override some of the fields with custom
|
||||
// // update values.
|
||||
// Update(func(u *ent.CpTaskLogUpsert) {
|
||||
// SetCpTaskID(v+v).
|
||||
// SetCreateTime(v+v).
|
||||
// }).
|
||||
// Exec(ctx)
|
||||
func (_c *CpTaskLogCreateBulk) OnConflict(opts ...sql.ConflictOption) *CpTaskLogUpsertBulk {
|
||||
@@ -687,6 +768,13 @@ type CpTaskLogUpsertBulk struct {
|
||||
// Exec(ctx)
|
||||
func (u *CpTaskLogUpsertBulk) UpdateNewValues() *CpTaskLogUpsertBulk {
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
||||
for _, b := range u.create.builders {
|
||||
if _, exists := b.mutation.CreateTime(); exists {
|
||||
s.SetIgnore(cptasklog.FieldCreateTime)
|
||||
}
|
||||
}
|
||||
}))
|
||||
return u
|
||||
}
|
||||
|
||||
@@ -717,6 +805,20 @@ func (u *CpTaskLogUpsertBulk) Update(set func(*CpTaskLogUpsert)) *CpTaskLogUpser
|
||||
return u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpTaskLogUpsertBulk) SetUpdateTime(v *ent2.CustomTime) *CpTaskLogUpsertBulk {
|
||||
return u.Update(func(s *CpTaskLogUpsert) {
|
||||
s.SetUpdateTime(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpTaskLogUpsertBulk) UpdateUpdateTime() *CpTaskLogUpsertBulk {
|
||||
return u.Update(func(s *CpTaskLogUpsert) {
|
||||
s.UpdateUpdateTime()
|
||||
})
|
||||
}
|
||||
|
||||
// SetCpTaskID sets the "cp_task_id" field.
|
||||
func (u *CpTaskLogUpsertBulk) SetCpTaskID(v int64) *CpTaskLogUpsertBulk {
|
||||
return u.Update(func(s *CpTaskLogUpsert) {
|
||||
|
||||
@@ -383,12 +383,12 @@ func (_q *CpTaskLogQuery) WithCpUser(opts ...func(*CpUserQuery)) *CpTaskLogQuery
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// CpTaskID int64 `json:"cp_task_id,omitempty"`
|
||||
// CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.CpTaskLog.Query().
|
||||
// GroupBy(cptasklog.FieldCpTaskID).
|
||||
// GroupBy(cptasklog.FieldCreateTime).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *CpTaskLogQuery) GroupBy(field string, fields ...string) *CpTaskLogGroupBy {
|
||||
@@ -406,11 +406,11 @@ func (_q *CpTaskLogQuery) GroupBy(field string, fields ...string) *CpTaskLogGrou
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// CpTaskID int64 `json:"cp_task_id,omitempty"`
|
||||
// CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// }
|
||||
//
|
||||
// client.CpTaskLog.Query().
|
||||
// Select(cptasklog.FieldCpTaskID).
|
||||
// Select(cptasklog.FieldCreateTime).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *CpTaskLogQuery) Select(fields ...string) *CpTaskLogSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"likedream-goframe/internal/ent/internal"
|
||||
"likedream-goframe/internal/ent/predicate"
|
||||
"likedream-goframe/internal/ent/sysuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -32,6 +33,12 @@ func (_u *CpTaskLogUpdate) Where(ps ...predicate.CpTaskLog) *CpTaskLogUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *CpTaskLogUpdate) SetUpdateTime(v *ent2.CustomTime) *CpTaskLogUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCpTaskID sets the "cp_task_id" field.
|
||||
func (_u *CpTaskLogUpdate) SetCpTaskID(v int64) *CpTaskLogUpdate {
|
||||
_u.mutation.SetCpTaskID(v)
|
||||
@@ -225,6 +232,9 @@ func (_u *CpTaskLogUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cptasklog.FieldUpdateTime, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.IsSuccess(); ok {
|
||||
_spec.SetField(cptasklog.FieldIsSuccess, field.TypeBool, value)
|
||||
}
|
||||
@@ -357,6 +367,12 @@ type CpTaskLogUpdateOne struct {
|
||||
modifiers []func(*sql.UpdateBuilder)
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *CpTaskLogUpdateOne) SetUpdateTime(v *ent2.CustomTime) *CpTaskLogUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCpTaskID sets the "cp_task_id" field.
|
||||
func (_u *CpTaskLogUpdateOne) SetCpTaskID(v int64) *CpTaskLogUpdateOne {
|
||||
_u.mutation.SetCpTaskID(v)
|
||||
@@ -580,6 +596,9 @@ func (_u *CpTaskLogUpdateOne) sqlSave(ctx context.Context) (_node *CpTaskLog, er
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cptasklog.FieldUpdateTime, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.IsSuccess(); ok {
|
||||
_spec.SetField(cptasklog.FieldIsSuccess, field.TypeBool, value)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"likedream-goframe/internal/ent/cpschool"
|
||||
"likedream-goframe/internal/ent/cpuser"
|
||||
"likedream-goframe/internal/ent/sysuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
@@ -18,6 +19,10 @@ type CpUser struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *ent2.CustomTime `json:"updateTime"`
|
||||
// UserID holds the value of the "user_id" field.
|
||||
UserID int64 `json:"user_id,omitempty"`
|
||||
// Username holds the value of the "username" field.
|
||||
@@ -102,6 +107,8 @@ func (*CpUser) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case cpuser.FieldCreateTime, cpuser.FieldUpdateTime:
|
||||
values[i] = new(ent2.CustomTime)
|
||||
case cpuser.FieldID, cpuser.FieldUserID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case cpuser.FieldUsername, cpuser.FieldPassword, cpuser.FieldSchoolID, cpuser.FieldEmail, cpuser.FieldMobileCode, cpuser.FieldCookie, cpuser.FieldMobileType:
|
||||
@@ -127,6 +134,18 @@ func (_m *CpUser) assignValues(columns []string, values []any) error {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case cpuser.FieldCreateTime:
|
||||
if value, ok := values[i].(*ent2.CustomTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value != nil {
|
||||
_m.CreateTime = value
|
||||
}
|
||||
case cpuser.FieldUpdateTime:
|
||||
if value, ok := values[i].(*ent2.CustomTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value != nil {
|
||||
_m.UpdateTime = value
|
||||
}
|
||||
case cpuser.FieldUserID:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field user_id", values[i])
|
||||
@@ -231,6 +250,12 @@ func (_m *CpUser) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("CpUser(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.CreateTime))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UpdateTime))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("user_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UserID))
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -4,7 +4,9 @@ package cpuser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
@@ -14,6 +16,10 @@ const (
|
||||
Label = "cp_user"
|
||||
// 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.
|
||||
@@ -73,6 +79,8 @@ const (
|
||||
// Columns holds all SQL columns for cpuser fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldCreateTime,
|
||||
FieldUpdateTime,
|
||||
FieldUserID,
|
||||
FieldUsername,
|
||||
FieldPassword,
|
||||
@@ -93,7 +101,17 @@ func ValidColumn(column string) bool {
|
||||
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
|
||||
// UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
||||
UsernameValidator func(string) error
|
||||
// PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
||||
@@ -133,6 +151,16 @@ 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()
|
||||
|
||||
@@ -5,6 +5,7 @@ package cpuser
|
||||
import (
|
||||
"likedream-goframe/internal/ent/internal"
|
||||
"likedream-goframe/internal/ent/predicate"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -55,6 +56,16 @@ func IDLTE(id int64) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
|
||||
func UserID(v int64) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldEQ(FieldUserID, v))
|
||||
@@ -90,6 +101,146 @@ func Cookie(v string) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldEQ(FieldCookie, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...*ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...*ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeContains applies the Contains predicate on the "create_time" field.
|
||||
func CreateTimeContains(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldContains(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeHasPrefix applies the HasPrefix predicate on the "create_time" field.
|
||||
func CreateTimeHasPrefix(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldHasPrefix(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeHasSuffix applies the HasSuffix predicate on the "create_time" field.
|
||||
func CreateTimeHasSuffix(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldHasSuffix(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeEqualFold applies the EqualFold predicate on the "create_time" field.
|
||||
func CreateTimeEqualFold(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldEqualFold(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// CreateTimeContainsFold applies the ContainsFold predicate on the "create_time" field.
|
||||
func CreateTimeContainsFold(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldContainsFold(FieldCreateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...*ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...*ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v *ent2.CustomTime) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeContains applies the Contains predicate on the "update_time" field.
|
||||
func UpdateTimeContains(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldContains(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeHasPrefix applies the HasPrefix predicate on the "update_time" field.
|
||||
func UpdateTimeHasPrefix(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldHasPrefix(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeHasSuffix applies the HasSuffix predicate on the "update_time" field.
|
||||
func UpdateTimeHasSuffix(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldHasSuffix(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeEqualFold applies the EqualFold predicate on the "update_time" field.
|
||||
func UpdateTimeEqualFold(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldEqualFold(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UpdateTimeContainsFold applies the ContainsFold predicate on the "update_time" field.
|
||||
func UpdateTimeContainsFold(v *ent2.CustomTime) predicate.CpUser {
|
||||
vc := v.String()
|
||||
return predicate.CpUser(sql.FieldContainsFold(FieldUpdateTime, vc))
|
||||
}
|
||||
|
||||
// UserIDEQ applies the EQ predicate on the "user_id" field.
|
||||
func UserIDEQ(v int64) predicate.CpUser {
|
||||
return predicate.CpUser(sql.FieldEQ(FieldUserID, v))
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"likedream-goframe/internal/ent/cptasklog"
|
||||
"likedream-goframe/internal/ent/cpuser"
|
||||
"likedream-goframe/internal/ent/sysuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -25,6 +26,18 @@ type CpUserCreate struct {
|
||||
conflict []sql.ConflictOption
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *CpUserCreate) SetCreateTime(v *ent2.CustomTime) *CpUserCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *CpUserCreate) SetUpdateTime(v *ent2.CustomTime) *CpUserCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUserID sets the "user_id" field.
|
||||
func (_c *CpUserCreate) SetUserID(v int64) *CpUserCreate {
|
||||
_c.mutation.SetUserID(v)
|
||||
@@ -150,6 +163,9 @@ func (_c *CpUserCreate) Mutation() *CpUserMutation {
|
||||
|
||||
// Save creates the CpUser in the database.
|
||||
func (_c *CpUserCreate) Save(ctx context.Context) (*CpUser, error) {
|
||||
if err := _c.defaults(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
@@ -175,8 +191,33 @@ func (_c *CpUserCreate) ExecX(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (_c *CpUserCreate) defaults() error {
|
||||
if _, ok := _c.mutation.CreateTime(); !ok {
|
||||
if cpuser.DefaultCreateTime == nil {
|
||||
return fmt.Errorf("ent: uninitialized cpuser.DefaultCreateTime (forgotten import ent/runtime?)")
|
||||
}
|
||||
v := cpuser.DefaultCreateTime()
|
||||
_c.mutation.SetCreateTime(v)
|
||||
}
|
||||
if _, ok := _c.mutation.UpdateTime(); !ok {
|
||||
if cpuser.DefaultUpdateTime == nil {
|
||||
return fmt.Errorf("ent: uninitialized cpuser.DefaultUpdateTime (forgotten import ent/runtime?)")
|
||||
}
|
||||
v := cpuser.DefaultUpdateTime()
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_c *CpUserCreate) check() error {
|
||||
if _, ok := _c.mutation.CreateTime(); !ok {
|
||||
return &ValidationError{Name: "create_time", err: errors.New(`ent: missing required field "CpUser.create_time"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.UpdateTime(); !ok {
|
||||
return &ValidationError{Name: "update_time", err: errors.New(`ent: missing required field "CpUser.update_time"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.UserID(); !ok {
|
||||
return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "CpUser.user_id"`)}
|
||||
}
|
||||
@@ -246,6 +287,14 @@ func (_c *CpUserCreate) createSpec() (*CpUser, *sqlgraph.CreateSpec) {
|
||||
)
|
||||
_spec.Schema = _c.schemaConfig.CpUser
|
||||
_spec.OnConflict = _c.conflict
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(cpuser.FieldCreateTime, field.TypeString, value)
|
||||
_node.CreateTime = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cpuser.FieldUpdateTime, field.TypeString, value)
|
||||
_node.UpdateTime = value
|
||||
}
|
||||
if value, ok := _c.mutation.Username(); ok {
|
||||
_spec.SetField(cpuser.FieldUsername, field.TypeString, value)
|
||||
_node.Username = value
|
||||
@@ -347,7 +396,7 @@ func (_c *CpUserCreate) createSpec() (*CpUser, *sqlgraph.CreateSpec) {
|
||||
// of the `INSERT` statement. For example:
|
||||
//
|
||||
// client.CpUser.Create().
|
||||
// SetUserID(v).
|
||||
// SetCreateTime(v).
|
||||
// OnConflict(
|
||||
// // Update the row with the new values
|
||||
// // the was proposed for insertion.
|
||||
@@ -356,7 +405,7 @@ func (_c *CpUserCreate) createSpec() (*CpUser, *sqlgraph.CreateSpec) {
|
||||
// // Override some of the fields with custom
|
||||
// // update values.
|
||||
// Update(func(u *ent.CpUserUpsert) {
|
||||
// SetUserID(v+v).
|
||||
// SetCreateTime(v+v).
|
||||
// }).
|
||||
// Exec(ctx)
|
||||
func (_c *CpUserCreate) OnConflict(opts ...sql.ConflictOption) *CpUserUpsertOne {
|
||||
@@ -392,6 +441,18 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpUserUpsert) SetUpdateTime(v *ent2.CustomTime) *CpUserUpsert {
|
||||
u.Set(cpuser.FieldUpdateTime, v)
|
||||
return u
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpUserUpsert) UpdateUpdateTime() *CpUserUpsert {
|
||||
u.SetExcluded(cpuser.FieldUpdateTime)
|
||||
return u
|
||||
}
|
||||
|
||||
// SetUserID sets the "user_id" field.
|
||||
func (u *CpUserUpsert) SetUserID(v int64) *CpUserUpsert {
|
||||
u.Set(cpuser.FieldUserID, v)
|
||||
@@ -516,6 +577,11 @@ func (u *CpUserUpsert) UpdateMobileType() *CpUserUpsert {
|
||||
// Exec(ctx)
|
||||
func (u *CpUserUpsertOne) UpdateNewValues() *CpUserUpsertOne {
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
||||
if _, exists := u.create.mutation.CreateTime(); exists {
|
||||
s.SetIgnore(cpuser.FieldCreateTime)
|
||||
}
|
||||
}))
|
||||
return u
|
||||
}
|
||||
|
||||
@@ -546,6 +612,20 @@ func (u *CpUserUpsertOne) Update(set func(*CpUserUpsert)) *CpUserUpsertOne {
|
||||
return u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpUserUpsertOne) SetUpdateTime(v *ent2.CustomTime) *CpUserUpsertOne {
|
||||
return u.Update(func(s *CpUserUpsert) {
|
||||
s.SetUpdateTime(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpUserUpsertOne) UpdateUpdateTime() *CpUserUpsertOne {
|
||||
return u.Update(func(s *CpUserUpsert) {
|
||||
s.UpdateUpdateTime()
|
||||
})
|
||||
}
|
||||
|
||||
// SetUserID sets the "user_id" field.
|
||||
func (u *CpUserUpsertOne) SetUserID(v int64) *CpUserUpsertOne {
|
||||
return u.Update(func(s *CpUserUpsert) {
|
||||
@@ -731,6 +811,7 @@ func (_c *CpUserCreateBulk) Save(ctx context.Context) ([]*CpUser, error) {
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
builder.defaults()
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*CpUserMutation)
|
||||
if !ok {
|
||||
@@ -813,7 +894,7 @@ func (_c *CpUserCreateBulk) ExecX(ctx context.Context) {
|
||||
// // Override some of the fields with custom
|
||||
// // update values.
|
||||
// Update(func(u *ent.CpUserUpsert) {
|
||||
// SetUserID(v+v).
|
||||
// SetCreateTime(v+v).
|
||||
// }).
|
||||
// Exec(ctx)
|
||||
func (_c *CpUserCreateBulk) OnConflict(opts ...sql.ConflictOption) *CpUserUpsertBulk {
|
||||
@@ -852,6 +933,13 @@ type CpUserUpsertBulk struct {
|
||||
// Exec(ctx)
|
||||
func (u *CpUserUpsertBulk) UpdateNewValues() *CpUserUpsertBulk {
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
||||
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
||||
for _, b := range u.create.builders {
|
||||
if _, exists := b.mutation.CreateTime(); exists {
|
||||
s.SetIgnore(cpuser.FieldCreateTime)
|
||||
}
|
||||
}
|
||||
}))
|
||||
return u
|
||||
}
|
||||
|
||||
@@ -882,6 +970,20 @@ func (u *CpUserUpsertBulk) Update(set func(*CpUserUpsert)) *CpUserUpsertBulk {
|
||||
return u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (u *CpUserUpsertBulk) SetUpdateTime(v *ent2.CustomTime) *CpUserUpsertBulk {
|
||||
return u.Update(func(s *CpUserUpsert) {
|
||||
s.SetUpdateTime(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
||||
func (u *CpUserUpsertBulk) UpdateUpdateTime() *CpUserUpsertBulk {
|
||||
return u.Update(func(s *CpUserUpsert) {
|
||||
s.UpdateUpdateTime()
|
||||
})
|
||||
}
|
||||
|
||||
// SetUserID sets the "user_id" field.
|
||||
func (u *CpUserUpsertBulk) SetUserID(v int64) *CpUserUpsertBulk {
|
||||
return u.Update(func(s *CpUserUpsert) {
|
||||
|
||||
@@ -425,12 +425,12 @@ func (_q *CpUserQuery) WithSchool(opts ...func(*CpSchoolQuery)) *CpUserQuery {
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// UserID int64 `json:"user_id,omitempty"`
|
||||
// CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.CpUser.Query().
|
||||
// GroupBy(cpuser.FieldUserID).
|
||||
// GroupBy(cpuser.FieldCreateTime).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *CpUserQuery) GroupBy(field string, fields ...string) *CpUserGroupBy {
|
||||
@@ -448,11 +448,11 @@ func (_q *CpUserQuery) GroupBy(field string, fields ...string) *CpUserGroupBy {
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// UserID int64 `json:"user_id,omitempty"`
|
||||
// CreateTime *ent2.CustomTime `json:"createTime"`
|
||||
// }
|
||||
//
|
||||
// client.CpUser.Query().
|
||||
// Select(cpuser.FieldUserID).
|
||||
// Select(cpuser.FieldCreateTime).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *CpUserQuery) Select(fields ...string) *CpUserSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"likedream-goframe/internal/ent/internal"
|
||||
"likedream-goframe/internal/ent/predicate"
|
||||
"likedream-goframe/internal/ent/sysuser"
|
||||
"likedream-goframe/internal/framework/ent2"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@@ -33,6 +34,12 @@ func (_u *CpUserUpdate) Where(ps ...predicate.CpUser) *CpUserUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *CpUserUpdate) SetUpdateTime(v *ent2.CustomTime) *CpUserUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUserID sets the "user_id" field.
|
||||
func (_u *CpUserUpdate) SetUserID(v int64) *CpUserUpdate {
|
||||
_u.mutation.SetUserID(v)
|
||||
@@ -344,6 +351,9 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cpuser.FieldUpdateTime, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Username(); ok {
|
||||
_spec.SetField(cpuser.FieldUsername, field.TypeString, value)
|
||||
}
|
||||
@@ -553,6 +563,12 @@ type CpUserUpdateOne struct {
|
||||
modifiers []func(*sql.UpdateBuilder)
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *CpUserUpdateOne) SetUpdateTime(v *ent2.CustomTime) *CpUserUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUserID sets the "user_id" field.
|
||||
func (_u *CpUserUpdateOne) SetUserID(v int64) *CpUserUpdateOne {
|
||||
_u.mutation.SetUserID(v)
|
||||
@@ -894,6 +910,9 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(cpuser.FieldUpdateTime, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Username(); ok {
|
||||
_spec.SetField(cpuser.FieldUsername, field.TypeString, value)
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ var schemaGraph = func() *sqlgraph.Schema {
|
||||
},
|
||||
Type: "CpSchool",
|
||||
Fields: map[string]*sqlgraph.FieldSpec{
|
||||
cpschool.FieldCreateTime: {Type: field.TypeString, Column: cpschool.FieldCreateTime},
|
||||
cpschool.FieldUpdateTime: {Type: field.TypeString, Column: cpschool.FieldUpdateTime},
|
||||
cpschool.FieldName: {Type: field.TypeString, Column: cpschool.FieldName},
|
||||
cpschool.FieldNamePinyin: {Type: field.TypeString, Column: cpschool.FieldNamePinyin},
|
||||
cpschool.FieldIconImg: {Type: field.TypeString, Column: cpschool.FieldIconImg},
|
||||
@@ -72,6 +74,8 @@ var schemaGraph = func() *sqlgraph.Schema {
|
||||
},
|
||||
Type: "CpTask",
|
||||
Fields: map[string]*sqlgraph.FieldSpec{
|
||||
cptask.FieldCreateTime: {Type: field.TypeString, Column: cptask.FieldCreateTime},
|
||||
cptask.FieldUpdateTime: {Type: field.TypeString, Column: cptask.FieldUpdateTime},
|
||||
cptask.FieldCpUserID: {Type: field.TypeInt64, Column: cptask.FieldCpUserID},
|
||||
cptask.FieldUserID: {Type: field.TypeInt64, Column: cptask.FieldUserID},
|
||||
cptask.FieldTaskType: {Type: field.TypeEnum, Column: cptask.FieldTaskType},
|
||||
@@ -98,6 +102,8 @@ var schemaGraph = func() *sqlgraph.Schema {
|
||||
},
|
||||
Type: "CpTaskLog",
|
||||
Fields: map[string]*sqlgraph.FieldSpec{
|
||||
cptasklog.FieldCreateTime: {Type: field.TypeString, Column: cptasklog.FieldCreateTime},
|
||||
cptasklog.FieldUpdateTime: {Type: field.TypeString, Column: cptasklog.FieldUpdateTime},
|
||||
cptasklog.FieldCpTaskID: {Type: field.TypeInt64, Column: cptasklog.FieldCpTaskID},
|
||||
cptasklog.FieldSystemUserID: {Type: field.TypeInt64, Column: cptasklog.FieldSystemUserID},
|
||||
cptasklog.FieldCpUserID: {Type: field.TypeInt64, Column: cptasklog.FieldCpUserID},
|
||||
@@ -117,6 +123,8 @@ var schemaGraph = func() *sqlgraph.Schema {
|
||||
},
|
||||
Type: "CpUser",
|
||||
Fields: map[string]*sqlgraph.FieldSpec{
|
||||
cpuser.FieldCreateTime: {Type: field.TypeString, Column: cpuser.FieldCreateTime},
|
||||
cpuser.FieldUpdateTime: {Type: field.TypeString, Column: cpuser.FieldUpdateTime},
|
||||
cpuser.FieldUserID: {Type: field.TypeInt64, Column: cpuser.FieldUserID},
|
||||
cpuser.FieldUsername: {Type: field.TypeString, Column: cpuser.FieldUsername},
|
||||
cpuser.FieldPassword: {Type: field.TypeString, Column: cpuser.FieldPassword},
|
||||
@@ -186,6 +194,7 @@ var schemaGraph = func() *sqlgraph.Schema {
|
||||
sysmenu.FieldPermission: {Type: field.TypeString, Column: sysmenu.FieldPermission},
|
||||
sysmenu.FieldRoute: {Type: field.TypeString, Column: sysmenu.FieldRoute},
|
||||
sysmenu.FieldComponent: {Type: field.TypeString, Column: sysmenu.FieldComponent},
|
||||
sysmenu.FieldKeepAlive: {Type: field.TypeBool, Column: sysmenu.FieldKeepAlive},
|
||||
sysmenu.FieldHidden: {Type: field.TypeBool, Column: sysmenu.FieldHidden},
|
||||
sysmenu.FieldIcon: {Type: field.TypeString, Column: sysmenu.FieldIcon},
|
||||
sysmenu.FieldOrder: {Type: field.TypeUint, Column: sysmenu.FieldOrder},
|
||||
@@ -767,6 +776,16 @@ func (f *CpSchoolFilter) WhereID(p entql.StringP) {
|
||||
f.Where(p.Field(cpschool.FieldID))
|
||||
}
|
||||
|
||||
// WhereCreateTime applies the entql string predicate on the create_time field.
|
||||
func (f *CpSchoolFilter) WhereCreateTime(p entql.StringP) {
|
||||
f.Where(p.Field(cpschool.FieldCreateTime))
|
||||
}
|
||||
|
||||
// WhereUpdateTime applies the entql string predicate on the update_time field.
|
||||
func (f *CpSchoolFilter) WhereUpdateTime(p entql.StringP) {
|
||||
f.Where(p.Field(cpschool.FieldUpdateTime))
|
||||
}
|
||||
|
||||
// WhereName applies the entql string predicate on the name field.
|
||||
func (f *CpSchoolFilter) WhereName(p entql.StringP) {
|
||||
f.Where(p.Field(cpschool.FieldName))
|
||||
@@ -836,6 +855,16 @@ func (f *CpTaskFilter) WhereID(p entql.Int64P) {
|
||||
f.Where(p.Field(cptask.FieldID))
|
||||
}
|
||||
|
||||
// WhereCreateTime applies the entql string predicate on the create_time field.
|
||||
func (f *CpTaskFilter) WhereCreateTime(p entql.StringP) {
|
||||
f.Where(p.Field(cptask.FieldCreateTime))
|
||||
}
|
||||
|
||||
// WhereUpdateTime applies the entql string predicate on the update_time field.
|
||||
func (f *CpTaskFilter) WhereUpdateTime(p entql.StringP) {
|
||||
f.Where(p.Field(cptask.FieldUpdateTime))
|
||||
}
|
||||
|
||||
// WhereCpUserID applies the entql int64 predicate on the cp_user_id field.
|
||||
func (f *CpTaskFilter) WhereCpUserID(p entql.Int64P) {
|
||||
f.Where(p.Field(cptask.FieldCpUserID))
|
||||
@@ -983,6 +1012,16 @@ func (f *CpTaskLogFilter) WhereID(p entql.Int64P) {
|
||||
f.Where(p.Field(cptasklog.FieldID))
|
||||
}
|
||||
|
||||
// WhereCreateTime applies the entql string predicate on the create_time field.
|
||||
func (f *CpTaskLogFilter) WhereCreateTime(p entql.StringP) {
|
||||
f.Where(p.Field(cptasklog.FieldCreateTime))
|
||||
}
|
||||
|
||||
// WhereUpdateTime applies the entql string predicate on the update_time field.
|
||||
func (f *CpTaskLogFilter) WhereUpdateTime(p entql.StringP) {
|
||||
f.Where(p.Field(cptasklog.FieldUpdateTime))
|
||||
}
|
||||
|
||||
// WhereCpTaskID applies the entql int64 predicate on the cp_task_id field.
|
||||
func (f *CpTaskLogFilter) WhereCpTaskID(p entql.Int64P) {
|
||||
f.Where(p.Field(cptasklog.FieldCpTaskID))
|
||||
@@ -1095,6 +1134,16 @@ func (f *CpUserFilter) WhereID(p entql.Int64P) {
|
||||
f.Where(p.Field(cpuser.FieldID))
|
||||
}
|
||||
|
||||
// WhereCreateTime applies the entql string predicate on the create_time field.
|
||||
func (f *CpUserFilter) WhereCreateTime(p entql.StringP) {
|
||||
f.Where(p.Field(cpuser.FieldCreateTime))
|
||||
}
|
||||
|
||||
// WhereUpdateTime applies the entql string predicate on the update_time field.
|
||||
func (f *CpUserFilter) WhereUpdateTime(p entql.StringP) {
|
||||
f.Where(p.Field(cpuser.FieldUpdateTime))
|
||||
}
|
||||
|
||||
// WhereUserID applies the entql int64 predicate on the user_id field.
|
||||
func (f *CpUserFilter) WhereUserID(p entql.Int64P) {
|
||||
f.Where(p.Field(cpuser.FieldUserID))
|
||||
@@ -1477,6 +1526,11 @@ func (f *SysMenuFilter) WhereComponent(p entql.StringP) {
|
||||
f.Where(p.Field(sysmenu.FieldComponent))
|
||||
}
|
||||
|
||||
// WhereKeepAlive applies the entql bool predicate on the keep_alive field.
|
||||
func (f *SysMenuFilter) WhereKeepAlive(p entql.BoolP) {
|
||||
f.Where(p.Field(sysmenu.FieldKeepAlive))
|
||||
}
|
||||
|
||||
// WhereHidden applies the entql bool predicate on the hidden field.
|
||||
func (f *SysMenuFilter) WhereHidden(p entql.BoolP) {
|
||||
f.Where(p.Field(sysmenu.FieldHidden))
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -37,6 +37,8 @@ var (
|
||||
// CpSchoolsColumns holds the columns for the "cp_schools" table.
|
||||
CpSchoolsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeString, Unique: true},
|
||||
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
|
||||
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
|
||||
{Name: "name", Type: field.TypeString},
|
||||
{Name: "name_pinyin", Type: field.TypeString},
|
||||
{Name: "icon_img", Type: field.TypeString, Nullable: true},
|
||||
@@ -50,6 +52,8 @@ var (
|
||||
// CpTasksColumns holds the columns for the "cp_tasks" table.
|
||||
CpTasksColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
|
||||
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
|
||||
{Name: "task_type", Type: field.TypeEnum, Enums: []string{"collection", "sign", "sleep_check"}},
|
||||
{Name: "title", Type: field.TypeString},
|
||||
{Name: "frequency", Type: field.TypeInt, Default: 0},
|
||||
@@ -72,13 +76,13 @@ var (
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "cp_tasks_cp_users_cptasks",
|
||||
Columns: []*schema.Column{CpTasksColumns[12]},
|
||||
Columns: []*schema.Column{CpTasksColumns[14]},
|
||||
RefColumns: []*schema.Column{CpUsersColumns[0]},
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
{
|
||||
Symbol: "cp_tasks_sys_user_cp_task",
|
||||
Columns: []*schema.Column{CpTasksColumns[13]},
|
||||
Columns: []*schema.Column{CpTasksColumns[15]},
|
||||
RefColumns: []*schema.Column{SysUserColumns[0]},
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
@@ -87,6 +91,8 @@ var (
|
||||
// CpTaskLogsColumns holds the columns for the "cp_task_logs" table.
|
||||
CpTaskLogsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
|
||||
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
|
||||
{Name: "is_success", Type: field.TypeBool},
|
||||
{Name: "error_message", Type: field.TypeString, Nullable: true},
|
||||
{Name: "real_name", Type: field.TypeString, Nullable: true},
|
||||
@@ -102,19 +108,19 @@ var (
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "cp_task_logs_cp_tasks_cp_task_logs",
|
||||
Columns: []*schema.Column{CpTaskLogsColumns[4]},
|
||||
Columns: []*schema.Column{CpTaskLogsColumns[6]},
|
||||
RefColumns: []*schema.Column{CpTasksColumns[0]},
|
||||
OnDelete: schema.Cascade,
|
||||
},
|
||||
{
|
||||
Symbol: "cp_task_logs_cp_users_cp_task_logs",
|
||||
Columns: []*schema.Column{CpTaskLogsColumns[5]},
|
||||
Columns: []*schema.Column{CpTaskLogsColumns[7]},
|
||||
RefColumns: []*schema.Column{CpUsersColumns[0]},
|
||||
OnDelete: schema.Cascade,
|
||||
},
|
||||
{
|
||||
Symbol: "cp_task_logs_sys_user_cp_task_logs",
|
||||
Columns: []*schema.Column{CpTaskLogsColumns[6]},
|
||||
Columns: []*schema.Column{CpTaskLogsColumns[8]},
|
||||
RefColumns: []*schema.Column{SysUserColumns[0]},
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
@@ -123,6 +129,8 @@ var (
|
||||
// CpUsersColumns holds the columns for the "cp_users" table.
|
||||
CpUsersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
|
||||
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
|
||||
{Name: "username", Type: field.TypeString},
|
||||
{Name: "password", Type: field.TypeString},
|
||||
{Name: "email", Type: field.TypeString, Nullable: true},
|
||||
@@ -140,13 +148,13 @@ var (
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "cp_users_cp_schools_cpusers",
|
||||
Columns: []*schema.Column{CpUsersColumns[7]},
|
||||
Columns: []*schema.Column{CpUsersColumns[9]},
|
||||
RefColumns: []*schema.Column{CpSchoolsColumns[0]},
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
{
|
||||
Symbol: "cp_users_sys_user_cpuser",
|
||||
Columns: []*schema.Column{CpUsersColumns[8]},
|
||||
Columns: []*schema.Column{CpUsersColumns[10]},
|
||||
RefColumns: []*schema.Column{SysUserColumns[0]},
|
||||
OnDelete: schema.Cascade,
|
||||
},
|
||||
@@ -226,6 +234,7 @@ var (
|
||||
{Name: "permission", Type: field.TypeString},
|
||||
{Name: "route", Type: field.TypeString, Nullable: true},
|
||||
{Name: "component", Type: field.TypeString, Nullable: true},
|
||||
{Name: "keep_alive", Type: field.TypeBool, Default: false},
|
||||
{Name: "hidden", Type: field.TypeBool, Default: false},
|
||||
{Name: "icon", Type: field.TypeString, Nullable: true},
|
||||
{Name: "order", Type: field.TypeUint},
|
||||
@@ -239,7 +248,7 @@ var (
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "sys_menu_sys_menu_children",
|
||||
Columns: []*schema.Column{SysMenuColumns[13]},
|
||||
Columns: []*schema.Column{SysMenuColumns[14]},
|
||||
RefColumns: []*schema.Column{SysMenuColumns[0]},
|
||||
OnDelete: schema.SetNull,
|
||||
},
|
||||
|
||||
+491
-5
@@ -794,6 +794,8 @@ type CpSchoolMutation struct {
|
||||
op Op
|
||||
typ string
|
||||
id *string
|
||||
create_time **ent2.CustomTime
|
||||
update_time **ent2.CustomTime
|
||||
name *string
|
||||
name_pinyin *string
|
||||
icon_img *string
|
||||
@@ -910,6 +912,78 @@ func (m *CpSchoolMutation) IDs(ctx context.Context) ([]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (m *CpSchoolMutation) SetCreateTime(et *ent2.CustomTime) {
|
||||
m.create_time = &et
|
||||
}
|
||||
|
||||
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||
func (m *CpSchoolMutation) CreateTime() (r *ent2.CustomTime, exists bool) {
|
||||
v := m.create_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldCreateTime returns the old "create_time" field's value of the CpSchool entity.
|
||||
// If the CpSchool object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *CpSchoolMutation) OldCreateTime(ctx context.Context) (v *ent2.CustomTime, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||
}
|
||||
return oldValue.CreateTime, nil
|
||||
}
|
||||
|
||||
// ResetCreateTime resets all changes to the "create_time" field.
|
||||
func (m *CpSchoolMutation) ResetCreateTime() {
|
||||
m.create_time = nil
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (m *CpSchoolMutation) SetUpdateTime(et *ent2.CustomTime) {
|
||||
m.update_time = &et
|
||||
}
|
||||
|
||||
// UpdateTime returns the value of the "update_time" field in the mutation.
|
||||
func (m *CpSchoolMutation) UpdateTime() (r *ent2.CustomTime, exists bool) {
|
||||
v := m.update_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldUpdateTime returns the old "update_time" field's value of the CpSchool entity.
|
||||
// If the CpSchool object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *CpSchoolMutation) OldUpdateTime(ctx context.Context) (v *ent2.CustomTime, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
|
||||
}
|
||||
return oldValue.UpdateTime, nil
|
||||
}
|
||||
|
||||
// ResetUpdateTime resets all changes to the "update_time" field.
|
||||
func (m *CpSchoolMutation) ResetUpdateTime() {
|
||||
m.update_time = nil
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (m *CpSchoolMutation) SetName(s string) {
|
||||
m.name = &s
|
||||
@@ -1119,7 +1193,13 @@ func (m *CpSchoolMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *CpSchoolMutation) Fields() []string {
|
||||
fields := make([]string, 0, 3)
|
||||
fields := make([]string, 0, 5)
|
||||
if m.create_time != nil {
|
||||
fields = append(fields, cpschool.FieldCreateTime)
|
||||
}
|
||||
if m.update_time != nil {
|
||||
fields = append(fields, cpschool.FieldUpdateTime)
|
||||
}
|
||||
if m.name != nil {
|
||||
fields = append(fields, cpschool.FieldName)
|
||||
}
|
||||
@@ -1137,6 +1217,10 @@ func (m *CpSchoolMutation) Fields() []string {
|
||||
// schema.
|
||||
func (m *CpSchoolMutation) Field(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case cpschool.FieldCreateTime:
|
||||
return m.CreateTime()
|
||||
case cpschool.FieldUpdateTime:
|
||||
return m.UpdateTime()
|
||||
case cpschool.FieldName:
|
||||
return m.Name()
|
||||
case cpschool.FieldNamePinyin:
|
||||
@@ -1152,6 +1236,10 @@ func (m *CpSchoolMutation) Field(name string) (ent.Value, bool) {
|
||||
// database failed.
|
||||
func (m *CpSchoolMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
||||
switch name {
|
||||
case cpschool.FieldCreateTime:
|
||||
return m.OldCreateTime(ctx)
|
||||
case cpschool.FieldUpdateTime:
|
||||
return m.OldUpdateTime(ctx)
|
||||
case cpschool.FieldName:
|
||||
return m.OldName(ctx)
|
||||
case cpschool.FieldNamePinyin:
|
||||
@@ -1167,6 +1255,20 @@ func (m *CpSchoolMutation) OldField(ctx context.Context, name string) (ent.Value
|
||||
// type.
|
||||
func (m *CpSchoolMutation) SetField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case cpschool.FieldCreateTime:
|
||||
v, ok := value.(*ent2.CustomTime)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetCreateTime(v)
|
||||
return nil
|
||||
case cpschool.FieldUpdateTime:
|
||||
v, ok := value.(*ent2.CustomTime)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetUpdateTime(v)
|
||||
return nil
|
||||
case cpschool.FieldName:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
@@ -1246,6 +1348,12 @@ func (m *CpSchoolMutation) ClearField(name string) error {
|
||||
// It returns an error if the field is not defined in the schema.
|
||||
func (m *CpSchoolMutation) ResetField(name string) error {
|
||||
switch name {
|
||||
case cpschool.FieldCreateTime:
|
||||
m.ResetCreateTime()
|
||||
return nil
|
||||
case cpschool.FieldUpdateTime:
|
||||
m.ResetUpdateTime()
|
||||
return nil
|
||||
case cpschool.FieldName:
|
||||
m.ResetName()
|
||||
return nil
|
||||
@@ -1349,6 +1457,8 @@ type CpTaskMutation struct {
|
||||
op Op
|
||||
typ string
|
||||
id *int64
|
||||
create_time **ent2.CustomTime
|
||||
update_time **ent2.CustomTime
|
||||
task_type *cptask.TaskType
|
||||
title *string
|
||||
frequency *int
|
||||
@@ -1476,6 +1586,78 @@ func (m *CpTaskMutation) IDs(ctx context.Context) ([]int64, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (m *CpTaskMutation) SetCreateTime(et *ent2.CustomTime) {
|
||||
m.create_time = &et
|
||||
}
|
||||
|
||||
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||
func (m *CpTaskMutation) CreateTime() (r *ent2.CustomTime, exists bool) {
|
||||
v := m.create_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldCreateTime returns the old "create_time" field's value of the CpTask entity.
|
||||
// If the CpTask object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *CpTaskMutation) OldCreateTime(ctx context.Context) (v *ent2.CustomTime, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||
}
|
||||
return oldValue.CreateTime, nil
|
||||
}
|
||||
|
||||
// ResetCreateTime resets all changes to the "create_time" field.
|
||||
func (m *CpTaskMutation) ResetCreateTime() {
|
||||
m.create_time = nil
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (m *CpTaskMutation) SetUpdateTime(et *ent2.CustomTime) {
|
||||
m.update_time = &et
|
||||
}
|
||||
|
||||
// UpdateTime returns the value of the "update_time" field in the mutation.
|
||||
func (m *CpTaskMutation) UpdateTime() (r *ent2.CustomTime, exists bool) {
|
||||
v := m.update_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldUpdateTime returns the old "update_time" field's value of the CpTask entity.
|
||||
// If the CpTask object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *CpTaskMutation) OldUpdateTime(ctx context.Context) (v *ent2.CustomTime, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
|
||||
}
|
||||
return oldValue.UpdateTime, nil
|
||||
}
|
||||
|
||||
// ResetUpdateTime resets all changes to the "update_time" field.
|
||||
func (m *CpTaskMutation) ResetUpdateTime() {
|
||||
m.update_time = nil
|
||||
}
|
||||
|
||||
// SetCpUserID sets the "cp_user_id" field.
|
||||
func (m *CpTaskMutation) SetCpUserID(i int64) {
|
||||
m.cp_user = &i
|
||||
@@ -2254,7 +2436,13 @@ func (m *CpTaskMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *CpTaskMutation) Fields() []string {
|
||||
fields := make([]string, 0, 13)
|
||||
fields := make([]string, 0, 15)
|
||||
if m.create_time != nil {
|
||||
fields = append(fields, cptask.FieldCreateTime)
|
||||
}
|
||||
if m.update_time != nil {
|
||||
fields = append(fields, cptask.FieldUpdateTime)
|
||||
}
|
||||
if m.cp_user != nil {
|
||||
fields = append(fields, cptask.FieldCpUserID)
|
||||
}
|
||||
@@ -2302,6 +2490,10 @@ func (m *CpTaskMutation) Fields() []string {
|
||||
// schema.
|
||||
func (m *CpTaskMutation) Field(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case cptask.FieldCreateTime:
|
||||
return m.CreateTime()
|
||||
case cptask.FieldUpdateTime:
|
||||
return m.UpdateTime()
|
||||
case cptask.FieldCpUserID:
|
||||
return m.CpUserID()
|
||||
case cptask.FieldUserID:
|
||||
@@ -2337,6 +2529,10 @@ func (m *CpTaskMutation) Field(name string) (ent.Value, bool) {
|
||||
// database failed.
|
||||
func (m *CpTaskMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
||||
switch name {
|
||||
case cptask.FieldCreateTime:
|
||||
return m.OldCreateTime(ctx)
|
||||
case cptask.FieldUpdateTime:
|
||||
return m.OldUpdateTime(ctx)
|
||||
case cptask.FieldCpUserID:
|
||||
return m.OldCpUserID(ctx)
|
||||
case cptask.FieldUserID:
|
||||
@@ -2372,6 +2568,20 @@ func (m *CpTaskMutation) OldField(ctx context.Context, name string) (ent.Value,
|
||||
// type.
|
||||
func (m *CpTaskMutation) SetField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case cptask.FieldCreateTime:
|
||||
v, ok := value.(*ent2.CustomTime)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetCreateTime(v)
|
||||
return nil
|
||||
case cptask.FieldUpdateTime:
|
||||
v, ok := value.(*ent2.CustomTime)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetUpdateTime(v)
|
||||
return nil
|
||||
case cptask.FieldCpUserID:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
@@ -2602,6 +2812,12 @@ func (m *CpTaskMutation) ClearField(name string) error {
|
||||
// It returns an error if the field is not defined in the schema.
|
||||
func (m *CpTaskMutation) ResetField(name string) error {
|
||||
switch name {
|
||||
case cptask.FieldCreateTime:
|
||||
m.ResetCreateTime()
|
||||
return nil
|
||||
case cptask.FieldUpdateTime:
|
||||
m.ResetUpdateTime()
|
||||
return nil
|
||||
case cptask.FieldCpUserID:
|
||||
m.ResetCpUserID()
|
||||
return nil
|
||||
@@ -2771,6 +2987,8 @@ type CpTaskLogMutation struct {
|
||||
op Op
|
||||
typ string
|
||||
id *int64
|
||||
create_time **ent2.CustomTime
|
||||
update_time **ent2.CustomTime
|
||||
is_success *bool
|
||||
error_message *string
|
||||
real_name *string
|
||||
@@ -2884,6 +3102,78 @@ func (m *CpTaskLogMutation) IDs(ctx context.Context) ([]int64, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (m *CpTaskLogMutation) SetCreateTime(et *ent2.CustomTime) {
|
||||
m.create_time = &et
|
||||
}
|
||||
|
||||
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||
func (m *CpTaskLogMutation) CreateTime() (r *ent2.CustomTime, exists bool) {
|
||||
v := m.create_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldCreateTime returns the old "create_time" field's value of the CpTaskLog entity.
|
||||
// If the CpTaskLog object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *CpTaskLogMutation) OldCreateTime(ctx context.Context) (v *ent2.CustomTime, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||
}
|
||||
return oldValue.CreateTime, nil
|
||||
}
|
||||
|
||||
// ResetCreateTime resets all changes to the "create_time" field.
|
||||
func (m *CpTaskLogMutation) ResetCreateTime() {
|
||||
m.create_time = nil
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (m *CpTaskLogMutation) SetUpdateTime(et *ent2.CustomTime) {
|
||||
m.update_time = &et
|
||||
}
|
||||
|
||||
// UpdateTime returns the value of the "update_time" field in the mutation.
|
||||
func (m *CpTaskLogMutation) UpdateTime() (r *ent2.CustomTime, exists bool) {
|
||||
v := m.update_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldUpdateTime returns the old "update_time" field's value of the CpTaskLog entity.
|
||||
// If the CpTaskLog object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *CpTaskLogMutation) OldUpdateTime(ctx context.Context) (v *ent2.CustomTime, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
|
||||
}
|
||||
return oldValue.UpdateTime, nil
|
||||
}
|
||||
|
||||
// ResetUpdateTime resets all changes to the "update_time" field.
|
||||
func (m *CpTaskLogMutation) ResetUpdateTime() {
|
||||
m.update_time = nil
|
||||
}
|
||||
|
||||
// SetCpTaskID sets the "cp_task_id" field.
|
||||
func (m *CpTaskLogMutation) SetCpTaskID(i int64) {
|
||||
m.cp_task = &i
|
||||
@@ -3241,7 +3531,13 @@ func (m *CpTaskLogMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *CpTaskLogMutation) Fields() []string {
|
||||
fields := make([]string, 0, 6)
|
||||
fields := make([]string, 0, 8)
|
||||
if m.create_time != nil {
|
||||
fields = append(fields, cptasklog.FieldCreateTime)
|
||||
}
|
||||
if m.update_time != nil {
|
||||
fields = append(fields, cptasklog.FieldUpdateTime)
|
||||
}
|
||||
if m.cp_task != nil {
|
||||
fields = append(fields, cptasklog.FieldCpTaskID)
|
||||
}
|
||||
@@ -3268,6 +3564,10 @@ func (m *CpTaskLogMutation) Fields() []string {
|
||||
// schema.
|
||||
func (m *CpTaskLogMutation) Field(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case cptasklog.FieldCreateTime:
|
||||
return m.CreateTime()
|
||||
case cptasklog.FieldUpdateTime:
|
||||
return m.UpdateTime()
|
||||
case cptasklog.FieldCpTaskID:
|
||||
return m.CpTaskID()
|
||||
case cptasklog.FieldSystemUserID:
|
||||
@@ -3289,6 +3589,10 @@ func (m *CpTaskLogMutation) Field(name string) (ent.Value, bool) {
|
||||
// database failed.
|
||||
func (m *CpTaskLogMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
||||
switch name {
|
||||
case cptasklog.FieldCreateTime:
|
||||
return m.OldCreateTime(ctx)
|
||||
case cptasklog.FieldUpdateTime:
|
||||
return m.OldUpdateTime(ctx)
|
||||
case cptasklog.FieldCpTaskID:
|
||||
return m.OldCpTaskID(ctx)
|
||||
case cptasklog.FieldSystemUserID:
|
||||
@@ -3310,6 +3614,20 @@ func (m *CpTaskLogMutation) OldField(ctx context.Context, name string) (ent.Valu
|
||||
// type.
|
||||
func (m *CpTaskLogMutation) SetField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case cptasklog.FieldCreateTime:
|
||||
v, ok := value.(*ent2.CustomTime)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetCreateTime(v)
|
||||
return nil
|
||||
case cptasklog.FieldUpdateTime:
|
||||
v, ok := value.(*ent2.CustomTime)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetUpdateTime(v)
|
||||
return nil
|
||||
case cptasklog.FieldCpTaskID:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
@@ -3419,6 +3737,12 @@ func (m *CpTaskLogMutation) ClearField(name string) error {
|
||||
// It returns an error if the field is not defined in the schema.
|
||||
func (m *CpTaskLogMutation) ResetField(name string) error {
|
||||
switch name {
|
||||
case cptasklog.FieldCreateTime:
|
||||
m.ResetCreateTime()
|
||||
return nil
|
||||
case cptasklog.FieldUpdateTime:
|
||||
m.ResetUpdateTime()
|
||||
return nil
|
||||
case cptasklog.FieldCpTaskID:
|
||||
m.ResetCpTaskID()
|
||||
return nil
|
||||
@@ -3557,6 +3881,8 @@ type CpUserMutation struct {
|
||||
op Op
|
||||
typ string
|
||||
id *int64
|
||||
create_time **ent2.CustomTime
|
||||
update_time **ent2.CustomTime
|
||||
username *string
|
||||
password *string
|
||||
email *string
|
||||
@@ -3677,6 +4003,78 @@ func (m *CpUserMutation) IDs(ctx context.Context) ([]int64, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (m *CpUserMutation) SetCreateTime(et *ent2.CustomTime) {
|
||||
m.create_time = &et
|
||||
}
|
||||
|
||||
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||
func (m *CpUserMutation) CreateTime() (r *ent2.CustomTime, exists bool) {
|
||||
v := m.create_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldCreateTime returns the old "create_time" field's value of the CpUser entity.
|
||||
// If the CpUser object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *CpUserMutation) OldCreateTime(ctx context.Context) (v *ent2.CustomTime, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||
}
|
||||
return oldValue.CreateTime, nil
|
||||
}
|
||||
|
||||
// ResetCreateTime resets all changes to the "create_time" field.
|
||||
func (m *CpUserMutation) ResetCreateTime() {
|
||||
m.create_time = nil
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (m *CpUserMutation) SetUpdateTime(et *ent2.CustomTime) {
|
||||
m.update_time = &et
|
||||
}
|
||||
|
||||
// UpdateTime returns the value of the "update_time" field in the mutation.
|
||||
func (m *CpUserMutation) UpdateTime() (r *ent2.CustomTime, exists bool) {
|
||||
v := m.update_time
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldUpdateTime returns the old "update_time" field's value of the CpUser entity.
|
||||
// If the CpUser object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *CpUserMutation) OldUpdateTime(ctx context.Context) (v *ent2.CustomTime, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdateTime is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldUpdateTime requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldUpdateTime: %w", err)
|
||||
}
|
||||
return oldValue.UpdateTime, nil
|
||||
}
|
||||
|
||||
// ResetUpdateTime resets all changes to the "update_time" field.
|
||||
func (m *CpUserMutation) ResetUpdateTime() {
|
||||
m.update_time = nil
|
||||
}
|
||||
|
||||
// SetUserID sets the "user_id" field.
|
||||
func (m *CpUserMutation) SetUserID(i int64) {
|
||||
m.sysuser = &i
|
||||
@@ -4213,7 +4611,13 @@ func (m *CpUserMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *CpUserMutation) Fields() []string {
|
||||
fields := make([]string, 0, 8)
|
||||
fields := make([]string, 0, 10)
|
||||
if m.create_time != nil {
|
||||
fields = append(fields, cpuser.FieldCreateTime)
|
||||
}
|
||||
if m.update_time != nil {
|
||||
fields = append(fields, cpuser.FieldUpdateTime)
|
||||
}
|
||||
if m.sysuser != nil {
|
||||
fields = append(fields, cpuser.FieldUserID)
|
||||
}
|
||||
@@ -4246,6 +4650,10 @@ func (m *CpUserMutation) Fields() []string {
|
||||
// schema.
|
||||
func (m *CpUserMutation) Field(name string) (ent.Value, bool) {
|
||||
switch name {
|
||||
case cpuser.FieldCreateTime:
|
||||
return m.CreateTime()
|
||||
case cpuser.FieldUpdateTime:
|
||||
return m.UpdateTime()
|
||||
case cpuser.FieldUserID:
|
||||
return m.UserID()
|
||||
case cpuser.FieldUsername:
|
||||
@@ -4271,6 +4679,10 @@ func (m *CpUserMutation) Field(name string) (ent.Value, bool) {
|
||||
// database failed.
|
||||
func (m *CpUserMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
||||
switch name {
|
||||
case cpuser.FieldCreateTime:
|
||||
return m.OldCreateTime(ctx)
|
||||
case cpuser.FieldUpdateTime:
|
||||
return m.OldUpdateTime(ctx)
|
||||
case cpuser.FieldUserID:
|
||||
return m.OldUserID(ctx)
|
||||
case cpuser.FieldUsername:
|
||||
@@ -4296,6 +4708,20 @@ func (m *CpUserMutation) OldField(ctx context.Context, name string) (ent.Value,
|
||||
// type.
|
||||
func (m *CpUserMutation) SetField(name string, value ent.Value) error {
|
||||
switch name {
|
||||
case cpuser.FieldCreateTime:
|
||||
v, ok := value.(*ent2.CustomTime)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetCreateTime(v)
|
||||
return nil
|
||||
case cpuser.FieldUpdateTime:
|
||||
v, ok := value.(*ent2.CustomTime)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetUpdateTime(v)
|
||||
return nil
|
||||
case cpuser.FieldUserID:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
@@ -4425,6 +4851,12 @@ func (m *CpUserMutation) ClearField(name string) error {
|
||||
// It returns an error if the field is not defined in the schema.
|
||||
func (m *CpUserMutation) ResetField(name string) error {
|
||||
switch name {
|
||||
case cpuser.FieldCreateTime:
|
||||
m.ResetCreateTime()
|
||||
return nil
|
||||
case cpuser.FieldUpdateTime:
|
||||
m.ResetUpdateTime()
|
||||
return nil
|
||||
case cpuser.FieldUserID:
|
||||
m.ResetUserID()
|
||||
return nil
|
||||
@@ -6199,6 +6631,7 @@ type SysMenuMutation struct {
|
||||
permission *string
|
||||
route *string
|
||||
component *string
|
||||
keep_alive *bool
|
||||
hidden *bool
|
||||
icon *string
|
||||
_order *uint
|
||||
@@ -6678,6 +7111,42 @@ func (m *SysMenuMutation) ResetComponent() {
|
||||
delete(m.clearedFields, sysmenu.FieldComponent)
|
||||
}
|
||||
|
||||
// SetKeepAlive sets the "keep_alive" field.
|
||||
func (m *SysMenuMutation) SetKeepAlive(b bool) {
|
||||
m.keep_alive = &b
|
||||
}
|
||||
|
||||
// KeepAlive returns the value of the "keep_alive" field in the mutation.
|
||||
func (m *SysMenuMutation) KeepAlive() (r bool, exists bool) {
|
||||
v := m.keep_alive
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldKeepAlive returns the old "keep_alive" field's value of the SysMenu entity.
|
||||
// If the SysMenu object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *SysMenuMutation) OldKeepAlive(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldKeepAlive is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldKeepAlive requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldKeepAlive: %w", err)
|
||||
}
|
||||
return oldValue.KeepAlive, nil
|
||||
}
|
||||
|
||||
// ResetKeepAlive resets all changes to the "keep_alive" field.
|
||||
func (m *SysMenuMutation) ResetKeepAlive() {
|
||||
m.keep_alive = nil
|
||||
}
|
||||
|
||||
// SetHidden sets the "hidden" field.
|
||||
func (m *SysMenuMutation) SetHidden(b bool) {
|
||||
m.hidden = &b
|
||||
@@ -7000,7 +7469,7 @@ func (m *SysMenuMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *SysMenuMutation) Fields() []string {
|
||||
fields := make([]string, 0, 12)
|
||||
fields := make([]string, 0, 13)
|
||||
if m.create_time != nil {
|
||||
fields = append(fields, sysmenu.FieldCreateTime)
|
||||
}
|
||||
@@ -7028,6 +7497,9 @@ func (m *SysMenuMutation) Fields() []string {
|
||||
if m.component != nil {
|
||||
fields = append(fields, sysmenu.FieldComponent)
|
||||
}
|
||||
if m.keep_alive != nil {
|
||||
fields = append(fields, sysmenu.FieldKeepAlive)
|
||||
}
|
||||
if m.hidden != nil {
|
||||
fields = append(fields, sysmenu.FieldHidden)
|
||||
}
|
||||
@@ -7063,6 +7535,8 @@ func (m *SysMenuMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.Route()
|
||||
case sysmenu.FieldComponent:
|
||||
return m.Component()
|
||||
case sysmenu.FieldKeepAlive:
|
||||
return m.KeepAlive()
|
||||
case sysmenu.FieldHidden:
|
||||
return m.Hidden()
|
||||
case sysmenu.FieldIcon:
|
||||
@@ -7096,6 +7570,8 @@ func (m *SysMenuMutation) OldField(ctx context.Context, name string) (ent.Value,
|
||||
return m.OldRoute(ctx)
|
||||
case sysmenu.FieldComponent:
|
||||
return m.OldComponent(ctx)
|
||||
case sysmenu.FieldKeepAlive:
|
||||
return m.OldKeepAlive(ctx)
|
||||
case sysmenu.FieldHidden:
|
||||
return m.OldHidden(ctx)
|
||||
case sysmenu.FieldIcon:
|
||||
@@ -7174,6 +7650,13 @@ func (m *SysMenuMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetComponent(v)
|
||||
return nil
|
||||
case sysmenu.FieldKeepAlive:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetKeepAlive(v)
|
||||
return nil
|
||||
case sysmenu.FieldHidden:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
@@ -7313,6 +7796,9 @@ func (m *SysMenuMutation) ResetField(name string) error {
|
||||
case sysmenu.FieldComponent:
|
||||
m.ResetComponent()
|
||||
return nil
|
||||
case sysmenu.FieldKeepAlive:
|
||||
m.ResetKeepAlive()
|
||||
return nil
|
||||
case sysmenu.FieldHidden:
|
||||
m.ResetHidden()
|
||||
return nil
|
||||
|
||||
@@ -4,7 +4,9 @@ package runtime
|
||||
|
||||
import (
|
||||
"likedream-goframe/internal/ent/cpimage"
|
||||
"likedream-goframe/internal/ent/cpschool"
|
||||
"likedream-goframe/internal/ent/cptask"
|
||||
"likedream-goframe/internal/ent/cptasklog"
|
||||
"likedream-goframe/internal/ent/cpuser"
|
||||
"likedream-goframe/internal/ent/schema"
|
||||
"likedream-goframe/internal/ent/sysagent"
|
||||
@@ -57,8 +59,36 @@ func init() {
|
||||
cpimageDescContentLength := cpimageFields[4].Descriptor()
|
||||
// cpimage.ContentLengthValidator is a validator for the "content_length" field. It is called by the builders before save.
|
||||
cpimage.ContentLengthValidator = cpimageDescContentLength.Validators[0].(func(int64) error)
|
||||
cpschoolMixin := schema.CpSchool{}.Mixin()
|
||||
cpschoolMixinHooks0 := cpschoolMixin[0].Hooks()
|
||||
cpschool.Hooks[0] = cpschoolMixinHooks0[0]
|
||||
cpschoolMixinFields0 := cpschoolMixin[0].Fields()
|
||||
_ = cpschoolMixinFields0
|
||||
cpschoolFields := schema.CpSchool{}.Fields()
|
||||
_ = cpschoolFields
|
||||
// cpschoolDescCreateTime is the schema descriptor for create_time field.
|
||||
cpschoolDescCreateTime := cpschoolMixinFields0[0].Descriptor()
|
||||
// cpschool.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||
cpschool.DefaultCreateTime = cpschoolDescCreateTime.Default.(func() *ent2.CustomTime)
|
||||
// cpschoolDescUpdateTime is the schema descriptor for update_time field.
|
||||
cpschoolDescUpdateTime := cpschoolMixinFields0[1].Descriptor()
|
||||
// cpschool.DefaultUpdateTime holds the default value on creation for the update_time field.
|
||||
cpschool.DefaultUpdateTime = cpschoolDescUpdateTime.Default.(func() *ent2.CustomTime)
|
||||
cptaskMixin := schema.CpTask{}.Mixin()
|
||||
cptaskMixinHooks0 := cptaskMixin[0].Hooks()
|
||||
cptask.Hooks[0] = cptaskMixinHooks0[0]
|
||||
cptaskMixinFields0 := cptaskMixin[0].Fields()
|
||||
_ = cptaskMixinFields0
|
||||
cptaskFields := schema.CpTask{}.Fields()
|
||||
_ = cptaskFields
|
||||
// cptaskDescCreateTime is the schema descriptor for create_time field.
|
||||
cptaskDescCreateTime := cptaskMixinFields0[0].Descriptor()
|
||||
// cptask.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||
cptask.DefaultCreateTime = cptaskDescCreateTime.Default.(func() *ent2.CustomTime)
|
||||
// cptaskDescUpdateTime is the schema descriptor for update_time field.
|
||||
cptaskDescUpdateTime := cptaskMixinFields0[1].Descriptor()
|
||||
// cptask.DefaultUpdateTime holds the default value on creation for the update_time field.
|
||||
cptask.DefaultUpdateTime = cptaskDescUpdateTime.Default.(func() *ent2.CustomTime)
|
||||
// cptaskDescTitle is the schema descriptor for title field.
|
||||
cptaskDescTitle := cptaskFields[3].Descriptor()
|
||||
// cptask.TitleValidator is a validator for the "title" field. It is called by the builders before save.
|
||||
@@ -71,8 +101,36 @@ func init() {
|
||||
cptaskDescSuccessCount := cptaskFields[6].Descriptor()
|
||||
// cptask.DefaultSuccessCount holds the default value on creation for the success_count field.
|
||||
cptask.DefaultSuccessCount = cptaskDescSuccessCount.Default.(int)
|
||||
cptasklogMixin := schema.CpTaskLog{}.Mixin()
|
||||
cptasklogMixinHooks0 := cptasklogMixin[0].Hooks()
|
||||
cptasklog.Hooks[0] = cptasklogMixinHooks0[0]
|
||||
cptasklogMixinFields0 := cptasklogMixin[0].Fields()
|
||||
_ = cptasklogMixinFields0
|
||||
cptasklogFields := schema.CpTaskLog{}.Fields()
|
||||
_ = cptasklogFields
|
||||
// cptasklogDescCreateTime is the schema descriptor for create_time field.
|
||||
cptasklogDescCreateTime := cptasklogMixinFields0[0].Descriptor()
|
||||
// cptasklog.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||
cptasklog.DefaultCreateTime = cptasklogDescCreateTime.Default.(func() *ent2.CustomTime)
|
||||
// cptasklogDescUpdateTime is the schema descriptor for update_time field.
|
||||
cptasklogDescUpdateTime := cptasklogMixinFields0[1].Descriptor()
|
||||
// cptasklog.DefaultUpdateTime holds the default value on creation for the update_time field.
|
||||
cptasklog.DefaultUpdateTime = cptasklogDescUpdateTime.Default.(func() *ent2.CustomTime)
|
||||
cpuserMixin := schema.CpUser{}.Mixin()
|
||||
cpuserMixinHooks0 := cpuserMixin[0].Hooks()
|
||||
cpuser.Hooks[0] = cpuserMixinHooks0[0]
|
||||
cpuserMixinFields0 := cpuserMixin[0].Fields()
|
||||
_ = cpuserMixinFields0
|
||||
cpuserFields := schema.CpUser{}.Fields()
|
||||
_ = cpuserFields
|
||||
// cpuserDescCreateTime is the schema descriptor for create_time field.
|
||||
cpuserDescCreateTime := cpuserMixinFields0[0].Descriptor()
|
||||
// cpuser.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||
cpuser.DefaultCreateTime = cpuserDescCreateTime.Default.(func() *ent2.CustomTime)
|
||||
// cpuserDescUpdateTime is the schema descriptor for update_time field.
|
||||
cpuserDescUpdateTime := cpuserMixinFields0[1].Descriptor()
|
||||
// cpuser.DefaultUpdateTime holds the default value on creation for the update_time field.
|
||||
cpuser.DefaultUpdateTime = cpuserDescUpdateTime.Default.(func() *ent2.CustomTime)
|
||||
// cpuserDescUsername is the schema descriptor for username field.
|
||||
cpuserDescUsername := cpuserFields[1].Descriptor()
|
||||
// cpuser.UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
||||
@@ -134,8 +192,12 @@ func init() {
|
||||
sysmenuDescUpdateTime := sysmenuMixinFields0[1].Descriptor()
|
||||
// sysmenu.DefaultUpdateTime holds the default value on creation for the update_time field.
|
||||
sysmenu.DefaultUpdateTime = sysmenuDescUpdateTime.Default.(func() *ent2.CustomTime)
|
||||
// sysmenuDescKeepAlive is the schema descriptor for keep_alive field.
|
||||
sysmenuDescKeepAlive := sysmenuFields[7].Descriptor()
|
||||
// sysmenu.DefaultKeepAlive holds the default value on creation for the keep_alive field.
|
||||
sysmenu.DefaultKeepAlive = sysmenuDescKeepAlive.Default.(bool)
|
||||
// sysmenuDescHidden is the schema descriptor for hidden field.
|
||||
sysmenuDescHidden := sysmenuFields[7].Descriptor()
|
||||
sysmenuDescHidden := sysmenuFields[8].Descriptor()
|
||||
// sysmenu.DefaultHidden holds the default value on creation for the hidden field.
|
||||
sysmenu.DefaultHidden = sysmenuDescHidden.Default.(bool)
|
||||
sysroleMixin := schema.SysRole{}.Mixin()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"likedream-goframe/internal/ent/schema/mix"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
@@ -26,3 +28,9 @@ func (CpSchool) Edges() []ent.Edge {
|
||||
edge.To("cpusers", CpUser.Type),
|
||||
}
|
||||
}
|
||||
|
||||
func (CpSchool) Mixin() []ent.Mixin {
|
||||
return []ent.Mixin{
|
||||
mix.MixinTime{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"likedream-goframe/internal/ent/schema/mix"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema/edge"
|
||||
@@ -39,3 +41,9 @@ func (CpTask) Edges() []ent.Edge {
|
||||
edge.To("cp_task_logs", CpTaskLog.Type).Annotations(entsql.OnDelete(entsql.Cascade)), // 任务拥有的cp任务日志
|
||||
}
|
||||
}
|
||||
|
||||
func (CpTask) Mixin() []ent.Mixin {
|
||||
return []ent.Mixin{
|
||||
mix.MixinTime{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"likedream-goframe/internal/ent/schema/mix"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
@@ -38,3 +40,9 @@ func (CpTaskLog) Edges() []ent.Edge {
|
||||
Field("cp_user_id").Unique().Required(),
|
||||
}
|
||||
}
|
||||
|
||||
func (CpTaskLog) Mixin() []ent.Mixin {
|
||||
return []ent.Mixin{
|
||||
mix.MixinTime{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"likedream-goframe/internal/ent/schema/mix"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema/edge"
|
||||
@@ -39,3 +41,8 @@ func (CpUser) Edges() []ent.Edge {
|
||||
Required(),
|
||||
}
|
||||
}
|
||||
func (CpUser) Mixin() []ent.Mixin {
|
||||
return []ent.Mixin{
|
||||
mix.MixinTime{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"likedream-goframe/internal/ent/schema/mix"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
"likedream-goframe/internal/ent/schema/mix"
|
||||
)
|
||||
|
||||
type SysMenu struct {
|
||||
@@ -23,6 +24,7 @@ func (SysMenu) Fields() []ent.Field {
|
||||
field.String("permission"),
|
||||
field.String("route").Optional(),
|
||||
field.String("component").Optional(),
|
||||
field.Bool("keep_alive").Default(false),
|
||||
field.Bool("hidden").Default(false),
|
||||
field.String("icon").Optional(),
|
||||
field.Uint("order"),
|
||||
|
||||
+12
-1
@@ -35,6 +35,8 @@ type SysMenu struct {
|
||||
Route string `json:"route,omitempty"`
|
||||
// Component holds the value of the "component" field.
|
||||
Component string `json:"component,omitempty"`
|
||||
// KeepAlive holds the value of the "keep_alive" field.
|
||||
KeepAlive bool `json:"keep_alive,omitempty"`
|
||||
// Hidden holds the value of the "hidden" field.
|
||||
Hidden bool `json:"hidden,omitempty"`
|
||||
// Icon holds the value of the "icon" field.
|
||||
@@ -99,7 +101,7 @@ func (*SysMenu) scanValues(columns []string) ([]any, error) {
|
||||
switch columns[i] {
|
||||
case sysmenu.FieldCreateTime, sysmenu.FieldUpdateTime:
|
||||
values[i] = new(ent2.CustomTime)
|
||||
case sysmenu.FieldHidden:
|
||||
case sysmenu.FieldKeepAlive, sysmenu.FieldHidden:
|
||||
values[i] = new(sql.NullBool)
|
||||
case sysmenu.FieldID, sysmenu.FieldOrder:
|
||||
values[i] = new(sql.NullInt64)
|
||||
@@ -182,6 +184,12 @@ func (_m *SysMenu) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
_m.Component = value.String
|
||||
}
|
||||
case sysmenu.FieldKeepAlive:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field keep_alive", values[i])
|
||||
} else if value.Valid {
|
||||
_m.KeepAlive = value.Bool
|
||||
}
|
||||
case sysmenu.FieldHidden:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hidden", values[i])
|
||||
@@ -285,6 +293,9 @@ func (_m *SysMenu) String() string {
|
||||
builder.WriteString("component=")
|
||||
builder.WriteString(_m.Component)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("keep_alive=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.KeepAlive))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hidden=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Hidden))
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -34,6 +34,8 @@ const (
|
||||
FieldRoute = "route"
|
||||
// FieldComponent holds the string denoting the component field in the database.
|
||||
FieldComponent = "component"
|
||||
// FieldKeepAlive holds the string denoting the keep_alive field in the database.
|
||||
FieldKeepAlive = "keep_alive"
|
||||
// FieldHidden holds the string denoting the hidden field in the database.
|
||||
FieldHidden = "hidden"
|
||||
// FieldIcon holds the string denoting the icon field in the database.
|
||||
@@ -75,6 +77,7 @@ var Columns = []string{
|
||||
FieldPermission,
|
||||
FieldRoute,
|
||||
FieldComponent,
|
||||
FieldKeepAlive,
|
||||
FieldHidden,
|
||||
FieldIcon,
|
||||
FieldOrder,
|
||||
@@ -118,6 +121,8 @@ var (
|
||||
DefaultCreateTime func() *ent2.CustomTime
|
||||
// DefaultUpdateTime holds the default value on creation for the "update_time" field.
|
||||
DefaultUpdateTime func() *ent2.CustomTime
|
||||
// DefaultKeepAlive holds the default value on creation for the "keep_alive" field.
|
||||
DefaultKeepAlive bool
|
||||
// DefaultHidden holds the default value on creation for the "hidden" field.
|
||||
DefaultHidden bool
|
||||
)
|
||||
@@ -201,6 +206,11 @@ func ByComponent(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldComponent, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByKeepAlive orders the results by the keep_alive field.
|
||||
func ByKeepAlive(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldKeepAlive, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHidden orders the results by the hidden field.
|
||||
func ByHidden(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHidden, opts...).ToFunc()
|
||||
|
||||
@@ -91,6 +91,11 @@ func Component(v string) predicate.SysMenu {
|
||||
return predicate.SysMenu(sql.FieldEQ(FieldComponent, v))
|
||||
}
|
||||
|
||||
// KeepAlive applies equality check predicate on the "keep_alive" field. It's identical to KeepAliveEQ.
|
||||
func KeepAlive(v bool) predicate.SysMenu {
|
||||
return predicate.SysMenu(sql.FieldEQ(FieldKeepAlive, v))
|
||||
}
|
||||
|
||||
// Hidden applies equality check predicate on the "hidden" field. It's identical to HiddenEQ.
|
||||
func Hidden(v bool) predicate.SysMenu {
|
||||
return predicate.SysMenu(sql.FieldEQ(FieldHidden, v))
|
||||
@@ -686,6 +691,16 @@ func ComponentContainsFold(v string) predicate.SysMenu {
|
||||
return predicate.SysMenu(sql.FieldContainsFold(FieldComponent, v))
|
||||
}
|
||||
|
||||
// KeepAliveEQ applies the EQ predicate on the "keep_alive" field.
|
||||
func KeepAliveEQ(v bool) predicate.SysMenu {
|
||||
return predicate.SysMenu(sql.FieldEQ(FieldKeepAlive, v))
|
||||
}
|
||||
|
||||
// KeepAliveNEQ applies the NEQ predicate on the "keep_alive" field.
|
||||
func KeepAliveNEQ(v bool) predicate.SysMenu {
|
||||
return predicate.SysMenu(sql.FieldNEQ(FieldKeepAlive, v))
|
||||
}
|
||||
|
||||
// HiddenEQ applies the EQ predicate on the "hidden" field.
|
||||
func HiddenEQ(v bool) predicate.SysMenu {
|
||||
return predicate.SysMenu(sql.FieldEQ(FieldHidden, v))
|
||||
|
||||
@@ -101,6 +101,20 @@ func (_c *SysMenuCreate) SetNillableComponent(v *string) *SysMenuCreate {
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetKeepAlive sets the "keep_alive" field.
|
||||
func (_c *SysMenuCreate) SetKeepAlive(v bool) *SysMenuCreate {
|
||||
_c.mutation.SetKeepAlive(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableKeepAlive sets the "keep_alive" field if the given value is not nil.
|
||||
func (_c *SysMenuCreate) SetNillableKeepAlive(v *bool) *SysMenuCreate {
|
||||
if v != nil {
|
||||
_c.SetKeepAlive(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHidden sets the "hidden" field.
|
||||
func (_c *SysMenuCreate) SetHidden(v bool) *SysMenuCreate {
|
||||
_c.mutation.SetHidden(v)
|
||||
@@ -235,6 +249,10 @@ func (_c *SysMenuCreate) defaults() error {
|
||||
v := sysmenu.DefaultUpdateTime()
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
}
|
||||
if _, ok := _c.mutation.KeepAlive(); !ok {
|
||||
v := sysmenu.DefaultKeepAlive
|
||||
_c.mutation.SetKeepAlive(v)
|
||||
}
|
||||
if _, ok := _c.mutation.Hidden(); !ok {
|
||||
v := sysmenu.DefaultHidden
|
||||
_c.mutation.SetHidden(v)
|
||||
@@ -267,6 +285,9 @@ func (_c *SysMenuCreate) check() error {
|
||||
if _, ok := _c.mutation.Permission(); !ok {
|
||||
return &ValidationError{Name: "permission", err: errors.New(`ent: missing required field "SysMenu.permission"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.KeepAlive(); !ok {
|
||||
return &ValidationError{Name: "keep_alive", err: errors.New(`ent: missing required field "SysMenu.keep_alive"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Hidden(); !ok {
|
||||
return &ValidationError{Name: "hidden", err: errors.New(`ent: missing required field "SysMenu.hidden"`)}
|
||||
}
|
||||
@@ -337,6 +358,10 @@ func (_c *SysMenuCreate) createSpec() (*SysMenu, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(sysmenu.FieldComponent, field.TypeString, value)
|
||||
_node.Component = value
|
||||
}
|
||||
if value, ok := _c.mutation.KeepAlive(); ok {
|
||||
_spec.SetField(sysmenu.FieldKeepAlive, field.TypeBool, value)
|
||||
_node.KeepAlive = value
|
||||
}
|
||||
if value, ok := _c.mutation.Hidden(); ok {
|
||||
_spec.SetField(sysmenu.FieldHidden, field.TypeBool, value)
|
||||
_node.Hidden = value
|
||||
@@ -567,6 +592,18 @@ func (u *SysMenuUpsert) ClearComponent() *SysMenuUpsert {
|
||||
return u
|
||||
}
|
||||
|
||||
// SetKeepAlive sets the "keep_alive" field.
|
||||
func (u *SysMenuUpsert) SetKeepAlive(v bool) *SysMenuUpsert {
|
||||
u.Set(sysmenu.FieldKeepAlive, v)
|
||||
return u
|
||||
}
|
||||
|
||||
// UpdateKeepAlive sets the "keep_alive" field to the value that was provided on create.
|
||||
func (u *SysMenuUpsert) UpdateKeepAlive() *SysMenuUpsert {
|
||||
u.SetExcluded(sysmenu.FieldKeepAlive)
|
||||
return u
|
||||
}
|
||||
|
||||
// SetHidden sets the "hidden" field.
|
||||
func (u *SysMenuUpsert) SetHidden(v bool) *SysMenuUpsert {
|
||||
u.Set(sysmenu.FieldHidden, v)
|
||||
@@ -793,6 +830,20 @@ func (u *SysMenuUpsertOne) ClearComponent() *SysMenuUpsertOne {
|
||||
})
|
||||
}
|
||||
|
||||
// SetKeepAlive sets the "keep_alive" field.
|
||||
func (u *SysMenuUpsertOne) SetKeepAlive(v bool) *SysMenuUpsertOne {
|
||||
return u.Update(func(s *SysMenuUpsert) {
|
||||
s.SetKeepAlive(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateKeepAlive sets the "keep_alive" field to the value that was provided on create.
|
||||
func (u *SysMenuUpsertOne) UpdateKeepAlive() *SysMenuUpsertOne {
|
||||
return u.Update(func(s *SysMenuUpsert) {
|
||||
s.UpdateKeepAlive()
|
||||
})
|
||||
}
|
||||
|
||||
// SetHidden sets the "hidden" field.
|
||||
func (u *SysMenuUpsertOne) SetHidden(v bool) *SysMenuUpsertOne {
|
||||
return u.Update(func(s *SysMenuUpsert) {
|
||||
@@ -1193,6 +1244,20 @@ func (u *SysMenuUpsertBulk) ClearComponent() *SysMenuUpsertBulk {
|
||||
})
|
||||
}
|
||||
|
||||
// SetKeepAlive sets the "keep_alive" field.
|
||||
func (u *SysMenuUpsertBulk) SetKeepAlive(v bool) *SysMenuUpsertBulk {
|
||||
return u.Update(func(s *SysMenuUpsert) {
|
||||
s.SetKeepAlive(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateKeepAlive sets the "keep_alive" field to the value that was provided on create.
|
||||
func (u *SysMenuUpsertBulk) UpdateKeepAlive() *SysMenuUpsertBulk {
|
||||
return u.Update(func(s *SysMenuUpsert) {
|
||||
s.UpdateKeepAlive()
|
||||
})
|
||||
}
|
||||
|
||||
// SetHidden sets the "hidden" field.
|
||||
func (u *SysMenuUpsertBulk) SetHidden(v bool) *SysMenuUpsertBulk {
|
||||
return u.Update(func(s *SysMenuUpsert) {
|
||||
|
||||
@@ -153,6 +153,20 @@ func (_u *SysMenuUpdate) ClearComponent() *SysMenuUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetKeepAlive sets the "keep_alive" field.
|
||||
func (_u *SysMenuUpdate) SetKeepAlive(v bool) *SysMenuUpdate {
|
||||
_u.mutation.SetKeepAlive(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableKeepAlive sets the "keep_alive" field if the given value is not nil.
|
||||
func (_u *SysMenuUpdate) SetNillableKeepAlive(v *bool) *SysMenuUpdate {
|
||||
if v != nil {
|
||||
_u.SetKeepAlive(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHidden sets the "hidden" field.
|
||||
func (_u *SysMenuUpdate) SetHidden(v bool) *SysMenuUpdate {
|
||||
_u.mutation.SetHidden(v)
|
||||
@@ -398,6 +412,9 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if _u.mutation.ComponentCleared() {
|
||||
_spec.ClearField(sysmenu.FieldComponent, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.KeepAlive(); ok {
|
||||
_spec.SetField(sysmenu.FieldKeepAlive, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Hidden(); ok {
|
||||
_spec.SetField(sysmenu.FieldHidden, field.TypeBool, value)
|
||||
}
|
||||
@@ -686,6 +703,20 @@ func (_u *SysMenuUpdateOne) ClearComponent() *SysMenuUpdateOne {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetKeepAlive sets the "keep_alive" field.
|
||||
func (_u *SysMenuUpdateOne) SetKeepAlive(v bool) *SysMenuUpdateOne {
|
||||
_u.mutation.SetKeepAlive(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableKeepAlive sets the "keep_alive" field if the given value is not nil.
|
||||
func (_u *SysMenuUpdateOne) SetNillableKeepAlive(v *bool) *SysMenuUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetKeepAlive(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHidden sets the "hidden" field.
|
||||
func (_u *SysMenuUpdateOne) SetHidden(v bool) *SysMenuUpdateOne {
|
||||
_u.mutation.SetHidden(v)
|
||||
@@ -961,6 +992,9 @@ func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err er
|
||||
if _u.mutation.ComponentCleared() {
|
||||
_spec.ClearField(sysmenu.FieldComponent, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.KeepAlive(); ok {
|
||||
_spec.SetField(sysmenu.FieldKeepAlive, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Hidden(); ok {
|
||||
_spec.SetField(sysmenu.FieldHidden, field.TypeBool, value)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"likedream-goframe/internal/application/cpdaily/school"
|
||||
task2 "likedream-goframe/internal/application/cpdaily/task"
|
||||
"likedream-goframe/internal/application/cpdaily/task/formtype"
|
||||
errors2 "likedream-goframe/internal/common/errors"
|
||||
"likedream-goframe/internal/db"
|
||||
"likedream-goframe/internal/ent"
|
||||
"likedream-goframe/internal/ent/cptask"
|
||||
@@ -57,6 +58,8 @@ func (c *CpdailyTaskHandler) ProcessTask(ctx context.Context, task *asynq.Task)
|
||||
|
||||
if e1, ok := utils.Of[*errors.BusinessError](err); ok {
|
||||
errorMessage = e1.Message()
|
||||
} else if e1, ok := utils.Of[*errors2.BusinessError](err); ok {
|
||||
errorMessage = e1.Message
|
||||
} else {
|
||||
errorMessage = "未知的错误导致任务执行失败"
|
||||
}
|
||||
@@ -68,7 +71,7 @@ func (c *CpdailyTaskHandler) ProcessTask(ctx context.Context, task *asynq.Task)
|
||||
SetIsSuccess(false).
|
||||
SetRealName("").
|
||||
SetErrorMessage(errorMessage).
|
||||
Exec(ctx)
|
||||
Exec(context.Background())
|
||||
|
||||
utils.LogError(ctx, "创建任务日志失败", oops.With("task_id", taskPayload.CpTaskID).Wrap(e))
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ func NewV1() *AgentServiceV1 {
|
||||
}
|
||||
|
||||
func (s *AgentServiceV1) List(ctx context.Context, req *v1.AgentListReq) *utils.Response[[]v1.AgentListRes] {
|
||||
query := db.Global.SysUser.Query()
|
||||
query := db.Global.SysUser.Query().Order(ent.Desc(sysuser.FieldCreateTime))
|
||||
if !utils.IsAdminFromCtx(ctx) {
|
||||
query.Where(sysuser.HasParentWith(sysuser.IDEQ(utils.GetUserInfoFromCtx(ctx).ID)))
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ type CardServiceV1 struct{}
|
||||
|
||||
func (v CardServiceV1) List(ctx context.Context, req *v1.ListCardReq) *utils.Response[[]*ent.SysCard] {
|
||||
user := utils.GetUserInfoFromCtx(ctx)
|
||||
query := db.Global.SysCard.Query().Where(syscard.HasCreatorWith(sysuser.IDEQ(user.ID))).WithUser().WithCashUser()
|
||||
query := db.Global.SysCard.Query().Where(syscard.HasCreatorWith(sysuser.IDEQ(user.ID))).WithUser().WithCashUser().Order(ent.Desc(syscard.FieldCreateTime))
|
||||
if req.Content != "" {
|
||||
query.Where(syscard.ContentEQ(req.Content))
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func (v CpTaskServiceV1) AddTask(ctx context.Context, req *v1.AddTaskReq) *utils
|
||||
|
||||
func (v CpTaskServiceV1) List(ctx context.Context, req *v1.CpTaskListReq) *utils.Response[[]*ent.CpTask] {
|
||||
user := utils.GetUserInfoFromCtx(ctx)
|
||||
query := db.Global.CpTask.Query().Where(cptask.HasSysUserWith(sysuser.ID(user.ID))).WithCpUser()
|
||||
query := db.Global.CpTask.Query().Where(cptask.HasSysUserWith(sysuser.ID(user.ID))).WithCpUser().Order(ent.Desc(cptask.FieldCreateTime))
|
||||
if req.TaskType != "" {
|
||||
query.Where(cptask.TaskTypeEQ(req.TaskType))
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ func (v CpTaskLogServiceV1) List(ctx context.Context, req *v1.CpTaskLogListReq)
|
||||
user := utils.GetUserInfoFromCtx(ctx)
|
||||
query := db.Global.CpTaskLog.Query().Where(
|
||||
cptasklog.HasSystemUserWith(sysuser.ID(user.ID)),
|
||||
cptasklog.CpTaskID(req.TaskID))
|
||||
cptasklog.CpTaskID(req.TaskID)).Order(ent.Desc(cptasklog.FieldCreateTime))
|
||||
total := query.CountX(ctx)
|
||||
var data []*ent.CpTaskLog
|
||||
if total > 0 {
|
||||
|
||||
@@ -71,7 +71,7 @@ func (v CpUserServiceV1) ConfirmAdd(ctx context.Context, req *v1.CpUserConfirmAd
|
||||
|
||||
func (v CpUserServiceV1) List(ctx context.Context, req *v1.CpUserListReq) *utils.Response[[]*ent.CpUser] {
|
||||
user := utils.GetUserInfoFromCtx(ctx)
|
||||
query := db.Global.CpUser.Query().Where(cpuser.HasSysuserWith(sysuser.ID(user.ID))).WithSchool()
|
||||
query := db.Global.CpUser.Query().Where(cpuser.HasSysuserWith(sysuser.ID(user.ID))).WithSchool().Order(ent.Desc(cpuser.FieldCreateTime))
|
||||
if req.Email != "" {
|
||||
query.Where(cpuser.EmailContains(req.Email))
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ func (s *MenuServiceV1) Add(ctx context.Context, req *v1.MenuAddReq) *utils.Resp
|
||||
SetRoute(req.Route).
|
||||
SetComponent(req.Component).
|
||||
SetHidden(req.Hidden).
|
||||
SetKeepAlive(req.KeepAlive).
|
||||
SetIcon(req.Icon).
|
||||
SetOrder(req.Order)
|
||||
if req.ParentId != 0 {
|
||||
@@ -80,6 +81,7 @@ func (s *MenuServiceV1) Update(ctx context.Context, req *v1.MenuUpdateReq) *util
|
||||
SetComponent(req.Component).
|
||||
SetRoute(req.Route).
|
||||
SetHidden(req.Hidden).
|
||||
SetKeepAlive(req.KeepAlive).
|
||||
SetIcon(req.Icon).
|
||||
SetOrder(req.Order)
|
||||
if req.ParentId != 0 {
|
||||
|
||||
@@ -227,6 +227,7 @@ func buildTreeMenu(list []*ent.SysMenu, parentId int64) []*v1.UserMenuRes {
|
||||
Permission: menu.Permission,
|
||||
Type: string(menu.Type),
|
||||
Hidden: menu.Hidden,
|
||||
KeepAlive: menu.KeepAlive,
|
||||
Children: buildTreeMenu(list, menu.ID),
|
||||
Order: menu.Order,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user