Documentation ¶
Overview ¶
Package dynamodb contains an implementation of the `gokv.Store` interface for Amazon DynamoDB.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{ Codec: encoding.JSON, }
DefaultOptions is an Options object with default values. Region: "" (use shared config file or environment variable), TableName: "gokv", AWSaccessKeyID: "" (use shared credentials file or environment variable), AWSsecretAccessKey: "" (use shared credentials file or environment variable), CustomEndpoint: "", Codec: encoding.JSON
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a gokv.Store implementation for DynamoDB.
func NewClient ¶
NewClient creates a new DynamoDB client.
Credentials can be set in the options, but it's recommended to either use the shared credentials file (Linux: "~/.aws/credentials", Windows: "%UserProfile%\.aws\credentials") or environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY). See https://github.com/awsdocs/aws-go-developer-guide/blob/0ae5712d120d43867cf81de875cb7505f62f2d71/doc_source/configuring-sdk.rst#specifying-credentials.
func (Client) Close ¶
Close closes the client. In the DynamoDB implementation this doesn't have any effect.
func (Client) Delete ¶
Delete deletes the stored value for the given key. Deleting a non-existing key-value pair does NOT lead to an error. The key must not be "".
func (Client) Get ¶
Get retrieves the stored value for the given key. You need to pass a pointer to the value, so in case of a struct the automatic unmarshalling can populate the fields of the object that v points to with the values of the retrieved object's values. If no value is found it returns (false, nil). The key must not be "" and the pointer must not be nil.
type Options ¶
type Options struct { Session *session.Session AWSConfig *aws.Config TableName string // CustomEndpoint allows you to set a custom DynamoDB service endpoint. // This is especially useful if you're running a "DynamoDB local" Docker container for local testing. // Typical value for the Docker container: "http://localhost:8000". // See https://hub.docker.com/r/amazon/dynamodb-local/. // Optional ("" by default) CustomEndpoint string // Encoding format. // Optional (encoding.JSON by default). Codec encoding.Codec }
Options are the options for the DynamoDB client.