Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove lazy_static dependency #149

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions influxdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ chrono = { version = "0.4.23", features = ["serde"], default-features = false }
futures-util = "0.3.17"
http = "0.2.4"
influxdb_derive = { version = "0.5.1", optional = true }
lazy_static = "1.4.0"
regex = "1.3.5"
lazy-regex = "3.1"
reqwest = { version = "0.11.4", default-features = false, optional = true }
surf = { version = "2.2.0", default-features = false, optional = true }
serde = { version = "1.0.186", optional = true }
Expand Down
15 changes: 6 additions & 9 deletions influxdb/src/query/line_proto_term.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
/// InfluxDB Line Protocol escaping helper module.
/// https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/
use crate::Type;
use lazy_static::lazy_static;
use regex::Regex;

lazy_static! {
pub static ref COMMAS_SPACES: Regex = Regex::new("[, ]").unwrap();
pub static ref COMMAS_SPACES_EQUALS: Regex = Regex::new("[, =]").unwrap();
pub static ref QUOTES_SLASHES: Regex = Regex::new(r#"["\\]"#).unwrap();
pub static ref SLASHES: Regex = Regex::new(r#"(\\|,| |=|")"#).unwrap();
}
use lazy_regex::{lazy_regex, Lazy, Regex};

pub static COMMAS_SPACES: Lazy<Regex> = lazy_regex!("[, ]");
pub static COMMAS_SPACES_EQUALS: Lazy<Regex> = lazy_regex!("[, =]");
pub static QUOTES_SLASHES: Lazy<Regex> = lazy_regex!(r#"["\\]"#);
pub static SLASHES: Lazy<Regex> = lazy_regex!(r#"(\\|,| |=|")"#);

pub enum LineProtoTerm<'a> {
Measurement(&'a str), // escape commas, spaces
Expand Down