嵌入式数据库storm的使用
storm是一个使用BoltDB的上层orm框架
地址: 数据查看工具 : https://github.com/br0xen/boltbrowser 驱动 : https://github.com/asdine/storm 初始化 db, err := storm.Open("my.db") defer db.Close() 定义对象模型 type User struct { ID int // primary key Group string `storm:"index"` // this field will be indexed Email string `storm:"unique"` // this field will be indexed with a unique constraint Name string // this field will not be indexed Age int `storm:"index"` } 自增可以在主键上添加tag: storm:"id,increment=2" =2是自增步长
Continue reading...