Skip to content

Commit

Permalink
betav9 fix (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElecTwix authored Apr 3, 2023
1 parent 98daa05 commit 9fb7511
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"reflect"
"strings"

"github.com/surrealdb/surrealdb.go/internal/websocket"
)
Expand Down Expand Up @@ -302,20 +301,9 @@ func (db *DB) send(method string, params ...interface{}) (interface{}, error) {
}

// resp is a helper method for parsing the response from a query.
func (db *DB) resp(_ string, params []interface{}, res interface{}) (interface{}, error) {
if arg, ok := params[0].(string); ok {
if strings.Contains(arg, ":") {
arr, ok := res.([]interface{})
if !ok {
return nil, InvalidResponse
}

if len(arr) < 1 {
return nil, ErrNoRow
}

return arr[0], nil
}
func (db *DB) resp(_ string, _ []interface{}, res interface{}) (interface{}, error) {
if res == nil {
return nil, ErrNoRow
}
return res, nil
}
Expand Down

0 comments on commit 9fb7511

Please sign in to comment.