DATA-DOG / go-sqlmock

Sql mock driver for golang to test database interactions
Other
5.95k stars 404 forks source link

gordor.options PrefetchCount\FetchArraySize #306

Closed VadimGossip closed 1 year ago

VadimGossip commented 1 year ago

Hi, i am trying to mock with this code, request with gordor PrefetchCount\FetchArraySize params. refDestMockRows := sqlmock.NewRows([]string{"code", "ipcd_id"}). AddRow("3333", 33). AddRow("4444", 44). AddRow("3434", 33) mock.ExpectQuery(sqlDSTRQuery).WillReturnRows(refDestMockRows)

query
rows, err := tx.QueryContext(ctx, sqlDSTRQuery, godror.PrefetchCount(preFetchSize), godror.FetchArraySize(fetchSize))

and receive an error sql: converting argument $1 type: unsupported type godror.Option, a func

if i remove godror.PrefetchCount(preFetchSize), godror.FetchArraySize(fetchSize) everything become fine, but it's not an option. Please tell me what I'm doing wrong.

fatelei commented 1 year ago

hi, godror. FetchArraySize and godror.PrefetchCount type are type Option func(*stmtOptions)

https://github.com/godror/godror/blob/0040f4954e5bfabc081f2b1d58a28c4983a4712c/stmt.go#LL137-L137C31