dynamodb

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTable

func CreateTable(repo repository.Repository) (repository.Repository, error)

CreateTable - will create a dynamodb table if it doesn't exist or return the existing table interface if it does

func Delete

func Delete(ctx context.Context, repo repository.Repository, templ DAO) error

Delete - Removes a DAO object matching the template hashKey and sortKey. Validation is expected to be done by the caller. May consider validation of deletion in te future, intentionally not there now

func InsertOrUpdate

func InsertOrUpdate(ctx context.Context, repo repository.Repository, dao DAO) error

InsertOrUpdate - Generic method to insert or update a dynamo table

func ValidAction

func ValidAction(ctx context.Context, action string, dao DAO) error

ValidAction - Default Security check, called externally to enable swap outs

Types

type DAO

type DAO interface {
	HashKey() string
	SortKey() string
	User() string
	//New - Enables a copy of the specific struct to support return values
	New() DAO
	//Refresh - Updates the Hash/SortKey based on current values
	Refresh()
	//Populate - Called after a DAO has been mapped to the underlying db to support any additional actions.  Example:  calculated fields and decompressing
	Populate()
}

DAO marker interface - Dynamo specific for now, might make sense at some point to find generic names to work across

func Select

func Select(ctx context.Context, repo repository.Repository, templ DAO, strFilterVals ...string) ([]DAO, error)

Select - Returns a list of DAO objects matching the template hashKey. Validation is expected to be done by the caller Optionally a vararg of string with the form of:

str1 = A DynamoDB Filter Expression
str2 = The column variable, followed by A Type followed by a value delimited by ":"
For multiples of above, the "AND" keyword is automatically appended.
Type should be S: or N: for now, will add others as the need arises.  OR is not supported, would add a separate method if needed in the future

example: Select(ctx, repo, dao, "contains(Color, :c", "c:S:Red") The c variable is replaced with the string Red at runtime

func SelectOne

func SelectOne(ctx context.Context, repo repository.Repository, templ DAO) (DAO, error)

SelectOne - Returns a DAO object matching the template hashKey and sortKey. Validation is expected to be done by the caller

type DaoAudit

type DaoAudit struct {
	//These are audit columns
	CreatedBy string
	UpdatedBy string
	//TODO: confirm default go type includes timezone approach or update to alt that does
	CreatedDt time.Time
	UpdatedDt time.Time
}

DaoAudit - INTERNAL ONLY. Groups Audit data, exported to support default JSON conversion.

type DynamoSession

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

DynamoSession - Implementation of DynamoSession

func (*DynamoSession) Session

func (s *DynamoSession) Session() repository.Session

Session - Return this session/ implement the Session interface

Jump to

Keyboard shortcuts

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