@@ -69,13 +69,13 @@ func asVectorType(t TypeInfo) (VectorType, bool) {
6969 if err != nil {
7070 return VectorType {}, false
7171 }
72- subType := getCassandraLongType (subStr , n . Version (), nopLogger {})
72+ subType := getCassandraLongType (subStr , nopLogger {})
7373 // recurse if subtype itself is still a custom vector
7474 if innerVec , ok := asVectorType (subType ); ok {
7575 subType = innerVec
7676 }
7777 return VectorType {
78- NativeType : NewCustomType (n . Version () , TypeCustom , vectorTypePrefix ),
78+ NativeType : NewCustomType (0 , TypeCustom , vectorTypePrefix ),
7979 SubType : subType ,
8080 Dimensions : dim ,
8181 }, true
@@ -219,39 +219,39 @@ func getCassandraBaseType(name string) Type {
219219
220220// TODO: Cover with unit tests.
221221// Parses long Java-style type definition to internal data structures.
222- func getCassandraLongType (name string , protoVer byte , logger StdLogger ) TypeInfo {
222+ func getCassandraLongType (name string , logger StdLogger ) TypeInfo {
223223 const prefix = apacheCassandraTypePrefix
224224 if strings .HasPrefix (name , prefix + "SetType" ) {
225225 return CollectionType {
226- NativeType : NewNativeType (protoVer , TypeSet ),
227- Elem : getCassandraLongType (unwrapCompositeTypeDefinition (name , prefix + "SetType" , '(' ), protoVer , logger ),
226+ NativeType : NewNativeType (0 , TypeSet ),
227+ Elem : getCassandraLongType (unwrapCompositeTypeDefinition (name , prefix + "SetType" , '(' ), logger ),
228228 }
229229 } else if strings .HasPrefix (name , prefix + "ListType" ) {
230230 return CollectionType {
231- NativeType : NewNativeType (protoVer , TypeList ),
232- Elem : getCassandraLongType (unwrapCompositeTypeDefinition (name , prefix + "ListType" , '(' ), protoVer , logger ),
231+ NativeType : NewNativeType (0 , TypeList ),
232+ Elem : getCassandraLongType (unwrapCompositeTypeDefinition (name , prefix + "ListType" , '(' ), logger ),
233233 }
234234 } else if strings .HasPrefix (name , prefix + "MapType" ) {
235235 names := splitJavaCompositeTypes (name , prefix + "MapType" )
236236 if len (names ) != 2 {
237237 logger .Printf ("gocql: error parsing map type, it has %d subelements, expecting 2\n " , len (names ))
238- return NewNativeType (protoVer , TypeCustom )
238+ return NewNativeType (0 , TypeCustom )
239239 }
240240 return CollectionType {
241- NativeType : NewNativeType (protoVer , TypeMap ),
242- Key : getCassandraLongType (names [0 ], protoVer , logger ),
243- Elem : getCassandraLongType (names [1 ], protoVer , logger ),
241+ NativeType : NewNativeType (0 , TypeMap ),
242+ Key : getCassandraLongType (names [0 ], logger ),
243+ Elem : getCassandraLongType (names [1 ], logger ),
244244 }
245245 } else if strings .HasPrefix (name , prefix + "TupleType" ) {
246246 names := splitJavaCompositeTypes (name , prefix + "TupleType" )
247247 types := make ([]TypeInfo , len (names ))
248248
249249 for i , name := range names {
250- types [i ] = getCassandraLongType (name , protoVer , logger )
250+ types [i ] = getCassandraLongType (name , logger )
251251 }
252252
253253 return TupleTypeInfo {
254- NativeType : NewNativeType (protoVer , TypeTuple ),
254+ NativeType : NewNativeType (0 , TypeTuple ),
255255 Elems : types ,
256256 }
257257 } else if strings .HasPrefix (name , prefix + "UserType" ) {
@@ -263,94 +263,92 @@ func getCassandraLongType(name string, protoVer byte, logger StdLogger) TypeInfo
263263 fieldName , _ := hex .DecodeString (spec [0 ])
264264 fields [i - 2 ] = UDTField {
265265 Name : string (fieldName ),
266- Type : getCassandraLongType (spec [1 ], protoVer , logger ),
266+ Type : getCassandraLongType (spec [1 ], logger ),
267267 }
268268 }
269269
270270 udtName , _ := hex .DecodeString (names [1 ])
271271 return UDTTypeInfo {
272- NativeType : NewNativeType (protoVer , TypeUDT ),
272+ NativeType : NewNativeType (0 , TypeUDT ),
273273 KeySpace : names [0 ],
274274 Name : string (udtName ),
275275 Elements : fields ,
276276 }
277277 } else if strings .HasPrefix (name , prefix + "VectorType" ) {
278278 names := splitJavaCompositeTypes (name , prefix + "VectorType" )
279- subType := getCassandraLongType (strings .TrimSpace (names [0 ]), protoVer , logger )
279+ subType := getCassandraLongType (strings .TrimSpace (names [0 ]), logger )
280280 dim , err := strconv .Atoi (strings .TrimSpace (names [1 ]))
281281 if err != nil {
282282 logger .Printf ("gocql: error parsing vector dimensions: %v\n " , err )
283- return NewNativeType (protoVer , TypeCustom )
283+ return NewNativeType (0 , TypeCustom )
284284 }
285285
286286 return VectorType {
287- NativeType : NewCustomType (protoVer , TypeCustom , prefix + "VectorType" ),
287+ NativeType : NewCustomType (0 , TypeCustom , prefix + "VectorType" ),
288288 SubType : subType ,
289289 Dimensions : dim ,
290290 }
291291 } else if strings .HasPrefix (name , prefix + "FrozenType" ) {
292292 names := splitJavaCompositeTypes (name , prefix + "FrozenType" )
293- return getCassandraLongType (strings .TrimSpace (names [0 ]), protoVer , logger )
293+ return getCassandraLongType (strings .TrimSpace (names [0 ]), logger )
294294 } else {
295295 // basic type
296296 return NativeType {
297- proto : protoVer ,
298- typ : getApacheCassandraType (name ),
297+ typ : getApacheCassandraType (name ),
299298 }
300299 }
301300}
302301
303302// Parses short CQL type representation (e.g. map<text, text>) to internal data structures.
304- func getCassandraType (name string , protoVer byte , logger StdLogger ) TypeInfo {
303+ func getCassandraType (name string , logger StdLogger ) TypeInfo {
305304 if strings .HasPrefix (name , "frozen<" ) {
306- return getCassandraType (unwrapCompositeTypeDefinition (name , "frozen" , '<' ), protoVer , logger )
305+ return getCassandraType (unwrapCompositeTypeDefinition (name , "frozen" , '<' ), logger )
307306 } else if strings .HasPrefix (name , "set<" ) {
308307 return CollectionType {
309- NativeType : NewNativeType (protoVer , TypeSet ),
310- Elem : getCassandraType (unwrapCompositeTypeDefinition (name , "set" , '<' ), protoVer , logger ),
308+ NativeType : NewNativeType (0 , TypeSet ),
309+ Elem : getCassandraType (unwrapCompositeTypeDefinition (name , "set" , '<' ), logger ),
311310 }
312311 } else if strings .HasPrefix (name , "list<" ) {
313312 return CollectionType {
314- NativeType : NewNativeType (protoVer , TypeList ),
315- Elem : getCassandraType (unwrapCompositeTypeDefinition (name , "list" , '<' ), protoVer , logger ),
313+ NativeType : NewNativeType (0 , TypeList ),
314+ Elem : getCassandraType (unwrapCompositeTypeDefinition (name , "list" , '<' ), logger ),
316315 }
317316 } else if strings .HasPrefix (name , "map<" ) {
318317 names := splitCQLCompositeTypes (name , "map" )
319318 if len (names ) != 2 {
320319 logger .Printf ("Error parsing map type, it has %d subelements, expecting 2\n " , len (names ))
321- return NewNativeType (protoVer , TypeCustom )
320+ return NewNativeType (0 , TypeCustom )
322321 }
323322 return CollectionType {
324- NativeType : NewNativeType (protoVer , TypeMap ),
325- Key : getCassandraType (names [0 ], protoVer , logger ),
326- Elem : getCassandraType (names [1 ], protoVer , logger ),
323+ NativeType : NewNativeType (0 , TypeMap ),
324+ Key : getCassandraType (names [0 ], logger ),
325+ Elem : getCassandraType (names [1 ], logger ),
327326 }
328327 } else if strings .HasPrefix (name , "tuple<" ) {
329328 names := splitCQLCompositeTypes (name , "tuple" )
330329 types := make ([]TypeInfo , len (names ))
331330
332331 for i , name := range names {
333- types [i ] = getCassandraType (name , protoVer , logger )
332+ types [i ] = getCassandraType (name , logger )
334333 }
335334
336335 return TupleTypeInfo {
337- NativeType : NewNativeType (protoVer , TypeTuple ),
336+ NativeType : NewNativeType (0 , TypeTuple ),
338337 Elems : types ,
339338 }
340339 } else if strings .HasPrefix (name , "vector<" ) {
341340 names := splitCQLCompositeTypes (name , "vector" )
342- subType := getCassandraType (strings .TrimSpace (names [0 ]), protoVer , logger )
341+ subType := getCassandraType (strings .TrimSpace (names [0 ]), logger )
343342 dim , _ := strconv .Atoi (strings .TrimSpace (names [1 ]))
344343
345344 return VectorType {
346- NativeType : NewCustomType (protoVer , TypeCustom , apacheCassandraTypePrefix + "VectorType" ),
345+ NativeType : NewCustomType (0 , TypeCustom , apacheCassandraTypePrefix + "VectorType" ),
347346 SubType : subType ,
348347 Dimensions : dim ,
349348 }
350349 } else {
351350 return NativeType {
352- proto : protoVer ,
353- typ : getCassandraBaseType (name ),
351+ typ : getCassandraBaseType (name ),
354352 }
355353 }
356354}
0 commit comments