feat: add Go backend
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AppMemberLevelDao is the data access object for the table hg_app_member_level.
|
||||
type AppMemberLevelDao 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 AppMemberLevelColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// AppMemberLevelColumns defines and stores column names for the table hg_app_member_level.
|
||||
type AppMemberLevelColumns struct {
|
||||
Id string // 主键
|
||||
TenantId string // 租户ID
|
||||
LevelCode string // 稳定等级编码
|
||||
Name string // 等级名称
|
||||
IconAttachmentId string // 图标附件ID
|
||||
IconUrl string // 图标URL
|
||||
CurrentVersionId string // 当前发布版本ID
|
||||
MemberCount string // 会员数(可重建)
|
||||
Status string // 状态 1正常 2停用
|
||||
Sort string // 排序
|
||||
Remark string // 备注
|
||||
CreatedBy string // 创建者
|
||||
UpdatedBy string // 更新者
|
||||
DeletedBy string // 删除者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
DeletedAt string // 删除时间
|
||||
}
|
||||
|
||||
// appMemberLevelColumns holds the columns for the table hg_app_member_level.
|
||||
var appMemberLevelColumns = AppMemberLevelColumns{
|
||||
Id: "id",
|
||||
TenantId: "tenant_id",
|
||||
LevelCode: "level_code",
|
||||
Name: "name",
|
||||
IconAttachmentId: "icon_attachment_id",
|
||||
IconUrl: "icon_url",
|
||||
CurrentVersionId: "current_version_id",
|
||||
MemberCount: "member_count",
|
||||
Status: "status",
|
||||
Sort: "sort",
|
||||
Remark: "remark",
|
||||
CreatedBy: "created_by",
|
||||
UpdatedBy: "updated_by",
|
||||
DeletedBy: "deleted_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewAppMemberLevelDao creates and returns a new DAO object for table data access.
|
||||
func NewAppMemberLevelDao(handlers ...gdb.ModelHandler) *AppMemberLevelDao {
|
||||
return &AppMemberLevelDao{
|
||||
group: "default",
|
||||
table: "hg_app_member_level",
|
||||
columns: appMemberLevelColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *AppMemberLevelDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *AppMemberLevelDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *AppMemberLevelDao) Columns() AppMemberLevelColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *AppMemberLevelDao) 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 *AppMemberLevelDao) 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 *AppMemberLevelDao) 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