This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch new_datatype
in repository https://gitbox.apache.org/repos/asf/iotdb-client-go.git

commit c92755dc272e0846219f2bce9aff0b31427d95cd
Author: HTHou <[email protected]>
AuthorDate: Thu Sep 19 09:54:40 2024 +0800

    init
---
 client/protocol.go | 54 +++++++++++++++++++++++++++---------------------------
 client/session.go  | 11 +++++++++++
 2 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/client/protocol.go b/client/protocol.go
index 883f9ae..edc211e 100644
--- a/client/protocol.go
+++ b/client/protocol.go
@@ -26,42 +26,42 @@ type TSEncoding uint8
 type TSCompressionType uint8
 
 const (
-       UNKNOWN TSDataType = -1
-       BOOLEAN TSDataType = 0
-       INT32   TSDataType = 1
-       INT64   TSDataType = 2
-       FLOAT   TSDataType = 3
-       DOUBLE  TSDataType = 4
-       TEXT    TSDataType = 5
+       UNKNOWN   TSDataType = -1
+       BOOLEAN   TSDataType = 0
+       INT32     TSDataType = 1
+       INT64     TSDataType = 2
+       FLOAT     TSDataType = 3
+       DOUBLE    TSDataType = 4
+       TEXT      TSDataType = 5
+       TIMESTAMP TSDataType = 8
+       DATE      TSDataType = 9
+       BLOB      TSDataType = 10
+       STRING    TSDataType = 11
 )
 
 const (
-       PLAIN            TSEncoding = 0
-       PLAIN_DICTIONARY TSEncoding = 1
-       RLE              TSEncoding = 2
-       DIFF             TSEncoding = 3
-       TS_2DIFF         TSEncoding = 4
-       BITMAP           TSEncoding = 5
-       GORILLA_V1       TSEncoding = 6
-       REGULAR          TSEncoding = 7
-       GORILLA          TSEncoding = 8
-    ZIGZAG           TSEncoding = 9
-    FREQ             TSEncoding = 10
-    CHIMP            TSEncoding = 11
-    SPRINTZ          TSEncoding = 12
-    RLBE             TSEncoding = 13
+       PLAIN      TSEncoding = 0
+       DICTIONARY TSEncoding = 1
+       RLE        TSEncoding = 2
+       DIFF       TSEncoding = 3
+       TS_2DIFF   TSEncoding = 4
+       BITMAP     TSEncoding = 5
+       GORILLA_V1 TSEncoding = 6
+       REGULAR    TSEncoding = 7
+       GORILLA    TSEncoding = 8
+       ZIGZAG     TSEncoding = 9
+       FREQ       TSEncoding = 10
+       CHIMP      TSEncoding = 11
+       SPRINTZ    TSEncoding = 12
+       RLBE       TSEncoding = 13
 )
 
 const (
        UNCOMPRESSED TSCompressionType = 0
        SNAPPY       TSCompressionType = 1
        GZIP         TSCompressionType = 2
-       LZO          TSCompressionType = 3
-       SDT          TSCompressionType = 4
-       PAA          TSCompressionType = 5
-       PLA          TSCompressionType = 6
        LZ4          TSCompressionType = 7
-       ZSTD             TSCompressionType = 8
+       ZSTD         TSCompressionType = 8
        LZMA2        TSCompressionType = 9
 )
 
@@ -201,4 +201,4 @@ const (
        CqAlreadyActive           int32 = 1401
        CqAlreadyExist            int32 = 1402
        CqUpdateLastExecTimeError int32 = 1403
-)
\ No newline at end of file
+)
diff --git a/client/session.go b/client/session.go
index 47985f8..6fc014b 100644
--- a/client/session.go
+++ b/client/session.go
@@ -952,6 +952,7 @@ func valuesToBytes(dataTypes []TSDataType, values 
[]interface{}) ([]byte, error)
                                return nil, fmt.Errorf("values[%d] %v(%v) must 
be int32", i, v, reflect.TypeOf(v))
                        }
                case INT64:
+               case TIMESTAMP:
                        switch v.(type) {
                        case int64:
                                binary.Write(buff, binary.BigEndian, v)
@@ -973,6 +974,16 @@ func valuesToBytes(dataTypes []TSDataType, values 
[]interface{}) ([]byte, error)
                                return nil, fmt.Errorf("values[%d] %v(%v) must 
be float64", i, v, reflect.TypeOf(v))
                        }
                case TEXT:
+               case STRING:
+                       switch s := v.(type) {
+                       case string:
+                               size := len(s)
+                               binary.Write(buff, binary.BigEndian, 
int32(size))
+                               binary.Write(buff, binary.BigEndian, []byte(s))
+                       default:
+                               return nil, fmt.Errorf("values[%d] %v(%v) must 
be string", i, v, reflect.TypeOf(v))
+                       }
+               case BLOB:
                        switch s := v.(type) {
                        case string:
                                size := len(s)

Reply via email to