diff --git a/influxdb/src/query/line_proto_term.rs b/influxdb/src/query/line_proto_term.rs index 2ba8b3c..0b82a8b 100644 --- a/influxdb/src/query/line_proto_term.rs +++ b/influxdb/src/query/line_proto_term.rs @@ -44,7 +44,7 @@ impl LineProtoTerm<'_> { Float(v) => v.to_string(), SignedInteger(v) => format!("{}i", v), UnsignedInteger(v) => format!("{}i", v), - Text(v) => format!(r#""{}""#, Self::escape_any(v, &*SLASHES)), + Text(v) => format!(r#""{}""#, Self::escape_any(v, &*QUOTES_SLASHES)), } } @@ -59,9 +59,9 @@ impl LineProtoTerm<'_> { } } .to_string(), - Float(v) => format!(r#""{}""#, v.to_string()), - SignedInteger(v) => format!(r#""{}""#, v), - UnsignedInteger(v) => format!(r#""{}""#, v), + Float(v) => format!(r#"{}"#, v), + SignedInteger(v) => format!(r#"{}"#, v), + UnsignedInteger(v) => format!(r#"{}"#, v), Text(v) => Self::escape_any(v, &*SLASHES), } } @@ -78,6 +78,11 @@ mod test { #[test] fn test() { + assert_eq!(TagValue(&Type::Boolean(true)).escape(), r#"true"#); + assert_eq!(TagValue(&Type::Float(1.8324f64)).escape(), r#"1.8324"#); + assert_eq!(TagValue(&Type::SignedInteger(-1i64)).escape(), r#"-1"#); + assert_eq!(TagValue(&Type::UnsignedInteger(1u64)).escape(), r#"1"#); + assert_eq!( TagValue(&Type::Text("this is my special string".into())).escape(), r#"this\ is\ my\ special\ string"# @@ -112,7 +117,7 @@ mod test { assert_eq!(FieldValue(&Type::Text("\"".into())).escape(), r#""\"""#); assert_eq!( FieldValue(&Type::Text(r#"locat"\ ,=ion"#.into())).escape(), - r#""locat\"\\\ \,\=ion""# + r#""locat\"\\ ,=ion""# ); } diff --git a/influxdb/tests/derive_integration_tests.rs b/influxdb/tests/derive_integration_tests.rs index e4e28c7..c433d0a 100644 --- a/influxdb/tests/derive_integration_tests.rs +++ b/influxdb/tests/derive_integration_tests.rs @@ -35,7 +35,7 @@ fn test_build_query() { .unwrap(); assert_eq!( query.get(), - "weather_reading,wind_strength=\"5\" humidity=30i 3600000000000" + "weather_reading,wind_strength=5 humidity=30i 3600000000000" ); }