A lot of changes

This commit is contained in:
Fabian Stamm
2019-11-06 23:27:29 +01:00
parent d8c55d4389
commit 3fa209c0cf
5 changed files with 524 additions and 221 deletions

View File

@ -2,7 +2,7 @@ import { Rules } from "./rules";
import Settings from "../settings";
import getLevelDB, { LevelDB, deleteLevelDB } from "../storage";
import DocumentLock from "./lock";
import Query from "./query";
import { DocumentQuery, CollectionQuery, Query } from "./query";
export class DatabaseManager {
static databases = new Map<string, Database>();
@ -104,8 +104,13 @@ export class Database {
}
getQuery(path: string[], sender: string) {
return new Query(this, path, sender);
getQuery(path: string[], sender: string, type: "document" | "collection" | "any") {
if (type === "document")
return new DocumentQuery(this, path, sender);
else if (type === "collection")
return new CollectionQuery(this, path, sender);
else
return new Query(this, path, sender);
}
async stop() {