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

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

// TalentInfoColumns defines and stores column names for table talent_info.
type TalentInfoColumns struct {
	Id                string //
	TalentWxOpenid    string // 达人的微信openid
	TalentWxNickname  string // 达人的微信昵称
	TalentWxNumber    string // 达人微信号
	TalentGender      string // 性别，0未知 1男 2女
	TalentPhoneNumber string // 电话号码
	TalentAgeBracket  string // 年龄段，取tallent_age_bracket表id
	TalentSkinType    string // 肤质，取tallent_skin_type表的id
	TalentNationality string // 国籍，取tallent_nationality表id
	VisitStoreRegion  string // 探店区域，取region_info表中的self_code
	ApprovalStatus    string // 审核状态 0提交未审核 1审核通过 2审核失败
	ApprovalDate      string // 审核时间
	Enabled           string // 是否上架(激活)
	EnabledDate       string // 上架(激活)时间
	InBlacklist       string // 是否加入黑名单 0否 1是
	CreateDate        string // 创建时间
	LastLoginDate     string // 最后登录时间
	AliName           string // 支付宝姓名
	AliAccount        string // 支付宝账号
}

//  talentInfoColumns holds the columns for table talent_info.
var talentInfoColumns = TalentInfoColumns{
	Id:                "id",
	TalentWxOpenid:    "talent_wx_openid",
	TalentWxNickname:  "talent_wx_nickname",
	TalentWxNumber:    "talent_wx_number",
	TalentGender:      "talent_gender",
	TalentPhoneNumber: "talent_phone_number",
	TalentAgeBracket:  "talent_age_bracket",
	TalentSkinType:    "talent_skin_type",
	TalentNationality: "talent_nationality",
	VisitStoreRegion:  "visit_store_region",
	ApprovalStatus:    "approval_status",
	ApprovalDate:      "approval_date",
	Enabled:           "enabled",
	EnabledDate:       "enabled_date",
	InBlacklist:       "in_blacklist",
	CreateDate:        "create_date",
	LastLoginDate:     "last_login_date",
	AliName:           "ali_name",
	AliAccount:        "ali_account",
}

// NewTalentInfoDao creates and returns a new DAO object for table data access.
func NewTalentInfoDao() *TalentInfoDao {
	return &TalentInfoDao{
		Group:   "default",
		Table:   "talent_info",
		Columns: talentInfoColumns,
	}
}

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