Skip to content

Commit a3e4a2d

Browse files
authored
influxdb/src/query: Send uints as influxdb unsigned integers (u suffix instead of i) (#113)
1 parent e6326d8 commit a3e4a2d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: influxdb/src/query/line_proto_term.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl LineProtoTerm<'_> {
4343
.to_string(),
4444
Float(v) => v.to_string(),
4545
SignedInteger(v) => format!("{}i", v),
46-
UnsignedInteger(v) => format!("{}i", v),
46+
UnsignedInteger(v) => format!("{}u", v),
4747
Text(v) => format!(r#""{}""#, Self::escape_any(v, &*QUOTES_SLASHES)),
4848
}
4949
}

Diff for: influxdb/src/query/write_query.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,13 @@ mod tests {
264264
.into_query("weather".to_string())
265265
.add_field("temperature", 82)
266266
.add_field("wind_strength", 3.7)
267+
.add_field("temperature_unsigned", 82u64)
267268
.build();
268269

269270
assert!(query.is_ok(), "Query was empty");
270271
assert_eq!(
271272
query.unwrap(),
272-
"weather temperature=82i,wind_strength=3.7 11"
273+
"weather temperature=82i,wind_strength=3.7,temperature_unsigned=82u 11"
273274
);
274275
}
275276

@@ -282,7 +283,7 @@ mod tests {
282283
.build();
283284

284285
assert!(query.is_ok(), "Query was empty");
285-
assert_eq!(query.unwrap(), "weather temperature=82i 11");
286+
assert_eq!(query.unwrap(), "weather temperature=82u 11");
286287
}
287288

288289
#[test]

0 commit comments

Comments
 (0)