PostgresConnectionResolver

Helper class that resolves PostgreSQL connection and credential parameters, validates them and generates a connection URI.

Implements: IReferenceable, IConfigurable

Description

The PostgresConnectionResolver class allows you to create a PostgresSQL connection and credential parameters resolver that validates these parameters and generates a connection URI.

Important points

  • It is able to process multiple connections to PostgreSQL cluster nodes.

Configuration parameters

connection(s):

  • discovery_key: (optional) key to retrieve the connection from IDiscovery
  • host: host name or IP address
  • port: port number (default: 27017)
  • database: database name
  • uri: resource URI or connection string with all parameters in it

credential(s):

  • store_key: (optional) key to retrieve the credentials from ICredentialStore
  • username: username
  • password: user’s password

References

  • *:discovery:*:*:1.0 - (optional) IDiscovery services
  • *:credential-store:*:*:1.0 - (optional) credential stores to resolve credentials (ICredentialStore)

Fields

connectionResolver_

The connection resolver

connectionResolver_: ConnectionResolver

credentialResolver

The credential resolver

credentialResolver_: CredentialResolver

Instance methods

configure

Configures component by passing configuration parameters.

void configure(ConfigParams config)

  • config: ConfigParams - configuration parameters to be set.

resolve

Resolves PostgreSQL config from connection and credential parameters.

Future<Map<String, dynamic» resolve(IContext? context) async

  • context: IContext - (optional) a context to trace execution through a call chain.
  • returns: Future<Map<String, dynamic» - resolved connection config or raised error.

setReferences

Sets references to dependent components.

void setReferences(IReferences references)

  • references: IReferences - references to locate the component dependencies.