修复 多处基础错误 现在可以直接使用gf run .\main.go 运行程序

This commit is contained in:
联盟少侠
2025-07-09 13:16:46 +08:00
parent 6fcfa61dff
commit d79138d278
48 changed files with 1368 additions and 934 deletions

View File

@@ -8,9 +8,9 @@ package common
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"hotgo/api/admin/common"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/library/contexts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/sysin"

View File

@@ -8,9 +8,9 @@ package common
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"hotgo/api/admin/common"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/library/contexts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/sysin"

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AddonHgexampleTableDao is the data access object for table hg_addon_hgexample_table.
// AddonHgexampleTableDao is the data access object for the table hg_addon_hgexample_table.
type AddonHgexampleTableDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AddonHgexampleTableColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AddonHgexampleTableColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AddonHgexampleTableColumns defines and stores column names for table hg_addon_hgexample_table.
// AddonHgexampleTableColumns defines and stores column names for the table hg_addon_hgexample_table.
type AddonHgexampleTableColumns struct {
Id string // ID
Pid string // 上级ID
@@ -59,7 +60,7 @@ type AddonHgexampleTableColumns struct {
DeletedAt string // 删除时间
}
// addonHgexampleTableColumns holds the columns for table hg_addon_hgexample_table.
// addonHgexampleTableColumns holds the columns for the table hg_addon_hgexample_table.
var addonHgexampleTableColumns = AddonHgexampleTableColumns{
Id: "id",
Pid: "pid",
@@ -101,44 +102,49 @@ var addonHgexampleTableColumns = AddonHgexampleTableColumns{
}
// NewAddonHgexampleTableDao creates and returns a new DAO object for table data access.
func NewAddonHgexampleTableDao() *AddonHgexampleTableDao {
func NewAddonHgexampleTableDao(handlers ...gdb.ModelHandler) *AddonHgexampleTableDao {
return &AddonHgexampleTableDao{
group: "default",
table: "hg_addon_hgexample_table",
columns: addonHgexampleTableColumns,
group: "default",
table: "hg_addon_hgexample_table",
columns: addonHgexampleTableColumns,
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 *AddonHgexampleTableDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AddonHgexampleTableDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AddonHgexampleTableDao) Columns() AddonHgexampleTableColumns {
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 *AddonHgexampleTableDao) Group() string {
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 *AddonHgexampleTableDao) 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.
// 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.
//
// 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.
func (dao *AddonHgexampleTableDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AddonHgexampleTenantOrderDao is the data access object for table hg_addon_hgexample_tenant_order.
// AddonHgexampleTenantOrderDao is the data access object for the table hg_addon_hgexample_tenant_order.
type AddonHgexampleTenantOrderDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AddonHgexampleTenantOrderColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AddonHgexampleTenantOrderColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AddonHgexampleTenantOrderColumns defines and stores column names for table hg_addon_hgexample_tenant_order.
// AddonHgexampleTenantOrderColumns defines and stores column names for the table hg_addon_hgexample_tenant_order.
type AddonHgexampleTenantOrderColumns struct {
Id string // 主键
TenantId string // 租户ID
@@ -33,7 +34,7 @@ type AddonHgexampleTenantOrderColumns struct {
UpdatedAt string // 修改时间
}
// addonHgexampleTenantOrderColumns holds the columns for table hg_addon_hgexample_tenant_order.
// addonHgexampleTenantOrderColumns holds the columns for the table hg_addon_hgexample_tenant_order.
var addonHgexampleTenantOrderColumns = AddonHgexampleTenantOrderColumns{
Id: "id",
TenantId: "tenant_id",
@@ -49,44 +50,49 @@ var addonHgexampleTenantOrderColumns = AddonHgexampleTenantOrderColumns{
}
// NewAddonHgexampleTenantOrderDao creates and returns a new DAO object for table data access.
func NewAddonHgexampleTenantOrderDao() *AddonHgexampleTenantOrderDao {
func NewAddonHgexampleTenantOrderDao(handlers ...gdb.ModelHandler) *AddonHgexampleTenantOrderDao {
return &AddonHgexampleTenantOrderDao{
group: "default",
table: "hg_addon_hgexample_tenant_order",
columns: addonHgexampleTenantOrderColumns,
group: "default",
table: "hg_addon_hgexample_tenant_order",
columns: addonHgexampleTenantOrderColumns,
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 *AddonHgexampleTenantOrderDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AddonHgexampleTenantOrderDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AddonHgexampleTenantOrderDao) Columns() AddonHgexampleTenantOrderColumns {
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 *AddonHgexampleTenantOrderDao) Group() string {
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 *AddonHgexampleTenantOrderDao) 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.
// 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.
//
// 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.
func (dao *AddonHgexampleTenantOrderDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminCashDao is the data access object for table hg_admin_cash.
// AdminCashDao is the data access object for the table hg_admin_cash.
type AdminCashDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminCashColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminCashColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminCashColumns defines and stores column names for table hg_admin_cash.
// AdminCashColumns defines and stores column names for the table hg_admin_cash.
type AdminCashColumns struct {
Id string // ID
MemberId string // 管理员ID
@@ -32,7 +33,7 @@ type AdminCashColumns struct {
CreatedAt string // 申请时间
}
// adminCashColumns holds the columns for table hg_admin_cash.
// adminCashColumns holds the columns for the table hg_admin_cash.
var adminCashColumns = AdminCashColumns{
Id: "id",
MemberId: "member_id",
@@ -47,44 +48,49 @@ var adminCashColumns = AdminCashColumns{
}
// NewAdminCashDao creates and returns a new DAO object for table data access.
func NewAdminCashDao() *AdminCashDao {
func NewAdminCashDao(handlers ...gdb.ModelHandler) *AdminCashDao {
return &AdminCashDao{
group: "default",
table: "hg_admin_cash",
columns: adminCashColumns,
group: "default",
table: "hg_admin_cash",
columns: adminCashColumns,
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 *AdminCashDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminCashDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminCashDao) Columns() AdminCashColumns {
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 *AdminCashDao) Group() string {
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 *AdminCashDao) 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.
// 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.
//
// 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.
func (dao *AdminCashDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminCreditsLogDao is the data access object for table hg_admin_credits_log.
// AdminCreditsLogDao is the data access object for the table hg_admin_credits_log.
type AdminCreditsLogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminCreditsLogColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminCreditsLogColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminCreditsLogColumns defines and stores column names for table hg_admin_credits_log.
// AdminCreditsLogColumns defines and stores column names for the table hg_admin_credits_log.
type AdminCreditsLogColumns struct {
Id string // 变动ID
MemberId string // 管理员ID
@@ -37,7 +38,7 @@ type AdminCreditsLogColumns struct {
UpdatedAt string // 修改时间
}
// adminCreditsLogColumns holds the columns for table hg_admin_credits_log.
// adminCreditsLogColumns holds the columns for the table hg_admin_credits_log.
var adminCreditsLogColumns = AdminCreditsLogColumns{
Id: "id",
MemberId: "member_id",
@@ -57,44 +58,49 @@ var adminCreditsLogColumns = AdminCreditsLogColumns{
}
// NewAdminCreditsLogDao creates and returns a new DAO object for table data access.
func NewAdminCreditsLogDao() *AdminCreditsLogDao {
func NewAdminCreditsLogDao(handlers ...gdb.ModelHandler) *AdminCreditsLogDao {
return &AdminCreditsLogDao{
group: "default",
table: "hg_admin_credits_log",
columns: adminCreditsLogColumns,
group: "default",
table: "hg_admin_credits_log",
columns: adminCreditsLogColumns,
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 *AdminCreditsLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminCreditsLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminCreditsLogDao) Columns() AdminCreditsLogColumns {
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 *AdminCreditsLogDao) Group() string {
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 *AdminCreditsLogDao) 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.
// 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.
//
// 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.
func (dao *AdminCreditsLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminDeptDao is the data access object for table hg_admin_dept.
// AdminDeptDao is the data access object for the table hg_admin_dept.
type AdminDeptDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminDeptColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminDeptColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminDeptColumns defines and stores column names for table hg_admin_dept.
// AdminDeptColumns defines and stores column names for the table hg_admin_dept.
type AdminDeptColumns struct {
Id string // 部门ID
Pid string // 父部门ID
@@ -36,7 +37,7 @@ type AdminDeptColumns struct {
UpdatedAt string // 更新时间
}
// adminDeptColumns holds the columns for table hg_admin_dept.
// adminDeptColumns holds the columns for the table hg_admin_dept.
var adminDeptColumns = AdminDeptColumns{
Id: "id",
Pid: "pid",
@@ -55,44 +56,49 @@ var adminDeptColumns = AdminDeptColumns{
}
// NewAdminDeptDao creates and returns a new DAO object for table data access.
func NewAdminDeptDao() *AdminDeptDao {
func NewAdminDeptDao(handlers ...gdb.ModelHandler) *AdminDeptDao {
return &AdminDeptDao{
group: "default",
table: "hg_admin_dept",
columns: adminDeptColumns,
group: "default",
table: "hg_admin_dept",
columns: adminDeptColumns,
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 *AdminDeptDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminDeptDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminDeptDao) Columns() AdminDeptColumns {
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 *AdminDeptDao) Group() string {
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 *AdminDeptDao) 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.
// 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.
//
// 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.
func (dao *AdminDeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminMemberDao is the data access object for table hg_admin_member.
// AdminMemberDao is the data access object for the table hg_admin_member.
type AdminMemberDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminMemberColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminMemberColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminMemberColumns defines and stores column names for table hg_admin_member.
// AdminMemberColumns defines and stores column names for the table hg_admin_member.
type AdminMemberColumns struct {
Id string // 管理员ID
DeptId string // 部门ID
@@ -50,7 +51,7 @@ type AdminMemberColumns struct {
UpdatedAt string // 修改时间
}
// adminMemberColumns holds the columns for table hg_admin_member.
// adminMemberColumns holds the columns for the table hg_admin_member.
var adminMemberColumns = AdminMemberColumns{
Id: "id",
DeptId: "dept_id",
@@ -83,44 +84,49 @@ var adminMemberColumns = AdminMemberColumns{
}
// NewAdminMemberDao creates and returns a new DAO object for table data access.
func NewAdminMemberDao() *AdminMemberDao {
func NewAdminMemberDao(handlers ...gdb.ModelHandler) *AdminMemberDao {
return &AdminMemberDao{
group: "default",
table: "hg_admin_member",
columns: adminMemberColumns,
group: "default",
table: "hg_admin_member",
columns: adminMemberColumns,
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 *AdminMemberDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminMemberDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminMemberDao) Columns() AdminMemberColumns {
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 *AdminMemberDao) Group() string {
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 *AdminMemberDao) 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.
// 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.
//
// 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.
func (dao *AdminMemberDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,64 +11,70 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminMemberPostDao is the data access object for table hg_admin_member_post.
// AdminMemberPostDao is the data access object for the table hg_admin_member_post.
type AdminMemberPostDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminMemberPostColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminMemberPostColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminMemberPostColumns defines and stores column names for table hg_admin_member_post.
// AdminMemberPostColumns defines and stores column names for the table hg_admin_member_post.
type AdminMemberPostColumns struct {
MemberId string // 管理员ID
PostId string // 岗位ID
}
// adminMemberPostColumns holds the columns for table hg_admin_member_post.
// adminMemberPostColumns holds the columns for the table hg_admin_member_post.
var adminMemberPostColumns = AdminMemberPostColumns{
MemberId: "member_id",
PostId: "post_id",
}
// NewAdminMemberPostDao creates and returns a new DAO object for table data access.
func NewAdminMemberPostDao() *AdminMemberPostDao {
func NewAdminMemberPostDao(handlers ...gdb.ModelHandler) *AdminMemberPostDao {
return &AdminMemberPostDao{
group: "default",
table: "hg_admin_member_post",
columns: adminMemberPostColumns,
group: "default",
table: "hg_admin_member_post",
columns: adminMemberPostColumns,
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 *AdminMemberPostDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminMemberPostDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminMemberPostDao) Columns() AdminMemberPostColumns {
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 *AdminMemberPostDao) Group() string {
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 *AdminMemberPostDao) 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.
// 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.
//
// 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.
func (dao *AdminMemberPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,64 +11,70 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminMemberRoleDao is the data access object for table hg_admin_member_role.
// AdminMemberRoleDao is the data access object for the table hg_admin_member_role.
type AdminMemberRoleDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminMemberRoleColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminMemberRoleColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminMemberRoleColumns defines and stores column names for table hg_admin_member_role.
// AdminMemberRoleColumns defines and stores column names for the table hg_admin_member_role.
type AdminMemberRoleColumns struct {
MemberId string // 管理员ID
RoleId string // 角色ID
}
// adminMemberRoleColumns holds the columns for table hg_admin_member_role.
// adminMemberRoleColumns holds the columns for the table hg_admin_member_role.
var adminMemberRoleColumns = AdminMemberRoleColumns{
MemberId: "member_id",
RoleId: "role_id",
}
// NewAdminMemberRoleDao creates and returns a new DAO object for table data access.
func NewAdminMemberRoleDao() *AdminMemberRoleDao {
func NewAdminMemberRoleDao(handlers ...gdb.ModelHandler) *AdminMemberRoleDao {
return &AdminMemberRoleDao{
group: "default",
table: "hg_admin_member_role",
columns: adminMemberRoleColumns,
group: "default",
table: "hg_admin_member_role",
columns: adminMemberRoleColumns,
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 *AdminMemberRoleDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminMemberRoleDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminMemberRoleDao) Columns() AdminMemberRoleColumns {
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 *AdminMemberRoleDao) Group() string {
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 *AdminMemberRoleDao) 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.
// 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.
//
// 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.
func (dao *AdminMemberRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminMenuDao is the data access object for table hg_admin_menu.
// AdminMenuDao is the data access object for the table hg_admin_menu.
type AdminMenuDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminMenuColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminMenuColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminMenuColumns defines and stores column names for table hg_admin_menu.
// AdminMenuColumns defines and stores column names for the table hg_admin_menu.
type AdminMenuColumns struct {
Id string // 菜单ID
Pid string // 父菜单ID
@@ -48,7 +49,7 @@ type AdminMenuColumns struct {
CreatedAt string // 创建时间
}
// adminMenuColumns holds the columns for table hg_admin_menu.
// adminMenuColumns holds the columns for the table hg_admin_menu.
var adminMenuColumns = AdminMenuColumns{
Id: "id",
Pid: "pid",
@@ -79,44 +80,49 @@ var adminMenuColumns = AdminMenuColumns{
}
// NewAdminMenuDao creates and returns a new DAO object for table data access.
func NewAdminMenuDao() *AdminMenuDao {
func NewAdminMenuDao(handlers ...gdb.ModelHandler) *AdminMenuDao {
return &AdminMenuDao{
group: "default",
table: "hg_admin_menu",
columns: adminMenuColumns,
group: "default",
table: "hg_admin_menu",
columns: adminMenuColumns,
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 *AdminMenuDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminMenuDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminMenuDao) Columns() AdminMenuColumns {
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 *AdminMenuDao) Group() string {
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 *AdminMenuDao) 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.
// 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.
//
// 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.
func (dao *AdminMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminNoticeDao is the data access object for table hg_admin_notice.
// AdminNoticeDao is the data access object for the table hg_admin_notice.
type AdminNoticeDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminNoticeColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminNoticeColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminNoticeColumns defines and stores column names for table hg_admin_notice.
// AdminNoticeColumns defines and stores column names for the table hg_admin_notice.
type AdminNoticeColumns struct {
Id string // 公告ID
Title string // 公告标题
@@ -36,7 +37,7 @@ type AdminNoticeColumns struct {
DeletedAt string // 删除时间
}
// adminNoticeColumns holds the columns for table hg_admin_notice.
// adminNoticeColumns holds the columns for the table hg_admin_notice.
var adminNoticeColumns = AdminNoticeColumns{
Id: "id",
Title: "title",
@@ -55,44 +56,49 @@ var adminNoticeColumns = AdminNoticeColumns{
}
// NewAdminNoticeDao creates and returns a new DAO object for table data access.
func NewAdminNoticeDao() *AdminNoticeDao {
func NewAdminNoticeDao(handlers ...gdb.ModelHandler) *AdminNoticeDao {
return &AdminNoticeDao{
group: "default",
table: "hg_admin_notice",
columns: adminNoticeColumns,
group: "default",
table: "hg_admin_notice",
columns: adminNoticeColumns,
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 *AdminNoticeDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminNoticeDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminNoticeDao) Columns() AdminNoticeColumns {
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 *AdminNoticeDao) Group() string {
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 *AdminNoticeDao) 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.
// 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.
//
// 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.
func (dao *AdminNoticeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminNoticeReadDao is the data access object for table hg_admin_notice_read.
// AdminNoticeReadDao is the data access object for the table hg_admin_notice_read.
type AdminNoticeReadDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminNoticeReadColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminNoticeReadColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminNoticeReadColumns defines and stores column names for table hg_admin_notice_read.
// AdminNoticeReadColumns defines and stores column names for the table hg_admin_notice_read.
type AdminNoticeReadColumns struct {
Id string // 记录ID
NoticeId string // 公告ID
@@ -28,7 +29,7 @@ type AdminNoticeReadColumns struct {
CreatedAt string // 阅读时间
}
// adminNoticeReadColumns holds the columns for table hg_admin_notice_read.
// adminNoticeReadColumns holds the columns for the table hg_admin_notice_read.
var adminNoticeReadColumns = AdminNoticeReadColumns{
Id: "id",
NoticeId: "notice_id",
@@ -39,44 +40,49 @@ var adminNoticeReadColumns = AdminNoticeReadColumns{
}
// NewAdminNoticeReadDao creates and returns a new DAO object for table data access.
func NewAdminNoticeReadDao() *AdminNoticeReadDao {
func NewAdminNoticeReadDao(handlers ...gdb.ModelHandler) *AdminNoticeReadDao {
return &AdminNoticeReadDao{
group: "default",
table: "hg_admin_notice_read",
columns: adminNoticeReadColumns,
group: "default",
table: "hg_admin_notice_read",
columns: adminNoticeReadColumns,
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 *AdminNoticeReadDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminNoticeReadDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminNoticeReadDao) Columns() AdminNoticeReadColumns {
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 *AdminNoticeReadDao) Group() string {
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 *AdminNoticeReadDao) 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.
// 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.
//
// 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.
func (dao *AdminNoticeReadDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminOauthDao is the data access object for table hg_admin_oauth.
// AdminOauthDao is the data access object for the table hg_admin_oauth.
type AdminOauthDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminOauthColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminOauthColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminOauthColumns defines and stores column names for table hg_admin_oauth.
// AdminOauthColumns defines and stores column names for the table hg_admin_oauth.
type AdminOauthColumns struct {
Id string // 主键
MemberId string // 用户ID
@@ -37,7 +38,7 @@ type AdminOauthColumns struct {
UpdatedAt string // 修改时间
}
// adminOauthColumns holds the columns for table hg_admin_oauth.
// adminOauthColumns holds the columns for the table hg_admin_oauth.
var adminOauthColumns = AdminOauthColumns{
Id: "id",
MemberId: "member_id",
@@ -57,44 +58,49 @@ var adminOauthColumns = AdminOauthColumns{
}
// NewAdminOauthDao creates and returns a new DAO object for table data access.
func NewAdminOauthDao() *AdminOauthDao {
func NewAdminOauthDao(handlers ...gdb.ModelHandler) *AdminOauthDao {
return &AdminOauthDao{
group: "default",
table: "hg_admin_oauth",
columns: adminOauthColumns,
group: "default",
table: "hg_admin_oauth",
columns: adminOauthColumns,
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 *AdminOauthDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminOauthDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminOauthDao) Columns() AdminOauthColumns {
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 *AdminOauthDao) Group() string {
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 *AdminOauthDao) 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.
// 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.
//
// 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.
func (dao *AdminOauthDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminOrderDao is the data access object for table hg_admin_order.
// AdminOrderDao is the data access object for the table hg_admin_order.
type AdminOrderDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminOrderColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminOrderColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminOrderColumns defines and stores column names for table hg_admin_order.
// AdminOrderColumns defines and stores column names for the table hg_admin_order.
type AdminOrderColumns struct {
Id string // 主键
MemberId string // 管理员id
@@ -34,7 +35,7 @@ type AdminOrderColumns struct {
UpdatedAt string // 修改时间
}
// adminOrderColumns holds the columns for table hg_admin_order.
// adminOrderColumns holds the columns for the table hg_admin_order.
var adminOrderColumns = AdminOrderColumns{
Id: "id",
MemberId: "member_id",
@@ -51,44 +52,49 @@ var adminOrderColumns = AdminOrderColumns{
}
// NewAdminOrderDao creates and returns a new DAO object for table data access.
func NewAdminOrderDao() *AdminOrderDao {
func NewAdminOrderDao(handlers ...gdb.ModelHandler) *AdminOrderDao {
return &AdminOrderDao{
group: "default",
table: "hg_admin_order",
columns: adminOrderColumns,
group: "default",
table: "hg_admin_order",
columns: adminOrderColumns,
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 *AdminOrderDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminOrderDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminOrderDao) Columns() AdminOrderColumns {
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 *AdminOrderDao) Group() string {
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 *AdminOrderDao) 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.
// 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.
//
// 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.
func (dao *AdminOrderDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminPostDao is the data access object for table hg_admin_post.
// AdminPostDao is the data access object for the table hg_admin_post.
type AdminPostDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminPostColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminPostColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminPostColumns defines and stores column names for table hg_admin_post.
// AdminPostColumns defines and stores column names for the table hg_admin_post.
type AdminPostColumns struct {
Id string // 岗位ID
Code string // 岗位编码
@@ -30,7 +31,7 @@ type AdminPostColumns struct {
UpdatedAt string // 更新时间
}
// adminPostColumns holds the columns for table hg_admin_post.
// adminPostColumns holds the columns for the table hg_admin_post.
var adminPostColumns = AdminPostColumns{
Id: "id",
Code: "code",
@@ -43,44 +44,49 @@ var adminPostColumns = AdminPostColumns{
}
// NewAdminPostDao creates and returns a new DAO object for table data access.
func NewAdminPostDao() *AdminPostDao {
func NewAdminPostDao(handlers ...gdb.ModelHandler) *AdminPostDao {
return &AdminPostDao{
group: "default",
table: "hg_admin_post",
columns: adminPostColumns,
group: "default",
table: "hg_admin_post",
columns: adminPostColumns,
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 *AdminPostDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminPostDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminPostDao) Columns() AdminPostColumns {
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 *AdminPostDao) Group() string {
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 *AdminPostDao) 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.
// 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.
//
// 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.
func (dao *AdminPostDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminRoleDao is the data access object for table hg_admin_role.
// AdminRoleDao is the data access object for the table hg_admin_role.
type AdminRoleDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminRoleColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminRoleColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminRoleColumns defines and stores column names for table hg_admin_role.
// AdminRoleColumns defines and stores column names for the table hg_admin_role.
type AdminRoleColumns struct {
Id string // 角色ID
Name string // 角色名称
@@ -35,7 +36,7 @@ type AdminRoleColumns struct {
UpdatedAt string // 更新时间
}
// adminRoleColumns holds the columns for table hg_admin_role.
// adminRoleColumns holds the columns for the table hg_admin_role.
var adminRoleColumns = AdminRoleColumns{
Id: "id",
Name: "name",
@@ -53,44 +54,49 @@ var adminRoleColumns = AdminRoleColumns{
}
// NewAdminRoleDao creates and returns a new DAO object for table data access.
func NewAdminRoleDao() *AdminRoleDao {
func NewAdminRoleDao(handlers ...gdb.ModelHandler) *AdminRoleDao {
return &AdminRoleDao{
group: "default",
table: "hg_admin_role",
columns: adminRoleColumns,
group: "default",
table: "hg_admin_role",
columns: adminRoleColumns,
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 *AdminRoleDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminRoleDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminRoleDao) Columns() AdminRoleColumns {
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 *AdminRoleDao) Group() string {
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 *AdminRoleDao) 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.
// 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.
//
// 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.
func (dao *AdminRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminRoleCasbinDao is the data access object for table hg_admin_role_casbin.
// AdminRoleCasbinDao is the data access object for the table hg_admin_role_casbin.
type AdminRoleCasbinDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminRoleCasbinColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminRoleCasbinColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminRoleCasbinColumns defines and stores column names for table hg_admin_role_casbin.
// AdminRoleCasbinColumns defines and stores column names for the table hg_admin_role_casbin.
type AdminRoleCasbinColumns struct {
Id string //
PType string //
@@ -30,7 +31,7 @@ type AdminRoleCasbinColumns struct {
V5 string //
}
// adminRoleCasbinColumns holds the columns for table hg_admin_role_casbin.
// adminRoleCasbinColumns holds the columns for the table hg_admin_role_casbin.
var adminRoleCasbinColumns = AdminRoleCasbinColumns{
Id: "id",
PType: "p_type",
@@ -43,44 +44,49 @@ var adminRoleCasbinColumns = AdminRoleCasbinColumns{
}
// NewAdminRoleCasbinDao creates and returns a new DAO object for table data access.
func NewAdminRoleCasbinDao() *AdminRoleCasbinDao {
func NewAdminRoleCasbinDao(handlers ...gdb.ModelHandler) *AdminRoleCasbinDao {
return &AdminRoleCasbinDao{
group: "default",
table: "hg_admin_role_casbin",
columns: adminRoleCasbinColumns,
group: "default",
table: "hg_admin_role_casbin",
columns: adminRoleCasbinColumns,
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 *AdminRoleCasbinDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminRoleCasbinDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminRoleCasbinDao) Columns() AdminRoleCasbinColumns {
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 *AdminRoleCasbinDao) Group() string {
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 *AdminRoleCasbinDao) 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.
// 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.
//
// 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.
func (dao *AdminRoleCasbinDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,64 +11,70 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// AdminRoleMenuDao is the data access object for table hg_admin_role_menu.
// AdminRoleMenuDao is the data access object for the table hg_admin_role_menu.
type AdminRoleMenuDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns AdminRoleMenuColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminRoleMenuColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminRoleMenuColumns defines and stores column names for table hg_admin_role_menu.
// AdminRoleMenuColumns defines and stores column names for the table hg_admin_role_menu.
type AdminRoleMenuColumns struct {
RoleId string // 角色ID
MenuId string // 菜单ID
}
// adminRoleMenuColumns holds the columns for table hg_admin_role_menu.
// adminRoleMenuColumns holds the columns for the table hg_admin_role_menu.
var adminRoleMenuColumns = AdminRoleMenuColumns{
RoleId: "role_id",
MenuId: "menu_id",
}
// NewAdminRoleMenuDao creates and returns a new DAO object for table data access.
func NewAdminRoleMenuDao() *AdminRoleMenuDao {
func NewAdminRoleMenuDao(handlers ...gdb.ModelHandler) *AdminRoleMenuDao {
return &AdminRoleMenuDao{
group: "default",
table: "hg_admin_role_menu",
columns: adminRoleMenuColumns,
group: "default",
table: "hg_admin_role_menu",
columns: adminRoleMenuColumns,
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 *AdminRoleMenuDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *AdminRoleMenuDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *AdminRoleMenuDao) Columns() AdminRoleMenuColumns {
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 *AdminRoleMenuDao) Group() string {
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 *AdminRoleMenuDao) 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.
// 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.
//
// 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.
func (dao *AdminRoleMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// PayLogDao is the data access object for table hg_pay_log.
// PayLogDao is the data access object for the table hg_pay_log.
type PayLogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns PayLogColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns PayLogColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// PayLogColumns defines and stores column names for table hg_pay_log.
// PayLogColumns defines and stores column names for the table hg_pay_log.
type PayLogColumns struct {
Id string // 主键
MemberId string // 会员ID
@@ -52,7 +53,7 @@ type PayLogColumns struct {
UpdatedAt string // 修改时间
}
// payLogColumns holds the columns for table hg_pay_log.
// payLogColumns holds the columns for the table hg_pay_log.
var payLogColumns = PayLogColumns{
Id: "id",
MemberId: "member_id",
@@ -87,44 +88,49 @@ var payLogColumns = PayLogColumns{
}
// NewPayLogDao creates and returns a new DAO object for table data access.
func NewPayLogDao() *PayLogDao {
func NewPayLogDao(handlers ...gdb.ModelHandler) *PayLogDao {
return &PayLogDao{
group: "default",
table: "hg_pay_log",
columns: payLogColumns,
group: "default",
table: "hg_pay_log",
columns: payLogColumns,
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 *PayLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *PayLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *PayLogDao) Columns() PayLogColumns {
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 *PayLogDao) Group() string {
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 *PayLogDao) 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.
// 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.
//
// 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.
func (dao *PayLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// PayRefundDao is the data access object for table hg_pay_refund.
// PayRefundDao is the data access object for the table hg_pay_refund.
type PayRefundDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns PayRefundColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns PayRefundColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// PayRefundColumns defines and stores column names for table hg_pay_refund.
// PayRefundColumns defines and stores column names for the table hg_pay_refund.
type PayRefundColumns struct {
Id string // 主键ID
MemberId string // 会员ID
@@ -35,7 +36,7 @@ type PayRefundColumns struct {
UpdatedAt string // 更新时间
}
// payRefundColumns holds the columns for table hg_pay_refund.
// payRefundColumns holds the columns for the table hg_pay_refund.
var payRefundColumns = PayRefundColumns{
Id: "id",
MemberId: "member_id",
@@ -53,44 +54,49 @@ var payRefundColumns = PayRefundColumns{
}
// NewPayRefundDao creates and returns a new DAO object for table data access.
func NewPayRefundDao() *PayRefundDao {
func NewPayRefundDao(handlers ...gdb.ModelHandler) *PayRefundDao {
return &PayRefundDao{
group: "default",
table: "hg_pay_refund",
columns: payRefundColumns,
group: "default",
table: "hg_pay_refund",
columns: payRefundColumns,
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 *PayRefundDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *PayRefundDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *PayRefundDao) Columns() PayRefundColumns {
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 *PayRefundDao) Group() string {
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 *PayRefundDao) 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.
// 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.
//
// 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.
func (dao *PayRefundDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysAddonsConfigDao is the data access object for table hg_sys_addons_config.
// SysAddonsConfigDao is the data access object for the table hg_sys_addons_config.
type SysAddonsConfigDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysAddonsConfigColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysAddonsConfigColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysAddonsConfigColumns defines and stores column names for table hg_sys_addons_config.
// SysAddonsConfigColumns defines and stores column names for the table hg_sys_addons_config.
type SysAddonsConfigColumns struct {
Id string // 配置ID
AddonName string // 插件名称
@@ -36,7 +37,7 @@ type SysAddonsConfigColumns struct {
UpdatedAt string // 更新时间
}
// sysAddonsConfigColumns holds the columns for table hg_sys_addons_config.
// sysAddonsConfigColumns holds the columns for the table hg_sys_addons_config.
var sysAddonsConfigColumns = SysAddonsConfigColumns{
Id: "id",
AddonName: "addon_name",
@@ -55,44 +56,49 @@ var sysAddonsConfigColumns = SysAddonsConfigColumns{
}
// NewSysAddonsConfigDao creates and returns a new DAO object for table data access.
func NewSysAddonsConfigDao() *SysAddonsConfigDao {
func NewSysAddonsConfigDao(handlers ...gdb.ModelHandler) *SysAddonsConfigDao {
return &SysAddonsConfigDao{
group: "default",
table: "hg_sys_addons_config",
columns: sysAddonsConfigColumns,
group: "default",
table: "hg_sys_addons_config",
columns: sysAddonsConfigColumns,
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 *SysAddonsConfigDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysAddonsConfigDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysAddonsConfigDao) Columns() SysAddonsConfigColumns {
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 *SysAddonsConfigDao) Group() string {
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 *SysAddonsConfigDao) 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.
// 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.
//
// 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.
func (dao *SysAddonsConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -0,0 +1,89 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// SysAddonsInstallDao is the data access object for the table hg_sys_addons_install.
type SysAddonsInstallDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysAddonsInstallColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysAddonsInstallColumns defines and stores column names for the table hg_sys_addons_install.
type SysAddonsInstallColumns struct {
Id string // 主键
Name string // 插件名称
Version string // 版本号
Status string // 状态
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
}
// sysAddonsInstallColumns holds the columns for the table hg_sys_addons_install.
var sysAddonsInstallColumns = SysAddonsInstallColumns{
Id: "id",
Name: "name",
Version: "version",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
}
// NewSysAddonsInstallDao creates and returns a new DAO object for table data access.
func NewSysAddonsInstallDao(handlers ...gdb.ModelHandler) *SysAddonsInstallDao {
return &SysAddonsInstallDao{
group: "default",
table: "hg_sys_addons_install",
columns: sysAddonsInstallColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *SysAddonsInstallDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *SysAddonsInstallDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *SysAddonsInstallDao) Columns() SysAddonsInstallColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *SysAddonsInstallDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *SysAddonsInstallDao) Ctx(ctx context.Context) *gdb.Model {
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.
// 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.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *SysAddonsInstallDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysAttachmentDao is the data access object for table hg_sys_attachment.
// SysAttachmentDao is the data access object for the table hg_sys_attachment.
type SysAttachmentDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysAttachmentColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysAttachmentColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysAttachmentColumns defines and stores column names for table hg_sys_attachment.
// SysAttachmentColumns defines and stores column names for the table hg_sys_attachment.
type SysAttachmentColumns struct {
Id string // 文件ID
AppId string // 应用ID
@@ -39,7 +40,7 @@ type SysAttachmentColumns struct {
UpdatedAt string // 修改时间
}
// sysAttachmentColumns holds the columns for table hg_sys_attachment.
// sysAttachmentColumns holds the columns for the table hg_sys_attachment.
var sysAttachmentColumns = SysAttachmentColumns{
Id: "id",
AppId: "app_id",
@@ -61,44 +62,49 @@ var sysAttachmentColumns = SysAttachmentColumns{
}
// NewSysAttachmentDao creates and returns a new DAO object for table data access.
func NewSysAttachmentDao() *SysAttachmentDao {
func NewSysAttachmentDao(handlers ...gdb.ModelHandler) *SysAttachmentDao {
return &SysAttachmentDao{
group: "default",
table: "hg_sys_attachment",
columns: sysAttachmentColumns,
group: "default",
table: "hg_sys_attachment",
columns: sysAttachmentColumns,
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 *SysAttachmentDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysAttachmentDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysAttachmentDao) Columns() SysAttachmentColumns {
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 *SysAttachmentDao) Group() string {
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 *SysAttachmentDao) 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.
// 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.
//
// 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.
func (dao *SysAttachmentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysBlacklistDao is the data access object for table hg_sys_blacklist.
// SysBlacklistDao is the data access object for the table hg_sys_blacklist.
type SysBlacklistDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysBlacklistColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysBlacklistColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysBlacklistColumns defines and stores column names for table hg_sys_blacklist.
// SysBlacklistColumns defines and stores column names for the table hg_sys_blacklist.
type SysBlacklistColumns struct {
Id string // 黑名单ID
Ip string // IP地址
@@ -28,7 +29,7 @@ type SysBlacklistColumns struct {
UpdatedAt string // 更新时间
}
// sysBlacklistColumns holds the columns for table hg_sys_blacklist.
// sysBlacklistColumns holds the columns for the table hg_sys_blacklist.
var sysBlacklistColumns = SysBlacklistColumns{
Id: "id",
Ip: "ip",
@@ -39,44 +40,49 @@ var sysBlacklistColumns = SysBlacklistColumns{
}
// NewSysBlacklistDao creates and returns a new DAO object for table data access.
func NewSysBlacklistDao() *SysBlacklistDao {
func NewSysBlacklistDao(handlers ...gdb.ModelHandler) *SysBlacklistDao {
return &SysBlacklistDao{
group: "default",
table: "hg_sys_blacklist",
columns: sysBlacklistColumns,
group: "default",
table: "hg_sys_blacklist",
columns: sysBlacklistColumns,
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 *SysBlacklistDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysBlacklistDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysBlacklistDao) Columns() SysBlacklistColumns {
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 *SysBlacklistDao) Group() string {
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 *SysBlacklistDao) 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.
// 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.
//
// 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.
func (dao *SysBlacklistDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysConfigDao is the data access object for table hg_sys_config.
// SysConfigDao is the data access object for the table hg_sys_config.
type SysConfigDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysConfigColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysConfigColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysConfigColumns defines and stores column names for table hg_sys_config.
// SysConfigColumns defines and stores column names for the table hg_sys_config.
type SysConfigColumns struct {
Id string // 配置ID
Group string // 配置分组
@@ -35,7 +36,7 @@ type SysConfigColumns struct {
UpdatedAt string // 更新时间
}
// sysConfigColumns holds the columns for table hg_sys_config.
// sysConfigColumns holds the columns for the table hg_sys_config.
var sysConfigColumns = SysConfigColumns{
Id: "id",
Group: "group",
@@ -53,44 +54,49 @@ var sysConfigColumns = SysConfigColumns{
}
// NewSysConfigDao creates and returns a new DAO object for table data access.
func NewSysConfigDao() *SysConfigDao {
func NewSysConfigDao(handlers ...gdb.ModelHandler) *SysConfigDao {
return &SysConfigDao{
group: "default",
table: "hg_sys_config",
columns: sysConfigColumns,
group: "default",
table: "hg_sys_config",
columns: sysConfigColumns,
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 *SysConfigDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysConfigDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysConfigDao) Columns() SysConfigColumns {
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 *SysConfigDao) Group() string {
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 *SysConfigDao) 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.
// 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.
//
// 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.
func (dao *SysConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysCronDao is the data access object for table hg_sys_cron.
// SysCronDao is the data access object for the table hg_sys_cron.
type SysCronDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysCronColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysCronColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysCronColumns defines and stores column names for table hg_sys_cron.
// SysCronColumns defines and stores column names for the table hg_sys_cron.
type SysCronColumns struct {
Id string // 任务ID
GroupId string // 分组ID
@@ -35,7 +36,7 @@ type SysCronColumns struct {
UpdatedAt string // 更新时间
}
// sysCronColumns holds the columns for table hg_sys_cron.
// sysCronColumns holds the columns for the table hg_sys_cron.
var sysCronColumns = SysCronColumns{
Id: "id",
GroupId: "group_id",
@@ -53,44 +54,49 @@ var sysCronColumns = SysCronColumns{
}
// NewSysCronDao creates and returns a new DAO object for table data access.
func NewSysCronDao() *SysCronDao {
func NewSysCronDao(handlers ...gdb.ModelHandler) *SysCronDao {
return &SysCronDao{
group: "default",
table: "hg_sys_cron",
columns: sysCronColumns,
group: "default",
table: "hg_sys_cron",
columns: sysCronColumns,
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 *SysCronDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysCronDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysCronDao) Columns() SysCronColumns {
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 *SysCronDao) Group() string {
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 *SysCronDao) 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.
// 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.
//
// 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.
func (dao *SysCronDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysCronGroupDao is the data access object for table hg_sys_cron_group.
// SysCronGroupDao is the data access object for the table hg_sys_cron_group.
type SysCronGroupDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysCronGroupColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysCronGroupColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysCronGroupColumns defines and stores column names for table hg_sys_cron_group.
// SysCronGroupColumns defines and stores column names for the table hg_sys_cron_group.
type SysCronGroupColumns struct {
Id string // 任务分组ID
Pid string // 父类任务分组ID
@@ -31,7 +32,7 @@ type SysCronGroupColumns struct {
UpdatedAt string // 更新时间
}
// sysCronGroupColumns holds the columns for table hg_sys_cron_group.
// sysCronGroupColumns holds the columns for the table hg_sys_cron_group.
var sysCronGroupColumns = SysCronGroupColumns{
Id: "id",
Pid: "pid",
@@ -45,44 +46,49 @@ var sysCronGroupColumns = SysCronGroupColumns{
}
// NewSysCronGroupDao creates and returns a new DAO object for table data access.
func NewSysCronGroupDao() *SysCronGroupDao {
func NewSysCronGroupDao(handlers ...gdb.ModelHandler) *SysCronGroupDao {
return &SysCronGroupDao{
group: "default",
table: "hg_sys_cron_group",
columns: sysCronGroupColumns,
group: "default",
table: "hg_sys_cron_group",
columns: sysCronGroupColumns,
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 *SysCronGroupDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysCronGroupDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysCronGroupDao) Columns() SysCronGroupColumns {
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 *SysCronGroupDao) Group() string {
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 *SysCronGroupDao) 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.
// 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.
//
// 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.
func (dao *SysCronGroupDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysDictDataDao is the data access object for table hg_sys_dict_data.
// SysDictDataDao is the data access object for the table hg_sys_dict_data.
type SysDictDataDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysDictDataColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysDictDataColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysDictDataColumns defines and stores column names for table hg_sys_dict_data.
// SysDictDataColumns defines and stores column names for the table hg_sys_dict_data.
type SysDictDataColumns struct {
Id string // 字典数据ID
Label string // 字典标签
@@ -34,7 +35,7 @@ type SysDictDataColumns struct {
UpdatedAt string // 更新时间
}
// sysDictDataColumns holds the columns for table hg_sys_dict_data.
// sysDictDataColumns holds the columns for the table hg_sys_dict_data.
var sysDictDataColumns = SysDictDataColumns{
Id: "id",
Label: "label",
@@ -51,44 +52,49 @@ var sysDictDataColumns = SysDictDataColumns{
}
// NewSysDictDataDao creates and returns a new DAO object for table data access.
func NewSysDictDataDao() *SysDictDataDao {
func NewSysDictDataDao(handlers ...gdb.ModelHandler) *SysDictDataDao {
return &SysDictDataDao{
group: "default",
table: "hg_sys_dict_data",
columns: sysDictDataColumns,
group: "default",
table: "hg_sys_dict_data",
columns: sysDictDataColumns,
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 *SysDictDataDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysDictDataDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysDictDataDao) Columns() SysDictDataColumns {
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 *SysDictDataDao) Group() string {
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 *SysDictDataDao) 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.
// 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.
//
// 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.
func (dao *SysDictDataDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysDictTypeDao is the data access object for table hg_sys_dict_type.
// SysDictTypeDao is the data access object for the table hg_sys_dict_type.
type SysDictTypeDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysDictTypeColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysDictTypeColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysDictTypeColumns defines and stores column names for table hg_sys_dict_type.
// SysDictTypeColumns defines and stores column names for the table hg_sys_dict_type.
type SysDictTypeColumns struct {
Id string // 字典类型ID
Pid string // 父类字典类型ID
@@ -31,7 +32,7 @@ type SysDictTypeColumns struct {
UpdatedAt string // 更新时间
}
// sysDictTypeColumns holds the columns for table hg_sys_dict_type.
// sysDictTypeColumns holds the columns for the table hg_sys_dict_type.
var sysDictTypeColumns = SysDictTypeColumns{
Id: "id",
Pid: "pid",
@@ -45,44 +46,49 @@ var sysDictTypeColumns = SysDictTypeColumns{
}
// NewSysDictTypeDao creates and returns a new DAO object for table data access.
func NewSysDictTypeDao() *SysDictTypeDao {
func NewSysDictTypeDao(handlers ...gdb.ModelHandler) *SysDictTypeDao {
return &SysDictTypeDao{
group: "default",
table: "hg_sys_dict_type",
columns: sysDictTypeColumns,
group: "default",
table: "hg_sys_dict_type",
columns: sysDictTypeColumns,
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 *SysDictTypeDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysDictTypeDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysDictTypeDao) Columns() SysDictTypeColumns {
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 *SysDictTypeDao) Group() string {
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 *SysDictTypeDao) 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.
// 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.
//
// 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.
func (dao *SysDictTypeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysEmsLogDao is the data access object for table hg_sys_ems_log.
// SysEmsLogDao is the data access object for the table hg_sys_ems_log.
type SysEmsLogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysEmsLogColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysEmsLogColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysEmsLogColumns defines and stores column names for table hg_sys_ems_log.
// SysEmsLogColumns defines and stores column names for the table hg_sys_ems_log.
type SysEmsLogColumns struct {
Id string // 主键
Event string // 事件
@@ -32,7 +33,7 @@ type SysEmsLogColumns struct {
UpdatedAt string // 更新时间
}
// sysEmsLogColumns holds the columns for table hg_sys_ems_log.
// sysEmsLogColumns holds the columns for the table hg_sys_ems_log.
var sysEmsLogColumns = SysEmsLogColumns{
Id: "id",
Event: "event",
@@ -47,44 +48,49 @@ var sysEmsLogColumns = SysEmsLogColumns{
}
// NewSysEmsLogDao creates and returns a new DAO object for table data access.
func NewSysEmsLogDao() *SysEmsLogDao {
func NewSysEmsLogDao(handlers ...gdb.ModelHandler) *SysEmsLogDao {
return &SysEmsLogDao{
group: "default",
table: "hg_sys_ems_log",
columns: sysEmsLogColumns,
group: "default",
table: "hg_sys_ems_log",
columns: sysEmsLogColumns,
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 *SysEmsLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysEmsLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysEmsLogDao) Columns() SysEmsLogColumns {
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 *SysEmsLogDao) Group() string {
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 *SysEmsLogDao) 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.
// 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.
//
// 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.
func (dao *SysEmsLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysGenCodesDao is the data access object for table hg_sys_gen_codes.
// SysGenCodesDao is the data access object for the table hg_sys_gen_codes.
type SysGenCodesDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysGenCodesColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysGenCodesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysGenCodesColumns defines and stores column names for table hg_sys_gen_codes.
// SysGenCodesColumns defines and stores column names for the table hg_sys_gen_codes.
type SysGenCodesColumns struct {
Id string // 生成ID
GenType string // 生成类型
@@ -36,7 +37,7 @@ type SysGenCodesColumns struct {
UpdatedAt string // 更新时间
}
// sysGenCodesColumns holds the columns for table hg_sys_gen_codes.
// sysGenCodesColumns holds the columns for the table hg_sys_gen_codes.
var sysGenCodesColumns = SysGenCodesColumns{
Id: "id",
GenType: "gen_type",
@@ -55,44 +56,49 @@ var sysGenCodesColumns = SysGenCodesColumns{
}
// NewSysGenCodesDao creates and returns a new DAO object for table data access.
func NewSysGenCodesDao() *SysGenCodesDao {
func NewSysGenCodesDao(handlers ...gdb.ModelHandler) *SysGenCodesDao {
return &SysGenCodesDao{
group: "default",
table: "hg_sys_gen_codes",
columns: sysGenCodesColumns,
group: "default",
table: "hg_sys_gen_codes",
columns: sysGenCodesColumns,
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 *SysGenCodesDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysGenCodesDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysGenCodesDao) Columns() SysGenCodesColumns {
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 *SysGenCodesDao) Group() string {
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 *SysGenCodesDao) 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.
// 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.
//
// 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.
func (dao *SysGenCodesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysGenCurdDemoDao is the data access object for table hg_sys_gen_curd_demo.
// SysGenCurdDemoDao is the data access object for the table hg_sys_gen_curd_demo.
type SysGenCurdDemoDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysGenCurdDemoColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysGenCurdDemoColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysGenCurdDemoColumns defines and stores column names for table hg_sys_gen_curd_demo.
// SysGenCurdDemoColumns defines and stores column names for the table hg_sys_gen_curd_demo.
type SysGenCurdDemoColumns struct {
Id string // ID
CategoryId string // 分类ID
@@ -39,7 +40,7 @@ type SysGenCurdDemoColumns struct {
DeletedAt string // 删除时间
}
// sysGenCurdDemoColumns holds the columns for table hg_sys_gen_curd_demo.
// sysGenCurdDemoColumns holds the columns for the table hg_sys_gen_curd_demo.
var sysGenCurdDemoColumns = SysGenCurdDemoColumns{
Id: "id",
CategoryId: "category_id",
@@ -61,44 +62,49 @@ var sysGenCurdDemoColumns = SysGenCurdDemoColumns{
}
// NewSysGenCurdDemoDao creates and returns a new DAO object for table data access.
func NewSysGenCurdDemoDao() *SysGenCurdDemoDao {
func NewSysGenCurdDemoDao(handlers ...gdb.ModelHandler) *SysGenCurdDemoDao {
return &SysGenCurdDemoDao{
group: "default",
table: "hg_sys_gen_curd_demo",
columns: sysGenCurdDemoColumns,
group: "default",
table: "hg_sys_gen_curd_demo",
columns: sysGenCurdDemoColumns,
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 *SysGenCurdDemoDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysGenCurdDemoDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysGenCurdDemoDao) Columns() SysGenCurdDemoColumns {
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 *SysGenCurdDemoDao) Group() string {
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 *SysGenCurdDemoDao) 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.
// 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.
//
// 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.
func (dao *SysGenCurdDemoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysGenTreeDemoDao is the data access object for table hg_sys_gen_tree_demo.
// SysGenTreeDemoDao is the data access object for the table hg_sys_gen_tree_demo.
type SysGenTreeDemoDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysGenTreeDemoColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysGenTreeDemoColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysGenTreeDemoColumns defines and stores column names for table hg_sys_gen_tree_demo.
// SysGenTreeDemoColumns defines and stores column names for the table hg_sys_gen_tree_demo.
type SysGenTreeDemoColumns struct {
Id string // ID
Pid string // 上级ID
@@ -36,7 +37,7 @@ type SysGenTreeDemoColumns struct {
DeletedAt string // 删除时间
}
// sysGenTreeDemoColumns holds the columns for table hg_sys_gen_tree_demo.
// sysGenTreeDemoColumns holds the columns for the table hg_sys_gen_tree_demo.
var sysGenTreeDemoColumns = SysGenTreeDemoColumns{
Id: "id",
Pid: "pid",
@@ -55,44 +56,49 @@ var sysGenTreeDemoColumns = SysGenTreeDemoColumns{
}
// NewSysGenTreeDemoDao creates and returns a new DAO object for table data access.
func NewSysGenTreeDemoDao() *SysGenTreeDemoDao {
func NewSysGenTreeDemoDao(handlers ...gdb.ModelHandler) *SysGenTreeDemoDao {
return &SysGenTreeDemoDao{
group: "default",
table: "hg_sys_gen_tree_demo",
columns: sysGenTreeDemoColumns,
group: "default",
table: "hg_sys_gen_tree_demo",
columns: sysGenTreeDemoColumns,
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 *SysGenTreeDemoDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysGenTreeDemoDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysGenTreeDemoDao) Columns() SysGenTreeDemoColumns {
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 *SysGenTreeDemoDao) Group() string {
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 *SysGenTreeDemoDao) 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.
// 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.
//
// 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.
func (dao *SysGenTreeDemoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysLogDao is the data access object for table hg_sys_log.
// SysLogDao is the data access object for the table hg_sys_log.
type SysLogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysLogColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysLogColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysLogColumns defines and stores column names for table hg_sys_log.
// SysLogColumns defines and stores column names for the table hg_sys_log.
type SysLogColumns struct {
Id string // 日志ID
ReqId string // 对外ID
@@ -45,7 +46,7 @@ type SysLogColumns struct {
UpdatedAt string // 修改时间
}
// sysLogColumns holds the columns for table hg_sys_log.
// sysLogColumns holds the columns for the table hg_sys_log.
var sysLogColumns = SysLogColumns{
Id: "id",
ReqId: "req_id",
@@ -73,44 +74,49 @@ var sysLogColumns = SysLogColumns{
}
// NewSysLogDao creates and returns a new DAO object for table data access.
func NewSysLogDao() *SysLogDao {
func NewSysLogDao(handlers ...gdb.ModelHandler) *SysLogDao {
return &SysLogDao{
group: "default",
table: "hg_sys_log",
columns: sysLogColumns,
group: "default",
table: "hg_sys_log",
columns: sysLogColumns,
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 *SysLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysLogDao) Columns() SysLogColumns {
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 *SysLogDao) Group() string {
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 *SysLogDao) 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.
// 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.
//
// 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.
func (dao *SysLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysLoginLogDao is the data access object for table hg_sys_login_log.
// SysLoginLogDao is the data access object for the table hg_sys_login_log.
type SysLoginLogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysLoginLogColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysLoginLogColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysLoginLogColumns defines and stores column names for table hg_sys_login_log.
// SysLoginLogColumns defines and stores column names for the table hg_sys_login_log.
type SysLoginLogColumns struct {
Id string // 日志ID
ReqId string // 请求ID
@@ -36,7 +37,7 @@ type SysLoginLogColumns struct {
UpdatedAt string // 修改时间
}
// sysLoginLogColumns holds the columns for table hg_sys_login_log.
// sysLoginLogColumns holds the columns for the table hg_sys_login_log.
var sysLoginLogColumns = SysLoginLogColumns{
Id: "id",
ReqId: "req_id",
@@ -55,44 +56,49 @@ var sysLoginLogColumns = SysLoginLogColumns{
}
// NewSysLoginLogDao creates and returns a new DAO object for table data access.
func NewSysLoginLogDao() *SysLoginLogDao {
func NewSysLoginLogDao(handlers ...gdb.ModelHandler) *SysLoginLogDao {
return &SysLoginLogDao{
group: "default",
table: "hg_sys_login_log",
columns: sysLoginLogColumns,
group: "default",
table: "hg_sys_login_log",
columns: sysLoginLogColumns,
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 *SysLoginLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysLoginLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysLoginLogDao) Columns() SysLoginLogColumns {
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 *SysLoginLogDao) Group() string {
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 *SysLoginLogDao) 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.
// 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.
//
// 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.
func (dao *SysLoginLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysProvincesDao is the data access object for table hg_sys_provinces.
// SysProvincesDao is the data access object for the table hg_sys_provinces.
type SysProvincesDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysProvincesColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysProvincesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysProvincesColumns defines and stores column names for table hg_sys_provinces.
// SysProvincesColumns defines and stores column names for the table hg_sys_provinces.
type SysProvincesColumns struct {
Id string // 省市区ID
Title string // 栏目名称
@@ -34,7 +35,7 @@ type SysProvincesColumns struct {
UpdatedAt string // 更新时间
}
// sysProvincesColumns holds the columns for table hg_sys_provinces.
// sysProvincesColumns holds the columns for the table hg_sys_provinces.
var sysProvincesColumns = SysProvincesColumns{
Id: "id",
Title: "title",
@@ -51,44 +52,49 @@ var sysProvincesColumns = SysProvincesColumns{
}
// NewSysProvincesDao creates and returns a new DAO object for table data access.
func NewSysProvincesDao() *SysProvincesDao {
func NewSysProvincesDao(handlers ...gdb.ModelHandler) *SysProvincesDao {
return &SysProvincesDao{
group: "default",
table: "hg_sys_provinces",
columns: sysProvincesColumns,
group: "default",
table: "hg_sys_provinces",
columns: sysProvincesColumns,
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 *SysProvincesDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysProvincesDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysProvincesDao) Columns() SysProvincesColumns {
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 *SysProvincesDao) Group() string {
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 *SysProvincesDao) 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.
// 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.
//
// 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.
func (dao *SysProvincesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysServeLicenseDao is the data access object for table hg_sys_serve_license.
// SysServeLicenseDao is the data access object for the table hg_sys_serve_license.
type SysServeLicenseDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysServeLicenseColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysServeLicenseColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysServeLicenseColumns defines and stores column names for table hg_sys_serve_license.
// SysServeLicenseColumns defines and stores column names for the table hg_sys_serve_license.
type SysServeLicenseColumns struct {
Id string // 许可ID
Group string // 分组
@@ -39,7 +40,7 @@ type SysServeLicenseColumns struct {
UpdatedAt string // 修改时间
}
// sysServeLicenseColumns holds the columns for table hg_sys_serve_license.
// sysServeLicenseColumns holds the columns for the table hg_sys_serve_license.
var sysServeLicenseColumns = SysServeLicenseColumns{
Id: "id",
Group: "group",
@@ -61,44 +62,49 @@ var sysServeLicenseColumns = SysServeLicenseColumns{
}
// NewSysServeLicenseDao creates and returns a new DAO object for table data access.
func NewSysServeLicenseDao() *SysServeLicenseDao {
func NewSysServeLicenseDao(handlers ...gdb.ModelHandler) *SysServeLicenseDao {
return &SysServeLicenseDao{
group: "default",
table: "hg_sys_serve_license",
columns: sysServeLicenseColumns,
group: "default",
table: "hg_sys_serve_license",
columns: sysServeLicenseColumns,
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 *SysServeLicenseDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysServeLicenseDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysServeLicenseDao) Columns() SysServeLicenseColumns {
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 *SysServeLicenseDao) Group() string {
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 *SysServeLicenseDao) 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.
// 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.
//
// 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.
func (dao *SysServeLicenseDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysServeLogDao is the data access object for table hg_sys_serve_log.
// SysServeLogDao is the data access object for the table hg_sys_serve_log.
type SysServeLogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysServeLogColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysServeLogColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysServeLogColumns defines and stores column names for table hg_sys_serve_log.
// SysServeLogColumns defines and stores column names for the table hg_sys_serve_log.
type SysServeLogColumns struct {
Id string // 日志ID
TraceId string // 链路ID
@@ -32,7 +33,7 @@ type SysServeLogColumns struct {
UpdatedAt string // 修改时间
}
// sysServeLogColumns holds the columns for table hg_sys_serve_log.
// sysServeLogColumns holds the columns for the table hg_sys_serve_log.
var sysServeLogColumns = SysServeLogColumns{
Id: "id",
TraceId: "trace_id",
@@ -47,44 +48,49 @@ var sysServeLogColumns = SysServeLogColumns{
}
// NewSysServeLogDao creates and returns a new DAO object for table data access.
func NewSysServeLogDao() *SysServeLogDao {
func NewSysServeLogDao(handlers ...gdb.ModelHandler) *SysServeLogDao {
return &SysServeLogDao{
group: "default",
table: "hg_sys_serve_log",
columns: sysServeLogColumns,
group: "default",
table: "hg_sys_serve_log",
columns: sysServeLogColumns,
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 *SysServeLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysServeLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysServeLogDao) Columns() SysServeLogColumns {
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 *SysServeLogDao) Group() string {
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 *SysServeLogDao) 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.
// 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.
//
// 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.
func (dao *SysServeLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// SysSmsLogDao is the data access object for table hg_sys_sms_log.
// SysSmsLogDao is the data access object for the table hg_sys_sms_log.
type SysSmsLogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns SysSmsLogColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SysSmsLogColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SysSmsLogColumns defines and stores column names for table hg_sys_sms_log.
// SysSmsLogColumns defines and stores column names for the table hg_sys_sms_log.
type SysSmsLogColumns struct {
Id string // 主键
Event string // 事件
@@ -31,7 +32,7 @@ type SysSmsLogColumns struct {
UpdatedAt string // 更新时间
}
// sysSmsLogColumns holds the columns for table hg_sys_sms_log.
// sysSmsLogColumns holds the columns for the table hg_sys_sms_log.
var sysSmsLogColumns = SysSmsLogColumns{
Id: "id",
Event: "event",
@@ -45,44 +46,49 @@ var sysSmsLogColumns = SysSmsLogColumns{
}
// NewSysSmsLogDao creates and returns a new DAO object for table data access.
func NewSysSmsLogDao() *SysSmsLogDao {
func NewSysSmsLogDao(handlers ...gdb.ModelHandler) *SysSmsLogDao {
return &SysSmsLogDao{
group: "default",
table: "hg_sys_sms_log",
columns: sysSmsLogColumns,
group: "default",
table: "hg_sys_sms_log",
columns: sysSmsLogColumns,
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 *SysSmsLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *SysSmsLogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *SysSmsLogDao) Columns() SysSmsLogColumns {
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 *SysSmsLogDao) Group() string {
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 *SysSmsLogDao) 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.
// 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.
//
// 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.
func (dao *SysSmsLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -11,14 +11,15 @@ import (
"github.com/gogf/gf/v2/frame/g"
)
// TestCategoryDao is the data access object for table hg_test_category.
// TestCategoryDao is the data access object for the table hg_test_category.
type TestCategoryDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns TestCategoryColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns TestCategoryColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// TestCategoryColumns defines and stores column names for table hg_test_category.
// TestCategoryColumns defines and stores column names for the table hg_test_category.
type TestCategoryColumns struct {
Id string // 分类ID
Name string // 分类名称
@@ -32,7 +33,7 @@ type TestCategoryColumns struct {
DeletedAt string // 删除时间
}
// testCategoryColumns holds the columns for table hg_test_category.
// testCategoryColumns holds the columns for the table hg_test_category.
var testCategoryColumns = TestCategoryColumns{
Id: "id",
Name: "name",
@@ -47,44 +48,49 @@ var testCategoryColumns = TestCategoryColumns{
}
// NewTestCategoryDao creates and returns a new DAO object for table data access.
func NewTestCategoryDao() *TestCategoryDao {
func NewTestCategoryDao(handlers ...gdb.ModelHandler) *TestCategoryDao {
return &TestCategoryDao{
group: "default",
table: "hg_test_category",
columns: testCategoryColumns,
group: "default",
table: "hg_test_category",
columns: testCategoryColumns,
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 *TestCategoryDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
// Table returns the table name of the current DAO.
func (dao *TestCategoryDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
// Columns returns all column names of the current DAO.
func (dao *TestCategoryDao) Columns() TestCategoryColumns {
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 *TestCategoryDao) Group() string {
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 *TestCategoryDao) 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.
// 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.
//
// 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.
func (dao *TestCategoryDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)

View File

@@ -0,0 +1,22 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"hotgo/internal/dao/internal"
)
// sysAddonsInstallDao is the data access object for the table hg_sys_addons_install.
// You can define custom methods on it to extend its functionality as needed.
type sysAddonsInstallDao struct {
*internal.SysAddonsInstallDao
}
var (
// SysAddonsInstall is a globally accessible object for table hg_sys_addons_install operations.
SysAddonsInstall = sysAddonsInstallDao{internal.NewSysAddonsInstallDao()}
)
// Add your custom methods and functionality below.

View File

@@ -11,6 +11,7 @@ import (
"github.com/go-pay/crypto/xpem"
"github.com/go-pay/gopay"
"github.com/go-pay/gopay/wechat/v3"
"github.com/go-pay/smap"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/os/gtime"
@@ -142,16 +143,16 @@ func GetClient(config *model.PayConfig) (client *wechat.ClientV3, err error) {
if err != nil {
return
}
snPkMap := make(map[string]*rsa.PublicKey)
client.SnCertMap = smap.Map[string, *rsa.PublicKey]{}
for sn, cert := range snCertMap {
pubKey, err := xpem.DecodePublicKey([]byte(cert))
if err != nil {
return nil, err
}
snPkMap[sn] = pubKey
client.SnCertMap.Store(sn, pubKey)
}
client.SnCertMap = snPkMap
client.WxSerialNo = serialNo
// 打开Debug开关输出日志默认关闭
@@ -167,15 +168,14 @@ func getPublicKeyMap(client *wechat.ClientV3) (wxPublicKeyMap map[string]*rsa.Pu
return
}
snPkMap := make(map[string]*rsa.PublicKey)
client.SnCertMap = smap.Map[string, *rsa.PublicKey]{}
for sn, cert := range snCertMap {
pubKey, err := xpem.DecodePublicKey([]byte(cert))
if err != nil {
return nil, err
}
snPkMap[sn] = pubKey
client.SnCertMap.Store(sn, pubKey)
}
client.SnCertMap = snPkMap
client.WxSerialNo = serialNo
wxPublicKeyMap = client.WxPublicKeyMap()

View File

@@ -0,0 +1,21 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// SysAddonsInstall is the golang structure of table hg_sys_addons_install for DAO operations like Where/Data.
type SysAddonsInstall struct {
g.Meta `orm:"table:hg_sys_addons_install, do:true"`
Id interface{} // 主键
Name interface{} // 插件名称
Version interface{} // 版本号
Status interface{} // 状态
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
}

View File

@@ -0,0 +1,19 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// SysAddonsInstall is the golang structure for table sys_addons_install.
type SysAddonsInstall struct {
Id int64 `json:"id" orm:"id" description:"主键"`
Name string `json:"name" orm:"name" description:"插件名称"`
Version string `json:"version" orm:"version" description:"版本号"`
Status int `json:"status" orm:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"`
}