Closed asmyasnikov closed 6 months ago
How do I scan to optional values?
migration:
name Text
StructScan result:
cannot cast 'Test' (type 'Utf8') to '**string' destination
cannot cast 'Test' (type 'Utf8') to '*sql.NullString' destination
(maybe support https://github.com/guregu/null)It would still be cool to support scanning in aliases to types, for example in generating enum from protobuf type TestEnum int32
and JSON types in Go structure
How do I scan to optional values?
migration:
name Text
StructScan result:
cannot cast 'Test' (type 'Utf8') to '**string' destination
cannot cast 'Test' (type 'Utf8') to '*sql.NullString' destination
(maybe support https://github.com/guregu/null)It would still be cool to support scanning in aliases to types, for example in generating enum from protobuf
type TestEnum int32
and JSON types in Go structure
you can define a pointer to type such as
var v *string
err := row.Scan(&v)
How do I scan to optional values? migration:
name Text
StructScan result:
cannot cast 'Test' (type 'Utf8') to '**string' destination
cannot cast 'Test' (type 'Utf8') to '*sql.NullString' destination
(maybe support https://github.com/guregu/null)It would still be cool to support scanning in aliases to types, for example in generating enum from protobuf
type TestEnum int32
and JSON types in Go structureyou can define a pointer to type such as
var v *string err := row.Scan(&v)
The question was about StructScan, it doesn't work like that with it.
https://github.com/ydb-platform/ydb-go-sdk/blob/master/internal/query/scanner_struct.go#L20