forked from goodybag/mongo-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
102 lines (86 loc) · 3.2 KB
/
index.js
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
require('./lib/normalize');
var
build = require('./lib/query-builder')
, queryTypes = require('./lib/query-types')
, queryHelpers = require('./lib/query-helpers')
, conditionalHelpers = require('./lib/conditional-helpers')
, updateHelpers = require('./lib/update-helpers')
, actionHelpers = require('./lib/action-helpers')
, columnDefHelpers = require('./lib/column-def-helpers')
, quoteObject = require('./lib/utils').quoteObject
;
// Register query types
require('./helpers/query-types');
// Register query helpers
require('./helpers/query/action');
require('./helpers/query/alias');
require('./helpers/query/boolean-helpers');
require('./helpers/query/cascade');
require('./helpers/query/column-constraint');
require('./helpers/query/columns');
require('./helpers/query/conflict');
require('./helpers/query/definition');
require('./helpers/query/distinct');
require('./helpers/query/expression');
require('./helpers/query/for');
require('./helpers/query/from');
require('./helpers/query/function');
require('./helpers/query/group-by');
require('./helpers/query/having');
require('./helpers/query/if-exists');
require('./helpers/query/if-not-exists');
require('./helpers/query/inherits');
require('./helpers/query/joins');
require('./helpers/query/joins-dep');
require('./helpers/query/limit');
require('./helpers/query/offset');
require('./helpers/query/only');
require('./helpers/query/order');
require('./helpers/query/over');
require('./helpers/query/partition');
require('./helpers/query/queries');
require('./helpers/query/returning');
require('./helpers/query/table');
require('./helpers/query/updates');
require('./helpers/query/values');
require('./helpers/query/view');
require('./helpers/query/where');
require('./helpers/query/window');
require('./helpers/query/with');
// Register conditional helpers
require('./helpers/conditional');
// Register update helpers
require('./helpers/update');
// Register column definition helpers
require('./helpers/column-definitions');
// Register column action helpers
require('./helpers/actions');
module.exports.sql = build;
module.exports.toQuery = function() {
return build.apply(build, arguments).toQuery();
};
module.exports.queryTypes = queryTypes;
module.exports.registerQueryType = queryTypes.add;
module.exports.queryHelpers = queryHelpers;
module.exports.registerQueryHelper = function(name, options, fn){
return queryHelpers.add(name, options, fn);
};
module.exports.conditionalHelpers = conditionalHelpers;
module.exports.registerConditionalHelper = function(name, options, fn){
return conditionalHelpers.add(name, options, fn);
};
module.exports.actionHelpers = actionHelpers;
module.exports.registerActionHelper = function(name, options, fn){
return actionHelpers.add(name, options, fn);
};
module.exports.updateHelpers = updateHelpers;
module.exports.registerUpdateHelper = function(name, options, fn){
return updateHelpers.add(name, options, fn);
};
module.exports.columnDefHelpers = columnDefHelpers;
module.exports.registerColumnDefHelper = function(name, options, fn){
return columnDefHelpers.add(name, options, fn);
};
module.exports.quoteObject = quoteObject;
// Legacy support
module.exports.quoteColumn = quoteObject;