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

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

// YoungeePlatformAccountInfoColumns defines and stores column names for table youngee_platform_account_info.
type YoungeePlatformAccountInfoColumns struct {
	AccountId          string //
	TalentId           string // 达人账号id(youngee_talent_info表id值)
	PlatformId         string // 平台id，与third_platform_info中的id相同
	PlatformNickname   string // 在平台上的昵称
	HomePageUrl        string // 主页链接
	FansCount          string // 粉丝数
	HomePageCaptureUrl string // 主页截图链接
	BindDate           string // 绑定时间
	Deleted            string // 是否被解绑
	UpdatedAt          string // 更新时间
	UpdatedPerson      string // 更新人，0代表本人，1代表管理员
	UpdatedAdminId     string // 上一次更新的管理员id
}

//  youngeePlatformAccountInfoColumns holds the columns for table youngee_platform_account_info.
var youngeePlatformAccountInfoColumns = YoungeePlatformAccountInfoColumns{
	AccountId:          "account_id",
	TalentId:           "talent_id",
	PlatformId:         "platform_id",
	PlatformNickname:   "platform_nickname",
	HomePageUrl:        "home_page_url",
	FansCount:          "fans_count",
	HomePageCaptureUrl: "home_page_capture_url",
	BindDate:           "bind_date",
	Deleted:            "deleted",
	UpdatedAt:          "updated_at",
	UpdatedPerson:      "updated_person",
	UpdatedAdminId:     "updated_admin_id",
}

// NewYoungeePlatformAccountInfoDao creates and returns a new DAO object for table data access.
func NewYoungeePlatformAccountInfoDao() *YoungeePlatformAccountInfoDao {
	return &YoungeePlatformAccountInfoDao{
		Group:   "default",
		Table:   "youngee_platform_account_info",
		Columns: youngeePlatformAccountInfoColumns,
	}
}

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