Add QRM error if result set is empty when scanning into struct destination.
This commit is contained in:
parent
02fafd8a7a
commit
8c9ae77cd8
6 changed files with 61 additions and 22 deletions
|
|
@ -50,14 +50,16 @@ func TestScanToInvalidDestination(t *testing.T) {
|
|||
|
||||
func TestScanToValidDestination(t *testing.T) {
|
||||
t.Run("pointer to struct", func(t *testing.T) {
|
||||
err := query.Query(db, &struct{}{})
|
||||
dest := []struct{}{}
|
||||
err := query.Query(db, &dest)
|
||||
|
||||
assert.NilError(t, err)
|
||||
})
|
||||
|
||||
t.Run("global query function scan", func(t *testing.T) {
|
||||
queryStr, args := query.Sql()
|
||||
err := qrm.Query(nil, db, queryStr, args, &struct{}{})
|
||||
dest := []struct{}{}
|
||||
err := qrm.Query(nil, db, queryStr, args, &dest)
|
||||
assert.NilError(t, err)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue