batches

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxGetItems = 100
)
View Source
const (
	MaxWriteItems = 25
)

Variables

View Source
var MaxProcessorSize = 20

Functions

This section is empty.

Types

type Batch

type Batch[T any] struct {
	// contains filtered or unexported fields
}

func NewBatch

func NewBatch[T any](tableName string, entities []T) *Batch[T]

func (*Batch[T]) Delete

func (builder *Batch[T]) Delete(ctx context.Context, cli WriteClient, f ...DeleteKeyFunc) error

func (*Batch[T]) Get

func (builder *Batch[T]) Get(ctx context.Context, cli GetClient, fetch foundations.FetchItemFunc) (err error)

func (*Batch[T]) HasError

func (builder *Batch[T]) HasError() bool

func (*Batch[T]) Put

func (builder *Batch[T]) Put(ctx context.Context, cli WriteClient) error

type BatchProcessor added in v0.1.15

type BatchProcessor interface {
	Monitor(monitor Monitor) BatchProcessor
	Put(items ...WriteItemFunc) BatchProcessor
	Delete(items ...WriteItemFunc) BatchProcessor
	Run(ctx context.Context, cli WriteClient, opt ...options.Option) error
}

func NewProcessor added in v0.1.15

func NewProcessor(size ...int) BatchProcessor

type Builder

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

func New

func New() *Builder

func (*Builder) Delete

func (builder *Builder) Delete(items ...WriteItemFunc) *Builder

func (*Builder) HasError

func (builder *Builder) HasError() bool

func (*Builder) Monitor added in v0.1.15

func (builder *Builder) Monitor(monitor Monitor) *Builder

func (*Builder) Put

func (builder *Builder) Put(items ...WriteItemFunc) *Builder

func (*Builder) Run

func (builder *Builder) Run(ctx context.Context, cli WriteClient, opt ...options.Option) (err error)

type DeleteKeyFunc added in v0.1.5

type DeleteKeyFunc func(v any) map[string]types.AttributeValue

type GetBuilder

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

func Get

func Get(keys ...foundations.GetKeyFunc) *GetBuilder

func (*GetBuilder) HasError

func (builder *GetBuilder) HasError() bool

func (*GetBuilder) Keys

func (builder *GetBuilder) Keys(keys ...foundations.GetKeyFunc) *GetBuilder

func (*GetBuilder) Run

type GetClient

type GetClient interface {
	BatchGetItem(ctx context.Context, params *dynamodb.BatchGetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.BatchGetItemOutput, error)
}

type Monitor added in v0.1.15

type Monitor func(items map[string][]types.WriteRequest, err error) error

type MultiProcessor added in v0.1.15

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

func (*MultiProcessor) Delete added in v0.1.15

func (p *MultiProcessor) Delete(items ...WriteItemFunc) BatchProcessor

func (*MultiProcessor) Monitor added in v0.1.15

func (p *MultiProcessor) Monitor(monitor Monitor) BatchProcessor

func (*MultiProcessor) Put added in v0.1.15

func (p *MultiProcessor) Put(items ...WriteItemFunc) BatchProcessor

func (*MultiProcessor) Run added in v0.1.15

func (p *MultiProcessor) Run(ctx context.Context, cli WriteClient, opt ...options.Option) error

type SingleProcessor added in v0.1.15

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

func (*SingleProcessor) Delete added in v0.1.15

func (p *SingleProcessor) Delete(items ...WriteItemFunc) BatchProcessor

func (*SingleProcessor) Monitor added in v0.1.15

func (p *SingleProcessor) Monitor(monitor Monitor) BatchProcessor

func (*SingleProcessor) Put added in v0.1.15

func (p *SingleProcessor) Put(items ...WriteItemFunc) BatchProcessor

func (*SingleProcessor) Run added in v0.1.15

func (p *SingleProcessor) Run(ctx context.Context, cli WriteClient, opt ...options.Option) error

type WriteClient

type WriteClient interface {
	BatchWriteItem(ctx context.Context, params *dynamodb.BatchWriteItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.BatchWriteItemOutput, error)
}

type WriteItemFunc

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

func DeleteItems added in v0.0.8

func DeleteItems(items ...foundations.WriteItemFunc) []WriteItemFunc

func PutItems added in v0.0.8

func PutItems(items ...foundations.WriteItemFunc) []WriteItemFunc

Jump to

Keyboard shortcuts

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