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

Method GetIntDefault

sessions/session.go:257–262  ·  view source on GitHub ↗

GetIntDefault same as `Get` but returns its int representation, if key doesn't exist then it returns the "defaultValue".

(key string, defaultValue int)

Source from the content-addressed store, hash-verified

255// GetIntDefault same as `Get` but returns its int representation,
256// if key doesn't exist then it returns the "defaultValue".
257func (s *Session) GetIntDefault(key string, defaultValue int) int {
258 if v, err := s.GetInt(key); err == nil {
259 return v
260 }
261 return defaultValue
262}
263
264// Increment increments the stored int value saved as "key" by +"n".
265// If value doesn't exist on that "key" then it creates one with the "n" as its value.

Callers 7

IncrementMethod · 0.95
DecrementMethod · 0.95
NewAppFunction · 0.45
GetMethod · 0.45
writePathHandlerPage5Function · 0.45
newAppFunction · 0.45
getCurrentTriesMethod · 0.45

Calls 1

GetIntMethod · 0.95

Tested by

no test coverage detected