connect

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDbConnectionResolver

type MongoDbConnectionResolver struct {
	//The connections resolver.
	ConnectionResolver ccon.ConnectionResolver
	//The credentials resolver.
	CredentialResolver auth.CredentialResolver
}

MongoDbConnectionResolver a helper struct that resolves MongoDB connection and credential parameters, validates them and generates a connection URI. It is able to process multiple connections to MongoDB cluster nodes.

Configuration parameters

- connection(s):

  • discovery_key: (optional) a 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) a key to retrieve the credentials from ICredentialStore

  • username: user name

  • password: user password

    References

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

func NewMongoDbConnectionResolver

func NewMongoDbConnectionResolver() *MongoDbConnectionResolver

NewMongoDbConnectionResolver creates new connection resolver Retruns *MongoDbConnectionResolver

func (*MongoDbConnectionResolver) Configure

func (c *MongoDbConnectionResolver) Configure(config *cconf.ConfigParams)

Configure is configures component by passing configuration parameters. Parameters:

  • config *cconf.ConfigParams configuration parameters to be set.

func (*MongoDbConnectionResolver) Resolve

func (c *MongoDbConnectionResolver) Resolve(correlationId string) (uri string, err error)

Resolve method are resolves MongoDB connection URI from connection and credential parameters. Parameters:

  • correlationId string (optional) transaction id to trace execution through call chain.

Returns uri string, err error resolved URI and error, if this occured.

func (*MongoDbConnectionResolver) SetReferences

func (c *MongoDbConnectionResolver) SetReferences(references crefer.IReferences)

SetReferences is sets references to dependent components. Parameters:

  • references crefer.IReferences references to locate the component dependencies.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL