add comments to imports, remove unneeded ctx from SQLiteRows{}
This commit is contained in:
parent
04e36e3e46
commit
c04061c260
|
@ -355,6 +355,7 @@ func sqliteConn(ctx context.Context) (*bun.DB, error) {
|
|||
err = processSQLiteError(err) // adds error code
|
||||
return nil, fmt.Errorf("sqlite ping: %w", err)
|
||||
}
|
||||
|
||||
log.Infof(ctx, "connected to SQLITE database with address %s", address)
|
||||
|
||||
return db, nil
|
||||
|
|
|
@ -284,10 +284,7 @@ func (stmt *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedVal
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SQLiteRows{
|
||||
Ctx: ctx,
|
||||
RowsIface: rows.(sqlite.RowsIface),
|
||||
}, nil
|
||||
return &SQLiteRows{RowsIface: rows.(sqlite.RowsIface)}, nil
|
||||
}
|
||||
|
||||
func (stmt *SQLiteStmt) Close() (err error) {
|
||||
|
@ -296,10 +293,7 @@ func (stmt *SQLiteStmt) Close() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
type SQLiteRows struct {
|
||||
Ctx context.Context
|
||||
sqlite.RowsIface
|
||||
}
|
||||
type SQLiteRows struct{ sqlite.RowsIface }
|
||||
|
||||
func (r *SQLiteRows) Next(dest []driver.Value) (err error) {
|
||||
err = r.RowsIface.Next(dest)
|
||||
|
@ -308,7 +302,6 @@ func (r *SQLiteRows) Next(dest []driver.Value) (err error) {
|
|||
}
|
||||
|
||||
func (r *SQLiteRows) Close() (err error) {
|
||||
// use background ctx as these rows MUST be closed.
|
||||
err = r.RowsIface.Close()
|
||||
err = processSQLiteError(err)
|
||||
return
|
||||
|
|
|
@ -20,11 +20,14 @@ package sqlite
|
|||
import (
|
||||
"context"
|
||||
"database/sql/driver"
|
||||
|
||||
// linkname shenanigans
|
||||
_ "unsafe"
|
||||
|
||||
"github.com/ncruces/go-sqlite3"
|
||||
_ "github.com/ncruces/go-sqlite3/driver"
|
||||
// embed wasm sqlite binary
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
|
||||
"github.com/ncruces/go-sqlite3"
|
||||
)
|
||||
|
||||
// ConnIface is the driver.Conn interface
|
||||
|
|
Loading…
Reference in New Issue