Guest User

Untitled

a guest
Dec 6th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. let config = {
  2. connA: {
  3. host: 'abc123',
  4. user: 'abc123',
  5. password: 'abc123',
  6. database: 'abc123',
  7. },
  8. connB: {
  9. host: 'abc123',
  10. user: 'abc123',
  11. password: 'abc123',
  12. database: 'abc123',
  13. }
  14. }
  15.  
  16. export interface DatabaseConnection {
  17. host: string
  18. user: string
  19. password: string
  20. database: string
  21. }
  22.  
  23. export type DatabaseConnections<T> = {
  24. [P in keyof T]: T[P]
  25. }
  26.  
  27. public static connect(config: DatabaseConnections<DatabaseConnection>) {
  28. for (let db in config) {
  29. // Do something with the config
  30. }
Add Comment
Please, Sign In to add comment