Move statements into their own package

This commit is contained in:
Asdine El Hrychy
2021-05-29 21:22:48 +04:00
parent fc043bf179
commit 7a98a2025f
55 changed files with 233 additions and 219 deletions

View File

@@ -3,7 +3,7 @@ package parser_test
import (
"testing"
"github.com/genjidb/genji/internal/query"
"github.com/genjidb/genji/internal/query/statement"
"github.com/genjidb/genji/internal/sql/parser"
"github.com/stretchr/testify/require"
)
@@ -12,13 +12,13 @@ func TestParserDrop(t *testing.T) {
tests := []struct {
name string
s string
expected query.Statement
expected statement.Statement
errored bool
}{
{"Drop table", "DROP TABLE test", query.DropTableStmt{TableName: "test"}, false},
{"Drop table If not exists", "DROP TABLE IF EXISTS test", query.DropTableStmt{TableName: "test", IfExists: true}, false},
{"Drop index", "DROP INDEX test", query.DropIndexStmt{IndexName: "test"}, false},
{"Drop index if exists", "DROP INDEX IF EXISTS test", query.DropIndexStmt{IndexName: "test", IfExists: true}, false},
{"Drop table", "DROP TABLE test", statement.DropTableStmt{TableName: "test"}, false},
{"Drop table If not exists", "DROP TABLE IF EXISTS test", statement.DropTableStmt{TableName: "test", IfExists: true}, false},
{"Drop index", "DROP INDEX test", statement.DropIndexStmt{IndexName: "test"}, false},
{"Drop index if exists", "DROP INDEX IF EXISTS test", statement.DropIndexStmt{IndexName: "test", IfExists: true}, false},
}
for _, test := range tests {