protoc-gen-ts

command module
v0.0.0-...-48320cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

README

protoc-gen-ts

Typescript support for Protocol Buffers

// ** USAGE: // go get github.com/enjoypi/protoc-gen-ts // cd $YOUR_GOPATH/src/github.com/enjoypi/protoc-gen-ts // go install && protoc --ts_out=. languages.proto // ** it will generate a languages.ts file

// languages.proto syntax = "proto3";

package proto;

message Languages { string en = 1; // English string es = 2; // Spanish string de = 3; // German string fr = 4; // French string it = 5; // Italian string ja = 6; // Japanese string ko = 7; // Korean string pt = 8; // Portuguese string zhs = 9; // zh-Hans Simplified Chinese string zht = 10; // zh-Hant Traditional Chinese string ru = 11; // Russian }

// languages.ts

export class Languages { en: string; es: string; de: string; fr: string; it: string; ja: string; ko: string; pt: string; zhs: string; zht: string; ru: string;

constructor() {
	this.en = "";
	this.es = "";
	this.de = "";
	this.fr = "";
	this.it = "";
	this.ja = "";
	this.ko = "";
	this.pt = "";
	this.zhs = "";
	this.zht = "";
	this.ru = "";
}

}

interface LanguagesConstructor { new (): Languages; }

Documentation

Overview

protoc-gen-ts is a plugin for the Google protocol buffer compiler to generate Go code. Run it by building this program and putting it in your path with the name

protoc-gen-ts

That word 'go' at the end becomes part of the option string set for the protocol compiler, so once the protocol compiler (protoc) is installed you can run

protoc --go_out=output_directory input_directory/file.proto

to generate Go bindings for the protocol defined by file.proto. With that input, the output will be written to

output_directory/file.ts

The generated code is documented in the package comment for the library.

See the README and documentation for protocol buffers to learn more:

https://developers.google.com/protocol-buffers/

Directories

Path Synopsis
The code generator for the plugin for the Google protocol buffer compiler.
The code generator for the plugin for the Google protocol buffer compiler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL