diff --git a/CHANGELOG.md b/CHANGELOG.md index 8357d58a..f5698e83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Removed + - `::raw_read_query`, deprecated in 0.5.0, was removed + ## [0.7.2] - 2024-02-14 ### Fixed diff --git a/Cargo.toml b/Cargo.toml index 1b3a9f76..d33b2172 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ resolver = "2" [workspace.package] authors = ["Gero Gerke ", "Dominic "] -edition = "2018" +edition = "2021" rust-version = "1.67.1" license = "MIT" repository = "https://github.com/influxdb-rs/influxdb-rust" diff --git a/influxdb/Cargo.toml b/influxdb/Cargo.toml index 6763b985..44e7bb4c 100644 --- a/influxdb/Cargo.toml +++ b/influxdb/Cargo.toml @@ -16,6 +16,11 @@ repository.workspace = true [lints] workspace = true +[[test]] +name = "derive_integration_tests" +path = "tests/derive_integration_tests.rs" +required-features = ["chrono"] + [dependencies] chrono = { version = "0.4.23", features = ["serde"], default-features = false, optional = true } futures-util = "0.3.17" diff --git a/influxdb/src/integrations/serde_integration/mod.rs b/influxdb/src/integrations/serde_integration/mod.rs index a33cb6bb..e4000be2 100644 --- a/influxdb/src/integrations/serde_integration/mod.rs +++ b/influxdb/src/integrations/serde_integration/mod.rs @@ -7,7 +7,7 @@ //! `name`, InfluxDB provides alongside query results. //! //! ```rust,no_run -//! use influxdb::{Client, Query}; +//! use influxdb::{Client, Query as _, ReadQuery}; //! use serde_derive::Deserialize; //! //! #[derive(Deserialize)] @@ -24,7 +24,7 @@ //! # #[tokio::main] //! # async fn main() -> Result<(), influxdb::Error> { //! let client = Client::new("http://localhost:8086", "test"); -//! let query = Query::raw_read_query( +//! let query = ReadQuery::new( //! "SELECT temperature FROM /weather_[a-z]*$/ WHERE time > now() - 1m ORDER BY DESC", //! ); //! let mut db_result = client.json_query(query).await?; diff --git a/influxdb/src/query/mod.rs b/influxdb/src/query/mod.rs index 6268d3ef..19a73e39 100644 --- a/influxdb/src/query/mod.rs +++ b/influxdb/src/query/mod.rs @@ -4,7 +4,7 @@ //! # Examples //! //! ```rust -//! use influxdb::{Query, Timestamp}; +//! use influxdb::{ReadQuery, Query as _, Timestamp}; //! use influxdb::InfluxDbWriteable; //! //! let write_query = Timestamp::Nanoseconds(0).into_query("measurement") @@ -14,7 +14,7 @@ //! //! assert!(write_query.is_ok()); //! -//! let read_query = Query::raw_read_query("SELECT * FROM weather") +//! let read_query = ReadQuery::new("SELECT * FROM weather") //! .build(); //! //! assert!(read_query.is_ok()); @@ -26,7 +26,7 @@ pub mod read_query; pub mod write_query; use std::fmt; -use crate::{Error, ReadQuery, WriteQuery}; +use crate::{Error, WriteQuery}; use consts::{ MILLIS_PER_SECOND, MINUTES_PER_HOUR, NANOS_PER_MICRO, NANOS_PER_MILLI, SECONDS_PER_MINUTE, }; @@ -195,25 +195,6 @@ impl InfluxDbWriteable for Timestamp { } } -impl dyn Query { - /// Returns a [`ReadQuery`](crate::ReadQuery) builder. - /// - /// # Examples - /// - /// ```rust - /// use influxdb::Query; - /// - /// Query::raw_read_query("SELECT * FROM weather"); // Is of type [`ReadQuery`](crate::ReadQuery) - /// ``` - #[deprecated(since = "0.5.0", note = "Use ReadQuery::new instead")] - pub fn raw_read_query(read_query: S) -> ReadQuery - where - S: Into, - { - ReadQuery::new(read_query) - } -} - #[derive(Debug)] #[doc(hidden)] pub struct ValidQuery(String); @@ -255,7 +236,6 @@ mod tests { MILLIS_PER_SECOND, MINUTES_PER_HOUR, NANOS_PER_MICRO, NANOS_PER_MILLI, SECONDS_PER_MINUTE, }; use crate::query::{Timestamp, ValidQuery}; - use std::convert::TryInto; #[test] fn test_equality_str() { assert_eq!(ValidQuery::from("hello"), "hello"); diff --git a/influxdb/src/query/read_query.rs b/influxdb/src/query/read_query.rs index a1021468..a1a4e667 100644 --- a/influxdb/src/query/read_query.rs +++ b/influxdb/src/query/read_query.rs @@ -1,6 +1,4 @@ -//! Read Query Builder returned by Query::raw_read_query -//! -//! Can only be instantiated by using Query::raw_read_query +//! Read Query Builder use crate::query::{QueryType, ValidQuery}; use crate::{Error, Query}; @@ -49,7 +47,8 @@ impl Query for ReadQuery { #[cfg(test)] mod tests { - use crate::query::{Query, QueryType, ReadQuery}; + use super::ReadQuery; + use crate::query::{Query, QueryType}; #[test] fn test_read_builder_single_query() { diff --git a/influxdb_derive/src/writeable.rs b/influxdb_derive/src/writeable.rs index 234e5fc3..8db055d5 100644 --- a/influxdb_derive/src/writeable.rs +++ b/influxdb_derive/src/writeable.rs @@ -1,6 +1,5 @@ use proc_macro2::TokenStream; use quote::{format_ident, quote}; -use std::convert::TryFrom; use syn::{ parse::{Parse, ParseStream}, punctuated::Punctuated,