awsHelpers

package
v0.0.0-...-8e47c6c Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyFields = errors.New("cannot generate a conditional expression for empty fields")

Functions

func DDBIfAnyValueChangedCondition

func DDBIfAnyValueChangedCondition(ifAttributeValuesChanged map[string]types.AttributeValue) (expression.ConditionBuilder, error)

DDBIfAnyValueChangedCondition creates a conditional update expression that will only allow a table item to update if one of the field values provided in ifAttributeValuesChanged is different than the currently-stored values. This facilitates updating certain attributes (not included in ifAttributeValuesChanged) only when when a subset of attributes (which are included in ifAttributeValuesChanged) actually have updates. The primary use-case for this functionality is managing a revision identifier attribute, which must be updated only when at least one other item attribute is modified, but should never be the sole update to an existing item.

Returns ErrEmptyFields when ifAttributeValuesChanged is an empty map.

func DDBSetRevisionForUpdate

func DDBSetRevisionForUpdate(builder expression.UpdateBuilder) expression.UpdateBuilder

DDBSetRevisionForUpdate adds a DynamoDB SET operation to an UpdateBuilder, which sets the value of an item's "revision" attribute to a freshly-generated ULID string.

func GetConfig

func GetConfig(ctx context.Context) (aws.Config, error)

GetConfig returns an AWS SDK v2 Config with a custom resolver that resolves SDK requests to an endpoint at http://$LOCALSTACK_HOSTNAME:4566 when $LOCALSTACK_HOSTNAME is configured in the current environment. $EDGE_PORT will override port 4566 only when $LOCALSTACK_HOSTNAME is also set. If no $LOCALSTACK_HOSTNAME variable exists in the current environment, the resolver falls back to the SDK's default endpoint resolution behavior.

func GetSQSClient

func GetSQSClient(ctx context.Context) (*sqs.Client, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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