Repository navigation
Releases
Releases · insd47/keygrip
v0.5.1
v0.5.0
Added
- declare sort key spaces with literal sort key parts (#6)
- await transactions with the client of their first write (#4)
Changed
- [breaking] take the page limit as u32 and describe Cursor as it is (#14)
- [breaking] run transactions with the client of their first write (#13)
- [breaking] mark Error non_exhaustive and default Result's error type (#12)
- [breaking] drop the unused lifetime from Schema::Key (#11)
- [breaking] return Merge from Entity::merge (#10)
v0.4.0
0.4 fills the gaps in the typed API so the extension toolkit can leave the public surface. Writes are values with one condition rule, and transactions assemble the same values.
Added
Query::consistentfor strongly consistent queries (rejected withError::Invalidon a GSI).
Changed
Entity::put,update,merge, anddeletereturnPut,Update, orDelete, which run when awaited (or throughrun). A rejected condition resolves tofalseeverywhere;Update::fetchresolves toNone.Conditionguards a write:Condition::absent(),Condition::exists(), or anyExpression.Expression::valuebinds anyimpl Serialize, replacingstring,number,boolean, and rawAttributeValues.Transaction::addtakes write values andrunresolves to anOutcome(committed(),rejected(label)) instead of failing withTransactionError. Cancellations other than rejected conditions fail withError::Unavailable.Error::Invalidholds failures that retrying cannot fix: conflicting placeholders, (de)serialization, unsupported combinations.Error::Unavailableis now transient failures only.Expression,Transaction, andOutcomeare exported from the crate root.
Removed
Entity::create,Entity::store, and the immediateput/delete;Error::Conflict;TransactionError.- The extension toolkit:
attr,item,request, andocc.
Migration
| 0.3 | 0.4 |
|---|---|
table.create(&x).await? erroring with Error::Conflict |
if !table.put(&x).when(Condition::absent()).await? { /* conflict */ } — check the bool; .await?; alone silently ignores the conflict |
table.put(&x).await? |
table.put(&x).await?; (always true) |
table.delete(key).await? |
table.delete(key).await?; |
table.store(&x).when(c).run().await? |
table.put(&x).when(c).await? |
table.update(k, e).when(c).run().await? |
table.update(k, e).when(c).await? |
use keygrip::expression::Expression |
use keygrip::Expression |
.string(":s", v) / .number(":n", v) / .boolean(":b", v) |
.value(":s", &v) / .value(":n", &v) / .value(":b", &v) |
.value(":x", item::value(&x)?) |
.value(":x", &x) |
.value(":l", attr::list(vec![attr::s(s)])) |
.value(":l", &vec![s]) (a list, L) |
Transaction::new().put(&t, &x)?.when(c).label("a") |
Transaction::new().add(t.put(&x).when(c)).label("a") |
run(&client).await → Err(e) if e.failed("a") |
run(&client).await? → outcome.rejected("a"); check committed() |
occ::retry(n, conflict, …) |
a retry loop in your crate around a write that resolves to false |
raw get_item + item::from for another item shape |
a hand-written impl Schema for that shape and its own Entity on the same table |
request::unavailable for your own errors |
your own error type |
Error::Unavailable on (de)serialization failures |
Error::Invalid |
match on Error::Conflict(_) (e.g. → HTTP 409) |
remove the arm; conflicts are the bool/Outcome at the call site. Add an Error::Invalid(_) arm |