// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================

package internal

import (
	"context"

	"github.com/gogf/gf/v2/database/gdb"
	"github.com/gogf/gf/v2/frame/g"
)

// V2OrderNotifyLogDao is the data access object for table order_notify_log.
type V2OrderNotifyLogDao 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 V2OrderNotifyLogColumns // columns contains all the column names of Table for convenient usage.
}

// V2OrderNotifyLogColumns defines and stores column names for table order_notify_log.
type V2OrderNotifyLogColumns struct {
	Id        string // 主键，自增
	OrderId   string // 系统订单id
	Status    string // 状态字段
	Num       string // 回调次数
	Url       string // 回调的url
	Response  string // 回调返回的结果
	CreatedAt string // 创建时间
	UpdatedAt string // 更新时间
	DeletedAt string // 删除时间
}

// v2OrderNotifyLogColumns holds the columns for table order_notify_log.
var v2OrderNotifyLogColumns = V2OrderNotifyLogColumns{
	Id:        "id",
	OrderId:   "order_id",
	Status:    "status",
	Num:       "num",
	Url:       "url",
	Response:  "response",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
	DeletedAt: "deleted_at",
}

// NewV2OrderNotifyLogDao creates and returns a new DAO object for table data access.
func NewV2OrderNotifyLogDao() *V2OrderNotifyLogDao {
	return &V2OrderNotifyLogDao{
		group:   "default",
		table:   "order_notify_log",
		columns: v2OrderNotifyLogColumns,
	}
}

// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *V2OrderNotifyLogDao) DB() gdb.DB {
	return g.DB(dao.group)
}

// Table returns the table name of current dao.
func (dao *V2OrderNotifyLogDao) Table() string {
	return dao.table
}

// Columns returns all column names of current dao.
func (dao *V2OrderNotifyLogDao) Columns() V2OrderNotifyLogColumns {
	return dao.columns
}

// Group returns the configuration group name of database of current dao.
func (dao *V2OrderNotifyLogDao) Group() string {
	return dao.group
}

// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *V2OrderNotifyLogDao) 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 *V2OrderNotifyLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}
