feat: support converting from BlockType
parent
3c24b6e10e
commit
9006af8961
|
@ -8,3 +8,4 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
log = "0.4.8"
|
||||
delorean_tsm = { path = "../delorean_tsm" }
|
||||
|
|
|
@ -30,9 +30,11 @@
|
|||
//! assert_eq!(cols[3], ColumnDefinition::new("field2", 3, DataType::Boolean));
|
||||
//! assert_eq!(cols[4], ColumnDefinition::new("timestamp", 4, DataType::Timestamp));
|
||||
//! ```
|
||||
use std::collections::BTreeMap;
|
||||
use delorean_tsm::BlockType;
|
||||
|
||||
use log::warn;
|
||||
use std::collections::BTreeMap;
|
||||
use std::convert::From;
|
||||
|
||||
/// Represents a specific Line Protocol Tag name
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -68,6 +70,18 @@ pub enum DataType {
|
|||
Timestamp,
|
||||
}
|
||||
|
||||
impl From<&BlockType> for DataType {
|
||||
fn from(value: &BlockType) -> Self {
|
||||
match value {
|
||||
BlockType::Float => Self::Float,
|
||||
BlockType::Integer => Self::Integer,
|
||||
BlockType::Bool => Self::Boolean,
|
||||
BlockType::Str => Self::String,
|
||||
BlockType::Unsigned => Self::Integer,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a specific Line Protocol Field name
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Field {
|
||||
|
|
Loading…
Reference in New Issue