|
Lightweight 0.20260921.0
|
#include <QueryBuilders.hpp>
Public Attributes | |
| bool | loadRelations { true } |
| Whether to automatically load relations when querying records. | |
| size_t | eagerLoadDepth { 0 } |
| How many levels of relations to eagerly batch-load after a query materializes. | |
Structural type for options for DataMapper queries. This allows to configure behavior of the queries at compile time when using query builder directly from the DataMapper
Definition at line 25 of file QueryBuilders.hpp.
| bool Lightweight::DataMapperOptions::loadRelations { true } |
Whether to automatically load relations when querying records.
Definition at line 28 of file QueryBuilders.hpp.
| size_t Lightweight::DataMapperOptions::eagerLoadDepth { 0 } |
How many levels of relations to eagerly batch-load after a query materializes.
0 (the default) leaves every relation to load on demand, one query per record touched. A value of N resolves every BelongsTo and HasMany reachable within N levels for the whole result set at once, at a bounded number of queries per relation per level:
Use With<>() instead when only some relations are needed: this option descends into every relation of every record it reaches, which is more queries and more rows than a named path, and instantiates the loader for the whole reachable relation graph. The depth is what bounds that: a cyclic graph (a self-referencing record, or A -> B -> A) terminates because the recursion is cut at a compile-time constant.
HasOneThrough, HasManyThrough and CompositeForeignKey are not batch-loadable and keep their on-demand behaviour.
Definition at line 49 of file QueryBuilders.hpp.