protoutil

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

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

func Camel2Case added in v0.1.24

func Camel2Case(name string) string

Camel2Case 驼峰式写法转为下划线写法

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 ExtractAPIOptions

func ExtractAPIOptions(mth protoreflect.MethodDescriptor) (*options.HttpRule, error)

func ExtractHttpMethod

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

func Import

func Import(name string) func(id string) protogen.GoIdent

func NewList

func NewList(vv []interface{}) abc.Value

func NewStruct

func NewStruct(v map[string]interface{}) abc.Value

func NewValue

func NewValue(rv interface{}) abc.Value

func ParseParameter

func ParseParameter(args string)

func ParseRequest

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

func SourceCode

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

func Template

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

func UnExport

func UnExport(s string) string

func Zero

func Zero(rv interface{}) (interface{}, error)

Types

type Context

type Context = pongo2.Context

type GenWrap

type GenWrap struct {
	// contains filtered or unexported fields
}

func NewGenWrap

func NewGenWrap(g *protogen.GeneratedFile) *GenWrap

func (*GenWrap) Fmt

func (t *GenWrap) Fmt(tpl string, m pongo2.Context)

Jump to

Keyboard shortcuts

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