1 | // Generated by CoffeeScript 1.4.0
|
2 | /*
|
3 | There are a few subsystems that make up gesundheit, but the majority of use
|
4 | cases will be covered by using the following properties of the main module:
|
5 |
|
6 | **gesundheit.{Select, SELECT, select}**
|
7 | Function for creating new :class:`queries/select::SelectQuery` instances.
|
8 |
|
9 | **gesundheit.{Update, UPDATE, update}**
|
10 | Function for creating new :class:`queries/update::UpdateQuery` instances.
|
11 |
|
12 | **gesundheit.{Delete, DELETE, delete}**
|
13 | Function for creating new :class:`queries/delete::DeleteQuery` instances.
|
14 |
|
15 | **gesundheit.{Insert, INSERT, insert}**
|
16 | Function for creating new :class:`queries/insert::InsertQuery` instances.
|
17 |
|
18 | **gesundheit.engine**
|
19 | Function for creating new :mod:`engines`.
|
20 |
|
21 | **gesundheit.defaultEngine**
|
22 | The engine that will be used for queries that aren't explicitly bound. This
|
23 | is set to a no-op engine that you will want to replace with either an object
|
24 | returned by the ``gesundheit.engine`` function or by implementing the engine
|
25 | interface yourself.
|
26 |
|
27 | **Join types**
|
28 | Constant nodes for use with :meth:`queries/sud::SUDQuery.join`.
|
29 | 'LEFT', 'RIGHT', 'INNER', 'LEFT_OUTER', 'RIGHT_OUTER', 'FULL_OUTER'
|
30 | 'NATURAL', 'CROSS'
|
31 |
|
32 | **AST helper functions**
|
33 | These come from the `nodes <Nodes>`_ module and are often useful when
|
34 | constructing queries that the query manager classes don't cover as well:
|
35 |
|
36 | :func:`nodes::toParam`
|
37 | Convert any object to a parameter placeholder.
|
38 | :func:`nodes::toRelation`
|
39 | Convert various inputs to :class:`nodes::Relation` nodes.
|
40 | :func:`nodes::binaryOp`
|
41 | Create a binary comparison node manually. (e.g. for postgres' custom
|
42 | operators).
|
43 | :func:`nodes::sqlFunction`
|
44 | Create SQL function calls (e.g. ``MAX(last_update)``)
|
45 | :func:`nodes::text`
|
46 | Include raw SQL in a query, with parameter placeholders.
|
47 |
|
48 | If you are implementing support for a different database engine or constructing
|
49 | particularly unusual SQL statements, you might also want to make use of these:
|
50 |
|
51 | **gesundheit.nodes**
|
52 | The `nodes <Nodes>` module.
|
53 |
|
54 | **gesundheit.dialects**
|
55 | The `dialects <Dialects>` module.
|
56 | */
|
57 |
|
58 | var helper, name, node, _ref, _ref1, _ref2,
|
59 | __slice = [].slice;
|
60 |
|
61 | exports.dialects = require('./dialects');
|
62 |
|
63 | exports.engine = require('./engine');
|
64 |
|
65 | exports.defaultEngine = exports.engine('fake://localhost/');
|
66 |
|
67 | exports.nodes = require('./nodes');
|
68 |
|
69 | _ref = exports.nodes.CONST_NODES;
|
70 | for (name in _ref) {
|
71 | node = _ref[name];
|
72 | exports[name] = exports.nodes.CONST_NODES[name];
|
73 | }
|
74 |
|
75 | _ref1 = exports.nodes.JOIN_TYPES;
|
76 | for (name in _ref1) {
|
77 | node = _ref1[name];
|
78 | exports[name] = exports.nodes.JOIN_TYPES[name];
|
79 | }
|
80 |
|
81 | _ref2 = exports.nodes;
|
82 | for (name in _ref2) {
|
83 | helper = _ref2[name];
|
84 | if (name[0] === name[0].toLowerCase()) {
|
85 | exports[name] = helper;
|
86 | }
|
87 | }
|
88 |
|
89 | require('./queries').mixinFactoryMethods(exports, function() {
|
90 | return exports.defaultEngine;
|
91 | });
|
92 |
|
93 | exports.begin = function() {
|
94 | var args, _ref3;
|
95 | args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
96 | return (_ref3 = exports.defaultEngine).begin.apply(_ref3, args);
|
97 | };
|
98 |
|
99 | exports.query = function() {
|
100 | var args, _ref3;
|
101 | args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
102 | return (_ref3 = exports.defaultEngine).query.apply(_ref3, args);
|
103 | };
|