Documentation
¶
Index ¶
- func FieldGoType(g *protogen.GeneratedFile, field *protogen.Field) (goType []any, pointer bool)
- func FindField(name string, inMessage *protogen.Message) *protogen.Field
- func FullFieldName(fields []*protogen.Field) string
- type Endpoint
- func (e *Endpoint) Body() string
- func (e *Endpoint) DescName() string
- func (e *Endpoint) FullName() string
- func (e *Endpoint) HttpRule() *annotations.HttpRule
- func (e *Endpoint) Input() *protogen.Message
- func (e *Endpoint) InputGoIdent() protogen.GoIdent
- func (e *Endpoint) IsStreaming() bool
- func (e *Endpoint) Method() string
- func (e *Endpoint) Name() string
- func (e *Endpoint) Output() *protogen.Message
- func (e *Endpoint) OutputGoIdent() protogen.GoIdent
- func (e *Endpoint) ParseParameters() (*protogen.Message, *protogen.Field, []*protogen.Field, []*protogen.Field, ...)
- func (e *Endpoint) Path() string
- func (e *Endpoint) PathParameters() ([]string, error)
- func (e *Endpoint) Pattern() *Pattern
- func (e *Endpoint) ResponseBody() string
- func (e *Endpoint) SetHttpRule()
- func (e *Endpoint) SetPattern(pattern *Pattern)
- func (e *Endpoint) Unexported(s string) string
- type Pattern
- type Segment
- type Service
- func (s *Service) AppendRouteName() string
- func (s *Service) ClientName() string
- func (s *Service) FullName() string
- func (s *Service) HandlerName() string
- func (s *Service) Name() string
- func (s *Service) NewClientName() string
- func (s *Service) RequestDecoderName() string
- func (s *Service) RequestEncoderName() string
- func (s *Service) ResponseDecoderName() string
- func (s *Service) ResponseEncoderName() string
- func (s *Service) ServiceName() string
- func (s *Service) Unexported(name string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldGoType ¶
FieldGoType returns the Go type used for a field.
If it returns pointer=true, the struct field is a pointer to the type.
func FullFieldName ¶
Types ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func (*Endpoint) HttpRule ¶
func (e *Endpoint) HttpRule() *annotations.HttpRule
func (*Endpoint) InputGoIdent ¶
func (*Endpoint) IsStreaming ¶
func (*Endpoint) OutputGoIdent ¶
func (*Endpoint) ParseParameters ¶
func (*Endpoint) PathParameters ¶
func (*Endpoint) ResponseBody ¶
func (*Endpoint) SetHttpRule ¶
func (e *Endpoint) SetHttpRule()
func (*Endpoint) SetPattern ¶
func (*Endpoint) Unexported ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
A Pattern is something that can be matched against an HTTP request. It has an optional method, an optional host, and a path.
func ParsePattern ¶
parsePattern parses a string into a Pattern. The string's syntax is
[METHOD] [HOST]/[PATH]
where:
- METHOD is an HTTP method
- HOST is a hostname
- PATH consists of slash-separated segments, where each segment is either a literal or a wildcard of the form "{name}", "{name...}", or "{$}".
METHOD, HOST and PATH are all optional; that is, the string can be "/". If METHOD is present, it must be followed by a single space. Wildcard names must be valid Go identifiers. The "{$}" and "{name...}" wildcard must occur at the end of PATH. PATH may end with a '/'. Wildcard names in a path must be distinct.
type Segment ¶
type Segment struct {
// contains filtered or unexported fields
}
A Segment is a pattern piece that matches one or more path segments, or a trailing slash.
If wild is false, it matches a literal Segment, or, if s == "/", a trailing slash. Examples:
"a" => Segment{s: "a"}
"/{$}" => Segment{s: "/"}
If wild is true and multi is false, it matches a single path Segment. Example:
"{x}" => Segment{s: "x", wild: true}
If both wild and multi are true, it matches all remaining path segments. Example:
"{rest...}" => Segment{s: "rest", wild: true, multi: true}