aboutsummaryrefslogtreecommitdiff
path: root/securecookie.go
diff options
context:
space:
mode:
authorWenhui Shen <swhbox@foxmail.com>2017-07-22 06:24:17 +0300
committerWenhui Shen <swhbox@foxmail.com>2017-07-22 06:24:17 +0300
commit4eede49ef71430a42304f23218d8dd4b73c3c435 (patch)
treecab16b4c2eb7720ed22eb84514acb8037db375ba /securecookie.go
parentdeb9be694683b721489312b39d5265ff3d29add1 (diff)
update
Diffstat (limited to 'securecookie.go')
-rw-r--r--securecookie.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/securecookie.go b/securecookie.go
index c386907..912d64c 100644
--- a/securecookie.go
+++ b/securecookie.go
@@ -601,6 +601,22 @@ func DecodeMulti(name string, value string, dst interface{}, codecs ...Codec) er
return errors
}
+func DecodeMultiWithMaxAge(name string, value string, dst interface{}, maxAge int, codecs ...Codec) error {
+ if len(codecs) == 0 {
+ return errNoCodecs
+ }
+
+ var errors MultiError
+ for _, codec := range codecs {
+ err := codec.Decode(name, value, dst, maxAge)
+ if err == nil {
+ return nil
+ }
+ errors = append(errors, err)
+ }
+ return errors
+}
+
// MultiError groups multiple errors.
type MultiError []error