File tree Expand file tree Collapse file tree 3 files changed +28
-15
lines changed Expand file tree Collapse file tree 3 files changed +28
-15
lines changed Original file line number Diff line number Diff line change 14
14
# under the License.
15
15
16
16
[package ]
17
- name = " iotdb-client-rs"
18
- version = " 0.3.7"
19
17
authors = [
" Mark Liu <[email protected] >" ]
18
+ categories = [" database" ]
19
+ description = " Rust client library for Apache IoTDB"
20
+ documentation = " https://docs.rs/iotdb-client-rs"
20
21
edition = " 2021"
22
+ keywords = [" iotdb" , " iotdb-client-rust" , " apache-iotdb" ]
21
23
license = " Apache-2.0"
24
+ name = " iotdb-client-rs"
22
25
readme = " README.md"
23
- description = " Rust client library for Apache IoTDB"
24
- keywords = [" iotdb" , " iotdb-client-rust" , " apache-iotdb" ]
25
26
repository = " https://github.com/manlge/iotdb-client-rs.git"
26
- categories = [" database" ]
27
- documentation = " https://docs.rs/iotdb-client-rs"
27
+ version = " 0.3.8"
28
28
29
29
[lib ]
30
30
name = " iotdb"
31
31
32
32
[dev-dependencies ]
33
- chrono = " 0.4.19"
33
+ chrono = " 0.4.19"
34
34
prettytable-rs = " 0.8.0"
35
35
structopt = " 0.3.25"
36
36
37
37
[dependencies ]
38
- thrift = " 0.15.0 "
39
- permutation = " 0.2.5 "
38
+ permutation = " 0.2.5 "
39
+ thrift = " 0.15.0 "
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ Put this in your `Cargo.toml`:
61
61
62
62
``` toml
63
63
[dependencies ]
64
- iotdb-client-rs =" ^0.3.7 "
64
+ iotdb-client-rs =" ^0.3.8 "
65
65
```
66
66
67
67
## Example
@@ -70,7 +70,7 @@ Put this in your example's `Cargo.toml`:
70
70
71
71
``` toml
72
72
[dependencies ]
73
- iotdb-client-rs =" ^0.3.7 "
73
+ iotdb-client-rs =" ^0.3.8 "
74
74
chrono =" 0.4.19"
75
75
prettytable-rs =" 0.8.0"
76
76
structopt = " 0.3.25"
Original file line number Diff line number Diff line change @@ -67,10 +67,23 @@ impl Into<Vec<u8>> for &Tablet {
67
67
fn into ( self ) -> Vec < u8 > {
68
68
let mut buffer: Vec < u8 > = Vec :: with_capacity ( self . get_row_count ( ) * self . get_column_count ( ) * 8 ) ;
69
69
self . columns . iter ( ) . for_each ( |column| {
70
- column. iter ( ) . for_each ( |v| {
71
- let mut value_data: Vec < u8 > = v. into ( ) ;
72
- value_data. remove ( 0 ) ; //first item is datatype, remove it.
73
- buffer. append ( & mut value_data) ;
70
+ column. iter ( ) . for_each ( |value| {
71
+ match value{
72
+ Value :: Bool ( v) => match v {
73
+ true => buffer. push ( 1 ) ,
74
+ false => buffer. push ( 0 ) ,
75
+ } ,
76
+ Value :: Int32 ( v) => buffer. append ( & mut v. to_be_bytes ( ) . to_vec ( ) ) ,
77
+ Value :: Int64 ( v) => buffer. append ( & mut v. to_be_bytes ( ) . to_vec ( ) ) ,
78
+ Value :: Float ( v) => buffer. append ( & mut v. to_be_bytes ( ) . to_vec ( ) ) ,
79
+ Value :: Double ( v) => buffer. append ( & mut v. to_be_bytes ( ) . to_vec ( ) ) ,
80
+ Value :: Text ( t) => {
81
+ let len = t. len ( ) as i32 ;
82
+ buffer. append ( & mut len. to_be_bytes ( ) . to_vec ( ) ) ;
83
+ buffer. append ( & mut t. as_bytes ( ) . to_vec ( ) ) ;
84
+ } ,
85
+ Value :: Null => unimplemented ! ( "null value doesn't implemented for tablet" ) ,
86
+ }
74
87
} ) ;
75
88
} ) ;
76
89
buffer
You can’t perform that action at this time.
0 commit comments