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 ¶
- type DynamoStore
- func (d *DynamoStore) DataName() string
- func (d *DynamoStore) Delete(token string) error
- func (d *DynamoStore) ExpiryName() string
- func (d *DynamoStore) Find(token string) (b []byte, found bool, err error)
- func (d *DynamoStore) Ping() error
- func (d *DynamoStore) Save(token string, b []byte, expiry time.Time) error
- func (d *DynamoStore) TTLName() string
- func (d *DynamoStore) TableName() string
- func (d *DynamoStore) TokenName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamoStore ¶
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 ¶
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.