Releases: guregu/dynamo
Improved array handling
This is a minor release that improves how array marshaling and unmarshaling is handled.
- Fixed a bug that caused a panic when unmarshaling a binary DynamoDB value into a Go array that is too small. Now returns an error. See #124.
- Improved performance when marshaling and unmarshaling array values.
Support Count with Scan
This release adds Count functionality to Scan.
It also fixes Get to use a Query (instead of erroring out attempting a GetItem) when provided a Limit.
Bug fix for CreateTable
Improved ConsumedCapacity
This release adds more fields to the ConsumedCapacity struct, allowing you to track the read and write capacity units consumed on indexes and the table, not just the total.
Note that this seems to only work for transactions.
See: #112
TextMarshaler map keys for sets
This is a minor release that enables map[X]struct{}
or map[X]bool
to be used as a set, where X implements encoding.TextMarshaler
and encoding.TextUnmarshaler
.
Additionally, error handling for operations has been standardized to always return the first error they encounter, previously it was inconsistent depending on the operation. Put's error handling also had a bug that caused it to not return pre-run errors like encoding issues, which could result in unhelpful error messages. This is now fixed.
TTL, Unix Time, and more
This release adds Table.UpdateTTL
and Table.DescribeTTL
to modify and obtain time-to-live configuration (#51).
You can also use unixtime
as a special struct tag modifier along with time.Time
to force it to encode to Unix time in seconds, which is useful for TTL expirations (#109).
type Data struct {
ID int
Expires time.Time `dynamo:",unixtime"`
Value int
}
Additionally, you can now specify custom idempotency tokens for transactions with WriteTx.IdempotentWithToken
(#95). The docs have been slightly improved as well.
Thank you @roberth-k and @greggjs for the contributions.
CreateTable improvements
This release improves support for various types in CreateTable. uint
types are now handled properly. Additonally, dynamodbattribute.Marshaler
such as dynamodbattribute.UnixTime
can now be used as table keys in CreateTable.
It also bumps up the AWS SDK version in go.mod to properly support tags.
Thank you to @Songmu for the contributions.
See: #106 and #107
Initial support for tags
Omitempty bugfix
This fixes an issue with the omitempty struct tag and nil pointers of types where IsZero
is defined on the value type, such as *time.Time
(#101).
Better nil support
This release fixes #99 by properly handling nil pointers of special encoders (such as TextMarshaler) whose encoding methods were on the value receiver. For example, *time.Time
is now handled properly and will be automatically omitted if nil. Previously, it panicked.
Also, Update.Set
now handles these properly by removing the given path. It does this for nil, nil pointers, and empty strings as well. However, if the nil pointer is a special encoder and its encoding method has a pointer receiver, it will not be removed. Previously, it erroneously returned an AWS SerializationException.
This means that instead of writing code like:
u := table.Update(...)
if someString == "" {
u.Remove("SomeString")
} else {
u.Set("SomeString", someString)
}
You may instead just write:
u.Set("SomeString", someString)
This changes Update to match its behavior with Put for automatically omitted attributes.