Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 18-Jul-2019 | - | ||||
.gitignore | H A D | 18-Jul-2019 | 130 | 9 | 8 | |
.travis.yml | H A D | 18-Jul-2019 | 25 | 4 | 3 | |
LICENSE | H A D | 18-Jul-2019 | 1 KiB | 22 | 18 | |
README.md | H A D | 18-Jul-2019 | 2.5 KiB | 78 | 55 | |
aligned.go | H A D | 18-Jul-2019 | 2.4 KiB | 74 | 42 | |
comment.go | H A D | 18-Jul-2019 | 4.9 KiB | 166 | 108 | |
enum.go | H A D | 18-Jul-2019 | 4.8 KiB | 192 | 142 | |
extensions.go | H A D | 18-Jul-2019 | 1.9 KiB | 61 | 26 | |
field.go | H A D | 18-Jul-2019 | 6.1 KiB | 239 | 179 | |
formatter.go | H A D | 18-Jul-2019 | 5.8 KiB | 237 | 171 | |
formatter_utils.go | H A D | 18-Jul-2019 | 5.1 KiB | 201 | 139 | |
group.go | H A D | 18-Jul-2019 | 2.7 KiB | 96 | 53 | |
import.go | H A D | 18-Jul-2019 | 2.4 KiB | 84 | 48 | |
message.go | H A D | 18-Jul-2019 | 5.5 KiB | 230 | 182 | |
oneof.go | H A D | 18-Jul-2019 | 4.1 KiB | 155 | 105 | |
option.go | H A D | 18-Jul-2019 | 5.7 KiB | 226 | 170 | |
package.go | H A D | 18-Jul-2019 | 2.1 KiB | 70 | 34 | |
parser.go | H A D | 18-Jul-2019 | 4.4 KiB | 169 | 118 | |
proto.go | H A D | 18-Jul-2019 | 4.3 KiB | 144 | 104 | |
range.go | H A D | 18-Jul-2019 | 2.6 KiB | 91 | 58 | |
reserved.go | H A D | 18-Jul-2019 | 2.2 KiB | 76 | 42 | |
service.go | H A D | 18-Jul-2019 | 6.1 KiB | 255 | 201 | |
syntax.go | H A D | 18-Jul-2019 | 1.9 KiB | 64 | 30 | |
token.go | H A D | 18-Jul-2019 | 4.1 KiB | 209 | 151 | |
visitor.go | H A D | 18-Jul-2019 | 3.4 KiB | 89 | 51 |
README.md
1# proto 2 3[![Build Status](https://travis-ci.org/emicklei/proto.png)](https://travis-ci.org/emicklei/proto) 4[![Go Report Card](https://goreportcard.com/badge/github.com/emicklei/proto)](https://goreportcard.com/report/github.com/emicklei/proto) 5[![GoDoc](https://godoc.org/github.com/emicklei/proto?status.svg)](https://godoc.org/github.com/emicklei/proto) 6 7Package in Go for parsing Google Protocol Buffers [.proto files version 2 + 3] (https://developers.google.com/protocol-buffers/docs/reference/proto3-spec) 8 9This repository also includes 3 commands. The `protofmt` tool is for formatting .proto files. The `proto2xsd` tool is for generating XSD files from .proto version 3 files. The `proto2gql` tool is for generating the GraphQL Schema. 10 11### usage as package 12 13 package main 14 15 import ( 16 "os" 17 18 "github.com/emicklei/proto" 19 ) 20 21 func main() { 22 reader, _ := os.Open("test.proto") 23 defer reader.Close() 24 parser := proto.NewParser(reader) 25 definition, _ := parser.Parse() 26 formatter := proto.NewFormatter(os.Stdout, " ") 27 formatter.Format(definition) 28 } 29 30### usage of proto2xsd command 31 32 > proto2xsd -help 33 Usage of proto2xsd [flags] [path ...] 34 -ns string 35 namespace of the target types (default "http://your.company.com/domain/version") 36 -w write result to an XSD files instead of stdout 37 38See folder `cmd/proto2xsd/README.md` for more details. 39 40### usage of proto2gql command 41 42 > proto2gql -help 43 Usage of proto2gql [flags] [path ...] 44 45 -std_out 46 Writes transformed files to stdout 47 -txt_out string 48 Writes transformed files to .graphql file 49 -go_out string 50 Writes transformed files to .go file 51 -js_out string 52 Writes transformed files to .js file 53 -package_alias value 54 Renames packages using given aliases 55 -resolve_import value 56 Resolves given external packages 57 -no_prefix 58 Disables package prefix for type names 59 60See folder `cmd/proto2gql/README.md` for more details. 61 62### usage of protofmt command 63 64 > protofmt -help 65 Usage of protofmt [flags] [path ...] 66 -w write result to (source) files instead of stdout 67 68See folder `cmd/protofmt/README.md` for more details. 69 70### how to install 71 72 go get -u -v github.com/emicklei/proto 73 74#### known issues 75 76- the proto2 test file in protofmt folder contains character escape sequences that are currently not accepted by the scanner. See line 537 and 573. 77 78© 2017, [ernestmicklei.com](http://ernestmicklei.com). MIT License. Contributions welcome.