dynamodb

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateTable = testutil.CreateTable

CreateTable is an alias of CreateTable func defined in testutil package. Mainly used for test and local dev purposes.

Functions

This section is empty.

Types

type ClientAPI

type ClientAPI interface {
	dynamodb.QueryAPIClient

	GetItem(ctx context.Context, params *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
	PutItem(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
	UpdateItem(ctx context.Context, params *dynamodb.UpdateItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.UpdateItemOutput, error)
	DeleteItem(ctx context.Context, params *dynamodb.DeleteItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DeleteItemOutput, error)
}

ClientAPI presents an interface for a sub-part of the AWS Dynamodb client service: github.com/aws/aws-sdk-go-v2/service/dynamodb

type Item

type Item struct {
	HashKey  string `dynamodbav:"_pk"`
	RangeKey string `dynamodbav:"_sk"`
	LSIKey   string `dynamodbav:"_lsik,omitempty"`
}

type KeyEngine

type KeyEngine interface {
	core.KeyEngine
	NamespaceRegistry
}

KeyEngine extends core.KeyEngine to add NamespaceRegistry utilities

func NewKeyEngine

func NewKeyEngine(svc ClientAPI, table string, opts ...func(ec *KeyEngineConfig)) KeyEngine

NewKeyEngine returns a core.KeyEngine implementation built on top of a Dynamodb table.

It requires a non-empty value for Dynamodb client service and table name parameters. Otherwise, it will panic.

type KeyEngineConfig added in v0.2.2

type KeyEngineConfig core.KeyEngineConfig

KeyEngineConfig is an alias to core.KeyEngineConfig type defined in the core package. It may change later to extend the core one.

type KeyItem

type KeyItem struct {
	Item
	Namespace  string `dynamodbav:"_nspace"`
	KeyID      string `dynamodbav:"_kid"`
	Key        []byte `dynamodbav:"_key"`
	State      string `dynamodbav:"_state"`
	CreatedAt  int64  `dynamodbav:"_createdAt"`
	DisabledAt int64  `dynamodbav:"_disabledAt,omitempty"`
	DeletedAt  int64  `dynamodbav:"_deletedAt,omitempty"`
	EnabledAt  int64  `dynamodbav:"_enabledAt,omitempty"`
}

KeyItem defines Dynamodb Key Engine table schema.

type NamespaceItem

type NamespaceItem struct {
	Item
	Namespace string `dynamodbav:"_nspace"`
	At        int64  `dynamodbav:"_at"`
}

type NamespaceRegistry

type NamespaceRegistry interface {
	// ListNamespace returns a list of registred namespaces.
	// Namespaces are mainly added to the internal registry during the GetOrCtreateKeys ops.
	ListNamespace(ctx context.Context) ([]string, error)
}

NamespaceRegistry mainly used internally or by a cron to look up for namespaces to clean.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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