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 09a7dcf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 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
8 changes: 4 additions & 4 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 Expand Up @@ -1015,7 +1015,7 @@ func getDateset2() *nebula.DataSet {

var v4 = nebula.NewValue()
b4 := new(bool)
*b4 = bool(true)
*b4 = true
v2.BVal = b4

valueList := []*nebula.Value{v1, v2, v3, v4}
Expand Down

0 comments on commit 09a7dcf

Please sign in to comment.