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

Method GetString

sessions/session.go:134–150  ·  view source on GitHub ↗

GetString same as Get but returns its string representation, if key doesn't exist then it returns an empty string.

(key string)

Source from the content-addressed store, hash-verified

132// GetString same as Get but returns its string representation,
133// if key doesn't exist then it returns an empty string.
134func (s *Session) GetString(key string) string {
135 if value := s.Get(key); value != nil {
136 if v, ok := value.(string); ok {
137 return v
138 }
139
140 if v, ok := value.(int); ok {
141 return strconv.Itoa(v)
142 }
143
144 if v, ok := value.(int64); ok {
145 return strconv.FormatInt(v, 10)
146 }
147 }
148
149 return ""
150}
151
152// GetStringDefault same as Get but returns its string representation,
153// if key doesn't exist then it returns the "defaultValue".

Callers 15

GetStringDefaultMethod · 0.95
testSessionsFunction · 0.45
NewAppFunction · 0.45
GetByIDMethod · 0.45
main.goFile · 0.45
FormatMethod · 0.45
SetupErrorHandlersMethod · 0.45
mainFunction · 0.45
indexHandlerFunction · 0.45
mainFunction · 0.45
mainHandlerFunction · 0.45
mainFunction · 0.45

Calls 1

GetMethod · 0.95

Tested by 1

testSessionsFunction · 0.36