Setup turborepo (#2610)

* chore: BREAKING move to monorepo structure

* chore: setup turborepo
This commit is contained in:
Jonathan Ho
2022-12-01 01:59:02 +08:00
committed by GitHub
parent 42719cd2c1
commit d04a040f28
821 changed files with 8763 additions and 4396 deletions

View File

@@ -0,0 +1,32 @@
import { Kwik, KwikDecode, KwikEncode } from "../../deps.ts";
import { logger } from "../utils/logger.ts";
const log = logger({ name: "DB Manager" });
log.info("Initializing Database");
const kwik = new Kwik();
// Add BigInt Support
kwik.msgpackExtensionCodec.register({
type: 0,
encode: (object: unknown): Uint8Array | null => {
if (typeof object === "bigint") {
if (object <= Number.MAX_SAFE_INTEGER && object >= Number.MIN_SAFE_INTEGER) {
return KwikEncode(parseInt(object.toString(), 10), {});
} else {
return KwikEncode(object.toString(), {});
}
} else {
return null;
}
},
decode: (data: Uint8Array) => {
return BigInt(KwikDecode(data, {}) as string);
},
});
// Initialize the Database
await kwik.init();
log.info("Database Initialized!");