ci(drone): 添加 Go 模块和构建缓存
- 在 restore cache 和 rebuild cache 步骤中添加了 go-mod-cache 和 go
This commit is contained in:
@@ -11,15 +11,14 @@ import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SystemRoleDao is the data access object for the table system_role.
|
||||
// SystemRoleDao is the data access object for table system_role.
|
||||
type SystemRoleDao 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 SystemRoleColumns // 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 current DAO.
|
||||
columns SystemRoleColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SystemRoleColumns defines and stores column names for the table system_role.
|
||||
// SystemRoleColumns defines and stores column names for table system_role.
|
||||
type SystemRoleColumns struct {
|
||||
Id string // 角色ID
|
||||
Name string // 角色名称
|
||||
@@ -38,7 +37,7 @@ type SystemRoleColumns struct {
|
||||
TenantId string // 租户编号
|
||||
}
|
||||
|
||||
// systemRoleColumns holds the columns for the table system_role.
|
||||
// systemRoleColumns holds the columns for table system_role.
|
||||
var systemRoleColumns = SystemRoleColumns{
|
||||
Id: "id",
|
||||
Name: "name",
|
||||
@@ -58,49 +57,44 @@ var systemRoleColumns = SystemRoleColumns{
|
||||
}
|
||||
|
||||
// NewSystemRoleDao creates and returns a new DAO object for table data access.
|
||||
func NewSystemRoleDao(handlers ...gdb.ModelHandler) *SystemRoleDao {
|
||||
func NewSystemRoleDao() *SystemRoleDao {
|
||||
return &SystemRoleDao{
|
||||
group: "default",
|
||||
table: "system_role",
|
||||
columns: systemRoleColumns,
|
||||
handlers: handlers,
|
||||
group: "default",
|
||||
table: "system_role",
|
||||
columns: systemRoleColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SystemRoleDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SystemRoleDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SystemRoleDao) Columns() SystemRoleColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SystemRoleDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SystemRoleDao) 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.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns 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,
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SystemRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
|
||||
Reference in New Issue
Block a user