PostgreSQLPersistentStore.fromConnectionInfo(String username, String password, String host, int port, String databaseName, { String timeZone: "UTC", bool useSSL: false })

Creates an instance of this type from connection info.

Source

PostgreSQLPersistentStore.fromConnectionInfo(
    this.username, this.password, this.host, this.port, this.databaseName,
    {this.timeZone: "UTC", bool useSSL: false}) {
  ResourceRegistry.add<PostgreSQLPersistentStore>(this, (store) => store.close());

  this.connectFunction = () async {
    logger
        .info("PostgreSQL connecting, $username@$host:$port/$databaseName.");
    var connection = new PostgreSQLConnection(host, port, databaseName,
        username: username,
        password: password,
        timeZone: timeZone,
        useSSL: useSSL);
    try {
      await connection.open();
    } catch (e) {
      await connection?.close();
      rethrow;
    }
    return connection;
  };
}