dynamo-session-store

module
v0.0.0-...-c5d2ffa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2022 License: MIT

README

dynamo-session-store

dynamo-session-store is HTTP session store with DynamoDB for Gorilla Toolkit

Test

Features

Preparation

You have to create a table having a partition key named id

Type of id is string.

Examples

import (
    "github.com/aws/aws-sdk-go-v2/config"
    "github.com/itto-ki/dynamo-session-store/store"
)

cfg, err := config.LoadDefaultConfig(context.Background())
if err != nil {
    panic(err.Error())
}

sessionStore := store.NewStore("table-name", cfg, []byte("your-secret-key"))

// Get a session
session, err = sessionStore.Get(req, "session-key")
if err != nil {
    // error
}

// Add a value.
session.Values["foo"] = "bar"

// Save
if err = session.Save(req, rsp); err != nil {
    // error
}

// Delete session
session.Options.MaxAge = -1
if err = session.Save(req, rsp); err != nil {
    // error
}

License

MIT licensed. See the LICENSE file for details.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL