Files
epic-go/internal/dao/internal/yudao_demo_01_contact.go
hu xiaotong fc41c5ca73 refactor(internal): 优化 OSS 预签名 URL 缓存刷新任务和英雄数据缓存逻辑
- 注释掉 OSS预签名 URL 缓存刷新任务的定时执行代码
- 在 hero/hero.go 中增加对 Redis缓存和英雄数据集的非空校验
- 修改 OSS预签名 URL 生成逻辑,自动替换为 CDN 域名
2025-07-25 17:08:39 +08:00

102 lines
3.5 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"
)
// YudaoDemo01ContactDao is the data access object for the table yudao_demo01_contact.
type YudaoDemo01ContactDao 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 YudaoDemo01ContactColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// YudaoDemo01ContactColumns defines and stores column names for the table yudao_demo01_contact.
type YudaoDemo01ContactColumns struct {
Id string // 编号
Name string // 名字
Sex string // 性别
Birthday string // 出生年
Description string // 简介
Avatar string // 头像
Creator string // 创建者
CreateTime string // 创建时间
Updater string // 更新者
UpdateTime string // 更新时间
Deleted string // 是否删除
TenantId string // 租户编号
}
// yudaoDemo01ContactColumns holds the columns for the table yudao_demo01_contact.
var yudaoDemo01ContactColumns = YudaoDemo01ContactColumns{
Id: "id",
Name: "name",
Sex: "sex",
Birthday: "birthday",
Description: "description",
Avatar: "avatar",
Creator: "creator",
CreateTime: "create_time",
Updater: "updater",
UpdateTime: "update_time",
Deleted: "deleted",
TenantId: "tenant_id",
}
// NewYudaoDemo01ContactDao creates and returns a new DAO object for table data access.
func NewYudaoDemo01ContactDao(handlers ...gdb.ModelHandler) *YudaoDemo01ContactDao {
return &YudaoDemo01ContactDao{
group: "default",
table: "yudao_demo01_contact",
columns: yudaoDemo01ContactColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *YudaoDemo01ContactDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *YudaoDemo01ContactDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *YudaoDemo01ContactDao) Columns() YudaoDemo01ContactColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *YudaoDemo01ContactDao) 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 *YudaoDemo01ContactDao) 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 *YudaoDemo01ContactDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}