Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-07-05 14:45:08 +08:00
8 changed files with 148 additions and 21 deletions

View File

@ -13,9 +13,10 @@ import (
// StoreClientSessionsDao is the data access object for the table store_client_sessions.
type StoreClientSessionsDao 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 StoreClientSessionsColumns // 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 StoreClientSessionsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// StoreClientSessionsColumns defines and stores column names for the table store_client_sessions.
@ -57,11 +58,12 @@ var storeClientSessionsColumns = StoreClientSessionsColumns{
}
// NewStoreClientSessionsDao creates and returns a new DAO object for table data access.
func NewStoreClientSessionsDao() *StoreClientSessionsDao {
func NewStoreClientSessionsDao(handlers ...gdb.ModelHandler) *StoreClientSessionsDao {
return &StoreClientSessionsDao{
group: "default",
table: "store_client_sessions",
columns: storeClientSessionsColumns,
group: "default",
table: "store_client_sessions",
columns: storeClientSessionsColumns,
handlers: handlers,
}
}
@ -87,7 +89,11 @@ func (dao *StoreClientSessionsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreClientSessionsDao) 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.

View File

@ -8,20 +8,15 @@ import (
"server/internal/dao/internal"
)
// internalStoreClientSessionsDao is an internal type for wrapping the internal DAO implementation.
type internalStoreClientSessionsDao = *internal.StoreClientSessionsDao
// storeClientSessionsDao is the data access object for the table store_client_sessions.
// You can define custom methods on it to extend its functionality as needed.
type storeClientSessionsDao struct {
internalStoreClientSessionsDao
*internal.StoreClientSessionsDao
}
var (
// StoreClientSessions is a globally accessible object for table store_client_sessions operations.
StoreClientSessions = storeClientSessionsDao{
internal.NewStoreClientSessionsDao(),
}
StoreClientSessions = storeClientSessionsDao{internal.NewStoreClientSessionsDao()}
)
// Add your custom methods and functionality below.