productdb

package
v0.0.0-...-a3a6de1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrOptimisticLock = errors.New("lock error")

Functions

This section is empty.

Types

type DB

type DB interface {
	Get(ctx context.Context, clientId string) (*Product, int64, error)
	Scan(ctx context.Context, f func(*Product, int64)) error
	Put(ctx context.Context, record *Product) (int64, error)
	Update(ctx context.Context, record *Product, version int64) (int64, error)
	Delete(ctx context.Context, clientId string, version int64) error
}

type DynamoDB

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

func NewDynamoDB

func NewDynamoDB(
	client dynamodbiface.DynamoDBAPI,
	tableName string,
	options ...DynamoDBOption,
) *DynamoDB

func (*DynamoDB) Delete

func (d *DynamoDB) Delete(ctx context.Context, clientId string, version int64) error

func (*DynamoDB) Get

func (d *DynamoDB) Get(ctx context.Context, clientId string) (*Product, int64, error)

func (*DynamoDB) Put

func (d *DynamoDB) Put(ctx context.Context, product *Product) (int64, error)

func (*DynamoDB) Scan

func (d *DynamoDB) Scan(ctx context.Context, f func(*Product, int64)) error

func (*DynamoDB) Update

func (d *DynamoDB) Update(ctx context.Context, product *Product, version int64) (int64, error)

type DynamoDBLogger

type DynamoDBLogger interface {
	GetError(err error, table string, key map[string]*dynamodb.AttributeValue)
	GetMarshalMapError(err error, clientId string)
}

type DynamoDBOption

type DynamoDBOption func(*DynamoDB)

func SetDynamoDBLogger

func SetDynamoDBLogger(l DynamoDBLogger) DynamoDBOption

type Product

type Product struct {
	ClientId string
	AppCode  string
	FuncArn  string
}

Jump to

Keyboard shortcuts

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