proto

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPackageName

func GetPackageName(plugin *protogen.Plugin) (string, error)

func GetProtoFile

func GetProtoFile(plugin *protogen.Plugin) (*protogen.File, error)

func GetProtoFilePath

func GetProtoFilePath(plugin *protogen.Plugin) (string, error)

Types

type FieldAttribute

type FieldAttribute struct {
	Name      string
	Attribute string
}

func GetFieldAttributes

func GetFieldAttributes(plugin *protogen.Plugin) []*FieldAttribute

type Method

type Method struct {
	Name   string
	Input  *MethodMessage
	Output *MethodMessage
	// contains filtered or unexported fields
}

func (*Method) BodyArgumentName

func (m *Method) BodyArgumentName() string

BodyArgumentName gives the variable name of the body.

func (*Method) BodyArgumentType

func (m *Method) BodyArgumentType() string

BodyArgumentType gives the variable type of the body.

func (*Method) HasAuthentication

func (m *Method) HasAuthentication() bool

HasAuthentication returns true or false if the current Method has authentication enabled or not.

func (*Method) HasBody

func (m *Method) HasBody() bool

HasBody returns true or false if the current Method needs to parse the request body or not.

func (*Method) HttpMethod

func (m *Method) HttpMethod() string

func (*Method) IsHttp

func (m *Method) IsHttp() bool

func (*Method) NeedsInitializeInput

func (m *Method) NeedsInitializeInput() bool

NeedsInitializeInput returns true or false if the method input struct must be built using path and body parameters.

func (*Method) PathParameters

func (m *Method) PathParameters() []*Parameter

PathParameters gives a slice of parameters that must be read from the the request URL path.

func (*Method) QueryParameters

func (m *Method) QueryParameters() []*Parameter

QueryParameters gives a slice of parameters that must be read from the the request URL as query parameters.

func (*Method) RocketEndpoint

func (m *Method) RocketEndpoint() string

RocketEndpoint converts the method endpoint to the rocket syntax.

type MethodMessage

type MethodMessage struct {
	Name       string
	Parameters []*Parameter
}

type Parameter

type Parameter struct {
	GoName    string
	ProtoName string
	Location  ParameterLocation
	// contains filtered or unexported fields
}

func (*Parameter) BodyInitCall

func (p *Parameter) BodyInitCall() string

func (*Parameter) RustType

func (p *Parameter) RustType() string

RustType gives the rust type of the parameter

type ParameterLocation

type ParameterLocation int32
const (
	ParameterLocation_Header ParameterLocation = iota
	ParameterLocation_Path
	ParameterLocation_Query
	ParameterLocation_Body
)

func (ParameterLocation) String

func (p ParameterLocation) String() string

type Spec

type Spec struct {
	AppName     string
	PackageName string
	ServiceName string
	Methods     []*Method
}

func Parse

func Parse(plugin *protogen.Plugin) (*Spec, error)

Jump to

Keyboard shortcuts

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