Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
haoxins committed Jan 31, 2024
1 parent b2eade0 commit aadb7ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions result_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,16 @@ func (res ResultSet) scanRow(row *nebula.Row, colNames []string, t reflect.Type)
val.Field(fIdx).SetBool(rowVal.GetBVal())
case reflect.Int:
val.Field(fIdx).SetInt(rowVal.GetIVal())
case reflect.Int8:
val.Field(fIdx).SetInt(rowVal.GetIVal())
case reflect.Int16:
val.Field(fIdx).SetInt(rowVal.GetIVal())
case reflect.Int32:
val.Field(fIdx).SetInt(rowVal.GetIVal())
case reflect.Int64:
val.Field(fIdx).SetInt(rowVal.GetIVal())
case reflect.Float32:
val.Field(fIdx).SetFloat(rowVal.GetFVal())
case reflect.Float64:
val.Field(fIdx).SetFloat(rowVal.GetFVal())
case reflect.String:
Expand Down
6 changes: 3 additions & 3 deletions result_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ func TestScan(t *testing.T) {
assert.Equal(t, 1, len(testStructList))
assert.Equal(t, int64(1), testStructList[0].Col0)
assert.Equal(t, float64(2.0), testStructList[0].Col1)
assert.Equal(t, "string", testStructList[0].Col1)
assert.Equal(t, "string", testStructList[0].Col2)
assert.Equal(t, true, testStructList[0].Col3)

// Scan again should work
Expand All @@ -825,11 +825,11 @@ func TestScan(t *testing.T) {
assert.Equal(t, 2, len(testStructList))
assert.Equal(t, int64(1), testStructList[0].Col0)
assert.Equal(t, float64(2.0), testStructList[0].Col1)
assert.Equal(t, "string", testStructList[0].Col1)
assert.Equal(t, "string", testStructList[0].Col2)
assert.Equal(t, true, testStructList[0].Col3)
assert.Equal(t, int64(1), testStructList[1].Col0)
assert.Equal(t, float64(2.0), testStructList[1].Col1)
assert.Equal(t, "string", testStructList[1].Col1)
assert.Equal(t, "string", testStructList[1].Col2)
assert.Equal(t, true, testStructList[1].Col3)
}

Expand Down

0 comments on commit aadb7ab

Please sign in to comment.