Implements: IReferenceable, IConfigurable
Description
The MySqlConnectionResolver class allows you to create a MySQL connection and credential parameters resolver that validates the parameters and generates a connection URI.
Important points
- It is able to process multiple connections to MySQL 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) ICredentialStore stores to resolve credentials
Constructors
NewMySqlConnectionResolver
NewMySqlConnectionResolver creates new connection resolver
NewMySqlConnectionResolver() *MySqlConnectionResolver
Fields
Instance methods
Configure
Configures components by passing configuration parameters.
(c *MySqlConnectionResolver) Configure(ctx context.Context, config *ConfigParams)
- ctx: context.Context - operation context.
- config: *ConfigParams - configuration parameters to be set.
Resolve
Resolves a MySQL configuration from connection and credential parameters.
(c *MySqlConnectionResolver) Resolve(ctx context.Context, correlationId string) (uri string, err error)
- ctx: context.Context - operation context.
- correlationId: string - (optional) transaction id used to trace execution through the call chain.
- returns: (uri string, err error) - resolved connection config or return error.
SetReferences
Sets references to dependent components.
(c *MySqlConnectionResolver) SetReferences(ctx context.Context, references IReferences)
- ctx: context.Context - operation context.
- references: IReferences - references to locate the component dependencies.