tywalch / electrodb

A DynamoDB library to ease the use of modeling complex hierarchical relationships and implementing a Single Table Design while keeping your query code readable.
MIT License
1.03k stars 66 forks source link

Support `ConsistentRead` option #370

Closed harlowk closed 4 months ago

harlowk commented 8 months ago

ConsistentRead Determines the read consistency model: If set to true, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.

Request to add consistentRead as an input option to gofor GET requests.

Expected:

    const { data: payment } = await PaymentSource.get({id:'xxx'}).go({
            consistentRead: true
    }); 

    // operation uses strongly consistent reads

I'll open an MR for this if I can find time.

tywalch commented 8 months ago

Yo! So there isn't a consistentRead option but you can use

entity.get({...})
    .go({ 
        params: {
            ConsistentRead: true
        }
    });

The params option is a sort of "escape hatch" to put properties directly onto the ddb parameters sent off 💪

tywalch commented 8 months ago

Oh, I'm dumb, I see now this is a request to add this option, not that it "doesn't work". I can add it 👍

harlowk commented 4 months ago

Oh, I'm dumb, I see now this is a request to add this option, not that it "doesn't work". I can add it 👍

Ha no, it was more the latter - forgot the params object took those untyped params!