foundations

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, cli WriteClient, items WriteItemFunc) error

func Get

func Get(ctx context.Context, cli GetClient, getKeys GetKeyFunc, fetch FetchItemFunc) error

func IsNil

func IsNil(record interface{}) bool

func IsNotFound

func IsNotFound(err error) bool

func Put

func Put(ctx context.Context, cli WriteClient, items WriteItemFunc) error

func Query added in v0.0.2

func Query(ctx context.Context, cli QueryClient, condition QueryConditionFunc, fetch FetchItemsFunc, limit ...int32) error

func Scan added in v0.0.6

func Scan(ctx context.Context, cli ScanClient, table string, fetch FetchItemsFunc) error

func Update

func Update(ctx context.Context, cli WriteClient, items WriteItemFunc) error

func UpdateItems

func UpdateItems(ctx context.Context, fields ...UpdateField) expression.UpdateBuilder

Types

type FetchItemFunc

type FetchItemFunc func(tableName string, value map[string]types.AttributeValue) error

type FetchItemsFunc added in v0.0.2

type FetchItemsFunc func(tableName string, value []map[string]types.AttributeValue) error

type GetClient

type GetClient interface {
	GetItem(ctx context.Context, params *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
}

type GetKeyFunc

type GetKeyFunc func() (table string, keys map[string]types.AttributeValue, attrs []string, err error)

type QueryClient added in v0.0.2

type QueryClient interface {
	Query(ctx context.Context, params *dynamodb.QueryInput, optFns ...func(*dynamodb.Options)) (*dynamodb.QueryOutput, error)
}

type QueryConditionFunc added in v0.0.2

type QueryConditionFunc func() (table, index string, expr expression.Expression, desc bool, err error)

type RecordNotFoundException added in v0.0.3

type RecordNotFoundException struct{}
var ErrNotFound *RecordNotFoundException

func (*RecordNotFoundException) Error added in v0.0.3

func (err *RecordNotFoundException) Error() string

type ScanClient added in v0.0.6

type ScanClient interface {
	Scan(ctx context.Context, params *dynamodb.ScanInput, optFns ...func(*dynamodb.Options)) (*dynamodb.ScanOutput, error)
}

type UpdateField

type UpdateField func(ctx context.Context, builder *expression.UpdateBuilder) expression.UpdateBuilder

type WriteClient

type WriteClient interface {
	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)
}

type WriteItemFunc

type WriteItemFunc func() (table string, item map[string]types.AttributeValue, expr expression.Expression, err error)

Jump to

Keyboard shortcuts

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