forked from biggora/caminte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (29 loc) · 861 Bytes
/
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
/**
* Module dependencies
*/
var schema = require('./lib/schema');
var pkg = require('./package');
var abc = require('./lib/abstract-class');
var vld = require('./lib/validatable');
var Schema = schema.Schema;
exports.schema = {models:{}};
exports.Schema = Schema;
exports.AbstractClass = abc.AbstractClass;
exports.Validatable = vld.Validatable;
exports.__defineGetter__('BaseSQL', function () {
return require('./lib/sql');
});
exports.init = function (trinte) {
if (global.trinte) {
global.trinte.orm = exports;
} else {
trinte.orm = {Schema: exports.Schema, AbstractClass: exports.AbstractClass};
}
};
exports.model = function (name){
return this.schema.models[name.toLowerCase()];
};
exports.version = pkg.version;
exports.__defineGetter__('test', function () {
return require('./tmp/tests/common_test');
});