querystring

package module
v0.0.0-...-a238571 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 8 Imported by: 30

README

QueryString

A Go library for unmarshaling URL query strings into structs. It provides an opinionated and simple approach designed primarily for mapping Eolymp REST API requests to gRPC protobuf messages.

Simple types are mapped directly to query parameter values, while complex types are JSON-encoded as single parameter values. Slices are mapped to repeated query parameters with the same key.

For example, a simple list request might be represented using the following structure:

type ListUsersRequest struct {
	Offset       int
	SearchQuery  string
	Filters      []FilterExpression
}

This library would map this request to the query:

?Offset=1&SearchQuery=jose&Filters={"field":"nickname","equals":"jose"}

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(q url.Values, msg proto.Message) error

func UnmarshalStrict

func UnmarshalStrict(q url.Values, msg proto.Message) error

Types

type UnmarshalOptions

type UnmarshalOptions struct {
	ProtoOptions protojson.UnmarshalOptions
}

func (UnmarshalOptions) Unmarshal

func (u UnmarshalOptions) Unmarshal(query url.Values, msg proto.Message) error

Jump to

Keyboard shortcuts

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