12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- // ==========================================================================
- // Code generated by GoFrame CLI tool. DO NOT EDIT.
- // ==========================================================================
- package internal
- import (
- "context"
- "github.com/gogf/gf/database/gdb"
- "github.com/gogf/gf/frame/g"
- )
- // ProjectPhotoDao is the manager for logic model data accessing and custom defined data operations functions management.
- type ProjectPhotoDao 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 ProjectPhotoColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
- }
- // ProjectPhotoColumns defines and stores column names for table project_photo.
- type ProjectPhotoColumns struct {
- ProjectPhotoId string // 项目图片id
- PhotoUrl string // 图片url
- PhotoUid string //
- ProjectId string // 所属项目id
- CreatedAt string // 创建时间
- FileName string // 文件名称
- }
- // projectPhotoColumns holds the columns for table project_photo.
- var projectPhotoColumns = ProjectPhotoColumns{
- ProjectPhotoId: "project_photo_id",
- PhotoUrl: "photo_url",
- PhotoUid: "photo_uid",
- ProjectId: "project_id",
- CreatedAt: "created_at",
- FileName: "file_name",
- }
- // NewProjectPhotoDao creates and returns a new DAO object for table data access.
- func NewProjectPhotoDao() *ProjectPhotoDao {
- return &ProjectPhotoDao{
- Group: "default",
- Table: "project_photo",
- Columns: projectPhotoColumns,
- }
- }
- // DB retrieves and returns the underlying raw database management object of current DAO.
- func (dao *ProjectPhotoDao) DB() gdb.DB {
- return g.DB(dao.Group)
- }
- // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
- func (dao *ProjectPhotoDao) 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 *ProjectPhotoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
- return dao.Ctx(ctx).Transaction(ctx, f)
- }
|