QRM returns sql.ErrNoRows when scanning into struct destination and query result set is empty.
This commit is contained in:
parent
3544977d7f
commit
f9efee77ff
7 changed files with 103 additions and 90 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/testutils"
|
||||
. "github.com/go-jet/jet/postgres"
|
||||
|
|
@ -1798,13 +1797,3 @@ func TestJoinViewWithTable(t *testing.T) {
|
|||
assert.Equal(t, len(dest[0].Rentals), 32)
|
||||
assert.Equal(t, len(dest[1].Rentals), 27)
|
||||
}
|
||||
|
||||
func TestErrNoRows(t *testing.T) {
|
||||
query := SELECT(Customer.AllColumns).FROM(Customer).WHERE(Customer.CustomerID.EQ(Int(-1)))
|
||||
|
||||
customer := model.Customer{}
|
||||
|
||||
err := query.Query(db, &customer)
|
||||
|
||||
assert.Error(t, err, sql.ErrNoRows.Error())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue