Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 618 Bytes

readme.md

File metadata and controls

41 lines (27 loc) · 618 Bytes

mysql-protobuf

每次将数据库映射为 protobuf,是一项繁重有重复的工作

这是一个快速将 sql schema 转化为 protobuf 的 cli 工具

安装

npm install mysql-protobuf -g

CLI usage Example

$ mysql-protobuf [input-file]

$ mysql-protobuf schema.sql > schema.proto


  ----- print -----
  syntax = "proto3";

  message core {
    int32 uid = 1;
    int32 cid = 2;
    int32 no = 3;
    string nickname = 4;
  }

JS usage

var convert = require('mysql-protobuf')
var file = fs.readFileSync('schema.sql').toString()
console.log(convert(file))

npm publish