@@ -374,19 +374,20 @@ func (res ResultSet) scanRow(row *nebula.Row, colNames []string, rowType reflect
374
374
}
375
375
376
376
func scanListCol (vals []* nebula.Value , listVal reflect.Value , sliceType reflect.Type ) error {
377
- var listCol = reflect .MakeSlice (sliceType , len (vals ), len (vals ))
378
- for _ , val := range vals {
379
- switch sliceType .Elem ().Kind () {
380
- case reflect .Struct :
377
+ var listCol = reflect .MakeSlice (sliceType , 0 , len (vals ))
378
+
379
+ switch sliceType .Elem ().Kind () {
380
+ case reflect .Struct :
381
+ for _ , val := range vals {
381
382
ele := reflect .New (sliceType .Elem ()).Elem ()
382
383
err := scanStructField (val , ele , sliceType .Elem ())
383
384
if err != nil {
384
385
return err
385
386
}
386
387
listCol = reflect .Append (listCol , ele )
387
- default :
388
- return errors .New ("scan: not support list type" )
389
388
}
389
+ default :
390
+ return errors .New ("scan: not support list type" )
390
391
}
391
392
392
393
listVal .Set (listCol )
@@ -398,15 +399,23 @@ func scanStructField(val *nebula.Value, eleVal reflect.Value, eleType reflect.Ty
398
399
vertex := val .GetVVal ()
399
400
if vertex != nil {
400
401
tags := vertex .GetTags ()
402
+ vid := vertex .GetVid ()
403
+
401
404
if len (tags ) != 0 {
402
- tag := tags [0 ] // TODO: support multiple tags
405
+ tag := tags [0 ]
406
+
403
407
props := tag .GetProps ()
408
+ props ["_vid" ] = vid
409
+ tagName := tag .GetName ()
410
+ props ["_tag_name" ] = & nebula.Value {SVal : tagName }
411
+
404
412
err := scanValFromProps (props , eleVal , eleType )
405
413
if err != nil {
406
414
return err
407
415
}
416
+ return nil
408
417
}
409
- return nil
418
+ // no tags, continue
410
419
}
411
420
412
421
edge := val .GetEVal ()
0 commit comments