Documentation ¶
Overview ¶
Package dynamox contains DynamoDB utilities.
Index ¶
- Variables
- func AsBool(item map[string]types.AttributeValue, name string) (bool, error)
- func AsBytes(item map[string]types.AttributeValue, name string) ([]byte, error)
- func AsNumericString(item map[string]types.AttributeValue, name string) (string, error)
- func AsUint[T ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64](item map[string]types.AttributeValue, name string) (T, error)
- func CreateTableIfNotExists(ctx context.Context, client *dynamodb.Client, table string, ...) error
- func DeleteTableIfExists(ctx context.Context, client *dynamodb.Client, table string, ...) error
- func NewTestClient(t testing.TB) *dynamodb.Client
- func QueryOne(ctx context.Context, client *dynamodb.Client, ...) (bool, error)
- func QueryRange(ctx context.Context, client *dynamodb.Client, ...) error
- type KeyAttr
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // True is a [types.AttributeValueMemberBOOL] for true. True = &types.AttributeValueMemberBOOL{Value: true} // False is a [types.AttributeValueMemberBOOL] for false. False = &types.AttributeValueMemberBOOL{Value: false} )
Functions ¶
func AsBool ¶ added in v0.10.0
AsBool fetches a boolean attribute from an item. It returns false if the item is absent.
func AsNumericString ¶ added in v0.10.0
AsNumericString fetches the string representation of a numeric attribute from an item.
func AsUint ¶ added in v0.10.0
func AsUint[T ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64]( item map[string]types.AttributeValue, name string, ) (T, error)
AsUint fetches an unsigned integer attribute from an item.
func CreateTableIfNotExists ¶ added in v0.10.0
func CreateTableIfNotExists( ctx context.Context, client *dynamodb.Client, table string, onRequest func(any) []func(*dynamodb.Options), key ...KeyAttr, ) error
CreateTableIfNotExists creates a DynamoDB table if it does not exist.
func DeleteTableIfExists ¶ added in v0.10.0
func DeleteTableIfExists( ctx context.Context, client *dynamodb.Client, table string, onRequest func(any) []func(*dynamodb.Options), ) error
DeleteTableIfExists deletes a DynamoDB table if it exists.
func NewTestClient ¶
NewTestClient returns a new DynamoDB client for use in a test.
func QueryOne ¶ added in v0.10.0
func QueryOne( ctx context.Context, client *dynamodb.Client, m func(any) []func(*dynamodb.Options), in *dynamodb.QueryInput, fn func(context.Context, map[string]types.AttributeValue) error, ) (bool, error)
QueryOne executes a query and calls fn for the first item in the result set.
func QueryRange ¶ added in v0.10.0
func QueryRange( ctx context.Context, client *dynamodb.Client, m func(any) []func(*dynamodb.Options), in *dynamodb.QueryInput, fn func(context.Context, map[string]types.AttributeValue) (bool, error), ) error
QueryRange executes a query and calls fn for each item in the result set.
Types ¶
Click to show internal directories.
Click to hide internal directories.