ORM C++
Toggle main menu visibility
Loading...
Searching...
No Matches
perf_test_seam.cppm
Go to the documentation of this file.
1
module
;
2
3
#include <cstddef>
4
#include <optional>
5
#include <span>
6
#include <stdexcept>
7
8
export
module
orm:perf_test_seam
;
9
10
import
:database_context;
11
12
/**
13
* Internal perf-test seam for the benchmark gate (variant C).
14
*
15
* Compiled and exported only when ORM_CXX_ENABLE_PERF_TEST_SEAM=ON. It calls the same
16
* production insertManyImpl as the public API and differs only in the chunk policy.
17
*/
18
namespace
orm::detail::perf_seam
19
{
20
class
TestAccess
21
{
22
public
:
23
template
<
typename
SchemaType,
typename
T>
24
static
auto
insertManyWithChunkRows(OrmContext<SchemaType>& context, std::span<const T> rows,
25
std::size_t chunkRows) ->
void
26
{
27
context.template insertManyImpl<T>(rows, std::optional<std::size_t>{chunkRows});
28
}
29
};
30
31
export
[[nodiscard]]
inline
auto
defaultChunkRowsForTest() noexcept -> std::
size_t
32
{
33
return
insertManyDefaultRowBudget;
34
}
35
36
export
template
<
typename
SchemaType,
typename
T>
37
auto
insertManyWithChunkRowsForTest(OrmContext<SchemaType>& context, std::span<const T> rows,
38
std::size_t chunkRows) ->
void
39
{
40
if
(chunkRows == 0)
41
{
42
throw
std::invalid_argument{
"A batch insert chunk cannot be empty"
};
43
}
44
TestAccess::insertManyWithChunkRows(context, rows, chunkRows);
45
}
46
}
// namespace orm::detail::perf_seam
orm
modules
orm
database
perf_test_seam.cppm
Generated by
1.18.0