4e2cd43a55
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
30 lines
549 B
Go
30 lines
549 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
_ "github.com/gogf/gf/contrib/drivers/sqlite/v2"
|
|
"github.com/gogf/gf/v2/database/gdb"
|
|
)
|
|
|
|
func main() {
|
|
schema, err := os.ReadFile("manifest/sql/schema.sql")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if err = gdb.AddConfigNode(gdb.DefaultGroupName, gdb.ConfigNode{
|
|
Type: "sqlite",
|
|
Link: "sqlite::@file(./data/codegen.db)",
|
|
}); err != nil {
|
|
panic(err)
|
|
}
|
|
db, err := gdb.NewByGroup()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if _, err = db.Exec(context.Background(), string(schema)); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|