validate

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ISO8601Date

func ISO8601Date(v string) bool

ISO8601Date validates ISO 8601 date format `yyyy-mm-dd`.

func RequestQueryStringLimitParam added in v0.0.22

func RequestQueryStringLimitParam(v string, maxLimit int) (int, bool)

RequestQueryStringLimitParam converts incoming `limit` parameter (v) to a valid `int` type. If the value is empty, `10` is returned as default.

func RequestQueryStringOrderParam added in v0.0.22

func RequestQueryStringOrderParam(v string, allowed map[string]string) (map[int]string, bool)

RequestQueryStringOrderParam extracts comma separated fields from the `order` parameter (v), iterates and compares them against the allowed set of fields (allowed). Empty `order` parameter is considered as a valid input. Any empty field, duplicated field and non-matching field are all considered as an invalid input.

func RequestQueryStringPageParam added in v0.0.22

func RequestQueryStringPageParam(v string) (int, bool)

RequestQueryStringPageParam converts incoming `page` parameter (v) to a valid `int` type. If the value is empty, `1` is returned as default.

Types

This section is empty.

Jump to

Keyboard shortcuts

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