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

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

// TalentPayAccountInfoColumns defines and stores column names for table talent_pay_account_info.
type TalentPayAccountInfoColumns struct {
	Id           string //                              
    PayPlatform  string // 支付平台，如支付宝           
    PayAccount   string // 支付账户                     
    AccountName  string // 账户姓名                     
    TalentId     string // 达人id(talent_info表中的id)
}

//  talentPayAccountInfoColumns holds the columns for table talent_pay_account_info.
var talentPayAccountInfoColumns = TalentPayAccountInfoColumns{
	Id:          "id",            
            PayPlatform: "pay_platform",  
            PayAccount:  "pay_account",   
            AccountName: "account_name",  
            TalentId:    "talent_id",
}

// NewTalentPayAccountInfoDao creates and returns a new DAO object for table data access.
func NewTalentPayAccountInfoDao() *TalentPayAccountInfoDao {
	return &TalentPayAccountInfoDao{
		Group:   "default",
		Table:   "talent_pay_account_info",
		Columns: talentPayAccountInfoColumns,
	}
}

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