Skip to content

Commit 2a06c45

Browse files
committed
0
1 parent ca474f9 commit 2a06c45

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,28 @@ func main() {
3131
### goframe2.0+使用方法
3232
在manifeat/config/config.yaml配置
3333
~~~
34+
_ "github.com/logoove/go/sqlite" //加在internal\cmd\cmd.go文件中
35+
3436
# 数据库连接配置
3537
database:
3638
default:
3739
type: "sqlite"
3840
link: "./resource/db.db" #数据库路径根据自己的填写
3941
debug: true
4042
~~~
43+
44+
### goframe2.0+ 非配置
45+
~~~
46+
"github.com/gogf/gf/v2/database/gdb"
47+
_ "github.com/logoove/go/sqlite" //这是专门用于goframe2.0以上的驱动, 单文件写在main.go中, mvc架构放在internal\cmd\cmd.go
48+
49+
db, _ := gdb.New(gdb.ConfigNode{
50+
Link: "sqlite::@file(xx/db.db)", //支持相对路径和绝对路径
51+
})
52+
db.SetDebug(true) //可以显示sql语句
53+
list, _ := db.Model("zanzhu").Where("1=1").Order("id desc").Limit(page, pagesize).All() //简单查询, 可以不用建立数据表结构体
54+
55+
~~~
4156
### 更新日志
4257
2023-10-09 v1.16.1 修复对goframe支持,更新到gitlab.com/cznic/sqlite最新1.26同步.对于goframe2以下版本可能不能使用.
4358

0 commit comments

Comments
 (0)