Couchbase Transactions C++ Client  1.0.0
Transactions client for couchbase
Public Member Functions | Static Public Member Functions | List of all members
couchbase::mutate_in_spec Class Reference

Specify specific elements in a document to mutate. More...

#include <mutate_in_spec.hxx>

Public Member Functions

mutate_in_specxattr ()
 Specify the mutation is on xattrs, rather than the document body. More...
 
mutate_in_speccreate_path ()
 Specify the mutation creates the entire path. More...
 
mutate_in_specexpand_macro ()
 Specify the value in this mutation spec contains a mutate_in_macro. More...
 

Static Public Member Functions

template<typename Content >
static mutate_in_spec upsert (const std::string &path, const Content &value)
 Upsert content at a path within a document. More...
 
template<typename Content >
static mutate_in_spec insert (const std::string &path, const Content &value)
 Insert content at a path within a document. More...
 
template<typename Content >
static mutate_in_spec fulldoc_insert (const Content &value)
 Inserts the content as the entire body of the document. More...
 
template<typename Content >
static mutate_in_spec fulldoc_upsert (const Content &value)
 Upsert the content as the entire body of the document. More...
 
static mutate_in_spec remove (const std::string &path)
 Remove content at a path within a document. More...
 

Detailed Description

Specify specific elements in a document to mutate.

Used in collection::mutate_in, you can specify a specific path within a document to insert, remove, upsert. See collection::lookup_in.

You can pass in a primitive, like int, char*, etc..., std::string, a nlohmann::json object, or your own object which has to_json and from_json implemented. See https://github.com/nlohmann/json#basic-usage

Member Function Documentation

◆ create_path()

mutate_in_spec& couchbase::mutate_in_spec::create_path ( )

Specify the mutation creates the entire path.

Returns
Reference to the spec, so you can chain the calls.

◆ expand_macro()

mutate_in_spec& couchbase::mutate_in_spec::expand_macro ( )

Specify the value in this mutation spec contains a mutate_in_macro.

Returns
Reference to the spec, so you can chain the calls.

◆ fulldoc_insert()

template<typename Content >
static mutate_in_spec couchbase::mutate_in_spec::fulldoc_insert ( const Content &  value)
inlinestatic

Inserts the content as the entire body of the document.

This is an insert - expecting there to be no document already there.

Parameters
valueThe content to place at that path.
Returns
The newly created mutate_in_spec.

◆ fulldoc_upsert()

template<typename Content >
static mutate_in_spec couchbase::mutate_in_spec::fulldoc_upsert ( const Content &  value)
inlinestatic

Upsert the content as the entire body of the document.

Either replaces an existing document, or inserts a new one with the content provided.

Parameters
valueThe content to place at that path.
Returns
The newly created mutate_in_spec.

◆ insert()

template<typename Content >
static mutate_in_spec couchbase::mutate_in_spec::insert ( const std::string &  path,
const Content &  value 
)
inlinestatic

Insert content at a path within a document.

Expects there to be no content at this path.

Parameters
pathA dot-separated string representing the path to mutate.
valueThe content to place at that path.
Returns
The newly created mutate_in_spec.

◆ remove()

static mutate_in_spec couchbase::mutate_in_spec::remove ( const std::string &  path)
inlinestatic

Remove content at a path within a document.

Parameters
pathA dot-separated string representing the path to remove.
Returns
The newly created mutate_in_spec.

◆ upsert()

template<typename Content >
static mutate_in_spec couchbase::mutate_in_spec::upsert ( const std::string &  path,
const Content &  value 
)
inlinestatic

Upsert content at a path within a document.

Either inserts the content, or replaces existing content at this path.

Parameters
pathA dot-separated string representing the path to mutate.
valueThe content to place at that path.
Returns
The newly created mutate_in_spec.

◆ xattr()

mutate_in_spec& couchbase::mutate_in_spec::xattr ( )

Specify the mutation is on xattrs, rather than the document body.

Returns
Reference to the spec, so you can chain the calls.

The documentation for this class was generated from the following file: