|
|
@ -0,0 +1,95 @@ |
|
|
|
// ==========================================================================
|
|
|
|
// 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" |
|
|
|
) |
|
|
|
|
|
|
|
// GoShowsDao is the data access object for table go_shows.
|
|
|
|
type GoShowsDao 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 GoShowsColumns // columns contains all the column names of Table for convenient usage.
|
|
|
|
} |
|
|
|
|
|
|
|
// GoShowsColumns defines and stores column names for table go_shows.
|
|
|
|
type GoShowsColumns struct { |
|
|
|
Id string // 展示内容唯一ID,自增
|
|
|
|
Cover string // 展示内容封面路径或相关标识,可为空
|
|
|
|
Name string // 展示内容名称,最大长度255字符,不能为空
|
|
|
|
UserId string // 关联的用户ID,指向go_users表的id,长度为8位整数,不能为空
|
|
|
|
ReleaseTime string // 展示内容发布时间,可为空
|
|
|
|
VideoDuration string // 展示内容视频时长,格式根据实际情况定,可为空
|
|
|
|
ViewCount string // 展示内容观看数量,初始值为0,可累加
|
|
|
|
Comments string // 展示内容评论数量,初始值为0,可累加
|
|
|
|
Likes string // 展示内容点赞数量,初始值为0,可累加
|
|
|
|
FlagType string // 展示内容标识类型,按业务规则确定,可为空
|
|
|
|
ClubId string // 关联的俱乐部ID,指向go_clubs表的id,可为空
|
|
|
|
ChannelId string // 关联的频道ID,指向go_channels表的id,可为空
|
|
|
|
} |
|
|
|
|
|
|
|
// goShowsColumns holds the columns for table go_shows.
|
|
|
|
var goShowsColumns = GoShowsColumns{ |
|
|
|
Id: "id", |
|
|
|
Cover: "cover", |
|
|
|
Name: "name", |
|
|
|
UserId: "user_id", |
|
|
|
ReleaseTime: "release_time", |
|
|
|
VideoDuration: "video_duration", |
|
|
|
ViewCount: "view_count", |
|
|
|
Comments: "comments", |
|
|
|
Likes: "likes", |
|
|
|
FlagType: "flag_type", |
|
|
|
ClubId: "club_id", |
|
|
|
ChannelId: "channel_id", |
|
|
|
} |
|
|
|
|
|
|
|
// NewGoShowsDao creates and returns a new DAO object for table data access.
|
|
|
|
func NewGoShowsDao() *GoShowsDao { |
|
|
|
return &GoShowsDao{ |
|
|
|
group: "default", |
|
|
|
table: "go_shows", |
|
|
|
columns: goShowsColumns, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
|
|
|
func (dao *GoShowsDao) DB() gdb.DB { |
|
|
|
return g.DB(dao.group) |
|
|
|
} |
|
|
|
|
|
|
|
// Table returns the table name of current dao.
|
|
|
|
func (dao *GoShowsDao) Table() string { |
|
|
|
return dao.table |
|
|
|
} |
|
|
|
|
|
|
|
// Columns returns all column names of current dao.
|
|
|
|
func (dao *GoShowsDao) Columns() GoShowsColumns { |
|
|
|
return dao.columns |
|
|
|
} |
|
|
|
|
|
|
|
// Group returns the configuration group name of database of current dao.
|
|
|
|
func (dao *GoShowsDao) Group() string { |
|
|
|
return dao.group |
|
|
|
} |
|
|
|
|
|
|
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
|
|
|
func (dao *GoShowsDao) Ctx(ctx context.Context) *gdb.Model { |
|
|
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx) |
|
|
|
} |
|
|
|
|
|
|
|
// Transaction wraps the transaction logic using function f.
|
|
|
|
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
|
|
|
// It commits the transaction and returns nil if function f returns nil.
|
|
|
|
//
|
|
|
|
// Note that, you should not Commit or Rollback the transaction in function f
|
|
|
|
// as it is automatically handled by this function.
|
|
|
|
func (dao *GoShowsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { |
|
|
|
return dao.Ctx(ctx).Transaction(ctx, f) |
|
|
|
} |