Fix linter errors.
This commit is contained in:
parent
65e05021bc
commit
1cc463477d
4 changed files with 30 additions and 21 deletions
|
|
@ -31,5 +31,12 @@ func TestArgToString(t *testing.T) {
|
|||
time, err := time.Parse("Mon Jan 2 15:04:05 -0700 MST 2006", "Mon Jan 2 15:04:05 -0700 MST 2006")
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, argToString(time), "'2006-01-02 15:04:05-07:00'")
|
||||
assert.Equal(t, argToString(map[string]bool{}), "[Unsupported type]")
|
||||
|
||||
func() {
|
||||
defer func() {
|
||||
assert.Equal(t, recover().(string), "jet: map[string]bool type can not be used as SQL query parameter")
|
||||
}()
|
||||
|
||||
argToString(map[string]bool{})
|
||||
}()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@ package jet
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/go-jet/jet/internal/3rdparty/pq"
|
||||
"github.com/go-jet/jet/internal/utils"
|
||||
"github.com/google/uuid"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -176,7 +178,7 @@ func argToString(value interface{}) string {
|
|||
case time.Time:
|
||||
return stringQuote(string(pq.FormatTimestamp(bindVal)))
|
||||
default:
|
||||
return "[Unsupported type]"
|
||||
panic(fmt.Sprintf("jet: %s type can not be used as SQL query parameter", reflect.TypeOf(value).String()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue