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

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

// RecruitStrategyColumns defines and stores column names for table recruit_strategy.
type RecruitStrategyColumns struct {
	RecruitStrategyId string // 招募策略id
	FeeForm           string // 稿费形式，1-3分别代表产品置换、固定稿费、自报价
	StrategyId        string // 策略id
	FollowersLow      string // 达人粉丝数下限
	FollowersUp       string // 达人粉丝数上限
	RecruitNumber     string // 招募数量
	Offer             string // 报价
	ProjectId         string // 所属项目id
}

//  recruitStrategyColumns holds the columns for table recruit_strategy.
var recruitStrategyColumns = RecruitStrategyColumns{
	RecruitStrategyId: "recruit_strategy_id",
	FeeForm:           "fee_form",
	StrategyId:        "strategy_id",
	FollowersLow:      "followers_low",
	FollowersUp:       "followers_up",
	RecruitNumber:     "recruit_number",
	Offer:             "offer",
	ProjectId:         "project_id",
}

// NewRecruitStrategyDao creates and returns a new DAO object for table data access.
func NewRecruitStrategyDao() *RecruitStrategyDao {
	return &RecruitStrategyDao{
		Group:   "default",
		Table:   "recruit_strategy",
		Columns: recruitStrategyColumns,
	}
}

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