mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 11:27:50 +00:00
Merge branch 'master' into CORE-844_webUI_rename
This commit is contained in:
commit
68d1126ac9
1 changed files with 66 additions and 2 deletions
68
planner.go
68
planner.go
|
|
@ -645,11 +645,12 @@ func (rs *StmtRows) Columns() []*StmtColumn {
|
|||
return rs.node.Columns()
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
func (rs *StmtRows) Row() int64 {
|
||||
return rs.node.Row()[0].(int64)
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
func (rs *StmtRows) Next() bool {
|
||||
if rs.err != nil {
|
||||
return false
|
||||
|
|
@ -696,6 +697,15 @@ func (rs *StmtRows) Scan(dst ...interface{}) error {
|
|||
|
||||
// Copy row value to scan destination.
|
||||
switch v := row[i].(type) {
|
||||
case bool:
|
||||
switch p := dst[i].(type) {
|
||||
case *bool:
|
||||
*p = v
|
||||
case *interface{}:
|
||||
*p = v
|
||||
default:
|
||||
return fmt.Errorf("cannot scan %T value into %T destination at index %d", v, p, i)
|
||||
}
|
||||
case int64:
|
||||
switch p := dst[i].(type) {
|
||||
case *int:
|
||||
|
|
@ -711,6 +721,48 @@ func (rs *StmtRows) Scan(dst ...interface{}) error {
|
|||
default:
|
||||
return fmt.Errorf("cannot scan %T value into %T destination at index %d", v, p, i)
|
||||
}
|
||||
case uint64:
|
||||
switch p := dst[i].(type) {
|
||||
case *int:
|
||||
*p = int(v)
|
||||
case *int64:
|
||||
*p = int64(v)
|
||||
case *uint:
|
||||
*p = uint(v)
|
||||
case *uint64:
|
||||
*p = uint64(v)
|
||||
case *interface{}:
|
||||
*p = v
|
||||
default:
|
||||
return fmt.Errorf("cannot scan %T value into %T destination at index %d", v, p, i)
|
||||
}
|
||||
case []uint64:
|
||||
switch p := dst[i].(type) {
|
||||
case *[]uint64:
|
||||
*p = []uint64(v)
|
||||
case *interface{}:
|
||||
*p = joinUint64Slice(v)
|
||||
default:
|
||||
return fmt.Errorf("cannot scan %T value into %T destination at index %d", v, p, i)
|
||||
}
|
||||
case string:
|
||||
switch p := dst[i].(type) {
|
||||
case *string:
|
||||
*p = v
|
||||
case *interface{}:
|
||||
*p = v
|
||||
default:
|
||||
return fmt.Errorf("cannot scan %T value into %T destination at index %d", v, p, i)
|
||||
}
|
||||
case []string:
|
||||
switch p := dst[i].(type) {
|
||||
case *[]string:
|
||||
*p = []string(v)
|
||||
case *interface{}:
|
||||
*p = strings.Join(v, ",")
|
||||
default:
|
||||
return fmt.Errorf("cannot scan %T value into %T destination at index %d", v, p, i)
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("unexpected %T value at index %d", v, i)
|
||||
}
|
||||
|
|
@ -1113,3 +1165,15 @@ func stringSliceIndex(a []string, v string) int {
|
|||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func joinUint64Slice(a []uint64) string {
|
||||
b := []byte("[")
|
||||
for i, v := range a {
|
||||
b = strconv.AppendUint(b, v, 10)
|
||||
if i < len(a)-1 {
|
||||
b = append(b, ',')
|
||||
}
|
||||
}
|
||||
b = append(b, ']')
|
||||
return string(b)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue