Skip to content

Commit

Permalink
fix api docs for Get and Select functions, related to jmoiron#86
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoiron committed Sep 19, 2014
1 parent c7e35f7 commit 2142933
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions sqlx.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,9 @@ func Preparex(p Preparer, query string) (*Stmt, error) {
}

// Select executes a query using the provided Queryer, and StructScans each row
// into dest, which must be a slice of structs. The *sql.Rows are closed
// automatically.
// into dest, which must be a slice. If the slice elements are scannable, then
// the result set must have only one column. Otherwise, StructScan is used.
// The *sql.Rows are closed automatically.
func Select(q Queryer, dest interface{}, query string, args ...interface{}) error {
rows, err := q.Queryx(query, args...)
if err != nil {
Expand All @@ -598,9 +599,9 @@ func Select(q Queryer, dest interface{}, query string, args ...interface{}) erro
return scanAll(rows, dest, false)
}

// Get does a QueryRow using the provided Queryer, and StructScan the resulting
// row into dest, which must be a pointer to a struct. If there was no row,
// Get will return sql.ErrNoRows like row.Scan would.
// Get does a QueryRow using the provided Queryer, and scans the resulting row
// to dest. If dest is scannable, the result must only have one column. Otherwise,
// StructScan is used. Get will return sql.ErrNoRows like row.Scan would.
func Get(q Queryer, dest interface{}, query string, args ...interface{}) error {
r := q.QueryRowx(query, args...)
return r.scanAny(dest, false)
Expand Down

0 comments on commit 2142933

Please sign in to comment.