forked from dapr/go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SaveStateWithETag() convenience function (dapr#321)
In the state API there's an existing DeleteStateWithETag() convenience function but there does not appear to be an equivalent SaveStateWithETag(). This commit adds SetStateWithETag() so that consumers of the SDK don't have to employ the more verbose SaveBulkState() when they only need to update a singular item. Client code updating a single item with an etag prior to this commit looks like: -- item := &dapr.SetStateItem{ Etag: &dapr.ETag{ Value: "deadbeef", }, Key: "order_1", Value: []byte(data), } err := client.SaveBulkState(ctx, store, item) -- Client code after this commit can reduce to: -- err := client.SaveStateWithEtag(ctx, store, "order_1", []byte(data), "deadbeef") -- Signed-off-by: Mike Brown <[email protected]> Signed-off-by: Mike Brown <[email protected]>
- Loading branch information
Showing
3 changed files
with
14 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters