mirror of
https://github.com/ent/ent.git
synced 2026-05-04 00:20:58 +03:00
dialect/sqlscan: add ScanInt64 to be used by sqlgraph
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/213 Reviewed By: alexsn Differential Revision: D18763694 fbshipit-source-id: 890b35fcc2a28914b276ce65477788b4ddaeebf9
This commit is contained in:
committed by
Facebook Github Bot
parent
a4fac2db3b
commit
a5e4a9cf54
@@ -423,12 +423,9 @@ func exist(ctx context.Context, tx dialect.Tx, query string, args ...interface{}
|
||||
return false, fmt.Errorf("reading schema information %v", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
if !rows.Next() {
|
||||
return false, fmt.Errorf("no rows returned")
|
||||
}
|
||||
var n int
|
||||
if err := rows.Scan(&n); err != nil {
|
||||
return false, fmt.Errorf("scanning count")
|
||||
n, err := sql.ScanInt(rows)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return n > 0, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user