datafake_rs/lib.rs
1//! # datafake-rs
2//!
3//! A high-performance Rust library for generating realistic mock JSON data using JSONLogic-based configuration.
4//!
5//! ## Features
6//!
7//! - Generate fake data using a declarative JSON configuration
8//! - Support for 50+ fake data types (names, emails, addresses, etc.)
9//! - JSONLogic integration for conditional and dynamic data generation
10//! - Variable system for reusing generated values across the schema
11//! - Batch generation for creating multiple records efficiently
12//!
13//! ## Quick Start
14//!
15//! ```rust
16//! use datafake_rs::DataGenerator;
17//!
18//! let config = r#"{
19//! "schema": {
20//! "id": {"fake": ["uuid"]},
21//! "name": {"fake": ["name"]},
22//! "email": {"fake": ["email"]}
23//! }
24//! }"#;
25//!
26//! let generator = DataGenerator::from_json(config).unwrap();
27//! let data = generator.generate().unwrap();
28//! println!("{}", data);
29//! ```
30//!
31//! ## Configuration Structure
32//!
33//! The configuration JSON has three main sections:
34//! - `metadata`: Optional metadata about the configuration (name, version, description)
35//! - `variables`: Pre-generated values that can be referenced in the schema
36//! - `schema`: The structure of the output JSON with fake data operators
37//!
38//! ## Supported Fake Data Types
39//!
40//! - **Identity**: `uuid`, `name`, `first_name`, `last_name`, `email`, `username`
41//! - **Address**: `street_address`, `city`, `country_code`, `zip_code`, `latitude`, `longitude`
42//! - **Company**: `company_name`, `industry`, `profession`, `catch_phrase`
43//! - **Finance**: `bic`, `iban`, `credit_card_number`, `currency_code`
44//! - **Numeric**: `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `f32`, `f64` (with optional ranges)
45//! - **Text**: `word`, `sentence`, `paragraph`
46//! - **Date/Time**: `datetime`, `date`, `time`
47
48pub mod config;
49pub mod engine;
50pub mod error;
51pub mod generator;
52pub mod operators;
53pub mod types;
54
55pub use config::ConfigParser;
56pub use error::{DataFakeError, Result};
57pub use generator::DataGenerator;
58pub use types::{DataFakeConfig, GenerationContext, Metadata};