85 lines
2.6 KiB
Go
85 lines
2.6 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"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// internalCommentDao is internal type for wrapping internal DAO implements.
|
|||
|
|
type internalCommentDao 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 CommentColumns // columns contains all the column names of Table for convenient usage.
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CommentColumns defines and stores column names for table nl_comment.
|
|||
|
|
type CommentColumns struct {
|
|||
|
|
Id string // 评论ID
|
|||
|
|
UserId string // 用户ID
|
|||
|
|
MovieId string // 影片ID
|
|||
|
|
ParentId string // 父评论ID,0为顶级评论
|
|||
|
|
Content string // 评论内容
|
|||
|
|
LikeCount string // 点赞数
|
|||
|
|
Status string // 状态:0待审核,1已通过,2已拒绝
|
|||
|
|
CreatedAt string // 创建时间
|
|||
|
|
UpdatedAt string // 更新时间
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// commentColumns holds the columns for table nl_comment.
|
|||
|
|
var commentColumns = CommentColumns{
|
|||
|
|
Id: "id",
|
|||
|
|
UserId: "user_id",
|
|||
|
|
MovieId: "movie_id",
|
|||
|
|
ParentId: "parent_id",
|
|||
|
|
Content: "content",
|
|||
|
|
LikeCount: "like_count",
|
|||
|
|
Status: "status",
|
|||
|
|
CreatedAt: "created_at",
|
|||
|
|
UpdatedAt: "updated_at",
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// NewCommentDao creates and returns a new DAO object for table data access.
|
|||
|
|
func NewCommentDao() *internalCommentDao {
|
|||
|
|
return &internalCommentDao{
|
|||
|
|
group: "default",
|
|||
|
|
table: "nl_comment",
|
|||
|
|
columns: commentColumns,
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
|||
|
|
func (dao *internalCommentDao) DB() gdb.DB {
|
|||
|
|
return g.DB(dao.group)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Table returns the table name of current dao.
|
|||
|
|
func (dao *internalCommentDao) Table() string {
|
|||
|
|
return dao.table
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Columns returns the columns of current dao.
|
|||
|
|
func (dao *internalCommentDao) Columns() CommentColumns {
|
|||
|
|
return dao.columns
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Group returns the configuration group name of database of current dao.
|
|||
|
|
func (dao *internalCommentDao) Group() string {
|
|||
|
|
return dao.group
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
|||
|
|
func (dao *internalCommentDao) 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 *internalCommentDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) error {
|
|||
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|||
|
|
}
|