mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
dialect/sql: wraps the sql.Rows with ColumnScanner interface
This commit is contained in:
committed by
Ariel Mashraki
parent
123930c362
commit
899e9f0e50
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user