83 lines
2.5 KiB
Go
83 lines
2.5 KiB
Go
// =================================================================================
|
||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||
// =================================================================================
|
||
|
||
package dao
|
||
|
||
import (
|
||
"context"
|
||
|
||
"github.com/gogf/gf/v2/database/gdb"
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
)
|
||
|
||
// internalBannerDao is internal type for wrapping internal DAO implements.
|
||
type internalBannerDao 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 BannerColumns // columns contains all the column names of Table for convenient usage.
|
||
}
|
||
|
||
// BannerColumns defines and stores column names for table nl_banner.
|
||
type BannerColumns struct {
|
||
Id string // 轮播图ID
|
||
Title string // 轮播图标题
|
||
ImageUrl string // 图片URL
|
||
LinkUrl string // 跳转链接
|
||
Sort string // 排序
|
||
Status string // 状态:0禁用,1启用
|
||
CreatedAt string // 创建时间
|
||
UpdatedAt string // 更新时间
|
||
}
|
||
|
||
// bannerColumns holds the columns for table nl_banner.
|
||
var bannerColumns = BannerColumns{
|
||
Id: "id",
|
||
Title: "title",
|
||
ImageUrl: "image_url",
|
||
LinkUrl: "link_url",
|
||
Sort: "sort",
|
||
Status: "status",
|
||
CreatedAt: "created_at",
|
||
UpdatedAt: "updated_at",
|
||
}
|
||
|
||
// NewBannerDao creates and returns a new DAO object for table data access.
|
||
func NewBannerDao() *internalBannerDao {
|
||
return &internalBannerDao{
|
||
group: "default",
|
||
table: "nl_banner",
|
||
columns: bannerColumns,
|
||
}
|
||
}
|
||
|
||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||
func (dao *internalBannerDao) DB() gdb.DB {
|
||
return g.DB(dao.group)
|
||
}
|
||
|
||
// Table returns the table name of current dao.
|
||
func (dao *internalBannerDao) Table() string {
|
||
return dao.table
|
||
}
|
||
|
||
// Columns returns the columns of current dao.
|
||
func (dao *internalBannerDao) Columns() BannerColumns {
|
||
return dao.columns
|
||
}
|
||
|
||
// Group returns the configuration group name of database of current dao.
|
||
func (dao *internalBannerDao) Group() string {
|
||
return dao.group
|
||
}
|
||
|
||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||
func (dao *internalBannerDao) Ctx(ctx context.Context) *gdb.Model {
|
||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||
}
|
||
|
||
// Transaction wraps the transaction logic using function f.
|
||
func (dao *internalBannerDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) error {
|
||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||
}
|