• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..18-Jul-2019-

.gitignoreH A D18-Jul-2019130 98

.travis.ymlH A D18-Jul-201925 43

LICENSEH A D18-Jul-20191 KiB2218

README.mdH A D18-Jul-20192.5 KiB7855

aligned.goH A D18-Jul-20192.4 KiB7442

comment.goH A D18-Jul-20194.9 KiB166108

enum.goH A D18-Jul-20194.8 KiB192142

extensions.goH A D18-Jul-20191.9 KiB6126

field.goH A D18-Jul-20196.1 KiB239179

formatter.goH A D18-Jul-20195.8 KiB237171

formatter_utils.goH A D18-Jul-20195.1 KiB201139

group.goH A D18-Jul-20192.7 KiB9653

import.goH A D18-Jul-20192.4 KiB8448

message.goH A D18-Jul-20195.5 KiB230182

oneof.goH A D18-Jul-20194.1 KiB155105

option.goH A D18-Jul-20195.7 KiB226170

package.goH A D18-Jul-20192.1 KiB7034

parser.goH A D18-Jul-20194.4 KiB169118

proto.goH A D18-Jul-20194.3 KiB144104

range.goH A D18-Jul-20192.6 KiB9158

reserved.goH A D18-Jul-20192.2 KiB7642

service.goH A D18-Jul-20196.1 KiB255201

syntax.goH A D18-Jul-20191.9 KiB6430

token.goH A D18-Jul-20194.1 KiB209151

visitor.goH A D18-Jul-20193.4 KiB8951

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.