mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Fix KeyvOptions
This commit is contained in:
Vendored
+6
-6
@@ -10,9 +10,9 @@ interface KeyvOptions {
|
||||
/** Namespace for the current instance. */
|
||||
namespace?: string;
|
||||
/** A custom serialization function. */
|
||||
serialize: (data: any) => string;
|
||||
serialize?: (data: any) => string;
|
||||
/** A custom deserialization function. */
|
||||
deserialize: (data: string) => any;
|
||||
deserialize?: (data: string) => any;
|
||||
/** The connection string URI. */
|
||||
uri?: string;
|
||||
/** The storage adapter instance to be used by Keyv. */
|
||||
@@ -24,6 +24,10 @@ interface KeyvOptions {
|
||||
}
|
||||
|
||||
declare class Keyv extends NodeJS.EventEmitter {
|
||||
/**
|
||||
* @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options.
|
||||
*/
|
||||
constructor(opts?: KeyvOptions);
|
||||
/**
|
||||
* @param uri The connection string URI.
|
||||
*
|
||||
@@ -31,10 +35,6 @@ declare class Keyv extends NodeJS.EventEmitter {
|
||||
* @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options.
|
||||
*/
|
||||
constructor(uri?: string, opts?: KeyvOptions);
|
||||
/**
|
||||
* @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options.
|
||||
*/
|
||||
constructor(opts?: KeyvOptions);
|
||||
/** Returns the value. */
|
||||
get(key: string): Promise<any>;
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import Keyv = require("keyv");
|
||||
|
||||
new Keyv({
|
||||
uri: 'redis://user:pass@localhost:6379',
|
||||
namespace: "redis"
|
||||
});
|
||||
|
||||
new Keyv('mongodb://user:pass@localhost:27017/dbname');
|
||||
new Keyv('redis://user:pass@localhost:6379');
|
||||
new Keyv('sqlite://path/to/database.sqlite');
|
||||
|
||||
Reference in New Issue
Block a user