sqlite database connector
Go to file
2023-09-16 20:21:42 +08:00
.gitignore first commit 2023-09-11 00:07:03 +08:00
autogen_model_model.go first commit 2023-09-11 00:07:03 +08:00
delete_scope_test.go feat: support crud 2023-09-16 18:09:34 +08:00
delete_scope.go fix: sdbc to Driver 2023-09-16 20:21:42 +08:00
errors.go feat: support crud 2023-09-16 18:09:34 +08:00
find_scope_test.go feat: support crud 2023-09-16 18:09:34 +08:00
find_scope.go fix: sdbc to Driver 2023-09-16 20:21:42 +08:00
go.mod feat: support crud 2023-09-16 18:09:34 +08:00
go.sum feat: support crud 2023-09-16 18:09:34 +08:00
insert_scope_test.go feat: support crud 2023-09-16 18:09:34 +08:00
insert_scope.go fix: sdbc to Driver 2023-09-16 20:21:42 +08:00
model.pb.go fix: sdbc to Driver 2023-09-16 20:21:42 +08:00
model.proto first commit 2023-09-11 00:07:03 +08:00
README.md feat: auto create table 2023-09-11 00:13:23 +08:00
scope.go fix: sdbc to Driver 2023-09-16 20:21:42 +08:00
sdbc.go fix: sdbc to Driver 2023-09-16 20:21:42 +08:00
update_scope_test.go feat: support crud 2023-09-16 18:09:34 +08:00
update_scope.go fix: sdbc to Driver 2023-09-16 20:21:42 +08:00

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)
}