1
- use influx_db_client:: {
2
- point, points, reqwest:: Url , Client , Point , Points , Precision , UdpClient , Value ,
3
- } ;
1
+ use influx_db_client:: { point, points, reqwest:: Url , Client , Point , Points , Precision , UdpClient } ;
4
2
use std:: fs:: File ;
5
3
use std:: io:: Read ;
6
4
use std:: thread:: sleep;
@@ -28,10 +26,10 @@ fn create_and_delete_measurement() {
28
26
client. switch_database ( "test_create_and_delete_measurement" ) ;
29
27
client. create_database ( client. get_db ( ) ) . await . unwrap ( ) ;
30
28
let point = Point :: new ( "temporary" )
31
- . add_field ( "foo" , Value :: String ( "bar" . to_string ( ) ) )
32
- . add_field ( "integer" , Value :: Integer ( 11 ) )
33
- . add_field ( "float" , Value :: Float ( 22.3 ) )
34
- . add_field ( "'boolean'" , Value :: Boolean ( false ) ) ;
29
+ . add_field ( "foo" , "bar" )
30
+ . add_field ( "integer" , 11 )
31
+ . add_field ( "float" , 22.3 )
32
+ . add_field ( "'boolean'" , false ) ;
35
33
36
34
client
37
35
. write_point ( point, Some ( Precision :: Seconds ) , None )
@@ -50,16 +48,16 @@ fn use_points() {
50
48
client. switch_database ( "test_use_points" ) ;
51
49
client. create_database ( client. get_db ( ) ) . await . unwrap ( ) ;
52
50
let point = Point :: new ( "test1" )
53
- . add_field ( "foo" , Value :: String ( "bar" . to_string ( ) ) )
54
- . add_field ( "integer" , Value :: Integer ( 11 ) )
55
- . add_field ( "float" , Value :: Float ( 22.3 ) )
56
- . add_field ( "'boolean'" , Value :: Boolean ( false ) ) ;
51
+ . add_field ( "foo" , "bar" )
52
+ . add_field ( "integer" , 11 )
53
+ . add_field ( "float" , 22.3 )
54
+ . add_field ( "'boolean'" , false ) ;
57
55
58
56
let point1 = Point :: new ( "test2" )
59
- . add_tag ( "tags" , Value :: String ( String :: from ( "'=213w" ) ) )
60
- . add_tag ( "number" , Value :: Integer ( 12 ) )
61
- . add_tag ( "float" , Value :: Float ( 12.6 ) )
62
- . add_field ( "fd" , Value :: String ( "'3'" . to_string ( ) ) ) ;
57
+ . add_tag ( "tags" , "'=213w" )
58
+ . add_tag ( "number" , 12 )
59
+ . add_tag ( "float" , 12.6 )
60
+ . add_field ( "fd" , "'3'" . to_string ( ) ) ;
63
61
64
62
let points = Points :: create_new ( vec ! [ point1, point] ) ;
65
63
@@ -83,7 +81,7 @@ fn query() {
83
81
let mut client = Client :: default ( ) . set_authentication ( "root" , "root" ) ;
84
82
client. switch_database ( dbname) ;
85
83
client. create_database ( client. get_db ( ) ) . await . unwrap ( ) ;
86
- let point = Point :: new ( "test3" ) . add_field ( "foo" , Value :: String ( "bar" . to_string ( ) ) ) ;
84
+ let point = Point :: new ( "test3" ) . add_field ( "foo" , "bar" ) ;
87
85
let point1 = point. clone ( ) ;
88
86
let point = point. add_timestamp ( 1_508_981_970 ) ;
89
87
let point1 = point1. add_timestamp ( 1_508_982_026 ) ;
@@ -102,7 +100,7 @@ fn use_macro() {
102
100
let mut client = Client :: default ( ) . set_authentication ( "root" , "root" ) ;
103
101
client. switch_database ( "use_macro" ) ;
104
102
client. create_database ( client. get_db ( ) ) . await . unwrap ( ) ;
105
- let point = point ! ( "test4" ) . add_field ( "foo" , Value :: String ( "bar" . to_string ( ) ) ) ;
103
+ let point = point ! ( "test4" ) . add_field ( "foo" , "bar" ) ;
106
104
let point1 = point. clone ( ) ;
107
105
let point = point. add_timestamp ( 1_508_981_970 ) ;
108
106
let point1 = point1. add_timestamp ( 1_508_982_026 ) ;
@@ -123,7 +121,7 @@ fn use_udp() {
123
121
udp. add_host ( "127.0.0.1:8090" . parse ( ) . unwrap ( ) ) ;
124
122
let mut client = Client :: default ( ) . set_authentication ( "root" , "root" ) ;
125
123
126
- let point = point ! ( "test" ) . add_field ( "foo" , Value :: String ( String :: from ( "bar" ) ) ) ;
124
+ let point = point ! ( "test" ) . add_field ( "foo" , "bar" ) ;
127
125
128
126
udp. write_point ( point) . unwrap ( ) ;
129
127
@@ -253,7 +251,7 @@ bind-address = "127.0.0.1:{rpc_port}"
253
251
block_on ( async {
254
252
client. create_database ( client. get_db ( ) ) . await . unwrap ( ) ;
255
253
256
- let point = point ! ( "foo" ) . add_field ( "foo" , Value :: String ( String :: from ( "bar" ) ) ) ;
254
+ let point = point ! ( "foo" ) . add_field ( "foo" , "bar" ) ;
257
255
258
256
client. write_point ( point, None , None ) . await . unwrap ( ) ;
259
257
0 commit comments