文件名称:MySQL结构转protobuf模型schemabuf.zip
文件大小:6KB
文件格式:ZIP
更新时间:2022-08-07 20:12:17
开源项目
schemabuf 可以根据 MySQL 的表结构来生成 ProtocolBuffers 对应的模型。使用方法:$ schemabuf -h Usage of schemabuf: -db string the database type (default "mysql") -host string the database host (default "localhost") -password string the database password (default "root") -port int the database port (default 3306) -schema string the database schema (default "db_name") -user string the database user (default "root")Go 语言调用:import "github.com/mcos/schemabuf" func main() { connStr := config.get("dbConnStr") db, err := sql.Open(*dbType, connStr) if err != nil { log.Fatal(err) } defer db.Close() s, err := schemabuf.GenerateSchema(db) if nil != err { log.Fatal(err) } if nil != s { fmt.Println(s) } } 标签:schemabuf
【文件预览】:
schemabuf-master
----main.go(1KB)
----schemabuf()
--------schemabuf.go(10KB)
----glide.yaml(166B)
----LICENSE(1KB)
----README.md(1KB)
----.gitignore(266B)