From ea929bd0347766b09b52a9be0dd85f1ccf60a179 Mon Sep 17 00:00:00 2001 From: RecordingTheSmile <17124941+RecordingTheSmile@users.noreply.github.com> Date: Sun, 26 Oct 2025 18:57:08 +0800 Subject: [PATCH] feat: entsql full feature enabled --- cmd/entc/main.go | 7 +- internal/ent/client.go | 137 ++ internal/ent/cpimage/where.go | 7 + internal/ent/cpimage_create.go | 2 + internal/ent/cpimage_delete.go | 3 + internal/ent/cpimage_query.go | 65 +- internal/ent/cpimage_update.go | 35 +- internal/ent/cpschool.go | 27 +- internal/ent/cpschool/where.go | 7 + internal/ent/cpschool_create.go | 2 + internal/ent/cpschool_delete.go | 3 + internal/ent/cpschool_query.go | 109 +- internal/ent/cpschool_update.go | 37 +- internal/ent/cptask.go | 27 +- internal/ent/cptask/where.go | 19 + internal/ent/cptask_create.go | 4 + internal/ent/cptask_delete.go | 3 + internal/ent/cptask_query.go | 119 +- internal/ent/cptask_update.go | 45 +- internal/ent/cptasklog/where.go | 19 + internal/ent/cptasklog_create.go | 4 + internal/ent/cptasklog_delete.go | 3 + internal/ent/cptasklog_query.go | 71 +- internal/ent/cptasklog_update.go | 43 +- internal/ent/cpuser.go | 52 +- internal/ent/cpuser/where.go | 25 + internal/ent/cpuser_create.go | 5 + internal/ent/cpuser_delete.go | 3 + internal/ent/cpuser_query.go | 158 +- internal/ent/cpuser_update.go | 51 +- internal/ent/entql.go | 1917 +++++++++++++++++++++++++ internal/ent/intercept/intercept.go | 450 ++++++ internal/ent/internal/globalid.go | 5 + internal/ent/internal/schema.go | 9 + internal/ent/internal/schemaconfig.go | 36 + internal/ent/migrate/migrate.go | 32 + internal/ent/migrate/schema.go | 33 +- internal/ent/privacy/privacy.go | 467 ++++++ internal/ent/sysagent/where.go | 7 + internal/ent/sysagent_create.go | 2 + internal/ent/sysagent_delete.go | 3 + internal/ent/sysagent_query.go | 72 +- internal/ent/sysagent_update.go | 35 +- internal/ent/syscard/where.go | 19 + internal/ent/syscard_create.go | 4 + internal/ent/syscard_delete.go | 3 + internal/ent/syscard_query.go | 71 +- internal/ent/syscard_update.go | 43 +- internal/ent/sysmenu.go | 52 +- internal/ent/sysmenu/where.go | 19 + internal/ent/sysmenu_create.go | 4 + internal/ent/sysmenu_delete.go | 3 + internal/ent/sysmenu_query.go | 144 +- internal/ent/sysmenu_update.go | 47 +- internal/ent/sysrole.go | 50 + internal/ent/sysrole/where.go | 13 + internal/ent/sysrole_create.go | 3 + internal/ent/sysrole_delete.go | 3 + internal/ent/sysrole_query.go | 126 +- internal/ent/sysrole_update.go | 43 +- internal/ent/sysuser.go | 227 ++- internal/ent/sysuser/where.go | 67 + internal/ent/sysuser_create.go | 12 + internal/ent/sysuser_delete.go | 3 + internal/ent/sysuser_query.go | 429 +++++- internal/ent/sysuser_update.go | 93 +- internal/ent/sysuserlog_create.go | 1 + internal/ent/sysuserlog_delete.go | 3 + internal/ent/sysuserlog_query.go | 62 +- internal/ent/sysuserlog_update.go | 31 +- internal/ent/tx.go | 26 + 71 files changed, 5604 insertions(+), 157 deletions(-) create mode 100644 internal/ent/entql.go create mode 100644 internal/ent/intercept/intercept.go create mode 100644 internal/ent/internal/globalid.go create mode 100644 internal/ent/internal/schema.go create mode 100644 internal/ent/internal/schemaconfig.go create mode 100644 internal/ent/privacy/privacy.go diff --git a/cmd/entc/main.go b/cmd/entc/main.go index a748b5b..534d8fc 100644 --- a/cmd/entc/main.go +++ b/cmd/entc/main.go @@ -1,10 +1,11 @@ package entc import ( + "likedream-goframe/internal/utils" + "entgo.io/ent/entc" "entgo.io/ent/entc/gen" "entgo.io/ent/schema/field" - "likedream-goframe/internal/utils" ) func Run() { @@ -13,9 +14,7 @@ func Run() { IDType: &field.TypeInfo{ Type: field.TypeInt64, }, - Features: []gen.Feature{ - gen.FeatureUpsert, - }, + Features: gen.AllFeatures, }) utils.OkOrPanic(err) diff --git a/internal/ent/client.go b/internal/ent/client.go index 7c31a4d..2c93b33 100644 --- a/internal/ent/client.go +++ b/internal/ent/client.go @@ -27,6 +27,9 @@ import ( "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" + + stdsql "database/sql" + "likedream-goframe/internal/ent/internal" ) // Client is the client that holds all ent builders. @@ -93,6 +96,8 @@ type ( hooks *hooks // interceptors to execute on queries. inters *inters + // schemaConfig contains alternative names for all tables. + schemaConfig SchemaConfig } // Option function to configure the client. Option func(*config) @@ -406,6 +411,9 @@ func (c *CpImageClient) QueryUser(_m *CpImage) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cpimage.UserTable, cpimage.UserColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpImage fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -556,6 +564,9 @@ func (c *CpSchoolClient) QueryCpusers(_m *CpSchool) *CpUserQuery { sqlgraph.To(cpuser.Table, cpuser.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, cpschool.CpusersTable, cpschool.CpusersColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpUser fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -705,6 +716,9 @@ func (c *CpTaskClient) QueryCpUser(_m *CpTask) *CpUserQuery { sqlgraph.To(cpuser.Table, cpuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptask.CpUserTable, cptask.CpUserColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpTask fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -721,6 +735,9 @@ func (c *CpTaskClient) QuerySysUser(_m *CpTask) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptask.SysUserTable, cptask.SysUserColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpTask fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -737,6 +754,9 @@ func (c *CpTaskClient) QueryCpTaskLogs(_m *CpTask) *CpTaskLogQuery { sqlgraph.To(cptasklog.Table, cptasklog.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, cptask.CpTaskLogsTable, cptask.CpTaskLogsColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -886,6 +906,9 @@ func (c *CpTaskLogClient) QueryCpTask(_m *CpTaskLog) *CpTaskQuery { sqlgraph.To(cptask.Table, cptask.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptasklog.CpTaskTable, cptasklog.CpTaskColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTaskLog fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -902,6 +925,9 @@ func (c *CpTaskLogClient) QuerySystemUser(_m *CpTaskLog) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptasklog.SystemUserTable, cptasklog.SystemUserColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpTaskLog fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -918,6 +944,9 @@ func (c *CpTaskLogClient) QueryCpUser(_m *CpTaskLog) *CpUserQuery { sqlgraph.To(cpuser.Table, cpuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptasklog.CpUserTable, cptasklog.CpUserColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpTaskLog fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1067,6 +1096,9 @@ func (c *CpUserClient) QueryCptasks(_m *CpUser) *CpTaskQuery { sqlgraph.To(cptask.Table, cptask.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, cpuser.CptasksTable, cpuser.CptasksColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTask fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1083,6 +1115,9 @@ func (c *CpUserClient) QuerySysuser(_m *CpUser) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cpuser.SysuserTable, cpuser.SysuserColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpUser fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1099,6 +1134,9 @@ func (c *CpUserClient) QueryCpTaskLogs(_m *CpUser) *CpTaskLogQuery { sqlgraph.To(cptasklog.Table, cptasklog.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, cpuser.CpTaskLogsTable, cpuser.CpTaskLogsColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1115,6 +1153,9 @@ func (c *CpUserClient) QuerySchool(_m *CpUser) *CpSchoolQuery { sqlgraph.To(cpschool.Table, cpschool.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cpuser.SchoolTable, cpuser.SchoolColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpSchool + step.Edge.Schema = schemaConfig.CpUser fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1264,6 +1305,9 @@ func (c *SysAgentClient) QueryUsers(_m *SysAgent) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.O2O, true, sysagent.UsersTable, sysagent.UsersColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysAgent fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1414,6 +1458,9 @@ func (c *SysCardClient) QueryCreator(_m *SysCard) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, syscard.CreatorTable, syscard.CreatorColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1430,6 +1477,9 @@ func (c *SysCardClient) QueryUser(_m *SysCard) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, syscard.UserTable, syscard.UserColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1446,6 +1496,9 @@ func (c *SysCardClient) QueryCashUser(_m *SysCard) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, syscard.CashUserTable, syscard.CashUserColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1596,6 +1649,9 @@ func (c *SysMenuClient) QueryRoles(_m *SysMenu) *SysRoleQuery { sqlgraph.To(sysrole.Table, sysrole.FieldID), sqlgraph.Edge(sqlgraph.M2M, true, sysmenu.RolesTable, sysmenu.RolesPrimaryKey...), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysRole + step.Edge.Schema = schemaConfig.SysRoleMenus fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1612,6 +1668,9 @@ func (c *SysMenuClient) QueryParent(_m *SysMenu) *SysMenuQuery { sqlgraph.To(sysmenu.Table, sysmenu.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, sysmenu.ParentTable, sysmenu.ParentColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysMenu fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1628,6 +1687,9 @@ func (c *SysMenuClient) QueryChildren(_m *SysMenu) *SysMenuQuery { sqlgraph.To(sysmenu.Table, sysmenu.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysmenu.ChildrenTable, sysmenu.ChildrenColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysMenu fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1778,6 +1840,9 @@ func (c *SysRoleClient) QueryMenus(_m *SysRole) *SysMenuQuery { sqlgraph.To(sysmenu.Table, sysmenu.FieldID), sqlgraph.Edge(sqlgraph.M2M, false, sysrole.MenusTable, sysrole.MenusPrimaryKey...), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysRoleMenus fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1794,6 +1859,9 @@ func (c *SysRoleClient) QueryUsers(_m *SysRole) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2M, true, sysrole.UsersTable, sysrole.UsersPrimaryKey...), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUserRoles fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1944,6 +2012,9 @@ func (c *SysUserClient) QueryParent(_m *SysUser) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, sysuser.ParentTable, sysuser.ParentColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUser fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1960,6 +2031,9 @@ func (c *SysUserClient) QueryChildren(_m *SysUser) *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.ChildrenTable, sysuser.ChildrenColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUser fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1976,6 +2050,9 @@ func (c *SysUserClient) QueryRoles(_m *SysUser) *SysRoleQuery { sqlgraph.To(sysrole.Table, sysrole.FieldID), sqlgraph.Edge(sqlgraph.M2M, false, sysuser.RolesTable, sysuser.RolesPrimaryKey...), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysRole + step.Edge.Schema = schemaConfig.SysUserRoles fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -1992,6 +2069,9 @@ func (c *SysUserClient) QueryAgent(_m *SysUser) *SysAgentQuery { sqlgraph.To(sysagent.Table, sysagent.FieldID), sqlgraph.Edge(sqlgraph.O2O, false, sysuser.AgentTable, sysuser.AgentColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysAgent + step.Edge.Schema = schemaConfig.SysAgent fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -2008,6 +2088,9 @@ func (c *SysUserClient) QueryImages(_m *SysUser) *CpImageQuery { sqlgraph.To(cpimage.Table, cpimage.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.ImagesTable, sysuser.ImagesColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpImage + step.Edge.Schema = schemaConfig.CpImage fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -2024,6 +2107,9 @@ func (c *SysUserClient) QueryCpuser(_m *SysUser) *CpUserQuery { sqlgraph.To(cpuser.Table, cpuser.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CpuserTable, sysuser.CpuserColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpUser fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -2040,6 +2126,9 @@ func (c *SysUserClient) QueryCpTask(_m *SysUser) *CpTaskQuery { sqlgraph.To(cptask.Table, cptask.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CpTaskTable, sysuser.CpTaskColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTask fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -2056,6 +2145,9 @@ func (c *SysUserClient) QueryCpTaskLogs(_m *SysUser) *CpTaskLogQuery { sqlgraph.To(cptasklog.Table, cptasklog.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CpTaskLogsTable, sysuser.CpTaskLogsColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -2072,6 +2164,9 @@ func (c *SysUserClient) QueryCreatedCards(_m *SysUser) *SysCardQuery { sqlgraph.To(syscard.Table, syscard.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CreatedCardsTable, sysuser.CreatedCardsColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -2088,6 +2183,9 @@ func (c *SysUserClient) QueryUsedCards(_m *SysUser) *SysCardQuery { sqlgraph.To(syscard.Table, syscard.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.UsedCardsTable, sysuser.UsedCardsColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -2104,6 +2202,9 @@ func (c *SysUserClient) QueryCashbackCards(_m *SysUser) *SysCardQuery { sqlgraph.To(syscard.Table, syscard.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CashbackCardsTable, sysuser.CashbackCardsColumn), ) + schemaConfig := _m.schemaConfig + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } @@ -2280,3 +2381,39 @@ type ( SysRole, SysUser, SysUserLog []ent.Interceptor } ) + +// SchemaConfig represents alternative schema names for all tables +// that can be passed at runtime. +type SchemaConfig = internal.SchemaConfig + +// AlternateSchemas allows alternate schema names to be +// passed into ent operations. +func AlternateSchema(schemaConfig SchemaConfig) Option { + return func(c *config) { + c.schemaConfig = schemaConfig + } +} + +// ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. +// See, database/sql#DB.ExecContext for more information. +func (c *config) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error) { + ex, ok := c.driver.(interface { + ExecContext(context.Context, string, ...any) (stdsql.Result, error) + }) + if !ok { + return nil, fmt.Errorf("Driver.ExecContext is not supported") + } + return ex.ExecContext(ctx, query, args...) +} + +// QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. +// See, database/sql#DB.QueryContext for more information. +func (c *config) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error) { + q, ok := c.driver.(interface { + QueryContext(context.Context, string, ...any) (*stdsql.Rows, error) + }) + if !ok { + return nil, fmt.Errorf("Driver.QueryContext is not supported") + } + return q.QueryContext(ctx, query, args...) +} diff --git a/internal/ent/cpimage/where.go b/internal/ent/cpimage/where.go index 4c3a471..54f37d1 100644 --- a/internal/ent/cpimage/where.go +++ b/internal/ent/cpimage/where.go @@ -3,6 +3,7 @@ package cpimage import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/framework/ent2" @@ -468,6 +469,9 @@ func HasUser() predicate.CpImage { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpImage sqlgraph.HasNeighbors(s, step) }) } @@ -476,6 +480,9 @@ func HasUser() predicate.CpImage { func HasUserWith(preds ...predicate.SysUser) predicate.CpImage { return predicate.CpImage(func(s *sql.Selector) { step := newUserStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpImage sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/cpimage_create.go b/internal/ent/cpimage_create.go index 3358c95..35088c6 100644 --- a/internal/ent/cpimage_create.go +++ b/internal/ent/cpimage_create.go @@ -197,6 +197,7 @@ func (_c *CpImageCreate) createSpec() (*CpImage, *sqlgraph.CreateSpec) { _node = &CpImage{config: _c.config} _spec = sqlgraph.NewCreateSpec(cpimage.Table, sqlgraph.NewFieldSpec(cpimage.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.CpImage _spec.OnConflict = _c.conflict if value, ok := _c.mutation.CreateTime(); ok { _spec.SetField(cpimage.FieldCreateTime, field.TypeString, value) @@ -233,6 +234,7 @@ func (_c *CpImageCreate) createSpec() (*CpImage, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpImage for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/cpimage_delete.go b/internal/ent/cpimage_delete.go index 1671731..873ca51 100644 --- a/internal/ent/cpimage_delete.go +++ b/internal/ent/cpimage_delete.go @@ -5,6 +5,7 @@ package ent import ( "context" "likedream-goframe/internal/ent/cpimage" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -41,6 +42,8 @@ func (_d *CpImageDelete) ExecX(ctx context.Context) int { func (_d *CpImageDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(cpimage.Table, sqlgraph.NewFieldSpec(cpimage.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.CpImage + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/cpimage_query.go b/internal/ent/cpimage_query.go index 0f723e1..2f3e5cd 100644 --- a/internal/ent/cpimage_query.go +++ b/internal/ent/cpimage_query.go @@ -6,11 +6,13 @@ import ( "context" "fmt" "likedream-goframe/internal/ent/cpimage" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuser" "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -24,6 +26,7 @@ type CpImageQuery struct { inters []Interceptor predicates []predicate.CpImage withUser *SysUserQuery + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -76,6 +79,9 @@ func (_q *CpImageQuery) QueryUser() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cpimage.UserTable, cpimage.UserColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpImage fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -276,8 +282,9 @@ func (_q *CpImageQuery) Clone() *CpImageQuery { predicates: append([]predicate.CpImage{}, _q.predicates...), withUser: _q.withUser.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -383,6 +390,11 @@ func (_q *CpImageQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*CpIm node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.CpImage + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -433,6 +445,11 @@ func (_q *CpImageQuery) loadUser(ctx context.Context, query *SysUserQuery, nodes func (_q *CpImageQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.CpImage + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -498,6 +515,12 @@ func (_q *CpImageQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.CpImage) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -515,6 +538,38 @@ func (_q *CpImageQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *CpImageQuery) ForUpdate(opts ...sql.LockOption) *CpImageQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *CpImageQuery) ForShare(opts ...sql.LockOption) *CpImageQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *CpImageQuery) Modify(modifiers ...func(s *sql.Selector)) *CpImageSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + // CpImageGroupBy is the group-by builder for CpImage entities. type CpImageGroupBy struct { selector @@ -604,3 +659,9 @@ func (_s *CpImageSelect) sqlScan(ctx context.Context, root *CpImageQuery, v any) defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *CpImageSelect) Modify(modifiers ...func(s *sql.Selector)) *CpImageSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/cpimage_update.go b/internal/ent/cpimage_update.go index 9c6056e..1ba7137 100644 --- a/internal/ent/cpimage_update.go +++ b/internal/ent/cpimage_update.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "likedream-goframe/internal/ent/cpimage" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuser" "likedream-goframe/internal/framework/ent2" @@ -19,8 +20,9 @@ import ( // CpImageUpdate is the builder for updating CpImage entities. type CpImageUpdate struct { config - hooks []Hook - mutation *CpImageMutation + hooks []Hook + mutation *CpImageMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the CpImageUpdate builder. @@ -169,6 +171,12 @@ func (_u *CpImageUpdate) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpImageUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpImageUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpImageUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err @@ -207,6 +215,7 @@ func (_u *CpImageUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.UserIDs(); len(nodes) > 0 { @@ -220,11 +229,15 @@ func (_u *CpImageUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpImage + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{cpimage.Label} @@ -240,9 +253,10 @@ func (_u *CpImageUpdate) sqlSave(ctx context.Context) (_node int, err error) { // CpImageUpdateOne is the builder for updating a single CpImage entity. type CpImageUpdateOne struct { config - fields []string - hooks []Hook - mutation *CpImageMutation + fields []string + hooks []Hook + mutation *CpImageMutation + modifiers []func(*sql.UpdateBuilder) } // SetUpdateTime sets the "update_time" field. @@ -398,6 +412,12 @@ func (_u *CpImageUpdateOne) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpImageUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpImageUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpImageUpdateOne) sqlSave(ctx context.Context) (_node *CpImage, err error) { if err := _u.check(); err != nil { return _node, err @@ -453,6 +473,7 @@ func (_u *CpImageUpdateOne) sqlSave(ctx context.Context) (_node *CpImage, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.UserIDs(); len(nodes) > 0 { @@ -466,11 +487,15 @@ func (_u *CpImageUpdateOne) sqlSave(ctx context.Context) (_node *CpImage, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpImage + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &CpImage{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/cpschool.go b/internal/ent/cpschool.go index 6ed82c8..e9781ba 100644 --- a/internal/ent/cpschool.go +++ b/internal/ent/cpschool.go @@ -34,7 +34,8 @@ type CpSchoolEdges struct { Cpusers []*CpUser `json:"cpusers,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [1]bool + loadedTypes [1]bool + namedCpusers map[string][]*CpUser } // CpusersOrErr returns the Cpusers value or an error if the edge @@ -145,5 +146,29 @@ func (_m *CpSchool) String() string { return builder.String() } +// NamedCpusers returns the Cpusers named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *CpSchool) NamedCpusers(name string) ([]*CpUser, error) { + if _m.Edges.namedCpusers == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedCpusers[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *CpSchool) appendNamedCpusers(name string, edges ...*CpUser) { + if _m.Edges.namedCpusers == nil { + _m.Edges.namedCpusers = make(map[string][]*CpUser) + } + if len(edges) == 0 { + _m.Edges.namedCpusers[name] = []*CpUser{} + } else { + _m.Edges.namedCpusers[name] = append(_m.Edges.namedCpusers[name], edges...) + } +} + // CpSchools is a parsable slice of CpSchool. type CpSchools []*CpSchool diff --git a/internal/ent/cpschool/where.go b/internal/ent/cpschool/where.go index 1bc0840..092461b 100644 --- a/internal/ent/cpschool/where.go +++ b/internal/ent/cpschool/where.go @@ -3,6 +3,7 @@ package cpschool import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -291,6 +292,9 @@ func HasCpusers() predicate.CpSchool { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CpusersTable, CpusersColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpUser sqlgraph.HasNeighbors(s, step) }) } @@ -299,6 +303,9 @@ func HasCpusers() predicate.CpSchool { func HasCpusersWith(preds ...predicate.CpUser) predicate.CpSchool { return predicate.CpSchool(func(s *sql.Selector) { step := newCpusersStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpUser sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/cpschool_create.go b/internal/ent/cpschool_create.go index caa9a6f..098445c 100644 --- a/internal/ent/cpschool_create.go +++ b/internal/ent/cpschool_create.go @@ -141,6 +141,7 @@ func (_c *CpSchoolCreate) createSpec() (*CpSchool, *sqlgraph.CreateSpec) { _node = &CpSchool{config: _c.config} _spec = sqlgraph.NewCreateSpec(cpschool.Table, sqlgraph.NewFieldSpec(cpschool.FieldID, field.TypeString)) ) + _spec.Schema = _c.schemaConfig.CpSchool _spec.OnConflict = _c.conflict if id, ok := _c.mutation.ID(); ok { _node.ID = id @@ -169,6 +170,7 @@ func (_c *CpSchoolCreate) createSpec() (*CpSchool, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/cpschool_delete.go b/internal/ent/cpschool_delete.go index 08b6cf3..d125b7a 100644 --- a/internal/ent/cpschool_delete.go +++ b/internal/ent/cpschool_delete.go @@ -5,6 +5,7 @@ package ent import ( "context" "likedream-goframe/internal/ent/cpschool" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -41,6 +42,8 @@ func (_d *CpSchoolDelete) ExecX(ctx context.Context) int { func (_d *CpSchoolDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(cpschool.Table, sqlgraph.NewFieldSpec(cpschool.FieldID, field.TypeString)) + _spec.Node.Schema = _d.schemaConfig.CpSchool + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/cpschool_query.go b/internal/ent/cpschool_query.go index 63ed49d..0ba98e8 100644 --- a/internal/ent/cpschool_query.go +++ b/internal/ent/cpschool_query.go @@ -8,10 +8,12 @@ import ( "fmt" "likedream-goframe/internal/ent/cpschool" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -20,11 +22,13 @@ import ( // CpSchoolQuery is the builder for querying CpSchool entities. type CpSchoolQuery struct { config - ctx *QueryContext - order []cpschool.OrderOption - inters []Interceptor - predicates []predicate.CpSchool - withCpusers *CpUserQuery + ctx *QueryContext + order []cpschool.OrderOption + inters []Interceptor + predicates []predicate.CpSchool + withCpusers *CpUserQuery + modifiers []func(*sql.Selector) + withNamedCpusers map[string]*CpUserQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -77,6 +81,9 @@ func (_q *CpSchoolQuery) QueryCpusers() *CpUserQuery { sqlgraph.To(cpuser.Table, cpuser.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, cpschool.CpusersTable, cpschool.CpusersColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpUser fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -277,8 +284,9 @@ func (_q *CpSchoolQuery) Clone() *CpSchoolQuery { predicates: append([]predicate.CpSchool{}, _q.predicates...), withCpusers: _q.withCpusers.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -384,6 +392,11 @@ func (_q *CpSchoolQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*CpS node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.CpSchool + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -396,7 +409,24 @@ func (_q *CpSchoolQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*CpS if query := _q.withCpusers; query != nil { if err := _q.loadCpusers(ctx, query, nodes, func(n *CpSchool) { n.Edges.Cpusers = []*CpUser{} }, - func(n *CpSchool, e *CpUser) { n.Edges.Cpusers = append(n.Edges.Cpusers, e) }); err != nil { + func(n *CpSchool, e *CpUser) { + n.Edges.Cpusers = append(n.Edges.Cpusers, e) + if !e.Edges.loadedTypes[3] { + e.Edges.School = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedCpusers { + if err := _q.loadCpusers(ctx, query, nodes, + func(n *CpSchool) { n.appendNamedCpusers(name) }, + func(n *CpSchool, e *CpUser) { + n.appendNamedCpusers(name, e) + if !e.Edges.loadedTypes[3] { + e.Edges.School = n + } + }); err != nil { return nil, err } } @@ -436,6 +466,11 @@ func (_q *CpSchoolQuery) loadCpusers(ctx context.Context, query *CpUserQuery, no func (_q *CpSchoolQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.CpSchool + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -498,6 +533,12 @@ func (_q *CpSchoolQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.CpSchool) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -515,6 +556,52 @@ func (_q *CpSchoolQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *CpSchoolQuery) ForUpdate(opts ...sql.LockOption) *CpSchoolQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *CpSchoolQuery) ForShare(opts ...sql.LockOption) *CpSchoolQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *CpSchoolQuery) Modify(modifiers ...func(s *sql.Selector)) *CpSchoolSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + +// WithNamedCpusers tells the query-builder to eager-load the nodes that are connected to the "cpusers" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *CpSchoolQuery) WithNamedCpusers(name string, opts ...func(*CpUserQuery)) *CpSchoolQuery { + query := (&CpUserClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedCpusers == nil { + _q.withNamedCpusers = make(map[string]*CpUserQuery) + } + _q.withNamedCpusers[name] = query + return _q +} + // CpSchoolGroupBy is the group-by builder for CpSchool entities. type CpSchoolGroupBy struct { selector @@ -604,3 +691,9 @@ func (_s *CpSchoolSelect) sqlScan(ctx context.Context, root *CpSchoolQuery, v an defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *CpSchoolSelect) Modify(modifiers ...func(s *sql.Selector)) *CpSchoolSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/cpschool_update.go b/internal/ent/cpschool_update.go index 5c113dd..1d86d54 100644 --- a/internal/ent/cpschool_update.go +++ b/internal/ent/cpschool_update.go @@ -8,6 +8,7 @@ import ( "fmt" "likedream-goframe/internal/ent/cpschool" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -18,8 +19,9 @@ import ( // CpSchoolUpdate is the builder for updating CpSchool entities. type CpSchoolUpdate struct { config - hooks []Hook - mutation *CpSchoolMutation + hooks []Hook + mutation *CpSchoolMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the CpSchoolUpdate builder. @@ -144,6 +146,12 @@ func (_u *CpSchoolUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpSchoolUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpSchoolUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpSchoolUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(cpschool.Table, cpschool.Columns, sqlgraph.NewFieldSpec(cpschool.FieldID, field.TypeString)) if ps := _u.mutation.predicates; len(ps) > 0 { @@ -176,6 +184,7 @@ func (_u *CpSchoolUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpusersIDs(); len(nodes) > 0 && !_u.mutation.CpusersCleared() { @@ -189,6 +198,7 @@ func (_u *CpSchoolUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -205,11 +215,15 @@ func (_u *CpSchoolUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpSchool + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{cpschool.Label} @@ -225,9 +239,10 @@ func (_u *CpSchoolUpdate) sqlSave(ctx context.Context) (_node int, err error) { // CpSchoolUpdateOne is the builder for updating a single CpSchool entity. type CpSchoolUpdateOne struct { config - fields []string - hooks []Hook - mutation *CpSchoolMutation + fields []string + hooks []Hook + mutation *CpSchoolMutation + modifiers []func(*sql.UpdateBuilder) } // SetName sets the "name" field. @@ -359,6 +374,12 @@ func (_u *CpSchoolUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpSchoolUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpSchoolUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpSchoolUpdateOne) sqlSave(ctx context.Context) (_node *CpSchool, err error) { _spec := sqlgraph.NewUpdateSpec(cpschool.Table, cpschool.Columns, sqlgraph.NewFieldSpec(cpschool.FieldID, field.TypeString)) id, ok := _u.mutation.ID() @@ -408,6 +429,7 @@ func (_u *CpSchoolUpdateOne) sqlSave(ctx context.Context) (_node *CpSchool, err IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpusersIDs(); len(nodes) > 0 && !_u.mutation.CpusersCleared() { @@ -421,6 +443,7 @@ func (_u *CpSchoolUpdateOne) sqlSave(ctx context.Context) (_node *CpSchool, err IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -437,11 +460,15 @@ func (_u *CpSchoolUpdateOne) sqlSave(ctx context.Context) (_node *CpSchool, err IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpSchool + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &CpSchool{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/cptask.go b/internal/ent/cptask.go index 1ed6caa..1b29645 100644 --- a/internal/ent/cptask.go +++ b/internal/ent/cptask.go @@ -60,7 +60,8 @@ type CpTaskEdges struct { CpTaskLogs []*CpTaskLog `json:"cp_task_logs,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [3]bool + loadedTypes [3]bool + namedCpTaskLogs map[string][]*CpTaskLog } // CpUserOrErr returns the CpUser value or an error if the edge @@ -304,5 +305,29 @@ func (_m *CpTask) String() string { return builder.String() } +// NamedCpTaskLogs returns the CpTaskLogs named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *CpTask) NamedCpTaskLogs(name string) ([]*CpTaskLog, error) { + if _m.Edges.namedCpTaskLogs == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedCpTaskLogs[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *CpTask) appendNamedCpTaskLogs(name string, edges ...*CpTaskLog) { + if _m.Edges.namedCpTaskLogs == nil { + _m.Edges.namedCpTaskLogs = make(map[string][]*CpTaskLog) + } + if len(edges) == 0 { + _m.Edges.namedCpTaskLogs[name] = []*CpTaskLog{} + } else { + _m.Edges.namedCpTaskLogs[name] = append(_m.Edges.namedCpTaskLogs[name], edges...) + } +} + // CpTasks is a parsable slice of CpTask. type CpTasks []*CpTask diff --git a/internal/ent/cptask/where.go b/internal/ent/cptask/where.go index 4e64898..dc654db 100644 --- a/internal/ent/cptask/where.go +++ b/internal/ent/cptask/where.go @@ -3,6 +3,7 @@ package cptask import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -596,6 +597,9 @@ func HasCpUser() predicate.CpTask { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, CpUserTable, CpUserColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpTask sqlgraph.HasNeighbors(s, step) }) } @@ -604,6 +608,9 @@ func HasCpUser() predicate.CpTask { func HasCpUserWith(preds ...predicate.CpUser) predicate.CpTask { return predicate.CpTask(func(s *sql.Selector) { step := newCpUserStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpTask sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -619,6 +626,9 @@ func HasSysUser() predicate.CpTask { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SysUserTable, SysUserColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpTask sqlgraph.HasNeighbors(s, step) }) } @@ -627,6 +637,9 @@ func HasSysUser() predicate.CpTask { func HasSysUserWith(preds ...predicate.SysUser) predicate.CpTask { return predicate.CpTask(func(s *sql.Selector) { step := newSysUserStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpTask sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -642,6 +655,9 @@ func HasCpTaskLogs() predicate.CpTask { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CpTaskLogsTable, CpTaskLogsColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighbors(s, step) }) } @@ -650,6 +666,9 @@ func HasCpTaskLogs() predicate.CpTask { func HasCpTaskLogsWith(preds ...predicate.CpTaskLog) predicate.CpTask { return predicate.CpTask(func(s *sql.Selector) { step := newCpTaskLogsStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/cptask_create.go b/internal/ent/cptask_create.go index dfc2988..1a1b3b5 100644 --- a/internal/ent/cptask_create.go +++ b/internal/ent/cptask_create.go @@ -312,6 +312,7 @@ func (_c *CpTaskCreate) createSpec() (*CpTask, *sqlgraph.CreateSpec) { _node = &CpTask{config: _c.config} _spec = sqlgraph.NewCreateSpec(cptask.Table, sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.CpTask _spec.OnConflict = _c.conflict if value, ok := _c.mutation.TaskType(); ok { _spec.SetField(cptask.FieldTaskType, field.TypeEnum, value) @@ -368,6 +369,7 @@ func (_c *CpTaskCreate) createSpec() (*CpTask, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -385,6 +387,7 @@ func (_c *CpTaskCreate) createSpec() (*CpTask, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -402,6 +405,7 @@ func (_c *CpTaskCreate) createSpec() (*CpTask, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/cptask_delete.go b/internal/ent/cptask_delete.go index b0a4c28..397c55d 100644 --- a/internal/ent/cptask_delete.go +++ b/internal/ent/cptask_delete.go @@ -5,6 +5,7 @@ package ent import ( "context" "likedream-goframe/internal/ent/cptask" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -41,6 +42,8 @@ func (_d *CpTaskDelete) ExecX(ctx context.Context) int { func (_d *CpTaskDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(cptask.Table, sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.CpTask + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/cptask_query.go b/internal/ent/cptask_query.go index b69bf20..46580e0 100644 --- a/internal/ent/cptask_query.go +++ b/internal/ent/cptask_query.go @@ -9,11 +9,13 @@ import ( "likedream-goframe/internal/ent/cptask" "likedream-goframe/internal/ent/cptasklog" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuser" "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -22,13 +24,15 @@ import ( // CpTaskQuery is the builder for querying CpTask entities. type CpTaskQuery struct { config - ctx *QueryContext - order []cptask.OrderOption - inters []Interceptor - predicates []predicate.CpTask - withCpUser *CpUserQuery - withSysUser *SysUserQuery - withCpTaskLogs *CpTaskLogQuery + ctx *QueryContext + order []cptask.OrderOption + inters []Interceptor + predicates []predicate.CpTask + withCpUser *CpUserQuery + withSysUser *SysUserQuery + withCpTaskLogs *CpTaskLogQuery + modifiers []func(*sql.Selector) + withNamedCpTaskLogs map[string]*CpTaskLogQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -81,6 +85,9 @@ func (_q *CpTaskQuery) QueryCpUser() *CpUserQuery { sqlgraph.To(cpuser.Table, cpuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptask.CpUserTable, cptask.CpUserColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpTask fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -103,6 +110,9 @@ func (_q *CpTaskQuery) QuerySysUser() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptask.SysUserTable, cptask.SysUserColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpTask fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -125,6 +135,9 @@ func (_q *CpTaskQuery) QueryCpTaskLogs() *CpTaskLogQuery { sqlgraph.To(cptasklog.Table, cptasklog.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, cptask.CpTaskLogsTable, cptask.CpTaskLogsColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -327,8 +340,9 @@ func (_q *CpTaskQuery) Clone() *CpTaskQuery { withSysUser: _q.withSysUser.Clone(), withCpTaskLogs: _q.withCpTaskLogs.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -458,6 +472,11 @@ func (_q *CpTaskQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*CpTas node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.CpTask + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -482,7 +501,24 @@ func (_q *CpTaskQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*CpTas if query := _q.withCpTaskLogs; query != nil { if err := _q.loadCpTaskLogs(ctx, query, nodes, func(n *CpTask) { n.Edges.CpTaskLogs = []*CpTaskLog{} }, - func(n *CpTask, e *CpTaskLog) { n.Edges.CpTaskLogs = append(n.Edges.CpTaskLogs, e) }); err != nil { + func(n *CpTask, e *CpTaskLog) { + n.Edges.CpTaskLogs = append(n.Edges.CpTaskLogs, e) + if !e.Edges.loadedTypes[0] { + e.Edges.CpTask = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedCpTaskLogs { + if err := _q.loadCpTaskLogs(ctx, query, nodes, + func(n *CpTask) { n.appendNamedCpTaskLogs(name) }, + func(n *CpTask, e *CpTaskLog) { + n.appendNamedCpTaskLogs(name, e) + if !e.Edges.loadedTypes[0] { + e.Edges.CpTask = n + } + }); err != nil { return nil, err } } @@ -580,6 +616,11 @@ func (_q *CpTaskQuery) loadCpTaskLogs(ctx context.Context, query *CpTaskLogQuery func (_q *CpTaskQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.CpTask + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -648,6 +689,12 @@ func (_q *CpTaskQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.CpTask) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -665,6 +712,52 @@ func (_q *CpTaskQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *CpTaskQuery) ForUpdate(opts ...sql.LockOption) *CpTaskQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *CpTaskQuery) ForShare(opts ...sql.LockOption) *CpTaskQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *CpTaskQuery) Modify(modifiers ...func(s *sql.Selector)) *CpTaskSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + +// WithNamedCpTaskLogs tells the query-builder to eager-load the nodes that are connected to the "cp_task_logs" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *CpTaskQuery) WithNamedCpTaskLogs(name string, opts ...func(*CpTaskLogQuery)) *CpTaskQuery { + query := (&CpTaskLogClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedCpTaskLogs == nil { + _q.withNamedCpTaskLogs = make(map[string]*CpTaskLogQuery) + } + _q.withNamedCpTaskLogs[name] = query + return _q +} + // CpTaskGroupBy is the group-by builder for CpTask entities. type CpTaskGroupBy struct { selector @@ -754,3 +847,9 @@ func (_s *CpTaskSelect) sqlScan(ctx context.Context, root *CpTaskQuery, v any) e defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *CpTaskSelect) Modify(modifiers ...func(s *sql.Selector)) *CpTaskSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/cptask_update.go b/internal/ent/cptask_update.go index e89dc28..40974ac 100644 --- a/internal/ent/cptask_update.go +++ b/internal/ent/cptask_update.go @@ -9,6 +9,7 @@ import ( "likedream-goframe/internal/ent/cptask" "likedream-goframe/internal/ent/cptasklog" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuser" @@ -20,8 +21,9 @@ import ( // CpTaskUpdate is the builder for updating CpTask entities. type CpTaskUpdate struct { config - hooks []Hook - mutation *CpTaskMutation + hooks []Hook + mutation *CpTaskMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the CpTaskUpdate builder. @@ -403,6 +405,12 @@ func (_u *CpTaskUpdate) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpTaskUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpTaskUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err @@ -486,6 +494,7 @@ func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CpUserIDs(); len(nodes) > 0 { @@ -499,6 +508,7 @@ func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -515,6 +525,7 @@ func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SysUserIDs(); len(nodes) > 0 { @@ -528,6 +539,7 @@ func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -544,6 +556,7 @@ func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpTaskLogsIDs(); len(nodes) > 0 && !_u.mutation.CpTaskLogsCleared() { @@ -557,6 +570,7 @@ func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -573,11 +587,15 @@ func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpTask + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{cptask.Label} @@ -593,9 +611,10 @@ func (_u *CpTaskUpdate) sqlSave(ctx context.Context) (_node int, err error) { // CpTaskUpdateOne is the builder for updating a single CpTask entity. type CpTaskUpdateOne struct { config - fields []string - hooks []Hook - mutation *CpTaskMutation + fields []string + hooks []Hook + mutation *CpTaskMutation + modifiers []func(*sql.UpdateBuilder) } // SetCpUserID sets the "cp_user_id" field. @@ -984,6 +1003,12 @@ func (_u *CpTaskUpdateOne) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpTaskUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpTaskUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpTaskUpdateOne) sqlSave(ctx context.Context) (_node *CpTask, err error) { if err := _u.check(); err != nil { return _node, err @@ -1084,6 +1109,7 @@ func (_u *CpTaskUpdateOne) sqlSave(ctx context.Context) (_node *CpTask, err erro IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CpUserIDs(); len(nodes) > 0 { @@ -1097,6 +1123,7 @@ func (_u *CpTaskUpdateOne) sqlSave(ctx context.Context) (_node *CpTask, err erro IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1113,6 +1140,7 @@ func (_u *CpTaskUpdateOne) sqlSave(ctx context.Context) (_node *CpTask, err erro IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SysUserIDs(); len(nodes) > 0 { @@ -1126,6 +1154,7 @@ func (_u *CpTaskUpdateOne) sqlSave(ctx context.Context) (_node *CpTask, err erro IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1142,6 +1171,7 @@ func (_u *CpTaskUpdateOne) sqlSave(ctx context.Context) (_node *CpTask, err erro IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpTaskLogsIDs(); len(nodes) > 0 && !_u.mutation.CpTaskLogsCleared() { @@ -1155,6 +1185,7 @@ func (_u *CpTaskUpdateOne) sqlSave(ctx context.Context) (_node *CpTask, err erro IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1171,11 +1202,15 @@ func (_u *CpTaskUpdateOne) sqlSave(ctx context.Context) (_node *CpTask, err erro IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpTask + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &CpTask{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/cptasklog/where.go b/internal/ent/cptasklog/where.go index 65c0389..0ad2b81 100644 --- a/internal/ent/cptasklog/where.go +++ b/internal/ent/cptasklog/where.go @@ -3,6 +3,7 @@ package cptasklog import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -311,6 +312,9 @@ func HasCpTask() predicate.CpTaskLog { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, CpTaskTable, CpTaskColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighbors(s, step) }) } @@ -319,6 +323,9 @@ func HasCpTask() predicate.CpTaskLog { func HasCpTaskWith(preds ...predicate.CpTask) predicate.CpTaskLog { return predicate.CpTaskLog(func(s *sql.Selector) { step := newCpTaskStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -334,6 +341,9 @@ func HasSystemUser() predicate.CpTaskLog { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SystemUserTable, SystemUserColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighbors(s, step) }) } @@ -342,6 +352,9 @@ func HasSystemUser() predicate.CpTaskLog { func HasSystemUserWith(preds ...predicate.SysUser) predicate.CpTaskLog { return predicate.CpTaskLog(func(s *sql.Selector) { step := newSystemUserStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -357,6 +370,9 @@ func HasCpUser() predicate.CpTaskLog { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, CpUserTable, CpUserColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighbors(s, step) }) } @@ -365,6 +381,9 @@ func HasCpUser() predicate.CpTaskLog { func HasCpUserWith(preds ...predicate.CpUser) predicate.CpTaskLog { return predicate.CpTaskLog(func(s *sql.Selector) { step := newCpUserStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/cptasklog_create.go b/internal/ent/cptasklog_create.go index 5637e94..644cb97 100644 --- a/internal/ent/cptasklog_create.go +++ b/internal/ent/cptasklog_create.go @@ -172,6 +172,7 @@ func (_c *CpTaskLogCreate) createSpec() (*CpTaskLog, *sqlgraph.CreateSpec) { _node = &CpTaskLog{config: _c.config} _spec = sqlgraph.NewCreateSpec(cptasklog.Table, sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.CpTaskLog _spec.OnConflict = _c.conflict if value, ok := _c.mutation.IsSuccess(); ok { _spec.SetField(cptasklog.FieldIsSuccess, field.TypeBool, value) @@ -196,6 +197,7 @@ func (_c *CpTaskLogCreate) createSpec() (*CpTaskLog, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -213,6 +215,7 @@ func (_c *CpTaskLogCreate) createSpec() (*CpTaskLog, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -230,6 +233,7 @@ func (_c *CpTaskLogCreate) createSpec() (*CpTaskLog, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/cptasklog_delete.go b/internal/ent/cptasklog_delete.go index 22b8ead..1f4f26d 100644 --- a/internal/ent/cptasklog_delete.go +++ b/internal/ent/cptasklog_delete.go @@ -5,6 +5,7 @@ package ent import ( "context" "likedream-goframe/internal/ent/cptasklog" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -41,6 +42,8 @@ func (_d *CpTaskLogDelete) ExecX(ctx context.Context) int { func (_d *CpTaskLogDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(cptasklog.Table, sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.CpTaskLog + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/cptasklog_query.go b/internal/ent/cptasklog_query.go index d847513..4c4a14b 100644 --- a/internal/ent/cptasklog_query.go +++ b/internal/ent/cptasklog_query.go @@ -8,11 +8,13 @@ import ( "likedream-goframe/internal/ent/cptask" "likedream-goframe/internal/ent/cptasklog" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuser" "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -28,6 +30,7 @@ type CpTaskLogQuery struct { withCpTask *CpTaskQuery withSystemUser *SysUserQuery withCpUser *CpUserQuery + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -80,6 +83,9 @@ func (_q *CpTaskLogQuery) QueryCpTask() *CpTaskQuery { sqlgraph.To(cptask.Table, cptask.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptasklog.CpTaskTable, cptasklog.CpTaskColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTaskLog fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -102,6 +108,9 @@ func (_q *CpTaskLogQuery) QuerySystemUser() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptasklog.SystemUserTable, cptasklog.SystemUserColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpTaskLog fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -124,6 +133,9 @@ func (_q *CpTaskLogQuery) QueryCpUser() *CpUserQuery { sqlgraph.To(cpuser.Table, cpuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cptasklog.CpUserTable, cptasklog.CpUserColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpTaskLog fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -326,8 +338,9 @@ func (_q *CpTaskLogQuery) Clone() *CpTaskLogQuery { withSystemUser: _q.withSystemUser.Clone(), withCpUser: _q.withCpUser.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -457,6 +470,11 @@ func (_q *CpTaskLogQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Cp node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.CpTaskLog + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -577,6 +595,11 @@ func (_q *CpTaskLogQuery) loadCpUser(ctx context.Context, query *CpUserQuery, no func (_q *CpTaskLogQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.CpTaskLog + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -648,6 +671,12 @@ func (_q *CpTaskLogQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.CpTaskLog) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -665,6 +694,38 @@ func (_q *CpTaskLogQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *CpTaskLogQuery) ForUpdate(opts ...sql.LockOption) *CpTaskLogQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *CpTaskLogQuery) ForShare(opts ...sql.LockOption) *CpTaskLogQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *CpTaskLogQuery) Modify(modifiers ...func(s *sql.Selector)) *CpTaskLogSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + // CpTaskLogGroupBy is the group-by builder for CpTaskLog entities. type CpTaskLogGroupBy struct { selector @@ -754,3 +815,9 @@ func (_s *CpTaskLogSelect) sqlScan(ctx context.Context, root *CpTaskLogQuery, v defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *CpTaskLogSelect) Modify(modifiers ...func(s *sql.Selector)) *CpTaskLogSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/cptasklog_update.go b/internal/ent/cptasklog_update.go index 98a396b..9e4d22c 100644 --- a/internal/ent/cptasklog_update.go +++ b/internal/ent/cptasklog_update.go @@ -9,6 +9,7 @@ import ( "likedream-goframe/internal/ent/cptask" "likedream-goframe/internal/ent/cptasklog" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuser" @@ -20,8 +21,9 @@ import ( // CpTaskLogUpdate is the builder for updating CpTaskLog entities. type CpTaskLogUpdate struct { config - hooks []Hook - mutation *CpTaskLogMutation + hooks []Hook + mutation *CpTaskLogMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the CpTaskLogUpdate builder. @@ -205,6 +207,12 @@ func (_u *CpTaskLogUpdate) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpTaskLogUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpTaskLogUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpTaskLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err @@ -243,6 +251,7 @@ func (_u *CpTaskLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CpTaskIDs(); len(nodes) > 0 { @@ -256,6 +265,7 @@ func (_u *CpTaskLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -272,6 +282,7 @@ func (_u *CpTaskLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SystemUserIDs(); len(nodes) > 0 { @@ -285,6 +296,7 @@ func (_u *CpTaskLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -301,6 +313,7 @@ func (_u *CpTaskLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CpUserIDs(); len(nodes) > 0 { @@ -314,11 +327,15 @@ func (_u *CpTaskLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpTaskLog + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{cptasklog.Label} @@ -334,9 +351,10 @@ func (_u *CpTaskLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { // CpTaskLogUpdateOne is the builder for updating a single CpTaskLog entity. type CpTaskLogUpdateOne struct { config - fields []string - hooks []Hook - mutation *CpTaskLogMutation + fields []string + hooks []Hook + mutation *CpTaskLogMutation + modifiers []func(*sql.UpdateBuilder) } // SetCpTaskID sets the "cp_task_id" field. @@ -527,6 +545,12 @@ func (_u *CpTaskLogUpdateOne) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpTaskLogUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpTaskLogUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpTaskLogUpdateOne) sqlSave(ctx context.Context) (_node *CpTaskLog, err error) { if err := _u.check(); err != nil { return _node, err @@ -582,6 +606,7 @@ func (_u *CpTaskLogUpdateOne) sqlSave(ctx context.Context) (_node *CpTaskLog, er IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CpTaskIDs(); len(nodes) > 0 { @@ -595,6 +620,7 @@ func (_u *CpTaskLogUpdateOne) sqlSave(ctx context.Context) (_node *CpTaskLog, er IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -611,6 +637,7 @@ func (_u *CpTaskLogUpdateOne) sqlSave(ctx context.Context) (_node *CpTaskLog, er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SystemUserIDs(); len(nodes) > 0 { @@ -624,6 +651,7 @@ func (_u *CpTaskLogUpdateOne) sqlSave(ctx context.Context) (_node *CpTaskLog, er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -640,6 +668,7 @@ func (_u *CpTaskLogUpdateOne) sqlSave(ctx context.Context) (_node *CpTaskLog, er IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CpUserIDs(); len(nodes) > 0 { @@ -653,11 +682,15 @@ func (_u *CpTaskLogUpdateOne) sqlSave(ctx context.Context) (_node *CpTaskLog, er IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpTaskLog + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &CpTaskLog{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/cpuser.go b/internal/ent/cpuser.go index 1f03a93..c04310b 100644 --- a/internal/ent/cpuser.go +++ b/internal/ent/cpuser.go @@ -52,7 +52,9 @@ type CpUserEdges struct { School *CpSchool `json:"school,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [4]bool + loadedTypes [4]bool + namedCptasks map[string][]*CpTask + namedCpTaskLogs map[string][]*CpTaskLog } // CptasksOrErr returns the Cptasks value or an error if the edge @@ -256,5 +258,53 @@ func (_m *CpUser) String() string { return builder.String() } +// NamedCptasks returns the Cptasks named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *CpUser) NamedCptasks(name string) ([]*CpTask, error) { + if _m.Edges.namedCptasks == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedCptasks[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *CpUser) appendNamedCptasks(name string, edges ...*CpTask) { + if _m.Edges.namedCptasks == nil { + _m.Edges.namedCptasks = make(map[string][]*CpTask) + } + if len(edges) == 0 { + _m.Edges.namedCptasks[name] = []*CpTask{} + } else { + _m.Edges.namedCptasks[name] = append(_m.Edges.namedCptasks[name], edges...) + } +} + +// NamedCpTaskLogs returns the CpTaskLogs named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *CpUser) NamedCpTaskLogs(name string) ([]*CpTaskLog, error) { + if _m.Edges.namedCpTaskLogs == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedCpTaskLogs[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *CpUser) appendNamedCpTaskLogs(name string, edges ...*CpTaskLog) { + if _m.Edges.namedCpTaskLogs == nil { + _m.Edges.namedCpTaskLogs = make(map[string][]*CpTaskLog) + } + if len(edges) == 0 { + _m.Edges.namedCpTaskLogs[name] = []*CpTaskLog{} + } else { + _m.Edges.namedCpTaskLogs[name] = append(_m.Edges.namedCpTaskLogs[name], edges...) + } +} + // CpUsers is a parsable slice of CpUser. type CpUsers []*CpUser diff --git a/internal/ent/cpuser/where.go b/internal/ent/cpuser/where.go index c5e798c..ea3761f 100644 --- a/internal/ent/cpuser/where.go +++ b/internal/ent/cpuser/where.go @@ -3,6 +3,7 @@ package cpuser import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -556,6 +557,9 @@ func HasCptasks() predicate.CpUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CptasksTable, CptasksColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTask sqlgraph.HasNeighbors(s, step) }) } @@ -564,6 +568,9 @@ func HasCptasks() predicate.CpUser { func HasCptasksWith(preds ...predicate.CpTask) predicate.CpUser { return predicate.CpUser(func(s *sql.Selector) { step := newCptasksStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTask sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -579,6 +586,9 @@ func HasSysuser() predicate.CpUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SysuserTable, SysuserColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpUser sqlgraph.HasNeighbors(s, step) }) } @@ -587,6 +597,9 @@ func HasSysuser() predicate.CpUser { func HasSysuserWith(preds ...predicate.SysUser) predicate.CpUser { return predicate.CpUser(func(s *sql.Selector) { step := newSysuserStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpUser sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -602,6 +615,9 @@ func HasCpTaskLogs() predicate.CpUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CpTaskLogsTable, CpTaskLogsColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighbors(s, step) }) } @@ -610,6 +626,9 @@ func HasCpTaskLogs() predicate.CpUser { func HasCpTaskLogsWith(preds ...predicate.CpTaskLog) predicate.CpUser { return predicate.CpUser(func(s *sql.Selector) { step := newCpTaskLogsStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -625,6 +644,9 @@ func HasSchool() predicate.CpUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SchoolTable, SchoolColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpSchool + step.Edge.Schema = schemaConfig.CpUser sqlgraph.HasNeighbors(s, step) }) } @@ -633,6 +655,9 @@ func HasSchool() predicate.CpUser { func HasSchoolWith(preds ...predicate.CpSchool) predicate.CpUser { return predicate.CpUser(func(s *sql.Selector) { step := newSchoolStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpSchool + step.Edge.Schema = schemaConfig.CpUser sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/cpuser_create.go b/internal/ent/cpuser_create.go index 003c16c..bccb5d6 100644 --- a/internal/ent/cpuser_create.go +++ b/internal/ent/cpuser_create.go @@ -244,6 +244,7 @@ func (_c *CpUserCreate) createSpec() (*CpUser, *sqlgraph.CreateSpec) { _node = &CpUser{config: _c.config} _spec = sqlgraph.NewCreateSpec(cpuser.Table, sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.CpUser _spec.OnConflict = _c.conflict if value, ok := _c.mutation.Username(); ok { _spec.SetField(cpuser.FieldUsername, field.TypeString, value) @@ -280,6 +281,7 @@ func (_c *CpUserCreate) createSpec() (*CpUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -296,6 +298,7 @@ func (_c *CpUserCreate) createSpec() (*CpUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -313,6 +316,7 @@ func (_c *CpUserCreate) createSpec() (*CpUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -329,6 +333,7 @@ func (_c *CpUserCreate) createSpec() (*CpUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cpschool.FieldID, field.TypeString), }, } + edge.Schema = _c.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/cpuser_delete.go b/internal/ent/cpuser_delete.go index de41d8e..144f933 100644 --- a/internal/ent/cpuser_delete.go +++ b/internal/ent/cpuser_delete.go @@ -5,6 +5,7 @@ package ent import ( "context" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "entgo.io/ent/dialect/sql" @@ -41,6 +42,8 @@ func (_d *CpUserDelete) ExecX(ctx context.Context) int { func (_d *CpUserDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(cpuser.Table, sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.CpUser + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/cpuser_query.go b/internal/ent/cpuser_query.go index 143206a..61ed726 100644 --- a/internal/ent/cpuser_query.go +++ b/internal/ent/cpuser_query.go @@ -10,11 +10,13 @@ import ( "likedream-goframe/internal/ent/cptask" "likedream-goframe/internal/ent/cptasklog" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuser" "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -23,14 +25,17 @@ import ( // CpUserQuery is the builder for querying CpUser entities. type CpUserQuery struct { config - ctx *QueryContext - order []cpuser.OrderOption - inters []Interceptor - predicates []predicate.CpUser - withCptasks *CpTaskQuery - withSysuser *SysUserQuery - withCpTaskLogs *CpTaskLogQuery - withSchool *CpSchoolQuery + ctx *QueryContext + order []cpuser.OrderOption + inters []Interceptor + predicates []predicate.CpUser + withCptasks *CpTaskQuery + withSysuser *SysUserQuery + withCpTaskLogs *CpTaskLogQuery + withSchool *CpSchoolQuery + modifiers []func(*sql.Selector) + withNamedCptasks map[string]*CpTaskQuery + withNamedCpTaskLogs map[string]*CpTaskLogQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -83,6 +88,9 @@ func (_q *CpUserQuery) QueryCptasks() *CpTaskQuery { sqlgraph.To(cptask.Table, cptask.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, cpuser.CptasksTable, cpuser.CptasksColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTask fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -105,6 +113,9 @@ func (_q *CpUserQuery) QuerySysuser() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cpuser.SysuserTable, cpuser.SysuserColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.CpUser fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -127,6 +138,9 @@ func (_q *CpUserQuery) QueryCpTaskLogs() *CpTaskLogQuery { sqlgraph.To(cptasklog.Table, cptasklog.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, cpuser.CpTaskLogsTable, cpuser.CpTaskLogsColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -149,6 +163,9 @@ func (_q *CpUserQuery) QuerySchool() *CpSchoolQuery { sqlgraph.To(cpschool.Table, cpschool.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, cpuser.SchoolTable, cpuser.SchoolColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpSchool + step.Edge.Schema = schemaConfig.CpUser fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -352,8 +369,9 @@ func (_q *CpUserQuery) Clone() *CpUserQuery { withCpTaskLogs: _q.withCpTaskLogs.Clone(), withSchool: _q.withSchool.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -495,6 +513,11 @@ func (_q *CpUserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*CpUse node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.CpUser + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -507,7 +530,12 @@ func (_q *CpUserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*CpUse if query := _q.withCptasks; query != nil { if err := _q.loadCptasks(ctx, query, nodes, func(n *CpUser) { n.Edges.Cptasks = []*CpTask{} }, - func(n *CpUser, e *CpTask) { n.Edges.Cptasks = append(n.Edges.Cptasks, e) }); err != nil { + func(n *CpUser, e *CpTask) { + n.Edges.Cptasks = append(n.Edges.Cptasks, e) + if !e.Edges.loadedTypes[0] { + e.Edges.CpUser = n + } + }); err != nil { return nil, err } } @@ -520,7 +548,12 @@ func (_q *CpUserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*CpUse if query := _q.withCpTaskLogs; query != nil { if err := _q.loadCpTaskLogs(ctx, query, nodes, func(n *CpUser) { n.Edges.CpTaskLogs = []*CpTaskLog{} }, - func(n *CpUser, e *CpTaskLog) { n.Edges.CpTaskLogs = append(n.Edges.CpTaskLogs, e) }); err != nil { + func(n *CpUser, e *CpTaskLog) { + n.Edges.CpTaskLogs = append(n.Edges.CpTaskLogs, e) + if !e.Edges.loadedTypes[2] { + e.Edges.CpUser = n + } + }); err != nil { return nil, err } } @@ -530,6 +563,30 @@ func (_q *CpUserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*CpUse return nil, err } } + for name, query := range _q.withNamedCptasks { + if err := _q.loadCptasks(ctx, query, nodes, + func(n *CpUser) { n.appendNamedCptasks(name) }, + func(n *CpUser, e *CpTask) { + n.appendNamedCptasks(name, e) + if !e.Edges.loadedTypes[0] { + e.Edges.CpUser = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedCpTaskLogs { + if err := _q.loadCpTaskLogs(ctx, query, nodes, + func(n *CpUser) { n.appendNamedCpTaskLogs(name) }, + func(n *CpUser, e *CpTaskLog) { + n.appendNamedCpTaskLogs(name, e) + if !e.Edges.loadedTypes[2] { + e.Edges.CpUser = n + } + }); err != nil { + return nil, err + } + } return nodes, nil } @@ -654,6 +711,11 @@ func (_q *CpUserQuery) loadSchool(ctx context.Context, query *CpSchoolQuery, nod func (_q *CpUserQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.CpUser + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -722,6 +784,12 @@ func (_q *CpUserQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.CpUser) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -739,6 +807,66 @@ func (_q *CpUserQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *CpUserQuery) ForUpdate(opts ...sql.LockOption) *CpUserQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *CpUserQuery) ForShare(opts ...sql.LockOption) *CpUserQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *CpUserQuery) Modify(modifiers ...func(s *sql.Selector)) *CpUserSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + +// WithNamedCptasks tells the query-builder to eager-load the nodes that are connected to the "cptasks" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *CpUserQuery) WithNamedCptasks(name string, opts ...func(*CpTaskQuery)) *CpUserQuery { + query := (&CpTaskClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedCptasks == nil { + _q.withNamedCptasks = make(map[string]*CpTaskQuery) + } + _q.withNamedCptasks[name] = query + return _q +} + +// WithNamedCpTaskLogs tells the query-builder to eager-load the nodes that are connected to the "cp_task_logs" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *CpUserQuery) WithNamedCpTaskLogs(name string, opts ...func(*CpTaskLogQuery)) *CpUserQuery { + query := (&CpTaskLogClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedCpTaskLogs == nil { + _q.withNamedCpTaskLogs = make(map[string]*CpTaskLogQuery) + } + _q.withNamedCpTaskLogs[name] = query + return _q +} + // CpUserGroupBy is the group-by builder for CpUser entities. type CpUserGroupBy struct { selector @@ -828,3 +956,9 @@ func (_s *CpUserSelect) sqlScan(ctx context.Context, root *CpUserQuery, v any) e defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *CpUserSelect) Modify(modifiers ...func(s *sql.Selector)) *CpUserSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/cpuser_update.go b/internal/ent/cpuser_update.go index f27499b..5eedd50 100644 --- a/internal/ent/cpuser_update.go +++ b/internal/ent/cpuser_update.go @@ -10,6 +10,7 @@ import ( "likedream-goframe/internal/ent/cptask" "likedream-goframe/internal/ent/cptasklog" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuser" @@ -21,8 +22,9 @@ import ( // CpUserUpdate is the builder for updating CpUser entities. type CpUserUpdate struct { config - hooks []Hook - mutation *CpUserMutation + hooks []Hook + mutation *CpUserMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the CpUserUpdate builder. @@ -324,6 +326,12 @@ func (_u *CpUserUpdate) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpUserUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpUserUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err @@ -374,6 +382,7 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCptasksIDs(); len(nodes) > 0 && !_u.mutation.CptasksCleared() { @@ -387,6 +396,7 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -403,6 +413,7 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -419,6 +430,7 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SysuserIDs(); len(nodes) > 0 { @@ -432,6 +444,7 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -448,6 +461,7 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpTaskLogsIDs(); len(nodes) > 0 && !_u.mutation.CpTaskLogsCleared() { @@ -461,6 +475,7 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -477,6 +492,7 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -493,6 +509,7 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpschool.FieldID, field.TypeString), }, } + edge.Schema = _u.schemaConfig.CpUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SchoolIDs(); len(nodes) > 0 { @@ -506,11 +523,15 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpschool.FieldID, field.TypeString), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpUser + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{cpuser.Label} @@ -526,9 +547,10 @@ func (_u *CpUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { // CpUserUpdateOne is the builder for updating a single CpUser entity. type CpUserUpdateOne struct { config - fields []string - hooks []Hook - mutation *CpUserMutation + fields []string + hooks []Hook + mutation *CpUserMutation + modifiers []func(*sql.UpdateBuilder) } // SetUserID sets the "user_id" field. @@ -837,6 +859,12 @@ func (_u *CpUserUpdateOne) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *CpUserUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CpUserUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err error) { if err := _u.check(); err != nil { return _node, err @@ -904,6 +932,7 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCptasksIDs(); len(nodes) > 0 && !_u.mutation.CptasksCleared() { @@ -917,6 +946,7 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -933,6 +963,7 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -949,6 +980,7 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SysuserIDs(); len(nodes) > 0 { @@ -962,6 +994,7 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -978,6 +1011,7 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpTaskLogsIDs(); len(nodes) > 0 && !_u.mutation.CpTaskLogsCleared() { @@ -991,6 +1025,7 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1007,6 +1042,7 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1023,6 +1059,7 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(cpschool.FieldID, field.TypeString), }, } + edge.Schema = _u.schemaConfig.CpUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SchoolIDs(); len(nodes) > 0 { @@ -1036,11 +1073,15 @@ func (_u *CpUserUpdateOne) sqlSave(ctx context.Context) (_node *CpUser, err erro IDSpec: sqlgraph.NewFieldSpec(cpschool.FieldID, field.TypeString), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.CpUser + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &CpUser{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/entql.go b/internal/ent/entql.go new file mode 100644 index 0000000..b64286c --- /dev/null +++ b/internal/ent/entql.go @@ -0,0 +1,1917 @@ +// ENT数据库文件,请勿编辑。 + +package ent + +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/predicate" + "likedream-goframe/internal/ent/sysagent" + "likedream-goframe/internal/ent/syscard" + "likedream-goframe/internal/ent/sysmenu" + "likedream-goframe/internal/ent/sysrole" + "likedream-goframe/internal/ent/sysuser" + "likedream-goframe/internal/ent/sysuserlog" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/entql" + "entgo.io/ent/schema/field" +) + +// schemaGraph holds a representation of ent/schema at runtime. +var schemaGraph = func() *sqlgraph.Schema { + graph := &sqlgraph.Schema{Nodes: make([]*sqlgraph.Node, 11)} + graph.Nodes[0] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: cpimage.Table, + Columns: cpimage.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: cpimage.FieldID, + }, + }, + Type: "CpImage", + Fields: map[string]*sqlgraph.FieldSpec{ + cpimage.FieldCreateTime: {Type: field.TypeString, Column: cpimage.FieldCreateTime}, + cpimage.FieldUpdateTime: {Type: field.TypeString, Column: cpimage.FieldUpdateTime}, + cpimage.FieldImageID: {Type: field.TypeUUID, Column: cpimage.FieldImageID}, + cpimage.FieldKey: {Type: field.TypeString, Column: cpimage.FieldKey}, + cpimage.FieldUserID: {Type: field.TypeInt64, Column: cpimage.FieldUserID}, + cpimage.FieldContentType: {Type: field.TypeString, Column: cpimage.FieldContentType}, + cpimage.FieldContentLength: {Type: field.TypeInt64, Column: cpimage.FieldContentLength}, + }, + } + graph.Nodes[1] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: cpschool.Table, + Columns: cpschool.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeString, + Column: cpschool.FieldID, + }, + }, + Type: "CpSchool", + Fields: map[string]*sqlgraph.FieldSpec{ + cpschool.FieldName: {Type: field.TypeString, Column: cpschool.FieldName}, + cpschool.FieldNamePinyin: {Type: field.TypeString, Column: cpschool.FieldNamePinyin}, + cpschool.FieldIconImg: {Type: field.TypeString, Column: cpschool.FieldIconImg}, + }, + } + graph.Nodes[2] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: cptask.Table, + Columns: cptask.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: cptask.FieldID, + }, + }, + Type: "CpTask", + Fields: map[string]*sqlgraph.FieldSpec{ + cptask.FieldCpUserID: {Type: field.TypeInt64, Column: cptask.FieldCpUserID}, + cptask.FieldUserID: {Type: field.TypeInt64, Column: cptask.FieldUserID}, + cptask.FieldTaskType: {Type: field.TypeEnum, Column: cptask.FieldTaskType}, + cptask.FieldTitle: {Type: field.TypeString, Column: cptask.FieldTitle}, + cptask.FieldFrequency: {Type: field.TypeInt, Column: cptask.FieldFrequency}, + cptask.FieldTaskStatus: {Type: field.TypeEnum, Column: cptask.FieldTaskStatus}, + cptask.FieldSuccessCount: {Type: field.TypeInt, Column: cptask.FieldSuccessCount}, + cptask.FieldFormData: {Type: field.TypeString, Column: cptask.FieldFormData}, + cptask.FieldStep: {Type: field.TypeEnum, Column: cptask.FieldStep}, + cptask.FieldNotificationType: {Type: field.TypeEnum, Column: cptask.FieldNotificationType}, + cptask.FieldExecuteHour: {Type: field.TypeInt, Column: cptask.FieldExecuteHour}, + cptask.FieldExecuteMinute: {Type: field.TypeInt, Column: cptask.FieldExecuteMinute}, + cptask.FieldNextExecuteTime: {Type: field.TypeInt64, Column: cptask.FieldNextExecuteTime}, + }, + } + graph.Nodes[3] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: cptasklog.Table, + Columns: cptasklog.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: cptasklog.FieldID, + }, + }, + Type: "CpTaskLog", + Fields: map[string]*sqlgraph.FieldSpec{ + cptasklog.FieldCpTaskID: {Type: field.TypeInt64, Column: cptasklog.FieldCpTaskID}, + cptasklog.FieldSystemUserID: {Type: field.TypeInt64, Column: cptasklog.FieldSystemUserID}, + cptasklog.FieldCpUserID: {Type: field.TypeInt64, Column: cptasklog.FieldCpUserID}, + cptasklog.FieldIsSuccess: {Type: field.TypeBool, Column: cptasklog.FieldIsSuccess}, + cptasklog.FieldErrorMessage: {Type: field.TypeString, Column: cptasklog.FieldErrorMessage}, + cptasklog.FieldRealName: {Type: field.TypeString, Column: cptasklog.FieldRealName}, + }, + } + graph.Nodes[4] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: cpuser.Table, + Columns: cpuser.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: cpuser.FieldID, + }, + }, + Type: "CpUser", + Fields: map[string]*sqlgraph.FieldSpec{ + cpuser.FieldUserID: {Type: field.TypeInt64, Column: cpuser.FieldUserID}, + cpuser.FieldUsername: {Type: field.TypeString, Column: cpuser.FieldUsername}, + cpuser.FieldPassword: {Type: field.TypeString, Column: cpuser.FieldPassword}, + cpuser.FieldSchoolID: {Type: field.TypeString, Column: cpuser.FieldSchoolID}, + cpuser.FieldEmail: {Type: field.TypeString, Column: cpuser.FieldEmail}, + cpuser.FieldMobileCode: {Type: field.TypeString, Column: cpuser.FieldMobileCode}, + cpuser.FieldCookie: {Type: field.TypeString, Column: cpuser.FieldCookie}, + cpuser.FieldMobileType: {Type: field.TypeEnum, Column: cpuser.FieldMobileType}, + }, + } + graph.Nodes[5] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: sysagent.Table, + Columns: sysagent.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: sysagent.FieldID, + }, + }, + Type: "SysAgent", + Fields: map[string]*sqlgraph.FieldSpec{ + sysagent.FieldCreateTime: {Type: field.TypeString, Column: sysagent.FieldCreateTime}, + sysagent.FieldUpdateTime: {Type: field.TypeString, Column: sysagent.FieldUpdateTime}, + sysagent.FieldLevel: {Type: field.TypeInt, Column: sysagent.FieldLevel}, + sysagent.FieldRate: {Type: field.TypeString, Column: sysagent.FieldRate}, + }, + } + graph.Nodes[6] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: syscard.Table, + Columns: syscard.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: syscard.FieldID, + }, + }, + Type: "SysCard", + Fields: map[string]*sqlgraph.FieldSpec{ + syscard.FieldCreateTime: {Type: field.TypeString, Column: syscard.FieldCreateTime}, + syscard.FieldUpdateTime: {Type: field.TypeString, Column: syscard.FieldUpdateTime}, + syscard.FieldContent: {Type: field.TypeString, Column: syscard.FieldContent}, + syscard.FieldStatus: {Type: field.TypeInt, Column: syscard.FieldStatus}, + syscard.FieldValue: {Type: field.TypeUint64, Column: syscard.FieldValue}, + syscard.FieldCreatorID: {Type: field.TypeInt64, Column: syscard.FieldCreatorID}, + syscard.FieldUsedID: {Type: field.TypeInt64, Column: syscard.FieldUsedID}, + syscard.FieldCashUserID: {Type: field.TypeInt64, Column: syscard.FieldCashUserID}, + syscard.FieldCashValue: {Type: field.TypeString, Column: syscard.FieldCashValue}, + }, + } + graph.Nodes[7] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: sysmenu.Table, + Columns: sysmenu.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: sysmenu.FieldID, + }, + }, + Type: "SysMenu", + Fields: map[string]*sqlgraph.FieldSpec{ + sysmenu.FieldCreateTime: {Type: field.TypeString, Column: sysmenu.FieldCreateTime}, + sysmenu.FieldUpdateTime: {Type: field.TypeString, Column: sysmenu.FieldUpdateTime}, + sysmenu.FieldName: {Type: field.TypeString, Column: sysmenu.FieldName}, + sysmenu.FieldLabel: {Type: field.TypeString, Column: sysmenu.FieldLabel}, + sysmenu.FieldType: {Type: field.TypeEnum, Column: sysmenu.FieldType}, + sysmenu.FieldLink: {Type: field.TypeString, Column: sysmenu.FieldLink}, + 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.FieldHidden: {Type: field.TypeBool, Column: sysmenu.FieldHidden}, + sysmenu.FieldIcon: {Type: field.TypeString, Column: sysmenu.FieldIcon}, + sysmenu.FieldOrder: {Type: field.TypeUint, Column: sysmenu.FieldOrder}, + }, + } + graph.Nodes[8] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: sysrole.Table, + Columns: sysrole.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: sysrole.FieldID, + }, + }, + Type: "SysRole", + Fields: map[string]*sqlgraph.FieldSpec{ + sysrole.FieldCreateTime: {Type: field.TypeString, Column: sysrole.FieldCreateTime}, + sysrole.FieldUpdateTime: {Type: field.TypeString, Column: sysrole.FieldUpdateTime}, + sysrole.FieldLabel: {Type: field.TypeString, Column: sysrole.FieldLabel}, + sysrole.FieldName: {Type: field.TypeString, Column: sysrole.FieldName}, + sysrole.FieldDescription: {Type: field.TypeString, Column: sysrole.FieldDescription}, + sysrole.FieldOrder: {Type: field.TypeUint, Column: sysrole.FieldOrder}, + }, + } + graph.Nodes[9] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: sysuser.Table, + Columns: sysuser.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: sysuser.FieldID, + }, + }, + Type: "SysUser", + Fields: map[string]*sqlgraph.FieldSpec{ + sysuser.FieldCreateTime: {Type: field.TypeString, Column: sysuser.FieldCreateTime}, + sysuser.FieldUpdateTime: {Type: field.TypeString, Column: sysuser.FieldUpdateTime}, + sysuser.FieldUsername: {Type: field.TypeString, Column: sysuser.FieldUsername}, + sysuser.FieldPassword: {Type: field.TypeString, Column: sysuser.FieldPassword}, + sysuser.FieldEmail: {Type: field.TypeString, Column: sysuser.FieldEmail}, + sysuser.FieldInviteCode: {Type: field.TypeString, Column: sysuser.FieldInviteCode}, + sysuser.FieldBalance: {Type: field.TypeString, Column: sysuser.FieldBalance}, + sysuser.FieldBlock: {Type: field.TypeBool, Column: sysuser.FieldBlock}, + sysuser.FieldVerify: {Type: field.TypeBool, Column: sysuser.FieldVerify}, + sysuser.FieldInviteCashback: {Type: field.TypeString, Column: sysuser.FieldInviteCashback}, + }, + } + graph.Nodes[10] = &sqlgraph.Node{ + NodeSpec: sqlgraph.NodeSpec{ + Table: sysuserlog.Table, + Columns: sysuserlog.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt64, + Column: sysuserlog.FieldID, + }, + }, + Type: "SysUserLog", + Fields: map[string]*sqlgraph.FieldSpec{}, + } + graph.MustAddE( + "user", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: cpimage.UserTable, + Columns: []string{cpimage.UserColumn}, + Bidi: false, + }, + "CpImage", + "SysUser", + ) + graph.MustAddE( + "cpusers", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: cpschool.CpusersTable, + Columns: []string{cpschool.CpusersColumn}, + Bidi: false, + }, + "CpSchool", + "CpUser", + ) + graph.MustAddE( + "cp_user", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: cptask.CpUserTable, + Columns: []string{cptask.CpUserColumn}, + Bidi: false, + }, + "CpTask", + "CpUser", + ) + graph.MustAddE( + "sys_user", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: cptask.SysUserTable, + Columns: []string{cptask.SysUserColumn}, + Bidi: false, + }, + "CpTask", + "SysUser", + ) + graph.MustAddE( + "cp_task_logs", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: cptask.CpTaskLogsTable, + Columns: []string{cptask.CpTaskLogsColumn}, + Bidi: false, + }, + "CpTask", + "CpTaskLog", + ) + graph.MustAddE( + "cp_task", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: cptasklog.CpTaskTable, + Columns: []string{cptasklog.CpTaskColumn}, + Bidi: false, + }, + "CpTaskLog", + "CpTask", + ) + graph.MustAddE( + "system_user", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: cptasklog.SystemUserTable, + Columns: []string{cptasklog.SystemUserColumn}, + Bidi: false, + }, + "CpTaskLog", + "SysUser", + ) + graph.MustAddE( + "cp_user", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: cptasklog.CpUserTable, + Columns: []string{cptasklog.CpUserColumn}, + Bidi: false, + }, + "CpTaskLog", + "CpUser", + ) + graph.MustAddE( + "cptasks", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: cpuser.CptasksTable, + Columns: []string{cpuser.CptasksColumn}, + Bidi: false, + }, + "CpUser", + "CpTask", + ) + graph.MustAddE( + "sysuser", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: cpuser.SysuserTable, + Columns: []string{cpuser.SysuserColumn}, + Bidi: false, + }, + "CpUser", + "SysUser", + ) + graph.MustAddE( + "cp_task_logs", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: cpuser.CpTaskLogsTable, + Columns: []string{cpuser.CpTaskLogsColumn}, + Bidi: false, + }, + "CpUser", + "CpTaskLog", + ) + graph.MustAddE( + "school", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: cpuser.SchoolTable, + Columns: []string{cpuser.SchoolColumn}, + Bidi: false, + }, + "CpUser", + "CpSchool", + ) + graph.MustAddE( + "users", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: true, + Table: sysagent.UsersTable, + Columns: []string{sysagent.UsersColumn}, + Bidi: false, + }, + "SysAgent", + "SysUser", + ) + graph.MustAddE( + "creator", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: syscard.CreatorTable, + Columns: []string{syscard.CreatorColumn}, + Bidi: false, + }, + "SysCard", + "SysUser", + ) + graph.MustAddE( + "user", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: syscard.UserTable, + Columns: []string{syscard.UserColumn}, + Bidi: false, + }, + "SysCard", + "SysUser", + ) + graph.MustAddE( + "cash_user", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: syscard.CashUserTable, + Columns: []string{syscard.CashUserColumn}, + Bidi: false, + }, + "SysCard", + "SysUser", + ) + graph.MustAddE( + "roles", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2M, + Inverse: true, + Table: sysmenu.RolesTable, + Columns: sysmenu.RolesPrimaryKey, + Bidi: false, + }, + "SysMenu", + "SysRole", + ) + graph.MustAddE( + "parent", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: sysmenu.ParentTable, + Columns: []string{sysmenu.ParentColumn}, + Bidi: false, + }, + "SysMenu", + "SysMenu", + ) + graph.MustAddE( + "children", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: sysmenu.ChildrenTable, + Columns: []string{sysmenu.ChildrenColumn}, + Bidi: false, + }, + "SysMenu", + "SysMenu", + ) + graph.MustAddE( + "menus", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2M, + Inverse: false, + Table: sysrole.MenusTable, + Columns: sysrole.MenusPrimaryKey, + Bidi: false, + }, + "SysRole", + "SysMenu", + ) + graph.MustAddE( + "users", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2M, + Inverse: true, + Table: sysrole.UsersTable, + Columns: sysrole.UsersPrimaryKey, + Bidi: false, + }, + "SysRole", + "SysUser", + ) + graph.MustAddE( + "parent", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: sysuser.ParentTable, + Columns: []string{sysuser.ParentColumn}, + Bidi: false, + }, + "SysUser", + "SysUser", + ) + graph.MustAddE( + "children", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: sysuser.ChildrenTable, + Columns: []string{sysuser.ChildrenColumn}, + Bidi: false, + }, + "SysUser", + "SysUser", + ) + graph.MustAddE( + "roles", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2M, + Inverse: false, + Table: sysuser.RolesTable, + Columns: sysuser.RolesPrimaryKey, + Bidi: false, + }, + "SysUser", + "SysRole", + ) + graph.MustAddE( + "agent", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: sysuser.AgentTable, + Columns: []string{sysuser.AgentColumn}, + Bidi: false, + }, + "SysUser", + "SysAgent", + ) + graph.MustAddE( + "images", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: sysuser.ImagesTable, + Columns: []string{sysuser.ImagesColumn}, + Bidi: false, + }, + "SysUser", + "CpImage", + ) + graph.MustAddE( + "cpuser", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: sysuser.CpuserTable, + Columns: []string{sysuser.CpuserColumn}, + Bidi: false, + }, + "SysUser", + "CpUser", + ) + graph.MustAddE( + "cp_task", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: sysuser.CpTaskTable, + Columns: []string{sysuser.CpTaskColumn}, + Bidi: false, + }, + "SysUser", + "CpTask", + ) + graph.MustAddE( + "cp_task_logs", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: sysuser.CpTaskLogsTable, + Columns: []string{sysuser.CpTaskLogsColumn}, + Bidi: false, + }, + "SysUser", + "CpTaskLog", + ) + graph.MustAddE( + "created_cards", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: sysuser.CreatedCardsTable, + Columns: []string{sysuser.CreatedCardsColumn}, + Bidi: false, + }, + "SysUser", + "SysCard", + ) + graph.MustAddE( + "used_cards", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: sysuser.UsedCardsTable, + Columns: []string{sysuser.UsedCardsColumn}, + Bidi: false, + }, + "SysUser", + "SysCard", + ) + graph.MustAddE( + "cashback_cards", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: sysuser.CashbackCardsTable, + Columns: []string{sysuser.CashbackCardsColumn}, + Bidi: false, + }, + "SysUser", + "SysCard", + ) + return graph +}() + +// predicateAdder wraps the addPredicate method. +// All update, update-one and query builders implement this interface. +type predicateAdder interface { + addPredicate(func(s *sql.Selector)) +} + +// addPredicate implements the predicateAdder interface. +func (_q *CpImageQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the CpImageQuery builder. +func (_q *CpImageQuery) Filter() *CpImageFilter { + return &CpImageFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *CpImageMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the CpImageMutation builder. +func (m *CpImageMutation) Filter() *CpImageFilter { + return &CpImageFilter{config: m.config, predicateAdder: m} +} + +// CpImageFilter provides a generic filtering capability at runtime for CpImageQuery. +type CpImageFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *CpImageFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[0].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *CpImageFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(cpimage.FieldID)) +} + +// WhereCreateTime applies the entql string predicate on the create_time field. +func (f *CpImageFilter) WhereCreateTime(p entql.StringP) { + f.Where(p.Field(cpimage.FieldCreateTime)) +} + +// WhereUpdateTime applies the entql string predicate on the update_time field. +func (f *CpImageFilter) WhereUpdateTime(p entql.StringP) { + f.Where(p.Field(cpimage.FieldUpdateTime)) +} + +// WhereImageID applies the entql [16]byte predicate on the image_id field. +func (f *CpImageFilter) WhereImageID(p entql.ValueP) { + f.Where(p.Field(cpimage.FieldImageID)) +} + +// WhereKey applies the entql string predicate on the key field. +func (f *CpImageFilter) WhereKey(p entql.StringP) { + f.Where(p.Field(cpimage.FieldKey)) +} + +// WhereUserID applies the entql int64 predicate on the user_id field. +func (f *CpImageFilter) WhereUserID(p entql.Int64P) { + f.Where(p.Field(cpimage.FieldUserID)) +} + +// WhereContentType applies the entql string predicate on the content_type field. +func (f *CpImageFilter) WhereContentType(p entql.StringP) { + f.Where(p.Field(cpimage.FieldContentType)) +} + +// WhereContentLength applies the entql int64 predicate on the content_length field. +func (f *CpImageFilter) WhereContentLength(p entql.Int64P) { + f.Where(p.Field(cpimage.FieldContentLength)) +} + +// WhereHasUser applies a predicate to check if query has an edge user. +func (f *CpImageFilter) WhereHasUser() { + f.Where(entql.HasEdge("user")) +} + +// WhereHasUserWith applies a predicate to check if query has an edge user with a given conditions (other predicates). +func (f *CpImageFilter) WhereHasUserWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("user", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *CpSchoolQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the CpSchoolQuery builder. +func (_q *CpSchoolQuery) Filter() *CpSchoolFilter { + return &CpSchoolFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *CpSchoolMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the CpSchoolMutation builder. +func (m *CpSchoolMutation) Filter() *CpSchoolFilter { + return &CpSchoolFilter{config: m.config, predicateAdder: m} +} + +// CpSchoolFilter provides a generic filtering capability at runtime for CpSchoolQuery. +type CpSchoolFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *CpSchoolFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[1].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql string predicate on the id field. +func (f *CpSchoolFilter) WhereID(p entql.StringP) { + f.Where(p.Field(cpschool.FieldID)) +} + +// WhereName applies the entql string predicate on the name field. +func (f *CpSchoolFilter) WhereName(p entql.StringP) { + f.Where(p.Field(cpschool.FieldName)) +} + +// WhereNamePinyin applies the entql string predicate on the name_pinyin field. +func (f *CpSchoolFilter) WhereNamePinyin(p entql.StringP) { + f.Where(p.Field(cpschool.FieldNamePinyin)) +} + +// WhereIconImg applies the entql string predicate on the icon_img field. +func (f *CpSchoolFilter) WhereIconImg(p entql.StringP) { + f.Where(p.Field(cpschool.FieldIconImg)) +} + +// WhereHasCpusers applies a predicate to check if query has an edge cpusers. +func (f *CpSchoolFilter) WhereHasCpusers() { + f.Where(entql.HasEdge("cpusers")) +} + +// WhereHasCpusersWith applies a predicate to check if query has an edge cpusers with a given conditions (other predicates). +func (f *CpSchoolFilter) WhereHasCpusersWith(preds ...predicate.CpUser) { + f.Where(entql.HasEdgeWith("cpusers", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *CpTaskQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the CpTaskQuery builder. +func (_q *CpTaskQuery) Filter() *CpTaskFilter { + return &CpTaskFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *CpTaskMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the CpTaskMutation builder. +func (m *CpTaskMutation) Filter() *CpTaskFilter { + return &CpTaskFilter{config: m.config, predicateAdder: m} +} + +// CpTaskFilter provides a generic filtering capability at runtime for CpTaskQuery. +type CpTaskFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *CpTaskFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[2].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *CpTaskFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(cptask.FieldID)) +} + +// 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)) +} + +// WhereUserID applies the entql int64 predicate on the user_id field. +func (f *CpTaskFilter) WhereUserID(p entql.Int64P) { + f.Where(p.Field(cptask.FieldUserID)) +} + +// WhereTaskType applies the entql string predicate on the task_type field. +func (f *CpTaskFilter) WhereTaskType(p entql.StringP) { + f.Where(p.Field(cptask.FieldTaskType)) +} + +// WhereTitle applies the entql string predicate on the title field. +func (f *CpTaskFilter) WhereTitle(p entql.StringP) { + f.Where(p.Field(cptask.FieldTitle)) +} + +// WhereFrequency applies the entql int predicate on the frequency field. +func (f *CpTaskFilter) WhereFrequency(p entql.IntP) { + f.Where(p.Field(cptask.FieldFrequency)) +} + +// WhereTaskStatus applies the entql string predicate on the task_status field. +func (f *CpTaskFilter) WhereTaskStatus(p entql.StringP) { + f.Where(p.Field(cptask.FieldTaskStatus)) +} + +// WhereSuccessCount applies the entql int predicate on the success_count field. +func (f *CpTaskFilter) WhereSuccessCount(p entql.IntP) { + f.Where(p.Field(cptask.FieldSuccessCount)) +} + +// WhereFormData applies the entql string predicate on the form_data field. +func (f *CpTaskFilter) WhereFormData(p entql.StringP) { + f.Where(p.Field(cptask.FieldFormData)) +} + +// WhereStep applies the entql string predicate on the step field. +func (f *CpTaskFilter) WhereStep(p entql.StringP) { + f.Where(p.Field(cptask.FieldStep)) +} + +// WhereNotificationType applies the entql string predicate on the notification_type field. +func (f *CpTaskFilter) WhereNotificationType(p entql.StringP) { + f.Where(p.Field(cptask.FieldNotificationType)) +} + +// WhereExecuteHour applies the entql int predicate on the execute_hour field. +func (f *CpTaskFilter) WhereExecuteHour(p entql.IntP) { + f.Where(p.Field(cptask.FieldExecuteHour)) +} + +// WhereExecuteMinute applies the entql int predicate on the execute_minute field. +func (f *CpTaskFilter) WhereExecuteMinute(p entql.IntP) { + f.Where(p.Field(cptask.FieldExecuteMinute)) +} + +// WhereNextExecuteTime applies the entql int64 predicate on the next_execute_time field. +func (f *CpTaskFilter) WhereNextExecuteTime(p entql.Int64P) { + f.Where(p.Field(cptask.FieldNextExecuteTime)) +} + +// WhereHasCpUser applies a predicate to check if query has an edge cp_user. +func (f *CpTaskFilter) WhereHasCpUser() { + f.Where(entql.HasEdge("cp_user")) +} + +// WhereHasCpUserWith applies a predicate to check if query has an edge cp_user with a given conditions (other predicates). +func (f *CpTaskFilter) WhereHasCpUserWith(preds ...predicate.CpUser) { + f.Where(entql.HasEdgeWith("cp_user", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasSysUser applies a predicate to check if query has an edge sys_user. +func (f *CpTaskFilter) WhereHasSysUser() { + f.Where(entql.HasEdge("sys_user")) +} + +// WhereHasSysUserWith applies a predicate to check if query has an edge sys_user with a given conditions (other predicates). +func (f *CpTaskFilter) WhereHasSysUserWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("sys_user", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasCpTaskLogs applies a predicate to check if query has an edge cp_task_logs. +func (f *CpTaskFilter) WhereHasCpTaskLogs() { + f.Where(entql.HasEdge("cp_task_logs")) +} + +// WhereHasCpTaskLogsWith applies a predicate to check if query has an edge cp_task_logs with a given conditions (other predicates). +func (f *CpTaskFilter) WhereHasCpTaskLogsWith(preds ...predicate.CpTaskLog) { + f.Where(entql.HasEdgeWith("cp_task_logs", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *CpTaskLogQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the CpTaskLogQuery builder. +func (_q *CpTaskLogQuery) Filter() *CpTaskLogFilter { + return &CpTaskLogFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *CpTaskLogMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the CpTaskLogMutation builder. +func (m *CpTaskLogMutation) Filter() *CpTaskLogFilter { + return &CpTaskLogFilter{config: m.config, predicateAdder: m} +} + +// CpTaskLogFilter provides a generic filtering capability at runtime for CpTaskLogQuery. +type CpTaskLogFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *CpTaskLogFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[3].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *CpTaskLogFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(cptasklog.FieldID)) +} + +// 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)) +} + +// WhereSystemUserID applies the entql int64 predicate on the system_user_id field. +func (f *CpTaskLogFilter) WhereSystemUserID(p entql.Int64P) { + f.Where(p.Field(cptasklog.FieldSystemUserID)) +} + +// WhereCpUserID applies the entql int64 predicate on the cp_user_id field. +func (f *CpTaskLogFilter) WhereCpUserID(p entql.Int64P) { + f.Where(p.Field(cptasklog.FieldCpUserID)) +} + +// WhereIsSuccess applies the entql bool predicate on the is_success field. +func (f *CpTaskLogFilter) WhereIsSuccess(p entql.BoolP) { + f.Where(p.Field(cptasklog.FieldIsSuccess)) +} + +// WhereErrorMessage applies the entql string predicate on the error_message field. +func (f *CpTaskLogFilter) WhereErrorMessage(p entql.StringP) { + f.Where(p.Field(cptasklog.FieldErrorMessage)) +} + +// WhereRealName applies the entql string predicate on the real_name field. +func (f *CpTaskLogFilter) WhereRealName(p entql.StringP) { + f.Where(p.Field(cptasklog.FieldRealName)) +} + +// WhereHasCpTask applies a predicate to check if query has an edge cp_task. +func (f *CpTaskLogFilter) WhereHasCpTask() { + f.Where(entql.HasEdge("cp_task")) +} + +// WhereHasCpTaskWith applies a predicate to check if query has an edge cp_task with a given conditions (other predicates). +func (f *CpTaskLogFilter) WhereHasCpTaskWith(preds ...predicate.CpTask) { + f.Where(entql.HasEdgeWith("cp_task", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasSystemUser applies a predicate to check if query has an edge system_user. +func (f *CpTaskLogFilter) WhereHasSystemUser() { + f.Where(entql.HasEdge("system_user")) +} + +// WhereHasSystemUserWith applies a predicate to check if query has an edge system_user with a given conditions (other predicates). +func (f *CpTaskLogFilter) WhereHasSystemUserWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("system_user", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasCpUser applies a predicate to check if query has an edge cp_user. +func (f *CpTaskLogFilter) WhereHasCpUser() { + f.Where(entql.HasEdge("cp_user")) +} + +// WhereHasCpUserWith applies a predicate to check if query has an edge cp_user with a given conditions (other predicates). +func (f *CpTaskLogFilter) WhereHasCpUserWith(preds ...predicate.CpUser) { + f.Where(entql.HasEdgeWith("cp_user", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *CpUserQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the CpUserQuery builder. +func (_q *CpUserQuery) Filter() *CpUserFilter { + return &CpUserFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *CpUserMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the CpUserMutation builder. +func (m *CpUserMutation) Filter() *CpUserFilter { + return &CpUserFilter{config: m.config, predicateAdder: m} +} + +// CpUserFilter provides a generic filtering capability at runtime for CpUserQuery. +type CpUserFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *CpUserFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[4].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *CpUserFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(cpuser.FieldID)) +} + +// WhereUserID applies the entql int64 predicate on the user_id field. +func (f *CpUserFilter) WhereUserID(p entql.Int64P) { + f.Where(p.Field(cpuser.FieldUserID)) +} + +// WhereUsername applies the entql string predicate on the username field. +func (f *CpUserFilter) WhereUsername(p entql.StringP) { + f.Where(p.Field(cpuser.FieldUsername)) +} + +// WherePassword applies the entql string predicate on the password field. +func (f *CpUserFilter) WherePassword(p entql.StringP) { + f.Where(p.Field(cpuser.FieldPassword)) +} + +// WhereSchoolID applies the entql string predicate on the school_id field. +func (f *CpUserFilter) WhereSchoolID(p entql.StringP) { + f.Where(p.Field(cpuser.FieldSchoolID)) +} + +// WhereEmail applies the entql string predicate on the email field. +func (f *CpUserFilter) WhereEmail(p entql.StringP) { + f.Where(p.Field(cpuser.FieldEmail)) +} + +// WhereMobileCode applies the entql string predicate on the mobile_code field. +func (f *CpUserFilter) WhereMobileCode(p entql.StringP) { + f.Where(p.Field(cpuser.FieldMobileCode)) +} + +// WhereCookie applies the entql string predicate on the cookie field. +func (f *CpUserFilter) WhereCookie(p entql.StringP) { + f.Where(p.Field(cpuser.FieldCookie)) +} + +// WhereMobileType applies the entql string predicate on the mobile_type field. +func (f *CpUserFilter) WhereMobileType(p entql.StringP) { + f.Where(p.Field(cpuser.FieldMobileType)) +} + +// WhereHasCptasks applies a predicate to check if query has an edge cptasks. +func (f *CpUserFilter) WhereHasCptasks() { + f.Where(entql.HasEdge("cptasks")) +} + +// WhereHasCptasksWith applies a predicate to check if query has an edge cptasks with a given conditions (other predicates). +func (f *CpUserFilter) WhereHasCptasksWith(preds ...predicate.CpTask) { + f.Where(entql.HasEdgeWith("cptasks", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasSysuser applies a predicate to check if query has an edge sysuser. +func (f *CpUserFilter) WhereHasSysuser() { + f.Where(entql.HasEdge("sysuser")) +} + +// WhereHasSysuserWith applies a predicate to check if query has an edge sysuser with a given conditions (other predicates). +func (f *CpUserFilter) WhereHasSysuserWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("sysuser", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasCpTaskLogs applies a predicate to check if query has an edge cp_task_logs. +func (f *CpUserFilter) WhereHasCpTaskLogs() { + f.Where(entql.HasEdge("cp_task_logs")) +} + +// WhereHasCpTaskLogsWith applies a predicate to check if query has an edge cp_task_logs with a given conditions (other predicates). +func (f *CpUserFilter) WhereHasCpTaskLogsWith(preds ...predicate.CpTaskLog) { + f.Where(entql.HasEdgeWith("cp_task_logs", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasSchool applies a predicate to check if query has an edge school. +func (f *CpUserFilter) WhereHasSchool() { + f.Where(entql.HasEdge("school")) +} + +// WhereHasSchoolWith applies a predicate to check if query has an edge school with a given conditions (other predicates). +func (f *CpUserFilter) WhereHasSchoolWith(preds ...predicate.CpSchool) { + f.Where(entql.HasEdgeWith("school", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *SysAgentQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the SysAgentQuery builder. +func (_q *SysAgentQuery) Filter() *SysAgentFilter { + return &SysAgentFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *SysAgentMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the SysAgentMutation builder. +func (m *SysAgentMutation) Filter() *SysAgentFilter { + return &SysAgentFilter{config: m.config, predicateAdder: m} +} + +// SysAgentFilter provides a generic filtering capability at runtime for SysAgentQuery. +type SysAgentFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *SysAgentFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[5].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *SysAgentFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(sysagent.FieldID)) +} + +// WhereCreateTime applies the entql string predicate on the create_time field. +func (f *SysAgentFilter) WhereCreateTime(p entql.StringP) { + f.Where(p.Field(sysagent.FieldCreateTime)) +} + +// WhereUpdateTime applies the entql string predicate on the update_time field. +func (f *SysAgentFilter) WhereUpdateTime(p entql.StringP) { + f.Where(p.Field(sysagent.FieldUpdateTime)) +} + +// WhereLevel applies the entql int predicate on the level field. +func (f *SysAgentFilter) WhereLevel(p entql.IntP) { + f.Where(p.Field(sysagent.FieldLevel)) +} + +// WhereRate applies the entql string predicate on the rate field. +func (f *SysAgentFilter) WhereRate(p entql.StringP) { + f.Where(p.Field(sysagent.FieldRate)) +} + +// WhereHasUsers applies a predicate to check if query has an edge users. +func (f *SysAgentFilter) WhereHasUsers() { + f.Where(entql.HasEdge("users")) +} + +// WhereHasUsersWith applies a predicate to check if query has an edge users with a given conditions (other predicates). +func (f *SysAgentFilter) WhereHasUsersWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("users", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *SysCardQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the SysCardQuery builder. +func (_q *SysCardQuery) Filter() *SysCardFilter { + return &SysCardFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *SysCardMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the SysCardMutation builder. +func (m *SysCardMutation) Filter() *SysCardFilter { + return &SysCardFilter{config: m.config, predicateAdder: m} +} + +// SysCardFilter provides a generic filtering capability at runtime for SysCardQuery. +type SysCardFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *SysCardFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[6].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *SysCardFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(syscard.FieldID)) +} + +// WhereCreateTime applies the entql string predicate on the create_time field. +func (f *SysCardFilter) WhereCreateTime(p entql.StringP) { + f.Where(p.Field(syscard.FieldCreateTime)) +} + +// WhereUpdateTime applies the entql string predicate on the update_time field. +func (f *SysCardFilter) WhereUpdateTime(p entql.StringP) { + f.Where(p.Field(syscard.FieldUpdateTime)) +} + +// WhereContent applies the entql string predicate on the content field. +func (f *SysCardFilter) WhereContent(p entql.StringP) { + f.Where(p.Field(syscard.FieldContent)) +} + +// WhereStatus applies the entql int predicate on the status field. +func (f *SysCardFilter) WhereStatus(p entql.IntP) { + f.Where(p.Field(syscard.FieldStatus)) +} + +// WhereValue applies the entql uint64 predicate on the value field. +func (f *SysCardFilter) WhereValue(p entql.Uint64P) { + f.Where(p.Field(syscard.FieldValue)) +} + +// WhereCreatorID applies the entql int64 predicate on the creator_id field. +func (f *SysCardFilter) WhereCreatorID(p entql.Int64P) { + f.Where(p.Field(syscard.FieldCreatorID)) +} + +// WhereUsedID applies the entql int64 predicate on the used_id field. +func (f *SysCardFilter) WhereUsedID(p entql.Int64P) { + f.Where(p.Field(syscard.FieldUsedID)) +} + +// WhereCashUserID applies the entql int64 predicate on the cash_user_id field. +func (f *SysCardFilter) WhereCashUserID(p entql.Int64P) { + f.Where(p.Field(syscard.FieldCashUserID)) +} + +// WhereCashValue applies the entql string predicate on the cash_value field. +func (f *SysCardFilter) WhereCashValue(p entql.StringP) { + f.Where(p.Field(syscard.FieldCashValue)) +} + +// WhereHasCreator applies a predicate to check if query has an edge creator. +func (f *SysCardFilter) WhereHasCreator() { + f.Where(entql.HasEdge("creator")) +} + +// WhereHasCreatorWith applies a predicate to check if query has an edge creator with a given conditions (other predicates). +func (f *SysCardFilter) WhereHasCreatorWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("creator", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasUser applies a predicate to check if query has an edge user. +func (f *SysCardFilter) WhereHasUser() { + f.Where(entql.HasEdge("user")) +} + +// WhereHasUserWith applies a predicate to check if query has an edge user with a given conditions (other predicates). +func (f *SysCardFilter) WhereHasUserWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("user", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasCashUser applies a predicate to check if query has an edge cash_user. +func (f *SysCardFilter) WhereHasCashUser() { + f.Where(entql.HasEdge("cash_user")) +} + +// WhereHasCashUserWith applies a predicate to check if query has an edge cash_user with a given conditions (other predicates). +func (f *SysCardFilter) WhereHasCashUserWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("cash_user", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *SysMenuQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the SysMenuQuery builder. +func (_q *SysMenuQuery) Filter() *SysMenuFilter { + return &SysMenuFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *SysMenuMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the SysMenuMutation builder. +func (m *SysMenuMutation) Filter() *SysMenuFilter { + return &SysMenuFilter{config: m.config, predicateAdder: m} +} + +// SysMenuFilter provides a generic filtering capability at runtime for SysMenuQuery. +type SysMenuFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *SysMenuFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[7].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *SysMenuFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(sysmenu.FieldID)) +} + +// WhereCreateTime applies the entql string predicate on the create_time field. +func (f *SysMenuFilter) WhereCreateTime(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldCreateTime)) +} + +// WhereUpdateTime applies the entql string predicate on the update_time field. +func (f *SysMenuFilter) WhereUpdateTime(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldUpdateTime)) +} + +// WhereName applies the entql string predicate on the name field. +func (f *SysMenuFilter) WhereName(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldName)) +} + +// WhereLabel applies the entql string predicate on the label field. +func (f *SysMenuFilter) WhereLabel(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldLabel)) +} + +// WhereType applies the entql string predicate on the type field. +func (f *SysMenuFilter) WhereType(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldType)) +} + +// WhereLink applies the entql string predicate on the link field. +func (f *SysMenuFilter) WhereLink(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldLink)) +} + +// WherePermission applies the entql string predicate on the permission field. +func (f *SysMenuFilter) WherePermission(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldPermission)) +} + +// WhereRoute applies the entql string predicate on the route field. +func (f *SysMenuFilter) WhereRoute(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldRoute)) +} + +// WhereComponent applies the entql string predicate on the component field. +func (f *SysMenuFilter) WhereComponent(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldComponent)) +} + +// WhereHidden applies the entql bool predicate on the hidden field. +func (f *SysMenuFilter) WhereHidden(p entql.BoolP) { + f.Where(p.Field(sysmenu.FieldHidden)) +} + +// WhereIcon applies the entql string predicate on the icon field. +func (f *SysMenuFilter) WhereIcon(p entql.StringP) { + f.Where(p.Field(sysmenu.FieldIcon)) +} + +// WhereOrder applies the entql uint predicate on the order field. +func (f *SysMenuFilter) WhereOrder(p entql.UintP) { + f.Where(p.Field(sysmenu.FieldOrder)) +} + +// WhereHasRoles applies a predicate to check if query has an edge roles. +func (f *SysMenuFilter) WhereHasRoles() { + f.Where(entql.HasEdge("roles")) +} + +// WhereHasRolesWith applies a predicate to check if query has an edge roles with a given conditions (other predicates). +func (f *SysMenuFilter) WhereHasRolesWith(preds ...predicate.SysRole) { + f.Where(entql.HasEdgeWith("roles", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasParent applies a predicate to check if query has an edge parent. +func (f *SysMenuFilter) WhereHasParent() { + f.Where(entql.HasEdge("parent")) +} + +// WhereHasParentWith applies a predicate to check if query has an edge parent with a given conditions (other predicates). +func (f *SysMenuFilter) WhereHasParentWith(preds ...predicate.SysMenu) { + f.Where(entql.HasEdgeWith("parent", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasChildren applies a predicate to check if query has an edge children. +func (f *SysMenuFilter) WhereHasChildren() { + f.Where(entql.HasEdge("children")) +} + +// WhereHasChildrenWith applies a predicate to check if query has an edge children with a given conditions (other predicates). +func (f *SysMenuFilter) WhereHasChildrenWith(preds ...predicate.SysMenu) { + f.Where(entql.HasEdgeWith("children", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *SysRoleQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the SysRoleQuery builder. +func (_q *SysRoleQuery) Filter() *SysRoleFilter { + return &SysRoleFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *SysRoleMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the SysRoleMutation builder. +func (m *SysRoleMutation) Filter() *SysRoleFilter { + return &SysRoleFilter{config: m.config, predicateAdder: m} +} + +// SysRoleFilter provides a generic filtering capability at runtime for SysRoleQuery. +type SysRoleFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *SysRoleFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[8].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *SysRoleFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(sysrole.FieldID)) +} + +// WhereCreateTime applies the entql string predicate on the create_time field. +func (f *SysRoleFilter) WhereCreateTime(p entql.StringP) { + f.Where(p.Field(sysrole.FieldCreateTime)) +} + +// WhereUpdateTime applies the entql string predicate on the update_time field. +func (f *SysRoleFilter) WhereUpdateTime(p entql.StringP) { + f.Where(p.Field(sysrole.FieldUpdateTime)) +} + +// WhereLabel applies the entql string predicate on the label field. +func (f *SysRoleFilter) WhereLabel(p entql.StringP) { + f.Where(p.Field(sysrole.FieldLabel)) +} + +// WhereName applies the entql string predicate on the name field. +func (f *SysRoleFilter) WhereName(p entql.StringP) { + f.Where(p.Field(sysrole.FieldName)) +} + +// WhereDescription applies the entql string predicate on the description field. +func (f *SysRoleFilter) WhereDescription(p entql.StringP) { + f.Where(p.Field(sysrole.FieldDescription)) +} + +// WhereOrder applies the entql uint predicate on the order field. +func (f *SysRoleFilter) WhereOrder(p entql.UintP) { + f.Where(p.Field(sysrole.FieldOrder)) +} + +// WhereHasMenus applies a predicate to check if query has an edge menus. +func (f *SysRoleFilter) WhereHasMenus() { + f.Where(entql.HasEdge("menus")) +} + +// WhereHasMenusWith applies a predicate to check if query has an edge menus with a given conditions (other predicates). +func (f *SysRoleFilter) WhereHasMenusWith(preds ...predicate.SysMenu) { + f.Where(entql.HasEdgeWith("menus", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasUsers applies a predicate to check if query has an edge users. +func (f *SysRoleFilter) WhereHasUsers() { + f.Where(entql.HasEdge("users")) +} + +// WhereHasUsersWith applies a predicate to check if query has an edge users with a given conditions (other predicates). +func (f *SysRoleFilter) WhereHasUsersWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("users", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *SysUserQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the SysUserQuery builder. +func (_q *SysUserQuery) Filter() *SysUserFilter { + return &SysUserFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *SysUserMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the SysUserMutation builder. +func (m *SysUserMutation) Filter() *SysUserFilter { + return &SysUserFilter{config: m.config, predicateAdder: m} +} + +// SysUserFilter provides a generic filtering capability at runtime for SysUserQuery. +type SysUserFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *SysUserFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[9].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *SysUserFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(sysuser.FieldID)) +} + +// WhereCreateTime applies the entql string predicate on the create_time field. +func (f *SysUserFilter) WhereCreateTime(p entql.StringP) { + f.Where(p.Field(sysuser.FieldCreateTime)) +} + +// WhereUpdateTime applies the entql string predicate on the update_time field. +func (f *SysUserFilter) WhereUpdateTime(p entql.StringP) { + f.Where(p.Field(sysuser.FieldUpdateTime)) +} + +// WhereUsername applies the entql string predicate on the username field. +func (f *SysUserFilter) WhereUsername(p entql.StringP) { + f.Where(p.Field(sysuser.FieldUsername)) +} + +// WherePassword applies the entql string predicate on the password field. +func (f *SysUserFilter) WherePassword(p entql.StringP) { + f.Where(p.Field(sysuser.FieldPassword)) +} + +// WhereEmail applies the entql string predicate on the email field. +func (f *SysUserFilter) WhereEmail(p entql.StringP) { + f.Where(p.Field(sysuser.FieldEmail)) +} + +// WhereInviteCode applies the entql string predicate on the invite_code field. +func (f *SysUserFilter) WhereInviteCode(p entql.StringP) { + f.Where(p.Field(sysuser.FieldInviteCode)) +} + +// WhereBalance applies the entql string predicate on the balance field. +func (f *SysUserFilter) WhereBalance(p entql.StringP) { + f.Where(p.Field(sysuser.FieldBalance)) +} + +// WhereBlock applies the entql bool predicate on the block field. +func (f *SysUserFilter) WhereBlock(p entql.BoolP) { + f.Where(p.Field(sysuser.FieldBlock)) +} + +// WhereVerify applies the entql bool predicate on the verify field. +func (f *SysUserFilter) WhereVerify(p entql.BoolP) { + f.Where(p.Field(sysuser.FieldVerify)) +} + +// WhereInviteCashback applies the entql string predicate on the invite_cashback field. +func (f *SysUserFilter) WhereInviteCashback(p entql.StringP) { + f.Where(p.Field(sysuser.FieldInviteCashback)) +} + +// WhereHasParent applies a predicate to check if query has an edge parent. +func (f *SysUserFilter) WhereHasParent() { + f.Where(entql.HasEdge("parent")) +} + +// WhereHasParentWith applies a predicate to check if query has an edge parent with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasParentWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("parent", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasChildren applies a predicate to check if query has an edge children. +func (f *SysUserFilter) WhereHasChildren() { + f.Where(entql.HasEdge("children")) +} + +// WhereHasChildrenWith applies a predicate to check if query has an edge children with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasChildrenWith(preds ...predicate.SysUser) { + f.Where(entql.HasEdgeWith("children", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasRoles applies a predicate to check if query has an edge roles. +func (f *SysUserFilter) WhereHasRoles() { + f.Where(entql.HasEdge("roles")) +} + +// WhereHasRolesWith applies a predicate to check if query has an edge roles with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasRolesWith(preds ...predicate.SysRole) { + f.Where(entql.HasEdgeWith("roles", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasAgent applies a predicate to check if query has an edge agent. +func (f *SysUserFilter) WhereHasAgent() { + f.Where(entql.HasEdge("agent")) +} + +// WhereHasAgentWith applies a predicate to check if query has an edge agent with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasAgentWith(preds ...predicate.SysAgent) { + f.Where(entql.HasEdgeWith("agent", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasImages applies a predicate to check if query has an edge images. +func (f *SysUserFilter) WhereHasImages() { + f.Where(entql.HasEdge("images")) +} + +// WhereHasImagesWith applies a predicate to check if query has an edge images with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasImagesWith(preds ...predicate.CpImage) { + f.Where(entql.HasEdgeWith("images", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasCpuser applies a predicate to check if query has an edge cpuser. +func (f *SysUserFilter) WhereHasCpuser() { + f.Where(entql.HasEdge("cpuser")) +} + +// WhereHasCpuserWith applies a predicate to check if query has an edge cpuser with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasCpuserWith(preds ...predicate.CpUser) { + f.Where(entql.HasEdgeWith("cpuser", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasCpTask applies a predicate to check if query has an edge cp_task. +func (f *SysUserFilter) WhereHasCpTask() { + f.Where(entql.HasEdge("cp_task")) +} + +// WhereHasCpTaskWith applies a predicate to check if query has an edge cp_task with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasCpTaskWith(preds ...predicate.CpTask) { + f.Where(entql.HasEdgeWith("cp_task", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasCpTaskLogs applies a predicate to check if query has an edge cp_task_logs. +func (f *SysUserFilter) WhereHasCpTaskLogs() { + f.Where(entql.HasEdge("cp_task_logs")) +} + +// WhereHasCpTaskLogsWith applies a predicate to check if query has an edge cp_task_logs with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasCpTaskLogsWith(preds ...predicate.CpTaskLog) { + f.Where(entql.HasEdgeWith("cp_task_logs", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasCreatedCards applies a predicate to check if query has an edge created_cards. +func (f *SysUserFilter) WhereHasCreatedCards() { + f.Where(entql.HasEdge("created_cards")) +} + +// WhereHasCreatedCardsWith applies a predicate to check if query has an edge created_cards with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasCreatedCardsWith(preds ...predicate.SysCard) { + f.Where(entql.HasEdgeWith("created_cards", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasUsedCards applies a predicate to check if query has an edge used_cards. +func (f *SysUserFilter) WhereHasUsedCards() { + f.Where(entql.HasEdge("used_cards")) +} + +// WhereHasUsedCardsWith applies a predicate to check if query has an edge used_cards with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasUsedCardsWith(preds ...predicate.SysCard) { + f.Where(entql.HasEdgeWith("used_cards", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// WhereHasCashbackCards applies a predicate to check if query has an edge cashback_cards. +func (f *SysUserFilter) WhereHasCashbackCards() { + f.Where(entql.HasEdge("cashback_cards")) +} + +// WhereHasCashbackCardsWith applies a predicate to check if query has an edge cashback_cards with a given conditions (other predicates). +func (f *SysUserFilter) WhereHasCashbackCardsWith(preds ...predicate.SysCard) { + f.Where(entql.HasEdgeWith("cashback_cards", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + +// addPredicate implements the predicateAdder interface. +func (_q *SysUserLogQuery) addPredicate(pred func(s *sql.Selector)) { + _q.predicates = append(_q.predicates, pred) +} + +// Filter returns a Filter implementation to apply filters on the SysUserLogQuery builder. +func (_q *SysUserLogQuery) Filter() *SysUserLogFilter { + return &SysUserLogFilter{config: _q.config, predicateAdder: _q} +} + +// addPredicate implements the predicateAdder interface. +func (m *SysUserLogMutation) addPredicate(pred func(s *sql.Selector)) { + m.predicates = append(m.predicates, pred) +} + +// Filter returns an entql.Where implementation to apply filters on the SysUserLogMutation builder. +func (m *SysUserLogMutation) Filter() *SysUserLogFilter { + return &SysUserLogFilter{config: m.config, predicateAdder: m} +} + +// SysUserLogFilter provides a generic filtering capability at runtime for SysUserLogQuery. +type SysUserLogFilter struct { + predicateAdder + config +} + +// Where applies the entql predicate on the query filter. +func (f *SysUserLogFilter) Where(p entql.P) { + f.addPredicate(func(s *sql.Selector) { + if err := schemaGraph.EvalP(schemaGraph.Nodes[10].Type, p, s); err != nil { + s.AddError(err) + } + }) +} + +// WhereID applies the entql int64 predicate on the id field. +func (f *SysUserLogFilter) WhereID(p entql.Int64P) { + f.Where(p.Field(sysuserlog.FieldID)) +} diff --git a/internal/ent/intercept/intercept.go b/internal/ent/intercept/intercept.go new file mode 100644 index 0000000..d133261 --- /dev/null +++ b/internal/ent/intercept/intercept.go @@ -0,0 +1,450 @@ +// ENT数据库文件,请勿编辑。 + +package intercept + +import ( + "context" + "fmt" + + "likedream-goframe/internal/ent" + "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/predicate" + "likedream-goframe/internal/ent/sysagent" + "likedream-goframe/internal/ent/syscard" + "likedream-goframe/internal/ent/sysmenu" + "likedream-goframe/internal/ent/sysrole" + "likedream-goframe/internal/ent/sysuser" + "likedream-goframe/internal/ent/sysuserlog" + + "entgo.io/ent/dialect/sql" +) + +// The Query interface represents an operation that queries a graph. +// By using this interface, users can write generic code that manipulates +// query builders of different types. +type Query interface { + // Type returns the string representation of the query type. + Type() string + // Limit the number of records to be returned by this query. + Limit(int) + // Offset to start from. + Offset(int) + // Unique configures the query builder to filter duplicate records. + Unique(bool) + // Order specifies how the records should be ordered. + Order(...func(*sql.Selector)) + // WhereP appends storage-level predicates to the query builder. Using this method, users + // can use type-assertion to append predicates that do not depend on any generated package. + WhereP(...func(*sql.Selector)) +} + +// The Func type is an adapter that allows ordinary functions to be used as interceptors. +// Unlike traversal functions, interceptors are skipped during graph traversals. Note that the +// implementation of Func is different from the one defined in entgo.io/ent.InterceptFunc. +type Func func(context.Context, Query) error + +// Intercept calls f(ctx, q) and then applied the next Querier. +func (f Func) Intercept(next ent.Querier) ent.Querier { + return ent.QuerierFunc(func(ctx context.Context, q ent.Query) (ent.Value, error) { + query, err := NewQuery(q) + if err != nil { + return nil, err + } + if err := f(ctx, query); err != nil { + return nil, err + } + return next.Query(ctx, q) + }) +} + +// The TraverseFunc type is an adapter to allow the use of ordinary function as Traverser. +// If f is a function with the appropriate signature, TraverseFunc(f) is a Traverser that calls f. +type TraverseFunc func(context.Context, Query) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseFunc) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseFunc) Traverse(ctx context.Context, q ent.Query) error { + query, err := NewQuery(q) + if err != nil { + return err + } + return f(ctx, query) +} + +// The CpImageFunc type is an adapter to allow the use of ordinary function as a Querier. +type CpImageFunc func(context.Context, *ent.CpImageQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f CpImageFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.CpImageQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.CpImageQuery", q) +} + +// The TraverseCpImage type is an adapter to allow the use of ordinary function as Traverser. +type TraverseCpImage func(context.Context, *ent.CpImageQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseCpImage) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseCpImage) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpImageQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.CpImageQuery", q) +} + +// The CpSchoolFunc type is an adapter to allow the use of ordinary function as a Querier. +type CpSchoolFunc func(context.Context, *ent.CpSchoolQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f CpSchoolFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.CpSchoolQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.CpSchoolQuery", q) +} + +// The TraverseCpSchool type is an adapter to allow the use of ordinary function as Traverser. +type TraverseCpSchool func(context.Context, *ent.CpSchoolQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseCpSchool) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseCpSchool) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpSchoolQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.CpSchoolQuery", q) +} + +// The CpTaskFunc type is an adapter to allow the use of ordinary function as a Querier. +type CpTaskFunc func(context.Context, *ent.CpTaskQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f CpTaskFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.CpTaskQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.CpTaskQuery", q) +} + +// The TraverseCpTask type is an adapter to allow the use of ordinary function as Traverser. +type TraverseCpTask func(context.Context, *ent.CpTaskQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseCpTask) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseCpTask) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpTaskQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.CpTaskQuery", q) +} + +// The CpTaskLogFunc type is an adapter to allow the use of ordinary function as a Querier. +type CpTaskLogFunc func(context.Context, *ent.CpTaskLogQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f CpTaskLogFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.CpTaskLogQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.CpTaskLogQuery", q) +} + +// The TraverseCpTaskLog type is an adapter to allow the use of ordinary function as Traverser. +type TraverseCpTaskLog func(context.Context, *ent.CpTaskLogQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseCpTaskLog) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseCpTaskLog) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpTaskLogQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.CpTaskLogQuery", q) +} + +// The CpUserFunc type is an adapter to allow the use of ordinary function as a Querier. +type CpUserFunc func(context.Context, *ent.CpUserQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f CpUserFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.CpUserQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.CpUserQuery", q) +} + +// The TraverseCpUser type is an adapter to allow the use of ordinary function as Traverser. +type TraverseCpUser func(context.Context, *ent.CpUserQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseCpUser) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseCpUser) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpUserQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.CpUserQuery", q) +} + +// The SysAgentFunc type is an adapter to allow the use of ordinary function as a Querier. +type SysAgentFunc func(context.Context, *ent.SysAgentQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f SysAgentFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.SysAgentQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.SysAgentQuery", q) +} + +// The TraverseSysAgent type is an adapter to allow the use of ordinary function as Traverser. +type TraverseSysAgent func(context.Context, *ent.SysAgentQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseSysAgent) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseSysAgent) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysAgentQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.SysAgentQuery", q) +} + +// The SysCardFunc type is an adapter to allow the use of ordinary function as a Querier. +type SysCardFunc func(context.Context, *ent.SysCardQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f SysCardFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.SysCardQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.SysCardQuery", q) +} + +// The TraverseSysCard type is an adapter to allow the use of ordinary function as Traverser. +type TraverseSysCard func(context.Context, *ent.SysCardQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseSysCard) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseSysCard) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysCardQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.SysCardQuery", q) +} + +// The SysMenuFunc type is an adapter to allow the use of ordinary function as a Querier. +type SysMenuFunc func(context.Context, *ent.SysMenuQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f SysMenuFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.SysMenuQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.SysMenuQuery", q) +} + +// The TraverseSysMenu type is an adapter to allow the use of ordinary function as Traverser. +type TraverseSysMenu func(context.Context, *ent.SysMenuQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseSysMenu) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseSysMenu) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysMenuQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.SysMenuQuery", q) +} + +// The SysRoleFunc type is an adapter to allow the use of ordinary function as a Querier. +type SysRoleFunc func(context.Context, *ent.SysRoleQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f SysRoleFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.SysRoleQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.SysRoleQuery", q) +} + +// The TraverseSysRole type is an adapter to allow the use of ordinary function as Traverser. +type TraverseSysRole func(context.Context, *ent.SysRoleQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseSysRole) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseSysRole) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysRoleQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.SysRoleQuery", q) +} + +// The SysUserFunc type is an adapter to allow the use of ordinary function as a Querier. +type SysUserFunc func(context.Context, *ent.SysUserQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f SysUserFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.SysUserQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.SysUserQuery", q) +} + +// The TraverseSysUser type is an adapter to allow the use of ordinary function as Traverser. +type TraverseSysUser func(context.Context, *ent.SysUserQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseSysUser) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseSysUser) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysUserQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.SysUserQuery", q) +} + +// The SysUserLogFunc type is an adapter to allow the use of ordinary function as a Querier. +type SysUserLogFunc func(context.Context, *ent.SysUserLogQuery) (ent.Value, error) + +// Query calls f(ctx, q). +func (f SysUserLogFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) { + if q, ok := q.(*ent.SysUserLogQuery); ok { + return f(ctx, q) + } + return nil, fmt.Errorf("unexpected query type %T. expect *ent.SysUserLogQuery", q) +} + +// The TraverseSysUserLog type is an adapter to allow the use of ordinary function as Traverser. +type TraverseSysUserLog func(context.Context, *ent.SysUserLogQuery) error + +// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline. +func (f TraverseSysUserLog) Intercept(next ent.Querier) ent.Querier { + return next +} + +// Traverse calls f(ctx, q). +func (f TraverseSysUserLog) Traverse(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysUserLogQuery); ok { + return f(ctx, q) + } + return fmt.Errorf("unexpected query type %T. expect *ent.SysUserLogQuery", q) +} + +// NewQuery returns the generic Query interface for the given typed query. +func NewQuery(q ent.Query) (Query, error) { + switch q := q.(type) { + case *ent.CpImageQuery: + return &query[*ent.CpImageQuery, predicate.CpImage, cpimage.OrderOption]{typ: ent.TypeCpImage, tq: q}, nil + case *ent.CpSchoolQuery: + return &query[*ent.CpSchoolQuery, predicate.CpSchool, cpschool.OrderOption]{typ: ent.TypeCpSchool, tq: q}, nil + case *ent.CpTaskQuery: + return &query[*ent.CpTaskQuery, predicate.CpTask, cptask.OrderOption]{typ: ent.TypeCpTask, tq: q}, nil + case *ent.CpTaskLogQuery: + return &query[*ent.CpTaskLogQuery, predicate.CpTaskLog, cptasklog.OrderOption]{typ: ent.TypeCpTaskLog, tq: q}, nil + case *ent.CpUserQuery: + return &query[*ent.CpUserQuery, predicate.CpUser, cpuser.OrderOption]{typ: ent.TypeCpUser, tq: q}, nil + case *ent.SysAgentQuery: + return &query[*ent.SysAgentQuery, predicate.SysAgent, sysagent.OrderOption]{typ: ent.TypeSysAgent, tq: q}, nil + case *ent.SysCardQuery: + return &query[*ent.SysCardQuery, predicate.SysCard, syscard.OrderOption]{typ: ent.TypeSysCard, tq: q}, nil + case *ent.SysMenuQuery: + return &query[*ent.SysMenuQuery, predicate.SysMenu, sysmenu.OrderOption]{typ: ent.TypeSysMenu, tq: q}, nil + case *ent.SysRoleQuery: + return &query[*ent.SysRoleQuery, predicate.SysRole, sysrole.OrderOption]{typ: ent.TypeSysRole, tq: q}, nil + case *ent.SysUserQuery: + return &query[*ent.SysUserQuery, predicate.SysUser, sysuser.OrderOption]{typ: ent.TypeSysUser, tq: q}, nil + case *ent.SysUserLogQuery: + return &query[*ent.SysUserLogQuery, predicate.SysUserLog, sysuserlog.OrderOption]{typ: ent.TypeSysUserLog, tq: q}, nil + default: + return nil, fmt.Errorf("unknown query type %T", q) + } +} + +type query[T any, P ~func(*sql.Selector), R ~func(*sql.Selector)] struct { + typ string + tq interface { + Limit(int) T + Offset(int) T + Unique(bool) T + Order(...R) T + Where(...P) T + } +} + +func (q query[T, P, R]) Type() string { + return q.typ +} + +func (q query[T, P, R]) Limit(limit int) { + q.tq.Limit(limit) +} + +func (q query[T, P, R]) Offset(offset int) { + q.tq.Offset(offset) +} + +func (q query[T, P, R]) Unique(unique bool) { + q.tq.Unique(unique) +} + +func (q query[T, P, R]) Order(orders ...func(*sql.Selector)) { + rs := make([]R, len(orders)) + for i := range orders { + rs[i] = orders[i] + } + q.tq.Order(rs...) +} + +func (q query[T, P, R]) WhereP(ps ...func(*sql.Selector)) { + p := make([]P, len(ps)) + for i := range ps { + p[i] = ps[i] + } + q.tq.Where(p...) +} diff --git a/internal/ent/internal/globalid.go b/internal/ent/internal/globalid.go new file mode 100644 index 0000000..c7f4f4f --- /dev/null +++ b/internal/ent/internal/globalid.go @@ -0,0 +1,5 @@ +// ENT数据库文件,请勿编辑。 + +package internal + +const IncrementStarts = "{\"cp_image\":0,\"cp_schools\":4294967296,\"cp_task_logs\":12884901888,\"cp_tasks\":8589934592,\"cp_users\":17179869184,\"sys_agent\":21474836480,\"sys_card\":25769803776,\"sys_menu\":30064771072,\"sys_role\":34359738368,\"sys_user\":38654705664,\"sys_user_logs\":42949672960}" diff --git a/internal/ent/internal/schema.go b/internal/ent/internal/schema.go new file mode 100644 index 0000000..fabeba9 --- /dev/null +++ b/internal/ent/internal/schema.go @@ -0,0 +1,9 @@ +// ENT数据库文件,请勿编辑。 + +//go:build tools +// +build tools + +// Package internal holds a loadable version of the latest schema. +package internal + +const Schema = "{\"Schema\":\"likedream-goframe/internal/ent/schema\",\"Package\":\"likedream-goframe/internal/ent\",\"Schemas\":[{\"name\":\"CpImage\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"user\",\"type\":\"SysUser\",\"field\":\"user_id\",\"ref_name\":\"images\",\"unique\":true,\"inverse\":true,\"required\":true}],\"fields\":[{\"name\":\"create_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"createTime\\\"\",\"default\":true,\"default_kind\":19,\"immutable\":true,\"position\":{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"update_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"updateTime\\\"\",\"default\":true,\"default_kind\":19,\"position\":{\"Index\":1,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"image_id\",\"type\":{\"Type\":4,\"Ident\":\"uuid.UUID\",\"PkgPath\":\"github.com/google/uuid\",\"PkgName\":\"uuid\",\"Nillable\":false,\"RType\":{\"Name\":\"UUID\",\"Ident\":\"uuid.UUID\",\"Kind\":17,\"PkgPath\":\"github.com/google/uuid\",\"Methods\":{\"ClockSequence\":{\"In\":[],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Domain\":{\"In\":[],\"Out\":[{\"Name\":\"Domain\",\"Ident\":\"uuid.Domain\",\"Kind\":8,\"PkgPath\":\"github.com/google/uuid\",\"Methods\":null}]},\"ID\":{\"In\":[],\"Out\":[{\"Name\":\"uint32\",\"Ident\":\"uint32\",\"Kind\":10,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalBinary\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalText\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"NodeID\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"uuid.Time\",\"Kind\":6,\"PkgPath\":\"github.com/google/uuid\",\"Methods\":null}]},\"URN\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalBinary\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalText\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Variant\":{\"In\":[],\"Out\":[{\"Name\":\"Variant\",\"Ident\":\"uuid.Variant\",\"Kind\":8,\"PkgPath\":\"github.com/google/uuid\",\"Methods\":null}]},\"Version\":{\"In\":[],\"Out\":[{\"Name\":\"Version\",\"Ident\":\"uuid.Version\",\"Kind\":8,\"PkgPath\":\"github.com/google/uuid\",\"Methods\":null}]}}}},\"unique\":true,\"immutable\":true,\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"key\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"validators\":1,\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"user_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"validators\":1,\"position\":{\"Index\":2,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"content_type\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"validators\":1,\"position\":{\"Index\":3,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"content_length\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"validators\":1,\"position\":{\"Index\":4,\"MixedIn\":false,\"MixinIndex\":0}}],\"hooks\":[{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0}],\"annotations\":{\"EntSQL\":{\"increment_start\":0,\"table\":\"cp_image\"}}},{\"name\":\"CpSchool\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"cpusers\",\"type\":\"CpUser\"}],\"fields\":[{\"name\":\"name\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"name_pinyin\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"icon_img\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":2,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"id\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"unique\":true,\"position\":{\"Index\":3,\"MixedIn\":false,\"MixinIndex\":0}}]},{\"name\":\"CpTask\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"cp_user\",\"type\":\"CpUser\",\"field\":\"cp_user_id\",\"ref_name\":\"cptasks\",\"unique\":true,\"inverse\":true,\"required\":true,\"annotations\":{\"EntSQL\":{\"on_delete\":\"CASCADE\"}}},{\"name\":\"sys_user\",\"type\":\"SysUser\",\"field\":\"user_id\",\"ref_name\":\"cp_task\",\"unique\":true,\"inverse\":true,\"required\":true,\"annotations\":{\"EntSQL\":{\"on_delete\":\"CASCADE\"}}},{\"name\":\"cp_task_logs\",\"type\":\"CpTaskLog\"}],\"fields\":[{\"name\":\"cp_user_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"user_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"task_type\",\"type\":{\"Type\":6,\"Ident\":\"cptask.TaskType\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"enums\":[{\"N\":\"collection\",\"V\":\"collection\"},{\"N\":\"sign\",\"V\":\"sign\"},{\"N\":\"sleep_check\",\"V\":\"sleep_check\"}],\"position\":{\"Index\":2,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"title\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"validators\":1,\"position\":{\"Index\":3,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"frequency\",\"type\":{\"Type\":12,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"default\":true,\"default_value\":0,\"default_kind\":2,\"position\":{\"Index\":4,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"task_status\",\"type\":{\"Type\":6,\"Ident\":\"cptask.TaskStatus\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"enums\":[{\"N\":\"not_start\",\"V\":\"not_start\"},{\"N\":\"doing\",\"V\":\"doing\"},{\"N\":\"done\",\"V\":\"done\"},{\"N\":\"fail\",\"V\":\"fail\"},{\"N\":\"unknown\",\"V\":\"unknown\"}],\"position\":{\"Index\":5,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"success_count\",\"type\":{\"Type\":12,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"default\":true,\"default_value\":0,\"default_kind\":2,\"position\":{\"Index\":6,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"form_data\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":7,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"step\",\"type\":{\"Type\":6,\"Ident\":\"cptask.Step\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"enums\":[{\"N\":\"form\",\"V\":\"form\"},{\"N\":\"execute\",\"V\":\"execute\"},{\"N\":\"complete\",\"V\":\"complete\"}],\"position\":{\"Index\":8,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"notification_type\",\"type\":{\"Type\":6,\"Ident\":\"cptask.NotificationType\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"enums\":[{\"N\":\"none\",\"V\":\"none\"},{\"N\":\"cp_user_email\",\"V\":\"cp_user_email\"},{\"N\":\"system_user_email\",\"V\":\"system_user_email\"}],\"position\":{\"Index\":9,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"execute_hour\",\"type\":{\"Type\":12,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"nillable\":true,\"optional\":true,\"position\":{\"Index\":10,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"execute_minute\",\"type\":{\"Type\":12,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"nillable\":true,\"optional\":true,\"position\":{\"Index\":11,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"next_execute_time\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"nillable\":true,\"optional\":true,\"position\":{\"Index\":12,\"MixedIn\":false,\"MixinIndex\":0}}]},{\"name\":\"CpTaskLog\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"cp_task\",\"type\":\"CpTask\",\"field\":\"cp_task_id\",\"ref_name\":\"cp_task_logs\",\"unique\":true,\"inverse\":true,\"required\":true},{\"name\":\"system_user\",\"type\":\"SysUser\",\"field\":\"system_user_id\",\"ref_name\":\"cp_task_logs\",\"unique\":true,\"inverse\":true,\"required\":true},{\"name\":\"cp_user\",\"type\":\"CpUser\",\"field\":\"cp_user_id\",\"ref_name\":\"cp_task_logs\",\"unique\":true,\"inverse\":true,\"required\":true}],\"fields\":[{\"name\":\"cp_task_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"system_user_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"cp_user_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":2,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"is_success\",\"type\":{\"Type\":1,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":3,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"error_message\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":4,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"real_name\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":5,\"MixedIn\":false,\"MixinIndex\":0}}]},{\"name\":\"CpUser\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"cptasks\",\"type\":\"CpTask\"},{\"name\":\"sysuser\",\"type\":\"SysUser\",\"field\":\"user_id\",\"ref_name\":\"cpuser\",\"unique\":true,\"inverse\":true,\"required\":true,\"annotations\":{\"EntSQL\":{\"on_delete\":\"CASCADE\"}}},{\"name\":\"cp_task_logs\",\"type\":\"CpTaskLog\"},{\"name\":\"school\",\"type\":\"CpSchool\",\"field\":\"school_id\",\"ref_name\":\"cpusers\",\"unique\":true,\"inverse\":true,\"required\":true}],\"fields\":[{\"name\":\"user_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"username\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"validators\":1,\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"password\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"validators\":1,\"position\":{\"Index\":2,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"school_id\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"validators\":1,\"position\":{\"Index\":3,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"email\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":4,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"mobile_code\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":5,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"cookie\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"size\":2147483647,\"optional\":true,\"position\":{\"Index\":6,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"mobile_type\",\"type\":{\"Type\":6,\"Ident\":\"cpuser.MobileType\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"enums\":[{\"N\":\"random\",\"V\":\"random\"},{\"N\":\"authorize\",\"V\":\"authorize\"}],\"position\":{\"Index\":7,\"MixedIn\":false,\"MixinIndex\":0}}]},{\"name\":\"SysAgent\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"users\",\"type\":\"SysUser\",\"ref_name\":\"agent\",\"unique\":true,\"inverse\":true}],\"fields\":[{\"name\":\"create_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"createTime\\\"\",\"default\":true,\"default_kind\":19,\"immutable\":true,\"position\":{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"update_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"updateTime\\\"\",\"default\":true,\"default_kind\":19,\"position\":{\"Index\":1,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"level\",\"type\":{\"Type\":12,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"rate\",\"type\":{\"Type\":7,\"Ident\":\"decimal.Decimal\",\"PkgPath\":\"github.com/shopspring/decimal\",\"PkgName\":\"decimal\",\"Nillable\":false,\"RType\":{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":{\"Abs\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Add\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Atan\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"BigFloat\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Float\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"BigInt\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"Ceil\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Cmp\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Coefficient\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"CoefficientInt64\":{\"In\":[],\"Out\":[{\"Name\":\"int64\",\"Ident\":\"int64\",\"Kind\":6,\"PkgPath\":\"\",\"Methods\":null}]},\"Compare\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Copy\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Cos\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Div\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"DivRound\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Equal\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Equals\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"ExpHullAbrham\":{\"In\":[{\"Name\":\"uint32\",\"Ident\":\"uint32\",\"Kind\":10,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"ExpTaylor\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Exponent\":{\"In\":[],\"Out\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}]},\"Float64\":{\"In\":[],\"Out\":[{\"Name\":\"float64\",\"Ident\":\"float64\",\"Kind\":14,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Floor\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"GobDecode\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"GobEncode\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"GreaterThan\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"GreaterThanOrEqual\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"InexactFloat64\":{\"In\":[],\"Out\":[{\"Name\":\"float64\",\"Ident\":\"float64\",\"Kind\":14,\"PkgPath\":\"\",\"Methods\":null}]},\"IntPart\":{\"In\":[],\"Out\":[{\"Name\":\"int64\",\"Ident\":\"int64\",\"Kind\":6,\"PkgPath\":\"\",\"Methods\":null}]},\"IsInteger\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsNegative\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsPositive\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsZero\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"LessThan\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"LessThanOrEqual\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Ln\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalBinary\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalText\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Mod\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Mul\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Neg\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"NumDigits\":{\"In\":[],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Pow\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"PowBigInt\":{\"In\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"PowInt32\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"PowWithPrecision\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"QuoRem\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Rat\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Rat\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"Round\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundBank\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundCash\":{\"In\":[{\"Name\":\"uint8\",\"Ident\":\"uint8\",\"Kind\":8,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundCeil\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundDown\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundFloor\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundUp\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Shift\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Sign\":{\"In\":[],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Sin\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixed\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixedBank\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixedCash\":{\"In\":[{\"Name\":\"uint8\",\"Ident\":\"uint8\",\"Kind\":8,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringScaled\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Sub\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Tan\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Truncate\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"UnmarshalBinary\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalText\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"decimal(10,2)\",\"postgres\":\"numeric(10,2)\"}}],\"hooks\":[{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0}],\"annotations\":{\"EntSQL\":{\"increment_start\":21474836480,\"table\":\"sys_agent\"}}},{\"name\":\"SysCard\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"creator\",\"type\":\"SysUser\",\"field\":\"creator_id\",\"ref_name\":\"created_cards\",\"unique\":true,\"inverse\":true,\"required\":true},{\"name\":\"user\",\"type\":\"SysUser\",\"field\":\"used_id\",\"ref_name\":\"used_cards\",\"unique\":true,\"inverse\":true},{\"name\":\"cash_user\",\"type\":\"SysUser\",\"field\":\"cash_user_id\",\"ref_name\":\"cashback_cards\",\"unique\":true,\"inverse\":true}],\"fields\":[{\"name\":\"create_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"createTime\\\"\",\"default\":true,\"default_kind\":19,\"immutable\":true,\"position\":{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"update_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"updateTime\\\"\",\"default\":true,\"default_kind\":19,\"position\":{\"Index\":1,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"content\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"unique\":true,\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"status\",\"type\":{\"Type\":12,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"default\":true,\"default_value\":1,\"default_kind\":2,\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"value\",\"type\":{\"Type\":18,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":2,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"creator_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":3,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"used_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":4,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"cash_user_id\",\"type\":{\"Type\":13,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":5,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"cash_value\",\"type\":{\"Type\":7,\"Ident\":\"decimal.Decimal\",\"PkgPath\":\"github.com/shopspring/decimal\",\"PkgName\":\"decimal\",\"Nillable\":false,\"RType\":{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":{\"Abs\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Add\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Atan\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"BigFloat\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Float\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"BigInt\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"Ceil\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Cmp\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Coefficient\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"CoefficientInt64\":{\"In\":[],\"Out\":[{\"Name\":\"int64\",\"Ident\":\"int64\",\"Kind\":6,\"PkgPath\":\"\",\"Methods\":null}]},\"Compare\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Copy\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Cos\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Div\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"DivRound\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Equal\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Equals\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"ExpHullAbrham\":{\"In\":[{\"Name\":\"uint32\",\"Ident\":\"uint32\",\"Kind\":10,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"ExpTaylor\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Exponent\":{\"In\":[],\"Out\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}]},\"Float64\":{\"In\":[],\"Out\":[{\"Name\":\"float64\",\"Ident\":\"float64\",\"Kind\":14,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Floor\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"GobDecode\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"GobEncode\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"GreaterThan\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"GreaterThanOrEqual\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"InexactFloat64\":{\"In\":[],\"Out\":[{\"Name\":\"float64\",\"Ident\":\"float64\",\"Kind\":14,\"PkgPath\":\"\",\"Methods\":null}]},\"IntPart\":{\"In\":[],\"Out\":[{\"Name\":\"int64\",\"Ident\":\"int64\",\"Kind\":6,\"PkgPath\":\"\",\"Methods\":null}]},\"IsInteger\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsNegative\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsPositive\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsZero\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"LessThan\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"LessThanOrEqual\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Ln\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalBinary\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalText\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Mod\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Mul\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Neg\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"NumDigits\":{\"In\":[],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Pow\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"PowBigInt\":{\"In\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"PowInt32\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"PowWithPrecision\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"QuoRem\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Rat\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Rat\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"Round\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundBank\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundCash\":{\"In\":[{\"Name\":\"uint8\",\"Ident\":\"uint8\",\"Kind\":8,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundCeil\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundDown\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundFloor\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundUp\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Shift\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Sign\":{\"In\":[],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Sin\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixed\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixedBank\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixedCash\":{\"In\":[{\"Name\":\"uint8\",\"Ident\":\"uint8\",\"Kind\":8,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringScaled\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Sub\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Tan\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Truncate\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"UnmarshalBinary\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalText\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"default\":true,\"default_kind\":19,\"position\":{\"Index\":6,\"MixedIn\":false,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"decimal(10,2)\",\"postgres\":\"numeric(10,2)\"}}],\"hooks\":[{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0}],\"annotations\":{\"EntSQL\":{\"increment_start\":25769803776,\"table\":\"sys_card\"}}},{\"name\":\"SysMenu\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"roles\",\"type\":\"SysRole\",\"ref_name\":\"menus\",\"inverse\":true},{\"name\":\"parent\",\"type\":\"SysMenu\",\"ref\":{\"name\":\"children\",\"type\":\"SysMenu\"},\"unique\":true,\"inverse\":true}],\"fields\":[{\"name\":\"create_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"createTime\\\"\",\"default\":true,\"default_kind\":19,\"immutable\":true,\"position\":{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"update_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"updateTime\\\"\",\"default\":true,\"default_kind\":19,\"position\":{\"Index\":1,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"name\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"label\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"type\",\"type\":{\"Type\":6,\"Ident\":\"sysmenu.Type\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"enums\":[{\"N\":\"group\",\"V\":\"group\"},{\"N\":\"menu\",\"V\":\"menu\"},{\"N\":\"button\",\"V\":\"button\"},{\"N\":\"link_in\",\"V\":\"link_in\"},{\"N\":\"link_out\",\"V\":\"link_out\"}],\"position\":{\"Index\":2,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"link\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":3,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"permission\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":4,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"route\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":5,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"component\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":6,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"hidden\",\"type\":{\"Type\":1,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"default\":true,\"default_value\":false,\"default_kind\":1,\"position\":{\"Index\":7,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"icon\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"optional\":true,\"position\":{\"Index\":8,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"order\",\"type\":{\"Type\":17,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":9,\"MixedIn\":false,\"MixinIndex\":0}}],\"hooks\":[{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0}],\"annotations\":{\"EntSQL\":{\"increment_start\":30064771072,\"table\":\"sys_menu\"}}},{\"name\":\"SysRole\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"menus\",\"type\":\"SysMenu\"},{\"name\":\"users\",\"type\":\"SysUser\",\"ref_name\":\"roles\",\"inverse\":true}],\"fields\":[{\"name\":\"create_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"createTime\\\"\",\"default\":true,\"default_kind\":19,\"immutable\":true,\"position\":{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"update_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"updateTime\\\"\",\"default\":true,\"default_kind\":19,\"position\":{\"Index\":1,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"label\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"unique\":true,\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"name\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"unique\":true,\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"description\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":2,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"order\",\"type\":{\"Type\":17,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":3,\"MixedIn\":false,\"MixinIndex\":0}}],\"hooks\":[{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0}],\"annotations\":{\"EntSQL\":{\"increment_start\":34359738368,\"table\":\"sys_role\"}}},{\"name\":\"SysUser\",\"config\":{\"Table\":\"\"},\"edges\":[{\"name\":\"parent\",\"type\":\"SysUser\",\"ref\":{\"name\":\"children\",\"type\":\"SysUser\"},\"unique\":true,\"inverse\":true},{\"name\":\"roles\",\"type\":\"SysRole\"},{\"name\":\"agent\",\"type\":\"SysAgent\",\"unique\":true},{\"name\":\"images\",\"type\":\"CpImage\"},{\"name\":\"cpuser\",\"type\":\"CpUser\"},{\"name\":\"cp_task\",\"type\":\"CpTask\"},{\"name\":\"cp_task_logs\",\"type\":\"CpTaskLog\"},{\"name\":\"created_cards\",\"type\":\"SysCard\"},{\"name\":\"used_cards\",\"type\":\"SysCard\"},{\"name\":\"cashback_cards\",\"type\":\"SysCard\"}],\"fields\":[{\"name\":\"create_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"createTime\\\"\",\"default\":true,\"default_kind\":19,\"immutable\":true,\"position\":{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"update_time\",\"type\":{\"Type\":7,\"Ident\":\"*ent2.CustomTime\",\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"PkgName\":\"ent2\",\"Nillable\":true,\"RType\":{\"Name\":\"CustomTime\",\"Ident\":\"ent2.CustomTime\",\"Kind\":22,\"PkgPath\":\"likedream-goframe/internal/framework/ent2\",\"Methods\":{\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Time\":{\"In\":[],\"Out\":[{\"Name\":\"Time\",\"Ident\":\"time.Time\",\"Kind\":25,\"PkgPath\":\"time\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"tag\":\"json:\\\"updateTime\\\"\",\"default\":true,\"default_kind\":19,\"position\":{\"Index\":1,\"MixedIn\":true,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"datetime\",\"postgres\":\"timestamp\",\"sqlite3\":\"datetime\"}},{\"name\":\"username\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"unique\":true,\"position\":{\"Index\":0,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"password\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"position\":{\"Index\":1,\"MixedIn\":false,\"MixinIndex\":0},\"sensitive\":true},{\"name\":\"email\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"unique\":true,\"validators\":1,\"position\":{\"Index\":2,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"invite_code\",\"type\":{\"Type\":7,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"unique\":true,\"optional\":true,\"position\":{\"Index\":3,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"balance\",\"type\":{\"Type\":7,\"Ident\":\"decimal.Decimal\",\"PkgPath\":\"github.com/shopspring/decimal\",\"PkgName\":\"decimal\",\"Nillable\":false,\"RType\":{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":{\"Abs\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Add\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Atan\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"BigFloat\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Float\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"BigInt\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"Ceil\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Cmp\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Coefficient\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"CoefficientInt64\":{\"In\":[],\"Out\":[{\"Name\":\"int64\",\"Ident\":\"int64\",\"Kind\":6,\"PkgPath\":\"\",\"Methods\":null}]},\"Compare\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Copy\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Cos\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Div\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"DivRound\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Equal\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Equals\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"ExpHullAbrham\":{\"In\":[{\"Name\":\"uint32\",\"Ident\":\"uint32\",\"Kind\":10,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"ExpTaylor\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Exponent\":{\"In\":[],\"Out\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}]},\"Float64\":{\"In\":[],\"Out\":[{\"Name\":\"float64\",\"Ident\":\"float64\",\"Kind\":14,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Floor\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"GobDecode\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"GobEncode\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"GreaterThan\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"GreaterThanOrEqual\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"InexactFloat64\":{\"In\":[],\"Out\":[{\"Name\":\"float64\",\"Ident\":\"float64\",\"Kind\":14,\"PkgPath\":\"\",\"Methods\":null}]},\"IntPart\":{\"In\":[],\"Out\":[{\"Name\":\"int64\",\"Ident\":\"int64\",\"Kind\":6,\"PkgPath\":\"\",\"Methods\":null}]},\"IsInteger\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsNegative\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsPositive\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsZero\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"LessThan\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"LessThanOrEqual\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Ln\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalBinary\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalText\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Mod\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Mul\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Neg\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"NumDigits\":{\"In\":[],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Pow\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"PowBigInt\":{\"In\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"PowInt32\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"PowWithPrecision\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"QuoRem\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Rat\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Rat\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"Round\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundBank\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundCash\":{\"In\":[{\"Name\":\"uint8\",\"Ident\":\"uint8\",\"Kind\":8,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundCeil\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundDown\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundFloor\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundUp\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Shift\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Sign\":{\"In\":[],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Sin\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixed\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixedBank\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixedCash\":{\"In\":[{\"Name\":\"uint8\",\"Ident\":\"uint8\",\"Kind\":8,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringScaled\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Sub\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Tan\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Truncate\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"UnmarshalBinary\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalText\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"default\":true,\"default_kind\":19,\"position\":{\"Index\":4,\"MixedIn\":false,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"decimal(10,2)\",\"postgres\":\"numeric(10,2)\"}},{\"name\":\"block\",\"type\":{\"Type\":1,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"default\":true,\"default_value\":false,\"default_kind\":1,\"position\":{\"Index\":5,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"verify\",\"type\":{\"Type\":1,\"Ident\":\"\",\"PkgPath\":\"\",\"PkgName\":\"\",\"Nillable\":false,\"RType\":null},\"default\":true,\"default_value\":false,\"default_kind\":1,\"position\":{\"Index\":6,\"MixedIn\":false,\"MixinIndex\":0}},{\"name\":\"invite_cashback\",\"type\":{\"Type\":7,\"Ident\":\"decimal.Decimal\",\"PkgPath\":\"github.com/shopspring/decimal\",\"PkgName\":\"decimal\",\"Nillable\":false,\"RType\":{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":{\"Abs\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Add\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Atan\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"BigFloat\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Float\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"BigInt\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"Ceil\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Cmp\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Coefficient\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"CoefficientInt64\":{\"In\":[],\"Out\":[{\"Name\":\"int64\",\"Ident\":\"int64\",\"Kind\":6,\"PkgPath\":\"\",\"Methods\":null}]},\"Compare\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Copy\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Cos\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Div\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"DivRound\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Equal\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Equals\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"ExpHullAbrham\":{\"In\":[{\"Name\":\"uint32\",\"Ident\":\"uint32\",\"Kind\":10,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"ExpTaylor\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Exponent\":{\"In\":[],\"Out\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}]},\"Float64\":{\"In\":[],\"Out\":[{\"Name\":\"float64\",\"Ident\":\"float64\",\"Kind\":14,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Floor\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"GobDecode\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"GobEncode\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"GreaterThan\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"GreaterThanOrEqual\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"InexactFloat64\":{\"In\":[],\"Out\":[{\"Name\":\"float64\",\"Ident\":\"float64\",\"Kind\":14,\"PkgPath\":\"\",\"Methods\":null}]},\"IntPart\":{\"In\":[],\"Out\":[{\"Name\":\"int64\",\"Ident\":\"int64\",\"Kind\":6,\"PkgPath\":\"\",\"Methods\":null}]},\"IsInteger\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsNegative\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsPositive\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"IsZero\":{\"In\":[],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"LessThan\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"LessThanOrEqual\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"bool\",\"Ident\":\"bool\",\"Kind\":1,\"PkgPath\":\"\",\"Methods\":null}]},\"Ln\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalBinary\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalJSON\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"MarshalText\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Mod\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Mul\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Neg\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"NumDigits\":{\"In\":[],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Pow\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"PowBigInt\":{\"In\":[{\"Name\":\"\",\"Ident\":\"*big.Int\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"PowInt32\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"PowWithPrecision\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"QuoRem\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null},{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Rat\":{\"In\":[],\"Out\":[{\"Name\":\"\",\"Ident\":\"*big.Rat\",\"Kind\":22,\"PkgPath\":\"\",\"Methods\":null}]},\"Round\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundBank\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundCash\":{\"In\":[{\"Name\":\"uint8\",\"Ident\":\"uint8\",\"Kind\":8,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundCeil\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundDown\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundFloor\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"RoundUp\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Scan\":{\"In\":[{\"Name\":\"\",\"Ident\":\"interface {}\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Shift\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Sign\":{\"In\":[],\"Out\":[{\"Name\":\"int\",\"Ident\":\"int\",\"Kind\":2,\"PkgPath\":\"\",\"Methods\":null}]},\"Sin\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"String\":{\"In\":[],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixed\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixedBank\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringFixedCash\":{\"In\":[{\"Name\":\"uint8\",\"Ident\":\"uint8\",\"Kind\":8,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"StringScaled\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"string\",\"Ident\":\"string\",\"Kind\":24,\"PkgPath\":\"\",\"Methods\":null}]},\"Sub\":{\"In\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Tan\":{\"In\":[],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"Truncate\":{\"In\":[{\"Name\":\"int32\",\"Ident\":\"int32\",\"Kind\":5,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"Decimal\",\"Ident\":\"decimal.Decimal\",\"Kind\":25,\"PkgPath\":\"github.com/shopspring/decimal\",\"Methods\":null}]},\"UnmarshalBinary\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalJSON\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"UnmarshalText\":{\"In\":[{\"Name\":\"\",\"Ident\":\"[]uint8\",\"Kind\":23,\"PkgPath\":\"\",\"Methods\":null}],\"Out\":[{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]},\"Value\":{\"In\":[],\"Out\":[{\"Name\":\"Value\",\"Ident\":\"driver.Value\",\"Kind\":20,\"PkgPath\":\"database/sql/driver\",\"Methods\":null},{\"Name\":\"error\",\"Ident\":\"error\",\"Kind\":20,\"PkgPath\":\"\",\"Methods\":null}]}}}},\"default\":true,\"default_kind\":19,\"position\":{\"Index\":7,\"MixedIn\":false,\"MixinIndex\":0},\"schema_type\":{\"mysql\":\"decimal(10,2)\",\"postgres\":\"numeric(10,2)\"}}],\"hooks\":[{\"Index\":0,\"MixedIn\":true,\"MixinIndex\":0}],\"annotations\":{\"EntSQL\":{\"increment_start\":38654705664,\"table\":\"sys_user\"}}},{\"name\":\"SysUserLog\",\"config\":{\"Table\":\"\"}}],\"Features\":[\"privacy\",\"intercept\",\"entql\",\"namedges\",\"bidiedges\",\"schema/snapshot\",\"sql/schemaconfig\",\"sql/lock\",\"sql/modifier\",\"sql/execquery\",\"sql/upsert\",\"sql/versioned-migration\",\"sql/globalid\"]}" diff --git a/internal/ent/internal/schemaconfig.go b/internal/ent/internal/schemaconfig.go new file mode 100644 index 0000000..0cb3bf2 --- /dev/null +++ b/internal/ent/internal/schemaconfig.go @@ -0,0 +1,36 @@ +// ENT数据库文件,请勿编辑。 + +package internal + +import "context" + +// SchemaConfig represents alternative schema names for all tables +// that can be passed at runtime. +type SchemaConfig struct { + CpImage string // CpImage table. + CpSchool string // CpSchool table. + CpTask string // CpTask table. + CpTaskLog string // CpTaskLog table. + CpUser string // CpUser table. + SysAgent string // SysAgent table. + SysCard string // SysCard table. + SysMenu string // SysMenu table. + SysRole string // SysRole table. + SysRoleMenus string // SysRole-menus->SysMenu table. + SysUser string // SysUser table. + SysUserRoles string // SysUser-roles->SysRole table. + SysUserLog string // SysUserLog table. +} + +type schemaCtxKey struct{} + +// SchemaConfigFromContext returns a SchemaConfig stored inside a context, or empty if there isn't one. +func SchemaConfigFromContext(ctx context.Context) SchemaConfig { + config, _ := ctx.Value(schemaCtxKey{}).(SchemaConfig) + return config +} + +// NewSchemaConfigContext returns a new context with the given SchemaConfig attached. +func NewSchemaConfigContext(parent context.Context, config SchemaConfig) context.Context { + return context.WithValue(parent, schemaCtxKey{}, config) +} diff --git a/internal/ent/migrate/migrate.go b/internal/ent/migrate/migrate.go index 22790c1..b4bb366 100644 --- a/internal/ent/migrate/migrate.go +++ b/internal/ent/migrate/migrate.go @@ -54,6 +54,38 @@ func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...sche return migrate.Create(ctx, tables...) } +// Diff compares the state read from a database connection or migration directory with +// the state defined by the Ent schema. Changes will be written to new migration files. +func Diff(ctx context.Context, url string, opts ...schema.MigrateOption) error { + return NamedDiff(ctx, url, "changes", opts...) +} + +// NamedDiff compares the state read from a database connection or migration directory with +// the state defined by the Ent schema. Changes will be written to new named migration files. +func NamedDiff(ctx context.Context, url, name string, opts ...schema.MigrateOption) error { + return schema.Diff(ctx, url, name, Tables, opts...) +} + +// Diff creates a migration file containing the statements to resolve the diff +// between the Ent schema and the connected database. +func (s *Schema) Diff(ctx context.Context, opts ...schema.MigrateOption) error { + migrate, err := schema.NewMigrate(s.drv, opts...) + if err != nil { + return fmt.Errorf("ent/migrate: %w", err) + } + return migrate.Diff(ctx, Tables...) +} + +// NamedDiff creates a named migration file containing the statements to resolve the diff +// between the Ent schema and the connected database. +func (s *Schema) NamedDiff(ctx context.Context, name string, opts ...schema.MigrateOption) error { + migrate, err := schema.NewMigrate(s.drv, opts...) + if err != nil { + return fmt.Errorf("ent/migrate: %w", err) + } + return migrate.NamedDiff(ctx, name, Tables...) +} + // WriteTo writes the schema changes to w instead of running them against the database. // // if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil { diff --git a/internal/ent/migrate/schema.go b/internal/ent/migrate/schema.go index edd9908..ef9933d 100644 --- a/internal/ent/migrate/schema.go +++ b/internal/ent/migrate/schema.go @@ -371,35 +371,56 @@ var ( func init() { CpImageTable.ForeignKeys[0].RefTable = SysUserTable CpImageTable.Annotation = &entsql.Annotation{ - Table: "cp_image", + Table: "cp_image", + IncrementStart: func(i int) *int { return &i }(0), + } + CpSchoolsTable.Annotation = &entsql.Annotation{ + IncrementStart: func(i int) *int { return &i }(4294967296), } CpTasksTable.ForeignKeys[0].RefTable = CpUsersTable CpTasksTable.ForeignKeys[1].RefTable = SysUserTable + CpTasksTable.Annotation = &entsql.Annotation{ + IncrementStart: func(i int) *int { return &i }(8589934592), + } CpTaskLogsTable.ForeignKeys[0].RefTable = CpTasksTable CpTaskLogsTable.ForeignKeys[1].RefTable = CpUsersTable CpTaskLogsTable.ForeignKeys[2].RefTable = SysUserTable + CpTaskLogsTable.Annotation = &entsql.Annotation{ + IncrementStart: func(i int) *int { return &i }(12884901888), + } CpUsersTable.ForeignKeys[0].RefTable = CpSchoolsTable CpUsersTable.ForeignKeys[1].RefTable = SysUserTable + CpUsersTable.Annotation = &entsql.Annotation{ + IncrementStart: func(i int) *int { return &i }(17179869184), + } SysAgentTable.ForeignKeys[0].RefTable = SysUserTable SysAgentTable.Annotation = &entsql.Annotation{ - Table: "sys_agent", + Table: "sys_agent", + IncrementStart: func(i int) *int { return &i }(21474836480), } SysCardTable.ForeignKeys[0].RefTable = SysUserTable SysCardTable.ForeignKeys[1].RefTable = SysUserTable SysCardTable.ForeignKeys[2].RefTable = SysUserTable SysCardTable.Annotation = &entsql.Annotation{ - Table: "sys_card", + Table: "sys_card", + IncrementStart: func(i int) *int { return &i }(25769803776), } SysMenuTable.ForeignKeys[0].RefTable = SysMenuTable SysMenuTable.Annotation = &entsql.Annotation{ - Table: "sys_menu", + Table: "sys_menu", + IncrementStart: func(i int) *int { return &i }(30064771072), } SysRoleTable.Annotation = &entsql.Annotation{ - Table: "sys_role", + Table: "sys_role", + IncrementStart: func(i int) *int { return &i }(34359738368), } SysUserTable.ForeignKeys[0].RefTable = SysUserTable SysUserTable.Annotation = &entsql.Annotation{ - Table: "sys_user", + Table: "sys_user", + IncrementStart: func(i int) *int { return &i }(38654705664), + } + SysUserLogsTable.Annotation = &entsql.Annotation{ + IncrementStart: func(i int) *int { return &i }(42949672960), } SysRoleMenusTable.ForeignKeys[0].RefTable = SysRoleTable SysRoleMenusTable.ForeignKeys[1].RefTable = SysMenuTable diff --git a/internal/ent/privacy/privacy.go b/internal/ent/privacy/privacy.go new file mode 100644 index 0000000..d744599 --- /dev/null +++ b/internal/ent/privacy/privacy.go @@ -0,0 +1,467 @@ +// ENT数据库文件,请勿编辑。 + +package privacy + +import ( + "context" + + "likedream-goframe/internal/ent" + + "entgo.io/ent/entql" + "entgo.io/ent/privacy" +) + +var ( + // Allow may be returned by rules to indicate that the policy + // evaluation should terminate with allow decision. + Allow = privacy.Allow + + // Deny may be returned by rules to indicate that the policy + // evaluation should terminate with deny decision. + Deny = privacy.Deny + + // Skip may be returned by rules to indicate that the policy + // evaluation should continue to the next rule. + Skip = privacy.Skip +) + +// Allowf returns a formatted wrapped Allow decision. +func Allowf(format string, a ...any) error { + return privacy.Allowf(format, a...) +} + +// Denyf returns a formatted wrapped Deny decision. +func Denyf(format string, a ...any) error { + return privacy.Denyf(format, a...) +} + +// Skipf returns a formatted wrapped Skip decision. +func Skipf(format string, a ...any) error { + return privacy.Skipf(format, a...) +} + +// DecisionContext creates a new context from the given parent context with +// a policy decision attach to it. +func DecisionContext(parent context.Context, decision error) context.Context { + return privacy.DecisionContext(parent, decision) +} + +// DecisionFromContext retrieves the policy decision from the context. +func DecisionFromContext(ctx context.Context) (error, bool) { + return privacy.DecisionFromContext(ctx) +} + +type ( + // Policy groups query and mutation policies. + Policy = privacy.Policy + + // QueryRule defines the interface deciding whether a + // query is allowed and optionally modify it. + QueryRule = privacy.QueryRule + // QueryPolicy combines multiple query rules into a single policy. + QueryPolicy = privacy.QueryPolicy + + // MutationRule defines the interface which decides whether a + // mutation is allowed and optionally modifies it. + MutationRule = privacy.MutationRule + // MutationPolicy combines multiple mutation rules into a single policy. + MutationPolicy = privacy.MutationPolicy + // MutationRuleFunc type is an adapter which allows the use of + // ordinary functions as mutation rules. + MutationRuleFunc = privacy.MutationRuleFunc + + // QueryMutationRule is an interface which groups query and mutation rules. + QueryMutationRule = privacy.QueryMutationRule +) + +// QueryRuleFunc type is an adapter to allow the use of +// ordinary functions as query rules. +type QueryRuleFunc func(context.Context, ent.Query) error + +// Eval returns f(ctx, q). +func (f QueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + return f(ctx, q) +} + +// AlwaysAllowRule returns a rule that returns an allow decision. +func AlwaysAllowRule() QueryMutationRule { + return privacy.AlwaysAllowRule() +} + +// AlwaysDenyRule returns a rule that returns a deny decision. +func AlwaysDenyRule() QueryMutationRule { + return privacy.AlwaysDenyRule() +} + +// ContextQueryMutationRule creates a query/mutation rule from a context eval func. +func ContextQueryMutationRule(eval func(context.Context) error) QueryMutationRule { + return privacy.ContextQueryMutationRule(eval) +} + +// OnMutationOperation evaluates the given rule only on a given mutation operation. +func OnMutationOperation(rule MutationRule, op ent.Op) MutationRule { + return privacy.OnMutationOperation(rule, op) +} + +// DenyMutationOperationRule returns a rule denying specified mutation operation. +func DenyMutationOperationRule(op ent.Op) MutationRule { + rule := MutationRuleFunc(func(_ context.Context, m ent.Mutation) error { + return Denyf("ent/privacy: operation %s is not allowed", m.Op()) + }) + return OnMutationOperation(rule, op) +} + +// The CpImageQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type CpImageQueryRuleFunc func(context.Context, *ent.CpImageQuery) error + +// EvalQuery return f(ctx, q). +func (f CpImageQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpImageQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.CpImageQuery", q) +} + +// The CpImageMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type CpImageMutationRuleFunc func(context.Context, *ent.CpImageMutation) error + +// EvalMutation calls f(ctx, m). +func (f CpImageMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.CpImageMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.CpImageMutation", m) +} + +// The CpSchoolQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type CpSchoolQueryRuleFunc func(context.Context, *ent.CpSchoolQuery) error + +// EvalQuery return f(ctx, q). +func (f CpSchoolQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpSchoolQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.CpSchoolQuery", q) +} + +// The CpSchoolMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type CpSchoolMutationRuleFunc func(context.Context, *ent.CpSchoolMutation) error + +// EvalMutation calls f(ctx, m). +func (f CpSchoolMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.CpSchoolMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.CpSchoolMutation", m) +} + +// The CpTaskQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type CpTaskQueryRuleFunc func(context.Context, *ent.CpTaskQuery) error + +// EvalQuery return f(ctx, q). +func (f CpTaskQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpTaskQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.CpTaskQuery", q) +} + +// The CpTaskMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type CpTaskMutationRuleFunc func(context.Context, *ent.CpTaskMutation) error + +// EvalMutation calls f(ctx, m). +func (f CpTaskMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.CpTaskMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.CpTaskMutation", m) +} + +// The CpTaskLogQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type CpTaskLogQueryRuleFunc func(context.Context, *ent.CpTaskLogQuery) error + +// EvalQuery return f(ctx, q). +func (f CpTaskLogQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpTaskLogQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.CpTaskLogQuery", q) +} + +// The CpTaskLogMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type CpTaskLogMutationRuleFunc func(context.Context, *ent.CpTaskLogMutation) error + +// EvalMutation calls f(ctx, m). +func (f CpTaskLogMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.CpTaskLogMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.CpTaskLogMutation", m) +} + +// The CpUserQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type CpUserQueryRuleFunc func(context.Context, *ent.CpUserQuery) error + +// EvalQuery return f(ctx, q). +func (f CpUserQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.CpUserQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.CpUserQuery", q) +} + +// The CpUserMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type CpUserMutationRuleFunc func(context.Context, *ent.CpUserMutation) error + +// EvalMutation calls f(ctx, m). +func (f CpUserMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.CpUserMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.CpUserMutation", m) +} + +// The SysAgentQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type SysAgentQueryRuleFunc func(context.Context, *ent.SysAgentQuery) error + +// EvalQuery return f(ctx, q). +func (f SysAgentQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysAgentQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.SysAgentQuery", q) +} + +// The SysAgentMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type SysAgentMutationRuleFunc func(context.Context, *ent.SysAgentMutation) error + +// EvalMutation calls f(ctx, m). +func (f SysAgentMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.SysAgentMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.SysAgentMutation", m) +} + +// The SysCardQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type SysCardQueryRuleFunc func(context.Context, *ent.SysCardQuery) error + +// EvalQuery return f(ctx, q). +func (f SysCardQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysCardQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.SysCardQuery", q) +} + +// The SysCardMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type SysCardMutationRuleFunc func(context.Context, *ent.SysCardMutation) error + +// EvalMutation calls f(ctx, m). +func (f SysCardMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.SysCardMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.SysCardMutation", m) +} + +// The SysMenuQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type SysMenuQueryRuleFunc func(context.Context, *ent.SysMenuQuery) error + +// EvalQuery return f(ctx, q). +func (f SysMenuQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysMenuQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.SysMenuQuery", q) +} + +// The SysMenuMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type SysMenuMutationRuleFunc func(context.Context, *ent.SysMenuMutation) error + +// EvalMutation calls f(ctx, m). +func (f SysMenuMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.SysMenuMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.SysMenuMutation", m) +} + +// The SysRoleQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type SysRoleQueryRuleFunc func(context.Context, *ent.SysRoleQuery) error + +// EvalQuery return f(ctx, q). +func (f SysRoleQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysRoleQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.SysRoleQuery", q) +} + +// The SysRoleMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type SysRoleMutationRuleFunc func(context.Context, *ent.SysRoleMutation) error + +// EvalMutation calls f(ctx, m). +func (f SysRoleMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.SysRoleMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.SysRoleMutation", m) +} + +// The SysUserQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type SysUserQueryRuleFunc func(context.Context, *ent.SysUserQuery) error + +// EvalQuery return f(ctx, q). +func (f SysUserQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysUserQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.SysUserQuery", q) +} + +// The SysUserMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type SysUserMutationRuleFunc func(context.Context, *ent.SysUserMutation) error + +// EvalMutation calls f(ctx, m). +func (f SysUserMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.SysUserMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.SysUserMutation", m) +} + +// The SysUserLogQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type SysUserLogQueryRuleFunc func(context.Context, *ent.SysUserLogQuery) error + +// EvalQuery return f(ctx, q). +func (f SysUserLogQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.SysUserLogQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.SysUserLogQuery", q) +} + +// The SysUserLogMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type SysUserLogMutationRuleFunc func(context.Context, *ent.SysUserLogMutation) error + +// EvalMutation calls f(ctx, m). +func (f SysUserLogMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.SysUserLogMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.SysUserLogMutation", m) +} + +type ( + // Filter is the interface that wraps the Where function + // for filtering nodes in queries and mutations. + Filter interface { + // Where applies a filter on the executed query/mutation. + Where(entql.P) + } + + // The FilterFunc type is an adapter that allows the use of ordinary + // functions as filters for query and mutation types. + FilterFunc func(context.Context, Filter) error +) + +// EvalQuery calls f(ctx, q) if the query implements the Filter interface, otherwise it is denied. +func (f FilterFunc) EvalQuery(ctx context.Context, q ent.Query) error { + fr, err := queryFilter(q) + if err != nil { + return err + } + return f(ctx, fr) +} + +// EvalMutation calls f(ctx, q) if the mutation implements the Filter interface, otherwise it is denied. +func (f FilterFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + fr, err := mutationFilter(m) + if err != nil { + return err + } + return f(ctx, fr) +} + +var _ QueryMutationRule = FilterFunc(nil) + +func queryFilter(q ent.Query) (Filter, error) { + switch q := q.(type) { + case *ent.CpImageQuery: + return q.Filter(), nil + case *ent.CpSchoolQuery: + return q.Filter(), nil + case *ent.CpTaskQuery: + return q.Filter(), nil + case *ent.CpTaskLogQuery: + return q.Filter(), nil + case *ent.CpUserQuery: + return q.Filter(), nil + case *ent.SysAgentQuery: + return q.Filter(), nil + case *ent.SysCardQuery: + return q.Filter(), nil + case *ent.SysMenuQuery: + return q.Filter(), nil + case *ent.SysRoleQuery: + return q.Filter(), nil + case *ent.SysUserQuery: + return q.Filter(), nil + case *ent.SysUserLogQuery: + return q.Filter(), nil + default: + return nil, Denyf("ent/privacy: unexpected query type %T for query filter", q) + } +} + +func mutationFilter(m ent.Mutation) (Filter, error) { + switch m := m.(type) { + case *ent.CpImageMutation: + return m.Filter(), nil + case *ent.CpSchoolMutation: + return m.Filter(), nil + case *ent.CpTaskMutation: + return m.Filter(), nil + case *ent.CpTaskLogMutation: + return m.Filter(), nil + case *ent.CpUserMutation: + return m.Filter(), nil + case *ent.SysAgentMutation: + return m.Filter(), nil + case *ent.SysCardMutation: + return m.Filter(), nil + case *ent.SysMenuMutation: + return m.Filter(), nil + case *ent.SysRoleMutation: + return m.Filter(), nil + case *ent.SysUserMutation: + return m.Filter(), nil + case *ent.SysUserLogMutation: + return m.Filter(), nil + default: + return nil, Denyf("ent/privacy: unexpected mutation type %T for mutation filter", m) + } +} diff --git a/internal/ent/sysagent/where.go b/internal/ent/sysagent/where.go index 8473007..1e14c2d 100644 --- a/internal/ent/sysagent/where.go +++ b/internal/ent/sysagent/where.go @@ -3,6 +3,7 @@ package sysagent import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/framework/ent2" @@ -333,6 +334,9 @@ func HasUsers() predicate.SysAgent { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2O, true, UsersTable, UsersColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysAgent sqlgraph.HasNeighbors(s, step) }) } @@ -341,6 +345,9 @@ func HasUsers() predicate.SysAgent { func HasUsersWith(preds ...predicate.SysUser) predicate.SysAgent { return predicate.SysAgent(func(s *sql.Selector) { step := newUsersStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysAgent sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/sysagent_create.go b/internal/ent/sysagent_create.go index fa55717..1896d00 100644 --- a/internal/ent/sysagent_create.go +++ b/internal/ent/sysagent_create.go @@ -161,6 +161,7 @@ func (_c *SysAgentCreate) createSpec() (*SysAgent, *sqlgraph.CreateSpec) { _node = &SysAgent{config: _c.config} _spec = sqlgraph.NewCreateSpec(sysagent.Table, sqlgraph.NewFieldSpec(sysagent.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.SysAgent _spec.OnConflict = _c.conflict if value, ok := _c.mutation.CreateTime(); ok { _spec.SetField(sysagent.FieldCreateTime, field.TypeString, value) @@ -189,6 +190,7 @@ func (_c *SysAgentCreate) createSpec() (*SysAgent, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysAgent for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/sysagent_delete.go b/internal/ent/sysagent_delete.go index 4c238dd..49d9f27 100644 --- a/internal/ent/sysagent_delete.go +++ b/internal/ent/sysagent_delete.go @@ -4,6 +4,7 @@ package ent import ( "context" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysagent" @@ -41,6 +42,8 @@ func (_d *SysAgentDelete) ExecX(ctx context.Context) int { func (_d *SysAgentDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(sysagent.Table, sqlgraph.NewFieldSpec(sysagent.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.SysAgent + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/sysagent_query.go b/internal/ent/sysagent_query.go index 87b9fdc..f6ca275 100644 --- a/internal/ent/sysagent_query.go +++ b/internal/ent/sysagent_query.go @@ -5,12 +5,14 @@ package ent import ( "context" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysagent" "likedream-goframe/internal/ent/sysuser" "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -25,6 +27,7 @@ type SysAgentQuery struct { predicates []predicate.SysAgent withUsers *SysUserQuery withFKs bool + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -77,6 +80,9 @@ func (_q *SysAgentQuery) QueryUsers() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.O2O, true, sysagent.UsersTable, sysagent.UsersColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysAgent fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -277,8 +283,9 @@ func (_q *SysAgentQuery) Clone() *SysAgentQuery { predicates: append([]predicate.SysAgent{}, _q.predicates...), withUsers: _q.withUsers.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -391,6 +398,11 @@ func (_q *SysAgentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Sys node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.SysAgent + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -402,7 +414,12 @@ func (_q *SysAgentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Sys } if query := _q.withUsers; query != nil { if err := _q.loadUsers(ctx, query, nodes, nil, - func(n *SysAgent, e *SysUser) { n.Edges.Users = e }); err != nil { + func(n *SysAgent, e *SysUser) { + n.Edges.Users = e + if !e.Edges.loadedTypes[3] { + e.Edges.Agent = n + } + }); err != nil { return nil, err } } @@ -444,6 +461,11 @@ func (_q *SysAgentQuery) loadUsers(ctx context.Context, query *SysUserQuery, nod func (_q *SysAgentQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.SysAgent + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -506,6 +528,12 @@ func (_q *SysAgentQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.SysAgent) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -523,6 +551,38 @@ func (_q *SysAgentQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *SysAgentQuery) ForUpdate(opts ...sql.LockOption) *SysAgentQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *SysAgentQuery) ForShare(opts ...sql.LockOption) *SysAgentQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *SysAgentQuery) Modify(modifiers ...func(s *sql.Selector)) *SysAgentSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + // SysAgentGroupBy is the group-by builder for SysAgent entities. type SysAgentGroupBy struct { selector @@ -612,3 +672,9 @@ func (_s *SysAgentSelect) sqlScan(ctx context.Context, root *SysAgentQuery, v an defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *SysAgentSelect) Modify(modifiers ...func(s *sql.Selector)) *SysAgentSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/sysagent_update.go b/internal/ent/sysagent_update.go index 55139d5..cb8c5c8 100644 --- a/internal/ent/sysagent_update.go +++ b/internal/ent/sysagent_update.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysagent" "likedream-goframe/internal/ent/sysuser" @@ -20,8 +21,9 @@ import ( // SysAgentUpdate is the builder for updating SysAgent entities. type SysAgentUpdate struct { config - hooks []Hook - mutation *SysAgentMutation + hooks []Hook + mutation *SysAgentMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the SysAgentUpdate builder. @@ -128,6 +130,12 @@ func (_u *SysAgentUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysAgentUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysAgentUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysAgentUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(sysagent.Table, sysagent.Columns, sqlgraph.NewFieldSpec(sysagent.FieldID, field.TypeInt64)) if ps := _u.mutation.predicates; len(ps) > 0 { @@ -160,6 +168,7 @@ func (_u *SysAgentUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysAgent _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.UsersIDs(); len(nodes) > 0 { @@ -173,11 +182,15 @@ func (_u *SysAgentUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysAgent for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysAgent + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{sysagent.Label} @@ -193,9 +206,10 @@ func (_u *SysAgentUpdate) sqlSave(ctx context.Context) (_node int, err error) { // SysAgentUpdateOne is the builder for updating a single SysAgent entity. type SysAgentUpdateOne struct { config - fields []string - hooks []Hook - mutation *SysAgentMutation + fields []string + hooks []Hook + mutation *SysAgentMutation + modifiers []func(*sql.UpdateBuilder) } // SetUpdateTime sets the "update_time" field. @@ -309,6 +323,12 @@ func (_u *SysAgentUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysAgentUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysAgentUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysAgentUpdateOne) sqlSave(ctx context.Context) (_node *SysAgent, err error) { _spec := sqlgraph.NewUpdateSpec(sysagent.Table, sysagent.Columns, sqlgraph.NewFieldSpec(sysagent.FieldID, field.TypeInt64)) id, ok := _u.mutation.ID() @@ -358,6 +378,7 @@ func (_u *SysAgentUpdateOne) sqlSave(ctx context.Context) (_node *SysAgent, err IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysAgent _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.UsersIDs(); len(nodes) > 0 { @@ -371,11 +392,15 @@ func (_u *SysAgentUpdateOne) sqlSave(ctx context.Context) (_node *SysAgent, err IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysAgent for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysAgent + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &SysAgent{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/syscard/where.go b/internal/ent/syscard/where.go index 2a3051c..1f693cf 100644 --- a/internal/ent/syscard/where.go +++ b/internal/ent/syscard/where.go @@ -3,6 +3,7 @@ package syscard import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/framework/ent2" @@ -543,6 +544,9 @@ func HasCreator() predicate.SysCard { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, CreatorTable, CreatorColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighbors(s, step) }) } @@ -551,6 +555,9 @@ func HasCreator() predicate.SysCard { func HasCreatorWith(preds ...predicate.SysUser) predicate.SysCard { return predicate.SysCard(func(s *sql.Selector) { step := newCreatorStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -566,6 +573,9 @@ func HasUser() predicate.SysCard { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighbors(s, step) }) } @@ -574,6 +584,9 @@ func HasUser() predicate.SysCard { func HasUserWith(preds ...predicate.SysUser) predicate.SysCard { return predicate.SysCard(func(s *sql.Selector) { step := newUserStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -589,6 +602,9 @@ func HasCashUser() predicate.SysCard { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, CashUserTable, CashUserColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighbors(s, step) }) } @@ -597,6 +613,9 @@ func HasCashUser() predicate.SysCard { func HasCashUserWith(preds ...predicate.SysUser) predicate.SysCard { return predicate.SysCard(func(s *sql.Selector) { step := newCashUserStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/syscard_create.go b/internal/ent/syscard_create.go index f665726..56698ea 100644 --- a/internal/ent/syscard_create.go +++ b/internal/ent/syscard_create.go @@ -256,6 +256,7 @@ func (_c *SysCardCreate) createSpec() (*SysCard, *sqlgraph.CreateSpec) { _node = &SysCard{config: _c.config} _spec = sqlgraph.NewCreateSpec(syscard.Table, sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.SysCard _spec.OnConflict = _c.conflict if value, ok := _c.mutation.CreateTime(); ok { _spec.SetField(syscard.FieldCreateTime, field.TypeString, value) @@ -292,6 +293,7 @@ func (_c *SysCardCreate) createSpec() (*SysCard, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -309,6 +311,7 @@ func (_c *SysCardCreate) createSpec() (*SysCard, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -326,6 +329,7 @@ func (_c *SysCardCreate) createSpec() (*SysCard, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/syscard_delete.go b/internal/ent/syscard_delete.go index 16cf809..02ebe59 100644 --- a/internal/ent/syscard_delete.go +++ b/internal/ent/syscard_delete.go @@ -4,6 +4,7 @@ package ent import ( "context" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/syscard" @@ -41,6 +42,8 @@ func (_d *SysCardDelete) ExecX(ctx context.Context) int { func (_d *SysCardDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(syscard.Table, sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.SysCard + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/syscard_query.go b/internal/ent/syscard_query.go index 776232d..84942fd 100644 --- a/internal/ent/syscard_query.go +++ b/internal/ent/syscard_query.go @@ -5,12 +5,14 @@ package ent import ( "context" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/syscard" "likedream-goframe/internal/ent/sysuser" "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -26,6 +28,7 @@ type SysCardQuery struct { withCreator *SysUserQuery withUser *SysUserQuery withCashUser *SysUserQuery + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -78,6 +81,9 @@ func (_q *SysCardQuery) QueryCreator() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, syscard.CreatorTable, syscard.CreatorColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -100,6 +106,9 @@ func (_q *SysCardQuery) QueryUser() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, syscard.UserTable, syscard.UserColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -122,6 +131,9 @@ func (_q *SysCardQuery) QueryCashUser() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, syscard.CashUserTable, syscard.CashUserColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysCard fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -324,8 +336,9 @@ func (_q *SysCardQuery) Clone() *SysCardQuery { withUser: _q.withUser.Clone(), withCashUser: _q.withCashUser.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -455,6 +468,11 @@ func (_q *SysCardQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*SysC node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.SysCard + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -575,6 +593,11 @@ func (_q *SysCardQuery) loadCashUser(ctx context.Context, query *SysUserQuery, n func (_q *SysCardQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.SysCard + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -646,6 +669,12 @@ func (_q *SysCardQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.SysCard) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -663,6 +692,38 @@ func (_q *SysCardQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *SysCardQuery) ForUpdate(opts ...sql.LockOption) *SysCardQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *SysCardQuery) ForShare(opts ...sql.LockOption) *SysCardQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *SysCardQuery) Modify(modifiers ...func(s *sql.Selector)) *SysCardSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + // SysCardGroupBy is the group-by builder for SysCard entities. type SysCardGroupBy struct { selector @@ -752,3 +813,9 @@ func (_s *SysCardSelect) sqlScan(ctx context.Context, root *SysCardQuery, v any) defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *SysCardSelect) Modify(modifiers ...func(s *sql.Selector)) *SysCardSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/syscard_update.go b/internal/ent/syscard_update.go index 966e0dd..bda32e9 100644 --- a/internal/ent/syscard_update.go +++ b/internal/ent/syscard_update.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/syscard" "likedream-goframe/internal/ent/sysuser" @@ -20,8 +21,9 @@ import ( // SysCardUpdate is the builder for updating SysCard entities. type SysCardUpdate struct { config - hooks []Hook - mutation *SysCardMutation + hooks []Hook + mutation *SysCardMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the SysCardUpdate builder. @@ -247,6 +249,12 @@ func (_u *SysCardUpdate) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysCardUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysCardUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysCardUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err @@ -291,6 +299,7 @@ func (_u *SysCardUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CreatorIDs(); len(nodes) > 0 { @@ -304,6 +313,7 @@ func (_u *SysCardUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -320,6 +330,7 @@ func (_u *SysCardUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.UserIDs(); len(nodes) > 0 { @@ -333,6 +344,7 @@ func (_u *SysCardUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -349,6 +361,7 @@ func (_u *SysCardUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CashUserIDs(); len(nodes) > 0 { @@ -362,11 +375,15 @@ func (_u *SysCardUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysCard + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{syscard.Label} @@ -382,9 +399,10 @@ func (_u *SysCardUpdate) sqlSave(ctx context.Context) (_node int, err error) { // SysCardUpdateOne is the builder for updating a single SysCard entity. type SysCardUpdateOne struct { config - fields []string - hooks []Hook - mutation *SysCardMutation + fields []string + hooks []Hook + mutation *SysCardMutation + modifiers []func(*sql.UpdateBuilder) } // SetUpdateTime sets the "update_time" field. @@ -617,6 +635,12 @@ func (_u *SysCardUpdateOne) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysCardUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysCardUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysCardUpdateOne) sqlSave(ctx context.Context) (_node *SysCard, err error) { if err := _u.check(); err != nil { return _node, err @@ -678,6 +702,7 @@ func (_u *SysCardUpdateOne) sqlSave(ctx context.Context) (_node *SysCard, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CreatorIDs(); len(nodes) > 0 { @@ -691,6 +716,7 @@ func (_u *SysCardUpdateOne) sqlSave(ctx context.Context) (_node *SysCard, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -707,6 +733,7 @@ func (_u *SysCardUpdateOne) sqlSave(ctx context.Context) (_node *SysCard, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.UserIDs(); len(nodes) > 0 { @@ -720,6 +747,7 @@ func (_u *SysCardUpdateOne) sqlSave(ctx context.Context) (_node *SysCard, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -736,6 +764,7 @@ func (_u *SysCardUpdateOne) sqlSave(ctx context.Context) (_node *SysCard, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.CashUserIDs(); len(nodes) > 0 { @@ -749,11 +778,15 @@ func (_u *SysCardUpdateOne) sqlSave(ctx context.Context) (_node *SysCard, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysCard + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &SysCard{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/sysmenu.go b/internal/ent/sysmenu.go index 99c97c9..b53dbcb 100644 --- a/internal/ent/sysmenu.go +++ b/internal/ent/sysmenu.go @@ -58,7 +58,9 @@ type SysMenuEdges struct { Children []*SysMenu `json:"children,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [3]bool + loadedTypes [3]bool + namedRoles map[string][]*SysRole + namedChildren map[string][]*SysMenu } // RolesOrErr returns the Roles value or an error if the edge @@ -295,5 +297,53 @@ func (_m *SysMenu) String() string { return builder.String() } +// NamedRoles returns the Roles named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysMenu) NamedRoles(name string) ([]*SysRole, error) { + if _m.Edges.namedRoles == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedRoles[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysMenu) appendNamedRoles(name string, edges ...*SysRole) { + if _m.Edges.namedRoles == nil { + _m.Edges.namedRoles = make(map[string][]*SysRole) + } + if len(edges) == 0 { + _m.Edges.namedRoles[name] = []*SysRole{} + } else { + _m.Edges.namedRoles[name] = append(_m.Edges.namedRoles[name], edges...) + } +} + +// NamedChildren returns the Children named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysMenu) NamedChildren(name string) ([]*SysMenu, error) { + if _m.Edges.namedChildren == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedChildren[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysMenu) appendNamedChildren(name string, edges ...*SysMenu) { + if _m.Edges.namedChildren == nil { + _m.Edges.namedChildren = make(map[string][]*SysMenu) + } + if len(edges) == 0 { + _m.Edges.namedChildren[name] = []*SysMenu{} + } else { + _m.Edges.namedChildren[name] = append(_m.Edges.namedChildren[name], edges...) + } +} + // SysMenus is a parsable slice of SysMenu. type SysMenus []*SysMenu diff --git a/internal/ent/sysmenu/where.go b/internal/ent/sysmenu/where.go index 2c80da2..aa625c0 100644 --- a/internal/ent/sysmenu/where.go +++ b/internal/ent/sysmenu/where.go @@ -3,6 +3,7 @@ package sysmenu import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/framework/ent2" @@ -817,6 +818,9 @@ func HasRoles() predicate.SysMenu { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2M, true, RolesTable, RolesPrimaryKey...), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysRole + step.Edge.Schema = schemaConfig.SysRoleMenus sqlgraph.HasNeighbors(s, step) }) } @@ -825,6 +829,9 @@ func HasRoles() predicate.SysMenu { func HasRolesWith(preds ...predicate.SysRole) predicate.SysMenu { return predicate.SysMenu(func(s *sql.Selector) { step := newRolesStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysRole + step.Edge.Schema = schemaConfig.SysRoleMenus sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -840,6 +847,9 @@ func HasParent() predicate.SysMenu { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysMenu sqlgraph.HasNeighbors(s, step) }) } @@ -848,6 +858,9 @@ func HasParent() predicate.SysMenu { func HasParentWith(preds ...predicate.SysMenu) predicate.SysMenu { return predicate.SysMenu(func(s *sql.Selector) { step := newParentStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysMenu sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -863,6 +876,9 @@ func HasChildren() predicate.SysMenu { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, ChildrenTable, ChildrenColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysMenu sqlgraph.HasNeighbors(s, step) }) } @@ -871,6 +887,9 @@ func HasChildren() predicate.SysMenu { func HasChildrenWith(preds ...predicate.SysMenu) predicate.SysMenu { return predicate.SysMenu(func(s *sql.Selector) { step := newChildrenStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysMenu sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/sysmenu_create.go b/internal/ent/sysmenu_create.go index eb59c30..1b95320 100644 --- a/internal/ent/sysmenu_create.go +++ b/internal/ent/sysmenu_create.go @@ -299,6 +299,7 @@ func (_c *SysMenuCreate) createSpec() (*SysMenu, *sqlgraph.CreateSpec) { _node = &SysMenu{config: _c.config} _spec = sqlgraph.NewCreateSpec(sysmenu.Table, sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.SysMenu _spec.OnConflict = _c.conflict if value, ok := _c.mutation.CreateTime(); ok { _spec.SetField(sysmenu.FieldCreateTime, field.TypeString, value) @@ -359,6 +360,7 @@ func (_c *SysMenuCreate) createSpec() (*SysMenu, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -375,6 +377,7 @@ func (_c *SysMenuCreate) createSpec() (*SysMenu, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysMenu for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -392,6 +395,7 @@ func (_c *SysMenuCreate) createSpec() (*SysMenu, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysMenu for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/sysmenu_delete.go b/internal/ent/sysmenu_delete.go index 55bbf42..0be4197 100644 --- a/internal/ent/sysmenu_delete.go +++ b/internal/ent/sysmenu_delete.go @@ -4,6 +4,7 @@ package ent import ( "context" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysmenu" @@ -41,6 +42,8 @@ func (_d *SysMenuDelete) ExecX(ctx context.Context) int { func (_d *SysMenuDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(sysmenu.Table, sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.SysMenu + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/sysmenu_query.go b/internal/ent/sysmenu_query.go index d5dd8af..d7b2d28 100644 --- a/internal/ent/sysmenu_query.go +++ b/internal/ent/sysmenu_query.go @@ -6,12 +6,14 @@ import ( "context" "database/sql/driver" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysmenu" "likedream-goframe/internal/ent/sysrole" "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -20,14 +22,17 @@ import ( // SysMenuQuery is the builder for querying SysMenu entities. type SysMenuQuery struct { config - ctx *QueryContext - order []sysmenu.OrderOption - inters []Interceptor - predicates []predicate.SysMenu - withRoles *SysRoleQuery - withParent *SysMenuQuery - withChildren *SysMenuQuery - withFKs bool + ctx *QueryContext + order []sysmenu.OrderOption + inters []Interceptor + predicates []predicate.SysMenu + withRoles *SysRoleQuery + withParent *SysMenuQuery + withChildren *SysMenuQuery + withFKs bool + modifiers []func(*sql.Selector) + withNamedRoles map[string]*SysRoleQuery + withNamedChildren map[string]*SysMenuQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -80,6 +85,9 @@ func (_q *SysMenuQuery) QueryRoles() *SysRoleQuery { sqlgraph.To(sysrole.Table, sysrole.FieldID), sqlgraph.Edge(sqlgraph.M2M, true, sysmenu.RolesTable, sysmenu.RolesPrimaryKey...), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysRole + step.Edge.Schema = schemaConfig.SysRoleMenus fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -102,6 +110,9 @@ func (_q *SysMenuQuery) QueryParent() *SysMenuQuery { sqlgraph.To(sysmenu.Table, sysmenu.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, sysmenu.ParentTable, sysmenu.ParentColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysMenu fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -124,6 +135,9 @@ func (_q *SysMenuQuery) QueryChildren() *SysMenuQuery { sqlgraph.To(sysmenu.Table, sysmenu.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysmenu.ChildrenTable, sysmenu.ChildrenColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysMenu fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -326,8 +340,9 @@ func (_q *SysMenuQuery) Clone() *SysMenuQuery { withParent: _q.withParent.Clone(), withChildren: _q.withChildren.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -464,6 +479,11 @@ func (_q *SysMenuQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*SysM node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.SysMenu + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -489,7 +509,31 @@ func (_q *SysMenuQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*SysM if query := _q.withChildren; query != nil { if err := _q.loadChildren(ctx, query, nodes, func(n *SysMenu) { n.Edges.Children = []*SysMenu{} }, - func(n *SysMenu, e *SysMenu) { n.Edges.Children = append(n.Edges.Children, e) }); err != nil { + func(n *SysMenu, e *SysMenu) { + n.Edges.Children = append(n.Edges.Children, e) + if !e.Edges.loadedTypes[1] { + e.Edges.Parent = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedRoles { + if err := _q.loadRoles(ctx, query, nodes, + func(n *SysMenu) { n.appendNamedRoles(name) }, + func(n *SysMenu, e *SysRole) { n.appendNamedRoles(name, e) }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedChildren { + if err := _q.loadChildren(ctx, query, nodes, + func(n *SysMenu) { n.appendNamedChildren(name) }, + func(n *SysMenu, e *SysMenu) { + n.appendNamedChildren(name, e) + if !e.Edges.loadedTypes[1] { + e.Edges.Parent = n + } + }); err != nil { return nil, err } } @@ -509,6 +553,7 @@ func (_q *SysMenuQuery) loadRoles(ctx context.Context, query *SysRoleQuery, node } query.Where(func(s *sql.Selector) { joinT := sql.Table(sysmenu.RolesTable) + joinT.Schema(_q.schemaConfig.SysRoleMenus) s.Join(joinT).On(s.C(sysrole.FieldID), joinT.C(sysmenu.RolesPrimaryKey[0])) s.Where(sql.InValues(joinT.C(sysmenu.RolesPrimaryKey[1]), edgeIDs...)) columns := s.SelectedColumns() @@ -623,6 +668,11 @@ func (_q *SysMenuQuery) loadChildren(ctx context.Context, query *SysMenuQuery, n func (_q *SysMenuQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.SysMenu + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -685,6 +735,12 @@ func (_q *SysMenuQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.SysMenu) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -702,6 +758,66 @@ func (_q *SysMenuQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *SysMenuQuery) ForUpdate(opts ...sql.LockOption) *SysMenuQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *SysMenuQuery) ForShare(opts ...sql.LockOption) *SysMenuQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *SysMenuQuery) Modify(modifiers ...func(s *sql.Selector)) *SysMenuSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + +// WithNamedRoles tells the query-builder to eager-load the nodes that are connected to the "roles" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysMenuQuery) WithNamedRoles(name string, opts ...func(*SysRoleQuery)) *SysMenuQuery { + query := (&SysRoleClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedRoles == nil { + _q.withNamedRoles = make(map[string]*SysRoleQuery) + } + _q.withNamedRoles[name] = query + return _q +} + +// WithNamedChildren tells the query-builder to eager-load the nodes that are connected to the "children" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysMenuQuery) WithNamedChildren(name string, opts ...func(*SysMenuQuery)) *SysMenuQuery { + query := (&SysMenuClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedChildren == nil { + _q.withNamedChildren = make(map[string]*SysMenuQuery) + } + _q.withNamedChildren[name] = query + return _q +} + // SysMenuGroupBy is the group-by builder for SysMenu entities. type SysMenuGroupBy struct { selector @@ -791,3 +907,9 @@ func (_s *SysMenuSelect) sqlScan(ctx context.Context, root *SysMenuQuery, v any) defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *SysMenuSelect) Modify(modifiers ...func(s *sql.Selector)) *SysMenuSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/sysmenu_update.go b/internal/ent/sysmenu_update.go index fec0bd2..578e35b 100644 --- a/internal/ent/sysmenu_update.go +++ b/internal/ent/sysmenu_update.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysmenu" "likedream-goframe/internal/ent/sysrole" @@ -19,8 +20,9 @@ import ( // SysMenuUpdate is the builder for updating SysMenu entities. type SysMenuUpdate struct { config - hooks []Hook - mutation *SysMenuMutation + hooks []Hook + mutation *SysMenuMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the SysMenuUpdate builder. @@ -345,6 +347,12 @@ func (_u *SysMenuUpdate) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysMenuUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysMenuUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err @@ -416,6 +424,7 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedRolesIDs(); len(nodes) > 0 && !_u.mutation.RolesCleared() { @@ -429,6 +438,7 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -445,6 +455,7 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -461,6 +472,7 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 { @@ -474,6 +486,7 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -490,6 +503,7 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !_u.mutation.ChildrenCleared() { @@ -503,6 +517,7 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -519,11 +534,15 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysMenu + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{sysmenu.Label} @@ -539,9 +558,10 @@ func (_u *SysMenuUpdate) sqlSave(ctx context.Context) (_node int, err error) { // SysMenuUpdateOne is the builder for updating a single SysMenu entity. type SysMenuUpdateOne struct { config - fields []string - hooks []Hook - mutation *SysMenuMutation + fields []string + hooks []Hook + mutation *SysMenuMutation + modifiers []func(*sql.UpdateBuilder) } // SetUpdateTime sets the "update_time" field. @@ -873,6 +893,12 @@ func (_u *SysMenuUpdateOne) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysMenuUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysMenuUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err error) { if err := _u.check(); err != nil { return _node, err @@ -961,6 +987,7 @@ func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err er IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedRolesIDs(); len(nodes) > 0 && !_u.mutation.RolesCleared() { @@ -974,6 +1001,7 @@ func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err er IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -990,6 +1018,7 @@ func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err er IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1006,6 +1035,7 @@ func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err er IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 { @@ -1019,6 +1049,7 @@ func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err er IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1035,6 +1066,7 @@ func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err er IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !_u.mutation.ChildrenCleared() { @@ -1048,6 +1080,7 @@ func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err er IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1064,11 +1097,15 @@ func (_u *SysMenuUpdateOne) sqlSave(ctx context.Context) (_node *SysMenu, err er IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysMenu for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysMenu + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &SysMenu{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/sysrole.go b/internal/ent/sysrole.go index 65147ba..8bf7119 100644 --- a/internal/ent/sysrole.go +++ b/internal/ent/sysrole.go @@ -44,6 +44,8 @@ type SysRoleEdges struct { // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [2]bool + namedMenus map[string][]*SysMenu + namedUsers map[string][]*SysUser } // MenusOrErr returns the Menus value or an error if the edge @@ -199,5 +201,53 @@ func (_m *SysRole) String() string { return builder.String() } +// NamedMenus returns the Menus named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysRole) NamedMenus(name string) ([]*SysMenu, error) { + if _m.Edges.namedMenus == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedMenus[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysRole) appendNamedMenus(name string, edges ...*SysMenu) { + if _m.Edges.namedMenus == nil { + _m.Edges.namedMenus = make(map[string][]*SysMenu) + } + if len(edges) == 0 { + _m.Edges.namedMenus[name] = []*SysMenu{} + } else { + _m.Edges.namedMenus[name] = append(_m.Edges.namedMenus[name], edges...) + } +} + +// NamedUsers returns the Users named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysRole) NamedUsers(name string) ([]*SysUser, error) { + if _m.Edges.namedUsers == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedUsers[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysRole) appendNamedUsers(name string, edges ...*SysUser) { + if _m.Edges.namedUsers == nil { + _m.Edges.namedUsers = make(map[string][]*SysUser) + } + if len(edges) == 0 { + _m.Edges.namedUsers[name] = []*SysUser{} + } else { + _m.Edges.namedUsers[name] = append(_m.Edges.namedUsers[name], edges...) + } +} + // SysRoles is a parsable slice of SysRole. type SysRoles []*SysRole diff --git a/internal/ent/sysrole/where.go b/internal/ent/sysrole/where.go index b43895b..3d0b06f 100644 --- a/internal/ent/sysrole/where.go +++ b/internal/ent/sysrole/where.go @@ -3,6 +3,7 @@ package sysrole import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/framework/ent2" @@ -462,6 +463,9 @@ func HasMenus() predicate.SysRole { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2M, false, MenusTable, MenusPrimaryKey...), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysRoleMenus sqlgraph.HasNeighbors(s, step) }) } @@ -470,6 +474,9 @@ func HasMenus() predicate.SysRole { func HasMenusWith(preds ...predicate.SysMenu) predicate.SysRole { return predicate.SysRole(func(s *sql.Selector) { step := newMenusStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysRoleMenus sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -485,6 +492,9 @@ func HasUsers() predicate.SysRole { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2M, true, UsersTable, UsersPrimaryKey...), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUserRoles sqlgraph.HasNeighbors(s, step) }) } @@ -493,6 +503,9 @@ func HasUsers() predicate.SysRole { func HasUsersWith(preds ...predicate.SysUser) predicate.SysRole { return predicate.SysRole(func(s *sql.Selector) { step := newUsersStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUserRoles sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/sysrole_create.go b/internal/ent/sysrole_create.go index b3277ab..006a2c6 100644 --- a/internal/ent/sysrole_create.go +++ b/internal/ent/sysrole_create.go @@ -190,6 +190,7 @@ func (_c *SysRoleCreate) createSpec() (*SysRole, *sqlgraph.CreateSpec) { _node = &SysRole{config: _c.config} _spec = sqlgraph.NewCreateSpec(sysrole.Table, sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.SysRole _spec.OnConflict = _c.conflict if value, ok := _c.mutation.CreateTime(); ok { _spec.SetField(sysrole.FieldCreateTime, field.TypeString, value) @@ -226,6 +227,7 @@ func (_c *SysRoleCreate) createSpec() (*SysRole, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -242,6 +244,7 @@ func (_c *SysRoleCreate) createSpec() (*SysRole, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/sysrole_delete.go b/internal/ent/sysrole_delete.go index c5ee00c..e6db8d8 100644 --- a/internal/ent/sysrole_delete.go +++ b/internal/ent/sysrole_delete.go @@ -4,6 +4,7 @@ package ent import ( "context" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysrole" @@ -41,6 +42,8 @@ func (_d *SysRoleDelete) ExecX(ctx context.Context) int { func (_d *SysRoleDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(sysrole.Table, sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.SysRole + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/sysrole_query.go b/internal/ent/sysrole_query.go index ed9700a..b3929c0 100644 --- a/internal/ent/sysrole_query.go +++ b/internal/ent/sysrole_query.go @@ -6,6 +6,7 @@ import ( "context" "database/sql/driver" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysmenu" "likedream-goframe/internal/ent/sysrole" @@ -13,6 +14,7 @@ import ( "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -21,12 +23,15 @@ import ( // SysRoleQuery is the builder for querying SysRole entities. type SysRoleQuery struct { config - ctx *QueryContext - order []sysrole.OrderOption - inters []Interceptor - predicates []predicate.SysRole - withMenus *SysMenuQuery - withUsers *SysUserQuery + ctx *QueryContext + order []sysrole.OrderOption + inters []Interceptor + predicates []predicate.SysRole + withMenus *SysMenuQuery + withUsers *SysUserQuery + modifiers []func(*sql.Selector) + withNamedMenus map[string]*SysMenuQuery + withNamedUsers map[string]*SysUserQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -79,6 +84,9 @@ func (_q *SysRoleQuery) QueryMenus() *SysMenuQuery { sqlgraph.To(sysmenu.Table, sysmenu.FieldID), sqlgraph.Edge(sqlgraph.M2M, false, sysrole.MenusTable, sysrole.MenusPrimaryKey...), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysMenu + step.Edge.Schema = schemaConfig.SysRoleMenus fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -101,6 +109,9 @@ func (_q *SysRoleQuery) QueryUsers() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2M, true, sysrole.UsersTable, sysrole.UsersPrimaryKey...), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUserRoles fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -302,8 +313,9 @@ func (_q *SysRoleQuery) Clone() *SysRoleQuery { withMenus: _q.withMenus.Clone(), withUsers: _q.withUsers.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -421,6 +433,11 @@ func (_q *SysRoleQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*SysR node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.SysRole + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -444,6 +461,20 @@ func (_q *SysRoleQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*SysR return nil, err } } + for name, query := range _q.withNamedMenus { + if err := _q.loadMenus(ctx, query, nodes, + func(n *SysRole) { n.appendNamedMenus(name) }, + func(n *SysRole, e *SysMenu) { n.appendNamedMenus(name, e) }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedUsers { + if err := _q.loadUsers(ctx, query, nodes, + func(n *SysRole) { n.appendNamedUsers(name) }, + func(n *SysRole, e *SysUser) { n.appendNamedUsers(name, e) }); err != nil { + return nil, err + } + } return nodes, nil } @@ -460,6 +491,7 @@ func (_q *SysRoleQuery) loadMenus(ctx context.Context, query *SysMenuQuery, node } query.Where(func(s *sql.Selector) { joinT := sql.Table(sysrole.MenusTable) + joinT.Schema(_q.schemaConfig.SysRoleMenus) s.Join(joinT).On(s.C(sysmenu.FieldID), joinT.C(sysrole.MenusPrimaryKey[1])) s.Where(sql.InValues(joinT.C(sysrole.MenusPrimaryKey[0]), edgeIDs...)) columns := s.SelectedColumns() @@ -521,6 +553,7 @@ func (_q *SysRoleQuery) loadUsers(ctx context.Context, query *SysUserQuery, node } query.Where(func(s *sql.Selector) { joinT := sql.Table(sysrole.UsersTable) + joinT.Schema(_q.schemaConfig.SysUserRoles) s.Join(joinT).On(s.C(sysuser.FieldID), joinT.C(sysrole.UsersPrimaryKey[0])) s.Where(sql.InValues(joinT.C(sysrole.UsersPrimaryKey[1]), edgeIDs...)) columns := s.SelectedColumns() @@ -572,6 +605,11 @@ func (_q *SysRoleQuery) loadUsers(ctx context.Context, query *SysUserQuery, node func (_q *SysRoleQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.SysRole + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -634,6 +672,12 @@ func (_q *SysRoleQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.SysRole) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -651,6 +695,66 @@ func (_q *SysRoleQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *SysRoleQuery) ForUpdate(opts ...sql.LockOption) *SysRoleQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *SysRoleQuery) ForShare(opts ...sql.LockOption) *SysRoleQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *SysRoleQuery) Modify(modifiers ...func(s *sql.Selector)) *SysRoleSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + +// WithNamedMenus tells the query-builder to eager-load the nodes that are connected to the "menus" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysRoleQuery) WithNamedMenus(name string, opts ...func(*SysMenuQuery)) *SysRoleQuery { + query := (&SysMenuClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedMenus == nil { + _q.withNamedMenus = make(map[string]*SysMenuQuery) + } + _q.withNamedMenus[name] = query + return _q +} + +// WithNamedUsers tells the query-builder to eager-load the nodes that are connected to the "users" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysRoleQuery) WithNamedUsers(name string, opts ...func(*SysUserQuery)) *SysRoleQuery { + query := (&SysUserClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedUsers == nil { + _q.withNamedUsers = make(map[string]*SysUserQuery) + } + _q.withNamedUsers[name] = query + return _q +} + // SysRoleGroupBy is the group-by builder for SysRole entities. type SysRoleGroupBy struct { selector @@ -740,3 +844,9 @@ func (_s *SysRoleSelect) sqlScan(ctx context.Context, root *SysRoleQuery, v any) defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *SysRoleSelect) Modify(modifiers ...func(s *sql.Selector)) *SysRoleSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/sysrole_update.go b/internal/ent/sysrole_update.go index a56fee0..b11374b 100644 --- a/internal/ent/sysrole_update.go +++ b/internal/ent/sysrole_update.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysmenu" "likedream-goframe/internal/ent/sysrole" @@ -20,8 +21,9 @@ import ( // SysRoleUpdate is the builder for updating SysRole entities. type SysRoleUpdate struct { config - hooks []Hook - mutation *SysRoleMutation + hooks []Hook + mutation *SysRoleMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the SysRoleUpdate builder. @@ -203,6 +205,12 @@ func (_u *SysRoleUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysRoleUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysRoleUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysRoleUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(sysrole.Table, sysrole.Columns, sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64)) if ps := _u.mutation.predicates; len(ps) > 0 { @@ -241,6 +249,7 @@ func (_u *SysRoleUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedMenusIDs(); len(nodes) > 0 && !_u.mutation.MenusCleared() { @@ -254,6 +263,7 @@ func (_u *SysRoleUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -270,6 +280,7 @@ func (_u *SysRoleUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -286,6 +297,7 @@ func (_u *SysRoleUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedUsersIDs(); len(nodes) > 0 && !_u.mutation.UsersCleared() { @@ -299,6 +311,7 @@ func (_u *SysRoleUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -315,11 +328,15 @@ func (_u *SysRoleUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysRole + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{sysrole.Label} @@ -335,9 +352,10 @@ func (_u *SysRoleUpdate) sqlSave(ctx context.Context) (_node int, err error) { // SysRoleUpdateOne is the builder for updating a single SysRole entity. type SysRoleUpdateOne struct { config - fields []string - hooks []Hook - mutation *SysRoleMutation + fields []string + hooks []Hook + mutation *SysRoleMutation + modifiers []func(*sql.UpdateBuilder) } // SetUpdateTime sets the "update_time" field. @@ -526,6 +544,12 @@ func (_u *SysRoleUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysRoleUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysRoleUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysRoleUpdateOne) sqlSave(ctx context.Context) (_node *SysRole, err error) { _spec := sqlgraph.NewUpdateSpec(sysrole.Table, sysrole.Columns, sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64)) id, ok := _u.mutation.ID() @@ -581,6 +605,7 @@ func (_u *SysRoleUpdateOne) sqlSave(ctx context.Context) (_node *SysRole, err er IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedMenusIDs(); len(nodes) > 0 && !_u.mutation.MenusCleared() { @@ -594,6 +619,7 @@ func (_u *SysRoleUpdateOne) sqlSave(ctx context.Context) (_node *SysRole, err er IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -610,6 +636,7 @@ func (_u *SysRoleUpdateOne) sqlSave(ctx context.Context) (_node *SysRole, err er IDSpec: sqlgraph.NewFieldSpec(sysmenu.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysRoleMenus for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -626,6 +653,7 @@ func (_u *SysRoleUpdateOne) sqlSave(ctx context.Context) (_node *SysRole, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedUsersIDs(); len(nodes) > 0 && !_u.mutation.UsersCleared() { @@ -639,6 +667,7 @@ func (_u *SysRoleUpdateOne) sqlSave(ctx context.Context) (_node *SysRole, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -655,11 +684,15 @@ func (_u *SysRoleUpdateOne) sqlSave(ctx context.Context) (_node *SysRole, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysRole + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &SysRole{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/sysuser.go b/internal/ent/sysuser.go index c9667c7..8914d3e 100644 --- a/internal/ent/sysuser.go +++ b/internal/ent/sysuser.go @@ -72,7 +72,16 @@ type SysUserEdges struct { CashbackCards []*SysCard `json:"cashback_cards,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [11]bool + loadedTypes [11]bool + namedChildren map[string][]*SysUser + namedRoles map[string][]*SysRole + namedImages map[string][]*CpImage + namedCpuser map[string][]*CpUser + namedCpTask map[string][]*CpTask + namedCpTaskLogs map[string][]*CpTaskLog + namedCreatedCards map[string][]*SysCard + namedUsedCards map[string][]*SysCard + namedCashbackCards map[string][]*SysCard } // ParentOrErr returns the Parent value or an error if the edge @@ -406,5 +415,221 @@ func (_m *SysUser) String() string { return builder.String() } +// NamedChildren returns the Children named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysUser) NamedChildren(name string) ([]*SysUser, error) { + if _m.Edges.namedChildren == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedChildren[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysUser) appendNamedChildren(name string, edges ...*SysUser) { + if _m.Edges.namedChildren == nil { + _m.Edges.namedChildren = make(map[string][]*SysUser) + } + if len(edges) == 0 { + _m.Edges.namedChildren[name] = []*SysUser{} + } else { + _m.Edges.namedChildren[name] = append(_m.Edges.namedChildren[name], edges...) + } +} + +// NamedRoles returns the Roles named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysUser) NamedRoles(name string) ([]*SysRole, error) { + if _m.Edges.namedRoles == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedRoles[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysUser) appendNamedRoles(name string, edges ...*SysRole) { + if _m.Edges.namedRoles == nil { + _m.Edges.namedRoles = make(map[string][]*SysRole) + } + if len(edges) == 0 { + _m.Edges.namedRoles[name] = []*SysRole{} + } else { + _m.Edges.namedRoles[name] = append(_m.Edges.namedRoles[name], edges...) + } +} + +// NamedImages returns the Images named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysUser) NamedImages(name string) ([]*CpImage, error) { + if _m.Edges.namedImages == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedImages[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysUser) appendNamedImages(name string, edges ...*CpImage) { + if _m.Edges.namedImages == nil { + _m.Edges.namedImages = make(map[string][]*CpImage) + } + if len(edges) == 0 { + _m.Edges.namedImages[name] = []*CpImage{} + } else { + _m.Edges.namedImages[name] = append(_m.Edges.namedImages[name], edges...) + } +} + +// NamedCpuser returns the Cpuser named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysUser) NamedCpuser(name string) ([]*CpUser, error) { + if _m.Edges.namedCpuser == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedCpuser[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysUser) appendNamedCpuser(name string, edges ...*CpUser) { + if _m.Edges.namedCpuser == nil { + _m.Edges.namedCpuser = make(map[string][]*CpUser) + } + if len(edges) == 0 { + _m.Edges.namedCpuser[name] = []*CpUser{} + } else { + _m.Edges.namedCpuser[name] = append(_m.Edges.namedCpuser[name], edges...) + } +} + +// NamedCpTask returns the CpTask named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysUser) NamedCpTask(name string) ([]*CpTask, error) { + if _m.Edges.namedCpTask == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedCpTask[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysUser) appendNamedCpTask(name string, edges ...*CpTask) { + if _m.Edges.namedCpTask == nil { + _m.Edges.namedCpTask = make(map[string][]*CpTask) + } + if len(edges) == 0 { + _m.Edges.namedCpTask[name] = []*CpTask{} + } else { + _m.Edges.namedCpTask[name] = append(_m.Edges.namedCpTask[name], edges...) + } +} + +// NamedCpTaskLogs returns the CpTaskLogs named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysUser) NamedCpTaskLogs(name string) ([]*CpTaskLog, error) { + if _m.Edges.namedCpTaskLogs == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedCpTaskLogs[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysUser) appendNamedCpTaskLogs(name string, edges ...*CpTaskLog) { + if _m.Edges.namedCpTaskLogs == nil { + _m.Edges.namedCpTaskLogs = make(map[string][]*CpTaskLog) + } + if len(edges) == 0 { + _m.Edges.namedCpTaskLogs[name] = []*CpTaskLog{} + } else { + _m.Edges.namedCpTaskLogs[name] = append(_m.Edges.namedCpTaskLogs[name], edges...) + } +} + +// NamedCreatedCards returns the CreatedCards named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysUser) NamedCreatedCards(name string) ([]*SysCard, error) { + if _m.Edges.namedCreatedCards == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedCreatedCards[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysUser) appendNamedCreatedCards(name string, edges ...*SysCard) { + if _m.Edges.namedCreatedCards == nil { + _m.Edges.namedCreatedCards = make(map[string][]*SysCard) + } + if len(edges) == 0 { + _m.Edges.namedCreatedCards[name] = []*SysCard{} + } else { + _m.Edges.namedCreatedCards[name] = append(_m.Edges.namedCreatedCards[name], edges...) + } +} + +// NamedUsedCards returns the UsedCards named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysUser) NamedUsedCards(name string) ([]*SysCard, error) { + if _m.Edges.namedUsedCards == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedUsedCards[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysUser) appendNamedUsedCards(name string, edges ...*SysCard) { + if _m.Edges.namedUsedCards == nil { + _m.Edges.namedUsedCards = make(map[string][]*SysCard) + } + if len(edges) == 0 { + _m.Edges.namedUsedCards[name] = []*SysCard{} + } else { + _m.Edges.namedUsedCards[name] = append(_m.Edges.namedUsedCards[name], edges...) + } +} + +// NamedCashbackCards returns the CashbackCards named value or an error if the edge was not +// loaded in eager-loading with this name. +func (_m *SysUser) NamedCashbackCards(name string) ([]*SysCard, error) { + if _m.Edges.namedCashbackCards == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := _m.Edges.namedCashbackCards[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (_m *SysUser) appendNamedCashbackCards(name string, edges ...*SysCard) { + if _m.Edges.namedCashbackCards == nil { + _m.Edges.namedCashbackCards = make(map[string][]*SysCard) + } + if len(edges) == 0 { + _m.Edges.namedCashbackCards[name] = []*SysCard{} + } else { + _m.Edges.namedCashbackCards[name] = append(_m.Edges.namedCashbackCards[name], edges...) + } +} + // SysUsers is a parsable slice of SysUser. type SysUsers []*SysUser diff --git a/internal/ent/sysuser/where.go b/internal/ent/sysuser/where.go index f44012c..2a7c689 100644 --- a/internal/ent/sysuser/where.go +++ b/internal/ent/sysuser/where.go @@ -3,6 +3,7 @@ package sysuser import ( + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/framework/ent2" @@ -683,6 +684,9 @@ func HasParent() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUser sqlgraph.HasNeighbors(s, step) }) } @@ -691,6 +695,9 @@ func HasParent() predicate.SysUser { func HasParentWith(preds ...predicate.SysUser) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newParentStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUser sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -706,6 +713,9 @@ func HasChildren() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, ChildrenTable, ChildrenColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUser sqlgraph.HasNeighbors(s, step) }) } @@ -714,6 +724,9 @@ func HasChildren() predicate.SysUser { func HasChildrenWith(preds ...predicate.SysUser) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newChildrenStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUser sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -729,6 +742,9 @@ func HasRoles() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2M, false, RolesTable, RolesPrimaryKey...), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysRole + step.Edge.Schema = schemaConfig.SysUserRoles sqlgraph.HasNeighbors(s, step) }) } @@ -737,6 +753,9 @@ func HasRoles() predicate.SysUser { func HasRolesWith(preds ...predicate.SysRole) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newRolesStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysRole + step.Edge.Schema = schemaConfig.SysUserRoles sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -752,6 +771,9 @@ func HasAgent() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2O, false, AgentTable, AgentColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysAgent + step.Edge.Schema = schemaConfig.SysAgent sqlgraph.HasNeighbors(s, step) }) } @@ -760,6 +782,9 @@ func HasAgent() predicate.SysUser { func HasAgentWith(preds ...predicate.SysAgent) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newAgentStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysAgent + step.Edge.Schema = schemaConfig.SysAgent sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -775,6 +800,9 @@ func HasImages() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, ImagesTable, ImagesColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpImage + step.Edge.Schema = schemaConfig.CpImage sqlgraph.HasNeighbors(s, step) }) } @@ -783,6 +811,9 @@ func HasImages() predicate.SysUser { func HasImagesWith(preds ...predicate.CpImage) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newImagesStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpImage + step.Edge.Schema = schemaConfig.CpImage sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -798,6 +829,9 @@ func HasCpuser() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CpuserTable, CpuserColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpUser sqlgraph.HasNeighbors(s, step) }) } @@ -806,6 +840,9 @@ func HasCpuser() predicate.SysUser { func HasCpuserWith(preds ...predicate.CpUser) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newCpuserStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpUser sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -821,6 +858,9 @@ func HasCpTask() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CpTaskTable, CpTaskColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTask sqlgraph.HasNeighbors(s, step) }) } @@ -829,6 +869,9 @@ func HasCpTask() predicate.SysUser { func HasCpTaskWith(preds ...predicate.CpTask) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newCpTaskStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTask sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -844,6 +887,9 @@ func HasCpTaskLogs() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CpTaskLogsTable, CpTaskLogsColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighbors(s, step) }) } @@ -852,6 +898,9 @@ func HasCpTaskLogs() predicate.SysUser { func HasCpTaskLogsWith(preds ...predicate.CpTaskLog) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newCpTaskLogsStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -867,6 +916,9 @@ func HasCreatedCards() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CreatedCardsTable, CreatedCardsColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighbors(s, step) }) } @@ -875,6 +927,9 @@ func HasCreatedCards() predicate.SysUser { func HasCreatedCardsWith(preds ...predicate.SysCard) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newCreatedCardsStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -890,6 +945,9 @@ func HasUsedCards() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, UsedCardsTable, UsedCardsColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighbors(s, step) }) } @@ -898,6 +956,9 @@ func HasUsedCards() predicate.SysUser { func HasUsedCardsWith(preds ...predicate.SysCard) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newUsedCardsStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -913,6 +974,9 @@ func HasCashbackCards() predicate.SysUser { sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, CashbackCardsTable, CashbackCardsColumn), ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighbors(s, step) }) } @@ -921,6 +985,9 @@ func HasCashbackCards() predicate.SysUser { func HasCashbackCardsWith(preds ...predicate.SysCard) predicate.SysUser { return predicate.SysUser(func(s *sql.Selector) { step := newCashbackCardsStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/internal/ent/sysuser_create.go b/internal/ent/sysuser_create.go index 3bded8c..b71a314 100644 --- a/internal/ent/sysuser_create.go +++ b/internal/ent/sysuser_create.go @@ -439,6 +439,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { _node = &SysUser{config: _c.config} _spec = sqlgraph.NewCreateSpec(sysuser.Table, sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.SysUser _spec.OnConflict = _c.conflict if value, ok := _c.mutation.CreateTime(); ok { _spec.SetField(sysuser.FieldCreateTime, field.TypeString, value) @@ -491,6 +492,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -508,6 +510,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -524,6 +527,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -540,6 +544,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(sysagent.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysAgent for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -556,6 +561,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cpimage.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpImage for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -572,6 +578,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -588,6 +595,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -604,6 +612,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -620,6 +629,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -636,6 +646,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -652,6 +663,7 @@ func (_c *SysUserCreate) createSpec() (*SysUser, *sqlgraph.CreateSpec) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _c.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } diff --git a/internal/ent/sysuser_delete.go b/internal/ent/sysuser_delete.go index 0f33833..26d2101 100644 --- a/internal/ent/sysuser_delete.go +++ b/internal/ent/sysuser_delete.go @@ -4,6 +4,7 @@ package ent import ( "context" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuser" @@ -41,6 +42,8 @@ func (_d *SysUserDelete) ExecX(ctx context.Context) int { func (_d *SysUserDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(sysuser.Table, sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.SysUser + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/sysuser_query.go b/internal/ent/sysuser_query.go index a8d9c72..3b0d540 100644 --- a/internal/ent/sysuser_query.go +++ b/internal/ent/sysuser_query.go @@ -10,6 +10,7 @@ import ( "likedream-goframe/internal/ent/cptask" "likedream-goframe/internal/ent/cptasklog" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysagent" "likedream-goframe/internal/ent/syscard" @@ -18,6 +19,7 @@ import ( "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -26,22 +28,32 @@ import ( // SysUserQuery is the builder for querying SysUser entities. type SysUserQuery struct { config - ctx *QueryContext - order []sysuser.OrderOption - inters []Interceptor - predicates []predicate.SysUser - withParent *SysUserQuery - withChildren *SysUserQuery - withRoles *SysRoleQuery - withAgent *SysAgentQuery - withImages *CpImageQuery - withCpuser *CpUserQuery - withCpTask *CpTaskQuery - withCpTaskLogs *CpTaskLogQuery - withCreatedCards *SysCardQuery - withUsedCards *SysCardQuery - withCashbackCards *SysCardQuery - withFKs bool + ctx *QueryContext + order []sysuser.OrderOption + inters []Interceptor + predicates []predicate.SysUser + withParent *SysUserQuery + withChildren *SysUserQuery + withRoles *SysRoleQuery + withAgent *SysAgentQuery + withImages *CpImageQuery + withCpuser *CpUserQuery + withCpTask *CpTaskQuery + withCpTaskLogs *CpTaskLogQuery + withCreatedCards *SysCardQuery + withUsedCards *SysCardQuery + withCashbackCards *SysCardQuery + withFKs bool + modifiers []func(*sql.Selector) + withNamedChildren map[string]*SysUserQuery + withNamedRoles map[string]*SysRoleQuery + withNamedImages map[string]*CpImageQuery + withNamedCpuser map[string]*CpUserQuery + withNamedCpTask map[string]*CpTaskQuery + withNamedCpTaskLogs map[string]*CpTaskLogQuery + withNamedCreatedCards map[string]*SysCardQuery + withNamedUsedCards map[string]*SysCardQuery + withNamedCashbackCards map[string]*SysCardQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -94,6 +106,9 @@ func (_q *SysUserQuery) QueryParent() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, sysuser.ParentTable, sysuser.ParentColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUser fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -116,6 +131,9 @@ func (_q *SysUserQuery) QueryChildren() *SysUserQuery { sqlgraph.To(sysuser.Table, sysuser.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.ChildrenTable, sysuser.ChildrenColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysUser + step.Edge.Schema = schemaConfig.SysUser fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -138,6 +156,9 @@ func (_q *SysUserQuery) QueryRoles() *SysRoleQuery { sqlgraph.To(sysrole.Table, sysrole.FieldID), sqlgraph.Edge(sqlgraph.M2M, false, sysuser.RolesTable, sysuser.RolesPrimaryKey...), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysRole + step.Edge.Schema = schemaConfig.SysUserRoles fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -160,6 +181,9 @@ func (_q *SysUserQuery) QueryAgent() *SysAgentQuery { sqlgraph.To(sysagent.Table, sysagent.FieldID), sqlgraph.Edge(sqlgraph.O2O, false, sysuser.AgentTable, sysuser.AgentColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysAgent + step.Edge.Schema = schemaConfig.SysAgent fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -182,6 +206,9 @@ func (_q *SysUserQuery) QueryImages() *CpImageQuery { sqlgraph.To(cpimage.Table, cpimage.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.ImagesTable, sysuser.ImagesColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpImage + step.Edge.Schema = schemaConfig.CpImage fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -204,6 +231,9 @@ func (_q *SysUserQuery) QueryCpuser() *CpUserQuery { sqlgraph.To(cpuser.Table, cpuser.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CpuserTable, sysuser.CpuserColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpUser + step.Edge.Schema = schemaConfig.CpUser fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -226,6 +256,9 @@ func (_q *SysUserQuery) QueryCpTask() *CpTaskQuery { sqlgraph.To(cptask.Table, cptask.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CpTaskTable, sysuser.CpTaskColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpTask + step.Edge.Schema = schemaConfig.CpTask fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -248,6 +281,9 @@ func (_q *SysUserQuery) QueryCpTaskLogs() *CpTaskLogQuery { sqlgraph.To(cptasklog.Table, cptasklog.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CpTaskLogsTable, sysuser.CpTaskLogsColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.CpTaskLog + step.Edge.Schema = schemaConfig.CpTaskLog fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -270,6 +306,9 @@ func (_q *SysUserQuery) QueryCreatedCards() *SysCardQuery { sqlgraph.To(syscard.Table, syscard.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CreatedCardsTable, sysuser.CreatedCardsColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -292,6 +331,9 @@ func (_q *SysUserQuery) QueryUsedCards() *SysCardQuery { sqlgraph.To(syscard.Table, syscard.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.UsedCardsTable, sysuser.UsedCardsColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -314,6 +356,9 @@ func (_q *SysUserQuery) QueryCashbackCards() *SysCardQuery { sqlgraph.To(syscard.Table, syscard.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, sysuser.CashbackCardsTable, sysuser.CashbackCardsColumn), ) + schemaConfig := _q.schemaConfig + step.To.Schema = schemaConfig.SysCard + step.Edge.Schema = schemaConfig.SysCard fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } @@ -524,8 +569,9 @@ func (_q *SysUserQuery) Clone() *SysUserQuery { withUsedCards: _q.withUsedCards.Clone(), withCashbackCards: _q.withCashbackCards.Clone(), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -758,6 +804,11 @@ func (_q *SysUserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*SysU node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.SysUser + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -776,7 +827,12 @@ func (_q *SysUserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*SysU if query := _q.withChildren; query != nil { if err := _q.loadChildren(ctx, query, nodes, func(n *SysUser) { n.Edges.Children = []*SysUser{} }, - func(n *SysUser, e *SysUser) { n.Edges.Children = append(n.Edges.Children, e) }); err != nil { + func(n *SysUser, e *SysUser) { + n.Edges.Children = append(n.Edges.Children, e) + if !e.Edges.loadedTypes[0] { + e.Edges.Parent = n + } + }); err != nil { return nil, err } } @@ -789,56 +845,199 @@ func (_q *SysUserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*SysU } if query := _q.withAgent; query != nil { if err := _q.loadAgent(ctx, query, nodes, nil, - func(n *SysUser, e *SysAgent) { n.Edges.Agent = e }); err != nil { + func(n *SysUser, e *SysAgent) { + n.Edges.Agent = e + if !e.Edges.loadedTypes[0] { + e.Edges.Users = n + } + }); err != nil { return nil, err } } if query := _q.withImages; query != nil { if err := _q.loadImages(ctx, query, nodes, func(n *SysUser) { n.Edges.Images = []*CpImage{} }, - func(n *SysUser, e *CpImage) { n.Edges.Images = append(n.Edges.Images, e) }); err != nil { + func(n *SysUser, e *CpImage) { + n.Edges.Images = append(n.Edges.Images, e) + if !e.Edges.loadedTypes[0] { + e.Edges.User = n + } + }); err != nil { return nil, err } } if query := _q.withCpuser; query != nil { if err := _q.loadCpuser(ctx, query, nodes, func(n *SysUser) { n.Edges.Cpuser = []*CpUser{} }, - func(n *SysUser, e *CpUser) { n.Edges.Cpuser = append(n.Edges.Cpuser, e) }); err != nil { + func(n *SysUser, e *CpUser) { + n.Edges.Cpuser = append(n.Edges.Cpuser, e) + if !e.Edges.loadedTypes[1] { + e.Edges.Sysuser = n + } + }); err != nil { return nil, err } } if query := _q.withCpTask; query != nil { if err := _q.loadCpTask(ctx, query, nodes, func(n *SysUser) { n.Edges.CpTask = []*CpTask{} }, - func(n *SysUser, e *CpTask) { n.Edges.CpTask = append(n.Edges.CpTask, e) }); err != nil { + func(n *SysUser, e *CpTask) { + n.Edges.CpTask = append(n.Edges.CpTask, e) + if !e.Edges.loadedTypes[1] { + e.Edges.SysUser = n + } + }); err != nil { return nil, err } } if query := _q.withCpTaskLogs; query != nil { if err := _q.loadCpTaskLogs(ctx, query, nodes, func(n *SysUser) { n.Edges.CpTaskLogs = []*CpTaskLog{} }, - func(n *SysUser, e *CpTaskLog) { n.Edges.CpTaskLogs = append(n.Edges.CpTaskLogs, e) }); err != nil { + func(n *SysUser, e *CpTaskLog) { + n.Edges.CpTaskLogs = append(n.Edges.CpTaskLogs, e) + if !e.Edges.loadedTypes[1] { + e.Edges.SystemUser = n + } + }); err != nil { return nil, err } } if query := _q.withCreatedCards; query != nil { if err := _q.loadCreatedCards(ctx, query, nodes, func(n *SysUser) { n.Edges.CreatedCards = []*SysCard{} }, - func(n *SysUser, e *SysCard) { n.Edges.CreatedCards = append(n.Edges.CreatedCards, e) }); err != nil { + func(n *SysUser, e *SysCard) { + n.Edges.CreatedCards = append(n.Edges.CreatedCards, e) + if !e.Edges.loadedTypes[0] { + e.Edges.Creator = n + } + }); err != nil { return nil, err } } if query := _q.withUsedCards; query != nil { if err := _q.loadUsedCards(ctx, query, nodes, func(n *SysUser) { n.Edges.UsedCards = []*SysCard{} }, - func(n *SysUser, e *SysCard) { n.Edges.UsedCards = append(n.Edges.UsedCards, e) }); err != nil { + func(n *SysUser, e *SysCard) { + n.Edges.UsedCards = append(n.Edges.UsedCards, e) + if !e.Edges.loadedTypes[1] { + e.Edges.User = n + } + }); err != nil { return nil, err } } if query := _q.withCashbackCards; query != nil { if err := _q.loadCashbackCards(ctx, query, nodes, func(n *SysUser) { n.Edges.CashbackCards = []*SysCard{} }, - func(n *SysUser, e *SysCard) { n.Edges.CashbackCards = append(n.Edges.CashbackCards, e) }); err != nil { + func(n *SysUser, e *SysCard) { + n.Edges.CashbackCards = append(n.Edges.CashbackCards, e) + if !e.Edges.loadedTypes[2] { + e.Edges.CashUser = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedChildren { + if err := _q.loadChildren(ctx, query, nodes, + func(n *SysUser) { n.appendNamedChildren(name) }, + func(n *SysUser, e *SysUser) { + n.appendNamedChildren(name, e) + if !e.Edges.loadedTypes[0] { + e.Edges.Parent = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedRoles { + if err := _q.loadRoles(ctx, query, nodes, + func(n *SysUser) { n.appendNamedRoles(name) }, + func(n *SysUser, e *SysRole) { n.appendNamedRoles(name, e) }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedImages { + if err := _q.loadImages(ctx, query, nodes, + func(n *SysUser) { n.appendNamedImages(name) }, + func(n *SysUser, e *CpImage) { + n.appendNamedImages(name, e) + if !e.Edges.loadedTypes[0] { + e.Edges.User = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedCpuser { + if err := _q.loadCpuser(ctx, query, nodes, + func(n *SysUser) { n.appendNamedCpuser(name) }, + func(n *SysUser, e *CpUser) { + n.appendNamedCpuser(name, e) + if !e.Edges.loadedTypes[1] { + e.Edges.Sysuser = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedCpTask { + if err := _q.loadCpTask(ctx, query, nodes, + func(n *SysUser) { n.appendNamedCpTask(name) }, + func(n *SysUser, e *CpTask) { + n.appendNamedCpTask(name, e) + if !e.Edges.loadedTypes[1] { + e.Edges.SysUser = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedCpTaskLogs { + if err := _q.loadCpTaskLogs(ctx, query, nodes, + func(n *SysUser) { n.appendNamedCpTaskLogs(name) }, + func(n *SysUser, e *CpTaskLog) { + n.appendNamedCpTaskLogs(name, e) + if !e.Edges.loadedTypes[1] { + e.Edges.SystemUser = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedCreatedCards { + if err := _q.loadCreatedCards(ctx, query, nodes, + func(n *SysUser) { n.appendNamedCreatedCards(name) }, + func(n *SysUser, e *SysCard) { + n.appendNamedCreatedCards(name, e) + if !e.Edges.loadedTypes[0] { + e.Edges.Creator = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedUsedCards { + if err := _q.loadUsedCards(ctx, query, nodes, + func(n *SysUser) { n.appendNamedUsedCards(name) }, + func(n *SysUser, e *SysCard) { + n.appendNamedUsedCards(name, e) + if !e.Edges.loadedTypes[1] { + e.Edges.User = n + } + }); err != nil { + return nil, err + } + } + for name, query := range _q.withNamedCashbackCards { + if err := _q.loadCashbackCards(ctx, query, nodes, + func(n *SysUser) { n.appendNamedCashbackCards(name) }, + func(n *SysUser, e *SysCard) { + n.appendNamedCashbackCards(name, e) + if !e.Edges.loadedTypes[2] { + e.Edges.CashUser = n + } + }); err != nil { return nil, err } } @@ -921,6 +1120,7 @@ func (_q *SysUserQuery) loadRoles(ctx context.Context, query *SysRoleQuery, node } query.Where(func(s *sql.Selector) { joinT := sql.Table(sysuser.RolesTable) + joinT.Schema(_q.schemaConfig.SysUserRoles) s.Join(joinT).On(s.C(sysrole.FieldID), joinT.C(sysuser.RolesPrimaryKey[1])) s.Where(sql.InValues(joinT.C(sysuser.RolesPrimaryKey[0]), edgeIDs...)) columns := s.SelectedColumns() @@ -1210,6 +1410,11 @@ func (_q *SysUserQuery) loadCashbackCards(ctx context.Context, query *SysCardQue func (_q *SysUserQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.SysUser + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -1272,6 +1477,12 @@ func (_q *SysUserQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.SysUser) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -1289,6 +1500,164 @@ func (_q *SysUserQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *SysUserQuery) ForUpdate(opts ...sql.LockOption) *SysUserQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *SysUserQuery) ForShare(opts ...sql.LockOption) *SysUserQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *SysUserQuery) Modify(modifiers ...func(s *sql.Selector)) *SysUserSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + +// WithNamedChildren tells the query-builder to eager-load the nodes that are connected to the "children" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysUserQuery) WithNamedChildren(name string, opts ...func(*SysUserQuery)) *SysUserQuery { + query := (&SysUserClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedChildren == nil { + _q.withNamedChildren = make(map[string]*SysUserQuery) + } + _q.withNamedChildren[name] = query + return _q +} + +// WithNamedRoles tells the query-builder to eager-load the nodes that are connected to the "roles" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysUserQuery) WithNamedRoles(name string, opts ...func(*SysRoleQuery)) *SysUserQuery { + query := (&SysRoleClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedRoles == nil { + _q.withNamedRoles = make(map[string]*SysRoleQuery) + } + _q.withNamedRoles[name] = query + return _q +} + +// WithNamedImages tells the query-builder to eager-load the nodes that are connected to the "images" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysUserQuery) WithNamedImages(name string, opts ...func(*CpImageQuery)) *SysUserQuery { + query := (&CpImageClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedImages == nil { + _q.withNamedImages = make(map[string]*CpImageQuery) + } + _q.withNamedImages[name] = query + return _q +} + +// WithNamedCpuser tells the query-builder to eager-load the nodes that are connected to the "cpuser" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysUserQuery) WithNamedCpuser(name string, opts ...func(*CpUserQuery)) *SysUserQuery { + query := (&CpUserClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedCpuser == nil { + _q.withNamedCpuser = make(map[string]*CpUserQuery) + } + _q.withNamedCpuser[name] = query + return _q +} + +// WithNamedCpTask tells the query-builder to eager-load the nodes that are connected to the "cp_task" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysUserQuery) WithNamedCpTask(name string, opts ...func(*CpTaskQuery)) *SysUserQuery { + query := (&CpTaskClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedCpTask == nil { + _q.withNamedCpTask = make(map[string]*CpTaskQuery) + } + _q.withNamedCpTask[name] = query + return _q +} + +// WithNamedCpTaskLogs tells the query-builder to eager-load the nodes that are connected to the "cp_task_logs" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysUserQuery) WithNamedCpTaskLogs(name string, opts ...func(*CpTaskLogQuery)) *SysUserQuery { + query := (&CpTaskLogClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedCpTaskLogs == nil { + _q.withNamedCpTaskLogs = make(map[string]*CpTaskLogQuery) + } + _q.withNamedCpTaskLogs[name] = query + return _q +} + +// WithNamedCreatedCards tells the query-builder to eager-load the nodes that are connected to the "created_cards" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysUserQuery) WithNamedCreatedCards(name string, opts ...func(*SysCardQuery)) *SysUserQuery { + query := (&SysCardClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedCreatedCards == nil { + _q.withNamedCreatedCards = make(map[string]*SysCardQuery) + } + _q.withNamedCreatedCards[name] = query + return _q +} + +// WithNamedUsedCards tells the query-builder to eager-load the nodes that are connected to the "used_cards" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysUserQuery) WithNamedUsedCards(name string, opts ...func(*SysCardQuery)) *SysUserQuery { + query := (&SysCardClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedUsedCards == nil { + _q.withNamedUsedCards = make(map[string]*SysCardQuery) + } + _q.withNamedUsedCards[name] = query + return _q +} + +// WithNamedCashbackCards tells the query-builder to eager-load the nodes that are connected to the "cashback_cards" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (_q *SysUserQuery) WithNamedCashbackCards(name string, opts ...func(*SysCardQuery)) *SysUserQuery { + query := (&SysCardClient{config: _q.config}).Query() + for _, opt := range opts { + opt(query) + } + if _q.withNamedCashbackCards == nil { + _q.withNamedCashbackCards = make(map[string]*SysCardQuery) + } + _q.withNamedCashbackCards[name] = query + return _q +} + // SysUserGroupBy is the group-by builder for SysUser entities. type SysUserGroupBy struct { selector @@ -1378,3 +1747,9 @@ func (_s *SysUserSelect) sqlScan(ctx context.Context, root *SysUserQuery, v any) defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *SysUserSelect) Modify(modifiers ...func(s *sql.Selector)) *SysUserSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/sysuser_update.go b/internal/ent/sysuser_update.go index c51da2b..e2cffe4 100644 --- a/internal/ent/sysuser_update.go +++ b/internal/ent/sysuser_update.go @@ -10,6 +10,7 @@ import ( "likedream-goframe/internal/ent/cptask" "likedream-goframe/internal/ent/cptasklog" "likedream-goframe/internal/ent/cpuser" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysagent" "likedream-goframe/internal/ent/syscard" @@ -26,8 +27,9 @@ import ( // SysUserUpdate is the builder for updating SysUser entities. type SysUserUpdate struct { config - hooks []Hook - mutation *SysUserMutation + hooks []Hook + mutation *SysUserMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the SysUserUpdate builder. @@ -576,6 +578,12 @@ func (_u *SysUserUpdate) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysUserUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysUserUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err @@ -629,6 +637,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 { @@ -642,6 +651,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -658,6 +668,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !_u.mutation.ChildrenCleared() { @@ -671,6 +682,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -687,6 +699,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -703,6 +716,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedRolesIDs(); len(nodes) > 0 && !_u.mutation.RolesCleared() { @@ -716,6 +730,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -732,6 +747,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -748,6 +764,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysagent.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysAgent _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AgentIDs(); len(nodes) > 0 { @@ -761,6 +778,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(sysagent.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysAgent for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -777,6 +795,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpimage.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedImagesIDs(); len(nodes) > 0 && !_u.mutation.ImagesCleared() { @@ -790,6 +809,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpimage.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -806,6 +826,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpimage.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -822,6 +843,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpuserIDs(); len(nodes) > 0 && !_u.mutation.CpuserCleared() { @@ -835,6 +857,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -851,6 +874,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -867,6 +891,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpTaskIDs(); len(nodes) > 0 && !_u.mutation.CpTaskCleared() { @@ -880,6 +905,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -896,6 +922,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -912,6 +939,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpTaskLogsIDs(); len(nodes) > 0 && !_u.mutation.CpTaskLogsCleared() { @@ -925,6 +953,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -941,6 +970,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -957,6 +987,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCreatedCardsIDs(); len(nodes) > 0 && !_u.mutation.CreatedCardsCleared() { @@ -970,6 +1001,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -986,6 +1018,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1002,6 +1035,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedUsedCardsIDs(); len(nodes) > 0 && !_u.mutation.UsedCardsCleared() { @@ -1015,6 +1049,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1031,6 +1066,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1047,6 +1083,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCashbackCardsIDs(); len(nodes) > 0 && !_u.mutation.CashbackCardsCleared() { @@ -1060,6 +1097,7 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1076,11 +1114,15 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysUser + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{sysuser.Label} @@ -1096,9 +1138,10 @@ func (_u *SysUserUpdate) sqlSave(ctx context.Context) (_node int, err error) { // SysUserUpdateOne is the builder for updating a single SysUser entity. type SysUserUpdateOne struct { config - fields []string - hooks []Hook - mutation *SysUserMutation + fields []string + hooks []Hook + mutation *SysUserMutation + modifiers []func(*sql.UpdateBuilder) } // SetUpdateTime sets the "update_time" field. @@ -1654,6 +1697,12 @@ func (_u *SysUserUpdateOne) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysUserUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysUserUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err error) { if err := _u.check(); err != nil { return _node, err @@ -1724,6 +1773,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 { @@ -1737,6 +1787,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1753,6 +1804,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedChildrenIDs(); len(nodes) > 0 && !_u.mutation.ChildrenCleared() { @@ -1766,6 +1818,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1782,6 +1835,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1798,6 +1852,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedRolesIDs(); len(nodes) > 0 && !_u.mutation.RolesCleared() { @@ -1811,6 +1866,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1827,6 +1883,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysrole.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysUserRoles for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1843,6 +1900,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysagent.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysAgent _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AgentIDs(); len(nodes) > 0 { @@ -1856,6 +1914,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(sysagent.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysAgent for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1872,6 +1931,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cpimage.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedImagesIDs(); len(nodes) > 0 && !_u.mutation.ImagesCleared() { @@ -1885,6 +1945,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cpimage.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1901,6 +1962,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cpimage.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpImage for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1917,6 +1979,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpuserIDs(); len(nodes) > 0 && !_u.mutation.CpuserCleared() { @@ -1930,6 +1993,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1946,6 +2010,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cpuser.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpUser for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1962,6 +2027,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpTaskIDs(); len(nodes) > 0 && !_u.mutation.CpTaskCleared() { @@ -1975,6 +2041,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -1991,6 +2058,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cptask.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTask for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -2007,6 +2075,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCpTaskLogsIDs(); len(nodes) > 0 && !_u.mutation.CpTaskLogsCleared() { @@ -2020,6 +2089,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -2036,6 +2106,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(cptasklog.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.CpTaskLog for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -2052,6 +2123,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCreatedCardsIDs(); len(nodes) > 0 && !_u.mutation.CreatedCardsCleared() { @@ -2065,6 +2137,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -2081,6 +2154,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -2097,6 +2171,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedUsedCardsIDs(); len(nodes) > 0 && !_u.mutation.UsedCardsCleared() { @@ -2110,6 +2185,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -2126,6 +2202,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -2142,6 +2219,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedCashbackCardsIDs(); len(nodes) > 0 && !_u.mutation.CashbackCardsCleared() { @@ -2155,6 +2233,7 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } @@ -2171,11 +2250,15 @@ func (_u *SysUserUpdateOne) sqlSave(ctx context.Context) (_node *SysUser, err er IDSpec: sqlgraph.NewFieldSpec(syscard.FieldID, field.TypeInt64), }, } + edge.Schema = _u.schemaConfig.SysCard for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Node.Schema = _u.schemaConfig.SysUser + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &SysUser{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/sysuserlog_create.go b/internal/ent/sysuserlog_create.go index 52574be..1566db1 100644 --- a/internal/ent/sysuserlog_create.go +++ b/internal/ent/sysuserlog_create.go @@ -81,6 +81,7 @@ func (_c *SysUserLogCreate) createSpec() (*SysUserLog, *sqlgraph.CreateSpec) { _node = &SysUserLog{config: _c.config} _spec = sqlgraph.NewCreateSpec(sysuserlog.Table, sqlgraph.NewFieldSpec(sysuserlog.FieldID, field.TypeInt64)) ) + _spec.Schema = _c.schemaConfig.SysUserLog _spec.OnConflict = _c.conflict return _node, _spec } diff --git a/internal/ent/sysuserlog_delete.go b/internal/ent/sysuserlog_delete.go index 81d6c67..ae23d33 100644 --- a/internal/ent/sysuserlog_delete.go +++ b/internal/ent/sysuserlog_delete.go @@ -4,6 +4,7 @@ package ent import ( "context" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuserlog" @@ -41,6 +42,8 @@ func (_d *SysUserLogDelete) ExecX(ctx context.Context) int { func (_d *SysUserLogDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(sysuserlog.Table, sqlgraph.NewFieldSpec(sysuserlog.FieldID, field.TypeInt64)) + _spec.Node.Schema = _d.schemaConfig.SysUserLog + ctx = internal.NewSchemaConfigContext(ctx, _d.schemaConfig) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/internal/ent/sysuserlog_query.go b/internal/ent/sysuserlog_query.go index 72041fa..638d917 100644 --- a/internal/ent/sysuserlog_query.go +++ b/internal/ent/sysuserlog_query.go @@ -5,11 +5,13 @@ package ent import ( "context" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuserlog" "math" "entgo.io/ent" + "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -22,6 +24,7 @@ type SysUserLogQuery struct { order []sysuserlog.OrderOption inters []Interceptor predicates []predicate.SysUserLog + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -251,8 +254,9 @@ func (_q *SysUserLogQuery) Clone() *SysUserLogQuery { inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.SysUserLog{}, _q.predicates...), // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, + sql: _q.sql.Clone(), + path: _q.path, + modifiers: append([]func(*sql.Selector){}, _q.modifiers...), } } @@ -321,6 +325,11 @@ func (_q *SysUserLogQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*S nodes = append(nodes, node) return node.assignValues(columns, values) } + _spec.Node.Schema = _q.schemaConfig.SysUserLog + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } for i := range hooks { hooks[i](ctx, _spec) } @@ -335,6 +344,11 @@ func (_q *SysUserLogQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*S func (_q *SysUserLogQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() + _spec.Node.Schema = _q.schemaConfig.SysUserLog + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + if len(_q.modifiers) > 0 { + _spec.Modifiers = _q.modifiers + } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique @@ -397,6 +411,12 @@ func (_q *SysUserLogQuery) sqlQuery(ctx context.Context) *sql.Selector { if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } + t1.Schema(_q.schemaConfig.SysUserLog) + ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) + selector.WithContext(ctx) + for _, m := range _q.modifiers { + m(selector) + } for _, p := range _q.predicates { p(selector) } @@ -414,6 +434,38 @@ func (_q *SysUserLogQuery) sqlQuery(ctx context.Context) *sql.Selector { return selector } +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (_q *SysUserLogQuery) ForUpdate(opts ...sql.LockOption) *SysUserLogQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return _q +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (_q *SysUserLogQuery) ForShare(opts ...sql.LockOption) *SysUserLogQuery { + if _q.driver.Dialect() == dialect.Postgres { + _q.Unique(false) + } + _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return _q +} + +// Modify adds a query modifier for attaching custom logic to queries. +func (_q *SysUserLogQuery) Modify(modifiers ...func(s *sql.Selector)) *SysUserLogSelect { + _q.modifiers = append(_q.modifiers, modifiers...) + return _q.Select() +} + // SysUserLogGroupBy is the group-by builder for SysUserLog entities. type SysUserLogGroupBy struct { selector @@ -503,3 +555,9 @@ func (_s *SysUserLogSelect) sqlScan(ctx context.Context, root *SysUserLogQuery, defer rows.Close() return sql.ScanSlice(rows, v) } + +// Modify adds a query modifier for attaching custom logic to queries. +func (_s *SysUserLogSelect) Modify(modifiers ...func(s *sql.Selector)) *SysUserLogSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s +} diff --git a/internal/ent/sysuserlog_update.go b/internal/ent/sysuserlog_update.go index f2a456f..1a5c3d4 100644 --- a/internal/ent/sysuserlog_update.go +++ b/internal/ent/sysuserlog_update.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "likedream-goframe/internal/ent/internal" "likedream-goframe/internal/ent/predicate" "likedream-goframe/internal/ent/sysuserlog" @@ -17,8 +18,9 @@ import ( // SysUserLogUpdate is the builder for updating SysUserLog entities. type SysUserLogUpdate struct { config - hooks []Hook - mutation *SysUserLogMutation + hooks []Hook + mutation *SysUserLogMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the SysUserLogUpdate builder. @@ -59,6 +61,12 @@ func (_u *SysUserLogUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysUserLogUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysUserLogUpdate { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysUserLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(sysuserlog.Table, sysuserlog.Columns, sqlgraph.NewFieldSpec(sysuserlog.FieldID, field.TypeInt64)) if ps := _u.mutation.predicates; len(ps) > 0 { @@ -68,6 +76,9 @@ func (_u *SysUserLogUpdate) sqlSave(ctx context.Context) (_node int, err error) } } } + _spec.Node.Schema = _u.schemaConfig.SysUserLog + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{sysuserlog.Label} @@ -83,9 +94,10 @@ func (_u *SysUserLogUpdate) sqlSave(ctx context.Context) (_node int, err error) // SysUserLogUpdateOne is the builder for updating a single SysUserLog entity. type SysUserLogUpdateOne struct { config - fields []string - hooks []Hook - mutation *SysUserLogMutation + fields []string + hooks []Hook + mutation *SysUserLogMutation + modifiers []func(*sql.UpdateBuilder) } // Mutation returns the SysUserLogMutation object of the builder. @@ -133,6 +145,12 @@ func (_u *SysUserLogUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (_u *SysUserLogUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SysUserLogUpdateOne { + _u.modifiers = append(_u.modifiers, modifiers...) + return _u +} + func (_u *SysUserLogUpdateOne) sqlSave(ctx context.Context) (_node *SysUserLog, err error) { _spec := sqlgraph.NewUpdateSpec(sysuserlog.Table, sysuserlog.Columns, sqlgraph.NewFieldSpec(sysuserlog.FieldID, field.TypeInt64)) id, ok := _u.mutation.ID() @@ -159,6 +177,9 @@ func (_u *SysUserLogUpdateOne) sqlSave(ctx context.Context) (_node *SysUserLog, } } } + _spec.Node.Schema = _u.schemaConfig.SysUserLog + ctx = internal.NewSchemaConfigContext(ctx, _u.schemaConfig) + _spec.AddModifiers(_u.modifiers...) _node = &SysUserLog{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/internal/ent/tx.go b/internal/ent/tx.go index a72ee65..40a611a 100644 --- a/internal/ent/tx.go +++ b/internal/ent/tx.go @@ -4,6 +4,8 @@ package ent import ( "context" + stdsql "database/sql" + "fmt" "sync" "entgo.io/ent/dialect" @@ -238,3 +240,27 @@ func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error } var _ dialect.Driver = (*txDriver)(nil) + +// ExecContext allows calling the underlying ExecContext method of the transaction if it is supported by it. +// See, database/sql#Tx.ExecContext for more information. +func (tx *txDriver) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error) { + ex, ok := tx.tx.(interface { + ExecContext(context.Context, string, ...any) (stdsql.Result, error) + }) + if !ok { + return nil, fmt.Errorf("Tx.ExecContext is not supported") + } + return ex.ExecContext(ctx, query, args...) +} + +// QueryContext allows calling the underlying QueryContext method of the transaction if it is supported by it. +// See, database/sql#Tx.QueryContext for more information. +func (tx *txDriver) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error) { + q, ok := tx.tx.(interface { + QueryContext(context.Context, string, ...any) (*stdsql.Rows, error) + }) + if !ok { + return nil, fmt.Errorf("Tx.QueryContext is not supported") + } + return q.QueryContext(ctx, query, args...) +}