ddb

package
v0.0.0-...-794f3e4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store cache service

func NewDDBStore

func NewDDBStore(
	config *domain.Config,
) (*Store, error)

NewDDBStore constructor for DynamoDB table.

func (*Store) ClearTable

func (r *Store) ClearTable(
	baseTableName string,
	baseTableSuffix string,
	baseTenant string,
	namespace string,
) (err error)

ClearTable removes all entries for tenant in table.

func (*Store) Create

func (r *Store) Create(
	baseTableName string,
	baseTableSuffix string,
	baseTenant string,
	namespace string,
	id string,
	value []byte,
	expiration time.Duration) (err error)

Create adds a new item.

func (*Store) CreateTable

func (r *Store) CreateTable(
	baseTableName string,
	_ string,
) (err error)

CreateTable helper method creates DDB table.

func (*Store) Delete

func (r *Store) Delete(
	baseTableName string,
	baseTableSuffix string,
	baseTenant string,
	namespace string,
	id string,
) (err error)

Delete removes existing item in DDB table.

func (*Store) Get

func (r *Store) Get(
	baseTableName string,
	baseTableSuffix string,
	baseTenant string,
	namespace string,
	ids ...string,
) (res map[string][]byte, err error)

Get finds items by ids.

func (*Store) Query

func (r *Store) Query(
	baseTableName string,
	baseTableSuffix string,
	baseTenant string,
	namespace string,
	predicate map[string]string,
	lastEvaluatedKeyStr string,
	limit int64,
) (res map[string][]byte, nextKeyStr string, err error)

Query searches items by predicates - not very optimal -- better use GSI in the future.

func (*Store) Size

func (r *Store) Size(
	tableName string,
	baseTableSuffix string,
	baseTenant string,
	namespace string,
) (size int64, err error)

Size returns number of items in table.

func (*Store) Update

func (r *Store) Update(
	baseTableName string,
	baseTableSuffix string,
	baseTenant string,
	namespace string,
	id string,
	version int64,
	value []byte,
	expiration time.Duration) (err error)

Update updates existing entry.

Jump to

Keyboard shortcuts

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