Skip to content

Commit

Permalink
Add ConsistentRead to Scan query
Browse files Browse the repository at this point in the history
  • Loading branch information
James Crasta committed Aug 7, 2017
1 parent e3946db commit 8c3974e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion functional_test.go
Expand Up @@ -347,7 +347,7 @@ func TestQueryPagination(t *testing.T) {
func TestScanBasic(t *testing.T) {
assert, client := funcTest.setUp(t)
assert.NoError(batchAddPosts(client, 50, 100, 120))
scan := client.Scan("Posts").Limit(20)
scan := client.Scan("Posts").ConsistentRead(true).Limit(20)
result, err := scan.Execute()
assert.NoError(err)
assert.NotEqual(0, len(result.Items))
Expand Down
6 changes: 6 additions & 0 deletions request_scan.go
Expand Up @@ -16,6 +16,12 @@ func newScan(c *Client, table string) *Scan {
return &Scan{c, req}
}

// ConsistentRead does a strongly consistent scan if strong is true. (defaults to false)
func (s Scan) ConsistentRead(strong bool) *Scan {
s.req.ConsistentRead = &strong
return &s
}

/*
ExclusiveStartKey sets the start key (effectively the offset cursor).
*/
Expand Down

0 comments on commit 8c3974e

Please sign in to comment.