refactor(internal): 优化 OSS 预签名 URL 缓存刷新任务和英雄数据缓存逻辑
- 注释掉 OSS预签名 URL 缓存刷新任务的定时执行代码 - 在 hero/hero.go 中增加对 Redis缓存和英雄数据集的非空校验 - 修改 OSS预签名 URL 生成逻辑,自动替换为 CDN 域名
This commit is contained in:
@@ -2,8 +2,8 @@ package consts
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// 笑门官网查询英雄名称和神器名称,用作中文翻译
|
// 笑门官网查询英雄名称和神器名称,用作中文翻译
|
||||||
SimileHeroName = "https://static.smilegatemegaport.com/gameRecord/epic7/epic7_hero.json?_=1729322698936"
|
SimileHeroName = "https://static.smilegatemegaport.com/gameRecord/epic7/epic7_hero.json"
|
||||||
SimileArtifactName = "https://static.smilegatemegaport.com/gameRecord/epic7/epic7_artifact.json?_=1729322698936"
|
SimileArtifactName = "https://static.smilegatemegaport.com/gameRecord/epic7/epic7_artifact.json"
|
||||||
|
|
||||||
// 获取角色信息
|
// 获取角色信息
|
||||||
HeroListURL = "https://e7-optimizer-game-data.s3-accelerate.amazonaws.com/herodata.json"
|
HeroListURL = "https://e7-optimizer-game-data.s3-accelerate.amazonaws.com/herodata.json"
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EpicArtifactInfoDao is the data access object for table epic_artifact_info.
|
// EpicArtifactInfoDao is the data access object for the table epic_artifact_info.
|
||||||
type EpicArtifactInfoDao struct {
|
type EpicArtifactInfoDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns EpicArtifactInfoColumns // columns contains all the column names of Table for convenient usage.
|
columns EpicArtifactInfoColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// EpicArtifactInfoColumns defines and stores column names for table epic_artifact_info.
|
// EpicArtifactInfoColumns defines and stores column names for the table epic_artifact_info.
|
||||||
type EpicArtifactInfoColumns struct {
|
type EpicArtifactInfoColumns struct {
|
||||||
Id string // 文件编号
|
Id string // 文件编号
|
||||||
ArtifactName string // 配置编号
|
ArtifactName string // 配置编号
|
||||||
@@ -37,7 +38,7 @@ type EpicArtifactInfoColumns struct {
|
|||||||
ImageUrl string // 图片地址
|
ImageUrl string // 图片地址
|
||||||
}
|
}
|
||||||
|
|
||||||
// epicArtifactInfoColumns holds the columns for table epic_artifact_info.
|
// epicArtifactInfoColumns holds the columns for the table epic_artifact_info.
|
||||||
var epicArtifactInfoColumns = EpicArtifactInfoColumns{
|
var epicArtifactInfoColumns = EpicArtifactInfoColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
ArtifactName: "artifact_name",
|
ArtifactName: "artifact_name",
|
||||||
@@ -57,44 +58,49 @@ var epicArtifactInfoColumns = EpicArtifactInfoColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewEpicArtifactInfoDao creates and returns a new DAO object for table data access.
|
// NewEpicArtifactInfoDao creates and returns a new DAO object for table data access.
|
||||||
func NewEpicArtifactInfoDao() *EpicArtifactInfoDao {
|
func NewEpicArtifactInfoDao(handlers ...gdb.ModelHandler) *EpicArtifactInfoDao {
|
||||||
return &EpicArtifactInfoDao{
|
return &EpicArtifactInfoDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "epic_artifact_info",
|
table: "epic_artifact_info",
|
||||||
columns: epicArtifactInfoColumns,
|
columns: epicArtifactInfoColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *EpicArtifactInfoDao) DB() gdb.DB {
|
func (dao *EpicArtifactInfoDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *EpicArtifactInfoDao) Table() string {
|
func (dao *EpicArtifactInfoDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *EpicArtifactInfoDao) Columns() EpicArtifactInfoColumns {
|
func (dao *EpicArtifactInfoDao) Columns() EpicArtifactInfoColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *EpicArtifactInfoDao) Group() string {
|
func (dao *EpicArtifactInfoDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *EpicArtifactInfoDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *EpicArtifactInfoDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *EpicArtifactInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *EpicArtifactInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EpicGvgAttackTeamsDao is the data access object for table epic_gvg_attack_teams.
|
// EpicGvgAttackTeamsDao is the data access object for the table epic_gvg_attack_teams.
|
||||||
type EpicGvgAttackTeamsDao struct {
|
type EpicGvgAttackTeamsDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns EpicGvgAttackTeamsColumns // columns contains all the column names of Table for convenient usage.
|
columns EpicGvgAttackTeamsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// EpicGvgAttackTeamsColumns defines and stores column names for table epic_gvg_attack_teams.
|
// EpicGvgAttackTeamsColumns defines and stores column names for the table epic_gvg_attack_teams.
|
||||||
type EpicGvgAttackTeamsColumns struct {
|
type EpicGvgAttackTeamsColumns struct {
|
||||||
Id string // id
|
Id string // id
|
||||||
AttackHeroes string // 进攻角色
|
AttackHeroes string // 进攻角色
|
||||||
@@ -29,7 +30,7 @@ type EpicGvgAttackTeamsColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// epicGvgAttackTeamsColumns holds the columns for table epic_gvg_attack_teams.
|
// epicGvgAttackTeamsColumns holds the columns for the table epic_gvg_attack_teams.
|
||||||
var epicGvgAttackTeamsColumns = EpicGvgAttackTeamsColumns{
|
var epicGvgAttackTeamsColumns = EpicGvgAttackTeamsColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
AttackHeroes: "attack_heroes",
|
AttackHeroes: "attack_heroes",
|
||||||
@@ -41,44 +42,49 @@ var epicGvgAttackTeamsColumns = EpicGvgAttackTeamsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewEpicGvgAttackTeamsDao creates and returns a new DAO object for table data access.
|
// NewEpicGvgAttackTeamsDao creates and returns a new DAO object for table data access.
|
||||||
func NewEpicGvgAttackTeamsDao() *EpicGvgAttackTeamsDao {
|
func NewEpicGvgAttackTeamsDao(handlers ...gdb.ModelHandler) *EpicGvgAttackTeamsDao {
|
||||||
return &EpicGvgAttackTeamsDao{
|
return &EpicGvgAttackTeamsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "epic_gvg_attack_teams",
|
table: "epic_gvg_attack_teams",
|
||||||
columns: epicGvgAttackTeamsColumns,
|
columns: epicGvgAttackTeamsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *EpicGvgAttackTeamsDao) DB() gdb.DB {
|
func (dao *EpicGvgAttackTeamsDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *EpicGvgAttackTeamsDao) Table() string {
|
func (dao *EpicGvgAttackTeamsDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *EpicGvgAttackTeamsDao) Columns() EpicGvgAttackTeamsColumns {
|
func (dao *EpicGvgAttackTeamsDao) Columns() EpicGvgAttackTeamsColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *EpicGvgAttackTeamsDao) Group() string {
|
func (dao *EpicGvgAttackTeamsDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *EpicGvgAttackTeamsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *EpicGvgAttackTeamsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *EpicGvgAttackTeamsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *EpicGvgAttackTeamsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EpicGvgDefenseAttackMappingDao is the data access object for table epic_gvg_defense_attack_mapping.
|
// EpicGvgDefenseAttackMappingDao is the data access object for the table epic_gvg_defense_attack_mapping.
|
||||||
type EpicGvgDefenseAttackMappingDao struct {
|
type EpicGvgDefenseAttackMappingDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns EpicGvgDefenseAttackMappingColumns // columns contains all the column names of Table for convenient usage.
|
columns EpicGvgDefenseAttackMappingColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// EpicGvgDefenseAttackMappingColumns defines and stores column names for table epic_gvg_defense_attack_mapping.
|
// EpicGvgDefenseAttackMappingColumns defines and stores column names for the table epic_gvg_defense_attack_mapping.
|
||||||
type EpicGvgDefenseAttackMappingColumns struct {
|
type EpicGvgDefenseAttackMappingColumns struct {
|
||||||
Id string // id
|
Id string // id
|
||||||
DefenseId string // 防守阵容
|
DefenseId string // 防守阵容
|
||||||
@@ -35,7 +36,7 @@ type EpicGvgDefenseAttackMappingColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// epicGvgDefenseAttackMappingColumns holds the columns for table epic_gvg_defense_attack_mapping.
|
// epicGvgDefenseAttackMappingColumns holds the columns for the table epic_gvg_defense_attack_mapping.
|
||||||
var epicGvgDefenseAttackMappingColumns = EpicGvgDefenseAttackMappingColumns{
|
var epicGvgDefenseAttackMappingColumns = EpicGvgDefenseAttackMappingColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
DefenseId: "defense_id",
|
DefenseId: "defense_id",
|
||||||
@@ -53,44 +54,49 @@ var epicGvgDefenseAttackMappingColumns = EpicGvgDefenseAttackMappingColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewEpicGvgDefenseAttackMappingDao creates and returns a new DAO object for table data access.
|
// NewEpicGvgDefenseAttackMappingDao creates and returns a new DAO object for table data access.
|
||||||
func NewEpicGvgDefenseAttackMappingDao() *EpicGvgDefenseAttackMappingDao {
|
func NewEpicGvgDefenseAttackMappingDao(handlers ...gdb.ModelHandler) *EpicGvgDefenseAttackMappingDao {
|
||||||
return &EpicGvgDefenseAttackMappingDao{
|
return &EpicGvgDefenseAttackMappingDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "epic_gvg_defense_attack_mapping",
|
table: "epic_gvg_defense_attack_mapping",
|
||||||
columns: epicGvgDefenseAttackMappingColumns,
|
columns: epicGvgDefenseAttackMappingColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *EpicGvgDefenseAttackMappingDao) DB() gdb.DB {
|
func (dao *EpicGvgDefenseAttackMappingDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *EpicGvgDefenseAttackMappingDao) Table() string {
|
func (dao *EpicGvgDefenseAttackMappingDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *EpicGvgDefenseAttackMappingDao) Columns() EpicGvgDefenseAttackMappingColumns {
|
func (dao *EpicGvgDefenseAttackMappingDao) Columns() EpicGvgDefenseAttackMappingColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *EpicGvgDefenseAttackMappingDao) Group() string {
|
func (dao *EpicGvgDefenseAttackMappingDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *EpicGvgDefenseAttackMappingDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *EpicGvgDefenseAttackMappingDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *EpicGvgDefenseAttackMappingDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *EpicGvgDefenseAttackMappingDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EpicGvgDefenseTeamsDao is the data access object for table epic_gvg_defense_teams.
|
// EpicGvgDefenseTeamsDao is the data access object for the table epic_gvg_defense_teams.
|
||||||
type EpicGvgDefenseTeamsDao struct {
|
type EpicGvgDefenseTeamsDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns EpicGvgDefenseTeamsColumns // columns contains all the column names of Table for convenient usage.
|
columns EpicGvgDefenseTeamsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// EpicGvgDefenseTeamsColumns defines and stores column names for table epic_gvg_defense_teams.
|
// EpicGvgDefenseTeamsColumns defines and stores column names for the table epic_gvg_defense_teams.
|
||||||
type EpicGvgDefenseTeamsColumns struct {
|
type EpicGvgDefenseTeamsColumns struct {
|
||||||
Id string // id
|
Id string // id
|
||||||
DefenseHeroes string // 防守角色
|
DefenseHeroes string // 防守角色
|
||||||
@@ -29,7 +30,7 @@ type EpicGvgDefenseTeamsColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// epicGvgDefenseTeamsColumns holds the columns for table epic_gvg_defense_teams.
|
// epicGvgDefenseTeamsColumns holds the columns for the table epic_gvg_defense_teams.
|
||||||
var epicGvgDefenseTeamsColumns = EpicGvgDefenseTeamsColumns{
|
var epicGvgDefenseTeamsColumns = EpicGvgDefenseTeamsColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
DefenseHeroes: "defense_heroes",
|
DefenseHeroes: "defense_heroes",
|
||||||
@@ -41,44 +42,49 @@ var epicGvgDefenseTeamsColumns = EpicGvgDefenseTeamsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewEpicGvgDefenseTeamsDao creates and returns a new DAO object for table data access.
|
// NewEpicGvgDefenseTeamsDao creates and returns a new DAO object for table data access.
|
||||||
func NewEpicGvgDefenseTeamsDao() *EpicGvgDefenseTeamsDao {
|
func NewEpicGvgDefenseTeamsDao(handlers ...gdb.ModelHandler) *EpicGvgDefenseTeamsDao {
|
||||||
return &EpicGvgDefenseTeamsDao{
|
return &EpicGvgDefenseTeamsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "epic_gvg_defense_teams",
|
table: "epic_gvg_defense_teams",
|
||||||
columns: epicGvgDefenseTeamsColumns,
|
columns: epicGvgDefenseTeamsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *EpicGvgDefenseTeamsDao) DB() gdb.DB {
|
func (dao *EpicGvgDefenseTeamsDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *EpicGvgDefenseTeamsDao) Table() string {
|
func (dao *EpicGvgDefenseTeamsDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *EpicGvgDefenseTeamsDao) Columns() EpicGvgDefenseTeamsColumns {
|
func (dao *EpicGvgDefenseTeamsDao) Columns() EpicGvgDefenseTeamsColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *EpicGvgDefenseTeamsDao) Group() string {
|
func (dao *EpicGvgDefenseTeamsDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *EpicGvgDefenseTeamsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *EpicGvgDefenseTeamsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *EpicGvgDefenseTeamsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *EpicGvgDefenseTeamsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EpicHeroInfoDao is the data access object for table epic_hero_info.
|
// EpicHeroInfoDao is the data access object for the table epic_hero_info.
|
||||||
type EpicHeroInfoDao struct {
|
type EpicHeroInfoDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns EpicHeroInfoColumns // columns contains all the column names of Table for convenient usage.
|
columns EpicHeroInfoColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// EpicHeroInfoColumns defines and stores column names for table epic_hero_info.
|
// EpicHeroInfoColumns defines and stores column names for the table epic_hero_info.
|
||||||
type EpicHeroInfoColumns struct {
|
type EpicHeroInfoColumns struct {
|
||||||
Id string // 文件编号
|
Id string // 文件编号
|
||||||
HeroName string // 配置编号
|
HeroName string // 配置编号
|
||||||
@@ -41,7 +42,7 @@ type EpicHeroInfoColumns struct {
|
|||||||
SetUpdateTime string // 配装更新时间
|
SetUpdateTime string // 配装更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// epicHeroInfoColumns holds the columns for table epic_hero_info.
|
// epicHeroInfoColumns holds the columns for the table epic_hero_info.
|
||||||
var epicHeroInfoColumns = EpicHeroInfoColumns{
|
var epicHeroInfoColumns = EpicHeroInfoColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
HeroName: "hero_name",
|
HeroName: "hero_name",
|
||||||
@@ -65,44 +66,49 @@ var epicHeroInfoColumns = EpicHeroInfoColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewEpicHeroInfoDao creates and returns a new DAO object for table data access.
|
// NewEpicHeroInfoDao creates and returns a new DAO object for table data access.
|
||||||
func NewEpicHeroInfoDao() *EpicHeroInfoDao {
|
func NewEpicHeroInfoDao(handlers ...gdb.ModelHandler) *EpicHeroInfoDao {
|
||||||
return &EpicHeroInfoDao{
|
return &EpicHeroInfoDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "epic_hero_info",
|
table: "epic_hero_info",
|
||||||
columns: epicHeroInfoColumns,
|
columns: epicHeroInfoColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *EpicHeroInfoDao) DB() gdb.DB {
|
func (dao *EpicHeroInfoDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *EpicHeroInfoDao) Table() string {
|
func (dao *EpicHeroInfoDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *EpicHeroInfoDao) Columns() EpicHeroInfoColumns {
|
func (dao *EpicHeroInfoDao) Columns() EpicHeroInfoColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *EpicHeroInfoDao) Group() string {
|
func (dao *EpicHeroInfoDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *EpicHeroInfoDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *EpicHeroInfoDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *EpicHeroInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *EpicHeroInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EpicHeroUserBuildDao is the data access object for table epic_hero_user_build.
|
// EpicHeroUserBuildDao is the data access object for the table epic_hero_user_build.
|
||||||
type EpicHeroUserBuildDao struct {
|
type EpicHeroUserBuildDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns EpicHeroUserBuildColumns // columns contains all the column names of Table for convenient usage.
|
columns EpicHeroUserBuildColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// EpicHeroUserBuildColumns defines and stores column names for table epic_hero_user_build.
|
// EpicHeroUserBuildColumns defines and stores column names for the table epic_hero_user_build.
|
||||||
type EpicHeroUserBuildColumns struct {
|
type EpicHeroUserBuildColumns struct {
|
||||||
Id string // 文件编号
|
Id string // 文件编号
|
||||||
ArtifactCode string // 配置编号
|
ArtifactCode string // 配置编号
|
||||||
@@ -33,7 +34,7 @@ type EpicHeroUserBuildColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// epicHeroUserBuildColumns holds the columns for table epic_hero_user_build.
|
// epicHeroUserBuildColumns holds the columns for the table epic_hero_user_build.
|
||||||
var epicHeroUserBuildColumns = EpicHeroUserBuildColumns{
|
var epicHeroUserBuildColumns = EpicHeroUserBuildColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
ArtifactCode: "artifact_code",
|
ArtifactCode: "artifact_code",
|
||||||
@@ -49,44 +50,49 @@ var epicHeroUserBuildColumns = EpicHeroUserBuildColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewEpicHeroUserBuildDao creates and returns a new DAO object for table data access.
|
// NewEpicHeroUserBuildDao creates and returns a new DAO object for table data access.
|
||||||
func NewEpicHeroUserBuildDao() *EpicHeroUserBuildDao {
|
func NewEpicHeroUserBuildDao(handlers ...gdb.ModelHandler) *EpicHeroUserBuildDao {
|
||||||
return &EpicHeroUserBuildDao{
|
return &EpicHeroUserBuildDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "epic_hero_user_build",
|
table: "epic_hero_user_build",
|
||||||
columns: epicHeroUserBuildColumns,
|
columns: epicHeroUserBuildColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *EpicHeroUserBuildDao) DB() gdb.DB {
|
func (dao *EpicHeroUserBuildDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *EpicHeroUserBuildDao) Table() string {
|
func (dao *EpicHeroUserBuildDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *EpicHeroUserBuildDao) Columns() EpicHeroUserBuildColumns {
|
func (dao *EpicHeroUserBuildDao) Columns() EpicHeroUserBuildColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *EpicHeroUserBuildDao) Group() string {
|
func (dao *EpicHeroUserBuildDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *EpicHeroUserBuildDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *EpicHeroUserBuildDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *EpicHeroUserBuildDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *EpicHeroUserBuildDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EpicI18NMappingsDao is the data access object for table epic_i18n_mappings.
|
// EpicI18NMappingsDao is the data access object for the table epic_i18n_mappings.
|
||||||
type EpicI18NMappingsDao struct {
|
type EpicI18NMappingsDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns EpicI18NMappingsColumns // columns contains all the column names of Table for convenient usage.
|
columns EpicI18NMappingsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// EpicI18NMappingsColumns defines and stores column names for table epic_i18n_mappings.
|
// EpicI18NMappingsColumns defines and stores column names for the table epic_i18n_mappings.
|
||||||
type EpicI18NMappingsColumns struct {
|
type EpicI18NMappingsColumns struct {
|
||||||
Id string // 主键ID
|
Id string // 主键ID
|
||||||
KeyName string // 英文key
|
KeyName string // 英文key
|
||||||
@@ -31,9 +32,10 @@ type EpicI18NMappingsColumns struct {
|
|||||||
Updater string // 更新者
|
Updater string // 更新者
|
||||||
UpdateTime string // 更新时间
|
UpdateTime string // 更新时间
|
||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
|
Code string // 编码
|
||||||
}
|
}
|
||||||
|
|
||||||
// epicI18NMappingsColumns holds the columns for table epic_i18n_mappings.
|
// epicI18NMappingsColumns holds the columns for the table epic_i18n_mappings.
|
||||||
var epicI18NMappingsColumns = EpicI18NMappingsColumns{
|
var epicI18NMappingsColumns = EpicI18NMappingsColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
KeyName: "key_name",
|
KeyName: "key_name",
|
||||||
@@ -46,47 +48,53 @@ var epicI18NMappingsColumns = EpicI18NMappingsColumns{
|
|||||||
Updater: "updater",
|
Updater: "updater",
|
||||||
UpdateTime: "update_time",
|
UpdateTime: "update_time",
|
||||||
Deleted: "deleted",
|
Deleted: "deleted",
|
||||||
|
Code: "code",
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEpicI18NMappingsDao creates and returns a new DAO object for table data access.
|
// NewEpicI18NMappingsDao creates and returns a new DAO object for table data access.
|
||||||
func NewEpicI18NMappingsDao() *EpicI18NMappingsDao {
|
func NewEpicI18NMappingsDao(handlers ...gdb.ModelHandler) *EpicI18NMappingsDao {
|
||||||
return &EpicI18NMappingsDao{
|
return &EpicI18NMappingsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "epic_i18n_mappings",
|
table: "epic_i18n_mappings",
|
||||||
columns: epicI18NMappingsColumns,
|
columns: epicI18NMappingsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *EpicI18NMappingsDao) DB() gdb.DB {
|
func (dao *EpicI18NMappingsDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *EpicI18NMappingsDao) Table() string {
|
func (dao *EpicI18NMappingsDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *EpicI18NMappingsDao) Columns() EpicI18NMappingsColumns {
|
func (dao *EpicI18NMappingsDao) Columns() EpicI18NMappingsColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *EpicI18NMappingsDao) Group() string {
|
func (dao *EpicI18NMappingsDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *EpicI18NMappingsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *EpicI18NMappingsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *EpicI18NMappingsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *EpicI18NMappingsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FribbleHeroSetDao is the data access object for table fribble_hero_set.
|
// FribbleHeroSetDao is the data access object for the table fribble_hero_set.
|
||||||
type FribbleHeroSetDao struct {
|
type FribbleHeroSetDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns FribbleHeroSetColumns // columns contains all the column names of Table for convenient usage.
|
columns FribbleHeroSetColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// FribbleHeroSetColumns defines and stores column names for table fribble_hero_set.
|
// FribbleHeroSetColumns defines and stores column names for the table fribble_hero_set.
|
||||||
type FribbleHeroSetColumns struct {
|
type FribbleHeroSetColumns struct {
|
||||||
Id string // 文件编号
|
Id string // 文件编号
|
||||||
HeroCode string // 配置编号
|
HeroCode string // 配置编号
|
||||||
@@ -32,7 +33,7 @@ type FribbleHeroSetColumns struct {
|
|||||||
SuccessGet string //
|
SuccessGet string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// fribbleHeroSetColumns holds the columns for table fribble_hero_set.
|
// fribbleHeroSetColumns holds the columns for the table fribble_hero_set.
|
||||||
var fribbleHeroSetColumns = FribbleHeroSetColumns{
|
var fribbleHeroSetColumns = FribbleHeroSetColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
HeroCode: "hero_code",
|
HeroCode: "hero_code",
|
||||||
@@ -47,44 +48,49 @@ var fribbleHeroSetColumns = FribbleHeroSetColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewFribbleHeroSetDao creates and returns a new DAO object for table data access.
|
// NewFribbleHeroSetDao creates and returns a new DAO object for table data access.
|
||||||
func NewFribbleHeroSetDao() *FribbleHeroSetDao {
|
func NewFribbleHeroSetDao(handlers ...gdb.ModelHandler) *FribbleHeroSetDao {
|
||||||
return &FribbleHeroSetDao{
|
return &FribbleHeroSetDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "fribble_hero_set",
|
table: "fribble_hero_set",
|
||||||
columns: fribbleHeroSetColumns,
|
columns: fribbleHeroSetColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *FribbleHeroSetDao) DB() gdb.DB {
|
func (dao *FribbleHeroSetDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *FribbleHeroSetDao) Table() string {
|
func (dao *FribbleHeroSetDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *FribbleHeroSetDao) Columns() FribbleHeroSetColumns {
|
func (dao *FribbleHeroSetDao) Columns() FribbleHeroSetColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *FribbleHeroSetDao) Group() string {
|
func (dao *FribbleHeroSetDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *FribbleHeroSetDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *FribbleHeroSetDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *FribbleHeroSetDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *FribbleHeroSetDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GearSetInfoDao is the data access object for table gear_set_info.
|
// GearSetInfoDao is the data access object for the table gear_set_info.
|
||||||
type GearSetInfoDao struct {
|
type GearSetInfoDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns GearSetInfoColumns // columns contains all the column names of Table for convenient usage.
|
columns GearSetInfoColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// GearSetInfoColumns defines and stores column names for table gear_set_info.
|
// GearSetInfoColumns defines and stores column names for the table gear_set_info.
|
||||||
type GearSetInfoColumns struct {
|
type GearSetInfoColumns struct {
|
||||||
Id string // 装备ID
|
Id string // 装备ID
|
||||||
Level string // 装备等级
|
Level string // 装备等级
|
||||||
@@ -45,7 +46,7 @@ type GearSetInfoColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// gearSetInfoColumns holds the columns for table gear_set_info.
|
// gearSetInfoColumns holds the columns for the table gear_set_info.
|
||||||
var gearSetInfoColumns = GearSetInfoColumns{
|
var gearSetInfoColumns = GearSetInfoColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Level: "level",
|
Level: "level",
|
||||||
@@ -73,44 +74,49 @@ var gearSetInfoColumns = GearSetInfoColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewGearSetInfoDao creates and returns a new DAO object for table data access.
|
// NewGearSetInfoDao creates and returns a new DAO object for table data access.
|
||||||
func NewGearSetInfoDao() *GearSetInfoDao {
|
func NewGearSetInfoDao(handlers ...gdb.ModelHandler) *GearSetInfoDao {
|
||||||
return &GearSetInfoDao{
|
return &GearSetInfoDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "gear_set_info",
|
table: "gear_set_info",
|
||||||
columns: gearSetInfoColumns,
|
columns: gearSetInfoColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *GearSetInfoDao) DB() gdb.DB {
|
func (dao *GearSetInfoDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *GearSetInfoDao) Table() string {
|
func (dao *GearSetInfoDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *GearSetInfoDao) Columns() GearSetInfoColumns {
|
func (dao *GearSetInfoDao) Columns() GearSetInfoColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *GearSetInfoDao) Group() string {
|
func (dao *GearSetInfoDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *GearSetInfoDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *GearSetInfoDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *GearSetInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *GearSetInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraApiAccessLogDao is the data access object for table infra_api_access_log.
|
// InfraApiAccessLogDao is the data access object for the table infra_api_access_log.
|
||||||
type InfraApiAccessLogDao struct {
|
type InfraApiAccessLogDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraApiAccessLogColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraApiAccessLogColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraApiAccessLogColumns defines and stores column names for table infra_api_access_log.
|
// InfraApiAccessLogColumns defines and stores column names for the table infra_api_access_log.
|
||||||
type InfraApiAccessLogColumns struct {
|
type InfraApiAccessLogColumns struct {
|
||||||
Id string // 日志主键
|
Id string // 日志主键
|
||||||
TraceId string // 链路追踪编号
|
TraceId string // 链路追踪编号
|
||||||
@@ -47,7 +48,7 @@ type InfraApiAccessLogColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraApiAccessLogColumns holds the columns for table infra_api_access_log.
|
// infraApiAccessLogColumns holds the columns for the table infra_api_access_log.
|
||||||
var infraApiAccessLogColumns = InfraApiAccessLogColumns{
|
var infraApiAccessLogColumns = InfraApiAccessLogColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
TraceId: "trace_id",
|
TraceId: "trace_id",
|
||||||
@@ -77,44 +78,49 @@ var infraApiAccessLogColumns = InfraApiAccessLogColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraApiAccessLogDao creates and returns a new DAO object for table data access.
|
// NewInfraApiAccessLogDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraApiAccessLogDao() *InfraApiAccessLogDao {
|
func NewInfraApiAccessLogDao(handlers ...gdb.ModelHandler) *InfraApiAccessLogDao {
|
||||||
return &InfraApiAccessLogDao{
|
return &InfraApiAccessLogDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_api_access_log",
|
table: "infra_api_access_log",
|
||||||
columns: infraApiAccessLogColumns,
|
columns: infraApiAccessLogColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraApiAccessLogDao) DB() gdb.DB {
|
func (dao *InfraApiAccessLogDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraApiAccessLogDao) Table() string {
|
func (dao *InfraApiAccessLogDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraApiAccessLogDao) Columns() InfraApiAccessLogColumns {
|
func (dao *InfraApiAccessLogDao) Columns() InfraApiAccessLogColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraApiAccessLogDao) Group() string {
|
func (dao *InfraApiAccessLogDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraApiAccessLogDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraApiAccessLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraApiAccessLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraApiAccessLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraApiErrorLogDao is the data access object for table infra_api_error_log.
|
// InfraApiErrorLogDao is the data access object for the table infra_api_error_log.
|
||||||
type InfraApiErrorLogDao struct {
|
type InfraApiErrorLogDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraApiErrorLogColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraApiErrorLogColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraApiErrorLogColumns defines and stores column names for table infra_api_error_log.
|
// InfraApiErrorLogColumns defines and stores column names for the table infra_api_error_log.
|
||||||
type InfraApiErrorLogColumns struct {
|
type InfraApiErrorLogColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
TraceId string // 链路追踪编号
|
TraceId string // 链路追踪编号
|
||||||
@@ -50,7 +51,7 @@ type InfraApiErrorLogColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraApiErrorLogColumns holds the columns for table infra_api_error_log.
|
// infraApiErrorLogColumns holds the columns for the table infra_api_error_log.
|
||||||
var infraApiErrorLogColumns = InfraApiErrorLogColumns{
|
var infraApiErrorLogColumns = InfraApiErrorLogColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
TraceId: "trace_id",
|
TraceId: "trace_id",
|
||||||
@@ -83,44 +84,49 @@ var infraApiErrorLogColumns = InfraApiErrorLogColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraApiErrorLogDao creates and returns a new DAO object for table data access.
|
// NewInfraApiErrorLogDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraApiErrorLogDao() *InfraApiErrorLogDao {
|
func NewInfraApiErrorLogDao(handlers ...gdb.ModelHandler) *InfraApiErrorLogDao {
|
||||||
return &InfraApiErrorLogDao{
|
return &InfraApiErrorLogDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_api_error_log",
|
table: "infra_api_error_log",
|
||||||
columns: infraApiErrorLogColumns,
|
columns: infraApiErrorLogColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraApiErrorLogDao) DB() gdb.DB {
|
func (dao *InfraApiErrorLogDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraApiErrorLogDao) Table() string {
|
func (dao *InfraApiErrorLogDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraApiErrorLogDao) Columns() InfraApiErrorLogColumns {
|
func (dao *InfraApiErrorLogDao) Columns() InfraApiErrorLogColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraApiErrorLogDao) Group() string {
|
func (dao *InfraApiErrorLogDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraApiErrorLogDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraApiErrorLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraApiErrorLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraApiErrorLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraCodegenColumnDao is the data access object for table infra_codegen_column.
|
// InfraCodegenColumnDao is the data access object for the table infra_codegen_column.
|
||||||
type InfraCodegenColumnDao struct {
|
type InfraCodegenColumnDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraCodegenColumnColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraCodegenColumnColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraCodegenColumnColumns defines and stores column names for table infra_codegen_column.
|
// InfraCodegenColumnColumns defines and stores column names for the table infra_codegen_column.
|
||||||
type InfraCodegenColumnColumns struct {
|
type InfraCodegenColumnColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
TableId string // 表编号
|
TableId string // 表编号
|
||||||
@@ -45,7 +46,7 @@ type InfraCodegenColumnColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraCodegenColumnColumns holds the columns for table infra_codegen_column.
|
// infraCodegenColumnColumns holds the columns for the table infra_codegen_column.
|
||||||
var infraCodegenColumnColumns = InfraCodegenColumnColumns{
|
var infraCodegenColumnColumns = InfraCodegenColumnColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
TableId: "table_id",
|
TableId: "table_id",
|
||||||
@@ -73,44 +74,49 @@ var infraCodegenColumnColumns = InfraCodegenColumnColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraCodegenColumnDao creates and returns a new DAO object for table data access.
|
// NewInfraCodegenColumnDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraCodegenColumnDao() *InfraCodegenColumnDao {
|
func NewInfraCodegenColumnDao(handlers ...gdb.ModelHandler) *InfraCodegenColumnDao {
|
||||||
return &InfraCodegenColumnDao{
|
return &InfraCodegenColumnDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_codegen_column",
|
table: "infra_codegen_column",
|
||||||
columns: infraCodegenColumnColumns,
|
columns: infraCodegenColumnColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraCodegenColumnDao) DB() gdb.DB {
|
func (dao *InfraCodegenColumnDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraCodegenColumnDao) Table() string {
|
func (dao *InfraCodegenColumnDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraCodegenColumnDao) Columns() InfraCodegenColumnColumns {
|
func (dao *InfraCodegenColumnDao) Columns() InfraCodegenColumnColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraCodegenColumnDao) Group() string {
|
func (dao *InfraCodegenColumnDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraCodegenColumnDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraCodegenColumnDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraCodegenColumnDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraCodegenColumnDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraCodegenTableDao is the data access object for table infra_codegen_table.
|
// InfraCodegenTableDao is the data access object for the table infra_codegen_table.
|
||||||
type InfraCodegenTableDao struct {
|
type InfraCodegenTableDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraCodegenTableColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraCodegenTableColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraCodegenTableColumns defines and stores column names for table infra_codegen_table.
|
// InfraCodegenTableColumns defines and stores column names for the table infra_codegen_table.
|
||||||
type InfraCodegenTableColumns struct {
|
type InfraCodegenTableColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
DataSourceConfigId string // 数据源配置的编号
|
DataSourceConfigId string // 数据源配置的编号
|
||||||
@@ -46,7 +47,7 @@ type InfraCodegenTableColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraCodegenTableColumns holds the columns for table infra_codegen_table.
|
// infraCodegenTableColumns holds the columns for the table infra_codegen_table.
|
||||||
var infraCodegenTableColumns = InfraCodegenTableColumns{
|
var infraCodegenTableColumns = InfraCodegenTableColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
DataSourceConfigId: "data_source_config_id",
|
DataSourceConfigId: "data_source_config_id",
|
||||||
@@ -75,44 +76,49 @@ var infraCodegenTableColumns = InfraCodegenTableColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraCodegenTableDao creates and returns a new DAO object for table data access.
|
// NewInfraCodegenTableDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraCodegenTableDao() *InfraCodegenTableDao {
|
func NewInfraCodegenTableDao(handlers ...gdb.ModelHandler) *InfraCodegenTableDao {
|
||||||
return &InfraCodegenTableDao{
|
return &InfraCodegenTableDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_codegen_table",
|
table: "infra_codegen_table",
|
||||||
columns: infraCodegenTableColumns,
|
columns: infraCodegenTableColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraCodegenTableDao) DB() gdb.DB {
|
func (dao *InfraCodegenTableDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraCodegenTableDao) Table() string {
|
func (dao *InfraCodegenTableDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraCodegenTableDao) Columns() InfraCodegenTableColumns {
|
func (dao *InfraCodegenTableDao) Columns() InfraCodegenTableColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraCodegenTableDao) Group() string {
|
func (dao *InfraCodegenTableDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraCodegenTableDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraCodegenTableDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraCodegenTableDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraCodegenTableDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraConfigDao is the data access object for table infra_config.
|
// InfraConfigDao is the data access object for the table infra_config.
|
||||||
type InfraConfigDao struct {
|
type InfraConfigDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraConfigColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraConfigColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraConfigColumns defines and stores column names for table infra_config.
|
// InfraConfigColumns defines and stores column names for the table infra_config.
|
||||||
type InfraConfigColumns struct {
|
type InfraConfigColumns struct {
|
||||||
Id string // 参数主键
|
Id string // 参数主键
|
||||||
Category string // 参数分组
|
Category string // 参数分组
|
||||||
@@ -35,7 +36,7 @@ type InfraConfigColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraConfigColumns holds the columns for table infra_config.
|
// infraConfigColumns holds the columns for the table infra_config.
|
||||||
var infraConfigColumns = InfraConfigColumns{
|
var infraConfigColumns = InfraConfigColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Category: "category",
|
Category: "category",
|
||||||
@@ -53,44 +54,49 @@ var infraConfigColumns = InfraConfigColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraConfigDao creates and returns a new DAO object for table data access.
|
// NewInfraConfigDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraConfigDao() *InfraConfigDao {
|
func NewInfraConfigDao(handlers ...gdb.ModelHandler) *InfraConfigDao {
|
||||||
return &InfraConfigDao{
|
return &InfraConfigDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_config",
|
table: "infra_config",
|
||||||
columns: infraConfigColumns,
|
columns: infraConfigColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraConfigDao) DB() gdb.DB {
|
func (dao *InfraConfigDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraConfigDao) Table() string {
|
func (dao *InfraConfigDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraConfigDao) Columns() InfraConfigColumns {
|
func (dao *InfraConfigDao) Columns() InfraConfigColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraConfigDao) Group() string {
|
func (dao *InfraConfigDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraConfigDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraConfigDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraDataSourceConfigDao is the data access object for table infra_data_source_config.
|
// InfraDataSourceConfigDao is the data access object for the table infra_data_source_config.
|
||||||
type InfraDataSourceConfigDao struct {
|
type InfraDataSourceConfigDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraDataSourceConfigColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraDataSourceConfigColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraDataSourceConfigColumns defines and stores column names for table infra_data_source_config.
|
// InfraDataSourceConfigColumns defines and stores column names for the table infra_data_source_config.
|
||||||
type InfraDataSourceConfigColumns struct {
|
type InfraDataSourceConfigColumns struct {
|
||||||
Id string // 主键编号
|
Id string // 主键编号
|
||||||
Name string // 参数名称
|
Name string // 参数名称
|
||||||
@@ -32,7 +33,7 @@ type InfraDataSourceConfigColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraDataSourceConfigColumns holds the columns for table infra_data_source_config.
|
// infraDataSourceConfigColumns holds the columns for the table infra_data_source_config.
|
||||||
var infraDataSourceConfigColumns = InfraDataSourceConfigColumns{
|
var infraDataSourceConfigColumns = InfraDataSourceConfigColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -47,44 +48,49 @@ var infraDataSourceConfigColumns = InfraDataSourceConfigColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraDataSourceConfigDao creates and returns a new DAO object for table data access.
|
// NewInfraDataSourceConfigDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraDataSourceConfigDao() *InfraDataSourceConfigDao {
|
func NewInfraDataSourceConfigDao(handlers ...gdb.ModelHandler) *InfraDataSourceConfigDao {
|
||||||
return &InfraDataSourceConfigDao{
|
return &InfraDataSourceConfigDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_data_source_config",
|
table: "infra_data_source_config",
|
||||||
columns: infraDataSourceConfigColumns,
|
columns: infraDataSourceConfigColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraDataSourceConfigDao) DB() gdb.DB {
|
func (dao *InfraDataSourceConfigDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraDataSourceConfigDao) Table() string {
|
func (dao *InfraDataSourceConfigDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraDataSourceConfigDao) Columns() InfraDataSourceConfigColumns {
|
func (dao *InfraDataSourceConfigDao) Columns() InfraDataSourceConfigColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraDataSourceConfigDao) Group() string {
|
func (dao *InfraDataSourceConfigDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraDataSourceConfigDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraDataSourceConfigDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraDataSourceConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraDataSourceConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraFileDao is the data access object for table infra_file.
|
// InfraFileDao is the data access object for the table infra_file.
|
||||||
type InfraFileDao struct {
|
type InfraFileDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraFileColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraFileColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraFileColumns defines and stores column names for table infra_file.
|
// InfraFileColumns defines and stores column names for the table infra_file.
|
||||||
type InfraFileColumns struct {
|
type InfraFileColumns struct {
|
||||||
Id string // 文件编号
|
Id string // 文件编号
|
||||||
ConfigId string // 配置编号
|
ConfigId string // 配置编号
|
||||||
@@ -34,7 +35,7 @@ type InfraFileColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraFileColumns holds the columns for table infra_file.
|
// infraFileColumns holds the columns for the table infra_file.
|
||||||
var infraFileColumns = InfraFileColumns{
|
var infraFileColumns = InfraFileColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
ConfigId: "config_id",
|
ConfigId: "config_id",
|
||||||
@@ -51,44 +52,49 @@ var infraFileColumns = InfraFileColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraFileDao creates and returns a new DAO object for table data access.
|
// NewInfraFileDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraFileDao() *InfraFileDao {
|
func NewInfraFileDao(handlers ...gdb.ModelHandler) *InfraFileDao {
|
||||||
return &InfraFileDao{
|
return &InfraFileDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_file",
|
table: "infra_file",
|
||||||
columns: infraFileColumns,
|
columns: infraFileColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraFileDao) DB() gdb.DB {
|
func (dao *InfraFileDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraFileDao) Table() string {
|
func (dao *InfraFileDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraFileDao) Columns() InfraFileColumns {
|
func (dao *InfraFileDao) Columns() InfraFileColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraFileDao) Group() string {
|
func (dao *InfraFileDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraFileDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraFileDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraFileDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraFileDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraFileConfigDao is the data access object for table infra_file_config.
|
// InfraFileConfigDao is the data access object for the table infra_file_config.
|
||||||
type InfraFileConfigDao struct {
|
type InfraFileConfigDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraFileConfigColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraFileConfigColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraFileConfigColumns defines and stores column names for table infra_file_config.
|
// InfraFileConfigColumns defines and stores column names for the table infra_file_config.
|
||||||
type InfraFileConfigColumns struct {
|
type InfraFileConfigColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
Name string // 配置名
|
Name string // 配置名
|
||||||
@@ -33,7 +34,7 @@ type InfraFileConfigColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraFileConfigColumns holds the columns for table infra_file_config.
|
// infraFileConfigColumns holds the columns for the table infra_file_config.
|
||||||
var infraFileConfigColumns = InfraFileConfigColumns{
|
var infraFileConfigColumns = InfraFileConfigColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -49,44 +50,49 @@ var infraFileConfigColumns = InfraFileConfigColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraFileConfigDao creates and returns a new DAO object for table data access.
|
// NewInfraFileConfigDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraFileConfigDao() *InfraFileConfigDao {
|
func NewInfraFileConfigDao(handlers ...gdb.ModelHandler) *InfraFileConfigDao {
|
||||||
return &InfraFileConfigDao{
|
return &InfraFileConfigDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_file_config",
|
table: "infra_file_config",
|
||||||
columns: infraFileConfigColumns,
|
columns: infraFileConfigColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraFileConfigDao) DB() gdb.DB {
|
func (dao *InfraFileConfigDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraFileConfigDao) Table() string {
|
func (dao *InfraFileConfigDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraFileConfigDao) Columns() InfraFileConfigColumns {
|
func (dao *InfraFileConfigDao) Columns() InfraFileConfigColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraFileConfigDao) Group() string {
|
func (dao *InfraFileConfigDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraFileConfigDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraFileConfigDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraFileConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraFileConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraFileContentDao is the data access object for table infra_file_content.
|
// InfraFileContentDao is the data access object for the table infra_file_content.
|
||||||
type InfraFileContentDao struct {
|
type InfraFileContentDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraFileContentColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraFileContentColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraFileContentColumns defines and stores column names for table infra_file_content.
|
// InfraFileContentColumns defines and stores column names for the table infra_file_content.
|
||||||
type InfraFileContentColumns struct {
|
type InfraFileContentColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
ConfigId string // 配置编号
|
ConfigId string // 配置编号
|
||||||
@@ -31,7 +32,7 @@ type InfraFileContentColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraFileContentColumns holds the columns for table infra_file_content.
|
// infraFileContentColumns holds the columns for the table infra_file_content.
|
||||||
var infraFileContentColumns = InfraFileContentColumns{
|
var infraFileContentColumns = InfraFileContentColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
ConfigId: "config_id",
|
ConfigId: "config_id",
|
||||||
@@ -45,44 +46,49 @@ var infraFileContentColumns = InfraFileContentColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraFileContentDao creates and returns a new DAO object for table data access.
|
// NewInfraFileContentDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraFileContentDao() *InfraFileContentDao {
|
func NewInfraFileContentDao(handlers ...gdb.ModelHandler) *InfraFileContentDao {
|
||||||
return &InfraFileContentDao{
|
return &InfraFileContentDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_file_content",
|
table: "infra_file_content",
|
||||||
columns: infraFileContentColumns,
|
columns: infraFileContentColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraFileContentDao) DB() gdb.DB {
|
func (dao *InfraFileContentDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraFileContentDao) Table() string {
|
func (dao *InfraFileContentDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraFileContentDao) Columns() InfraFileContentColumns {
|
func (dao *InfraFileContentDao) Columns() InfraFileContentColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraFileContentDao) Group() string {
|
func (dao *InfraFileContentDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraFileContentDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraFileContentDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraFileContentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraFileContentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraJobDao is the data access object for table infra_job.
|
// InfraJobDao is the data access object for the table infra_job.
|
||||||
type InfraJobDao struct {
|
type InfraJobDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraJobColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraJobColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraJobColumns defines and stores column names for table infra_job.
|
// InfraJobColumns defines and stores column names for the table infra_job.
|
||||||
type InfraJobColumns struct {
|
type InfraJobColumns struct {
|
||||||
Id string // 任务编号
|
Id string // 任务编号
|
||||||
Name string // 任务名称
|
Name string // 任务名称
|
||||||
@@ -36,7 +37,7 @@ type InfraJobColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraJobColumns holds the columns for table infra_job.
|
// infraJobColumns holds the columns for the table infra_job.
|
||||||
var infraJobColumns = InfraJobColumns{
|
var infraJobColumns = InfraJobColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -55,44 +56,49 @@ var infraJobColumns = InfraJobColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraJobDao creates and returns a new DAO object for table data access.
|
// NewInfraJobDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraJobDao() *InfraJobDao {
|
func NewInfraJobDao(handlers ...gdb.ModelHandler) *InfraJobDao {
|
||||||
return &InfraJobDao{
|
return &InfraJobDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_job",
|
table: "infra_job",
|
||||||
columns: infraJobColumns,
|
columns: infraJobColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraJobDao) DB() gdb.DB {
|
func (dao *InfraJobDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraJobDao) Table() string {
|
func (dao *InfraJobDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraJobDao) Columns() InfraJobColumns {
|
func (dao *InfraJobDao) Columns() InfraJobColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraJobDao) Group() string {
|
func (dao *InfraJobDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraJobDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraJobDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraJobDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraJobDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InfraJobLogDao is the data access object for table infra_job_log.
|
// InfraJobLogDao is the data access object for the table infra_job_log.
|
||||||
type InfraJobLogDao struct {
|
type InfraJobLogDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns InfraJobLogColumns // columns contains all the column names of Table for convenient usage.
|
columns InfraJobLogColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfraJobLogColumns defines and stores column names for table infra_job_log.
|
// InfraJobLogColumns defines and stores column names for the table infra_job_log.
|
||||||
type InfraJobLogColumns struct {
|
type InfraJobLogColumns struct {
|
||||||
Id string // 日志编号
|
Id string // 日志编号
|
||||||
JobId string // 任务编号
|
JobId string // 任务编号
|
||||||
@@ -37,7 +38,7 @@ type InfraJobLogColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// infraJobLogColumns holds the columns for table infra_job_log.
|
// infraJobLogColumns holds the columns for the table infra_job_log.
|
||||||
var infraJobLogColumns = InfraJobLogColumns{
|
var infraJobLogColumns = InfraJobLogColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
JobId: "job_id",
|
JobId: "job_id",
|
||||||
@@ -57,44 +58,49 @@ var infraJobLogColumns = InfraJobLogColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInfraJobLogDao creates and returns a new DAO object for table data access.
|
// NewInfraJobLogDao creates and returns a new DAO object for table data access.
|
||||||
func NewInfraJobLogDao() *InfraJobLogDao {
|
func NewInfraJobLogDao(handlers ...gdb.ModelHandler) *InfraJobLogDao {
|
||||||
return &InfraJobLogDao{
|
return &InfraJobLogDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "infra_job_log",
|
table: "infra_job_log",
|
||||||
columns: infraJobLogColumns,
|
columns: infraJobLogColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *InfraJobLogDao) DB() gdb.DB {
|
func (dao *InfraJobLogDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *InfraJobLogDao) Table() string {
|
func (dao *InfraJobLogDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *InfraJobLogDao) Columns() InfraJobLogColumns {
|
func (dao *InfraJobLogDao) Columns() InfraJobLogColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *InfraJobLogDao) Group() string {
|
func (dao *InfraJobLogDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *InfraJobLogDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *InfraJobLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *InfraJobLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *InfraJobLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzBlobTriggersDao is the data access object for table qrtz_blob_triggers.
|
// QrtzBlobTriggersDao is the data access object for the table qrtz_blob_triggers.
|
||||||
type QrtzBlobTriggersDao struct {
|
type QrtzBlobTriggersDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzBlobTriggersColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzBlobTriggersColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzBlobTriggersColumns defines and stores column names for table qrtz_blob_triggers.
|
// QrtzBlobTriggersColumns defines and stores column names for the table qrtz_blob_triggers.
|
||||||
type QrtzBlobTriggersColumns struct {
|
type QrtzBlobTriggersColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
TriggerName string //
|
TriggerName string //
|
||||||
@@ -26,7 +27,7 @@ type QrtzBlobTriggersColumns struct {
|
|||||||
BlobData string //
|
BlobData string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzBlobTriggersColumns holds the columns for table qrtz_blob_triggers.
|
// qrtzBlobTriggersColumns holds the columns for the table qrtz_blob_triggers.
|
||||||
var qrtzBlobTriggersColumns = QrtzBlobTriggersColumns{
|
var qrtzBlobTriggersColumns = QrtzBlobTriggersColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
TriggerName: "TRIGGER_NAME",
|
TriggerName: "TRIGGER_NAME",
|
||||||
@@ -35,44 +36,49 @@ var qrtzBlobTriggersColumns = QrtzBlobTriggersColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzBlobTriggersDao creates and returns a new DAO object for table data access.
|
// NewQrtzBlobTriggersDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzBlobTriggersDao() *QrtzBlobTriggersDao {
|
func NewQrtzBlobTriggersDao(handlers ...gdb.ModelHandler) *QrtzBlobTriggersDao {
|
||||||
return &QrtzBlobTriggersDao{
|
return &QrtzBlobTriggersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_blob_triggers",
|
table: "qrtz_blob_triggers",
|
||||||
columns: qrtzBlobTriggersColumns,
|
columns: qrtzBlobTriggersColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzBlobTriggersDao) DB() gdb.DB {
|
func (dao *QrtzBlobTriggersDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzBlobTriggersDao) Table() string {
|
func (dao *QrtzBlobTriggersDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzBlobTriggersDao) Columns() QrtzBlobTriggersColumns {
|
func (dao *QrtzBlobTriggersDao) Columns() QrtzBlobTriggersColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzBlobTriggersDao) Group() string {
|
func (dao *QrtzBlobTriggersDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzBlobTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzBlobTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzBlobTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzBlobTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,21 +11,22 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzCalendarsDao is the data access object for table qrtz_calendars.
|
// QrtzCalendarsDao is the data access object for the table qrtz_calendars.
|
||||||
type QrtzCalendarsDao struct {
|
type QrtzCalendarsDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzCalendarsColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzCalendarsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzCalendarsColumns defines and stores column names for table qrtz_calendars.
|
// QrtzCalendarsColumns defines and stores column names for the table qrtz_calendars.
|
||||||
type QrtzCalendarsColumns struct {
|
type QrtzCalendarsColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
CalendarName string //
|
CalendarName string //
|
||||||
Calendar string //
|
Calendar string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzCalendarsColumns holds the columns for table qrtz_calendars.
|
// qrtzCalendarsColumns holds the columns for the table qrtz_calendars.
|
||||||
var qrtzCalendarsColumns = QrtzCalendarsColumns{
|
var qrtzCalendarsColumns = QrtzCalendarsColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
CalendarName: "CALENDAR_NAME",
|
CalendarName: "CALENDAR_NAME",
|
||||||
@@ -33,44 +34,49 @@ var qrtzCalendarsColumns = QrtzCalendarsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzCalendarsDao creates and returns a new DAO object for table data access.
|
// NewQrtzCalendarsDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzCalendarsDao() *QrtzCalendarsDao {
|
func NewQrtzCalendarsDao(handlers ...gdb.ModelHandler) *QrtzCalendarsDao {
|
||||||
return &QrtzCalendarsDao{
|
return &QrtzCalendarsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_calendars",
|
table: "qrtz_calendars",
|
||||||
columns: qrtzCalendarsColumns,
|
columns: qrtzCalendarsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzCalendarsDao) DB() gdb.DB {
|
func (dao *QrtzCalendarsDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzCalendarsDao) Table() string {
|
func (dao *QrtzCalendarsDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzCalendarsDao) Columns() QrtzCalendarsColumns {
|
func (dao *QrtzCalendarsDao) Columns() QrtzCalendarsColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzCalendarsDao) Group() string {
|
func (dao *QrtzCalendarsDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzCalendarsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzCalendarsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzCalendarsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzCalendarsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzCronTriggersDao is the data access object for table qrtz_cron_triggers.
|
// QrtzCronTriggersDao is the data access object for the table qrtz_cron_triggers.
|
||||||
type QrtzCronTriggersDao struct {
|
type QrtzCronTriggersDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzCronTriggersColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzCronTriggersColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzCronTriggersColumns defines and stores column names for table qrtz_cron_triggers.
|
// QrtzCronTriggersColumns defines and stores column names for the table qrtz_cron_triggers.
|
||||||
type QrtzCronTriggersColumns struct {
|
type QrtzCronTriggersColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
TriggerName string //
|
TriggerName string //
|
||||||
@@ -27,7 +28,7 @@ type QrtzCronTriggersColumns struct {
|
|||||||
TimeZoneId string //
|
TimeZoneId string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzCronTriggersColumns holds the columns for table qrtz_cron_triggers.
|
// qrtzCronTriggersColumns holds the columns for the table qrtz_cron_triggers.
|
||||||
var qrtzCronTriggersColumns = QrtzCronTriggersColumns{
|
var qrtzCronTriggersColumns = QrtzCronTriggersColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
TriggerName: "TRIGGER_NAME",
|
TriggerName: "TRIGGER_NAME",
|
||||||
@@ -37,44 +38,49 @@ var qrtzCronTriggersColumns = QrtzCronTriggersColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzCronTriggersDao creates and returns a new DAO object for table data access.
|
// NewQrtzCronTriggersDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzCronTriggersDao() *QrtzCronTriggersDao {
|
func NewQrtzCronTriggersDao(handlers ...gdb.ModelHandler) *QrtzCronTriggersDao {
|
||||||
return &QrtzCronTriggersDao{
|
return &QrtzCronTriggersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_cron_triggers",
|
table: "qrtz_cron_triggers",
|
||||||
columns: qrtzCronTriggersColumns,
|
columns: qrtzCronTriggersColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzCronTriggersDao) DB() gdb.DB {
|
func (dao *QrtzCronTriggersDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzCronTriggersDao) Table() string {
|
func (dao *QrtzCronTriggersDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzCronTriggersDao) Columns() QrtzCronTriggersColumns {
|
func (dao *QrtzCronTriggersDao) Columns() QrtzCronTriggersColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzCronTriggersDao) Group() string {
|
func (dao *QrtzCronTriggersDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzCronTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzCronTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzCronTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzCronTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzFiredTriggersDao is the data access object for table qrtz_fired_triggers.
|
// QrtzFiredTriggersDao is the data access object for the table qrtz_fired_triggers.
|
||||||
type QrtzFiredTriggersDao struct {
|
type QrtzFiredTriggersDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzFiredTriggersColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzFiredTriggersColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzFiredTriggersColumns defines and stores column names for table qrtz_fired_triggers.
|
// QrtzFiredTriggersColumns defines and stores column names for the table qrtz_fired_triggers.
|
||||||
type QrtzFiredTriggersColumns struct {
|
type QrtzFiredTriggersColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
EntryId string //
|
EntryId string //
|
||||||
@@ -35,7 +36,7 @@ type QrtzFiredTriggersColumns struct {
|
|||||||
RequestsRecovery string //
|
RequestsRecovery string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzFiredTriggersColumns holds the columns for table qrtz_fired_triggers.
|
// qrtzFiredTriggersColumns holds the columns for the table qrtz_fired_triggers.
|
||||||
var qrtzFiredTriggersColumns = QrtzFiredTriggersColumns{
|
var qrtzFiredTriggersColumns = QrtzFiredTriggersColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
EntryId: "ENTRY_ID",
|
EntryId: "ENTRY_ID",
|
||||||
@@ -53,44 +54,49 @@ var qrtzFiredTriggersColumns = QrtzFiredTriggersColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzFiredTriggersDao creates and returns a new DAO object for table data access.
|
// NewQrtzFiredTriggersDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzFiredTriggersDao() *QrtzFiredTriggersDao {
|
func NewQrtzFiredTriggersDao(handlers ...gdb.ModelHandler) *QrtzFiredTriggersDao {
|
||||||
return &QrtzFiredTriggersDao{
|
return &QrtzFiredTriggersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_fired_triggers",
|
table: "qrtz_fired_triggers",
|
||||||
columns: qrtzFiredTriggersColumns,
|
columns: qrtzFiredTriggersColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzFiredTriggersDao) DB() gdb.DB {
|
func (dao *QrtzFiredTriggersDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzFiredTriggersDao) Table() string {
|
func (dao *QrtzFiredTriggersDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzFiredTriggersDao) Columns() QrtzFiredTriggersColumns {
|
func (dao *QrtzFiredTriggersDao) Columns() QrtzFiredTriggersColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzFiredTriggersDao) Group() string {
|
func (dao *QrtzFiredTriggersDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzFiredTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzFiredTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzFiredTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzFiredTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzJobDetailsDao is the data access object for table qrtz_job_details.
|
// QrtzJobDetailsDao is the data access object for the table qrtz_job_details.
|
||||||
type QrtzJobDetailsDao struct {
|
type QrtzJobDetailsDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzJobDetailsColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzJobDetailsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzJobDetailsColumns defines and stores column names for table qrtz_job_details.
|
// QrtzJobDetailsColumns defines and stores column names for the table qrtz_job_details.
|
||||||
type QrtzJobDetailsColumns struct {
|
type QrtzJobDetailsColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
JobName string //
|
JobName string //
|
||||||
@@ -32,7 +33,7 @@ type QrtzJobDetailsColumns struct {
|
|||||||
JobData string //
|
JobData string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzJobDetailsColumns holds the columns for table qrtz_job_details.
|
// qrtzJobDetailsColumns holds the columns for the table qrtz_job_details.
|
||||||
var qrtzJobDetailsColumns = QrtzJobDetailsColumns{
|
var qrtzJobDetailsColumns = QrtzJobDetailsColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
JobName: "JOB_NAME",
|
JobName: "JOB_NAME",
|
||||||
@@ -47,44 +48,49 @@ var qrtzJobDetailsColumns = QrtzJobDetailsColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzJobDetailsDao creates and returns a new DAO object for table data access.
|
// NewQrtzJobDetailsDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzJobDetailsDao() *QrtzJobDetailsDao {
|
func NewQrtzJobDetailsDao(handlers ...gdb.ModelHandler) *QrtzJobDetailsDao {
|
||||||
return &QrtzJobDetailsDao{
|
return &QrtzJobDetailsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_job_details",
|
table: "qrtz_job_details",
|
||||||
columns: qrtzJobDetailsColumns,
|
columns: qrtzJobDetailsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzJobDetailsDao) DB() gdb.DB {
|
func (dao *QrtzJobDetailsDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzJobDetailsDao) Table() string {
|
func (dao *QrtzJobDetailsDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzJobDetailsDao) Columns() QrtzJobDetailsColumns {
|
func (dao *QrtzJobDetailsDao) Columns() QrtzJobDetailsColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzJobDetailsDao) Group() string {
|
func (dao *QrtzJobDetailsDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzJobDetailsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzJobDetailsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzJobDetailsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzJobDetailsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,64 +11,70 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzLocksDao is the data access object for table qrtz_locks.
|
// QrtzLocksDao is the data access object for the table qrtz_locks.
|
||||||
type QrtzLocksDao struct {
|
type QrtzLocksDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzLocksColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzLocksColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzLocksColumns defines and stores column names for table qrtz_locks.
|
// QrtzLocksColumns defines and stores column names for the table qrtz_locks.
|
||||||
type QrtzLocksColumns struct {
|
type QrtzLocksColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
LockName string //
|
LockName string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzLocksColumns holds the columns for table qrtz_locks.
|
// qrtzLocksColumns holds the columns for the table qrtz_locks.
|
||||||
var qrtzLocksColumns = QrtzLocksColumns{
|
var qrtzLocksColumns = QrtzLocksColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
LockName: "LOCK_NAME",
|
LockName: "LOCK_NAME",
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzLocksDao creates and returns a new DAO object for table data access.
|
// NewQrtzLocksDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzLocksDao() *QrtzLocksDao {
|
func NewQrtzLocksDao(handlers ...gdb.ModelHandler) *QrtzLocksDao {
|
||||||
return &QrtzLocksDao{
|
return &QrtzLocksDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_locks",
|
table: "qrtz_locks",
|
||||||
columns: qrtzLocksColumns,
|
columns: qrtzLocksColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzLocksDao) DB() gdb.DB {
|
func (dao *QrtzLocksDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzLocksDao) Table() string {
|
func (dao *QrtzLocksDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzLocksDao) Columns() QrtzLocksColumns {
|
func (dao *QrtzLocksDao) Columns() QrtzLocksColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzLocksDao) Group() string {
|
func (dao *QrtzLocksDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzLocksDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzLocksDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzLocksDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzLocksDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,64 +11,70 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzPausedTriggerGrpsDao is the data access object for table qrtz_paused_trigger_grps.
|
// QrtzPausedTriggerGrpsDao is the data access object for the table qrtz_paused_trigger_grps.
|
||||||
type QrtzPausedTriggerGrpsDao struct {
|
type QrtzPausedTriggerGrpsDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzPausedTriggerGrpsColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzPausedTriggerGrpsColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzPausedTriggerGrpsColumns defines and stores column names for table qrtz_paused_trigger_grps.
|
// QrtzPausedTriggerGrpsColumns defines and stores column names for the table qrtz_paused_trigger_grps.
|
||||||
type QrtzPausedTriggerGrpsColumns struct {
|
type QrtzPausedTriggerGrpsColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
TriggerGroup string //
|
TriggerGroup string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzPausedTriggerGrpsColumns holds the columns for table qrtz_paused_trigger_grps.
|
// qrtzPausedTriggerGrpsColumns holds the columns for the table qrtz_paused_trigger_grps.
|
||||||
var qrtzPausedTriggerGrpsColumns = QrtzPausedTriggerGrpsColumns{
|
var qrtzPausedTriggerGrpsColumns = QrtzPausedTriggerGrpsColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
TriggerGroup: "TRIGGER_GROUP",
|
TriggerGroup: "TRIGGER_GROUP",
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzPausedTriggerGrpsDao creates and returns a new DAO object for table data access.
|
// NewQrtzPausedTriggerGrpsDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzPausedTriggerGrpsDao() *QrtzPausedTriggerGrpsDao {
|
func NewQrtzPausedTriggerGrpsDao(handlers ...gdb.ModelHandler) *QrtzPausedTriggerGrpsDao {
|
||||||
return &QrtzPausedTriggerGrpsDao{
|
return &QrtzPausedTriggerGrpsDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_paused_trigger_grps",
|
table: "qrtz_paused_trigger_grps",
|
||||||
columns: qrtzPausedTriggerGrpsColumns,
|
columns: qrtzPausedTriggerGrpsColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzPausedTriggerGrpsDao) DB() gdb.DB {
|
func (dao *QrtzPausedTriggerGrpsDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzPausedTriggerGrpsDao) Table() string {
|
func (dao *QrtzPausedTriggerGrpsDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzPausedTriggerGrpsDao) Columns() QrtzPausedTriggerGrpsColumns {
|
func (dao *QrtzPausedTriggerGrpsDao) Columns() QrtzPausedTriggerGrpsColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzPausedTriggerGrpsDao) Group() string {
|
func (dao *QrtzPausedTriggerGrpsDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzPausedTriggerGrpsDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzPausedTriggerGrpsDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzPausedTriggerGrpsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzPausedTriggerGrpsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzSchedulerStateDao is the data access object for table qrtz_scheduler_state.
|
// QrtzSchedulerStateDao is the data access object for the table qrtz_scheduler_state.
|
||||||
type QrtzSchedulerStateDao struct {
|
type QrtzSchedulerStateDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzSchedulerStateColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzSchedulerStateColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzSchedulerStateColumns defines and stores column names for table qrtz_scheduler_state.
|
// QrtzSchedulerStateColumns defines and stores column names for the table qrtz_scheduler_state.
|
||||||
type QrtzSchedulerStateColumns struct {
|
type QrtzSchedulerStateColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
InstanceName string //
|
InstanceName string //
|
||||||
@@ -26,7 +27,7 @@ type QrtzSchedulerStateColumns struct {
|
|||||||
CheckinInterval string //
|
CheckinInterval string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzSchedulerStateColumns holds the columns for table qrtz_scheduler_state.
|
// qrtzSchedulerStateColumns holds the columns for the table qrtz_scheduler_state.
|
||||||
var qrtzSchedulerStateColumns = QrtzSchedulerStateColumns{
|
var qrtzSchedulerStateColumns = QrtzSchedulerStateColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
InstanceName: "INSTANCE_NAME",
|
InstanceName: "INSTANCE_NAME",
|
||||||
@@ -35,44 +36,49 @@ var qrtzSchedulerStateColumns = QrtzSchedulerStateColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzSchedulerStateDao creates and returns a new DAO object for table data access.
|
// NewQrtzSchedulerStateDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzSchedulerStateDao() *QrtzSchedulerStateDao {
|
func NewQrtzSchedulerStateDao(handlers ...gdb.ModelHandler) *QrtzSchedulerStateDao {
|
||||||
return &QrtzSchedulerStateDao{
|
return &QrtzSchedulerStateDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_scheduler_state",
|
table: "qrtz_scheduler_state",
|
||||||
columns: qrtzSchedulerStateColumns,
|
columns: qrtzSchedulerStateColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzSchedulerStateDao) DB() gdb.DB {
|
func (dao *QrtzSchedulerStateDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzSchedulerStateDao) Table() string {
|
func (dao *QrtzSchedulerStateDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzSchedulerStateDao) Columns() QrtzSchedulerStateColumns {
|
func (dao *QrtzSchedulerStateDao) Columns() QrtzSchedulerStateColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzSchedulerStateDao) Group() string {
|
func (dao *QrtzSchedulerStateDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzSchedulerStateDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzSchedulerStateDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzSchedulerStateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzSchedulerStateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzSimpleTriggersDao is the data access object for table qrtz_simple_triggers.
|
// QrtzSimpleTriggersDao is the data access object for the table qrtz_simple_triggers.
|
||||||
type QrtzSimpleTriggersDao struct {
|
type QrtzSimpleTriggersDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzSimpleTriggersColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzSimpleTriggersColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzSimpleTriggersColumns defines and stores column names for table qrtz_simple_triggers.
|
// QrtzSimpleTriggersColumns defines and stores column names for the table qrtz_simple_triggers.
|
||||||
type QrtzSimpleTriggersColumns struct {
|
type QrtzSimpleTriggersColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
TriggerName string //
|
TriggerName string //
|
||||||
@@ -28,7 +29,7 @@ type QrtzSimpleTriggersColumns struct {
|
|||||||
TimesTriggered string //
|
TimesTriggered string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzSimpleTriggersColumns holds the columns for table qrtz_simple_triggers.
|
// qrtzSimpleTriggersColumns holds the columns for the table qrtz_simple_triggers.
|
||||||
var qrtzSimpleTriggersColumns = QrtzSimpleTriggersColumns{
|
var qrtzSimpleTriggersColumns = QrtzSimpleTriggersColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
TriggerName: "TRIGGER_NAME",
|
TriggerName: "TRIGGER_NAME",
|
||||||
@@ -39,44 +40,49 @@ var qrtzSimpleTriggersColumns = QrtzSimpleTriggersColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzSimpleTriggersDao creates and returns a new DAO object for table data access.
|
// NewQrtzSimpleTriggersDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzSimpleTriggersDao() *QrtzSimpleTriggersDao {
|
func NewQrtzSimpleTriggersDao(handlers ...gdb.ModelHandler) *QrtzSimpleTriggersDao {
|
||||||
return &QrtzSimpleTriggersDao{
|
return &QrtzSimpleTriggersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_simple_triggers",
|
table: "qrtz_simple_triggers",
|
||||||
columns: qrtzSimpleTriggersColumns,
|
columns: qrtzSimpleTriggersColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzSimpleTriggersDao) DB() gdb.DB {
|
func (dao *QrtzSimpleTriggersDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzSimpleTriggersDao) Table() string {
|
func (dao *QrtzSimpleTriggersDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzSimpleTriggersDao) Columns() QrtzSimpleTriggersColumns {
|
func (dao *QrtzSimpleTriggersDao) Columns() QrtzSimpleTriggersColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzSimpleTriggersDao) Group() string {
|
func (dao *QrtzSimpleTriggersDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzSimpleTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzSimpleTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzSimpleTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzSimpleTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzSimpropTriggersDao is the data access object for table qrtz_simprop_triggers.
|
// QrtzSimpropTriggersDao is the data access object for the table qrtz_simprop_triggers.
|
||||||
type QrtzSimpropTriggersDao struct {
|
type QrtzSimpropTriggersDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzSimpropTriggersColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzSimpropTriggersColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzSimpropTriggersColumns defines and stores column names for table qrtz_simprop_triggers.
|
// QrtzSimpropTriggersColumns defines and stores column names for the table qrtz_simprop_triggers.
|
||||||
type QrtzSimpropTriggersColumns struct {
|
type QrtzSimpropTriggersColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
TriggerName string //
|
TriggerName string //
|
||||||
@@ -36,7 +37,7 @@ type QrtzSimpropTriggersColumns struct {
|
|||||||
BoolProp2 string //
|
BoolProp2 string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzSimpropTriggersColumns holds the columns for table qrtz_simprop_triggers.
|
// qrtzSimpropTriggersColumns holds the columns for the table qrtz_simprop_triggers.
|
||||||
var qrtzSimpropTriggersColumns = QrtzSimpropTriggersColumns{
|
var qrtzSimpropTriggersColumns = QrtzSimpropTriggersColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
TriggerName: "TRIGGER_NAME",
|
TriggerName: "TRIGGER_NAME",
|
||||||
@@ -55,44 +56,49 @@ var qrtzSimpropTriggersColumns = QrtzSimpropTriggersColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzSimpropTriggersDao creates and returns a new DAO object for table data access.
|
// NewQrtzSimpropTriggersDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzSimpropTriggersDao() *QrtzSimpropTriggersDao {
|
func NewQrtzSimpropTriggersDao(handlers ...gdb.ModelHandler) *QrtzSimpropTriggersDao {
|
||||||
return &QrtzSimpropTriggersDao{
|
return &QrtzSimpropTriggersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_simprop_triggers",
|
table: "qrtz_simprop_triggers",
|
||||||
columns: qrtzSimpropTriggersColumns,
|
columns: qrtzSimpropTriggersColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzSimpropTriggersDao) DB() gdb.DB {
|
func (dao *QrtzSimpropTriggersDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzSimpropTriggersDao) Table() string {
|
func (dao *QrtzSimpropTriggersDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzSimpropTriggersDao) Columns() QrtzSimpropTriggersColumns {
|
func (dao *QrtzSimpropTriggersDao) Columns() QrtzSimpropTriggersColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzSimpropTriggersDao) Group() string {
|
func (dao *QrtzSimpropTriggersDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzSimpropTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzSimpropTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzSimpropTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzSimpropTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QrtzTriggersDao is the data access object for table qrtz_triggers.
|
// QrtzTriggersDao is the data access object for the table qrtz_triggers.
|
||||||
type QrtzTriggersDao struct {
|
type QrtzTriggersDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns QrtzTriggersColumns // columns contains all the column names of Table for convenient usage.
|
columns QrtzTriggersColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// QrtzTriggersColumns defines and stores column names for table qrtz_triggers.
|
// QrtzTriggersColumns defines and stores column names for the table qrtz_triggers.
|
||||||
type QrtzTriggersColumns struct {
|
type QrtzTriggersColumns struct {
|
||||||
SchedName string //
|
SchedName string //
|
||||||
TriggerName string //
|
TriggerName string //
|
||||||
@@ -38,7 +39,7 @@ type QrtzTriggersColumns struct {
|
|||||||
JobData string //
|
JobData string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// qrtzTriggersColumns holds the columns for table qrtz_triggers.
|
// qrtzTriggersColumns holds the columns for the table qrtz_triggers.
|
||||||
var qrtzTriggersColumns = QrtzTriggersColumns{
|
var qrtzTriggersColumns = QrtzTriggersColumns{
|
||||||
SchedName: "SCHED_NAME",
|
SchedName: "SCHED_NAME",
|
||||||
TriggerName: "TRIGGER_NAME",
|
TriggerName: "TRIGGER_NAME",
|
||||||
@@ -59,44 +60,49 @@ var qrtzTriggersColumns = QrtzTriggersColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewQrtzTriggersDao creates and returns a new DAO object for table data access.
|
// NewQrtzTriggersDao creates and returns a new DAO object for table data access.
|
||||||
func NewQrtzTriggersDao() *QrtzTriggersDao {
|
func NewQrtzTriggersDao(handlers ...gdb.ModelHandler) *QrtzTriggersDao {
|
||||||
return &QrtzTriggersDao{
|
return &QrtzTriggersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "qrtz_triggers",
|
table: "qrtz_triggers",
|
||||||
columns: qrtzTriggersColumns,
|
columns: qrtzTriggersColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *QrtzTriggersDao) DB() gdb.DB {
|
func (dao *QrtzTriggersDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *QrtzTriggersDao) Table() string {
|
func (dao *QrtzTriggersDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *QrtzTriggersDao) Columns() QrtzTriggersColumns {
|
func (dao *QrtzTriggersDao) Columns() QrtzTriggersColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *QrtzTriggersDao) Group() string {
|
func (dao *QrtzTriggersDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *QrtzTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *QrtzTriggersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *QrtzTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *QrtzTriggersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemDeptDao is the data access object for table system_dept.
|
// SystemDeptDao is the data access object for the table system_dept.
|
||||||
type SystemDeptDao struct {
|
type SystemDeptDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemDeptColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemDeptColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemDeptColumns defines and stores column names for table system_dept.
|
// SystemDeptColumns defines and stores column names for the table system_dept.
|
||||||
type SystemDeptColumns struct {
|
type SystemDeptColumns struct {
|
||||||
Id string // 部门id
|
Id string // 部门id
|
||||||
Name string // 部门名称
|
Name string // 部门名称
|
||||||
@@ -36,7 +37,7 @@ type SystemDeptColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemDeptColumns holds the columns for table system_dept.
|
// systemDeptColumns holds the columns for the table system_dept.
|
||||||
var systemDeptColumns = SystemDeptColumns{
|
var systemDeptColumns = SystemDeptColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -55,44 +56,49 @@ var systemDeptColumns = SystemDeptColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemDeptDao creates and returns a new DAO object for table data access.
|
// NewSystemDeptDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemDeptDao() *SystemDeptDao {
|
func NewSystemDeptDao(handlers ...gdb.ModelHandler) *SystemDeptDao {
|
||||||
return &SystemDeptDao{
|
return &SystemDeptDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_dept",
|
table: "system_dept",
|
||||||
columns: systemDeptColumns,
|
columns: systemDeptColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemDeptDao) DB() gdb.DB {
|
func (dao *SystemDeptDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemDeptDao) Table() string {
|
func (dao *SystemDeptDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemDeptDao) Columns() SystemDeptColumns {
|
func (dao *SystemDeptDao) Columns() SystemDeptColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemDeptDao) Group() string {
|
func (dao *SystemDeptDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemDeptDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemDeptDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemDictDataDao is the data access object for table system_dict_data.
|
// SystemDictDataDao is the data access object for the table system_dict_data.
|
||||||
type SystemDictDataDao struct {
|
type SystemDictDataDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemDictDataColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemDictDataColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemDictDataColumns defines and stores column names for table system_dict_data.
|
// SystemDictDataColumns defines and stores column names for the table system_dict_data.
|
||||||
type SystemDictDataColumns struct {
|
type SystemDictDataColumns struct {
|
||||||
Id string // 字典编码
|
Id string // 字典编码
|
||||||
Sort string // 字典排序
|
Sort string // 字典排序
|
||||||
@@ -36,7 +37,7 @@ type SystemDictDataColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemDictDataColumns holds the columns for table system_dict_data.
|
// systemDictDataColumns holds the columns for the table system_dict_data.
|
||||||
var systemDictDataColumns = SystemDictDataColumns{
|
var systemDictDataColumns = SystemDictDataColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Sort: "sort",
|
Sort: "sort",
|
||||||
@@ -55,44 +56,49 @@ var systemDictDataColumns = SystemDictDataColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemDictDataDao creates and returns a new DAO object for table data access.
|
// NewSystemDictDataDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemDictDataDao() *SystemDictDataDao {
|
func NewSystemDictDataDao(handlers ...gdb.ModelHandler) *SystemDictDataDao {
|
||||||
return &SystemDictDataDao{
|
return &SystemDictDataDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_dict_data",
|
table: "system_dict_data",
|
||||||
columns: systemDictDataColumns,
|
columns: systemDictDataColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemDictDataDao) DB() gdb.DB {
|
func (dao *SystemDictDataDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemDictDataDao) Table() string {
|
func (dao *SystemDictDataDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemDictDataDao) Columns() SystemDictDataColumns {
|
func (dao *SystemDictDataDao) Columns() SystemDictDataColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemDictDataDao) Group() string {
|
func (dao *SystemDictDataDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemDictDataDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemDictDataDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemDictDataDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemDictDataDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemDictTypeDao is the data access object for table system_dict_type.
|
// SystemDictTypeDao is the data access object for the table system_dict_type.
|
||||||
type SystemDictTypeDao struct {
|
type SystemDictTypeDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemDictTypeColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemDictTypeColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemDictTypeColumns defines and stores column names for table system_dict_type.
|
// SystemDictTypeColumns defines and stores column names for the table system_dict_type.
|
||||||
type SystemDictTypeColumns struct {
|
type SystemDictTypeColumns struct {
|
||||||
Id string // 字典主键
|
Id string // 字典主键
|
||||||
Name string // 字典名称
|
Name string // 字典名称
|
||||||
@@ -33,7 +34,7 @@ type SystemDictTypeColumns struct {
|
|||||||
DeletedTime string // 删除时间
|
DeletedTime string // 删除时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemDictTypeColumns holds the columns for table system_dict_type.
|
// systemDictTypeColumns holds the columns for the table system_dict_type.
|
||||||
var systemDictTypeColumns = SystemDictTypeColumns{
|
var systemDictTypeColumns = SystemDictTypeColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -49,44 +50,49 @@ var systemDictTypeColumns = SystemDictTypeColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemDictTypeDao creates and returns a new DAO object for table data access.
|
// NewSystemDictTypeDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemDictTypeDao() *SystemDictTypeDao {
|
func NewSystemDictTypeDao(handlers ...gdb.ModelHandler) *SystemDictTypeDao {
|
||||||
return &SystemDictTypeDao{
|
return &SystemDictTypeDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_dict_type",
|
table: "system_dict_type",
|
||||||
columns: systemDictTypeColumns,
|
columns: systemDictTypeColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemDictTypeDao) DB() gdb.DB {
|
func (dao *SystemDictTypeDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemDictTypeDao) Table() string {
|
func (dao *SystemDictTypeDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemDictTypeDao) Columns() SystemDictTypeColumns {
|
func (dao *SystemDictTypeDao) Columns() SystemDictTypeColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemDictTypeDao) Group() string {
|
func (dao *SystemDictTypeDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemDictTypeDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemDictTypeDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemDictTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemDictTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemLoginLogDao is the data access object for table system_login_log.
|
// SystemLoginLogDao is the data access object for the table system_login_log.
|
||||||
type SystemLoginLogDao struct {
|
type SystemLoginLogDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemLoginLogColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemLoginLogColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemLoginLogColumns defines and stores column names for table system_login_log.
|
// SystemLoginLogColumns defines and stores column names for the table system_login_log.
|
||||||
type SystemLoginLogColumns struct {
|
type SystemLoginLogColumns struct {
|
||||||
Id string // 访问ID
|
Id string // 访问ID
|
||||||
LogType string // 日志类型
|
LogType string // 日志类型
|
||||||
@@ -37,7 +38,7 @@ type SystemLoginLogColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemLoginLogColumns holds the columns for table system_login_log.
|
// systemLoginLogColumns holds the columns for the table system_login_log.
|
||||||
var systemLoginLogColumns = SystemLoginLogColumns{
|
var systemLoginLogColumns = SystemLoginLogColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
LogType: "log_type",
|
LogType: "log_type",
|
||||||
@@ -57,44 +58,49 @@ var systemLoginLogColumns = SystemLoginLogColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemLoginLogDao creates and returns a new DAO object for table data access.
|
// NewSystemLoginLogDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemLoginLogDao() *SystemLoginLogDao {
|
func NewSystemLoginLogDao(handlers ...gdb.ModelHandler) *SystemLoginLogDao {
|
||||||
return &SystemLoginLogDao{
|
return &SystemLoginLogDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_login_log",
|
table: "system_login_log",
|
||||||
columns: systemLoginLogColumns,
|
columns: systemLoginLogColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemLoginLogDao) DB() gdb.DB {
|
func (dao *SystemLoginLogDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemLoginLogDao) Table() string {
|
func (dao *SystemLoginLogDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemLoginLogDao) Columns() SystemLoginLogColumns {
|
func (dao *SystemLoginLogDao) Columns() SystemLoginLogColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemLoginLogDao) Group() string {
|
func (dao *SystemLoginLogDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemLoginLogDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemLoginLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemLoginLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemLoginLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemMailAccountDao is the data access object for table system_mail_account.
|
// SystemMailAccountDao is the data access object for the table system_mail_account.
|
||||||
type SystemMailAccountDao struct {
|
type SystemMailAccountDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemMailAccountColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemMailAccountColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemMailAccountColumns defines and stores column names for table system_mail_account.
|
// SystemMailAccountColumns defines and stores column names for the table system_mail_account.
|
||||||
type SystemMailAccountColumns struct {
|
type SystemMailAccountColumns struct {
|
||||||
Id string // 主键
|
Id string // 主键
|
||||||
Mail string // 邮箱
|
Mail string // 邮箱
|
||||||
@@ -35,7 +36,7 @@ type SystemMailAccountColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemMailAccountColumns holds the columns for table system_mail_account.
|
// systemMailAccountColumns holds the columns for the table system_mail_account.
|
||||||
var systemMailAccountColumns = SystemMailAccountColumns{
|
var systemMailAccountColumns = SystemMailAccountColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Mail: "mail",
|
Mail: "mail",
|
||||||
@@ -53,44 +54,49 @@ var systemMailAccountColumns = SystemMailAccountColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemMailAccountDao creates and returns a new DAO object for table data access.
|
// NewSystemMailAccountDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemMailAccountDao() *SystemMailAccountDao {
|
func NewSystemMailAccountDao(handlers ...gdb.ModelHandler) *SystemMailAccountDao {
|
||||||
return &SystemMailAccountDao{
|
return &SystemMailAccountDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_mail_account",
|
table: "system_mail_account",
|
||||||
columns: systemMailAccountColumns,
|
columns: systemMailAccountColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemMailAccountDao) DB() gdb.DB {
|
func (dao *SystemMailAccountDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemMailAccountDao) Table() string {
|
func (dao *SystemMailAccountDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemMailAccountDao) Columns() SystemMailAccountColumns {
|
func (dao *SystemMailAccountDao) Columns() SystemMailAccountColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemMailAccountDao) Group() string {
|
func (dao *SystemMailAccountDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemMailAccountDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemMailAccountDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemMailAccountDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemMailAccountDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemMailLogDao is the data access object for table system_mail_log.
|
// SystemMailLogDao is the data access object for the table system_mail_log.
|
||||||
type SystemMailLogDao struct {
|
type SystemMailLogDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemMailLogColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemMailLogColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemMailLogColumns defines and stores column names for table system_mail_log.
|
// SystemMailLogColumns defines and stores column names for the table system_mail_log.
|
||||||
type SystemMailLogColumns struct {
|
type SystemMailLogColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
UserId string // 用户编号
|
UserId string // 用户编号
|
||||||
@@ -43,7 +44,7 @@ type SystemMailLogColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemMailLogColumns holds the columns for table system_mail_log.
|
// systemMailLogColumns holds the columns for the table system_mail_log.
|
||||||
var systemMailLogColumns = SystemMailLogColumns{
|
var systemMailLogColumns = SystemMailLogColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
UserId: "user_id",
|
UserId: "user_id",
|
||||||
@@ -69,44 +70,49 @@ var systemMailLogColumns = SystemMailLogColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemMailLogDao creates and returns a new DAO object for table data access.
|
// NewSystemMailLogDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemMailLogDao() *SystemMailLogDao {
|
func NewSystemMailLogDao(handlers ...gdb.ModelHandler) *SystemMailLogDao {
|
||||||
return &SystemMailLogDao{
|
return &SystemMailLogDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_mail_log",
|
table: "system_mail_log",
|
||||||
columns: systemMailLogColumns,
|
columns: systemMailLogColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemMailLogDao) DB() gdb.DB {
|
func (dao *SystemMailLogDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemMailLogDao) Table() string {
|
func (dao *SystemMailLogDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemMailLogDao) Columns() SystemMailLogColumns {
|
func (dao *SystemMailLogDao) Columns() SystemMailLogColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemMailLogDao) Group() string {
|
func (dao *SystemMailLogDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemMailLogDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemMailLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemMailLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemMailLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemMailTemplateDao is the data access object for table system_mail_template.
|
// SystemMailTemplateDao is the data access object for the table system_mail_template.
|
||||||
type SystemMailTemplateDao struct {
|
type SystemMailTemplateDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemMailTemplateColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemMailTemplateColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemMailTemplateColumns defines and stores column names for table system_mail_template.
|
// SystemMailTemplateColumns defines and stores column names for the table system_mail_template.
|
||||||
type SystemMailTemplateColumns struct {
|
type SystemMailTemplateColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
Name string // 模板名称
|
Name string // 模板名称
|
||||||
@@ -37,7 +38,7 @@ type SystemMailTemplateColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemMailTemplateColumns holds the columns for table system_mail_template.
|
// systemMailTemplateColumns holds the columns for the table system_mail_template.
|
||||||
var systemMailTemplateColumns = SystemMailTemplateColumns{
|
var systemMailTemplateColumns = SystemMailTemplateColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -57,44 +58,49 @@ var systemMailTemplateColumns = SystemMailTemplateColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemMailTemplateDao creates and returns a new DAO object for table data access.
|
// NewSystemMailTemplateDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemMailTemplateDao() *SystemMailTemplateDao {
|
func NewSystemMailTemplateDao(handlers ...gdb.ModelHandler) *SystemMailTemplateDao {
|
||||||
return &SystemMailTemplateDao{
|
return &SystemMailTemplateDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_mail_template",
|
table: "system_mail_template",
|
||||||
columns: systemMailTemplateColumns,
|
columns: systemMailTemplateColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemMailTemplateDao) DB() gdb.DB {
|
func (dao *SystemMailTemplateDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemMailTemplateDao) Table() string {
|
func (dao *SystemMailTemplateDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemMailTemplateDao) Columns() SystemMailTemplateColumns {
|
func (dao *SystemMailTemplateDao) Columns() SystemMailTemplateColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemMailTemplateDao) Group() string {
|
func (dao *SystemMailTemplateDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemMailTemplateDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemMailTemplateDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemMailTemplateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemMailTemplateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemMenuDao is the data access object for table system_menu.
|
// SystemMenuDao is the data access object for the table system_menu.
|
||||||
type SystemMenuDao struct {
|
type SystemMenuDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemMenuColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemMenuColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemMenuColumns defines and stores column names for table system_menu.
|
// SystemMenuColumns defines and stores column names for the table system_menu.
|
||||||
type SystemMenuColumns struct {
|
type SystemMenuColumns struct {
|
||||||
Id string // 菜单ID
|
Id string // 菜单ID
|
||||||
Name string // 菜单名称
|
Name string // 菜单名称
|
||||||
@@ -41,7 +42,7 @@ type SystemMenuColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemMenuColumns holds the columns for table system_menu.
|
// systemMenuColumns holds the columns for the table system_menu.
|
||||||
var systemMenuColumns = SystemMenuColumns{
|
var systemMenuColumns = SystemMenuColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -65,44 +66,49 @@ var systemMenuColumns = SystemMenuColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemMenuDao creates and returns a new DAO object for table data access.
|
// NewSystemMenuDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemMenuDao() *SystemMenuDao {
|
func NewSystemMenuDao(handlers ...gdb.ModelHandler) *SystemMenuDao {
|
||||||
return &SystemMenuDao{
|
return &SystemMenuDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_menu",
|
table: "system_menu",
|
||||||
columns: systemMenuColumns,
|
columns: systemMenuColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemMenuDao) DB() gdb.DB {
|
func (dao *SystemMenuDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemMenuDao) Table() string {
|
func (dao *SystemMenuDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemMenuDao) Columns() SystemMenuColumns {
|
func (dao *SystemMenuDao) Columns() SystemMenuColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemMenuDao) Group() string {
|
func (dao *SystemMenuDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemMenuDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemMenuDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemNoticeDao is the data access object for table system_notice.
|
// SystemNoticeDao is the data access object for the table system_notice.
|
||||||
type SystemNoticeDao struct {
|
type SystemNoticeDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemNoticeColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemNoticeColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemNoticeColumns defines and stores column names for table system_notice.
|
// SystemNoticeColumns defines and stores column names for the table system_notice.
|
||||||
type SystemNoticeColumns struct {
|
type SystemNoticeColumns struct {
|
||||||
Id string // 公告ID
|
Id string // 公告ID
|
||||||
Title string // 公告标题
|
Title string // 公告标题
|
||||||
@@ -33,7 +34,7 @@ type SystemNoticeColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemNoticeColumns holds the columns for table system_notice.
|
// systemNoticeColumns holds the columns for the table system_notice.
|
||||||
var systemNoticeColumns = SystemNoticeColumns{
|
var systemNoticeColumns = SystemNoticeColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Title: "title",
|
Title: "title",
|
||||||
@@ -49,44 +50,49 @@ var systemNoticeColumns = SystemNoticeColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemNoticeDao creates and returns a new DAO object for table data access.
|
// NewSystemNoticeDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemNoticeDao() *SystemNoticeDao {
|
func NewSystemNoticeDao(handlers ...gdb.ModelHandler) *SystemNoticeDao {
|
||||||
return &SystemNoticeDao{
|
return &SystemNoticeDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_notice",
|
table: "system_notice",
|
||||||
columns: systemNoticeColumns,
|
columns: systemNoticeColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemNoticeDao) DB() gdb.DB {
|
func (dao *SystemNoticeDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemNoticeDao) Table() string {
|
func (dao *SystemNoticeDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemNoticeDao) Columns() SystemNoticeColumns {
|
func (dao *SystemNoticeDao) Columns() SystemNoticeColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemNoticeDao) Group() string {
|
func (dao *SystemNoticeDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemNoticeDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemNoticeDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemNoticeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemNoticeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemNotifyMessageDao is the data access object for table system_notify_message.
|
// SystemNotifyMessageDao is the data access object for the table system_notify_message.
|
||||||
type SystemNotifyMessageDao struct {
|
type SystemNotifyMessageDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemNotifyMessageColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemNotifyMessageColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemNotifyMessageColumns defines and stores column names for table system_notify_message.
|
// SystemNotifyMessageColumns defines and stores column names for the table system_notify_message.
|
||||||
type SystemNotifyMessageColumns struct {
|
type SystemNotifyMessageColumns struct {
|
||||||
Id string // 用户ID
|
Id string // 用户ID
|
||||||
UserId string // 用户id
|
UserId string // 用户id
|
||||||
@@ -39,7 +40,7 @@ type SystemNotifyMessageColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemNotifyMessageColumns holds the columns for table system_notify_message.
|
// systemNotifyMessageColumns holds the columns for the table system_notify_message.
|
||||||
var systemNotifyMessageColumns = SystemNotifyMessageColumns{
|
var systemNotifyMessageColumns = SystemNotifyMessageColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
UserId: "user_id",
|
UserId: "user_id",
|
||||||
@@ -61,44 +62,49 @@ var systemNotifyMessageColumns = SystemNotifyMessageColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemNotifyMessageDao creates and returns a new DAO object for table data access.
|
// NewSystemNotifyMessageDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemNotifyMessageDao() *SystemNotifyMessageDao {
|
func NewSystemNotifyMessageDao(handlers ...gdb.ModelHandler) *SystemNotifyMessageDao {
|
||||||
return &SystemNotifyMessageDao{
|
return &SystemNotifyMessageDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_notify_message",
|
table: "system_notify_message",
|
||||||
columns: systemNotifyMessageColumns,
|
columns: systemNotifyMessageColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemNotifyMessageDao) DB() gdb.DB {
|
func (dao *SystemNotifyMessageDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemNotifyMessageDao) Table() string {
|
func (dao *SystemNotifyMessageDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemNotifyMessageDao) Columns() SystemNotifyMessageColumns {
|
func (dao *SystemNotifyMessageDao) Columns() SystemNotifyMessageColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemNotifyMessageDao) Group() string {
|
func (dao *SystemNotifyMessageDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemNotifyMessageDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemNotifyMessageDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemNotifyMessageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemNotifyMessageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemNotifyTemplateDao is the data access object for table system_notify_template.
|
// SystemNotifyTemplateDao is the data access object for the table system_notify_template.
|
||||||
type SystemNotifyTemplateDao struct {
|
type SystemNotifyTemplateDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemNotifyTemplateColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemNotifyTemplateColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemNotifyTemplateColumns defines and stores column names for table system_notify_template.
|
// SystemNotifyTemplateColumns defines and stores column names for the table system_notify_template.
|
||||||
type SystemNotifyTemplateColumns struct {
|
type SystemNotifyTemplateColumns struct {
|
||||||
Id string // 主键
|
Id string // 主键
|
||||||
Name string // 模板名称
|
Name string // 模板名称
|
||||||
@@ -36,7 +37,7 @@ type SystemNotifyTemplateColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemNotifyTemplateColumns holds the columns for table system_notify_template.
|
// systemNotifyTemplateColumns holds the columns for the table system_notify_template.
|
||||||
var systemNotifyTemplateColumns = SystemNotifyTemplateColumns{
|
var systemNotifyTemplateColumns = SystemNotifyTemplateColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -55,44 +56,49 @@ var systemNotifyTemplateColumns = SystemNotifyTemplateColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemNotifyTemplateDao creates and returns a new DAO object for table data access.
|
// NewSystemNotifyTemplateDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemNotifyTemplateDao() *SystemNotifyTemplateDao {
|
func NewSystemNotifyTemplateDao(handlers ...gdb.ModelHandler) *SystemNotifyTemplateDao {
|
||||||
return &SystemNotifyTemplateDao{
|
return &SystemNotifyTemplateDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_notify_template",
|
table: "system_notify_template",
|
||||||
columns: systemNotifyTemplateColumns,
|
columns: systemNotifyTemplateColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemNotifyTemplateDao) DB() gdb.DB {
|
func (dao *SystemNotifyTemplateDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemNotifyTemplateDao) Table() string {
|
func (dao *SystemNotifyTemplateDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemNotifyTemplateDao) Columns() SystemNotifyTemplateColumns {
|
func (dao *SystemNotifyTemplateDao) Columns() SystemNotifyTemplateColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemNotifyTemplateDao) Group() string {
|
func (dao *SystemNotifyTemplateDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemNotifyTemplateDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemNotifyTemplateDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemNotifyTemplateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemNotifyTemplateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemOauth2AccessTokenDao is the data access object for table system_oauth2_access_token.
|
// SystemOauth2AccessTokenDao is the data access object for the table system_oauth2_access_token.
|
||||||
type SystemOauth2AccessTokenDao struct {
|
type SystemOauth2AccessTokenDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemOauth2AccessTokenColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemOauth2AccessTokenColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemOauth2AccessTokenColumns defines and stores column names for table system_oauth2_access_token.
|
// SystemOauth2AccessTokenColumns defines and stores column names for the table system_oauth2_access_token.
|
||||||
type SystemOauth2AccessTokenColumns struct {
|
type SystemOauth2AccessTokenColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
UserId string // 用户编号
|
UserId string // 用户编号
|
||||||
@@ -37,7 +38,7 @@ type SystemOauth2AccessTokenColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemOauth2AccessTokenColumns holds the columns for table system_oauth2_access_token.
|
// systemOauth2AccessTokenColumns holds the columns for the table system_oauth2_access_token.
|
||||||
var systemOauth2AccessTokenColumns = SystemOauth2AccessTokenColumns{
|
var systemOauth2AccessTokenColumns = SystemOauth2AccessTokenColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
UserId: "user_id",
|
UserId: "user_id",
|
||||||
@@ -57,44 +58,49 @@ var systemOauth2AccessTokenColumns = SystemOauth2AccessTokenColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemOauth2AccessTokenDao creates and returns a new DAO object for table data access.
|
// NewSystemOauth2AccessTokenDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemOauth2AccessTokenDao() *SystemOauth2AccessTokenDao {
|
func NewSystemOauth2AccessTokenDao(handlers ...gdb.ModelHandler) *SystemOauth2AccessTokenDao {
|
||||||
return &SystemOauth2AccessTokenDao{
|
return &SystemOauth2AccessTokenDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_oauth2_access_token",
|
table: "system_oauth2_access_token",
|
||||||
columns: systemOauth2AccessTokenColumns,
|
columns: systemOauth2AccessTokenColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemOauth2AccessTokenDao) DB() gdb.DB {
|
func (dao *SystemOauth2AccessTokenDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemOauth2AccessTokenDao) Table() string {
|
func (dao *SystemOauth2AccessTokenDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemOauth2AccessTokenDao) Columns() SystemOauth2AccessTokenColumns {
|
func (dao *SystemOauth2AccessTokenDao) Columns() SystemOauth2AccessTokenColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemOauth2AccessTokenDao) Group() string {
|
func (dao *SystemOauth2AccessTokenDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemOauth2AccessTokenDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemOauth2AccessTokenDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemOauth2AccessTokenDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemOauth2AccessTokenDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemOauth2ApproveDao is the data access object for table system_oauth2_approve.
|
// SystemOauth2ApproveDao is the data access object for the table system_oauth2_approve.
|
||||||
type SystemOauth2ApproveDao struct {
|
type SystemOauth2ApproveDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemOauth2ApproveColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemOauth2ApproveColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemOauth2ApproveColumns defines and stores column names for table system_oauth2_approve.
|
// SystemOauth2ApproveColumns defines and stores column names for the table system_oauth2_approve.
|
||||||
type SystemOauth2ApproveColumns struct {
|
type SystemOauth2ApproveColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
UserId string // 用户编号
|
UserId string // 用户编号
|
||||||
@@ -35,7 +36,7 @@ type SystemOauth2ApproveColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemOauth2ApproveColumns holds the columns for table system_oauth2_approve.
|
// systemOauth2ApproveColumns holds the columns for the table system_oauth2_approve.
|
||||||
var systemOauth2ApproveColumns = SystemOauth2ApproveColumns{
|
var systemOauth2ApproveColumns = SystemOauth2ApproveColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
UserId: "user_id",
|
UserId: "user_id",
|
||||||
@@ -53,44 +54,49 @@ var systemOauth2ApproveColumns = SystemOauth2ApproveColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemOauth2ApproveDao creates and returns a new DAO object for table data access.
|
// NewSystemOauth2ApproveDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemOauth2ApproveDao() *SystemOauth2ApproveDao {
|
func NewSystemOauth2ApproveDao(handlers ...gdb.ModelHandler) *SystemOauth2ApproveDao {
|
||||||
return &SystemOauth2ApproveDao{
|
return &SystemOauth2ApproveDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_oauth2_approve",
|
table: "system_oauth2_approve",
|
||||||
columns: systemOauth2ApproveColumns,
|
columns: systemOauth2ApproveColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemOauth2ApproveDao) DB() gdb.DB {
|
func (dao *SystemOauth2ApproveDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemOauth2ApproveDao) Table() string {
|
func (dao *SystemOauth2ApproveDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemOauth2ApproveDao) Columns() SystemOauth2ApproveColumns {
|
func (dao *SystemOauth2ApproveDao) Columns() SystemOauth2ApproveColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemOauth2ApproveDao) Group() string {
|
func (dao *SystemOauth2ApproveDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemOauth2ApproveDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemOauth2ApproveDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemOauth2ApproveDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemOauth2ApproveDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemOauth2ClientDao is the data access object for table system_oauth2_client.
|
// SystemOauth2ClientDao is the data access object for the table system_oauth2_client.
|
||||||
type SystemOauth2ClientDao struct {
|
type SystemOauth2ClientDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemOauth2ClientColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemOauth2ClientColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemOauth2ClientColumns defines and stores column names for table system_oauth2_client.
|
// SystemOauth2ClientColumns defines and stores column names for the table system_oauth2_client.
|
||||||
type SystemOauth2ClientColumns struct {
|
type SystemOauth2ClientColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
ClientId string // 客户端编号
|
ClientId string // 客户端编号
|
||||||
@@ -43,7 +44,7 @@ type SystemOauth2ClientColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemOauth2ClientColumns holds the columns for table system_oauth2_client.
|
// systemOauth2ClientColumns holds the columns for the table system_oauth2_client.
|
||||||
var systemOauth2ClientColumns = SystemOauth2ClientColumns{
|
var systemOauth2ClientColumns = SystemOauth2ClientColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
ClientId: "client_id",
|
ClientId: "client_id",
|
||||||
@@ -69,44 +70,49 @@ var systemOauth2ClientColumns = SystemOauth2ClientColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemOauth2ClientDao creates and returns a new DAO object for table data access.
|
// NewSystemOauth2ClientDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemOauth2ClientDao() *SystemOauth2ClientDao {
|
func NewSystemOauth2ClientDao(handlers ...gdb.ModelHandler) *SystemOauth2ClientDao {
|
||||||
return &SystemOauth2ClientDao{
|
return &SystemOauth2ClientDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_oauth2_client",
|
table: "system_oauth2_client",
|
||||||
columns: systemOauth2ClientColumns,
|
columns: systemOauth2ClientColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemOauth2ClientDao) DB() gdb.DB {
|
func (dao *SystemOauth2ClientDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemOauth2ClientDao) Table() string {
|
func (dao *SystemOauth2ClientDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemOauth2ClientDao) Columns() SystemOauth2ClientColumns {
|
func (dao *SystemOauth2ClientDao) Columns() SystemOauth2ClientColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemOauth2ClientDao) Group() string {
|
func (dao *SystemOauth2ClientDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemOauth2ClientDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemOauth2ClientDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemOauth2ClientDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemOauth2ClientDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemOauth2CodeDao is the data access object for table system_oauth2_code.
|
// SystemOauth2CodeDao is the data access object for the table system_oauth2_code.
|
||||||
type SystemOauth2CodeDao struct {
|
type SystemOauth2CodeDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemOauth2CodeColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemOauth2CodeColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemOauth2CodeColumns defines and stores column names for table system_oauth2_code.
|
// SystemOauth2CodeColumns defines and stores column names for the table system_oauth2_code.
|
||||||
type SystemOauth2CodeColumns struct {
|
type SystemOauth2CodeColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
UserId string // 用户编号
|
UserId string // 用户编号
|
||||||
@@ -37,7 +38,7 @@ type SystemOauth2CodeColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemOauth2CodeColumns holds the columns for table system_oauth2_code.
|
// systemOauth2CodeColumns holds the columns for the table system_oauth2_code.
|
||||||
var systemOauth2CodeColumns = SystemOauth2CodeColumns{
|
var systemOauth2CodeColumns = SystemOauth2CodeColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
UserId: "user_id",
|
UserId: "user_id",
|
||||||
@@ -57,44 +58,49 @@ var systemOauth2CodeColumns = SystemOauth2CodeColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemOauth2CodeDao creates and returns a new DAO object for table data access.
|
// NewSystemOauth2CodeDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemOauth2CodeDao() *SystemOauth2CodeDao {
|
func NewSystemOauth2CodeDao(handlers ...gdb.ModelHandler) *SystemOauth2CodeDao {
|
||||||
return &SystemOauth2CodeDao{
|
return &SystemOauth2CodeDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_oauth2_code",
|
table: "system_oauth2_code",
|
||||||
columns: systemOauth2CodeColumns,
|
columns: systemOauth2CodeColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemOauth2CodeDao) DB() gdb.DB {
|
func (dao *SystemOauth2CodeDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemOauth2CodeDao) Table() string {
|
func (dao *SystemOauth2CodeDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemOauth2CodeDao) Columns() SystemOauth2CodeColumns {
|
func (dao *SystemOauth2CodeDao) Columns() SystemOauth2CodeColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemOauth2CodeDao) Group() string {
|
func (dao *SystemOauth2CodeDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemOauth2CodeDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemOauth2CodeDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemOauth2CodeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemOauth2CodeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemOauth2RefreshTokenDao is the data access object for table system_oauth2_refresh_token.
|
// SystemOauth2RefreshTokenDao is the data access object for the table system_oauth2_refresh_token.
|
||||||
type SystemOauth2RefreshTokenDao struct {
|
type SystemOauth2RefreshTokenDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemOauth2RefreshTokenColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemOauth2RefreshTokenColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemOauth2RefreshTokenColumns defines and stores column names for table system_oauth2_refresh_token.
|
// SystemOauth2RefreshTokenColumns defines and stores column names for the table system_oauth2_refresh_token.
|
||||||
type SystemOauth2RefreshTokenColumns struct {
|
type SystemOauth2RefreshTokenColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
UserId string // 用户编号
|
UserId string // 用户编号
|
||||||
@@ -35,7 +36,7 @@ type SystemOauth2RefreshTokenColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemOauth2RefreshTokenColumns holds the columns for table system_oauth2_refresh_token.
|
// systemOauth2RefreshTokenColumns holds the columns for the table system_oauth2_refresh_token.
|
||||||
var systemOauth2RefreshTokenColumns = SystemOauth2RefreshTokenColumns{
|
var systemOauth2RefreshTokenColumns = SystemOauth2RefreshTokenColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
UserId: "user_id",
|
UserId: "user_id",
|
||||||
@@ -53,44 +54,49 @@ var systemOauth2RefreshTokenColumns = SystemOauth2RefreshTokenColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemOauth2RefreshTokenDao creates and returns a new DAO object for table data access.
|
// NewSystemOauth2RefreshTokenDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemOauth2RefreshTokenDao() *SystemOauth2RefreshTokenDao {
|
func NewSystemOauth2RefreshTokenDao(handlers ...gdb.ModelHandler) *SystemOauth2RefreshTokenDao {
|
||||||
return &SystemOauth2RefreshTokenDao{
|
return &SystemOauth2RefreshTokenDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_oauth2_refresh_token",
|
table: "system_oauth2_refresh_token",
|
||||||
columns: systemOauth2RefreshTokenColumns,
|
columns: systemOauth2RefreshTokenColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemOauth2RefreshTokenDao) DB() gdb.DB {
|
func (dao *SystemOauth2RefreshTokenDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemOauth2RefreshTokenDao) Table() string {
|
func (dao *SystemOauth2RefreshTokenDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemOauth2RefreshTokenDao) Columns() SystemOauth2RefreshTokenColumns {
|
func (dao *SystemOauth2RefreshTokenDao) Columns() SystemOauth2RefreshTokenColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemOauth2RefreshTokenDao) Group() string {
|
func (dao *SystemOauth2RefreshTokenDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemOauth2RefreshTokenDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemOauth2RefreshTokenDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemOauth2RefreshTokenDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemOauth2RefreshTokenDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemOperateLogDao is the data access object for table system_operate_log.
|
// SystemOperateLogDao is the data access object for the table system_operate_log.
|
||||||
type SystemOperateLogDao struct {
|
type SystemOperateLogDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemOperateLogColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemOperateLogColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemOperateLogColumns defines and stores column names for table system_operate_log.
|
// SystemOperateLogColumns defines and stores column names for the table system_operate_log.
|
||||||
type SystemOperateLogColumns struct {
|
type SystemOperateLogColumns struct {
|
||||||
Id string // 日志主键
|
Id string // 日志主键
|
||||||
TraceId string // 链路追踪编号
|
TraceId string // 链路追踪编号
|
||||||
@@ -41,7 +42,7 @@ type SystemOperateLogColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemOperateLogColumns holds the columns for table system_operate_log.
|
// systemOperateLogColumns holds the columns for the table system_operate_log.
|
||||||
var systemOperateLogColumns = SystemOperateLogColumns{
|
var systemOperateLogColumns = SystemOperateLogColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
TraceId: "trace_id",
|
TraceId: "trace_id",
|
||||||
@@ -65,44 +66,49 @@ var systemOperateLogColumns = SystemOperateLogColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemOperateLogDao creates and returns a new DAO object for table data access.
|
// NewSystemOperateLogDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemOperateLogDao() *SystemOperateLogDao {
|
func NewSystemOperateLogDao(handlers ...gdb.ModelHandler) *SystemOperateLogDao {
|
||||||
return &SystemOperateLogDao{
|
return &SystemOperateLogDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_operate_log",
|
table: "system_operate_log",
|
||||||
columns: systemOperateLogColumns,
|
columns: systemOperateLogColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemOperateLogDao) DB() gdb.DB {
|
func (dao *SystemOperateLogDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemOperateLogDao) Table() string {
|
func (dao *SystemOperateLogDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemOperateLogDao) Columns() SystemOperateLogColumns {
|
func (dao *SystemOperateLogDao) Columns() SystemOperateLogColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemOperateLogDao) Group() string {
|
func (dao *SystemOperateLogDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemOperateLogDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemOperateLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemOperateLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemOperateLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemPostDao is the data access object for table system_post.
|
// SystemPostDao is the data access object for the table system_post.
|
||||||
type SystemPostDao struct {
|
type SystemPostDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemPostColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemPostColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemPostColumns defines and stores column names for table system_post.
|
// SystemPostColumns defines and stores column names for the table system_post.
|
||||||
type SystemPostColumns struct {
|
type SystemPostColumns struct {
|
||||||
Id string // 岗位ID
|
Id string // 岗位ID
|
||||||
Code string // 岗位编码
|
Code string // 岗位编码
|
||||||
@@ -34,7 +35,7 @@ type SystemPostColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemPostColumns holds the columns for table system_post.
|
// systemPostColumns holds the columns for the table system_post.
|
||||||
var systemPostColumns = SystemPostColumns{
|
var systemPostColumns = SystemPostColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Code: "code",
|
Code: "code",
|
||||||
@@ -51,44 +52,49 @@ var systemPostColumns = SystemPostColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemPostDao creates and returns a new DAO object for table data access.
|
// NewSystemPostDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemPostDao() *SystemPostDao {
|
func NewSystemPostDao(handlers ...gdb.ModelHandler) *SystemPostDao {
|
||||||
return &SystemPostDao{
|
return &SystemPostDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_post",
|
table: "system_post",
|
||||||
columns: systemPostColumns,
|
columns: systemPostColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemPostDao) DB() gdb.DB {
|
func (dao *SystemPostDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemPostDao) Table() string {
|
func (dao *SystemPostDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemPostDao) Columns() SystemPostColumns {
|
func (dao *SystemPostDao) Columns() SystemPostColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemPostDao) Group() string {
|
func (dao *SystemPostDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemPostDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemPostDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemRoleDao is the data access object for table system_role.
|
// SystemRoleDao is the data access object for the table system_role.
|
||||||
type SystemRoleDao struct {
|
type SystemRoleDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemRoleColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemRoleColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemRoleColumns defines and stores column names for table system_role.
|
// SystemRoleColumns defines and stores column names for the table system_role.
|
||||||
type SystemRoleColumns struct {
|
type SystemRoleColumns struct {
|
||||||
Id string // 角色ID
|
Id string // 角色ID
|
||||||
Name string // 角色名称
|
Name string // 角色名称
|
||||||
@@ -37,7 +38,7 @@ type SystemRoleColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemRoleColumns holds the columns for table system_role.
|
// systemRoleColumns holds the columns for the table system_role.
|
||||||
var systemRoleColumns = SystemRoleColumns{
|
var systemRoleColumns = SystemRoleColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -57,44 +58,49 @@ var systemRoleColumns = SystemRoleColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemRoleDao creates and returns a new DAO object for table data access.
|
// NewSystemRoleDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemRoleDao() *SystemRoleDao {
|
func NewSystemRoleDao(handlers ...gdb.ModelHandler) *SystemRoleDao {
|
||||||
return &SystemRoleDao{
|
return &SystemRoleDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_role",
|
table: "system_role",
|
||||||
columns: systemRoleColumns,
|
columns: systemRoleColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemRoleDao) DB() gdb.DB {
|
func (dao *SystemRoleDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemRoleDao) Table() string {
|
func (dao *SystemRoleDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemRoleDao) Columns() SystemRoleColumns {
|
func (dao *SystemRoleDao) Columns() SystemRoleColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemRoleDao) Group() string {
|
func (dao *SystemRoleDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemRoleDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemRoleDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemRoleMenuDao is the data access object for table system_role_menu.
|
// SystemRoleMenuDao is the data access object for the table system_role_menu.
|
||||||
type SystemRoleMenuDao struct {
|
type SystemRoleMenuDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemRoleMenuColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemRoleMenuColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemRoleMenuColumns defines and stores column names for table system_role_menu.
|
// SystemRoleMenuColumns defines and stores column names for the table system_role_menu.
|
||||||
type SystemRoleMenuColumns struct {
|
type SystemRoleMenuColumns struct {
|
||||||
Id string // 自增编号
|
Id string // 自增编号
|
||||||
RoleId string // 角色ID
|
RoleId string // 角色ID
|
||||||
@@ -31,7 +32,7 @@ type SystemRoleMenuColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemRoleMenuColumns holds the columns for table system_role_menu.
|
// systemRoleMenuColumns holds the columns for the table system_role_menu.
|
||||||
var systemRoleMenuColumns = SystemRoleMenuColumns{
|
var systemRoleMenuColumns = SystemRoleMenuColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
RoleId: "role_id",
|
RoleId: "role_id",
|
||||||
@@ -45,44 +46,49 @@ var systemRoleMenuColumns = SystemRoleMenuColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemRoleMenuDao creates and returns a new DAO object for table data access.
|
// NewSystemRoleMenuDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemRoleMenuDao() *SystemRoleMenuDao {
|
func NewSystemRoleMenuDao(handlers ...gdb.ModelHandler) *SystemRoleMenuDao {
|
||||||
return &SystemRoleMenuDao{
|
return &SystemRoleMenuDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_role_menu",
|
table: "system_role_menu",
|
||||||
columns: systemRoleMenuColumns,
|
columns: systemRoleMenuColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemRoleMenuDao) DB() gdb.DB {
|
func (dao *SystemRoleMenuDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemRoleMenuDao) Table() string {
|
func (dao *SystemRoleMenuDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemRoleMenuDao) Columns() SystemRoleMenuColumns {
|
func (dao *SystemRoleMenuDao) Columns() SystemRoleMenuColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemRoleMenuDao) Group() string {
|
func (dao *SystemRoleMenuDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemRoleMenuDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemRoleMenuDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemRoleMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemRoleMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemSmsChannelDao is the data access object for table system_sms_channel.
|
// SystemSmsChannelDao is the data access object for the table system_sms_channel.
|
||||||
type SystemSmsChannelDao struct {
|
type SystemSmsChannelDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemSmsChannelColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemSmsChannelColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemSmsChannelColumns defines and stores column names for table system_sms_channel.
|
// SystemSmsChannelColumns defines and stores column names for the table system_sms_channel.
|
||||||
type SystemSmsChannelColumns struct {
|
type SystemSmsChannelColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
Signature string // 短信签名
|
Signature string // 短信签名
|
||||||
@@ -35,7 +36,7 @@ type SystemSmsChannelColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemSmsChannelColumns holds the columns for table system_sms_channel.
|
// systemSmsChannelColumns holds the columns for the table system_sms_channel.
|
||||||
var systemSmsChannelColumns = SystemSmsChannelColumns{
|
var systemSmsChannelColumns = SystemSmsChannelColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Signature: "signature",
|
Signature: "signature",
|
||||||
@@ -53,44 +54,49 @@ var systemSmsChannelColumns = SystemSmsChannelColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemSmsChannelDao creates and returns a new DAO object for table data access.
|
// NewSystemSmsChannelDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemSmsChannelDao() *SystemSmsChannelDao {
|
func NewSystemSmsChannelDao(handlers ...gdb.ModelHandler) *SystemSmsChannelDao {
|
||||||
return &SystemSmsChannelDao{
|
return &SystemSmsChannelDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_sms_channel",
|
table: "system_sms_channel",
|
||||||
columns: systemSmsChannelColumns,
|
columns: systemSmsChannelColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemSmsChannelDao) DB() gdb.DB {
|
func (dao *SystemSmsChannelDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemSmsChannelDao) Table() string {
|
func (dao *SystemSmsChannelDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemSmsChannelDao) Columns() SystemSmsChannelColumns {
|
func (dao *SystemSmsChannelDao) Columns() SystemSmsChannelColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemSmsChannelDao) Group() string {
|
func (dao *SystemSmsChannelDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemSmsChannelDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemSmsChannelDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemSmsChannelDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemSmsChannelDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemSmsCodeDao is the data access object for table system_sms_code.
|
// SystemSmsCodeDao is the data access object for the table system_sms_code.
|
||||||
type SystemSmsCodeDao struct {
|
type SystemSmsCodeDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemSmsCodeColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemSmsCodeColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemSmsCodeColumns defines and stores column names for table system_sms_code.
|
// SystemSmsCodeColumns defines and stores column names for the table system_sms_code.
|
||||||
type SystemSmsCodeColumns struct {
|
type SystemSmsCodeColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
Mobile string // 手机号
|
Mobile string // 手机号
|
||||||
@@ -37,7 +38,7 @@ type SystemSmsCodeColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemSmsCodeColumns holds the columns for table system_sms_code.
|
// systemSmsCodeColumns holds the columns for the table system_sms_code.
|
||||||
var systemSmsCodeColumns = SystemSmsCodeColumns{
|
var systemSmsCodeColumns = SystemSmsCodeColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Mobile: "mobile",
|
Mobile: "mobile",
|
||||||
@@ -57,44 +58,49 @@ var systemSmsCodeColumns = SystemSmsCodeColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemSmsCodeDao creates and returns a new DAO object for table data access.
|
// NewSystemSmsCodeDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemSmsCodeDao() *SystemSmsCodeDao {
|
func NewSystemSmsCodeDao(handlers ...gdb.ModelHandler) *SystemSmsCodeDao {
|
||||||
return &SystemSmsCodeDao{
|
return &SystemSmsCodeDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_sms_code",
|
table: "system_sms_code",
|
||||||
columns: systemSmsCodeColumns,
|
columns: systemSmsCodeColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemSmsCodeDao) DB() gdb.DB {
|
func (dao *SystemSmsCodeDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemSmsCodeDao) Table() string {
|
func (dao *SystemSmsCodeDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemSmsCodeDao) Columns() SystemSmsCodeColumns {
|
func (dao *SystemSmsCodeDao) Columns() SystemSmsCodeColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemSmsCodeDao) Group() string {
|
func (dao *SystemSmsCodeDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemSmsCodeDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemSmsCodeDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemSmsCodeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemSmsCodeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemSmsLogDao is the data access object for table system_sms_log.
|
// SystemSmsLogDao is the data access object for the table system_sms_log.
|
||||||
type SystemSmsLogDao struct {
|
type SystemSmsLogDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemSmsLogColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemSmsLogColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemSmsLogColumns defines and stores column names for table system_sms_log.
|
// SystemSmsLogColumns defines and stores column names for the table system_sms_log.
|
||||||
type SystemSmsLogColumns struct {
|
type SystemSmsLogColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
ChannelId string // 短信渠道编号
|
ChannelId string // 短信渠道编号
|
||||||
@@ -49,7 +50,7 @@ type SystemSmsLogColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemSmsLogColumns holds the columns for table system_sms_log.
|
// systemSmsLogColumns holds the columns for the table system_sms_log.
|
||||||
var systemSmsLogColumns = SystemSmsLogColumns{
|
var systemSmsLogColumns = SystemSmsLogColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
ChannelId: "channel_id",
|
ChannelId: "channel_id",
|
||||||
@@ -81,44 +82,49 @@ var systemSmsLogColumns = SystemSmsLogColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemSmsLogDao creates and returns a new DAO object for table data access.
|
// NewSystemSmsLogDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemSmsLogDao() *SystemSmsLogDao {
|
func NewSystemSmsLogDao(handlers ...gdb.ModelHandler) *SystemSmsLogDao {
|
||||||
return &SystemSmsLogDao{
|
return &SystemSmsLogDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_sms_log",
|
table: "system_sms_log",
|
||||||
columns: systemSmsLogColumns,
|
columns: systemSmsLogColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemSmsLogDao) DB() gdb.DB {
|
func (dao *SystemSmsLogDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemSmsLogDao) Table() string {
|
func (dao *SystemSmsLogDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemSmsLogDao) Columns() SystemSmsLogColumns {
|
func (dao *SystemSmsLogDao) Columns() SystemSmsLogColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemSmsLogDao) Group() string {
|
func (dao *SystemSmsLogDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemSmsLogDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemSmsLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemSmsLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemSmsLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemSmsTemplateDao is the data access object for table system_sms_template.
|
// SystemSmsTemplateDao is the data access object for the table system_sms_template.
|
||||||
type SystemSmsTemplateDao struct {
|
type SystemSmsTemplateDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemSmsTemplateColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemSmsTemplateColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemSmsTemplateColumns defines and stores column names for table system_sms_template.
|
// SystemSmsTemplateColumns defines and stores column names for the table system_sms_template.
|
||||||
type SystemSmsTemplateColumns struct {
|
type SystemSmsTemplateColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
Type string // 模板类型
|
Type string // 模板类型
|
||||||
@@ -38,7 +39,7 @@ type SystemSmsTemplateColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemSmsTemplateColumns holds the columns for table system_sms_template.
|
// systemSmsTemplateColumns holds the columns for the table system_sms_template.
|
||||||
var systemSmsTemplateColumns = SystemSmsTemplateColumns{
|
var systemSmsTemplateColumns = SystemSmsTemplateColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Type: "type",
|
Type: "type",
|
||||||
@@ -59,44 +60,49 @@ var systemSmsTemplateColumns = SystemSmsTemplateColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemSmsTemplateDao creates and returns a new DAO object for table data access.
|
// NewSystemSmsTemplateDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemSmsTemplateDao() *SystemSmsTemplateDao {
|
func NewSystemSmsTemplateDao(handlers ...gdb.ModelHandler) *SystemSmsTemplateDao {
|
||||||
return &SystemSmsTemplateDao{
|
return &SystemSmsTemplateDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_sms_template",
|
table: "system_sms_template",
|
||||||
columns: systemSmsTemplateColumns,
|
columns: systemSmsTemplateColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemSmsTemplateDao) DB() gdb.DB {
|
func (dao *SystemSmsTemplateDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemSmsTemplateDao) Table() string {
|
func (dao *SystemSmsTemplateDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemSmsTemplateDao) Columns() SystemSmsTemplateColumns {
|
func (dao *SystemSmsTemplateDao) Columns() SystemSmsTemplateColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemSmsTemplateDao) Group() string {
|
func (dao *SystemSmsTemplateDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemSmsTemplateDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemSmsTemplateDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemSmsTemplateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemSmsTemplateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemSocialClientDao is the data access object for table system_social_client.
|
// SystemSocialClientDao is the data access object for the table system_social_client.
|
||||||
type SystemSocialClientDao struct {
|
type SystemSocialClientDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemSocialClientColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemSocialClientColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemSocialClientColumns defines and stores column names for table system_social_client.
|
// SystemSocialClientColumns defines and stores column names for the table system_social_client.
|
||||||
type SystemSocialClientColumns struct {
|
type SystemSocialClientColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
Name string // 应用名
|
Name string // 应用名
|
||||||
@@ -36,7 +37,7 @@ type SystemSocialClientColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemSocialClientColumns holds the columns for table system_social_client.
|
// systemSocialClientColumns holds the columns for the table system_social_client.
|
||||||
var systemSocialClientColumns = SystemSocialClientColumns{
|
var systemSocialClientColumns = SystemSocialClientColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -55,44 +56,49 @@ var systemSocialClientColumns = SystemSocialClientColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemSocialClientDao creates and returns a new DAO object for table data access.
|
// NewSystemSocialClientDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemSocialClientDao() *SystemSocialClientDao {
|
func NewSystemSocialClientDao(handlers ...gdb.ModelHandler) *SystemSocialClientDao {
|
||||||
return &SystemSocialClientDao{
|
return &SystemSocialClientDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_social_client",
|
table: "system_social_client",
|
||||||
columns: systemSocialClientColumns,
|
columns: systemSocialClientColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemSocialClientDao) DB() gdb.DB {
|
func (dao *SystemSocialClientDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemSocialClientDao) Table() string {
|
func (dao *SystemSocialClientDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemSocialClientDao) Columns() SystemSocialClientColumns {
|
func (dao *SystemSocialClientDao) Columns() SystemSocialClientColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemSocialClientDao) Group() string {
|
func (dao *SystemSocialClientDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemSocialClientDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemSocialClientDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemSocialClientDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemSocialClientDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemSocialUserDao is the data access object for table system_social_user.
|
// SystemSocialUserDao is the data access object for the table system_social_user.
|
||||||
type SystemSocialUserDao struct {
|
type SystemSocialUserDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemSocialUserColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemSocialUserColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemSocialUserColumns defines and stores column names for table system_social_user.
|
// SystemSocialUserColumns defines and stores column names for the table system_social_user.
|
||||||
type SystemSocialUserColumns struct {
|
type SystemSocialUserColumns struct {
|
||||||
Id string // 主键(自增策略)
|
Id string // 主键(自增策略)
|
||||||
Type string // 社交平台的类型
|
Type string // 社交平台的类型
|
||||||
@@ -38,7 +39,7 @@ type SystemSocialUserColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemSocialUserColumns holds the columns for table system_social_user.
|
// systemSocialUserColumns holds the columns for the table system_social_user.
|
||||||
var systemSocialUserColumns = SystemSocialUserColumns{
|
var systemSocialUserColumns = SystemSocialUserColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Type: "type",
|
Type: "type",
|
||||||
@@ -59,44 +60,49 @@ var systemSocialUserColumns = SystemSocialUserColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemSocialUserDao creates and returns a new DAO object for table data access.
|
// NewSystemSocialUserDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemSocialUserDao() *SystemSocialUserDao {
|
func NewSystemSocialUserDao(handlers ...gdb.ModelHandler) *SystemSocialUserDao {
|
||||||
return &SystemSocialUserDao{
|
return &SystemSocialUserDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_social_user",
|
table: "system_social_user",
|
||||||
columns: systemSocialUserColumns,
|
columns: systemSocialUserColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemSocialUserDao) DB() gdb.DB {
|
func (dao *SystemSocialUserDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemSocialUserDao) Table() string {
|
func (dao *SystemSocialUserDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemSocialUserDao) Columns() SystemSocialUserColumns {
|
func (dao *SystemSocialUserDao) Columns() SystemSocialUserColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemSocialUserDao) Group() string {
|
func (dao *SystemSocialUserDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemSocialUserDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemSocialUserDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemSocialUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemSocialUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemSocialUserBindDao is the data access object for table system_social_user_bind.
|
// SystemSocialUserBindDao is the data access object for the table system_social_user_bind.
|
||||||
type SystemSocialUserBindDao struct {
|
type SystemSocialUserBindDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemSocialUserBindColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemSocialUserBindColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemSocialUserBindColumns defines and stores column names for table system_social_user_bind.
|
// SystemSocialUserBindColumns defines and stores column names for the table system_social_user_bind.
|
||||||
type SystemSocialUserBindColumns struct {
|
type SystemSocialUserBindColumns struct {
|
||||||
Id string // 主键(自增策略)
|
Id string // 主键(自增策略)
|
||||||
UserId string // 用户编号
|
UserId string // 用户编号
|
||||||
@@ -33,7 +34,7 @@ type SystemSocialUserBindColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemSocialUserBindColumns holds the columns for table system_social_user_bind.
|
// systemSocialUserBindColumns holds the columns for the table system_social_user_bind.
|
||||||
var systemSocialUserBindColumns = SystemSocialUserBindColumns{
|
var systemSocialUserBindColumns = SystemSocialUserBindColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
UserId: "user_id",
|
UserId: "user_id",
|
||||||
@@ -49,44 +50,49 @@ var systemSocialUserBindColumns = SystemSocialUserBindColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemSocialUserBindDao creates and returns a new DAO object for table data access.
|
// NewSystemSocialUserBindDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemSocialUserBindDao() *SystemSocialUserBindDao {
|
func NewSystemSocialUserBindDao(handlers ...gdb.ModelHandler) *SystemSocialUserBindDao {
|
||||||
return &SystemSocialUserBindDao{
|
return &SystemSocialUserBindDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_social_user_bind",
|
table: "system_social_user_bind",
|
||||||
columns: systemSocialUserBindColumns,
|
columns: systemSocialUserBindColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemSocialUserBindDao) DB() gdb.DB {
|
func (dao *SystemSocialUserBindDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemSocialUserBindDao) Table() string {
|
func (dao *SystemSocialUserBindDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemSocialUserBindDao) Columns() SystemSocialUserBindColumns {
|
func (dao *SystemSocialUserBindDao) Columns() SystemSocialUserBindColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemSocialUserBindDao) Group() string {
|
func (dao *SystemSocialUserBindDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemSocialUserBindDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemSocialUserBindDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemSocialUserBindDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemSocialUserBindDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemTenantDao is the data access object for table system_tenant.
|
// SystemTenantDao is the data access object for the table system_tenant.
|
||||||
type SystemTenantDao struct {
|
type SystemTenantDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemTenantColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemTenantColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemTenantColumns defines and stores column names for table system_tenant.
|
// SystemTenantColumns defines and stores column names for the table system_tenant.
|
||||||
type SystemTenantColumns struct {
|
type SystemTenantColumns struct {
|
||||||
Id string // 租户编号
|
Id string // 租户编号
|
||||||
Name string // 租户名
|
Name string // 租户名
|
||||||
@@ -37,7 +38,7 @@ type SystemTenantColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemTenantColumns holds the columns for table system_tenant.
|
// systemTenantColumns holds the columns for the table system_tenant.
|
||||||
var systemTenantColumns = SystemTenantColumns{
|
var systemTenantColumns = SystemTenantColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -57,44 +58,49 @@ var systemTenantColumns = SystemTenantColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemTenantDao creates and returns a new DAO object for table data access.
|
// NewSystemTenantDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemTenantDao() *SystemTenantDao {
|
func NewSystemTenantDao(handlers ...gdb.ModelHandler) *SystemTenantDao {
|
||||||
return &SystemTenantDao{
|
return &SystemTenantDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_tenant",
|
table: "system_tenant",
|
||||||
columns: systemTenantColumns,
|
columns: systemTenantColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemTenantDao) DB() gdb.DB {
|
func (dao *SystemTenantDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemTenantDao) Table() string {
|
func (dao *SystemTenantDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemTenantDao) Columns() SystemTenantColumns {
|
func (dao *SystemTenantDao) Columns() SystemTenantColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemTenantDao) Group() string {
|
func (dao *SystemTenantDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemTenantDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemTenantDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemTenantDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemTenantDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemTenantPackageDao is the data access object for table system_tenant_package.
|
// SystemTenantPackageDao is the data access object for the table system_tenant_package.
|
||||||
type SystemTenantPackageDao struct {
|
type SystemTenantPackageDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemTenantPackageColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemTenantPackageColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemTenantPackageColumns defines and stores column names for table system_tenant_package.
|
// SystemTenantPackageColumns defines and stores column names for the table system_tenant_package.
|
||||||
type SystemTenantPackageColumns struct {
|
type SystemTenantPackageColumns struct {
|
||||||
Id string // 套餐编号
|
Id string // 套餐编号
|
||||||
Name string // 套餐名
|
Name string // 套餐名
|
||||||
@@ -32,7 +33,7 @@ type SystemTenantPackageColumns struct {
|
|||||||
Deleted string // 是否删除
|
Deleted string // 是否删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemTenantPackageColumns holds the columns for table system_tenant_package.
|
// systemTenantPackageColumns holds the columns for the table system_tenant_package.
|
||||||
var systemTenantPackageColumns = SystemTenantPackageColumns{
|
var systemTenantPackageColumns = SystemTenantPackageColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -47,44 +48,49 @@ var systemTenantPackageColumns = SystemTenantPackageColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemTenantPackageDao creates and returns a new DAO object for table data access.
|
// NewSystemTenantPackageDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemTenantPackageDao() *SystemTenantPackageDao {
|
func NewSystemTenantPackageDao(handlers ...gdb.ModelHandler) *SystemTenantPackageDao {
|
||||||
return &SystemTenantPackageDao{
|
return &SystemTenantPackageDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_tenant_package",
|
table: "system_tenant_package",
|
||||||
columns: systemTenantPackageColumns,
|
columns: systemTenantPackageColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemTenantPackageDao) DB() gdb.DB {
|
func (dao *SystemTenantPackageDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemTenantPackageDao) Table() string {
|
func (dao *SystemTenantPackageDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemTenantPackageDao) Columns() SystemTenantPackageColumns {
|
func (dao *SystemTenantPackageDao) Columns() SystemTenantPackageColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemTenantPackageDao) Group() string {
|
func (dao *SystemTenantPackageDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemTenantPackageDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemTenantPackageDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemTenantPackageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemTenantPackageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemUserPostDao is the data access object for table system_user_post.
|
// SystemUserPostDao is the data access object for the table system_user_post.
|
||||||
type SystemUserPostDao struct {
|
type SystemUserPostDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemUserPostColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemUserPostColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemUserPostColumns defines and stores column names for table system_user_post.
|
// SystemUserPostColumns defines and stores column names for the table system_user_post.
|
||||||
type SystemUserPostColumns struct {
|
type SystemUserPostColumns struct {
|
||||||
Id string // id
|
Id string // id
|
||||||
UserId string // 用户ID
|
UserId string // 用户ID
|
||||||
@@ -31,7 +32,7 @@ type SystemUserPostColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemUserPostColumns holds the columns for table system_user_post.
|
// systemUserPostColumns holds the columns for the table system_user_post.
|
||||||
var systemUserPostColumns = SystemUserPostColumns{
|
var systemUserPostColumns = SystemUserPostColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
UserId: "user_id",
|
UserId: "user_id",
|
||||||
@@ -45,44 +46,49 @@ var systemUserPostColumns = SystemUserPostColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemUserPostDao creates and returns a new DAO object for table data access.
|
// NewSystemUserPostDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemUserPostDao() *SystemUserPostDao {
|
func NewSystemUserPostDao(handlers ...gdb.ModelHandler) *SystemUserPostDao {
|
||||||
return &SystemUserPostDao{
|
return &SystemUserPostDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_user_post",
|
table: "system_user_post",
|
||||||
columns: systemUserPostColumns,
|
columns: systemUserPostColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemUserPostDao) DB() gdb.DB {
|
func (dao *SystemUserPostDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemUserPostDao) Table() string {
|
func (dao *SystemUserPostDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemUserPostDao) Columns() SystemUserPostColumns {
|
func (dao *SystemUserPostDao) Columns() SystemUserPostColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemUserPostDao) Group() string {
|
func (dao *SystemUserPostDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemUserPostDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemUserPostDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemUserPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemUserPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemUserRoleDao is the data access object for table system_user_role.
|
// SystemUserRoleDao is the data access object for the table system_user_role.
|
||||||
type SystemUserRoleDao struct {
|
type SystemUserRoleDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemUserRoleColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemUserRoleColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemUserRoleColumns defines and stores column names for table system_user_role.
|
// SystemUserRoleColumns defines and stores column names for the table system_user_role.
|
||||||
type SystemUserRoleColumns struct {
|
type SystemUserRoleColumns struct {
|
||||||
Id string // 自增编号
|
Id string // 自增编号
|
||||||
UserId string // 用户ID
|
UserId string // 用户ID
|
||||||
@@ -31,7 +32,7 @@ type SystemUserRoleColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemUserRoleColumns holds the columns for table system_user_role.
|
// systemUserRoleColumns holds the columns for the table system_user_role.
|
||||||
var systemUserRoleColumns = SystemUserRoleColumns{
|
var systemUserRoleColumns = SystemUserRoleColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
UserId: "user_id",
|
UserId: "user_id",
|
||||||
@@ -45,44 +46,49 @@ var systemUserRoleColumns = SystemUserRoleColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemUserRoleDao creates and returns a new DAO object for table data access.
|
// NewSystemUserRoleDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemUserRoleDao() *SystemUserRoleDao {
|
func NewSystemUserRoleDao(handlers ...gdb.ModelHandler) *SystemUserRoleDao {
|
||||||
return &SystemUserRoleDao{
|
return &SystemUserRoleDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_user_role",
|
table: "system_user_role",
|
||||||
columns: systemUserRoleColumns,
|
columns: systemUserRoleColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemUserRoleDao) DB() gdb.DB {
|
func (dao *SystemUserRoleDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemUserRoleDao) Table() string {
|
func (dao *SystemUserRoleDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemUserRoleDao) Columns() SystemUserRoleColumns {
|
func (dao *SystemUserRoleDao) Columns() SystemUserRoleColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemUserRoleDao) Group() string {
|
func (dao *SystemUserRoleDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemUserRoleDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemUserRoleDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemUserRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemUserRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SystemUsersDao is the data access object for table system_users.
|
// SystemUsersDao is the data access object for the table system_users.
|
||||||
type SystemUsersDao struct {
|
type SystemUsersDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns SystemUsersColumns // columns contains all the column names of Table for convenient usage.
|
columns SystemUsersColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemUsersColumns defines and stores column names for table system_users.
|
// SystemUsersColumns defines and stores column names for the table system_users.
|
||||||
type SystemUsersColumns struct {
|
type SystemUsersColumns struct {
|
||||||
Id string // 用户ID
|
Id string // 用户ID
|
||||||
Username string // 用户账号
|
Username string // 用户账号
|
||||||
@@ -42,7 +43,7 @@ type SystemUsersColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// systemUsersColumns holds the columns for table system_users.
|
// systemUsersColumns holds the columns for the table system_users.
|
||||||
var systemUsersColumns = SystemUsersColumns{
|
var systemUsersColumns = SystemUsersColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Username: "username",
|
Username: "username",
|
||||||
@@ -67,44 +68,49 @@ var systemUsersColumns = SystemUsersColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSystemUsersDao creates and returns a new DAO object for table data access.
|
// NewSystemUsersDao creates and returns a new DAO object for table data access.
|
||||||
func NewSystemUsersDao() *SystemUsersDao {
|
func NewSystemUsersDao(handlers ...gdb.ModelHandler) *SystemUsersDao {
|
||||||
return &SystemUsersDao{
|
return &SystemUsersDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "system_users",
|
table: "system_users",
|
||||||
columns: systemUsersColumns,
|
columns: systemUsersColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *SystemUsersDao) DB() gdb.DB {
|
func (dao *SystemUsersDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *SystemUsersDao) Table() string {
|
func (dao *SystemUsersDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *SystemUsersDao) Columns() SystemUsersColumns {
|
func (dao *SystemUsersDao) Columns() SystemUsersColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *SystemUsersDao) Group() string {
|
func (dao *SystemUsersDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *SystemUsersDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *SystemUsersDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *SystemUsersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *SystemUsersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// YudaoDemo01ContactDao is the data access object for table yudao_demo01_contact.
|
// YudaoDemo01ContactDao is the data access object for the table yudao_demo01_contact.
|
||||||
type YudaoDemo01ContactDao struct {
|
type YudaoDemo01ContactDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns YudaoDemo01ContactColumns // columns contains all the column names of Table for convenient usage.
|
columns YudaoDemo01ContactColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// YudaoDemo01ContactColumns defines and stores column names for table yudao_demo01_contact.
|
// YudaoDemo01ContactColumns defines and stores column names for the table yudao_demo01_contact.
|
||||||
type YudaoDemo01ContactColumns struct {
|
type YudaoDemo01ContactColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
Name string // 名字
|
Name string // 名字
|
||||||
@@ -34,7 +35,7 @@ type YudaoDemo01ContactColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// yudaoDemo01ContactColumns holds the columns for table yudao_demo01_contact.
|
// yudaoDemo01ContactColumns holds the columns for the table yudao_demo01_contact.
|
||||||
var yudaoDemo01ContactColumns = YudaoDemo01ContactColumns{
|
var yudaoDemo01ContactColumns = YudaoDemo01ContactColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -51,44 +52,49 @@ var yudaoDemo01ContactColumns = YudaoDemo01ContactColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewYudaoDemo01ContactDao creates and returns a new DAO object for table data access.
|
// NewYudaoDemo01ContactDao creates and returns a new DAO object for table data access.
|
||||||
func NewYudaoDemo01ContactDao() *YudaoDemo01ContactDao {
|
func NewYudaoDemo01ContactDao(handlers ...gdb.ModelHandler) *YudaoDemo01ContactDao {
|
||||||
return &YudaoDemo01ContactDao{
|
return &YudaoDemo01ContactDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "yudao_demo01_contact",
|
table: "yudao_demo01_contact",
|
||||||
columns: yudaoDemo01ContactColumns,
|
columns: yudaoDemo01ContactColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *YudaoDemo01ContactDao) DB() gdb.DB {
|
func (dao *YudaoDemo01ContactDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *YudaoDemo01ContactDao) Table() string {
|
func (dao *YudaoDemo01ContactDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *YudaoDemo01ContactDao) Columns() YudaoDemo01ContactColumns {
|
func (dao *YudaoDemo01ContactDao) Columns() YudaoDemo01ContactColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *YudaoDemo01ContactDao) Group() string {
|
func (dao *YudaoDemo01ContactDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *YudaoDemo01ContactDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *YudaoDemo01ContactDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *YudaoDemo01ContactDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *YudaoDemo01ContactDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// YudaoDemo02CategoryDao is the data access object for table yudao_demo02_category.
|
// YudaoDemo02CategoryDao is the data access object for the table yudao_demo02_category.
|
||||||
type YudaoDemo02CategoryDao struct {
|
type YudaoDemo02CategoryDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns YudaoDemo02CategoryColumns // columns contains all the column names of Table for convenient usage.
|
columns YudaoDemo02CategoryColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// YudaoDemo02CategoryColumns defines and stores column names for table yudao_demo02_category.
|
// YudaoDemo02CategoryColumns defines and stores column names for the table yudao_demo02_category.
|
||||||
type YudaoDemo02CategoryColumns struct {
|
type YudaoDemo02CategoryColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
Name string // 名字
|
Name string // 名字
|
||||||
@@ -31,7 +32,7 @@ type YudaoDemo02CategoryColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// yudaoDemo02CategoryColumns holds the columns for table yudao_demo02_category.
|
// yudaoDemo02CategoryColumns holds the columns for the table yudao_demo02_category.
|
||||||
var yudaoDemo02CategoryColumns = YudaoDemo02CategoryColumns{
|
var yudaoDemo02CategoryColumns = YudaoDemo02CategoryColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -45,44 +46,49 @@ var yudaoDemo02CategoryColumns = YudaoDemo02CategoryColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewYudaoDemo02CategoryDao creates and returns a new DAO object for table data access.
|
// NewYudaoDemo02CategoryDao creates and returns a new DAO object for table data access.
|
||||||
func NewYudaoDemo02CategoryDao() *YudaoDemo02CategoryDao {
|
func NewYudaoDemo02CategoryDao(handlers ...gdb.ModelHandler) *YudaoDemo02CategoryDao {
|
||||||
return &YudaoDemo02CategoryDao{
|
return &YudaoDemo02CategoryDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "yudao_demo02_category",
|
table: "yudao_demo02_category",
|
||||||
columns: yudaoDemo02CategoryColumns,
|
columns: yudaoDemo02CategoryColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *YudaoDemo02CategoryDao) DB() gdb.DB {
|
func (dao *YudaoDemo02CategoryDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *YudaoDemo02CategoryDao) Table() string {
|
func (dao *YudaoDemo02CategoryDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *YudaoDemo02CategoryDao) Columns() YudaoDemo02CategoryColumns {
|
func (dao *YudaoDemo02CategoryDao) Columns() YudaoDemo02CategoryColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *YudaoDemo02CategoryDao) Group() string {
|
func (dao *YudaoDemo02CategoryDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *YudaoDemo02CategoryDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *YudaoDemo02CategoryDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *YudaoDemo02CategoryDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *YudaoDemo02CategoryDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// YudaoDemo03CourseDao is the data access object for table yudao_demo03_course.
|
// YudaoDemo03CourseDao is the data access object for the table yudao_demo03_course.
|
||||||
type YudaoDemo03CourseDao struct {
|
type YudaoDemo03CourseDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns YudaoDemo03CourseColumns // columns contains all the column names of Table for convenient usage.
|
columns YudaoDemo03CourseColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// YudaoDemo03CourseColumns defines and stores column names for table yudao_demo03_course.
|
// YudaoDemo03CourseColumns defines and stores column names for the table yudao_demo03_course.
|
||||||
type YudaoDemo03CourseColumns struct {
|
type YudaoDemo03CourseColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
StudentId string // 学生编号
|
StudentId string // 学生编号
|
||||||
@@ -32,7 +33,7 @@ type YudaoDemo03CourseColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// yudaoDemo03CourseColumns holds the columns for table yudao_demo03_course.
|
// yudaoDemo03CourseColumns holds the columns for the table yudao_demo03_course.
|
||||||
var yudaoDemo03CourseColumns = YudaoDemo03CourseColumns{
|
var yudaoDemo03CourseColumns = YudaoDemo03CourseColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
StudentId: "student_id",
|
StudentId: "student_id",
|
||||||
@@ -47,44 +48,49 @@ var yudaoDemo03CourseColumns = YudaoDemo03CourseColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewYudaoDemo03CourseDao creates and returns a new DAO object for table data access.
|
// NewYudaoDemo03CourseDao creates and returns a new DAO object for table data access.
|
||||||
func NewYudaoDemo03CourseDao() *YudaoDemo03CourseDao {
|
func NewYudaoDemo03CourseDao(handlers ...gdb.ModelHandler) *YudaoDemo03CourseDao {
|
||||||
return &YudaoDemo03CourseDao{
|
return &YudaoDemo03CourseDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "yudao_demo03_course",
|
table: "yudao_demo03_course",
|
||||||
columns: yudaoDemo03CourseColumns,
|
columns: yudaoDemo03CourseColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *YudaoDemo03CourseDao) DB() gdb.DB {
|
func (dao *YudaoDemo03CourseDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *YudaoDemo03CourseDao) Table() string {
|
func (dao *YudaoDemo03CourseDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *YudaoDemo03CourseDao) Columns() YudaoDemo03CourseColumns {
|
func (dao *YudaoDemo03CourseDao) Columns() YudaoDemo03CourseColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *YudaoDemo03CourseDao) Group() string {
|
func (dao *YudaoDemo03CourseDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *YudaoDemo03CourseDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *YudaoDemo03CourseDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *YudaoDemo03CourseDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *YudaoDemo03CourseDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// YudaoDemo03GradeDao is the data access object for table yudao_demo03_grade.
|
// YudaoDemo03GradeDao is the data access object for the table yudao_demo03_grade.
|
||||||
type YudaoDemo03GradeDao struct {
|
type YudaoDemo03GradeDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns YudaoDemo03GradeColumns // columns contains all the column names of Table for convenient usage.
|
columns YudaoDemo03GradeColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// YudaoDemo03GradeColumns defines and stores column names for table yudao_demo03_grade.
|
// YudaoDemo03GradeColumns defines and stores column names for the table yudao_demo03_grade.
|
||||||
type YudaoDemo03GradeColumns struct {
|
type YudaoDemo03GradeColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
StudentId string // 学生编号
|
StudentId string // 学生编号
|
||||||
@@ -32,7 +33,7 @@ type YudaoDemo03GradeColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// yudaoDemo03GradeColumns holds the columns for table yudao_demo03_grade.
|
// yudaoDemo03GradeColumns holds the columns for the table yudao_demo03_grade.
|
||||||
var yudaoDemo03GradeColumns = YudaoDemo03GradeColumns{
|
var yudaoDemo03GradeColumns = YudaoDemo03GradeColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
StudentId: "student_id",
|
StudentId: "student_id",
|
||||||
@@ -47,44 +48,49 @@ var yudaoDemo03GradeColumns = YudaoDemo03GradeColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewYudaoDemo03GradeDao creates and returns a new DAO object for table data access.
|
// NewYudaoDemo03GradeDao creates and returns a new DAO object for table data access.
|
||||||
func NewYudaoDemo03GradeDao() *YudaoDemo03GradeDao {
|
func NewYudaoDemo03GradeDao(handlers ...gdb.ModelHandler) *YudaoDemo03GradeDao {
|
||||||
return &YudaoDemo03GradeDao{
|
return &YudaoDemo03GradeDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "yudao_demo03_grade",
|
table: "yudao_demo03_grade",
|
||||||
columns: yudaoDemo03GradeColumns,
|
columns: yudaoDemo03GradeColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *YudaoDemo03GradeDao) DB() gdb.DB {
|
func (dao *YudaoDemo03GradeDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *YudaoDemo03GradeDao) Table() string {
|
func (dao *YudaoDemo03GradeDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *YudaoDemo03GradeDao) Columns() YudaoDemo03GradeColumns {
|
func (dao *YudaoDemo03GradeDao) Columns() YudaoDemo03GradeColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *YudaoDemo03GradeDao) Group() string {
|
func (dao *YudaoDemo03GradeDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *YudaoDemo03GradeDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *YudaoDemo03GradeDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *YudaoDemo03GradeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *YudaoDemo03GradeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -11,14 +11,15 @@ import (
|
|||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
)
|
)
|
||||||
|
|
||||||
// YudaoDemo03StudentDao is the data access object for table yudao_demo03_student.
|
// YudaoDemo03StudentDao is the data access object for the table yudao_demo03_student.
|
||||||
type YudaoDemo03StudentDao struct {
|
type YudaoDemo03StudentDao struct {
|
||||||
table string // table is the underlying table name of the DAO.
|
table string // table is the underlying table name of the DAO.
|
||||||
group string // group is the database configuration group name of current DAO.
|
group string // group is the database configuration group name of the current DAO.
|
||||||
columns YudaoDemo03StudentColumns // columns contains all the column names of Table for convenient usage.
|
columns YudaoDemo03StudentColumns // columns contains all the column names of Table for convenient usage.
|
||||||
|
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
// YudaoDemo03StudentColumns defines and stores column names for table yudao_demo03_student.
|
// YudaoDemo03StudentColumns defines and stores column names for the table yudao_demo03_student.
|
||||||
type YudaoDemo03StudentColumns struct {
|
type YudaoDemo03StudentColumns struct {
|
||||||
Id string // 编号
|
Id string // 编号
|
||||||
Name string // 名字
|
Name string // 名字
|
||||||
@@ -33,7 +34,7 @@ type YudaoDemo03StudentColumns struct {
|
|||||||
TenantId string // 租户编号
|
TenantId string // 租户编号
|
||||||
}
|
}
|
||||||
|
|
||||||
// yudaoDemo03StudentColumns holds the columns for table yudao_demo03_student.
|
// yudaoDemo03StudentColumns holds the columns for the table yudao_demo03_student.
|
||||||
var yudaoDemo03StudentColumns = YudaoDemo03StudentColumns{
|
var yudaoDemo03StudentColumns = YudaoDemo03StudentColumns{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
@@ -49,44 +50,49 @@ var yudaoDemo03StudentColumns = YudaoDemo03StudentColumns{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewYudaoDemo03StudentDao creates and returns a new DAO object for table data access.
|
// NewYudaoDemo03StudentDao creates and returns a new DAO object for table data access.
|
||||||
func NewYudaoDemo03StudentDao() *YudaoDemo03StudentDao {
|
func NewYudaoDemo03StudentDao(handlers ...gdb.ModelHandler) *YudaoDemo03StudentDao {
|
||||||
return &YudaoDemo03StudentDao{
|
return &YudaoDemo03StudentDao{
|
||||||
group: "default",
|
group: "default",
|
||||||
table: "yudao_demo03_student",
|
table: "yudao_demo03_student",
|
||||||
columns: yudaoDemo03StudentColumns,
|
columns: yudaoDemo03StudentColumns,
|
||||||
|
handlers: handlers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||||
func (dao *YudaoDemo03StudentDao) DB() gdb.DB {
|
func (dao *YudaoDemo03StudentDao) DB() gdb.DB {
|
||||||
return g.DB(dao.group)
|
return g.DB(dao.group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table returns the table name of current dao.
|
// Table returns the table name of the current DAO.
|
||||||
func (dao *YudaoDemo03StudentDao) Table() string {
|
func (dao *YudaoDemo03StudentDao) Table() string {
|
||||||
return dao.table
|
return dao.table
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns returns all column names of current dao.
|
// Columns returns all column names of the current DAO.
|
||||||
func (dao *YudaoDemo03StudentDao) Columns() YudaoDemo03StudentColumns {
|
func (dao *YudaoDemo03StudentDao) Columns() YudaoDemo03StudentColumns {
|
||||||
return dao.columns
|
return dao.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group returns the configuration group name of database of current dao.
|
// Group returns the database configuration group name of the current DAO.
|
||||||
func (dao *YudaoDemo03StudentDao) Group() string {
|
func (dao *YudaoDemo03StudentDao) Group() string {
|
||||||
return dao.group
|
return dao.group
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||||
func (dao *YudaoDemo03StudentDao) Ctx(ctx context.Context) *gdb.Model {
|
func (dao *YudaoDemo03StudentDao) Ctx(ctx context.Context) *gdb.Model {
|
||||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
model := dao.DB().Model(dao.table)
|
||||||
|
for _, handler := range dao.handlers {
|
||||||
|
model = handler(model)
|
||||||
|
}
|
||||||
|
return model.Safe().Ctx(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transaction wraps the transaction logic using function f.
|
// Transaction wraps the transaction logic using function f.
|
||||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||||
// It commits the transaction and returns nil if function f returns nil.
|
// It commits the transaction and returns nil if function f returns nil.
|
||||||
//
|
//
|
||||||
// Note that, you should not Commit or Rollback the transaction in function f
|
// Note: Do not commit or roll back the transaction in function f,
|
||||||
// as it is automatically handled by this function.
|
// as it is automatically handled by this function.
|
||||||
func (dao *YudaoDemo03StudentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
func (dao *YudaoDemo03StudentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cron
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"epic/internal/dao"
|
"epic/internal/dao"
|
||||||
|
"epic/internal/logic/i18n"
|
||||||
"epic/internal/model/entity"
|
"epic/internal/model/entity"
|
||||||
"epic/internal/service"
|
"epic/internal/service"
|
||||||
"epic/internal/util"
|
"epic/internal/util"
|
||||||
@@ -173,13 +174,6 @@ func (l *Logic) registerDefaultJobs(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 每30分钟执行一次OSS预签名URL缓存刷新任务
|
|
||||||
//if err := l.AddJob(ctx, "oss_presignurl_refresh", "0 0/30 * * * *", func() {
|
|
||||||
// l.refreshOssPresignUrlCacheJob(ctx)
|
|
||||||
//}); err != nil {
|
|
||||||
// return err
|
|
||||||
//}
|
|
||||||
|
|
||||||
// 每5天执行一次角色配装信息刷新任务
|
// 每5天执行一次角色配装信息刷新任务
|
||||||
if err := l.AddJob(ctx, "hero_set_refresh_5days", "0 0 0 */5 * *", func() {
|
if err := l.AddJob(ctx, "hero_set_refresh_5days", "0 0 0 */5 * *", func() {
|
||||||
l.refreshHeroSetContent(ctx)
|
l.refreshHeroSetContent(ctx)
|
||||||
@@ -187,6 +181,18 @@ func (l *Logic) registerDefaultJobs(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 每天凌晨2点同步i18n远程翻译数据
|
||||||
|
if err := l.AddJob(ctx, "i18n_remote_sync", "0 0 2 * * *", func() {
|
||||||
|
g.Log().Info(ctx, "开始同步i18n远程翻译数据...")
|
||||||
|
if err := i18n.GetI18nLogic().SyncI18nFromRemote(ctx); err != nil {
|
||||||
|
g.Log().Error(ctx, "i18n远程翻译数据同步失败:", err)
|
||||||
|
} else {
|
||||||
|
g.Log().Info(ctx, "i18n远程翻译数据同步完成")
|
||||||
|
}
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +209,7 @@ func (l *Logic) syncDataFromThirdParty(ctx context.Context) {
|
|||||||
g.Log().Info(ctx, "Data sync completed")
|
g.Log().Info(ctx, "Data sync completed")
|
||||||
}
|
}
|
||||||
|
|
||||||
//同步英雄数据
|
// 同步英雄数据
|
||||||
func (l *Logic) syncHeroData(ctx context.Context) {
|
func (l *Logic) syncHeroData(ctx context.Context) {
|
||||||
g.Log().Info(ctx, "Starting hero data sync...")
|
g.Log().Info(ctx, "Starting hero data sync...")
|
||||||
|
|
||||||
@@ -215,7 +221,7 @@ func (l *Logic) syncHeroData(ctx context.Context) {
|
|||||||
g.Log().Info(ctx, "Hero data sync completed")
|
g.Log().Info(ctx, "Hero data sync completed")
|
||||||
}
|
}
|
||||||
|
|
||||||
//同步神器数据
|
// 同步神器数据
|
||||||
func (l *Logic) syncArtifactData(ctx context.Context) {
|
func (l *Logic) syncArtifactData(ctx context.Context) {
|
||||||
g.Log().Info(ctx, "Starting artifact data sync...")
|
g.Log().Info(ctx, "Starting artifact data sync...")
|
||||||
|
|
||||||
|
|||||||
@@ -732,3 +732,77 @@ func max(a, b int) int {
|
|||||||
}
|
}
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修复历史数据,将epic_hero_info.hero_name和epic_artifact_info.artifact_name翻译为中文(基于code匹配)
|
||||||
|
func FixHeroAndArtifactNameToChinese(ctx context.Context) error {
|
||||||
|
// 1. 查询i18n hero映射(code->zh)
|
||||||
|
var heroMappings []*entity.EpicI18NMappings
|
||||||
|
err := dao.EpicI18NMappings.Ctx(ctx).
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Language, "zh").
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Category, "hero").
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Status, 1).
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Deleted, 0).
|
||||||
|
Scan(&heroMappings)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("查询i18n hero映射失败: %v", err)
|
||||||
|
}
|
||||||
|
heroCodeToZh := make(map[string]string)
|
||||||
|
for _, m := range heroMappings {
|
||||||
|
heroCodeToZh[m.Code] = m.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 修复英雄表
|
||||||
|
var heroes []*entity.EpicHeroInfo
|
||||||
|
err = dao.EpicHeroInfo.Ctx(ctx).Scan(&heroes)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("查询epic_hero_info失败: %v", err)
|
||||||
|
}
|
||||||
|
for _, h := range heroes {
|
||||||
|
if zh, ok := heroCodeToZh[h.HeroCode]; ok && zh != "" && zh != h.HeroName {
|
||||||
|
_, err := dao.EpicHeroInfo.Ctx(ctx).
|
||||||
|
Where(dao.EpicHeroInfo.Columns().HeroCode, h.HeroCode).
|
||||||
|
Data(g.Map{dao.EpicHeroInfo.Columns().HeroName: zh}).
|
||||||
|
Update()
|
||||||
|
if err != nil {
|
||||||
|
g.Log().Errorf(ctx, "更新英雄中文名失败: %s(%s) -> %s, err: %v", h.HeroName, h.HeroCode, zh, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.Log().Info(ctx, "epic_hero_info英雄名修复完成")
|
||||||
|
|
||||||
|
// 3. 查询i18n artifact映射(code->zh)
|
||||||
|
var artifactMappings []*entity.EpicI18NMappings
|
||||||
|
err = dao.EpicI18NMappings.Ctx(ctx).
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Language, "zh").
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Category, "artifact").
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Status, 1).
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Deleted, 0).
|
||||||
|
Scan(&artifactMappings)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("查询i18n artifact映射失败: %v", err)
|
||||||
|
}
|
||||||
|
artifactCodeToZh := make(map[string]string)
|
||||||
|
for _, m := range artifactMappings {
|
||||||
|
artifactCodeToZh[m.Code] = m.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 修复神器表
|
||||||
|
var artifacts []*entity.EpicArtifactInfo
|
||||||
|
err = dao.EpicArtifactInfo.Ctx(ctx).Scan(&artifacts)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("查询epic_artifact_info失败: %v", err)
|
||||||
|
}
|
||||||
|
for _, a := range artifacts {
|
||||||
|
if zh, ok := artifactCodeToZh[a.ArtifactCode]; ok && zh != "" && zh != a.ArtifactName {
|
||||||
|
_, err := dao.EpicArtifactInfo.Ctx(ctx).
|
||||||
|
Where(dao.EpicArtifactInfo.Columns().ArtifactCode, a.ArtifactCode).
|
||||||
|
Data(g.Map{dao.EpicArtifactInfo.Columns().ArtifactName: zh}).
|
||||||
|
Update()
|
||||||
|
if err != nil {
|
||||||
|
g.Log().Errorf(ctx, "更新神器中文名失败: %s(%s) -> %s, err: %v", a.ArtifactName, a.ArtifactCode, zh, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.Log().Info(ctx, "epic_artifact_info神器名修复完成")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -67,3 +67,22 @@ func TestInitI18nStaticToDB(t *testing.T) {
|
|||||||
}
|
}
|
||||||
t.Logf("静态i18n数据导入成功,共%d条", len(i18n.I18nEnToZh))
|
t.Logf("静态i18n数据导入成功,共%d条", len(i18n.I18nEnToZh))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSyncI18nFromRemote(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
logic := i18n.GetI18nLogic()
|
||||||
|
err := logic.SyncI18nFromRemote(ctx)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("远程i18n数据同步失败: %v", err)
|
||||||
|
}
|
||||||
|
t.Logf("远程i18n数据同步成功")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestFixHeroAndArtifactNameToChinese(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
err := FixHeroAndArtifactNameToChinese(ctx)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("修复英雄/神器中文名失败: %v", err)
|
||||||
|
}
|
||||||
|
t.Logf("修复英雄/神器中文名成功")
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package i18n
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"epic/internal/consts"
|
||||||
"epic/internal/dao"
|
"epic/internal/dao"
|
||||||
"epic/internal/model/entity"
|
"epic/internal/model/entity"
|
||||||
"epic/internal/util"
|
"epic/internal/util"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/gogf/gf/v2/encoding/gjson"
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"github.com/gogf/gf/v2/net/gclient"
|
||||||
"github.com/gogf/gf/v2/os/gtime"
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -603,14 +606,22 @@ var I18nZhToEn = func() map[string]string {
|
|||||||
return m
|
return m
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// Logic i18n主逻辑结构体
|
||||||
|
// cache结构调整:lang -> { code -> value, key -> value }
|
||||||
type Logic struct {
|
type Logic struct {
|
||||||
cache map[string]map[string]string // lang -> key -> value
|
cache map[string]struct {
|
||||||
|
ByCode map[string]string // code->value
|
||||||
|
ByKey map[string]string // key->value
|
||||||
|
}
|
||||||
mutex sync.RWMutex
|
mutex sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() *Logic {
|
func New() *Logic {
|
||||||
return &Logic{
|
return &Logic{
|
||||||
cache: make(map[string]map[string]string),
|
cache: make(map[string]struct {
|
||||||
|
ByCode map[string]string
|
||||||
|
ByKey map[string]string
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,16 +656,24 @@ func (l *Logic) LoadFromDB(ctx context.Context) error {
|
|||||||
defer l.mutex.Unlock()
|
defer l.mutex.Unlock()
|
||||||
|
|
||||||
// 重新构建缓存
|
// 重新构建缓存
|
||||||
l.cache = make(map[string]map[string]string)
|
l.cache = make(map[string]struct {
|
||||||
// 新增:同步数据库内容到I18nEnToZh和I18nZhToEn备份
|
ByCode map[string]string
|
||||||
|
ByKey map[string]string
|
||||||
|
})
|
||||||
for _, m := range mappings {
|
for _, m := range mappings {
|
||||||
if l.cache[m.Language] == nil {
|
if l.cache[m.Language].ByCode == nil {
|
||||||
l.cache[m.Language] = make(map[string]string)
|
l.cache[m.Language] = struct {
|
||||||
|
ByCode map[string]string
|
||||||
|
ByKey map[string]string
|
||||||
|
}{ByCode: make(map[string]string), ByKey: make(map[string]string)}
|
||||||
}
|
}
|
||||||
l.cache[m.Language][m.KeyName] = m.Value
|
if m.Code != "" {
|
||||||
|
l.cache[m.Language].ByCode[m.Code] = m.Value
|
||||||
|
}
|
||||||
|
l.cache[m.Language].ByKey[m.KeyName] = m.Value
|
||||||
if m.Language == "zh" {
|
if m.Language == "zh" {
|
||||||
I18nEnToZh[m.KeyName] = m.Value
|
I18nEnToZh[m.KeyName] = m.Value
|
||||||
I18nZhToEn[m.Value] = m.KeyName // 新增:同步反向映射
|
I18nZhToEn[m.Value] = m.KeyName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,13 +681,19 @@ func (l *Logic) LoadFromDB(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get 获取指定key的指定语言翻译
|
// Get 获取指定key/code的指定语言翻译
|
||||||
func (l *Logic) Get(ctx context.Context, lang, key string) string {
|
func (l *Logic) Get(ctx context.Context, lang, key string, code ...string) string {
|
||||||
l.mutex.RLock()
|
l.mutex.RLock()
|
||||||
defer l.mutex.RUnlock()
|
defer l.mutex.RUnlock()
|
||||||
|
if len(code) > 0 && code[0] != "" {
|
||||||
|
if m, ok := l.cache[lang]; ok {
|
||||||
|
if v, ok := m.ByCode[code[0]]; ok {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if m, ok := l.cache[lang]; ok {
|
if m, ok := l.cache[lang]; ok {
|
||||||
if v, ok := m[key]; ok {
|
if v, ok := m.ByKey[key]; ok {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -683,7 +708,7 @@ func (l *Logic) GetBatch(ctx context.Context, lang string, keys []string) map[st
|
|||||||
result := make(map[string]string)
|
result := make(map[string]string)
|
||||||
if m, ok := l.cache[lang]; ok {
|
if m, ok := l.cache[lang]; ok {
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
if v, ok := m[key]; ok {
|
if v, ok := m.ByKey[key]; ok {
|
||||||
result[key] = v
|
result[key] = v
|
||||||
} else {
|
} else {
|
||||||
result[key] = key // 找不到返回原文
|
result[key] = key // 找不到返回原文
|
||||||
@@ -724,10 +749,16 @@ func (l *Logic) Add(ctx context.Context, key, lang, value, category string) erro
|
|||||||
l.mutex.Lock()
|
l.mutex.Lock()
|
||||||
defer l.mutex.Unlock()
|
defer l.mutex.Unlock()
|
||||||
|
|
||||||
if l.cache[lang] == nil {
|
if _, exists := l.cache[lang]; !exists {
|
||||||
l.cache[lang] = make(map[string]string)
|
l.cache[lang] = struct {
|
||||||
|
ByCode map[string]string
|
||||||
|
ByKey map[string]string
|
||||||
|
}{
|
||||||
|
ByCode: make(map[string]string),
|
||||||
|
ByKey: make(map[string]string),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
l.cache[lang][key] = value
|
l.cache[lang].ByKey[key] = value
|
||||||
|
|
||||||
util.Info(ctx, "添加翻译:", lang, key, "->", value)
|
util.Info(ctx, "添加翻译:", lang, key, "->", value)
|
||||||
return nil
|
return nil
|
||||||
@@ -752,10 +783,16 @@ func (l *Logic) Update(ctx context.Context, key, lang, value string) error {
|
|||||||
l.mutex.Lock()
|
l.mutex.Lock()
|
||||||
defer l.mutex.Unlock()
|
defer l.mutex.Unlock()
|
||||||
|
|
||||||
if l.cache[lang] == nil {
|
if _, exists := l.cache[lang]; !exists {
|
||||||
l.cache[lang] = make(map[string]string)
|
l.cache[lang] = struct {
|
||||||
|
ByCode map[string]string
|
||||||
|
ByKey map[string]string
|
||||||
|
}{
|
||||||
|
ByCode: make(map[string]string),
|
||||||
|
ByKey: make(map[string]string),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
l.cache[lang][key] = value
|
l.cache[lang].ByKey[key] = value
|
||||||
|
|
||||||
util.Info(ctx, "更新翻译:", lang, key, "->", value)
|
util.Info(ctx, "更新翻译:", lang, key, "->", value)
|
||||||
return nil
|
return nil
|
||||||
@@ -781,7 +818,7 @@ func (l *Logic) Delete(ctx context.Context, key, lang string) error {
|
|||||||
defer l.mutex.Unlock()
|
defer l.mutex.Unlock()
|
||||||
|
|
||||||
if m, ok := l.cache[lang]; ok {
|
if m, ok := l.cache[lang]; ok {
|
||||||
delete(m, key)
|
delete(m.ByKey, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
util.Info(ctx, "删除翻译:", lang, key)
|
util.Info(ctx, "删除翻译:", lang, key)
|
||||||
@@ -811,7 +848,7 @@ func (l *Logic) GetByCategory(ctx context.Context, lang, category string) (map[s
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImportFromMap 从map批量导入翻译
|
// 从map批量导入翻译
|
||||||
func (l *Logic) ImportFromMap(ctx context.Context, lang string, mappings map[string]string, category string) error {
|
func (l *Logic) ImportFromMap(ctx context.Context, lang string, mappings map[string]string, category string) error {
|
||||||
if len(mappings) == 0 {
|
if len(mappings) == 0 {
|
||||||
return nil
|
return nil
|
||||||
@@ -840,11 +877,17 @@ func (l *Logic) ImportFromMap(ctx context.Context, lang string, mappings map[str
|
|||||||
l.mutex.Lock()
|
l.mutex.Lock()
|
||||||
defer l.mutex.Unlock()
|
defer l.mutex.Unlock()
|
||||||
|
|
||||||
if l.cache[lang] == nil {
|
if _, exists := l.cache[lang]; !exists {
|
||||||
l.cache[lang] = make(map[string]string)
|
l.cache[lang] = struct {
|
||||||
|
ByCode map[string]string
|
||||||
|
ByKey map[string]string
|
||||||
|
}{
|
||||||
|
ByCode: make(map[string]string),
|
||||||
|
ByKey: make(map[string]string),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for key, value := range mappings {
|
for key, value := range mappings {
|
||||||
l.cache[lang][key] = value
|
l.cache[lang].ByKey[key] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
util.Info(ctx, "批量导入翻译完成:", lang, category, "共", len(mappings), "条")
|
util.Info(ctx, "批量导入翻译完成:", lang, category, "共", len(mappings), "条")
|
||||||
@@ -878,7 +921,7 @@ func (l *Logic) StartAutoRefresh(ctx context.Context) {
|
|||||||
|
|
||||||
// En2Zh 英文转中文(静态映射,仅降级时使用)
|
// En2Zh 英文转中文(静态映射,仅降级时使用)
|
||||||
func En2Zh(s string) string {
|
func En2Zh(s string) string {
|
||||||
if v, ok := GetI18nLogic().cache["zh"][s]; ok {
|
if v, ok := GetI18nLogic().cache["zh"].ByKey[s]; ok {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
// 仅降级时才用备份
|
// 仅降级时才用备份
|
||||||
@@ -890,7 +933,7 @@ func En2Zh(s string) string {
|
|||||||
|
|
||||||
// Zh2En 中文转英文(静态映射,仅降级时使用)
|
// Zh2En 中文转英文(静态映射,仅降级时使用)
|
||||||
func Zh2En(s string) string {
|
func Zh2En(s string) string {
|
||||||
if v, ok := GetI18nLogic().cache["en"][s]; ok {
|
if v, ok := GetI18nLogic().cache["en"].ByKey[s]; ok {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
// 仅降级时才用备份
|
// 仅降级时才用备份
|
||||||
@@ -975,3 +1018,158 @@ func ImportI18nFromMap(ctx context.Context, lang string, mappings map[string]str
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SyncI18nFromRemote 从远程接口拉取英雄和神器的中英文名称,写入数据库和内存缓存
|
||||||
|
func (l *Logic) SyncI18nFromRemote(ctx context.Context) error {
|
||||||
|
client := gclient.New()
|
||||||
|
|
||||||
|
types := []struct {
|
||||||
|
url string
|
||||||
|
category string
|
||||||
|
}{
|
||||||
|
{consts.SimileHeroName, "hero"},
|
||||||
|
{consts.SimileArtifactName, "artifact"},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, t := range types {
|
||||||
|
g.Log().Infof(ctx, "拉取i18n远程数据: %s", t.url)
|
||||||
|
resp, err := client.Get(ctx, t.url)
|
||||||
|
if err != nil {
|
||||||
|
g.Log().Errorf(ctx, "拉取远程i18n数据失败: %s, err: %v", t.url, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
content := resp.ReadAll()
|
||||||
|
j := gjson.New(content)
|
||||||
|
if j == nil || j.IsNil() {
|
||||||
|
g.Log().Errorf(ctx, "解析远程i18n数据失败: %s, 内容为空", t.url)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var data map[string][]map[string]interface{}
|
||||||
|
if err := j.Var().Scan(&data); err != nil {
|
||||||
|
g.Log().Errorf(ctx, "解析远程i18n数据失败: %s, err: %v", t.url, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
enArr, enOk := data["en"]
|
||||||
|
zhArr, zhOk := data["zh-CN"]
|
||||||
|
if !enOk || !zhOk {
|
||||||
|
g.Log().Warningf(ctx, "远程i18n数据缺少en或zh-CN: %s", t.url)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// code->en/zh
|
||||||
|
enMap := make(map[string]string)
|
||||||
|
zhMap := make(map[string]string)
|
||||||
|
for _, item := range enArr {
|
||||||
|
if code, ok := item["code"].(string); ok {
|
||||||
|
if name, ok := item["name"].(string); ok {
|
||||||
|
enMap[code] = name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, item := range zhArr {
|
||||||
|
if code, ok := item["code"].(string); ok {
|
||||||
|
if name, ok := item["name"].(string); ok {
|
||||||
|
zhMap[code] = name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// code->en/zh三元组
|
||||||
|
type row struct{ code, en, zh string }
|
||||||
|
var rows []row
|
||||||
|
for code, enName := range enMap {
|
||||||
|
if zhName, ok := zhMap[code]; ok {
|
||||||
|
rows = append(rows, row{code, enName, zhName})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(rows) == 0 {
|
||||||
|
g.Log().Warningf(ctx, "未生成任何en->zh映射: %s", t.url)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取数据库现有映射,优先用code查找
|
||||||
|
var dbMappings []*entity.EpicI18NMappings
|
||||||
|
err = dao.EpicI18NMappings.Ctx(ctx).
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Language, "zh").
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Category, t.category).
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Status, 1).
|
||||||
|
Where(dao.EpicI18NMappings.Columns().Deleted, 0).
|
||||||
|
Scan(&dbMappings)
|
||||||
|
if err != nil {
|
||||||
|
g.Log().Errorf(ctx, "查询i18n数据库失败: %v", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dbMapByCode := make(map[string]*entity.EpicI18NMappings)
|
||||||
|
dbMapByKey := make(map[string]*entity.EpicI18NMappings)
|
||||||
|
for _, m := range dbMappings {
|
||||||
|
if m.Code != "" {
|
||||||
|
dbMapByCode[m.Code] = m
|
||||||
|
}
|
||||||
|
dbMapByKey[m.KeyName] = m
|
||||||
|
}
|
||||||
|
|
||||||
|
var toInsert []g.Map
|
||||||
|
var toUpdate []struct{ code, en, zh string }
|
||||||
|
for _, r := range rows {
|
||||||
|
var exist *entity.EpicI18NMappings
|
||||||
|
if r.code != "" {
|
||||||
|
exist = dbMapByCode[r.code]
|
||||||
|
}
|
||||||
|
if exist == nil {
|
||||||
|
exist = dbMapByKey[r.en]
|
||||||
|
}
|
||||||
|
if exist == nil {
|
||||||
|
toInsert = append(toInsert, g.Map{
|
||||||
|
dao.EpicI18NMappings.Columns().KeyName: r.en,
|
||||||
|
dao.EpicI18NMappings.Columns().Language: "zh",
|
||||||
|
dao.EpicI18NMappings.Columns().Value: r.zh,
|
||||||
|
dao.EpicI18NMappings.Columns().Category: t.category,
|
||||||
|
dao.EpicI18NMappings.Columns().Code: r.code,
|
||||||
|
dao.EpicI18NMappings.Columns().Status: 1,
|
||||||
|
dao.EpicI18NMappings.Columns().CreateTime: gtime.Now(),
|
||||||
|
dao.EpicI18NMappings.Columns().UpdateTime: gtime.Now(),
|
||||||
|
})
|
||||||
|
} else if exist.Value != r.zh {
|
||||||
|
toUpdate = append(toUpdate, struct{ code, en, zh string }{r.code, r.en, r.zh})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(toInsert) > 0 {
|
||||||
|
_, err := dao.EpicI18NMappings.Ctx(ctx).Data(toInsert).Insert()
|
||||||
|
if err != nil {
|
||||||
|
g.Log().Errorf(ctx, "批量导入i18n数据失败: %s, err: %v", t.url, err)
|
||||||
|
} else {
|
||||||
|
g.Log().Infof(ctx, "远程i18n新增导入成功: %s, 共%d条", t.url, len(toInsert))
|
||||||
|
// 更新缓存
|
||||||
|
l.mutex.Lock()
|
||||||
|
if _, exists := l.cache["zh"]; !exists {
|
||||||
|
l.cache["zh"] = struct {
|
||||||
|
ByCode map[string]string
|
||||||
|
ByKey map[string]string
|
||||||
|
}{
|
||||||
|
ByCode: make(map[string]string),
|
||||||
|
ByKey: make(map[string]string),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, item := range toInsert {
|
||||||
|
if keyName, ok := item[dao.EpicI18NMappings.Columns().KeyName].(string); ok {
|
||||||
|
if value, ok := item[dao.EpicI18NMappings.Columns().Value].(string); ok {
|
||||||
|
l.cache["zh"].ByKey[keyName] = value
|
||||||
|
if code, ok := item[dao.EpicI18NMappings.Columns().Code].(string); ok && code != "" {
|
||||||
|
l.cache["zh"].ByCode[code] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l.mutex.Unlock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(toUpdate) > 0 {
|
||||||
|
for _, r := range toUpdate {
|
||||||
|
if err := l.Update(ctx, r.en, "zh", r.zh); err != nil {
|
||||||
|
g.Log().Errorf(ctx, "更新i18n数据失败: %s %s -> %s, err: %v", t.category, r.en, r.zh, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.Log().Infof(ctx, "远程i18n更新成功: %s, 共%d条", t.url, len(toUpdate))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,4 +23,5 @@ type EpicI18NMappings struct {
|
|||||||
Updater interface{} // 更新者
|
Updater interface{} // 更新者
|
||||||
UpdateTime *gtime.Time // 更新时间
|
UpdateTime *gtime.Time // 更新时间
|
||||||
Deleted interface{} // 是否删除
|
Deleted interface{} // 是否删除
|
||||||
|
Code interface{} // 编码
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,5 @@ type EpicI18NMappings struct {
|
|||||||
Updater string `json:"updater" orm:"updater" description:"更新者"` // 更新者
|
Updater string `json:"updater" orm:"updater" description:"更新者"` // 更新者
|
||||||
UpdateTime *gtime.Time `json:"updateTime" orm:"update_time" description:"更新时间"` // 更新时间
|
UpdateTime *gtime.Time `json:"updateTime" orm:"update_time" description:"更新时间"` // 更新时间
|
||||||
Deleted int `json:"deleted" orm:"deleted" description:"是否删除"` // 是否删除
|
Deleted int `json:"deleted" orm:"deleted" description:"是否删除"` // 是否删除
|
||||||
|
Code string `json:"code" orm:"code" description:"编码"` // 编码
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user