You've already forked go-clickhouse
mirror of
https://github.com/uptrace/go-clickhouse.git
synced 2025-06-29 00:21:46 +02:00
chore: add scanning into a map
This commit is contained in:
@ -9,6 +9,7 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"net"
|
"net"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/uptrace/go-clickhouse/ch/chproto"
|
"github.com/uptrace/go-clickhouse/ch/chproto"
|
||||||
@ -447,6 +448,10 @@ func (c StringColumn) ConvertAssign(idx int, v reflect.Value) error {
|
|||||||
v.SetBytes(internal.Bytes(c.Column[idx]))
|
v.SetBytes(internal.Bytes(c.Column[idx]))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
case reflect.Map:
|
||||||
|
dec := json.NewDecoder(strings.NewReader(c.Column[idx]))
|
||||||
|
dec.UseNumber()
|
||||||
|
return dec.Decode(v.Addr().Interface())
|
||||||
default:
|
default:
|
||||||
v.Set(reflect.ValueOf(c.Column[idx]))
|
v.Set(reflect.ValueOf(c.Column[idx]))
|
||||||
return nil
|
return nil
|
||||||
|
Reference in New Issue
Block a user