query

package module
v0.0.0-...-2e1097e Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: MIT Imports: 5 Imported by: 0

README

query

query is a tool to get value from the request url

Installation

go get gitea.com/lunny/query

Usage

id := GetQuery(req).MustInt64("query_id)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorKeyIsNotExist

type ErrorKeyIsNotExist struct {
	Key string
}

ErrorKeyIsNotExist represents an error with no key exist

func (ErrorKeyIsNotExist) Error

func (e ErrorKeyIsNotExist) Error() string

type Queries

type Queries url.Values

Queries a new enhancement of http.Request

func GetQuery

func GetQuery(req *http.Request) Queries

GetQuery returns queries

func (Queries) Bool

func (f Queries) Bool(key string) (bool, error)

Bool returns request form as bool

func (Queries) Escape

func (f Queries) Escape(key string) (string, error)

Escape returns request form as escaped string

func (Queries) Float32

func (f Queries) Float32(key string) (float32, error)

Float32 returns request form as float32

func (Queries) Float64

func (f Queries) Float64(key string) (float64, error)

Float64 returns request form as float64

func (Queries) Int

func (f Queries) Int(key string) (int, error)

Int returns request form as int

func (Queries) Int32

func (f Queries) Int32(key string) (int32, error)

Int32 returns request form as int32

func (Queries) Int64

func (f Queries) Int64(key string) (int64, error)

Int64 returns request form as int64

func (Queries) MustBool

func (f Queries) MustBool(key string, defaults ...bool) bool

MustBool returns request form as bool with default

func (Queries) MustEscape

func (f Queries) MustEscape(key string, defaults ...string) string

MustEscape returns request form as escaped string with default

func (Queries) MustFloat32

func (f Queries) MustFloat32(key string, defaults ...float32) float32

MustFloat32 returns request form as float32 with default

func (Queries) MustFloat64

func (f Queries) MustFloat64(key string, defaults ...float64) float64

MustFloat64 returns request form as float64 with default

func (Queries) MustInt

func (f Queries) MustInt(key string, defaults ...int) int

MustInt returns request form as int with default

func (Queries) MustInt32

func (f Queries) MustInt32(key string, defaults ...int32) int32

MustInt32 returns request form as int32 with default

func (Queries) MustInt64

func (f Queries) MustInt64(key string, defaults ...int64) int64

MustInt64 returns request form as int64 with default

func (Queries) MustString

func (f Queries) MustString(key string, defaults ...string) string

MustString returns request form as string with default

func (Queries) MustStrings

func (f Queries) MustStrings(key string, defaults ...[]string) []string

MustStrings returns request form as strings with default

func (Queries) MustUint

func (f Queries) MustUint(key string, defaults ...uint) uint

MustUint returns request form as uint with default

func (Queries) MustUint32

func (f Queries) MustUint32(key string, defaults ...uint32) uint32

MustUint32 returns request form as uint32 with default

func (Queries) MustUint64

func (f Queries) MustUint64(key string, defaults ...uint64) uint64

MustUint64 returns request form as uint64 with default

func (Queries) String

func (f Queries) String(key string) (string, error)

String returns request form as string

func (Queries) Strings

func (f Queries) Strings(key string) ([]string, error)

Strings returns request form as strings

func (Queries) Uint

func (f Queries) Uint(key string) (uint, error)

Uint returns request form as uint

func (Queries) Uint32

func (f Queries) Uint32(key string) (uint32, error)

Uint32 returns request form as uint32

func (Queries) Uint64

func (f Queries) Uint64(key string) (uint64, error)

Uint64 returns request form as uint64

func (Queries) Values

func (f Queries) Values() url.Values

Values returns http.Request values

Jump to

Keyboard shortcuts

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