import { KyselySharedLockAdapter } from "@daiso-tech/core/shared-lock/kysely-shared-lock-adapter";
import Sqlite from "better-sqlite3";
const sharedLockAdapter = new KyselySharedLockAdapter({
kysely: new Kysely({
dialect: new SqliteDialect({
database: new Sqlite("local.db"),
}),
}),
});
// You need initialize the adapter once before using it.
await sharedLockAdapter.init();
To utilize the
KyselySharedLockAdapter, you must install the"kysely"package and configure aKyselyclass instance.Note in order to use
KyselySharedLockAdaptercorrectly, ensure you use a single, consistent database across all server instances. The adapter have been tested withsqlite,postgresandmysqldatabases.IMPORT_PATH:
"@daiso-tech/core/shared-lock/kysely-shared-lock-adapter"