modulepackage
0.0.1-alpha-5
Repository: https://github.com/edwardsmatt/dynamocity.git
Documentation: pkg.go.dev
# README
dynamocity
Dynamocity is a helpful library for doing things with DynamoDB in Go using the AWS Go SDK V2.
Rationale
From the standard go library time.RFC3339Nano documentation
The RFC3339Nano format removes trailing zeros from the seconds field and thus may not sort correctly once formatted.
Subsequently, because the existing AWS Go SDK V2 uses time.RFC3339Nano
, it is not suitable to use time.Time
as a Dynamo DB Sort Key in a string attribute type.
The reason why dynamocity.NanoTime
exists is because it provides an implementation dynamodbattribute.Marshaler
, dynamodbattribute.Unmarshaller
which enforces fixed nanosecond precision when marshalling for DynamoDB, making it safe for use as a DynamoDB range key.
Prerequisites
docker-compose
go 1.12
(in alignment with the AWS Go SDK V2)
Getting Started
Execute the following to provide an explanation of tasks that are commonly used for development.
make help
The output explains the common make targets and what they do:
Perform common development tasks
Usage: make [TARGET]
Targets:
clean Clean removes the vendor directory, go.mod, and go.sum files
prepare Sets up a go.mod, go.sum and downloads all vendor dependencies
test Starts a dynamo local dynamo container and runs unit and integration tests
# Functions
BetweenEndInc will return true if this dynamocity.MillisTime is after the start and before or equal to the end.
BetweenExclusive will return true if this dynamocity.MillisTime is after the start and before to the end.
BetweenInclusive will return true if this dynamocity.MillisTime is after or equal to the start and before or equal to the end.
BetweenStartInc will return true if this dynamocity.MillisTime is after or equal to the start and before the end.
MakeEndpointResolver is a factory function for creating an aws.EndpointResolver.
# Constants
FlexibleNanoFmt is the standard library time.RFC3339Nano, which applies a flexible compatible nanosecond precision marshalling and unmarshalling capability.
StrictMillisFmt applies a strict millisecond precision marshalling of a dynamocity.NanoTime.
StrictNanoFmt applies a strict nanosecond precision marshalling of a dynamocity.NanoTime.
StrictSecondsFmt is the standard library time.RFC3339, which applies a strict second precision marshalling and unmarshalling capability.
# Structs
OverrideEndpointResolver is an endpoint resolver for providing overridden endpoints for AWS services Overriding the endpoints for services is helpful for testing, including running dynamodb-local.
# Type aliases
MillisTime represents a sortable strict RFC3339 Timestamp with fixed millisecond precision, making it string sortable.
NanoTime represents a sortable strict RFC3339 Timestamp with fixed nanosecond precision, making it string sortable.
SecondsTime represents a sortable strict RFC3339 Timestamp with fixed second precision, making it string sortable.