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

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

// BobocoinDeductRecordColumns defines and stores column names for table bobocoin_deduct_record.
type BobocoinDeductRecordColumns struct {
	RecordId        string // 扣费记录ID                                      
    TalentId        string // 达人id                                          
    BobocoinValue   string // 冻结的卜卜币数量(真实数量 * 100)                
    OrderId         string // 订单id，如果是订单执行产生的扣费，则有值        
    ProcedureStage  string // 订单的执行步骤，如果是订单产生的扣费，则有此值  
    Reason          string // 扣费原因 1任务超期冻结 2拍单费用 3延期发放      
    CreatedAt       string // 创建时间                                        
    OperationStage  string // 扣款步骤名称                                    
    TaskName        string // 任务名称(冗余)
}

//  bobocoinDeductRecordColumns holds the columns for table bobocoin_deduct_record.
var bobocoinDeductRecordColumns = BobocoinDeductRecordColumns{
	RecordId:       "record_id",        
            TalentId:       "talent_id",        
            BobocoinValue:  "bobocoin_value",   
            OrderId:        "order_id",         
            ProcedureStage: "procedure_stage",  
            Reason:         "reason",           
            CreatedAt:      "created_at",       
            OperationStage: "operation_stage",  
            TaskName:       "task_name",
}

// NewBobocoinDeductRecordDao creates and returns a new DAO object for table data access.
func NewBobocoinDeductRecordDao() *BobocoinDeductRecordDao {
	return &BobocoinDeductRecordDao{
		Group:   "default",
		Table:   "bobocoin_deduct_record",
		Columns: bobocoinDeductRecordColumns,
	}
}

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