diff options
author | Wenhui Shen <swhbox@foxmail.com> | 2017-07-22 06:24:17 +0300 |
---|---|---|
committer | Wenhui Shen <swhbox@foxmail.com> | 2017-07-22 06:24:17 +0300 |
commit | 4eede49ef71430a42304f23218d8dd4b73c3c435 (patch) | |
tree | cab16b4c2eb7720ed22eb84514acb8037db375ba /securecookie.go | |
parent | deb9be694683b721489312b39d5265ff3d29add1 (diff) |
update
Diffstat (limited to 'securecookie.go')
-rw-r--r-- | securecookie.go | 16 |
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 |