mirror of https://github.com/lqs/sqlingo
22 lines
422 B
Go
22 lines
422 B
Go
package sqlingo
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func buildWhere(where BooleanExpression) string {
|
|
var sb strings.Builder
|
|
scope := scope{}
|
|
if err := appendWhere(&sb, scope, where); err != nil {
|
|
panic(err)
|
|
}
|
|
return sb.String()
|
|
}
|
|
|
|
func TestAppendWhere(t *testing.T) {
|
|
assertEqual(t, buildWhere(True()), "")
|
|
assertEqual(t, buildWhere(False()), " WHERE FALSE")
|
|
assertEqual(t, buildWhere(Raw("##")), " WHERE ##")
|
|
}
|