Documentation ¶
Overview ¶
Package dynamocity provides helpful types for working with DynamoDB
OverrideEndpointResolver is a utility resolver for replacing the endpoint for a dynamo service to use http://localhost:8000 for testing with a dynamodb-local.
Index ¶
- Constants
- func BetweenEndInc(t, startExclusive, endInclusive time.Time) bool
- func BetweenExclusive(t, startExclusive, endExclusive time.Time) bool
- func BetweenInclusive(t, start, end time.Time) bool
- func BetweenStartInc(t, startInclusive, endExclusive time.Time) bool
- func MakeEndpointResolver(services map[string]string) aws.EndpointResolver
- type MillisTime
- func (t MillisTime) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
- func (t MillisTime) MarshalJSON() ([]byte, error)
- func (t MillisTime) String() string
- func (t MillisTime) Time() time.Time
- func (t *MillisTime) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
- func (t *MillisTime) UnmarshalJSON(b []byte) error
- type NanoTime
- func (t NanoTime) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
- func (t NanoTime) MarshalJSON() ([]byte, error)
- func (t NanoTime) String() string
- func (t NanoTime) Time() time.Time
- func (t *NanoTime) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
- func (t *NanoTime) UnmarshalJSON(b []byte) error
- type OverrideEndpointResolver
- type SecondsTime
- func (t SecondsTime) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
- func (t SecondsTime) MarshalJSON() ([]byte, error)
- func (t SecondsTime) String() string
- func (t SecondsTime) Time() time.Time
- func (t *SecondsTime) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
- func (t *SecondsTime) UnmarshalJSON(b []byte) error
Constants ¶
const FlexibleNanoFmt = time.RFC3339Nano
FlexibleNanoFmt is the standard library time.RFC3339Nano, which applies a flexible compatible nanosecond precision marshalling and unmarshalling capability. However, when marshalling the standard library time.RFC3339Nano format removes trailing zeros from the seconds field, and thus may not sort correctly once formatted.
Therefore, this format is unsafe for marshalling to dynamo or JSON if the resultant value is expected to be sortable by string.
const StrictMillisFmt = "2006-01-02T15:04:05.000Z07:00"
StrictMillisFmt applies a strict millisecond precision marshalling of a dynamocity.NanoTime. This ensures that trailing zeros are never stripped. The standard library time.RFC3339Nano format removes trailing zeros from the seconds field, and thus may not sort correctly once formatted.
Unmarshalling using StrictMillisFmt will result in errors if the string does not strictly match the RFC3339 format with millisecond precision. For example: `2006-01-02T15:04:05.000Z07:00`
const StrictNanoFmt = "2006-01-02T15:04:05.000000000Z07:00"
StrictNanoFmt applies a strict nanosecond precision marshalling of a dynamocity.NanoTime. This ensures that trailing zeros are never stripped. The standard library time.RFC3339Nano format removes trailing zeros from the seconds field, and thus may not sort correctly once formatted.
Unmarshalling using StrictNanoFmt will result in errors if the string does not strictly match the RFC3339 format with fixed nanosecond precision. For example: `2006-01-02T15:04:05.000000000Z07:00`
const StrictSecondsFmt = time.RFC3339
StrictSecondsFmt is the standard library time.RFC3339, which applies a strict second precision marshalling and unmarshalling capability.
Unmarshalling using StrictSecondsFmt will result in errors if the string does not strictly match the time.RFC3339 format. For example: `2006-01-02T15:04:05Z07:00`
Variables ¶
This section is empty.
Functions ¶
func BetweenEndInc ¶
BetweenEndInc will return true if this dynamocity.MillisTime is after the start and before or equal to the end
func BetweenExclusive ¶
BetweenExclusive will return true if this dynamocity.MillisTime is after the start and before to the end
func BetweenInclusive ¶
BetweenInclusive will return true if this dynamocity.MillisTime is after or equal to the start and before or equal to the end
func BetweenStartInc ¶
BetweenStartInc will return true if this dynamocity.MillisTime is after or equal to the start and before the end
func MakeEndpointResolver ¶
func MakeEndpointResolver(services map[string]string) aws.EndpointResolver
MakeEndpointResolver is a factory function for creating an aws.EndpointResolver
Types ¶
type MillisTime ¶
MillisTime represents a sortable strict RFC3339 Timestamp with fixed millisecond precision, making it string sortable. MillisTime implements dynamodbattribute.Marshaler, dynamodbattribute.Unmarshaller The standard library time.RFC3339Nano format removes trailing zeros from the seconds field and thus may not sort correctly once formatted.
func (MillisTime) MarshalDynamoDBAttributeValue ¶
func (t MillisTime) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
MarshalDynamoDBAttributeValue implements the dynamodb.Marshaler interface to marshal a dynamocity.MillisTime into a DynamoDB AttributeValue string value with specific millisecond precision
func (MillisTime) MarshalJSON ¶
func (t MillisTime) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface to marshal RFC3339 timestamps with millisecond precision
func (MillisTime) String ¶
func (t MillisTime) String() string
String implements the fmt.Stringer interface to supply a native String representation for a value in RFC3339 Format with millisecond precision
func (MillisTime) Time ¶
func (t MillisTime) Time() time.Time
Time is a handler func to return an instance of dynamocity.MillisTime as time.Time
func (*MillisTime) UnmarshalDynamoDBAttributeValue ¶
func (t *MillisTime) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
UnmarshalDynamoDBAttributeValue implements the dynamodb.Unmarshaler interface to unmarshal a dynamodb.AttributeValue into a dynamocity.MillisTime. This unmarshal is flexible on millisecond precision
func (*MillisTime) UnmarshalJSON ¶
func (t *MillisTime) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface to marshal RFC3339 timestamps with millisecond precision
type NanoTime ¶
NanoTime represents a sortable strict RFC3339 Timestamp with fixed nanosecond precision, making it string sortable. NanoTime implements dynamodbattribute.Marshaler, dynamodbattribute.Unmarshaller The standard library time.RFC3339Nano format removes trailing zeros from the fractional seconds field and thus may not sort correctly once formatted.
func (NanoTime) MarshalDynamoDBAttributeValue ¶
func (t NanoTime) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
MarshalDynamoDBAttributeValue implements the dynamodb.Marshaler interface to marshal a dynamocity.NanoTime into a DynamoDB AttributeValue string value with specific nanosecond precision
func (NanoTime) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface to marshal RFC3339 timestamps with nanosecond precision
func (NanoTime) String ¶
String implements the fmt.Stringer interface to supply a native String representation for a value in RFC3339 Format with nanosecond precision
func (NanoTime) Time ¶
Time is a handler func to return an instance of dynamocity.NanoTime as time.Time
func (*NanoTime) UnmarshalDynamoDBAttributeValue ¶
func (t *NanoTime) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
UnmarshalDynamoDBAttributeValue implements the dynamodb.Unmarshaler interface to unmarshal a dynamodb.AttributeValue into a dynamocity.NanoTime. This unmarshal is flexible on nanosecond precision
func (*NanoTime) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface to marshal RFC3339 timestamps with nanosecond precision
type OverrideEndpointResolver ¶
type OverrideEndpointResolver struct {
// contains filtered or unexported fields
}
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
func (*OverrideEndpointResolver) ResolveEndpoint ¶
func (o *OverrideEndpointResolver) ResolveEndpoint(service, region string) (aws.Endpoint, error)
ResolveEndpoint implements the EndpointResolver interface which resolves an endpoint for a service endpoint id and region.
type SecondsTime ¶
SecondsTime represents a sortable strict RFC3339 Timestamp with fixed second precision, making it string sortable. SecondsTime implements dynamodbattribute.Marshaler, dynamodbattribute.Unmarshaller specifically for the time.RFC3339 format which does not permit fractional seconds; however, once this format is marshalled it may be sorted correctly in a string value
func (SecondsTime) MarshalDynamoDBAttributeValue ¶
func (t SecondsTime) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
MarshalDynamoDBAttributeValue implements the dynamodb.Marshaler interface to marshal a dynamocity.SecondsTime into a DynamoDB AttributeValue string value with specific second precision
func (SecondsTime) MarshalJSON ¶
func (t SecondsTime) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface to marshal RFC3339 timestamps with second precision
func (SecondsTime) String ¶
func (t SecondsTime) String() string
String implements the fmt.Stringer interface to supply a native String representation for a value in time.RFC3339 Format with second precision
func (SecondsTime) Time ¶
func (t SecondsTime) Time() time.Time
Time is a handler func to return an instance of dynamocity.SecondsTime as time.Time
func (*SecondsTime) UnmarshalDynamoDBAttributeValue ¶
func (t *SecondsTime) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
UnmarshalDynamoDBAttributeValue implements the dynamodb.Unmarshaler interface to unmarshal a dynamodb.AttributeValue into a dynamocity.SecondsTime. This unmarshal is flexible on fractional second precision
func (*SecondsTime) UnmarshalJSON ¶
func (t *SecondsTime) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface to marshal RFC3339 timestamps with second precision