Ditto
1.0.14
|
ScopedWriteTransaction
exposes functionality that allows you to perform multiple operations on the store within a single write transaction.
More...
Public Member Functions | |
DocumentId | insert (nlohmann::json content, DocumentId id=DocumentId(), bool is_default=false) |
Inserts a document into the scoped collection and returns the document's ID. More... | |
DocumentId | insert_with_strategy (nlohmann::json content, DocumentId id=DocumentId(), WriteStrategy write_strategy=WriteStrategy::overwrite) |
Inserts a document into the scoped collection and returns the document's ID. More... | |
WriteTransactionPendingIDSpecificOperation | find_by_id (DocumentId id) const |
Generates a WriteTransactionPendingIDSpecificOperation with the provided document ID that can be used to update, remove, or evict the document. More... | |
WriteTransactionPendingCursorOperation | find_all () |
Generates a WriteTransactionPendingCursorOperation that can be used to update, remove or evict documents. More... | |
WriteTransactionPendingCursorOperation | find (std::string query) |
Generates a WriteTransactionPendingCursorOperation with the provided query that can be used to update, remove, or evict documents. More... | |
WriteTransactionPendingCursorOperation | find (std::string query, nlohmann::json query_args) |
Generates a WriteTransactionPendingCursorOperation with the provided query that can be used to update, remove, or evict documents. More... | |
Public Attributes | |
std::string | collection_name |
ScopedWriteTransaction
exposes functionality that allows you to perform multiple operations on the store within a single write transaction.
WriteTransactionPendingCursorOperation ditto::ScopedWriteTransaction::find | ( | std::string | query | ) |
Generates a WriteTransactionPendingCursorOperation
with the provided query that can be used to update, remove, or evict documents.
query | the query to run against the collection. |
WriteTransactionPendingCursorOperation
that you can use to chain further query-related function calls. WriteTransactionPendingCursorOperation ditto::ScopedWriteTransaction::find | ( | std::string | query, |
nlohmann::json | query_args | ||
) |
Generates a WriteTransactionPendingCursorOperation
with the provided query that can be used to update, remove, or evict documents.
This is the recommended function to use when performing queries on a collection if you have any dynamic data included in the query string. It allows you to provide a query string with placeholders, in the form of $args.my_arg_name
, along with an accompanying dictionary of arguments, in the form of { "my_arg_name": "some value" }
, and the placeholders will be appropriately replaced by the matching provided arguments from the dictionary. This includes handling things like wrapping strings in quotation marks and arrays in square brackets, for example.
query | the query to run against the collection. |
query_args | the arguments to use to replace placeholders in the provided query. |
WriteTransactionPendingCursorOperation
that you can use to chain further query-related function calls. WriteTransactionPendingCursorOperation ditto::ScopedWriteTransaction::find_all | ( | ) |
Generates a WriteTransactionPendingCursorOperation
that can be used to update, remove or evict documents.
WriteTransactionPendingCursorOperation
that you can use to chain further query-related function calls. WriteTransactionPendingIDSpecificOperation ditto::ScopedWriteTransaction::find_by_id | ( | DocumentId | id | ) | const |
Generates a WriteTransactionPendingIDSpecificOperation
with the provided document ID that can be used to update, remove, or evict the document.
id | the ID of the document. |
WriteTransactionPendingIDSpecificOperation
that you can chain function calls to either get the document immediately or get updates about it over time. DocumentId ditto::ScopedWriteTransaction::insert | ( | nlohmann::json | content, |
DocumentId | id = DocumentId() , |
||
bool | is_default = false |
||
) |
Inserts a document into the scoped collection and returns the document's ID.
[in] | content | the value to insert into the collection. |
[in] | id | the ID to use for the document. If no ID is provided (or a DocumentId constructed using the default DocumentId constructor is used) then Ditto will automatically assign an ID. |
[in] | is_default | represents whether or not the data being inserted should be treated as default data or not. Set this to true if you want to set a default value that you expect to be overwritten by other devices in the network. The default value is false . |
DocumentId ditto::ScopedWriteTransaction::insert_with_strategy | ( | nlohmann::json | content, |
DocumentId | id = DocumentId() , |
||
WriteStrategy | write_strategy = WriteStrategy::overwrite |
||
) |
Inserts a document into the scoped collection and returns the document's ID.
[in] | content | the value to insert into the collection. |
[in] | id | the ID to use for the document. If no ID is provided (or a DocumentId constructed using the default DocumentId constructor is used) then Ditto will automatically assign an ID. |
write_strategy | specifies the desired strategy for inserting a document. The default value is WriteStrategy::overwrite . |
std::string ditto::ScopedWriteTransaction::collection_name |
The name of the collection that the scoped write transaction is scoped to.