docs: remove db in sml struct
This commit is contained in:
parent
d3540a7502
commit
4295063bea
|
@ -24,6 +24,9 @@ async fn put_json() -> anyhow::Result<()> {
|
|||
.exec(format!("create database if not exists {db}"))
|
||||
.await?;
|
||||
|
||||
// should specify database before insert
|
||||
client.exec(format!("use {db}")).await?;
|
||||
|
||||
// SchemalessProtocol::Json
|
||||
let data = [
|
||||
r#"[{"metric": "meters.current", "timestamp": 1681345954000, "value": 10.3, "tags": {"location": "California.SanFrancisco", "groupid": 2}}, {"metric": "meters.voltage", "timestamp": 1648432611249, "value": 219, "tags": {"location": "California.LosAngeles", "groupid": 1}}, {"metric": "meters.current", "timestamp": 1648432611250, "value": 12.6, "tags": {"location": "California.SanFrancisco", "groupid": 2}}, {"metric": "meters.voltage", "timestamp": 1648432611250, "value": 221, "tags": {"location": "California.LosAngeles", "groupid": 1}}]"#
|
||||
|
@ -33,7 +36,6 @@ async fn put_json() -> anyhow::Result<()> {
|
|||
|
||||
// demo with all fields
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Json)
|
||||
.precision(SchemalessPrecision::Millisecond)
|
||||
.data(data.clone())
|
||||
|
@ -44,7 +46,6 @@ async fn put_json() -> anyhow::Result<()> {
|
|||
|
||||
// demo with default precision
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Json)
|
||||
.data(data.clone())
|
||||
.ttl(1000)
|
||||
|
@ -54,7 +55,6 @@ async fn put_json() -> anyhow::Result<()> {
|
|||
|
||||
// demo with default ttl
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Json)
|
||||
.data(data.clone())
|
||||
.req_id(302u64)
|
||||
|
@ -63,7 +63,6 @@ async fn put_json() -> anyhow::Result<()> {
|
|||
|
||||
// demo with default req_id
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Json)
|
||||
.data(data.clone())
|
||||
.build()?;
|
||||
|
|
|
@ -25,6 +25,9 @@ async fn put_line() -> anyhow::Result<()> {
|
|||
.exec(format!("create database if not exists {db}"))
|
||||
.await?;
|
||||
|
||||
// should specify database before insert
|
||||
client.exec(format!("use {db}")).await?;
|
||||
|
||||
let data = [
|
||||
"measurement,host=host1 field1=2i,field2=2.0 1577837300000",
|
||||
"measurement,host=host1 field1=2i,field2=2.0 1577837400000",
|
||||
|
@ -36,7 +39,6 @@ async fn put_line() -> anyhow::Result<()> {
|
|||
|
||||
// demo with all fields
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Line)
|
||||
.precision(SchemalessPrecision::Millisecond)
|
||||
.data(data.clone())
|
||||
|
@ -47,7 +49,6 @@ async fn put_line() -> anyhow::Result<()> {
|
|||
|
||||
// demo with default ttl
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Line)
|
||||
.precision(SchemalessPrecision::Millisecond)
|
||||
.data(data.clone())
|
||||
|
@ -57,7 +58,6 @@ async fn put_line() -> anyhow::Result<()> {
|
|||
|
||||
// demo with default ttl and req_id
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Line)
|
||||
.precision(SchemalessPrecision::Millisecond)
|
||||
.data(data.clone())
|
||||
|
@ -66,7 +66,6 @@ async fn put_line() -> anyhow::Result<()> {
|
|||
|
||||
// demo with default precision
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Line)
|
||||
.data(data)
|
||||
.req_id(103u64)
|
||||
|
|
|
@ -24,6 +24,8 @@ async fn put_telnet() -> anyhow::Result<()> {
|
|||
.exec(format!("create database if not exists {db}"))
|
||||
.await?;
|
||||
|
||||
// should specify database before insert
|
||||
client.exec(format!("use {db}")).await?;
|
||||
|
||||
let data = [
|
||||
"meters.current 1648432611249 10.3 location=California.SanFrancisco group=2",
|
||||
|
@ -40,7 +42,6 @@ async fn put_telnet() -> anyhow::Result<()> {
|
|||
|
||||
// demo with all fields
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Telnet)
|
||||
.precision(SchemalessPrecision::Millisecond)
|
||||
.data(data.clone())
|
||||
|
@ -51,7 +52,6 @@ async fn put_telnet() -> anyhow::Result<()> {
|
|||
|
||||
// demo with default precision
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Telnet)
|
||||
.data(data.clone())
|
||||
.ttl(1000)
|
||||
|
@ -61,7 +61,6 @@ async fn put_telnet() -> anyhow::Result<()> {
|
|||
|
||||
// demo with default ttl
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Telnet)
|
||||
.data(data.clone())
|
||||
.req_id(202u64)
|
||||
|
@ -70,7 +69,6 @@ async fn put_telnet() -> anyhow::Result<()> {
|
|||
|
||||
// demo with default req_id
|
||||
let sml_data = SmlDataBuilder::default()
|
||||
.db(db.to_string())
|
||||
.protocol(SchemalessProtocol::Telnet)
|
||||
.data(data.clone())
|
||||
.build()?;
|
||||
|
|
Loading…
Reference in New Issue