7#include <Lightweight/DataMapper/DataMapper.hpp>
30 size_t userCount = 2000;
31 size_t categoryCount = 200;
32 size_t productCount = 2000;
34 size_t orderCount = 10000;
36 size_t reviewCount = 8000;
37 size_t tagCount = 500;
39 size_t activityLogCount = 50000;
40 size_t systemAuditLogCount = 5000;
41 size_t articleCount = 500;
44 size_t userBioSize = 500;
45 size_t userAvatarSize = 10240;
46 size_t categoryDescriptionSize = 2048;
47 size_t productLongDescriptionSize = 8192;
48 size_t productSpecsSize = 2048;
49 size_t productImageSize = 51200;
50 size_t productThumbnailSize = 5120;
51 size_t reviewContentSize = 2048;
52 size_t activityLogJsonSize = 1024;
53 size_t systemAuditContextSize = 5120;
54 size_t systemAuditStackTraceSize = 3072;
55 size_t articleContentSize = 15360;
56 size_t articleFeaturedImageSize = 20480;
71 int64_t
NextInt(int64_t min, int64_t max);
78 T
const&
Pick(std::vector<T>
const& items)
80 return items[
static_cast<size_t>(
NextInt(0,
static_cast<int64_t
>(items.size()) - 1))];
105 std::mt19937_64 m_generator;
122 std::function<void(
double, std::string_view)> progressCallback = {});
130template <
typename Entity,
typename Generator>
GeneratorConfig CreateScaledConfig(double scaleFactor)
Creates a scaled-down configuration for faster testing.
void PopulateDatabase(Light::DataMapper &dm, GeneratorConfig const &config={}, std::function< void(double, std::string_view)> progressCallback={})
Populates the database with generated data according to config.
size_t GetExpectedDataSize(GeneratorConfig const &config)
Gets the expected total size of generated data based on config.
void CreateSchema(Light::DataMapper &dm)
Creates all tables for the large test database schema.
void DropSchema(Light::DataMapper &dm)
Drops all tables from the large test database schema.
size_t BatchInsert(Light::DataMapper &dm, size_t count, Generator &&generator, size_t batchSize=1000)
Batch insert helper for efficient data loading.
Entity definitions for the large test database schema.
Seeded random number generator wrapper for deterministic generation.
std::string GenerateProductName(int64_t productId)
Generates a random product name.
double NextDouble(double min, double max)
Generates a random double in range [min, max).
std::string GenerateEmail(int64_t userId)
Generates a random email address.
int64_t NextInt(int64_t min, int64_t max)
Generates a random integer in range [min, max].
std::string GenerateText(size_t targetSize)
Generates random text of approximately the given size.
T const & Pick(std::vector< T > const &items)
Picks a random element from a vector.
std::string GenerateAddressJson()
Generates random address JSON.
std::string GenerateJson(size_t targetSize)
Generates a pseudo-random JSON object of approximately the given size.
std::vector< uint8_t > GenerateBinaryData(size_t targetSize)
Generates pseudo-random binary data of the given size.
bool NextBool(double probabilityTrue=0.5)
Generates a random boolean with given probability of true.
Main API for mapping records to and from the database using high level C++ syntax.
Configuration for database generation.
size_t orderItemCount
~3 items per order
uint64_t seed
Random seed for deterministic generation.
size_t productImageCount
~2 images per product
size_t productTagCount
~3 tags per product