Lightweight 0.20260213.0
Loading...
Searching...
No Matches
DataGenerator.hpp File Reference

Data generation utilities for creating a 500MB+ test database. More...

#include "Entities.hpp"
#include <Lightweight/DataMapper/DataMapper.hpp>
#include <cstddef>
#include <cstdint>
#include <random>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  LargeDb::GeneratorConfig
 Configuration for database generation. More...
 
class  LargeDb::SeededRandom
 Seeded random number generator wrapper for deterministic generation. More...
 

Functions

GeneratorConfig LargeDb::CreateScaledConfig (double scaleFactor)
 Creates a scaled-down configuration for faster testing.
 
void LargeDb::CreateSchema (Light::DataMapper &dm)
 Creates all tables for the large test database schema.
 
void LargeDb::DropSchema (Light::DataMapper &dm)
 Drops all tables from the large test database schema.
 
void LargeDb::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 LargeDb::GetExpectedDataSize (GeneratorConfig const &config)
 Gets the expected total size of generated data based on config.
 
template<typename Entity , typename Generator >
size_t LargeDb::BatchInsert (Light::DataMapper &dm, size_t count, Generator &&generator, size_t batchSize=1000)
 Batch insert helper for efficient data loading.
 

Detailed Description

Data generation utilities for creating a 500MB+ test database.

All generation functions are deterministic when using the same seed, allowing reproducible test runs across all supported database backends.

Definition in file DataGenerator.hpp.

Function Documentation

◆ CreateScaledConfig()

GeneratorConfig LargeDb::CreateScaledConfig ( double  scaleFactor)

Creates a scaled-down configuration for faster testing.

Parameters
scaleFactorFactor to scale down counts (e.g., 0.1 for 10% of full size)
Returns
Scaled configuration

References LargeDb::CreateScaledConfig().

Referenced by LargeDb::CreateScaledConfig().

◆ CreateSchema()

void LargeDb::CreateSchema ( Light::DataMapper dm)

Creates all tables for the large test database schema.

Parameters
dmDataMapper instance connected to the target database.

References LargeDb::CreateSchema().

Referenced by LargeDb::CreateSchema().

◆ DropSchema()

void LargeDb::DropSchema ( Light::DataMapper dm)

Drops all tables from the large test database schema.

Parameters
dmDataMapper instance connected to the target database.

References LargeDb::DropSchema().

Referenced by LargeDb::DropSchema().

◆ PopulateDatabase()

void LargeDb::PopulateDatabase ( Light::DataMapper dm,
GeneratorConfig const &  config = {},
std::function< void(double, std::string_view)>  progressCallback = {} 
)

Populates the database with generated data according to config.

Parameters
dmDataMapper instance connected to the target database.
configGeneration configuration.
progressCallbackOptional callback for progress reporting (0.0 to 1.0).

References LargeDb::PopulateDatabase().

Referenced by LargeDb::PopulateDatabase().

◆ GetExpectedDataSize()

size_t LargeDb::GetExpectedDataSize ( GeneratorConfig const &  config)

Gets the expected total size of generated data based on config.

Parameters
configGeneration configuration.
Returns
Expected raw data size in bytes.

References LargeDb::GetExpectedDataSize().

Referenced by LargeDb::GetExpectedDataSize().