Description
The ConnectionUtils class provides a set of utility functions used to process connection parameters.
Methods
ComposeUri
Composes URI from config parameters.
The result URI will be in the following form:
protocol://username@password@host1:port1,host2:port2,…?param1=abc¶m2=xyz&…
ComposeUri(options *config.ConfigParams, defaultProtocol string, defaultPort int) string
- options: *config.ConfigParams - configuration parameters
- defaultProtocol: string - default protocol
- defaultPort: int - default port
- returns: string - composed URI
Concat
Concatinates two options by combining duplicated properties into comma-separated list
Concat(options1 *config.ConfigParams, options2 *config.ConfigParams, keys …string) *config.ConfigParams
- options1: *config.ConfigParams - first options to merge
- options2: *config.ConfigParams - second options to merge
- keys: …string - when defined, it limits only to specific keys
- returns: *config.ConfigParams - new connection parameters to be added
Exclude
Excludes specified keys from the config parameters.
Exclude(options *config.ConfigParams, keys …string) *config.ConfigParams
- options: *config.ConfigParams - configuration parameters to be processed.
- keys: …string - list of keys to be excluded.
- returns: *config.ConfigParams - processed config parameters.
Include
Includes specified keys from the config parameters.
Include(options *config.ConfigParams, keys …string) *config.ConfigParams
- options: *config.ConfigParams - configuration parameters to be processed.
- keys: …string - list of keys to be included.
- returns: *config.ConfigParams - processed config parameters.
ParseUri
Parses URI into config parameters.
The URI shall be in the following form:
protocol://username@password@host1:port1,host2:port2,...?param1=abc¶m2=xyz&...
ParseUri(uri string, defaultProtocol string, defaultPort int) *config.ConfigParams
- uri: string - URI to be parsed
- defaultProtocol: string - default protocol
- defaultPort: string - default port
- returns: *config.ConfigParams - configuration parameters with URI elements