Skip to content

Commit 026c8c4

Browse files
committed
update
1 parent 5443bc2 commit 026c8c4

File tree

3 files changed

+4
-60
lines changed

3 files changed

+4
-60
lines changed

index.js

+4-29
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,8 @@ const Query = require('./lib/query.js');
33
const Schema = require('./lib/schema.js');
44
const Parser = require('./lib/parser.js');
55

6-
const QUERY = Symbol('think-model-query');
7-
const SCHEMA = Symbol('think-model-schema');
8-
const PARSER = Symbol('think-model-parser');
6+
module.exports = class SQLiteAdapter extends Abstract {};
97

10-
module.exports = class SQLiteAdapter extends Abstract {
11-
/**
12-
* get parser instance
13-
*/
14-
get parser() {
15-
if (this[PARSER]) return this[PARSER];
16-
this[PARSER] = new Parser(this.model.config);
17-
return this[PARSER];
18-
}
19-
/**
20-
* get query instance
21-
*/
22-
get query() {
23-
if (this[QUERY]) return this[QUERY];
24-
this[QUERY] = new Query(this.model.config);
25-
return this[QUERY];
26-
}
27-
/**
28-
* get schema instance
29-
*/
30-
get schema() {
31-
if (this[SCHEMA]) return this[SCHEMA];
32-
this[SCHEMA] = new Schema(this.model.config, this.model.schema, this.model.tableName);
33-
return this[SCHEMA];
34-
}
35-
};
8+
module.exports.Query = Query;
9+
module.exports.Parser = Parser;
10+
module.exports.Schema = Schema;

lib/query.js

-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
const {Query} = require('think-model-abstract');
2-
const Parser = require('./parser.js');
32
const SQLiteSocket = require('./socket.js');
43

5-
const PARSER = Symbol('think-model-sqlite-parser');
6-
74
/**
85
* mysql query
96
*/
107
module.exports = class SQLiteQuery extends Query {
11-
/**
12-
* get parser instance
13-
*/
14-
get parser() {
15-
if (this[PARSER]) return this[PARSER];
16-
this[PARSER] = new Parser(this.config);
17-
return this[PARSER];
18-
}
198
/**
209
* get socket
2110
* @param {String|Object} sql

lib/schema.js

-20
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
11
const helper = require('think-helper');
22
const {Schema} = require('think-model-abstract');
33
const Debounce = require('think-debounce');
4-
const Query = require('./query.js');
5-
const Parser = require('./parser.js');
64

7-
const QUERY = Symbol('think-model-sqlite-query');
8-
const PARSER = Symbol('think-model-sqlite-parser');
95
const debounce = new Debounce();
106
const SCHEMAS = {};
117

128
/**
139
* mysql Schema
1410
*/
1511
module.exports = class MysqlSchema extends Schema {
16-
/**
17-
* get query instance
18-
*/
19-
get query() {
20-
if (this[QUERY]) return this[QUERY];
21-
this[QUERY] = new Query(this.config);
22-
return this[QUERY];
23-
}
24-
/**
25-
* get parset instance
26-
*/
27-
get parser() {
28-
if (this[PARSER]) return this[PARSER];
29-
this[PARSER] = new Parser(this.config);
30-
return this[PARSER];
31-
}
3212
_getItemSchemaValidate(fieldData) {
3313
const validate = {};
3414
switch (fieldData.tinyType) {

0 commit comments

Comments
 (0)