gen

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append added in v0.0.7

func Append(s *string, args ...string)

func CamelCase

func CamelCase(s string) string

CamelCase returns the CamelCased name. If there is an interior underscore followed by a lower case letter, drop the underscore and convert the letter to upper case. There is a remote possibility of this rewrite causing a name collision, but it's so remote we're prepared to pretend it's nonexistent - since the C++ generator lowercases names, it's extremely unlikely to have two fields with different capitalizations. In short, _my_field_name_2 becomes XMyFieldName_2.

func DefaultAPIOptions

func DefaultAPIOptions(pkg string, srv string, mth string) *options.HttpRule

DefaultAPIOptions This generates an HttpRule that matches the gRPC mapping to HTTP/2 described in https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests i.e.:

  • method is POST
  • path is "<pkg name>/<service name>/<method name>"
  • body should contain the serialized request message

func DefaultHttpRule

func DefaultHttpRule(name string) *options.HttpRule

func ExtractHttpMethod

func ExtractHttpMethod(opts *options.HttpRule) (method string, path string)

func New

func New(name string, opts ...Opt) *protoGen

func ParseParameter added in v0.0.10

func ParseParameter(args string)

func ParseRequest added in v0.0.10

func ParseRequest(r io.Reader) (*plugin.CodeGeneratorRequest, error)

func SourceCode added in v0.0.10

func SourceCode(buf *bytes.Buffer) (string, error)

func Template added in v0.0.7

func Template(tpl string, m pongo2.Context) string

func UnExport

func UnExport(s string) string

Types

type Context added in v0.0.7

type Context = pongo2.Context

type FileDescriptor

type FileDescriptor struct {
	Pkg string
	*descriptor.FileDescriptorProto
}

func (*FileDescriptor) GetService

func (t *FileDescriptor) GetService() []*Service

type Method

type Method struct {
	InType     string
	OutType    string
	CS         bool
	SS         bool
	Name       string
	HttpMethod string
	HttpPath   string
	DefaultUrl bool
	Srv        string
	Pkg        string
	// contains filtered or unexported fields
}

func (*Method) GetClientStreaming added in v0.0.8

func (t *Method) GetClientStreaming() bool

func (*Method) GetHttpMethod

func (t *Method) GetHttpMethod() (method string, path string, defaultUrl bool)

func (*Method) GetInputType

func (t *Method) GetInputType() string

func (*Method) GetName

func (t *Method) GetName() string

func (*Method) GetOptions added in v0.0.8

func (t *Method) GetOptions() *descriptor.MethodOptions

func (*Method) GetOutputType

func (t *Method) GetOutputType() string

func (*Method) GetServerStreaming added in v0.0.8

func (t *Method) GetServerStreaming() bool

type Opt added in v0.0.8

type Opt = func(opt *opts) error

func OnlyService added in v0.0.9

func OnlyService() Opt

type Service

type Service struct {
	Pkg string
	Srv string
	*descriptor.ServiceDescriptorProto
}

func (*Service) GetMethod

func (t *Service) GetMethod() (methods []*Method)

func (*Service) GetName

func (t *Service) GetName() string

func (*Service) IsDefault added in v0.0.16

func (t *Service) IsDefault() bool

Jump to

Keyboard shortcuts

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