dynamostore

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dynamostore is a DynamoDB-based session store for the SCS session package.

The dynamostore package relies on the aws-sdk-go client. (https://godoc.org/github.com/aws/aws-sdk-go/service/dynamodb)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoStore

type DynamoStore struct {
	DB *dynamodb.DynamoDB
	// contains filtered or unexported fields
}

DynamoStore represents the currently configured session session store. It is essentially a wrapper around a DynamoDB client. And table is a table name session stored. token, data, expiry are key names.

func New

func New(dynamo *dynamodb.DynamoDB) *DynamoStore

New returns a new DynamoStore instance. The client parameter shoud be a pointer to a aws-sdk-go DynamoDB client. See https://godoc.org/github.com/aws/aws-sdk-go/service/dynamodb#DynamoDB.

func NewWithOption

func NewWithOption(dynamo *dynamodb.DynamoDB, table string, token string, data string, expiry string, ttl string) *DynamoStore

NewWithOption returns a new DynamoStore instance. The client parameter shoud be a pointer to a aws-sdk-go DynamoDB client. See https://godoc.org/github.com/aws/aws-sdk-go/service/dynamodb#DynamoDB. The parameter table is DynamoDB tabel name, and token/data/expiry are key names.

func (*DynamoStore) DataName

func (d *DynamoStore) DataName() string

DataName returns session data key name.

func (*DynamoStore) Delete

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

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

func (*DynamoStore) ExpiryName

func (d *DynamoStore) ExpiryName() string

ExpiryName returns session expiry key name.

func (*DynamoStore) Find

func (d *DynamoStore) Find(token string) (b []byte, found 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.

func (*DynamoStore) Ping

func (d *DynamoStore) Ping() error

Ping checks to exisit session table in DynamoDB.

func (*DynamoStore) Save

func (d *DynamoStore) Save(token string, b []byte, expiry time.Time) error

Save 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) TTLName

func (d *DynamoStore) TTLName() string

TTLName returns session expiry key name.

func (*DynamoStore) TableName

func (d *DynamoStore) TableName() string

TableName returns session table name.

func (*DynamoStore) TokenName

func (d *DynamoStore) TokenName() string

TokenName returns session token key name.

Jump to

Keyboard shortcuts

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