62struct PUBLIC_API Crud_factory
64 using Impl = common::Executable_if;
66 static Impl* mk_add(Collection &coll);
67 static Impl* mk_remove(Collection &coll,
const string &
expr);
68 static Impl* mk_find(Collection &coll);
69 static Impl* mk_find(Collection &coll,
const string &
expr);
70 static Impl* mk_modify(Collection &coll,
const string &
expr);
72 static Impl* mk_insert(Table &tbl);
73 static Impl* mk_select(Table &tbl);
74 static Impl* mk_update(Table &tbl);
75 static Impl* mk_remove(Table &tbl);
77 static Impl* mk_sql(Session &sess,
const string &sql);
118#define DEVAPI_LOCK_CONTENTION_ENUM(X,N) X = N,
120 LOCK_CONTENTION_LIST(DEVAPI_LOCK_CONTENTION_ENUM)
133 using Operation = Base;
142 Operation& offset(
unsigned rows)
145 get_impl()->set_offset(rows);
153 using Impl = common::Limit_if;
157 return static_cast<Impl*
>(Base::get_impl());
168 using Operation = Base;
176 Operation& limit(
unsigned items)
179 get_impl()->set_limit(items);
187 using Impl = common::Limit_if;
191 return static_cast<Impl*
>(Base::get_impl());
203 using Operation = Base;
215 template <
typename...Type>
216 Operation& sort(
Type... spec)
219 get_impl()->clear_sort();
220 add_sort(get_impl(), spec...);
228 using Impl = common::Sort_if;
232 return static_cast<Impl*
>(Base::get_impl());
244 using Operation = Base;
256 template <
typename...Type>
257 Operation& orderBy(
Type... spec)
260 get_impl()->clear_sort();
261 add_sort(get_impl(), spec...);
269 using Impl = common::Sort_if;
273 return static_cast<Impl*
>(Base::get_impl());
284 using Operation = Base;
294 Operation& having(
const string& having_spec)
297 get_impl()->set_having(having_spec);
305 using Impl = common::Having_if;
309 return static_cast<Impl*
>(Base::get_impl());
321 using Operation = Base;
332 template <
typename... Expr>
333 Operation& groupBy(Expr... group_by_spec)
336 get_impl()->clear_group_by();
337 do_group_by(get_impl(), group_by_spec...);
345 using Impl = common::Group_by_if;
349 return static_cast<Impl*
>(Base::get_impl());
372 template <
typename... Types>
376 add_params(get_impl(), std::forward<Types>(vals)...);
384 using Impl = common::Bind_if;
388 return static_cast<Impl*
>(Base::get_impl());
400 using Operation = Base;
414 if (Value::DOCUMENT == val.
getType())
415 throw_error(
"Can not bind a parameter to a document");
417 if (Value::ARRAY == val.
getType())
418 throw_error(
"Can not bind a parameter to an array");
421 get_impl()->add_param(parameter, (
const common::Value&)val);
433 Operation& bind(
const Map &args)
435 for (
const auto &keyval : args)
437 bind(keyval.first, keyval.second);
444 using Impl = common::Bind_if;
448 return static_cast<Impl*
>(Base::get_impl());
455template <
class Base,
class IMPL>
459 using Operation = Base;
472 get_impl()->set_lock_mode(common::Lock_mode::SHARED,
473 common::Lock_contention((
unsigned)contention));
486 lockExclusive(
LockContention contention = LockContention::DEFAULT)
488 get_impl()->set_lock_mode(common::Lock_mode::EXCLUSIVE,
489 common::Lock_contention((
unsigned)contention));
499 return static_cast<Impl*
>(Base::get_impl());
Value object can store value of scalar type, string, array or document.
Definition: document.h:230
Type getType() const
Return type of the value stored in this instance (or VNULL if no value is stored).
Definition: document.h:656
Template for defining fluent api for CRUD operations.
Definition: crud.h:397
Template for defining fluent api for CRUD operations.
Definition: crud.h:359
Template for defining fluent api for CRUD operations.
Definition: crud.h:319
Template for defining fluent api for CRUD operations.
Definition: crud.h:282
Template for defining fluent api for CRUD operations.
Definition: crud.h:166
Template for defining fluent api for CRUD operations.
Definition: crud.h:131
Template for defining fluent api for CRUD operations.
Definition: crud.h:242
Template for defining fluent api for CRUD operations.
Definition: crud.h:457
Template for defining fluent api for CRUD operations.
Definition: crud.h:201
LockContention
The LockContention enum defines constants for defining the row locking contention for Set_lock::lockE...
Definition: crud.h:117
Details for public API classes representing CRUD operations.
Type
Types that can be reported in result meta-data.
Definition: result.h:241
internal::Expression expr(std::string &&e)
Function which indicates that a given string should be treated as expression.
Definition: document.h:638