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

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

// BobocoinIncomeRecordColumns defines and stores column names for table bobocoin_income_record.
type BobocoinIncomeRecordColumns struct {
	RecordId        string // 记录id，主键，自增                                                                                     
    BobocoinValue   string // 收入的卜卜币数量                                                                                       
    OrderId         string // 获得卜卜币的订单id                                                                                     
    RecruitLevelId  string // 获得卜卜币的任务的招募级别                                                                             
    TalentId        string // 达人id                                                                                                 
    CompleteDate    string // 添加时间(订单完成时间，需要和bobocoin_withdrawal_record表中的打款完成时间字段名一致，因为要以时间排序  
    TaskName        string // 任务名称(冗余)
}

//  bobocoinIncomeRecordColumns holds the columns for table bobocoin_income_record.
var bobocoinIncomeRecordColumns = BobocoinIncomeRecordColumns{
	RecordId:       "record_id",         
            BobocoinValue:  "bobocoin_value",    
            OrderId:        "order_id",          
            RecruitLevelId: "recruit_level_id",  
            TalentId:       "talent_id",         
            CompleteDate:   "complete_date",     
            TaskName:       "task_name",
}

// NewBobocoinIncomeRecordDao creates and returns a new DAO object for table data access.
func NewBobocoinIncomeRecordDao() *BobocoinIncomeRecordDao {
	return &BobocoinIncomeRecordDao{
		Group:   "default",
		Table:   "bobocoin_income_record",
		Columns: bobocoinIncomeRecordColumns,
	}
}

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