pub enum DataType {
Counter,
SensorReading {
sensor_count: u32,
},
Generic,
}Expand description
Specifies the type of synthetic data to generate.
Each variant produces elements with different schemas and behaviors. See the crate-level documentation for detailed examples of each type.
Variants§
Counter
Generates sequential counter values (1, 2, 3, …).
Each event is an INSERT with a unique element ID (counter_1, counter_2, etc.).
Properties include value (the counter) and timestamp.
SensorReading
Generates simulated IoT sensor readings.
Produces temperature (20.0-30.0) and humidity (40.0-60.0) values from a pool of simulated sensors. The first reading for each sensor is an INSERT; subsequent readings for the same sensor are UPDATEs.
Fields
Generic
Generates generic data with random values (default).
Each event is an INSERT with a unique element ID (generic_1, generic_2, etc.).
Properties include value (random i32), message, and timestamp.
Implementations§
Source§impl DataType
impl DataType
Sourcepub fn sensor_reading(sensor_count: u32) -> Self
pub fn sensor_reading(sensor_count: u32) -> Self
Creates a SensorReading data type with the specified sensor count.
§Arguments
sensor_count- Number of distinct sensors to simulate (must be ≥ 1)
§Example
use drasi_source_mock::DataType;
let data_type = DataType::sensor_reading(10);
assert_eq!(data_type.sensor_count(), Some(10));Sourcepub fn sensor_count(&self) -> Option<u32>
pub fn sensor_count(&self) -> Option<u32>
Returns the sensor count if this is a SensorReading variant.
§Returns
Some(count)forSensorReadingvariantsNoneforCounterandGenericvariants
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DataType
impl<'de> Deserialize<'de> for DataType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for DataType
impl StructuralPartialEq for DataType
Auto Trait Implementations§
impl Freeze for DataType
impl RefUnwindSafe for DataType
impl Send for DataType
impl Sync for DataType
impl Unpin for DataType
impl UnsafeUnpin for DataType
impl UnwindSafe for DataType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.