dynamodb

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ItemKeys

func ItemKeys(item Item) []string

ItemKeys returns the sorted keys from an item.

func RawLastEvaluatedKey

func RawLastEvaluatedKey(m map[string]interface{}) map[string]types.AttributeValue

RawLastEvaluatedKey converts the generic map back to DynamoDB attribute values. This is used for pagination continuations.

Types

type AttributeDefinition

type AttributeDefinition struct {
	Name string
	Type string // S, N, B
}

AttributeDefinition describes an attribute's name and type.

type Client

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

Client wraps the DynamoDB API for table and item operations.

func NewClient

func NewClient(cfg aws.Config) *Client

NewClient creates a new DynamoDB client from the provided AWS config.

func (*Client) DescribeTable

func (c *Client) DescribeTable(ctx context.Context, tableName string) (*TableDescription, error)

DescribeTable returns detailed information about a table.

func (*Client) ListTables

func (c *Client) ListTables(ctx context.Context, exclusiveStartTableName *string) ([]Table, *string, error)

ListTables returns DynamoDB tables, paginated via exclusiveStartTableName.

func (*Client) Scan

func (c *Client) Scan(ctx context.Context, tableName string, exclusiveStartKey map[string]types.AttributeValue, limit int32) (*ScanResult, error)

Scan performs a table scan and returns items as simplified string maps.

type DynamoDBAPI

type DynamoDBAPI interface {
	ListTables(ctx context.Context, params *dynamodb.ListTablesInput, optFns ...func(*dynamodb.Options)) (*dynamodb.ListTablesOutput, error)
	DescribeTable(ctx context.Context, params *dynamodb.DescribeTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DescribeTableOutput, error)
	Scan(ctx context.Context, params *dynamodb.ScanInput, optFns ...func(*dynamodb.Options)) (*dynamodb.ScanOutput, error)
}

DynamoDBAPI captures the AWS SDK methods we use.

type IndexDescription

type IndexDescription struct {
	Name      string
	Status    string
	KeySchema []KeySchema
}

IndexDescription describes a Global Secondary Index.

type Item

type Item map[string]string

Item represents a DynamoDB item as a map of attribute name to display value.

type KeySchema

type KeySchema struct {
	AttributeName string
	KeyType       string // HASH or RANGE
}

KeySchema describes a key attribute in a DynamoDB table.

type ScanResult

type ScanResult struct {
	Items            []Item
	LastEvaluatedKey map[string]interface{}
	ScannedCount     int32
}

ScanResult contains the result of a Scan operation.

type Table

type Table struct {
	Name string
}

Table represents a DynamoDB table summary.

type TableDescription

type TableDescription struct {
	Name                   string
	Status                 string
	ItemCount              int64
	TableSizeBytes         int64
	CreationDateTime       time.Time
	KeySchema              []KeySchema
	AttributeDefinitions   []AttributeDefinition
	BillingMode            string
	ReadCapacity           int64
	WriteCapacity          int64
	GlobalSecondaryIndexes []IndexDescription
}

TableDescription contains detailed metadata about a DynamoDB table.

Jump to

Keyboard shortcuts

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