AWS dynamoDB store for gorilla sessions. Uses AWS Official Go Library
go get -u github.com/pratikju/dynamostore
import (
"github.com/pratikju/dynamostore"
)
// create dynamoDB store
store, err := dynamostore.NewDynamoStore(map[string]string{
"table": "mysession",
"endpoint": "http://localhost:8000", // No need to set this in production
}, []byte("something-very-secret"))
if err != nil {
// handle error
}
// Get a session.
// Get() always returns a session, even if empty.
session, err := store.Get(r, "session-name")
if err != nil {
// handle error
}
// Set some session values.
session.Values["name"] = "alice"
session.Values["id"] = 43
// Save the session.
if err := session.Save(r, w); err != nil {
// handle error
}
// Delete the session
session.Options.MaxAge = -1
if err := session.Save(r, w); err != nil {
// handle error
}
MIT, see the LICENSE.