Documentation
¶
Index ¶
- func Decode(vs url.Values, v any) error
- func DecodeValues(msg proto.Message, values url.Values) error
- func Encode(v any) (url.Values, error)
- func EncodeField(fieldDescriptor protoreflect.FieldDescriptor, value protoreflect.Value) (string, error)
- func EncodeURL(pathTemplate string, msg any, needQuery bool) string
- func EncodeValues(msg proto.Message) (url.Values, error)
- func Marshal(v any) ([]byte, error)
- func Name() string
- func ReplaceDefaultCodec(codec Codec)
- func Unmarshal(data []byte, v any) error
- type Codec
- func (c Codec) Decode(vs url.Values, v any) error
- func (c Codec) Encode(v any) (url.Values, error)
- func (c Codec) EncodeURL(pathTemplate string, msg any, needQuery bool) string
- func (c Codec) Marshal(v any) ([]byte, error)
- func (Codec) Name() string
- func (c Codec) Unmarshal(data []byte, v any) error
- type Option
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) (string, error)
EncodeField encode proto message filed
func EncodeValues ¶
EncodeValues encode a message into url values.
func ReplaceDefaultCodec ¶
func ReplaceDefaultCodec(codec Codec)
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
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 Option ¶
type Option func(*Codec)
func WithDecoder ¶
func WithDecoder(decoder *form.Decoder) Option
func WithDisableProto ¶
func WithDisableProto() Option
func WithEncoder ¶
func WithEncoder(encoder *form.Encoder) Option
func WithTagName ¶
Click to show internal directories.
Click to hide internal directories.