Files
epic-go/internal/dao/internal/system_role.go
hxt 0ad79c4f27 ci(drone): 添加 Go 模块和构建缓存
- 在 restore cache 和 rebuild cache 步骤中添加了 go-mod-cache 和 go
2025-07-17 20:25:50 +08:00

102 lines
3.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ==========================================================================
// 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"
)
// 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 current DAO.
columns SystemRoleColumns // columns contains all the column names of Table for convenient usage.
}
// SystemRoleColumns defines and stores column names for table system_role.
type SystemRoleColumns struct {
Id string // 角色ID
Name string // 角色名称
Code string // 角色权限字符串
Sort string // 显示顺序
DataScope string // 数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限
DataScopeDeptIds string // 数据范围(指定部门数组)
Status string // 角色状态0正常 1停用
Type string // 角色类型
Remark string // 备注
Creator string // 创建者
CreateTime string // 创建时间
Updater string // 更新者
UpdateTime string // 更新时间
Deleted string // 是否删除
TenantId string // 租户编号
}
// systemRoleColumns holds the columns for table system_role.
var systemRoleColumns = SystemRoleColumns{
Id: "id",
Name: "name",
Code: "code",
Sort: "sort",
DataScope: "data_scope",
DataScopeDeptIds: "data_scope_dept_ids",
Status: "status",
Type: "type",
Remark: "remark",
Creator: "creator",
CreateTime: "create_time",
Updater: "updater",
UpdateTime: "update_time",
Deleted: "deleted",
TenantId: "tenant_id",
}
// NewSystemRoleDao creates and returns a new DAO object for table data access.
func NewSystemRoleDao() *SystemRoleDao {
return &SystemRoleDao{
group: "default",
table: "system_role",
columns: systemRoleColumns,
}
}
// 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 current dao.
func (dao *SystemRoleDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *SystemRoleDao) Columns() SystemRoleColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *SystemRoleDao) Group() string {
return dao.group
}
// 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 {
return dao.DB().Model(dao.table).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 commits the transaction and returns nil if function f returns nil.
//
// 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)
}