query

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchKey = errors.New("no entry by the key")

Functions

This section is empty.

Types

type Params added in v0.15.0

type Params = *keyvalue.Storage

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query is a lazy structure for accessing URI parameters. Its laziness is defined by the fact that parameters won't be parsed until requested

func NewQuery

func NewQuery(underlying *keyvalue.Storage) *Query

func (*Query) Get

func (q *Query) Get(key string) (value string, err error)

Get is responsible for getting a key from query. In case this method is called a first time since rawQuery was set (or not set at all), rawQuery bytearray will be parsed and value returned (or ErrNoSuchKey instead). In case of invalid query bytearray, ErrBadQuery will be returned

func (*Query) Raw

func (q *Query) Raw() []byte

Raw just returns a raw value of query as it is

func (*Query) Set

func (q *Query) Set(raw []byte)

Set is responsible for setting a raw value of query. Each call resets parsedQuery value to nil (query bytearray must be parsed again)

func (*Query) Unwrap added in v0.15.0

func (q *Query) Unwrap() (Params, error)

Unwrap returns all query parameters. If error occurred, nil parameters will be returned

Jump to

Keyboard shortcuts

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