package
0.0.25
Repository: https://github.com/raito-io/go-dynamo-utils.git
Documentation: pkg.go.dev

# README

Executor

The executor package providers a DynamoDB Query/Scan executor. The executor returns a channel containing the returning elements or corresponding errors.

The executor abstracts the paginated complexity that can occurs during a DynamoDB query or scan execution, as well as the unmarshalling of all objects. The executor and corresponding channel can be closed by the provided context.

Example

type DBObject struct {
    PK         string `dynamodbav:"PK"`
    SK         string `dynamodbav:"SK"`
    Attribute1 string `dynamodbav:"attr1,omitempty"`
    Attribute2 int    `dynamodbav:"attr2,omitempty"`
}

func query(ctx context.Context, client *dynamodb.Client, query *dynamodb.QueryInput) error {
	e := executor.New(client)
	
	queryContext, cancelFn := context.WithCancel(ctx)
	defer cancelFn()
	
	for object := range e.Query(queryContext, query, executor.WithUnmarshalToItemMapFn[DBOject]()) {
		switch o := object.(type) {
		case error:
		    return o
		case DBObject:
		    fmt.Printf("Get element of partition %s: %+v\n", o.PK, o)
        } 
    }
	
}

# Packages

No description provided by the author

# Functions

New creates a new DynamoDB query/scan executor.
WithLock will ensure that a lock is refreshed after ever call to the DynamoDB service.
WithMapFn returns an options modifier function that sets an unmarshalling method of a Scan or Query execution.
WithUnmarshalToItemMapFn returns an options modifier function that sets an attributevalue unmarshalling .

# Structs

Executor can execute DynamoDB query and scan executions while abstracting pagination and unmarshalling complexity.
No description provided by the author

# Interfaces

go:generate go run github.com/vektra/mockery/v2 --name=DynamodbClient --with-expecter.
go:generate go run github.com/vektra/mockery/v2 --name=Lock --with-expecter.