MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / genInsertTabletsReq

Method genInsertTabletsReq

client/session.go:1050–1085  ·  view source on GitHub ↗
(tablets []*Tablet, isAligned bool)

Source from the content-addressed store, hash-verified

1048}
1049
1050func (s *Session) genInsertTabletsReq(tablets []*Tablet, isAligned bool) (*rpc.TSInsertTabletsReq, error) {
1051 var (
1052 length = len(tablets)
1053 deviceIds = make([]string, length)
1054 measurementsList = make([][]string, length)
1055 valuesList = make([][]byte, length)
1056 timestampsList = make([][]byte, length)
1057 typesList = make([][]int32, length)
1058 sizeList = make([]int32, length)
1059 )
1060 for index, tablet := range tablets {
1061 deviceIds[index] = tablet.insertTargetName
1062 measurementsList[index] = tablet.GetMeasurements()
1063
1064 values, err := tablet.getValuesBytes()
1065 if err != nil {
1066 return nil, err
1067 }
1068
1069 valuesList[index] = values
1070 timestampsList[index] = tablet.GetTimestampBytes()
1071 typesList[index] = tablet.getDataTypes()
1072 sizeList[index] = int32(tablet.RowSize)
1073 }
1074 request := rpc.TSInsertTabletsReq{
1075 SessionId: s.sessionId,
1076 PrefixPaths: deviceIds,
1077 TypesList: typesList,
1078 MeasurementsList: measurementsList,
1079 ValuesList: valuesList,
1080 TimestampsList: timestampsList,
1081 SizeList: sizeList,
1082 IsAligned: &isAligned,
1083 }
1084 return &request, nil
1085}
1086
1087func (s *Session) genInsertRecordsReq(deviceIds []string, measurements [][]string, dataTypes [][]TSDataType, values [][]interface{},
1088 timestamps []int64, isAligned bool,

Callers 2

InsertTabletsMethod · 0.95
InsertAlignedTabletsMethod · 0.95

Calls 4

getValuesBytesMethod · 0.80
GetTimestampBytesMethod · 0.80
getDataTypesMethod · 0.80
GetMeasurementsMethod · 0.45

Tested by

no test coverage detected