dynamodb

package
v0.0.0-...-8e0f7c1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package dynamodb supports randomizer storage in an Amazon DynamoDB table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FactoryFromEnv

func FactoryFromEnv(ctx context.Context) (func(string) randomizer.Store, error)

FactoryFromEnv returns a store.Factory whose stores are backed by Amazon DynamoDB.

AWS configuration is read as described at https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html.

Types

type Store

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

Store is a store backed by a pre-existing Amazon DynamoDB table.

The DynamoDB table used by a Store must have a composite primary key, with a partition key named "Partition" and a sort key named "Group", both string-valued. Items in each row are stored in a string set attribute named "Items".

func New

func New(db *dynamodb.Client, table, partition string) (Store, error)

New creates a new store, backed by the provided DynamoDB client, that writes groups into the provided table using the provided partition key. See the Store documentation for details.

func (Store) Delete

func (s Store) Delete(ctx context.Context, name string) (bool, error)

Delete removes the named group from this Store's partition.

func (Store) Get

func (s Store) Get(ctx context.Context, name string) ([]string, error)

Get obtains the options in a single named group from this Store's partition.

func (Store) List

func (s Store) List(ctx context.Context) ([]string, error)

List obtains the list of stored groups for this Store's partition.

func (Store) Put

func (s Store) Put(ctx context.Context, name string, options []string) error

Put saves the provided options into a named group for this Store's partition.

Jump to

Keyboard shortcuts

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