实现门店桌面设置相关配置
This commit is contained in:
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// AdminsDao is the data access object for the table admins.
|
||||
type AdminsDao 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 AdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 AdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// AdminsColumns defines and stores column names for the table admins.
|
||||
@ -50,12 +49,11 @@ var adminsColumns = AdminsColumns{
|
||||
}
|
||||
|
||||
// NewAdminsDao creates and returns a new DAO object for table data access.
|
||||
func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao {
|
||||
func NewAdminsDao() *AdminsDao {
|
||||
return &AdminsDao{
|
||||
group: "default",
|
||||
table: "admins",
|
||||
columns: adminsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "admins",
|
||||
columns: adminsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,11 +79,7 @@ func (dao *AdminsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *AdminsDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// FeedbacksDao is the data access object for the table feedbacks.
|
||||
type FeedbacksDao 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 FeedbacksColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 FeedbacksColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// FeedbacksColumns defines and stores column names for the table feedbacks.
|
||||
@ -52,12 +51,11 @@ var feedbacksColumns = FeedbacksColumns{
|
||||
}
|
||||
|
||||
// NewFeedbacksDao creates and returns a new DAO object for table data access.
|
||||
func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao {
|
||||
func NewFeedbacksDao() *FeedbacksDao {
|
||||
return &FeedbacksDao{
|
||||
group: "default",
|
||||
table: "feedbacks",
|
||||
columns: feedbacksColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "feedbacks",
|
||||
columns: feedbacksColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,11 +81,7 @@ func (dao *FeedbacksDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *FeedbacksDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// GamesDao is the data access object for the table games.
|
||||
type GamesDao 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 GamesColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 GamesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// GamesColumns defines and stores column names for the table games.
|
||||
@ -46,12 +45,11 @@ var gamesColumns = GamesColumns{
|
||||
}
|
||||
|
||||
// NewGamesDao creates and returns a new DAO object for table data access.
|
||||
func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao {
|
||||
func NewGamesDao() *GamesDao {
|
||||
return &GamesDao{
|
||||
group: "default",
|
||||
table: "games",
|
||||
columns: gamesColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "games",
|
||||
columns: gamesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,11 +75,7 @@ func (dao *GamesDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *GamesDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// MerchantAdminsDao is the data access object for the table merchant_admins.
|
||||
type MerchantAdminsDao 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 MerchantAdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 MerchantAdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// MerchantAdminsColumns defines and stores column names for the table merchant_admins.
|
||||
@ -58,12 +57,11 @@ var merchantAdminsColumns = MerchantAdminsColumns{
|
||||
}
|
||||
|
||||
// NewMerchantAdminsDao creates and returns a new DAO object for table data access.
|
||||
func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao {
|
||||
func NewMerchantAdminsDao() *MerchantAdminsDao {
|
||||
return &MerchantAdminsDao{
|
||||
group: "default",
|
||||
table: "merchant_admins",
|
||||
columns: merchantAdminsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "merchant_admins",
|
||||
columns: merchantAdminsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,11 +87,7 @@ func (dao *MerchantAdminsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *MerchantAdminsDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// MerchantsDao is the data access object for the table merchants.
|
||||
type MerchantsDao 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 MerchantsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 MerchantsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// MerchantsColumns defines and stores column names for the table merchants.
|
||||
@ -72,12 +71,11 @@ var merchantsColumns = MerchantsColumns{
|
||||
}
|
||||
|
||||
// NewMerchantsDao creates and returns a new DAO object for table data access.
|
||||
func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao {
|
||||
func NewMerchantsDao() *MerchantsDao {
|
||||
return &MerchantsDao{
|
||||
group: "default",
|
||||
table: "merchants",
|
||||
columns: merchantsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "merchants",
|
||||
columns: merchantsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,11 +101,7 @@ func (dao *MerchantsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *MerchantsDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// RewardTypesDao is the data access object for the table reward_types.
|
||||
type RewardTypesDao 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 RewardTypesColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 RewardTypesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// RewardTypesColumns defines and stores column names for the table reward_types.
|
||||
@ -46,12 +45,11 @@ var rewardTypesColumns = RewardTypesColumns{
|
||||
}
|
||||
|
||||
// NewRewardTypesDao creates and returns a new DAO object for table data access.
|
||||
func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao {
|
||||
func NewRewardTypesDao() *RewardTypesDao {
|
||||
return &RewardTypesDao{
|
||||
group: "default",
|
||||
table: "reward_types",
|
||||
columns: rewardTypesColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "reward_types",
|
||||
columns: rewardTypesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,11 +75,7 @@ func (dao *RewardTypesDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *RewardTypesDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// RewardsDao is the data access object for the table rewards.
|
||||
type RewardsDao 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 RewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 RewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// RewardsColumns defines and stores column names for the table rewards.
|
||||
@ -54,12 +53,11 @@ var rewardsColumns = RewardsColumns{
|
||||
}
|
||||
|
||||
// NewRewardsDao creates and returns a new DAO object for table data access.
|
||||
func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao {
|
||||
func NewRewardsDao() *RewardsDao {
|
||||
return &RewardsDao{
|
||||
group: "default",
|
||||
table: "rewards",
|
||||
columns: rewardsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "rewards",
|
||||
columns: rewardsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,11 +83,7 @@ func (dao *RewardsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *RewardsDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// RolesDao is the data access object for the table roles.
|
||||
type RolesDao 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 RolesColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 RolesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// RolesColumns defines and stores column names for the table roles.
|
||||
@ -48,12 +47,11 @@ var rolesColumns = RolesColumns{
|
||||
}
|
||||
|
||||
// NewRolesDao creates and returns a new DAO object for table data access.
|
||||
func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao {
|
||||
func NewRolesDao() *RolesDao {
|
||||
return &RolesDao{
|
||||
group: "default",
|
||||
table: "roles",
|
||||
columns: rolesColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "roles",
|
||||
columns: rolesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,11 +77,7 @@ func (dao *RolesDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *RolesDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// StoreAdminsDao is the data access object for the table store_admins.
|
||||
type StoreAdminsDao 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 StoreAdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 StoreAdminsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// StoreAdminsColumns defines and stores column names for the table store_admins.
|
||||
@ -58,12 +57,11 @@ var storeAdminsColumns = StoreAdminsColumns{
|
||||
}
|
||||
|
||||
// NewStoreAdminsDao creates and returns a new DAO object for table data access.
|
||||
func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao {
|
||||
func NewStoreAdminsDao() *StoreAdminsDao {
|
||||
return &StoreAdminsDao{
|
||||
group: "default",
|
||||
table: "store_admins",
|
||||
columns: storeAdminsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "store_admins",
|
||||
columns: storeAdminsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,11 +87,7 @@ func (dao *StoreAdminsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *StoreAdminsDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,45 +13,31 @@ import (
|
||||
|
||||
// StoreDesktopSettingsDao is the data access object for the table store_desktop_settings.
|
||||
type StoreDesktopSettingsDao 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 StoreDesktopSettingsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 StoreDesktopSettingsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// StoreDesktopSettingsColumns defines and stores column names for the table store_desktop_settings.
|
||||
type StoreDesktopSettingsColumns struct {
|
||||
Id string // 主键ID
|
||||
StoreId string // 门店ID
|
||||
BackgroundUrl string // 桌面背景图片URL
|
||||
Resolution string // 分辨率,例如1920x1080
|
||||
IsTopWidgetVisible string // 顶部组件是否显示:FALSE=隐藏,TRUE=显示
|
||||
IsRightWidgetVisible string // 右侧组件是否显示:FALSE=隐藏,TRUE=显示
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 软删除时间戳
|
||||
StoreId string //
|
||||
TopComponentVisible string // 1显示,2 隐藏
|
||||
RightComponentVisible string // 1显示,2 隐藏
|
||||
}
|
||||
|
||||
// storeDesktopSettingsColumns holds the columns for the table store_desktop_settings.
|
||||
var storeDesktopSettingsColumns = StoreDesktopSettingsColumns{
|
||||
Id: "id",
|
||||
StoreId: "store_id",
|
||||
BackgroundUrl: "background_url",
|
||||
Resolution: "resolution",
|
||||
IsTopWidgetVisible: "is_top_widget_visible",
|
||||
IsRightWidgetVisible: "is_right_widget_visible",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
StoreId: "store_id",
|
||||
TopComponentVisible: "top_component_visible",
|
||||
RightComponentVisible: "right_component_visible",
|
||||
}
|
||||
|
||||
// NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access.
|
||||
func NewStoreDesktopSettingsDao(handlers ...gdb.ModelHandler) *StoreDesktopSettingsDao {
|
||||
func NewStoreDesktopSettingsDao() *StoreDesktopSettingsDao {
|
||||
return &StoreDesktopSettingsDao{
|
||||
group: "default",
|
||||
table: "store_desktop_settings",
|
||||
columns: storeDesktopSettingsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "store_desktop_settings",
|
||||
columns: storeDesktopSettingsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,11 +63,7 @@ func (dao *StoreDesktopSettingsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *StoreDesktopSettingsDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// StoreRolesDao is the data access object for the table store_roles.
|
||||
type StoreRolesDao 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 StoreRolesColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 StoreRolesColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// StoreRolesColumns defines and stores column names for the table store_roles.
|
||||
@ -40,12 +39,11 @@ var storeRolesColumns = StoreRolesColumns{
|
||||
}
|
||||
|
||||
// NewStoreRolesDao creates and returns a new DAO object for table data access.
|
||||
func NewStoreRolesDao(handlers ...gdb.ModelHandler) *StoreRolesDao {
|
||||
func NewStoreRolesDao() *StoreRolesDao {
|
||||
return &StoreRolesDao{
|
||||
group: "default",
|
||||
table: "store_roles",
|
||||
columns: storeRolesColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "store_roles",
|
||||
columns: storeRolesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,11 +69,7 @@ func (dao *StoreRolesDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *StoreRolesDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// StoreTaskRewardsDao is the data access object for the table store_task_rewards.
|
||||
type StoreTaskRewardsDao 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 StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// StoreTaskRewardsColumns defines and stores column names for the table store_task_rewards.
|
||||
@ -42,12 +41,11 @@ var storeTaskRewardsColumns = StoreTaskRewardsColumns{
|
||||
}
|
||||
|
||||
// NewStoreTaskRewardsDao creates and returns a new DAO object for table data access.
|
||||
func NewStoreTaskRewardsDao(handlers ...gdb.ModelHandler) *StoreTaskRewardsDao {
|
||||
func NewStoreTaskRewardsDao() *StoreTaskRewardsDao {
|
||||
return &StoreTaskRewardsDao{
|
||||
group: "default",
|
||||
table: "store_task_rewards",
|
||||
columns: storeTaskRewardsColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "store_task_rewards",
|
||||
columns: storeTaskRewardsColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,11 +71,7 @@ func (dao *StoreTaskRewardsDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *StoreTaskRewardsDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// StoresDao is the data access object for the table stores.
|
||||
type StoresDao 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 StoresColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 StoresColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// StoresColumns defines and stores column names for the table stores.
|
||||
@ -52,12 +51,11 @@ var storesColumns = StoresColumns{
|
||||
}
|
||||
|
||||
// NewStoresDao creates and returns a new DAO object for table data access.
|
||||
func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao {
|
||||
func NewStoresDao() *StoresDao {
|
||||
return &StoresDao{
|
||||
group: "default",
|
||||
table: "stores",
|
||||
columns: storesColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "stores",
|
||||
columns: storesColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,11 +81,7 @@ func (dao *StoresDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *StoresDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// TasksDao is the data access object for the table tasks.
|
||||
type TasksDao 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 TasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 TasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// TasksColumns defines and stores column names for the table tasks.
|
||||
@ -58,12 +57,11 @@ var tasksColumns = TasksColumns{
|
||||
}
|
||||
|
||||
// NewTasksDao creates and returns a new DAO object for table data access.
|
||||
func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao {
|
||||
func NewTasksDao() *TasksDao {
|
||||
return &TasksDao{
|
||||
group: "default",
|
||||
table: "tasks",
|
||||
columns: tasksColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "tasks",
|
||||
columns: tasksColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,11 +87,7 @@ func (dao *TasksDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *TasksDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// UserTasksDao is the data access object for the table user_tasks.
|
||||
type UserTasksDao 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 UserTasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 UserTasksColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// UserTasksColumns defines and stores column names for the table user_tasks.
|
||||
@ -52,12 +51,11 @@ var userTasksColumns = UserTasksColumns{
|
||||
}
|
||||
|
||||
// NewUserTasksDao creates and returns a new DAO object for table data access.
|
||||
func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao {
|
||||
func NewUserTasksDao() *UserTasksDao {
|
||||
return &UserTasksDao{
|
||||
group: "default",
|
||||
table: "user_tasks",
|
||||
columns: userTasksColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "user_tasks",
|
||||
columns: userTasksColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,11 +81,7 @@ func (dao *UserTasksDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UserTasksDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
@ -13,10 +13,9 @@ import (
|
||||
|
||||
// UsersDao is the data access object for the table users.
|
||||
type UsersDao 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 UsersColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
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 UsersColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// UsersColumns defines and stores column names for the table users.
|
||||
@ -60,12 +59,11 @@ var usersColumns = UsersColumns{
|
||||
}
|
||||
|
||||
// NewUsersDao creates and returns a new DAO object for table data access.
|
||||
func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao {
|
||||
func NewUsersDao() *UsersDao {
|
||||
return &UsersDao{
|
||||
group: "default",
|
||||
table: "users",
|
||||
columns: usersColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "users",
|
||||
columns: usersColumns,
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,11 +89,7 @@ func (dao *UsersDao) Group() string {
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UsersDao) 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)
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
|
||||
Reference in New Issue
Block a user