This repository was archived by the owner on Jul 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathindex.d.ts
More file actions
62 lines (52 loc) · 1.63 KB
/
index.d.ts
File metadata and controls
62 lines (52 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Declaration file to have types in Typescript code that uses sqlite-parser
declare module 'sqlite-parser' {
function sqliteParser(expression: string): sqliteParser.ParsedObject
namespace sqliteParser {
// some sqlite-parser types for literal types
type dataType = 'text' | 'decimal' | 'boolean' | 'date' | 'datetime' | 'null';
interface BaseNode {
type: string,
}
interface IdentifierNode extends BaseNode {
type: 'identifier'
name: string
}
interface LiteralNode extends BaseNode {
type: 'literal'
value: string
variant: dataType
}
interface FunctionNode extends BaseNode {
type: 'function'
name: IdentifierNode
args: {expression: BaseNode[]}
}
interface ExpressionNode extends BaseNode {
type: 'expression'
format: 'binary'|'unary'
}
interface BinaryExpressionNode extends ExpressionNode {
format: 'binary'
operation: string
left: BaseNode
right: BaseNode
}
interface UnaryExpressionNode extends ExpressionNode {
format: 'unary'
operator: string
expression: BaseNode
}
type ParsedObject = {
type: "statement",
variant: "list",
statement: [
{
type: "statement",
variant: "select",
result: BaseNode[]
}
]
};
}
export = sqliteParser
}