Skip to content

Commit

Permalink
Merge pull request denisenkom#265 from boreq/docs
Browse files Browse the repository at this point in the history
Information about the Get() errors included in the documentation
  • Loading branch information
jmoiron authored Dec 2, 2016
2 parents f71d5ee + 4c83ffb commit c60b4ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sqlx.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ func (db *DB) Select(dest interface{}, query string, args ...interface{}) error

// Get using this DB.
// Any placeholder parameters are replaced with supplied args.
// An error is returned if the result set is empty.
func (db *DB) Get(dest interface{}, query string, args ...interface{}) error {
return Get(db, dest, query, args...)
}
Expand Down Expand Up @@ -430,6 +431,7 @@ func (tx *Tx) QueryRowx(query string, args ...interface{}) *Row {

// Get within a transaction.
// Any placeholder parameters are replaced with supplied args.
// An error is returned if the result set is empty.
func (tx *Tx) Get(dest interface{}, query string, args ...interface{}) error {
return Get(tx, dest, query, args...)
}
Expand Down Expand Up @@ -499,6 +501,7 @@ func (s *Stmt) Select(dest interface{}, args ...interface{}) error {

// Get using the prepared statement.
// Any placeholder parameters are replaced with supplied args.
// An error is returned if the result set is empty.
func (s *Stmt) Get(dest interface{}, args ...interface{}) error {
return Get(&qStmt{s}, dest, "", args...)
}
Expand Down Expand Up @@ -660,6 +663,7 @@ func Select(q Queryer, dest interface{}, query string, args ...interface{}) erro
// 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.
// Any placeholder parameters are replaced with supplied args.
// An error is returned if the result set is empty.
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 c60b4ab

Please sign in to comment.