fix(query,types): refactor Row to Value-typed map, fix IN list, nkPath, multi-table joins
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
- Refactored Row from Table[string, string] to Table[string, Value] - Added Value operators: ==, !=, $, in for string interop - Fixed valueToString for vkNull to return '\\N' instead of '' - Fixed evalExpr irekField to return vkNull when field not found - Added IN (val1, val2, ...) parser support - Fixed nkPath column names in multi-table joins - Fixed LATERAL JOIN null padding when no matching rows - Added CREATE/DROP/USE/SHOW DATABASE parser support - Adapted all tests for new Value type
This commit is contained in:
@@ -43,6 +43,10 @@ type
|
||||
nkSetVar
|
||||
nkCreateGraph
|
||||
nkDropGraph
|
||||
nkCreateDatabase
|
||||
nkDropDatabase
|
||||
nkUseDatabase
|
||||
nkShowDatabases
|
||||
|
||||
# Clauses
|
||||
nkFrom
|
||||
@@ -336,6 +340,16 @@ type
|
||||
of nkDropGraph:
|
||||
dgName*: string
|
||||
dgIfExists*: bool
|
||||
of nkCreateDatabase:
|
||||
cdDbName*: string
|
||||
cdIfNotExists*: bool
|
||||
of nkDropDatabase:
|
||||
ddDbName*: string
|
||||
ddIfExists*: bool
|
||||
of nkUseDatabase:
|
||||
udDbName*: string
|
||||
of nkShowDatabases:
|
||||
discard
|
||||
of nkApplyMigration:
|
||||
amName*: string
|
||||
of nkMigrationStatus:
|
||||
|
||||
+351
-284
File diff suppressed because it is too large
Load Diff
@@ -160,6 +160,10 @@ type
|
||||
tkBfs
|
||||
tkDfs
|
||||
tkPath
|
||||
tkDatabase
|
||||
tkDatabases
|
||||
tkUse
|
||||
tkShow
|
||||
|
||||
tkAutoIncrement
|
||||
tkSequence
|
||||
@@ -382,6 +386,10 @@ const keywords*: Table[string, TokenKind] = {
|
||||
"bfs": tkBfs,
|
||||
"dfs": tkDfs,
|
||||
"path": tkPath,
|
||||
"database": tkDatabase,
|
||||
"databases": tkDatabases,
|
||||
"use": tkUse,
|
||||
"show": tkShow,
|
||||
"over": tkOver,
|
||||
"partition": tkPartition,
|
||||
"row": tkRow,
|
||||
|
||||
@@ -1646,6 +1646,42 @@ proc parseDropGraph(p: var Parser): Node =
|
||||
result = Node(kind: nkDropGraph, dgName: name, dgIfExists: ifExists,
|
||||
line: tok.line, col: tok.col)
|
||||
|
||||
proc parseCreateDatabase(p: var Parser): Node =
|
||||
let tok = p.expect(tkCreate)
|
||||
discard p.expect(tkDatabase)
|
||||
var ifNotExists = false
|
||||
if p.peek().kind == tkIf:
|
||||
discard p.advance()
|
||||
discard p.expect(tkNot)
|
||||
discard p.expect(tkExists)
|
||||
ifNotExists = true
|
||||
let name = p.expect(tkIdent).value
|
||||
result = Node(kind: nkCreateDatabase, cdDbName: name, cdIfNotExists: ifNotExists,
|
||||
line: tok.line, col: tok.col)
|
||||
|
||||
proc parseDropDatabase(p: var Parser): Node =
|
||||
let tok = p.expect(tkDrop)
|
||||
discard p.expect(tkDatabase)
|
||||
var ifExists = false
|
||||
if p.peek().kind == tkIf:
|
||||
discard p.advance()
|
||||
discard p.expect(tkExists)
|
||||
ifExists = true
|
||||
let name = p.expect(tkIdent).value
|
||||
result = Node(kind: nkDropDatabase, ddDbName: name, ddIfExists: ifExists,
|
||||
line: tok.line, col: tok.col)
|
||||
|
||||
proc parseUseDatabase(p: var Parser): Node =
|
||||
let tok = p.expect(tkUse)
|
||||
let name = p.expect(tkIdent).value
|
||||
result = Node(kind: nkUseDatabase, udDbName: name,
|
||||
line: tok.line, col: tok.col)
|
||||
|
||||
proc parseShowDatabases(p: var Parser): Node =
|
||||
let tok = p.expect(tkShow)
|
||||
discard p.expect(tkDatabases)
|
||||
result = Node(kind: nkShowDatabases, line: tok.line, col: tok.col)
|
||||
|
||||
proc parseStatement*(p: var Parser): Node =
|
||||
case p.peek().kind
|
||||
of tkWith, tkSelect: p.parseSelect()
|
||||
@@ -1674,6 +1710,8 @@ proc parseStatement*(p: var Parser): Node =
|
||||
p.parseCreatePolicy()
|
||||
elif next.kind == tkGraph:
|
||||
p.parseCreateGraph()
|
||||
elif next.kind == tkDatabase:
|
||||
p.parseCreateDatabase()
|
||||
else:
|
||||
p.parseCreateType()
|
||||
else:
|
||||
@@ -1695,6 +1733,8 @@ proc parseStatement*(p: var Parser): Node =
|
||||
p.parseDropPolicy()
|
||||
elif next.kind == tkGraph:
|
||||
p.parseDropGraph()
|
||||
elif next.kind == tkDatabase:
|
||||
p.parseDropDatabase()
|
||||
else:
|
||||
let tok = p.advance()
|
||||
Node(kind: nkNullLit, line: tok.line, col: tok.col)
|
||||
@@ -1713,6 +1753,14 @@ proc parseStatement*(p: var Parser): Node =
|
||||
p.parseRevoke()
|
||||
of tkSet:
|
||||
p.parseSetVar()
|
||||
of tkUse:
|
||||
p.parseUseDatabase()
|
||||
of tkShow:
|
||||
if p.pos + 1 < p.tokens.len and p.tokens[p.pos + 1].kind == tkDatabases:
|
||||
p.parseShowDatabases()
|
||||
else:
|
||||
let tok = p.advance()
|
||||
Node(kind: nkNullLit, line: tok.line, col: tok.col)
|
||||
of tkApply:
|
||||
if p.pos + 1 < p.tokens.len and p.tokens[p.pos + 1].kind == tkMigration:
|
||||
p.parseApplyMigration()
|
||||
|
||||
Reference in New Issue
Block a user