|
dasmig-core 1.2.0
Shared random engine, distributions and data tiers for the dasmig generator libraries
|
Writers for batches: JSON Lines, and CSV flattened from a result's JSON. Both can be given to for_each_batch() as the sink. More...
#include <concepts>#include <cstddef>#include <cstdint>#include <ostream>#include <stdexcept>#include <string>#include <string_view>#include <unordered_map>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| class | dasmig::core::detail::json_flattener |
| class | dasmig::core::jsonl_writer |
| Writes one JSON document per line (JSON Lines / NDJSON). More... | |
| class | dasmig::core::csv_writer |
| Writes results as CSV, one row each, with columns flattened from their JSON (see flatten_json()). More... | |
Concepts | |
| concept | dasmig::core::json_result |
Whether a result has to_json() returning text. | |
Functions | |
| std::vector< std::pair< std::string, std::string > > | dasmig::core::flatten_json (std::string_view json) |
| Flatten a JSON document into dotted columns. | |
Writers for batches: JSON Lines, and CSV flattened from a result's JSON. Both can be given to for_each_batch() as the sink.
Definition in file sinks.hpp.
|
inline |
Flatten a JSON document into dotted columns.
An object's members become parent.child cells, strings are unescaped, numbers and booleans keep their text, null is an empty cell, and an array (or an empty nested object) is one cell holding its JSON text. A document that is not an object gives one cell with an empty name.
| json | A complete JSON document. |
(column, cell) pairs in document order. | std::invalid_argument | If json is not valid JSON. |