Documentation ¶
Overview ¶
Package form provides HTTP form <> protobuf encoding/decoding.
Index ¶
- Constants
- func DecodeValues(msg proto.Message, values url.Values) error
- func EncodeField(fieldDescriptor protoreflect.FieldDescriptor, value protoreflect.Value) (string, error)
- func EncodeFieldMask(m protoreflect.Message) (query string)
- type Form
- func (c Form) ContentTypes() []string
- func (c Form) Decode(data []byte, v any) error
- func (Form) Decodes(v any) bool
- func (c Form) Encode(v any) ([]byte, error)
- func (c Form) EncodeValues(msg interface{}) (url.Values, error)
- func (Form) Encodes(v any) bool
- func (c Form) Exts() []string
- func (c Form) NewDecoder(r io.Reader) codecs.Decoder
- func (c Form) NewEncoder(w io.Writer) codecs.Encoder
- func (Form) String() string
Constants ¶
const ( // Name is form codec name. Name = "form" // ContentType used by HTTP forms. ContentType = "application/x-www-form-urlencoded" )
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) (string, error)
EncodeField encode proto message filed.
func EncodeFieldMask ¶
func EncodeFieldMask(m protoreflect.Message) (query string)
EncodeFieldMask return field mask name=paths.
Types ¶
type Form ¶
type Form struct {
// contains filtered or unexported fields
}
Form is used to encode/decode HTML form values as used in GET request URL query parameters or POST request bodies.
func NewFormCodec ¶
func NewFormCodec() *Form
NewFormCodec will create a codec used to encode/decode HTML form values as used in GET request URL query parameters or POST request bodies.
func (Form) ContentTypes ¶
ContentTypes returns the Content-Type which this marshaler is responsible for. The parameter describes the type which is being marshaled, which can sometimes affect the content type returned.
func (Form) EncodeValues ¶
EncodeValues encode a message into url values.
func (Form) Exts ¶
Exts is a list of file extensions this encoder supports. Since the form codec is only used for request marshaling, no file extensions are supported.
func (Form) NewDecoder ¶
NewDecoder returns a Decoder which reads byte sequence from "r".
func (Form) NewEncoder ¶
NewEncoder returns an Encoder which writes bytes sequence into "w".