dynamostore

package module
v0.0.0-...-f852e39 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: MIT Imports: 8 Imported by: 1

README

dynamostore

Build Status codecov Go Report Card

Documentation

Index

Constants

View Source
const DefaultTableName = "scs.session"

DefaultTableName is used when a more specific name isn't provided.

Variables

View Source
var ErrCreateTimedOut = errors.New("timed out waiting for table creation")

ErrCreateTimedOut is returned when table creation takes too long.

View Source
var ErrDeleteInProgress = errors.New("table deletion in progress")

ErrDeleteInProgress is returned when table creation fails because a table with the same name was recently deleted.

Functions

This section is empty.

Types

type DynamoStore

type DynamoStore struct {
	// contains filtered or unexported fields
}

DynamoStore represents the session store.

func New

func New(svc *dynamodb.Client) *DynamoStore

New creates a DynamoStore instance using default values.

func NewWithTableName

func NewWithTableName(svc *dynamodb.Client, table string) *DynamoStore

NewWithTableName create a DynamoStore instance, overriding the default table name.

func (*DynamoStore) Commit

func (s *DynamoStore) Commit(token string, data []byte, expiry time.Time) error

Commit adds a session token and data to the DynamoStore instance with the given expiry time. If the session token already exists then the data and expiry time are updated.

func (*DynamoStore) CreateTable

func (s *DynamoStore) CreateTable() error

CreateTable creates the session store table, if it doesn't already exist. This is only intended as a convenience function to make development and testing easier. It is not intended for use in production.

func (*DynamoStore) Delete

func (s *DynamoStore) Delete(token string) error

Delete removes a session token and corresponding data from the DynamoStore instance.

func (*DynamoStore) Find

func (s *DynamoStore) Find(token string) (b []byte, exists bool, err error)

Find returns the data for a given session token from the DynamoStore instance. If the session token is not found or is expired, the returned exists flag will be set to false.

Jump to

Keyboard shortcuts

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