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

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

// YoungeeTalentDeliveryAddressColumns defines and stores column names for table youngee_talent_delivery_address.
type YoungeeTalentDeliveryAddressColumns struct {
	AddressId    string //
	TalentId     string // 达人id(youngee_talent_info表中的id)
	RegionCode   string // 区域码，取info_region表中的self_code字段值
	DetailAddr   string // 详细地址
	PhoneNumber  string // 联系电话
	ReceiverName string // 收货人名字
	DefaultTag   string // 是否默认收货地址
	MailCode     string // 邮政编码
}

//  youngeeTalentDeliveryAddressColumns holds the columns for table youngee_talent_delivery_address.
var youngeeTalentDeliveryAddressColumns = YoungeeTalentDeliveryAddressColumns{
	AddressId:    "address_id",
	TalentId:     "talent_id",
	RegionCode:   "region_code",
	DetailAddr:   "detail_addr",
	PhoneNumber:  "phone_number",
	ReceiverName: "receiver_name",
	DefaultTag:   "default_tag",
	MailCode:     "mail_code",
}

// NewYoungeeTalentDeliveryAddressDao creates and returns a new DAO object for table data access.
func NewYoungeeTalentDeliveryAddressDao() *YoungeeTalentDeliveryAddressDao {
	return &YoungeeTalentDeliveryAddressDao{
		Group:   "default",
		Table:   "youngee_talent_delivery_address",
		Columns: youngeeTalentDeliveryAddressColumns,
	}
}

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