From 258efc77db0bc6f1ecac0191930dda3d16797de9 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Tue, 23 May 2023 00:54:10 -0400 Subject: [PATCH] Create the TimestampFormat --- emseries/Cargo.lock | 81 ++++++++----------------------------------- emseries/Cargo.toml | 7 ++-- emseries/src/types.rs | 6 ++++ 3 files changed, 23 insertions(+), 71 deletions(-) diff --git a/emseries/Cargo.lock b/emseries/Cargo.lock index 9d1166f..4435e02 100644 --- a/emseries/Cargo.lock +++ b/emseries/Cargo.lock @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "chrono-tz" -version = "0.6.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58549f1842da3080ce63002102d5bc954c7bc843d4f47818e642abdc36253552" +checksum = "cf9cc2b23599e6d7479755f3594285efb3f74a1bdca7a7374948bc831e23a552" dependencies = [ "chrono", "chrono-tz-build", @@ -48,9 +48,9 @@ dependencies = [ [[package]] name = "chrono-tz-build" -version = "0.0.2" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069" +checksum = "d9998fb9f7e9b2111641485bf8beb32f92945f97f92a3d061f744cfef335f751" dependencies = [ "parse-zoneinfo", "phf", @@ -82,7 +82,6 @@ dependencies = [ "tempfile", "thiserror", "uuid", - "yaml-rust", ] [[package]] @@ -135,12 +134,6 @@ version = "0.2.124" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50" -[[package]] -name = "linked-hash-map" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" - [[package]] name = "num-integer" version = "0.1.44" @@ -171,18 +164,18 @@ dependencies = [ [[package]] name = "phf" -version = "0.10.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" dependencies = [ "phf_shared", ] [[package]] name = "phf_codegen" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770" dependencies = [ "phf_generator", "phf_shared", @@ -190,9 +183,9 @@ dependencies = [ [[package]] name = "phf_generator" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" dependencies = [ "phf_shared", "rand", @@ -200,20 +193,13 @@ dependencies = [ [[package]] name = "phf_shared" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" dependencies = [ "siphasher", - "uncased", ] -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - [[package]] name = "proc-macro2" version = "1.0.37" @@ -238,18 +224,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", "rand_core", ] @@ -258,9 +232,6 @@ name = "rand_core" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] [[package]] name = "redox_syscall" @@ -392,18 +363,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "uncased" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baeed7327e25054889b9bd4f975f32e5f4c5d434042d59ab6cd4142c0a76ed0" -dependencies = [ - "version_check", -] +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "unicode-xid" @@ -421,12 +383,6 @@ dependencies = [ "serde", ] -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" @@ -454,12 +410,3 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] diff --git a/emseries/Cargo.toml b/emseries/Cargo.toml index c9971fb..a50565b 100644 --- a/emseries/Cargo.toml +++ b/emseries/Cargo.toml @@ -4,7 +4,7 @@ version = "0.5.1" authors = ["Savanni D'Gerinel "] description = "an Embedded Time Series database" license = "GPL-3.0-only" -license-file = "../COPYING" +# license-file = "../COPYING" documentation = "https://docs.rs/emseries" homepage = "https://github.com/luminescent-dreams/emseries" repository = "https://github.com/luminescent-dreams/emseries" @@ -18,14 +18,13 @@ include = [ [dependencies] chrono = { version = "0.4", features = ["serde"] } -chrono-tz = { version = "0.6", features = ["serde"] } -dimensioned = { version = "0.7", features = ["serde"] } +chrono-tz = { version = "0.8", features = ["serde"] } serde = "1" serde_derive = "1" serde_json = "1.0" thiserror = "1.0" uuid = { version = "0.8", features = ["v4", "serde"] } -yaml-rust = "0.4" [dev-dependencies] tempfile = "3.1" +dimensioned = { version = "0.7", features = ["serde"] } diff --git a/emseries/src/types.rs b/emseries/src/types.rs index afebcfb..12a841b 100644 --- a/emseries/src/types.rs +++ b/emseries/src/types.rs @@ -10,6 +10,7 @@ Luminescent Dreams Tools is distributed in the hope that it will be useful, but You should have received a copy of the GNU General Public License along with Lumeto. If not, see . */ +use chrono::NaiveDate; use date_time_tz::DateTimeTz; use serde::de::DeserializeOwned; use serde::ser::Serialize; @@ -43,6 +44,11 @@ pub enum EmseriesWriteError { JSONWriteError(serde_json::error::Error), } +enum TimestampFormat { + DateTimeTz(DateTimeTz), + Date(NaiveDate), +} + /// Any element to be put into the database needs to be Recordable. This is the common API that /// will aid in searching and later in indexing records. pub trait Recordable {