-
-
Notifications
You must be signed in to change notification settings - Fork 406
Closed
Description
Hello,
I've been using a lot of go-sqlmock. However, I didn't find a way to mock the returned type from rows.Scan() when called database.Query (a rows object).
I have already successfully inplement the ConvertValue() func for my own custom type type StringSliceType []string which will make mock.NewRows([]string{"myarray"}).AddRow(StringSliceType {"hello", "world"}). enabled. I can input custom type to mock the Query result.
My 3rd party library (https://github.com/kshvakov/clickhouse) supports []string as supported data types so I can write:
var myArray []string
if err := rows.Scan(&myArray); err != nil {
e = err
return
}
However, there will be a type mismatch.
How could I extend go-sqlmock to allow mocking custom data types with the Scan function?
Thank you very much.
Metadata
Metadata
Assignees
Labels
No labels