Documentation ¶
Index ¶
- func DecodeValues(msg proto.Message, values url.Values) error
- func EncodeField(fieldDescriptor protoreflect.FieldDescriptor, value protoreflect.Value, ...) (string, error)
- func EncodeFieldMask(m protoreflect.Message, useProtoNames bool) (query string)
- func EncodeValues(msg proto.Message, useProtoNames, useEnumNumbers bool) (url.Values, error)
- type Codec
- func (*Codec) ContentType(_ any) string
- func (c *Codec) Decode(vs url.Values, v any) error
- func (c *Codec) DisableUseEnumNumbers() *Codec
- func (c *Codec) DisableUseProtoNames() *Codec
- func (c *Codec) Encode(v any) (url.Values, error)
- func (c *Codec) EncodeFieldMask(m protoreflect.Message) string
- func (c *Codec) EncodeURL(pathTemplate string, v any, needQuery bool) string
- func (c *Codec) Marshal(v any) ([]byte, error)
- func (c *Codec) NewDecoder(r io.Reader) codec.Decoder
- func (c *Codec) NewEncoder(w io.Writer) codec.Encoder
- func (c *Codec) Unmarshal(data []byte, v any) error
- type MultipartCodec
- type QueryCodec
- type UriCodec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeValues ¶
DecodeValues decode url value into proto message.
func EncodeField ¶
func EncodeField(fieldDescriptor protoreflect.FieldDescriptor, value protoreflect.Value, useEnumNumbers bool) (string, error)
EncodeField encode proto message filed
func EncodeFieldMask ¶
func EncodeFieldMask(m protoreflect.Message, useProtoNames bool) (query string)
EncodeFieldMask return field mask name=paths
Types ¶
type Codec ¶
type Codec struct { Encoder *form.Encoder Decoder *form.Decoder TagName string // UseProtoNames uses proto field name instead of // lowerCamelCase name in JSON field names. UseProtoNames bool // UseEnumNumbers emits enum values as numbers. UseEnumNumbers bool }
func (*Codec) ContentType ¶
ContentType always Returns "application/x-www-form-urlencoded; charset=utf-8"
func (*Codec) DisableUseEnumNumbers ¶
DisableUseProtoNames disable emits enum values as numbers.
func (*Codec) DisableUseProtoNames ¶
DisableUseProtoNames disable proto field name, use lowerCamelCase name in JSON field names.
func (*Codec) EncodeFieldMask ¶
func (c *Codec) EncodeFieldMask(m protoreflect.Message) string
EncodeFieldMask return field mask name=paths
func (*Codec) EncodeURL ¶
EncodeURL encode msg to url path. pathTemplate is a template of url path like http://helloworld.dev/{name}/sub/{sub.name},
type MultipartCodec ¶
type MultipartCodec struct {
*Codec
}
func (*MultipartCodec) ContentType ¶
func (*MultipartCodec) ContentType(_ any) string
type QueryCodec ¶
type QueryCodec struct {
*Codec
}
func (*QueryCodec) ContentType ¶
func (*QueryCodec) ContentType(_ any) string
Click to show internal directories.
Click to hide internal directories.