77 lines
2.5 KiB
Go
77 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"
|
|
)
|
|
|
|
// internalUserCollectDao is internal type for wrapping internal DAO implements.
|
|
type internalUserCollectDao 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 UserCollectColumns // columns contains all the column names of Table for convenient usage.
|
|
}
|
|
|
|
// UserCollectColumns defines and stores column names for table nl_user_collect.
|
|
type UserCollectColumns struct {
|
|
Id string // 收藏ID
|
|
UserId string // 用户ID
|
|
MovieId string // 影片ID
|
|
CreatedAt string // 创建时间
|
|
UpdatedAt string // 更新时间
|
|
}
|
|
|
|
// userCollectColumns holds the columns for table nl_user_collect.
|
|
var userCollectColumns = UserCollectColumns{
|
|
Id: "id",
|
|
UserId: "user_id",
|
|
MovieId: "movie_id",
|
|
CreatedAt: "created_at",
|
|
UpdatedAt: "updated_at",
|
|
}
|
|
|
|
// NewUserCollectDao creates and returns a new DAO object for table data access.
|
|
func NewUserCollectDao() *internalUserCollectDao {
|
|
return &internalUserCollectDao{
|
|
group: "default",
|
|
table: "nl_user_collect",
|
|
columns: userCollectColumns,
|
|
}
|
|
}
|
|
|
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
|
func (dao *internalUserCollectDao) DB() gdb.DB {
|
|
return g.DB(dao.group)
|
|
}
|
|
|
|
// Table returns the table name of current dao.
|
|
func (dao *internalUserCollectDao) Table() string {
|
|
return dao.table
|
|
}
|
|
|
|
// Columns returns the columns of current dao.
|
|
func (dao *internalUserCollectDao) Columns() UserCollectColumns {
|
|
return dao.columns
|
|
}
|
|
|
|
// Group returns the configuration group name of database of current dao.
|
|
func (dao *internalUserCollectDao) Group() string {
|
|
return dao.group
|
|
}
|
|
|
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
|
func (dao *internalUserCollectDao) 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 *internalUserCollectDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) error {
|
|
return dao.Ctx(ctx).Transaction(ctx, f)
|
|
}
|