embeddedPostgresTcpAddress function

Uri? embeddedPostgresTcpAddress(
  1. DatabasePoolManager poolManager
)

The loopback TCP URI of the embedded database behind poolManager, without its password, or null when it serves no TCP listener.

Implementation

Uri? embeddedPostgresTcpAddress(DatabasePoolManager poolManager) {
  if (poolManager is! PostgresPoolManager) return null;
  final tcp = poolManager.embeddedPostgres?.handle.tcpEndpoint;
  if (tcp == null) return null;
  return Uri(
    scheme: 'postgres',
    userInfo: tcp.username,
    host: tcp.host,
    port: tcp.port,
    path: '/${tcp.database}',
  );
}