|
| Box (Store &store) |
|
AsyncBox< EntityT > | async () |
| Async operations are available through the AsyncBox class.
|
|
QueryBuilder< EntityT > | query () |
| Start building a query this entity.
|
|
QueryBuilder< EntityT > | query (const QueryCondition &condition) |
| Start building a query this entity.
|
|
std::unique_ptr< EntityT > | get (obx_id id) |
| Read an object from the database, returning a managed pointer.
|
|
bool | get (obx_id id, EntityT &outObject) |
| Read an object from the database, replacing the contents of an existing object variable.
|
|
std::vector< std::unique_ptr< EntityT > > | get (const std::vector< obx_id > &ids) |
| Read multiple objects at once, i.e. in a single read transaction.
|
|
std::vector< std::unique_ptr< EntityT > > | getAll () |
| Read all objects from the Box at once, i.e. in a single read transaction.
|
|
obx_id | put (EntityT &object, OBXPutMode mode=OBXPutMode_PUT) |
| Inserts or updates the given object in the database.
|
|
obx_id | put (const EntityT &object, OBXPutMode mode=OBXPutMode_PUT) |
| Inserts or updates the given object in the database.
|
|
size_t | put (std::vector< EntityT > &objects, std::vector< obx_id > *outIds=nullptr, OBXPutMode mode=OBXPutMode_PUT) |
| Puts multiple objects using a single transaction. In case there was an error the transaction is rolled back and none of the changes are persisted.
|
|
size_t | put (const std::vector< EntityT > &objects, std::vector< obx_id > *outIds=nullptr, OBXPutMode mode=OBXPutMode_PUT) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
size_t | put (std::vector< std::unique_ptr< EntityT > > &objects, std::vector< obx_id > *outIds=nullptr, OBXPutMode mode=OBXPutMode_PUT) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<typename SourceEntityT , typename TargetEntityT > |
std::vector< obx_id > | backlinkIds (RelationProperty< SourceEntityT, TargetEntityT > toOneRel, obx_id objectId) |
| Fetch IDs of all objects in this box that reference the given object (ID) on the given relation property. Note: This method refers to "property based relations" unlike the "stand-alone relations" (Box::standaloneRel*).
|
|
template<typename SourceEntityT , typename TargetEntityT > |
void | standaloneRelReplace (RelationStandalone< SourceEntityT, TargetEntityT > toManyRel, obx_id sourceObjectId, const std::vector< obx_id > &targetObjectIds) |
| Replace the list of standalone relation target objects on the given source object.
|
|
template<typename TargetEntityT > |
void | standaloneRelPut (RelationStandalone< EntityT, TargetEntityT > toManyRel, obx_id sourceObjectId, obx_id targetObjectId) |
| Insert a standalone relation entry between two objects.
|
|
template<typename TargetEntityT > |
void | standaloneRelRemove (RelationStandalone< EntityT, TargetEntityT > toManyRel, obx_id sourceObjectId, obx_id targetObjectId) |
| Remove a standalone relation entry between two objects.
|
|
template<typename SourceEntityT > |
std::vector< obx_id > | standaloneRelIds (RelationStandalone< SourceEntityT, EntityT > toManyRel, obx_id objectId) |
| Fetch IDs of all objects in this Box related to the given object (typically from another Box). Used for a stand-alone relation and its "regular" direction; this Box represents the target of the relation.
|
|
template<typename TargetEntityT > |
std::vector< obx_id > | standaloneRelBacklinkIds (RelationStandalone< EntityT, TargetEntityT > toManyRel, obx_id objectId) |
| Fetch IDs of all objects in this Box related to the given object (typically from another Box). Used for a stand-alone relation and its "backlink" direction; this Box represents the source of the relation.
|
|
bool | timeSeriesMinMax (obx_id *outMinId, int64_t *outMinValue, obx_id *outMaxId, int64_t *outMaxValue) |
| Time series: get the limits (min/max time values) over all objects.
|
|
bool | timeSeriesMinMax (int64_t rangeBegin, int64_t rangeEnd, obx_id *outMinId, int64_t *outMinValue, obx_id *outMaxId, int64_t *outMaxValue) |
| Time series: get the limits (min/max time values) over objects within the given time range.
|
|
bool | get (CursorTx &cTx, obx_id id, const void **data, size_t *size) |
| Low-level API: read an object as FlatBuffers bytes from the database.
|
|
| BoxTypeless (Store &store, obx_schema_id entityTypeId) |
|
OBX_box * | cPtr () const |
|
uint64_t | count (uint64_t limit=0) |
| Return the number of objects contained by this box.
|
|
bool | isEmpty () |
| Returns true if the box contains no objects.
|
|
bool | contains (obx_id id) |
| Checks whether this box contains an object with the given ID.
|
|
bool | contains (const std::vector< obx_id > &ids) |
| Checks whether this box contains all objects matching the given IDs.
|
|
bool | get (CursorTx &cTx, obx_id id, const void **data, size_t *size) |
| Low-level API: read an object as FlatBuffers bytes from the database.
|
|
obx_id | putNoThrow (void *data, size_t size, OBXPutMode mode=OBXPutMode_PUT) |
| Low-level API: puts the given FlatBuffers object.
|
|
obx_id | put (void *data, size_t size, OBXPutMode mode=OBXPutMode_PUT) |
|
bool | remove (obx_id id) |
| Remove the object with the given id.
|
|
uint64_t | remove (const std::vector< obx_id > &ids) |
| Removes all objects matching the given IDs.
|
|
uint64_t | removeAll () |
| Removes all objects from the box.
|
|
template<typename EntityT>
class obx::Box< EntityT >
A Box offers database operations for objects of a specific type.
Given a Store, you can create Box instances to interact with object data (e.g. get and put operations). A Box instance is associated with a specific object type (data class) and gives you a high level API to interact with data objects of that type.
Box operations automatically start an implicit transaction when accessing the database. And because transactions offered by this API are always reentrant, you can set your own transaction boundary using Store::txRead(), Store::txWrite() or Store::tx(). Using these explicit transactions is very much encouraged for calling multiple write operations that logically belong together for better consistency(ACID) and performance.
Box instances are thread-safe and light-weight wrappers around C-boxes, which are cached internally (see obx_box()).