From 4eede49ef71430a42304f23218d8dd4b73c3c435 Mon Sep 17 00:00:00 2001 From: Wenhui Shen Date: Sat, 22 Jul 2017 11:24:17 +0800 Subject: update --- .vscode/temp.sql | 0 securecookie.go | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .vscode/temp.sql diff --git a/.vscode/temp.sql b/.vscode/temp.sql new file mode 100644 index 0000000..e69de29 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 -- cgit v1.2.3