Documentation
¶
Overview ¶
Package params 获取和转换路由中的参数信息。
Index ¶
- Constants
- Variables
- type Params
- func (p Params) Bool(key string) (bool, error)
- func (p Params) Exists(key string) bool
- func (p Params) Float(key string) (float64, error)
- func (p Params) Int(key string) (int64, error)
- func (p Params) MustBool(key string, def bool) bool
- func (p Params) MustFloat(key string, def float64) float64
- func (p Params) MustInt(key string, def int64) int64
- func (p Params) MustString(key, def string) string
- func (p Params) MustUint(key string, def uint64) uint64
- func (p Params) String(key string) (string, error)
- func (p Params) Uint(key string) (uint64, error)
Constants ¶
View Source
const ContextKeyParams contextKey = 0
ContextKeyParams 存取路由参数的关键字
Variables ¶
View Source
var ErrParamNotExists = errors.New("不存在该参数")
ErrParamNotExists 表示地址参数中并不存在该名称的值。
Functions ¶
This section is empty.
Types ¶
type Params ¶
Params 获取和转换路由中的参数信息。
func (Params) MustString ¶
MustString 获取地址参数中的名为 key 的变量,并将其转换成 string, 若不存在或是无法转换则返回 def。
Click to show internal directories.
Click to hide internal directories.