dialect/sql: wraps the sql.Rows with ColumnScanner interface

This commit is contained in:
Ariel Mashraki
2021-09-29 21:16:26 +03:00
committed by Ariel Mashraki
parent 123930c362
commit 899e9f0e50
2 changed files with 13 additions and 10 deletions

View File

@@ -12,15 +12,6 @@ import (
"strings"
)
// ColumnScanner is the interface that wraps the
// four sql.Rows methods used for scanning.
type ColumnScanner interface {
Next() bool
Scan(...interface{}) error
Columns() ([]string, error)
Err() error
}
// ScanOne scans one row to the given value. It fails if the rows holds more than 1 row.
func ScanOne(rows ColumnScanner, v interface{}) error {
columns, err := rows.Columns()