Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertQueryParams ¶
func GetEnv ¶ added in v0.3.0
GetEnv returns the value of the named environment variable, or fallback when it is unset or empty.
func GetEnvInt ¶ added in v0.3.0
GetEnvInt returns the named environment variable parsed as an int, or fallback when it is unset, empty, or not a valid integer.
func RedisPool ¶ added in v0.3.0
RedisPool builds a redigo connection pool from REDIS_HOST / REDIS_PORT / REDIS_PASS, for use as the backing store of the shared per-client rate limiter (and any other Redis need a service has). It returns nil when REDIS_HOST is unset, so a service with no Redis configured runs without the dependency - callers that require Redis (e.g. ratelimit.Middleware) must treat a nil pool as a fatal misconfiguration, per the fail-closed contract.
Types ¶
type Projection ¶
type QueryParams ¶
type QueryParams struct {
Start int64
Limit int
Sort []Sort
Filter []Filter
Projection []Projection
}
func GetQueryParams ¶
func GetQueryParams(query string) (QueryParams, error)
GetQueryParams parses a raw querystring into paging/sort/filter/projection parameters. It returns an error for a filter that names an operator outside filterOperators, so a list handler can answer 400 instead of silently ignoring or mishandling the filter.