golang thirft

p_gerer · · 417 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

mac安装

brew install thirft

查看命令帮助

thirft --help
  -o  path Set the output directory for gen-* packages (default: current directory)
  -out dirname    Set the ouput location for generated files.(no gen-* folder will be created)
  -I dir      Add a directory to the list of directories
                searched for include directives
  -strict     Strict compiler warnings on
  -v[erbose]  Verbose mode
  -r[ecurse]  Also generate included files
  -debug      Parse debug trace to stdout
  --allow-neg-keys  Allow negative field keys (Used to preserve protocol
                compatibility with older .thrift files)
  --allow-64bit-consts  Do not print warnings about using 64-bit constants
  --gen STR   Generate code with a dynamically-registered generator.
                (这里描述的是下面语言相关的附加参数的使用方式)
                STR has the form language[:key1=val1[,key2[,key3=val3]]].
                Keys and values are options passed to the generator.
                Many options will not require values.
  go (Go):
    package_prefix=  Package prefix for generated files. 生成文件的包前缀(有用)
    thrift_import=   Override thrift package import path (default:github.com/apache/thrift/lib/go/thrift) 重写
    package=           Package name (default: inferred from thrift file name) 重写gen包名 
    ignore_initialisms Disable automatic spelling correction of initialisms (e.g. "URL")
    read_write_private Make read/write methods private, default is public Read/Write
    注:额外命令使用方式 thrift --gen go:package_prefix=ownprefix,thrift_import=xxxxxx -o rpcgo demo.thrift

有疑问加站长微信联系(非本文作者)

本文来自:简书

感谢作者:p_gerer

查看原文:golang thirft

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

417 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传