ydb-go-sdk
ydb-go-sdk copied to clipboard
bug: When using `Text` columns, ScanStruct does not work for pointer struct field & and the column is mandatory
Bug Report
YDB GO SDK version:
v3.71.0
Description:
When using Text
columns, ScanStruct does not work for pointer struct field](bug: When using Text
columns, ScanStruct does not work for pointer struct field & and the column is mandatory)
CREATE TABLE `test`
(
`id` Text NOT NULL
);
type T struct {
ID *string `sql:"id"`
}
Not work, error: cannot cast 'TEST' (type 'Utf8') to '**string' destination at github.com/ydb-platform/ydb-go-sdk/v3/internal/value.textValue.castTo(value.go:2046)
at `github.com/ydb-platform/ydb-go-sdk/v3/internal/query/scanner.StructScanner.ScanStruct(struct.go:64)
row, err := s.ydbConn.Query().ReadResultSet(ctx, "select id from `test`;")
nextRow, err := row.NextRow(ctx)
var t T
err = nextRow.ScanStruct(&t, query.WithScanStructAllowMissingColumnsFromSelect(), query.WithScanStructAllowMissingFieldsInStruct())