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

Method PostValueIntDefault

context/context.go:2071–2078  ·  view source on GitHub ↗

PostValueIntDefault same as PostValueInt but if errored it returns the given "def" default value.

(name string, def int)

Source from the content-addressed store, hash-verified

2069// PostValueIntDefault same as PostValueInt but if errored it returns
2070// the given "def" default value.
2071func (ctx *Context) PostValueIntDefault(name string, def int) int {
2072 value, err := ctx.PostValueInt(name)
2073 if err != nil {
2074 return def
2075 }
2076
2077 return value
2078}
2079
2080// PostValueInt8 returns the last parsed form data matches the given "name" key
2081// from POST, PATCH, or PUT body request parameters as int8.

Callers

nothing calls this directly

Calls 1

PostValueIntMethod · 0.95

Tested by

no test coverage detected