parse

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URLParamType   string = "URL"
	QueryParamType string = "query"
)

Variables

This section is empty.

Functions

func ArrayQueryParam

func ArrayQueryParam[T any](
	r *http.Request,
	paramName string,
	defaultValue []T,
	parserFunc ParserFunc[T],
) ([]T, error)

func QueryParam

func QueryParam[T any](
	r *http.Request,
	paramName string,
	defaultValue T,
	parserFunc ParserFunc[T],
) (T, error)

func RequiredArrayQueryParam

func RequiredArrayQueryParam[T any](
	r *http.Request,
	paramName string,
	parserFunc ParserFunc[T],
) ([]T, error)

func RequiredQueryParam

func RequiredQueryParam[T any](
	r *http.Request,
	paramName string,
	parserFunc ParserFunc[T],
) (T, error)

func URLParam

func URLParam[T any](
	r *http.Request,
	paramName string,
	parserFunc ParserFunc[T],
) (T, error)

func UUID

func UUID(_ string, _ string, value string) (string, error)

Types

type ParserFunc

type ParserFunc[T any] func(paramType string, paramName string, value string) (T, error)

func DateFunc

func DateFunc(layout string) ParserFunc[time.Time]

func Int64Func

func Int64Func(isPositive bool, isZero bool) ParserFunc[int64]

func IntFunc

func IntFunc(isPositive bool, isZero bool) ParserFunc[int]

Jump to

Keyboard shortcuts

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