dynamostore

package module
v0.0.0-...-69258d1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2015 License: MIT Imports: 9 Imported by: 14

README

DynamoStore GoDoc Build Status

A session store backend for gorilla/sessions - src.

Requirements

Depends on the Goamz/aws Go Amazon Library

Depends on the Goamz/dynamodb Go Amazon Dynamodb Library

Installation

go get github.com/denizeren/dynamostore

Documentation

Available on godoc.org.

See http://www.gorillatoolkit.org/pkg/sessions for full documentation on underlying interface.

Example
// Fetch new store.
store, err := NewDynamoStore("AWS_ACCESS_KEY", "AWS_SECRET_KEY", "DYNAMODB_TABLE_NAME", "AWS_REGION_NAME", "SECRET-KEY")
if err != nil {
    panic(err)
}

// Get a session.
session, err = store.Get(req, "session-key")
if err != nil {
    log.Error(err.Error())
}

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

// Save.
if err = sessions.Save(req, rsp); err != nil {
    t.Fatalf("Error saving session: %v", err)
}

// Delete session.
session.Options.MaxAge = -1
if err = sessions.Save(req, rsp); err != nil {
    t.Fatalf("Error saving session: %v", err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoData

type DynamoData struct {
	Id   string
	Data []byte
}

type DynamoStore

type DynamoStore struct {
	Table   *dynamodb.Table
	Codecs  []securecookie.Codec
	Options *sessions.Options // default configuration
}

func NewDynamoStore

func NewDynamoStore(accessKey string, secretKey string, tableName string, region string, keyPairs ...[]byte) (*DynamoStore, error)

func NewDynamoStoreWithRegionObj

func NewDynamoStoreWithRegionObj(accessKey string, secretKey string, tableName string, region aws.Region, keyPairs ...[]byte) (*DynamoStore, error)

func (*DynamoStore) Get

func (s *DynamoStore) Get(r *http.Request, name string) (*sessions.Session, error)

Get returns a session for the given name after adding it to the registry.

See gorilla/sessions FilesystemStore.Get(). or boj/redistore

func (*DynamoStore) New

func (s *DynamoStore) New(r *http.Request, name string) (*sessions.Session, error)

func (*DynamoStore) Save

func (s *DynamoStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

Save adds a single session to the response.

Jump to

Keyboard shortcuts

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