MCPcopy Create free account
hub / github.com/kataras/iris / URLParamInt64

Method URLParamInt64

context/context.go:1625–1635  ·  view source on GitHub ↗

URLParamInt64 returns the url query parameter as int64 value from a request, returns -1 and an error if parse failed or not found.

(name string)

Source from the content-addressed store, hash-verified

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.
1625func (ctx *Context) URLParamInt64(name string) (int64, error) {
1626 if v := ctx.URLParam(name); v != "" {
1627 n, err := strconv.ParseInt(v, 10, 64)
1628 if err != nil {
1629 return -1, err
1630 }
1631 return n, nil
1632 }
1633
1634 return -1, ErrNotFound
1635}
1636
1637// URLParamInt64Default returns the url query parameter as int64 value from a request,
1638// if not found or parse failed then "def" is returned.

Callers 1

URLParamInt64DefaultMethod · 0.95

Calls 1

URLParamMethod · 0.95

Tested by

no test coverage detected