Files
epic-go/internal/dao/internal/infra_codegen_table.go
hu xiaotong 85e3a6540b init
2025-06-20 17:17:02 +08:00

126 lines
4.7 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"
)
// InfraCodegenTableDao is the data access object for the table infra_codegen_table.
type InfraCodegenTableDao 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 InfraCodegenTableColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// InfraCodegenTableColumns defines and stores column names for the table infra_codegen_table.
type InfraCodegenTableColumns struct {
Id string // 编号
DataSourceConfigId string // 数据源配置的编号
Scene string // 生成场景
TableName string // 表名称
TableComment string // 表描述
Remark string // 备注
ModuleName string // 模块名
BusinessName string // 业务名
ClassName string // 类名称
ClassComment string // 类描述
Author string // 作者
TemplateType string // 模板类型
FrontType string // 前端类型
ParentMenuId string // 父菜单编号
MasterTableId string // 主表的编号
SubJoinColumnId string // 子表关联主表的字段编号
SubJoinMany string // 主表与子表是否一对多
TreeParentColumnId string // 树表的父字段编号
TreeNameColumnId string // 树表的名字字段编号
Creator string // 创建者
CreateTime string // 创建时间
Updater string // 更新者
UpdateTime string // 更新时间
Deleted string // 是否删除
}
// infraCodegenTableColumns holds the columns for the table infra_codegen_table.
var infraCodegenTableColumns = InfraCodegenTableColumns{
Id: "id",
DataSourceConfigId: "data_source_config_id",
Scene: "scene",
TableName: "table_name",
TableComment: "table_comment",
Remark: "remark",
ModuleName: "module_name",
BusinessName: "business_name",
ClassName: "class_name",
ClassComment: "class_comment",
Author: "author",
TemplateType: "template_type",
FrontType: "front_type",
ParentMenuId: "parent_menu_id",
MasterTableId: "master_table_id",
SubJoinColumnId: "sub_join_column_id",
SubJoinMany: "sub_join_many",
TreeParentColumnId: "tree_parent_column_id",
TreeNameColumnId: "tree_name_column_id",
Creator: "creator",
CreateTime: "create_time",
Updater: "updater",
UpdateTime: "update_time",
Deleted: "deleted",
}
// NewInfraCodegenTableDao creates and returns a new DAO object for table data access.
func NewInfraCodegenTableDao(handlers ...gdb.ModelHandler) *InfraCodegenTableDao {
return &InfraCodegenTableDao{
group: "default",
table: "infra_codegen_table",
columns: infraCodegenTableColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *InfraCodegenTableDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *InfraCodegenTableDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *InfraCodegenTableDao) Columns() InfraCodegenTableColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *InfraCodegenTableDao) 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 *InfraCodegenTableDao) 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 *InfraCodegenTableDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}