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

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

// BobocoinWithdrawalRecordColumns defines and stores column names for table bobocoin_withdrawal_record.
type BobocoinWithdrawalRecordColumns struct {
	RecordId      string // 提现单号
	TalentId      string // 发起提现的达人id
	SubmitDate    string // 提交时间
	DrawAmount    string // 提现金额
	PayState      string // 支付状态 1未支付 2支付成功 3支付失败
	PayFailReason string // 支付失败原因
	CompleteDate  string // 打款时间
	PayPlatform   string // 支付平台，如支付宝
	PayAccount    string // 支付账户
	AccountName   string // 账户姓名
}

//  bobocoinWithdrawalRecordColumns holds the columns for table bobocoin_withdrawal_record.
var bobocoinWithdrawalRecordColumns = BobocoinWithdrawalRecordColumns{
	RecordId:      "record_id",
	TalentId:      "talent_id",
	SubmitDate:    "submit_date",
	DrawAmount:    "draw_amount",
	PayState:      "pay_state",
	PayFailReason: "pay_fail_reason",
	CompleteDate:  "complete_date",
	PayPlatform:   "pay_platform",
	PayAccount:    "pay_account",
	AccountName:   "account_name",
}

// NewBobocoinWithdrawalRecordDao creates and returns a new DAO object for table data access.
func NewBobocoinWithdrawalRecordDao() *BobocoinWithdrawalRecordDao {
	return &BobocoinWithdrawalRecordDao{
		Group:   "default",
		Table:   "bobocoin_withdrawal_record",
		Columns: bobocoinWithdrawalRecordColumns,
	}
}

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