Published by guregu over 4 years ago
This is a minor release that improves how array marshaling and unmarshaling is handled.
Published by guregu over 4 years ago
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.
Published by guregu over 4 years ago
This release fixes an issue with CreateTable.Index
(#121) and adds some additional error checking in Batch Get (#119).
Published by guregu almost 5 years ago
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
Published by guregu almost 5 years ago
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.
Published by guregu almost 5 years ago
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.
Published by guregu about 5 years ago
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
Published by guregu about 5 years ago
This release adds CreateTable.Tag
to specify metadata tags during table creation. More support for tags will be forthcoming.
See: #104 (Thanks @Nazozen!)
Published by guregu over 5 years ago
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).
Published by guregu over 5 years ago
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.
Published by guregu over 5 years ago
This release updates dependencies, fixes and improves some docs (#86, #91), and fixes a couple instances where context didn't get passed to the AWS SDK (#93).
Published by guregu over 5 years ago
This release adds some new features:
OnDemand(true)
.If
multiple times when using Update, Put, Delete, and ConditionCheck and your conditions will be combined with AND. Formerly, it replaced the previous condition which could lead to buggy behavior.
Filter
in Query and Scan is now careful about adding parentheses so that multiple calls will always have isolated conditions.Published by guregu over 5 years ago
This is a minor release that fixes CreateTable not working under certain conditions. See: #88
Published by guregu almost 6 years ago
This release adds support for DynamoDB transactions! For a quick and dirty intro to them, see tx_test.go
.
You create transactions by composing pre-existing parts of the library such as Update and Delete.
For example, imagine a game where you can give money to other players. The following transaction models Alice giving 100 gold to Bob and adding a log to a separate table, but only if Alice has enough gold.
tx := db.WriteTx()
users := db.Table("Users")
logs := db.Table("TradeLogs")
amount := 100
tx.Update(users.Update("UserID", "Alice").Add("Gold", -amount).If("Gold >= ?", amount))
tx.Update(users.Update("UserID", "Bob").Add("Gold", amount))
tx.Put(logs.Put(TradeLog{From: "Alice", To: "Bob", Amount: amount, Time: time.Now()}))
err := tx.Run()
If any part of the transaction fails, it will be rolled back and an appropriate error will be returned.
The official AWS Go SDK is still missing some transactions features, and we'll add support for them as they trickle in.
This release also adds support for Go modules.
Published by guregu about 6 years ago
The API has been relatively stable since the beginning and that API is now officially version 1 🎉
There are still things to add and changes I'd like to make, but rest assured that semver will be upheld.
Thanks to everyone who uses this library.