Use struct with Select many rows query
dipeshhkc opened this issue · 3 comments
dipeshhkc commented
Hi. Thank you for this library.
I am using struct with tag for BEGIN SELECT id,name INTO :id,:name FROM store WHERE id:id; end
and using ExecContext
command.
This is working fine.
type storeArg struct{
Id string `db:"name=id,size=50,dir=inout"`
Name string `db:"name=name,size=50,dir=out`
}
How can I use struct
if the SELECT is returning multiple rows? LIKE
Getting all stores; SELECT id,name FROM store
sijms commented
database/sql doesn't support this feature
so you should try it using package directly
conn, err := go_ora.NewConnection(den)
err = conn.Open()
rows, err := conn.QueryContext(,,,)
defer rows.Close()
.
.
.
dipeshhkc commented
Does go_ora QueryContext
support struct argument? Do you have an example implementation?
sijms commented
you should cast driver.Rows
to *DataSet
or see examples/query_to_struct