dynamodb

module
v0.0.0-...-e995d3a Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0

README

DynamoDB code examples for the SDK for Go

Overview

Shows how to use the AWS SDK for Go (v2) to create Amazon DynamoDB tables and move data in and out of them.

Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.

⚠️ Important

  • Running this code might result in charges to your AWS account.
  • Running the tests might result in charges to your AWS account.
  • We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see Grant least privilege.
  • This code is not tested in every AWS Region. For more information, see AWS Regional Services.

Code examples

Single action
Scenario

Running the examples

Get started using tables, items, and queries

This interactive scenario runs at a command prompt and shows you how to use DynamoDB to do the following:

  • Create a table that can hold movie data.
  • Put, get, and update a single movie in the table.
  • Write movie data to the table from a sample JSON file.
  • Query for movies that were released in a given year.
  • Scan for movies that were released in a range of years.
  • List tables in your account.
  • Delete a movie from the table.
  • Delete the table.

Install all required resources and start the example by running the following in the dynamodb folder at a command prompt.

go mod tidy
go run ./cmd -scenario movieTable
Query a table using PartiQL

These two scenarios show you how to run PartiQL statements to query a DynamoDB table of movie data. You can do this one at a time or in batches. Both scenarios add, get, update, and delete movies in the table.

Install all required resources and start the example by running one of the following in the dynamodb folder at a command prompt.

go mod tidy
go run ./cmd -scenario partiQLSingle
go run ./cmd -scenario partiQLBatch
Prerequisites

Prerequisites for running the examples for this service can be found in the README in the GoV2 folder.

Tests

Instructions for running the tests for this service can be found in the README in the GoV2 folder.

Additional resources


Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Directories

Path Synopsis
Package stubs defines service action stubs that are used by both the action and scenario unit tests.
Package stubs defines service action stubs that are used by both the action and scenario unit tests.

Jump to

Keyboard shortcuts

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