// ==========================================================================
// 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"
)

// ProjectInfoDao is the manager for logic model data accessing and custom defined data operations functions management.
type ProjectInfoDao 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 ProjectInfoColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
}

// ProjectInfoColumns defines and stores column names for table project_info.
type ProjectInfoColumns struct {
	ProjectId       string // 项目id
	ProjectName     string // 项目名称
	ProjectStatus   string // 项目状态，1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
	ProjectType     string // 项目类型，1代表全流程项目，2代表专项项目
	ProjectPlatform string // 项目平台，1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
	ProjectForm     string // 项目形式，1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
	TalentType      string // 达人类型
	RecruitDdl      string // 招募截止时间
	ContentType     string // 内容形式，1代表图文，2代表视频
	ProjectDetail   string // 项目详情
	ApplyNum        string // 报名人数
	RecruitNum      string // 已招募人数
	EnterpriseId    string // 所属企业id
	ProductId       string // 关联商品id
	CreatedAt       string // 创建时间
	UpdatedAt       string // 修改时间
}

//  projectInfoColumns holds the columns for table project_info.
var projectInfoColumns = ProjectInfoColumns{
	ProjectId:       "project_id",
	ProjectName:     "project_name",
	ProjectStatus:   "project_status",
	ProjectType:     "project_type",
	ProjectPlatform: "project_platform",
	ProjectForm:     "project_form",
	TalentType:      "talent_type",
	RecruitDdl:      "recruit_ddl",
	ContentType:     "content_type",
	ProjectDetail:   "project_detail",
	ApplyNum:        "apply_num",
	RecruitNum:      "recruit_num",
	EnterpriseId:    "enterprise_id",
	ProductId:       "product_id",
	CreatedAt:       "created_at",
	UpdatedAt:       "updated_at",
}

// NewProjectInfoDao creates and returns a new DAO object for table data access.
func NewProjectInfoDao() *ProjectInfoDao {
	return &ProjectInfoDao{
		Group:   "default",
		Table:   "project_info",
		Columns: projectInfoColumns,
	}
}

// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *ProjectInfoDao) 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 *ProjectInfoDao) 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 *ProjectInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}
