Files
olons_admin/server/internal/dao/internal/sensitive_access_log.go
T
2026-10-10 20:56:17 +08:00

106 lines
3.8 KiB
Go

// ==========================================================================
// 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"
)
// SensitiveAccessLogDao is the data access object for the table hg_sensitive_access_log.
type SensitiveAccessLogDao 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 SensitiveAccessLogColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// SensitiveAccessLogColumns defines and stores column names for the table hg_sensitive_access_log.
type SensitiveAccessLogColumns struct {
Id string // 主键
TenantId string // 租户ID
AccessNo string // 查看流水号
ActorId string // 管理员ID
TargetType string // 目标类型
TargetId string // 目标ID
FieldSet string // 查看字段集
PurposeCode string // 用途编码
PurposeText string // 用途说明
AuthorizationNo string // 授权号
MfaVerified string // 是否二次认证
Result string // 查看结果
TraceId string // 链路ID
CreatedAt string // 创建时间
}
// sensitiveAccessLogColumns holds the columns for the table hg_sensitive_access_log.
var sensitiveAccessLogColumns = SensitiveAccessLogColumns{
Id: "id",
TenantId: "tenant_id",
AccessNo: "access_no",
ActorId: "actor_id",
TargetType: "target_type",
TargetId: "target_id",
FieldSet: "field_set",
PurposeCode: "purpose_code",
PurposeText: "purpose_text",
AuthorizationNo: "authorization_no",
MfaVerified: "mfa_verified",
Result: "result",
TraceId: "trace_id",
CreatedAt: "created_at",
}
// NewSensitiveAccessLogDao creates and returns a new DAO object for table data access.
func NewSensitiveAccessLogDao(handlers ...gdb.ModelHandler) *SensitiveAccessLogDao {
return &SensitiveAccessLogDao{
group: "default",
table: "hg_sensitive_access_log",
columns: sensitiveAccessLogColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *SensitiveAccessLogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *SensitiveAccessLogDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *SensitiveAccessLogDao) Columns() SensitiveAccessLogColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *SensitiveAccessLogDao) 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 *SensitiveAccessLogDao) 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 *SensitiveAccessLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}