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

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

// RTalentPlatformTableColumns defines and stores column names for table r_talent_platform_table.
type RTalentPlatformTableColumns struct {
	RtId           string // 审核表的主键ID
	Tid            string // 达人id(talent_info表中的id)
	PId            string // 平台id(info_third_platform表中的id)
	PName          string // 平台名称
	PNickname      string // 账号所在平台昵称
	PAccountId     string // 平台对应的ID（达人在所在平台的ID）
	FansCount      string // 达人在平台的粉丝数量
	HomePageUrl    string // 达人的主页链接
	ExamineState   string // 审核状态 1待审核 2审核通过 3审核驳回
	FailReason     string // 审核驳回原因
	ExamineAdminId string // 审核操作管理员id
	CreateDate     string // 创建时间
	ExamineDate    string // 审核时间
	DisableDate    string // 下架时间
	Deleted        string // 是否逻辑删除 0否 1是
}

//  rTalentPlatformTableColumns holds the columns for table r_talent_platform_table.
var rTalentPlatformTableColumns = RTalentPlatformTableColumns{
	RtId:           "rt_id",
	Tid:            "tid",
	PId:            "p_id",
	PName:          "p_name",
	PNickname:      "p_nickname",
	PAccountId:     "p_account_id",
	FansCount:      "fans_count",
	HomePageUrl:    "home_page_url",
	ExamineState:   "examine_state",
	FailReason:     "fail_reason",
	ExamineAdminId: "examine_admin_id",
	CreateDate:     "create_date",
	ExamineDate:    "examine_date",
	DisableDate:    "disable_date",
	Deleted:        "deleted",
}

// NewRTalentPlatformTableDao creates and returns a new DAO object for table data access.
func NewRTalentPlatformTableDao() *RTalentPlatformTableDao {
	return &RTalentPlatformTableDao{
		Group:   "default",
		Table:   "r_talent_platform_table",
		Columns: rTalentPlatformTableColumns,
	}
}

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