sqlite database connector
.gitignore | ||
autogen_model_model.go | ||
go.mod | ||
go.sum | ||
insert_scope_test.go | ||
insert_scope.go | ||
model.pb.go | ||
model.proto | ||
README.md | ||
scope.go | ||
sdbc.go |
sdbc
sdbc: sqlite database connector
项目命名为sdbc 一个sqlite数据库orm,对官方驱动进行封装,将protobuf的Message和sqlite的Model进行绑定,实现对Message的操作可以同步到数据库中
todo
- 完成初始化程序
- 封装CRUD
usage
package main
import (
"time"
"gitter.top/drivers/sdbc"
)
func main() {
var driver = NewSDBC(&Config{
Dbname: "test.db",
MaxIdleConn: 10,
MaxOpenConn: 100,
MaxLifetime: time.Hour,
}).BindModel(&ModelArticles{})
var doc = &ModelArticles{
Title: "hello world",
CreateTime: time.Now().Unix(),
}
err = driver.Insert().InsertOne(doc)
assert.NoError(t, err)
t.Logf("doc id: %v", doc.Id)
}