mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-19 01:03:57 +00:00
Merge branch 'feat/migration-to-leveldb' into feature/custom-themes
This commit is contained in:
3
src/main/level/index.ts
Normal file
3
src/main/level/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { db } from "./level";
|
||||
|
||||
export * from "./sublevels";
|
||||
6
src/main/level/level.ts
Normal file
6
src/main/level/level.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { levelDatabasePath } from "@main/constants";
|
||||
import { ClassicLevel } from "classic-level";
|
||||
|
||||
export const db = new ClassicLevel(levelDatabasePath, {
|
||||
valueEncoding: "json",
|
||||
});
|
||||
11
src/main/level/sublevels/downloads.ts
Normal file
11
src/main/level/sublevels/downloads.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { Download } from "@types";
|
||||
|
||||
import { db } from "../level";
|
||||
import { levelKeys } from "./keys";
|
||||
|
||||
export const downloadsSublevel = db.sublevel<string, Download>(
|
||||
levelKeys.downloads,
|
||||
{
|
||||
valueEncoding: "json",
|
||||
}
|
||||
);
|
||||
11
src/main/level/sublevels/game-achievements.ts
Normal file
11
src/main/level/sublevels/game-achievements.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { GameAchievement } from "@types";
|
||||
|
||||
import { db } from "../level";
|
||||
import { levelKeys } from "./keys";
|
||||
|
||||
export const gameAchievementsSublevel = db.sublevel<string, GameAchievement>(
|
||||
levelKeys.gameAchievements,
|
||||
{
|
||||
valueEncoding: "json",
|
||||
}
|
||||
);
|
||||
11
src/main/level/sublevels/game-shop-cache.ts
Normal file
11
src/main/level/sublevels/game-shop-cache.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { ShopDetails } from "@types";
|
||||
|
||||
import { db } from "../level";
|
||||
import { levelKeys } from "./keys";
|
||||
|
||||
export const gamesShopCacheSublevel = db.sublevel<string, ShopDetails>(
|
||||
levelKeys.gameShopCache,
|
||||
{
|
||||
valueEncoding: "json",
|
||||
}
|
||||
);
|
||||
8
src/main/level/sublevels/games.ts
Normal file
8
src/main/level/sublevels/games.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { Game } from "@types";
|
||||
|
||||
import { db } from "../level";
|
||||
import { levelKeys } from "./keys";
|
||||
|
||||
export const gamesSublevel = db.sublevel<string, Game>(levelKeys.games, {
|
||||
valueEncoding: "json",
|
||||
});
|
||||
6
src/main/level/sublevels/index.ts
Normal file
6
src/main/level/sublevels/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./downloads";
|
||||
export * from "./games";
|
||||
export * from "./game-shop-cache";
|
||||
export * from "./game-achievements";
|
||||
|
||||
export * from "./keys";
|
||||
16
src/main/level/sublevels/keys.ts
Normal file
16
src/main/level/sublevels/keys.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { GameShop } from "@types";
|
||||
|
||||
export const levelKeys = {
|
||||
games: "games",
|
||||
game: (shop: GameShop, objectId: string) => `${shop}:${objectId}`,
|
||||
user: "user",
|
||||
auth: "auth",
|
||||
gameShopCache: "gameShopCache",
|
||||
gameShopCacheItem: (shop: GameShop, objectId: string, language: string) =>
|
||||
`${shop}:${objectId}:${language}`,
|
||||
gameAchievements: "gameAchievements",
|
||||
downloads: "downloads",
|
||||
userPreferences: "userPreferences",
|
||||
language: "language",
|
||||
sqliteMigrationDone: "sqliteMigrationDone",
|
||||
};
|
||||
Reference in New Issue
Block a user