schemabuf MySQL 结构转 protobuf 模型 schemabuf

polaris • 1876 次点击    
这是一个分享于 的项目,其中的信息可能已经有所发展或是发生改变。
schemabuf 可以根据 MySQL 的表结构来生成 [ProtocolBuffers](http://www.oschina.net/p/protocol+buffers) 对应的模型。 使用方法: <pre class="brush:shell;toolbar: true; auto-links: false;">$ schemabuf -h Usage of schemabuf:   -db string         the database type (default &#34;mysql&#34;)   -host string         the database host (default &#34;localhost&#34;)   -password string         the database password (default &#34;root&#34;)   -port int         the database port (default 3306)   -schema string         the database schema (default &#34;db_name&#34;)   -user string         the database user (default &#34;root&#34;)</pre> Go 语言调用: <pre class="brush:cpp ;toolbar: true; auto-links: false;">import &#34;github.com/mcos/schemabuf&#34; func main() {     connStr := config.get(&#34;dbConnStr&#34;)     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)     } }</pre>
授权协议:
MIT
开发语言:
Google Go 查看源码»
操作系统:
跨平台
1876 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传