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

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

// YoungeeTaskInfoColumns defines and stores column names for table youngee_task_info.
type YoungeeTaskInfoColumns struct {
	TaskId                 string // 任务id
	ProjectId              string // 项目id
	TalentId               string // 达人id
	TalentPlatformInfoSnap string // 达人平台信息快照
	TalentPersonalInfoSnap string // 达人个人信息快照
	TalentPostAddrSnap     string // 收货地址快照
	StrategyId             string // 报名选择的招募策略id
	TaskReward             string // 任务奖励金额
	SettleAmount           string // 待结算金额（任务奖励扣除违规扣款）
	TaskStatus             string // 任务状态
	CreateDate             string // 创建时间
	SelectDate             string // 反选时间
	CompleteStatus         string // 结束方式 1未结束 2正常结束 3反选失败 4被解约
	CompleteDate           string // 结束时间
}

//  youngeeTaskInfoColumns holds the columns for table youngee_task_info.
var youngeeTaskInfoColumns = YoungeeTaskInfoColumns{
	TaskId:                 "task_id",
	ProjectId:              "project_id",
	TalentId:               "talent_id",
	TalentPlatformInfoSnap: "talent_platform_info_snap",
	TalentPersonalInfoSnap: "talent_personal_info_snap",
	TalentPostAddrSnap:     "talent_post_addr_snap",
	StrategyId:             "strategy_id",
	TaskReward:             "task_reward",
	SettleAmount:           "settle_amount",
	TaskStatus:             "task_status",
	CreateDate:             "create_date",
	SelectDate:             "select_date",
	CompleteStatus:         "complete_status",
	CompleteDate:           "complete_date",
}

// NewYoungeeTaskInfoDao creates and returns a new DAO object for table data access.
func NewYoungeeTaskInfoDao() *YoungeeTaskInfoDao {
	return &YoungeeTaskInfoDao{
		Group:   "default",
		Table:   "youngee_task_info",
		Columns: youngeeTaskInfoColumns,
	}
}

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