mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
remove the old 'mvc' folder - examples are not changed yet - add the 'di' package inside the mvc2 package - which will be renamed to 'mvc' on the next commit - new mvc.Application and some dublications removed - The new version will be version 9 because it will contain breaking changes (not to the end-developer's controllers but to the API they register them) - get ready for 'Christmas Edition' for believers
Former-commit-id: c7114233dee90ee308c0a3e77ec2ad0c361094b8
This commit is contained in:
@@ -167,6 +167,26 @@ func (s *Session) GetIntDefault(key string, defaultValue int) (int, error) {
|
||||
return defaultValue, errFindParse.Format("int", key, v)
|
||||
}
|
||||
|
||||
// Increment increments the stored int value saved as "key" by +"n".
|
||||
// If value doesn't exist on that "key" then it creates one with the "n" as its value.
|
||||
// It returns the new, incremented, value.
|
||||
func (s *Session) Increment(key string, n int) (newValue int) {
|
||||
newValue, _ = s.GetIntDefault(key, 0)
|
||||
newValue += n
|
||||
s.Set(key, newValue)
|
||||
return
|
||||
}
|
||||
|
||||
// Decrement decrements the stored int value saved as "key" by -"n".
|
||||
// If value doesn't exist on that "key" then it creates one with the "n" as its value.
|
||||
// It returns the new, decremented, value even if it's less than zero.
|
||||
func (s *Session) Decrement(key string, n int) (newValue int) {
|
||||
newValue, _ = s.GetIntDefault(key, 0)
|
||||
newValue -= n
|
||||
s.Set(key, newValue)
|
||||
return
|
||||
}
|
||||
|
||||
// GetInt64 same as `Get` but returns its int64 representation,
|
||||
// if key doesn't exist then it returns -1.
|
||||
func (s *Session) GetInt64(key string) (int64, error) {
|
||||
|
||||
Reference in New Issue
Block a user