mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
[@keyv/sqlite] Add types
This commit is contained in:
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// Type definitions for @keyv/sqlite 2.0
|
||||
// Project: https://github.com/lukechilds/keyv-sqlite
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Store } from 'keyv';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export = KeyvSqlite;
|
||||
|
||||
declare class KeyvSqlite extends EventEmitter implements Store<string | undefined> {
|
||||
readonly ttlSupport: false;
|
||||
namespace?: string;
|
||||
|
||||
constructor(options?: KeyvSqlite.Options);
|
||||
|
||||
get(key: string): Promise<string | undefined>;
|
||||
set(key: string, value: string | undefined): Promise<any>;
|
||||
delete(key: string): Promise<boolean>;
|
||||
clear(): Promise<void>;
|
||||
}
|
||||
|
||||
declare namespace KeyvSqlite {
|
||||
interface Options {
|
||||
uri?: string;
|
||||
busyTimeout?: number;
|
||||
table?: string;
|
||||
keySize?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import Keyv = require('keyv');
|
||||
import KeyvSqlite = require('@keyv/sqlite');
|
||||
|
||||
new Keyv('sqlite://path/to/database.sqlite', { table: 'cache' });
|
||||
|
||||
new KeyvSqlite({ uri: 'sqlite://path/to/database.sqlite' });
|
||||
new KeyvSqlite({ busyTimeout: 10000 });
|
||||
new KeyvSqlite({ table: 'cache' });
|
||||
new KeyvSqlite({ keySize: 100 });
|
||||
|
||||
const sqlite = new KeyvSqlite({ uri: 'sqlite://path/to/database.sqlite' });
|
||||
new Keyv({ store: sqlite });
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@keyv/sqlite": [
|
||||
"keyv__sqlite"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"keyv__sqlite-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user