// ========================================================================== // 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" ) // ShortVideoDao is the data access object for table cms_short_video. type ShortVideoDao 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 ShortVideoColumns // columns contains all the column names of Table for convenient usage. } // ShortVideoColumns defines and stores column names for table cms_short_video. type ShortVideoColumns struct { Id string // Title string // 标题 Introduction string // Tag string // 标签 Author string // 作者 Actor string // 演员 Protagonist string // 主角 Cover string // 封面 CoverUrl string // 封面 ChapterUrls string // 资源地址 ChapterCount string // 当前章节 ChapterMax string // 共人章节 Status string // 状态 0未审核 1更新中 2完结 Views string // 观看次数 Stars string // 标星 CreatedAt string // UpdatedAt string // FinishStatus string // Online string // } // shortVideoColumns holds the columns for table cms_short_video. var shortVideoColumns = ShortVideoColumns{ Id: "id", Title: "title", Introduction: "introduction", Tag: "tag", Author: "author", Actor: "actor", Protagonist: "protagonist", Cover: "cover", CoverUrl: "cover_url", ChapterUrls: "chapter_urls", ChapterCount: "chapter_count", ChapterMax: "chapter_max", Status: "status", Views: "views", Stars: "stars", CreatedAt: "created_at", UpdatedAt: "updated_at", FinishStatus: "finish_status", Online: "online", } // NewShortVideoDao creates and returns a new DAO object for table data access. func NewShortVideoDao() *ShortVideoDao { return &ShortVideoDao{ group: "cms", table: "cms_short_video", columns: shortVideoColumns, } } // DB retrieves and returns the underlying raw database management object of current DAO. func (dao *ShortVideoDao) DB() gdb.DB { return g.DB(dao.group) } // Table returns the table name of current dao. func (dao *ShortVideoDao) Table() string { return dao.table } // Columns returns all column names of current dao. func (dao *ShortVideoDao) Columns() ShortVideoColumns { return dao.columns } // Group returns the configuration group name of database of current dao. func (dao *ShortVideoDao) Group() string { return dao.group } // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. func (dao *ShortVideoDao) 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 *ShortVideoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) }