4#ifndef _Stroika_Foundation_Database_Document_ObjectCollection_h_
5#define _Stroika_Foundation_Database_Document_ObjectCollection_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
9#include "Stroika/Foundation/DataExchange/ObjectVariantMapper.h"
18namespace Stroika::Foundation::Database::Document::ObjectCollection {
20 using namespace Database::Document::Collection;
21 using DataExchange::ObjectVariantMapper;
35 Ptr (
const Ptr& src) =
default;
36 Ptr (
Ptr&& src)
noexcept =
default;
37 Ptr ()
noexcept =
default;
39 using inherited::inherited;
47 nonvirtual
Ptr& operator= (
const Ptr& src) =
default;
48 nonvirtual
Ptr& operator= (
Ptr&& src)
noexcept =
default;
60 nonvirtual optional<T>
Get (
const IDType&
id,
const optional<Projection>& projection = {})
const;
61 nonvirtual optional<T>
Get (
const Filter& filter,
const optional<Projection>& projection = {})
const;
66 nonvirtual T GetOrThrow (
const IDType&
id,
const optional<Projection>& projection = {})
const;
67 nonvirtual T GetOrThrow (
const Filter& filter,
const optional<Projection>& projection = {})
const;
72 nonvirtual
Sequence<T> GetAll (
const optional<Filter>& filter = {},
const optional<Projection>& projection = {})
const;
77 using inherited::Replace;
78 nonvirtual
void Replace (
const T& newV)
const;
79 nonvirtual
void Replace (
const IDType&
id,
const T& newV)
const;
84 using inherited::Update;
92 using inherited::AddOrUpdate;
101 template <
typename T>
111#include "ObjectCollection.inl"
String is like std::u32string, except it is much easier to use, often much more space efficient,...
A generalization of a vector: a container whose elements are keyed by the natural numbers.
Set<T> is a container of T, where once an item is added, additionally adds () do nothing.
ObjectVariantMapper can be used to map C++ types to and from variant-union types, which can be transp...
nonvirtual void Replace(const Document &newV) const
except for issues of timing, equivalent to remove, and then add newV using id
nonvirtual optional< Document > Get(const IDType &id, const optional< Projection > &projection={}) const
Read the unique document given by id (or filter) or return nullopt if no such.
nonvirtual void Update(const Document &newV) const
Update the document named by 'id' - just updating fields in newV (all or ones given in argument onlyT...
nonvirtual IDType Add(const Document &v) const
nonvirtual IDType AddOrUpdate(const Document &v) const
if v contains and ID, look it up, and if found, Replace. If not found, then synonym for Add ()
nonvirtual Sequence< Document > GetAll(const optional< Filter > &filter={}, const optional< Projection > &projection={}) const