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

Method GetInt64

sessions/session.go:286–307  ·  view source on GitHub ↗

GetInt64 same as `Get` but returns its int64 representation, if key doesn't exist then it returns -1 and a non-nil error.

(key string)

Source from the content-addressed store, hash-verified

284// GetInt64 same as `Get` but returns its int64 representation,
285// if key doesn't exist then it returns -1 and a non-nil error.
286func (s *Session) GetInt64(key string) (int64, error) {
287 v := s.Get(key)
288 if v != nil {
289 if vint64, ok := v.(int64); ok {
290 return vint64, nil
291 }
292
293 if vfloat64, ok := v.(float64); ok {
294 return int64(vfloat64), nil
295 }
296
297 if vint, ok := v.(int); ok {
298 return int64(vint), nil
299 }
300
301 if vstring, sok := v.(string); sok {
302 return strconv.ParseInt(vstring, 10, 64)
303 }
304 }
305
306 return -1, newErrEntryNotFound(key, reflect.Int64, v)
307}
308
309// GetInt64Default same as `Get` but returns its int64 representation,
310// if key doesn't exist it returns the "defaultValue".

Callers 7

GetInt64DefaultMethod · 0.95
BeginRequestMethod · 0.45
GetMeMethod · 0.45
GetLikeHandlerFunction · 0.45
GetFollowerHandlerFunction · 0.45
GetFollowingHandlerFunction · 0.45
testBinderFuncFunction · 0.45

Calls 2

GetMethod · 0.95
newErrEntryNotFoundFunction · 0.85

Tested by 1

testBinderFuncFunction · 0.36