Remove RECORD keyword
This commit is contained in:
parent
58b9cf3478
commit
6da2e371ca
4 changed files with 9 additions and 11 deletions
|
@ -115,7 +115,7 @@ func (p *parser) parseMulti() (*Query, error) {
|
||||||
// parseSingle parses a single SQL SELECT statement.
|
// parseSingle parses a single SQL SELECT statement.
|
||||||
func (p *parser) parseSingle() (Statement, error) {
|
func (p *parser) parseSingle() (Statement, error) {
|
||||||
|
|
||||||
tok, _, err := p.shouldBe(USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, RECORD, DEFINE, REMOVE)
|
tok, _, err := p.shouldBe(USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, DEFINE, REMOVE)
|
||||||
|
|
||||||
switch tok {
|
switch tok {
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (p *parser) parseDefineRulesStatement() (stmt *DefineRulesStatement, err er
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|
||||||
tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD)
|
tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE)
|
||||||
if !exi {
|
if !exi {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func (p *parser) parseDefineRulesStatement() (stmt *DefineRulesStatement, err er
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(stmt.When) == 0 {
|
if len(stmt.When) == 0 {
|
||||||
return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE", "RECORD"}}
|
return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE"}}
|
||||||
}
|
}
|
||||||
|
|
||||||
if tok, _, err := p.shouldBe(ACCEPT, REJECT, CUSTOM); err != nil {
|
if tok, _, err := p.shouldBe(ACCEPT, REJECT, CUSTOM); err != nil {
|
||||||
|
@ -97,7 +97,7 @@ func (p *parser) parseRemoveRulesStatement() (stmt *RemoveRulesStatement, err er
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|
||||||
tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD)
|
tok, _, exi := p.mightBe(SELECT, CREATE, UPDATE, DELETE, RELATE)
|
||||||
if !exi {
|
if !exi {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ func (p *parser) parseRemoveRulesStatement() (stmt *RemoveRulesStatement, err er
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(stmt.When) == 0 {
|
if len(stmt.When) == 0 {
|
||||||
return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE", "RECORD"}}
|
return nil, &ParseError{Found: "", Expected: []string{"SELECT", "CREATE", "UPDATE", "DELETE", "RELATE"}}
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, _, err = p.shouldBe(EOF, SEMICOLON); err != nil {
|
if _, _, err = p.shouldBe(EOF, SEMICOLON); err != nil {
|
||||||
|
|
|
@ -140,11 +140,11 @@ func Test_Parse_Queries_Malformed(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sql: `!`,
|
sql: `!`,
|
||||||
err: "Found `!` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, RECORD, DEFINE, REMOVE`",
|
err: "Found `!` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, DEFINE, REMOVE`",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sql: `SELECT * FROM person;;;`,
|
sql: `SELECT * FROM person;;;`,
|
||||||
err: "Found `;` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, RECORD, DEFINE, REMOVE`",
|
err: "Found `;` but expected `USE, INFO, LET, BEGIN, CANCEL, COMMIT, ROLLBACK, SELECT, CREATE, UPDATE, INSERT, UPSERT, MODIFY, DELETE, RELATE, DEFINE, REMOVE`",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1338,7 +1338,7 @@ func Test_Parse_Queries_Define(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sql: `DEFINE RULES ON person FOR`,
|
sql: `DEFINE RULES ON person FOR`,
|
||||||
err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD`",
|
err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE`",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sql: `DEFINE RULES ON person FOR select, create, update, delete`,
|
sql: `DEFINE RULES ON person FOR select, create, update, delete`,
|
||||||
|
@ -1878,7 +1878,7 @@ func Test_Parse_Queries_Remove(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sql: `REMOVE RULES ON person FOR`,
|
sql: `REMOVE RULES ON person FOR`,
|
||||||
err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE, RECORD`",
|
err: "Found `` but expected `SELECT, CREATE, UPDATE, DELETE, RELATE`",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sql: `REMOVE RULES ON person FOR select, create, update, delete`,
|
sql: `REMOVE RULES ON person FOR select, create, update, delete`,
|
||||||
|
|
|
@ -160,7 +160,6 @@ const (
|
||||||
OR
|
OR
|
||||||
ORDER
|
ORDER
|
||||||
READONLY
|
READONLY
|
||||||
RECORD
|
|
||||||
REJECT
|
REJECT
|
||||||
RELATE
|
RELATE
|
||||||
REMOVE
|
REMOVE
|
||||||
|
@ -319,7 +318,6 @@ var tokens = [...]string{
|
||||||
OR: "OR",
|
OR: "OR",
|
||||||
ORDER: "ORDER",
|
ORDER: "ORDER",
|
||||||
READONLY: "READONLY",
|
READONLY: "READONLY",
|
||||||
RECORD: "RECORD",
|
|
||||||
REJECT: "REJECT",
|
REJECT: "REJECT",
|
||||||
RELATE: "RELATE",
|
RELATE: "RELATE",
|
||||||
REMOVE: "REMOVE",
|
REMOVE: "REMOVE",
|
||||||
|
|
Loading…
Reference in a new issue