(databaseURI, collectionPrefix, databaseOptions)
| 213 | } |
| 214 | |
| 215 | export function getDatabaseAdapter(databaseURI, collectionPrefix, databaseOptions) { |
| 216 | let protocol; |
| 217 | try { |
| 218 | const parsedURI = new URL(databaseURI); |
| 219 | protocol = parsedURI.protocol ? parsedURI.protocol.toLowerCase() : null; |
| 220 | } catch { |
| 221 | /* */ |
| 222 | } |
| 223 | switch (protocol) { |
| 224 | case 'postgres:': |
| 225 | case 'postgresql:': |
| 226 | return new PostgresStorageAdapter({ |
| 227 | uri: databaseURI, |
| 228 | collectionPrefix, |
| 229 | databaseOptions, |
| 230 | }); |
| 231 | default: |
| 232 | return new MongoStorageAdapter({ |
| 233 | uri: databaseURI, |
| 234 | collectionPrefix, |
| 235 | mongoOptions: databaseOptions, |
| 236 | }); |
| 237 | } |
| 238 | } |
no outgoing calls
no test coverage detected