ddb

package
v0.0.0-...-3a9ac50 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Wrapper

type Wrapper struct {
	Client *dynamodb.Client
}

Wrapper wraps a dynamodb.Client and provides convenient methods on interfaces provided in this package.

func Wrap

func Wrap(client *dynamodb.Client) *Wrapper

Wrap creates a new wrapper from the specified client.

func (Wrapper) Delete

func (w Wrapper) Delete(ctx context.Context, item model.Item, options ...func(*delete.Opts)) (*dynamodb.DeleteItemOutput, error)

Delete makes a dynamodb.DeleteItemInput request.

Return the original dynamodb.DeleteItemOutput output and any error.

See delete.Opts for the various options that can be passed into this method.

func (Wrapper) Load

func (w Wrapper) Load(ctx context.Context, item model.Item, options ...func(opts *load.Opts)) (*dynamodb.GetItemOutput, error)

Load makes a dynamodb.GetItemInput request and loads the response into the specified modeling. The modeling must have its key filled out. Return the original dynamodb.GetItemOutput output and any error. If it doesn't exist in database, the modeling will not be modified, and len(output.Item) will be 0.

func (Wrapper) Save

func (w Wrapper) Save(ctx context.Context, item model.Item, options ...func(*save.Opts)) (*dynamodb.PutItemOutput, error)

Save makes a dynamodb.PutItemInput request.

Return the original dynamodb.PutItemOutput output and any error.

See save.Opts for the various options that can be passed into this method.

func (Wrapper) Update

func (w Wrapper) Update(ctx context.Context, item model.Item, required func(*update.Opts), options ...func(*update.Opts)) (*dynamodb.UpdateItemOutput, error)

Update makes a dynamodb.UpdateItemInput request.

At least one update expression must be given such as update.SetOrRemove. See update.Opts for more options. The item being passed in is only used for its model.Item.GetKey and model.Item.GetTableName; any other attributes that are set in the item must be explicitly updated with an opt. This is because there's no easy way to scan through (maybe with reflection) all attributes to see which are non-nil or non-zero, and then create the SET or REMOVE actions accordingly.

Return the original dynamodb.UpdateItemOutput output and any error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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