mirror of
https://github.com/ent/ent.git
synced 2026-05-06 01:20:56 +03:00
dialect/sql: wraps the sql.Rows with ColumnScanner interface
This commit is contained in:
committed by
Ariel Mashraki
parent
123930c362
commit
899e9f0e50
@@ -132,7 +132,7 @@ var _ dialect.Driver = (*Driver)(nil)
|
||||
|
||||
type (
|
||||
// Rows wraps the sql.Rows to avoid locks copy.
|
||||
Rows struct{ *sql.Rows }
|
||||
Rows struct{ ColumnScanner }
|
||||
// Result is an alias to sql.Result.
|
||||
Result = sql.Result
|
||||
// NullBool is an alias to sql.NullBool.
|
||||
@@ -165,3 +165,15 @@ func (n *NullScanner) Scan(value interface{}) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ColumnScanner is the interface that wraps the standard
|
||||
// sql.Rows methods used for scanning database rows.
|
||||
type ColumnScanner interface {
|
||||
Close() error
|
||||
ColumnTypes() ([]*sql.ColumnType, error)
|
||||
Columns() ([]string, error)
|
||||
Err() error
|
||||
Next() bool
|
||||
NextResultSet() bool
|
||||
Scan(dest ...interface{}) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user