mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-11-21 03:12:10 +08:00
新增 - 表
This commit is contained in:
parent
97c21de9b7
commit
e76e66466d
39
model/Table.js
Normal file
39
model/Table.js
Normal file
@ -0,0 +1,39 @@
|
||||
//表实体
|
||||
class Table {
|
||||
constructor(tableName) {
|
||||
this.tableName = tableName;
|
||||
this._objs = {};
|
||||
}
|
||||
|
||||
setItem(k, v = null) {
|
||||
this._objs[k] = v;
|
||||
}
|
||||
|
||||
addItem(k, v = null) {
|
||||
if (this._objs[k])
|
||||
throw new Error("ADD_ITEM_ERROR: This is not null!");
|
||||
else
|
||||
this._objs[k] = v;
|
||||
}
|
||||
|
||||
delItem(k, v = null) {
|
||||
delete this._objs[k];
|
||||
}
|
||||
|
||||
toString() {
|
||||
return JSON.stringify(this._objs);
|
||||
}
|
||||
}
|
||||
|
||||
//权限表实体
|
||||
class PermissionTable extends Table {
|
||||
constructor(tableName) {
|
||||
super(tableName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
PermissionTable,
|
||||
Table
|
||||
}
|
Loading…
Reference in New Issue
Block a user