mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Merge pull request #31807 from BendingBender/keyv__mysql
[@keyv/mysql] Add types
This commit is contained in:
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// Type definitions for @keyv/mysql 1.1
|
||||
// Project: https://github.com/lukechilds/keyv-mysql
|
||||
// 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 = KeyvMysql;
|
||||
|
||||
declare class KeyvMysql extends EventEmitter implements Store<string | undefined> {
|
||||
readonly ttlSupport: false;
|
||||
namespace?: string;
|
||||
|
||||
constructor(uri?: string);
|
||||
constructor(options?: KeyvMysql.Options); // tslint:disable-line:unified-signatures
|
||||
|
||||
get(key: string): Promise<string | undefined>;
|
||||
set(key: string, value: string | undefined): Promise<any>;
|
||||
delete(key: string): Promise<boolean>;
|
||||
clear(): Promise<void>;
|
||||
}
|
||||
|
||||
declare namespace KeyvMysql {
|
||||
interface Options {
|
||||
uri?: string;
|
||||
table?: string;
|
||||
keySize?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import Keyv = require('keyv');
|
||||
import KeyvMysql = require('@keyv/mysql');
|
||||
|
||||
new Keyv('mysql://user:pass@localhost:3306/dbname', { table: 'cache' });
|
||||
|
||||
new KeyvMysql('mysql://user:pass@localhost:3306/dbname');
|
||||
new KeyvMysql({ uri: 'mysql://user:pass@localhost:3306/dbname' });
|
||||
new KeyvMysql({ table: 'cache' });
|
||||
new KeyvMysql({ keySize: 100 });
|
||||
|
||||
const mysql = new KeyvMysql({ uri: 'mysql://user:pass@localhost:3306/dbname' });
|
||||
new Keyv({ store: mysql });
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@keyv/mysql": [
|
||||
"keyv__mysql"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"keyv__mysql-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user