/
base.js
82 lines (69 loc) · 2.15 KB
/
base.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
/**
* XadillaX created at 2016-08-08 17:04:49 With ♥
*
* Copyright (c) 2016 Souche.com, all rights
* reserved.
*/
"use strict";
const cu = require("config.util");
const debug = require("debug")("toshihiko:adapter:base");
const EventEmitter = require("eventemitter2").EventEmitter2;
class Adapter extends EventEmitter {
constructor(parent, options) {
super();
Object.defineProperties(this, {
parent: {
value: parent,
writable: false,
configurable: false,
enumerable: false
},
options: {
value: cu.extendDeep({}, options || {}),
writable: true,
configurable: false,
enumerable: true
}
});
debug("created.", this);
}
execute(param, callback) {
debug("this adapter instance's execute is not implemented.");
process.nextTick(callback);
}
find(query, callback, options) {
options = null;
process.nextTick(function() {
callback(new Error("this adapter's find function is not implemented yet."));
});
}
count(query, callback) {
process.nextTick(function() {
callback(new Error("this adapter's count function is not implemented yet."));
});
}
updateByQuery(query, callback) {
process.nextTick(function() {
callback(new Error("this adapter's updateByQuery function is not implemented yet."));
});
}
deleteByQuery(query, callback) {
process.nextTick(function() {
callback(new Error("this adapter's deleteByQuery function is not implemented yet."));
});
}
insert(model, data, callback) {
process.nextTick(function() {
callback(new Error("this adapter's insert function is not implemented yet."));
});
}
update(model, pk, data, callback) {
process.nextTick(function() {
callback(new Error("this adapter's insert function is not implemented yet."));
});
}
getDBName() {
return "";
}
}
module.exports = Adapter;