add tests for the api
This commit is contained in:
@@ -7,6 +7,6 @@ authors = ["Sergey <me@sergeysav.com>"]
|
||||
|
||||
[dependencies]
|
||||
chrono = { workspace = true, features = ["serde"] }
|
||||
derive_more = { workspace = true, features = ["from", "try_into"] }
|
||||
derive_more = { workspace = true, features = ["display", "from", "try_into"] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use crate::data_value::DataValue;
|
||||
use derive_more::Display;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Display)]
|
||||
pub enum DataType {
|
||||
Float32,
|
||||
Float64,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::data_type::DataType;
|
||||
use derive_more::{From, TryInto};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -7,3 +8,13 @@ pub enum DataValue {
|
||||
Float64(f64),
|
||||
Boolean(bool),
|
||||
}
|
||||
|
||||
impl DataValue {
|
||||
pub fn to_data_type(self) -> DataType {
|
||||
match self {
|
||||
DataValue::Float32(_) => DataType::Float32,
|
||||
DataValue::Float64(_) => DataType::Float64,
|
||||
DataValue::Boolean(_) => DataType::Boolean,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user