Files
iotlcm/internal/dao/internal/mock_order.go
T
MiFaZhan 4e2cd43a55 chore: 初始开源发布
iotlcm-onelink-mock:OneLink 挡板服务(本地测试替身)。

- Go module 迁移至 git.5iot.com/iotlcm-public/iotlcm-onelink-mock
- 修复同毫秒内多次生成卡导致 ICCID/IMSI 唯一约束冲突
- 补 Apache-2.0 LICENSE,README 重写并新增 docs/deploy.md
- 移除内部部署资产(CI 触发器 / 镜像推送脚本 / 指定环境部署文档)
- 测试凭据改为 demo_appid / demo_password,真实手机号与内网 IP 脱敏
- 统一 LF 行尾并加 .gitattributes
2026-10-22 15:08:27 +08:00

98 lines
3.0 KiB
Go

// ==========================================================================
// 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"
)
// MockOrderDao is the data access object for the table mock_order.
type MockOrderDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns MockOrderColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// MockOrderColumns defines and stores column names for the table mock_order.
type MockOrderColumns struct {
Id string //
OrderNum string //
Msisdn string //
Iccid string //
Imsi string //
Type string //
OperType string //
ApnName string //
Status string //
CreatedAt string //
}
// mockOrderColumns holds the columns for the table mock_order.
var mockOrderColumns = MockOrderColumns{
Id: "id",
OrderNum: "order_num",
Msisdn: "msisdn",
Iccid: "iccid",
Imsi: "imsi",
Type: "type",
OperType: "oper_type",
ApnName: "apn_name",
Status: "status",
CreatedAt: "created_at",
}
// NewMockOrderDao creates and returns a new DAO object for table data access.
func NewMockOrderDao(handlers ...gdb.ModelHandler) *MockOrderDao {
return &MockOrderDao{
group: "default",
table: "mock_order",
columns: mockOrderColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *MockOrderDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *MockOrderDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *MockOrderDao) Columns() MockOrderColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *MockOrderDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *MockOrderDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *MockOrderDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}