@developers-joyride/shortify
Version:
High performance URL shortener library with multi-database support (MongoDB, SQLite, PostgreSQL, MySQL)
32 lines (31 loc) • 745 B
TypeScript
import { EventEmitter } from "events";
interface DbConnectionOptions {
mongoUri: string;
maxRetries?: number;
retryDelay?: number;
}
declare class DatabaseConnection extends EventEmitter {
private mongoUri;
private maxRetries;
private retryDelay;
private retryCount;
private isConnected;
constructor(options: DbConnectionOptions);
/**
* Connect to MongoDB with retry capability
*/
connect(): Promise<boolean>;
/**
* Retry connection with exponential backoff
*/
private retryConnection;
/**
* Disconnect from MongoDB
*/
disconnect(): Promise<void>;
/**
* Get connection status
*/
getStatus(): string;
}
export default DatabaseConnection;