URLParamInt32Default returns the url query parameter as int32 value from a request, if not found or parse failed then "def" is returned.
(name string, def int32)
| 1608 | // URLParamInt32Default returns the url query parameter as int32 value from a request, |
| 1609 | // if not found or parse failed then "def" is returned. |
| 1610 | func (ctx *Context) URLParamInt32Default(name string, def int32) int32 { |
| 1611 | if v := ctx.URLParam(name); v != "" { |
| 1612 | n, err := strconv.ParseInt(v, 10, 32) |
| 1613 | if err != nil { |
| 1614 | return def |
| 1615 | } |
| 1616 | |
| 1617 | return int32(n) |
| 1618 | } |
| 1619 | |
| 1620 | return def |
| 1621 | } |
| 1622 | |
| 1623 | // URLParamInt64 returns the url query parameter as int64 value from a request, |
| 1624 | // returns -1 and an error if parse failed or not found. |
no test coverage detected