mirror of https://github.com/VinGarcia/ksql.git
Improve a comment and a test
parent
99ed52b591
commit
d2c88ed71b
|
@ -67,7 +67,9 @@ func (builder *Builder) Build(query Query) (sqlQuery string, params []interface{
|
||||||
}
|
}
|
||||||
|
|
||||||
type Query struct {
|
type Query struct {
|
||||||
// Select expects a struct using the `ksql` tags
|
// Select expects either a struct using the `ksql` tags
|
||||||
|
// or a string listing the column names using SQL syntax,
|
||||||
|
// e.g.: `id, username, address`
|
||||||
Select interface{}
|
Select interface{}
|
||||||
|
|
||||||
// From expects the FROM clause from an SQL query, e.g. `users JOIN posts USING(post_id)`
|
// From expects the FROM clause from an SQL query, e.g. `users JOIN posts USING(post_id)`
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/tj/assert"
|
"github.com/tj/assert"
|
||||||
"github.com/vingarcia/ksql/kbuilder"
|
"github.com/vingarcia/ksql/kbuilder"
|
||||||
)
|
)
|
||||||
|
@ -137,8 +138,8 @@ func TestBuilder(t *testing.T) {
|
||||||
|
|
||||||
func expectError(t *testing.T, expect bool, err error) {
|
func expectError(t *testing.T, expect bool, err error) {
|
||||||
if expect {
|
if expect {
|
||||||
assert.Equal(t, true, err != nil, "expected an error, but got nothing")
|
require.Equal(t, true, err != nil, "expected an error, but got nothing")
|
||||||
} else {
|
} else {
|
||||||
assert.Equal(t, false, err != nil, fmt.Sprintf("unexpected error %s", err))
|
require.Equal(t, false, err != nil, fmt.Sprintf("unexpected error %s", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue