Documentation ¶
Overview ¶
Package datasource provides a structure within which to store connections to multiple data sources and services.
Index ¶
- type Connections
- func (mc *Connections) AddMongoConnection(key, dsn, db string) error
- func (mc *Connections) AddPostgresConnection(key, dsn string) error
- func (mc *Connections) AddPulsarConnection(key, dsn string, timeoutSeconds time.Duration) error
- func (mc *Connections) AddSolrConnection(key, dsn, core string, timeoutSeconds time.Duration) error
- func (mc *Connections) MongoConnByKey(key string) (*mongoConnection, error)
- func (mc *Connections) OnlyMongoConnection() (*mongoConnection, error)
- func (mc *Connections) OnlyPostgresConnection() (*postgresConnection, error)
- func (mc *Connections) OnlyPulsarConnection() (*pulsarConnection, error)
- func (mc *Connections) OnlySolrConnection() (*solrConnection, error)
- func (mc *Connections) PostgresConnByKey(key string) (*postgresConnection, error)
- func (mc *Connections) PulsarConnByKey(key string) (*pulsarConnection, error)
- func (mc *Connections) SolrConnByKey(key string) (*solrConnection, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connections ¶
type Connections struct { Mongo map[string]*mongoConnection Postgres map[string]*postgresConnection Pulsar map[string]*pulsarConnection Solr map[string]*solrConnection }
Connections represents connections to various platform services, most likely databases.
func New ¶
func New() *Connections
New returns a pointer to a Connections value no connections attached.
func (*Connections) AddMongoConnection ¶
func (mc *Connections) AddMongoConnection(key, dsn, db string) error
AddMongoConnection adds a connection to a mongo database identified by the specified key.
func (*Connections) AddPostgresConnection ¶
func (mc *Connections) AddPostgresConnection(key, dsn string) error
AddPostgresConnection adds a connection to a potsgres database identified by the specified key.
func (*Connections) AddPulsarConnection ¶
func (mc *Connections) AddPulsarConnection(key, dsn string, timeoutSeconds time.Duration) error
AddPulsarConnection adds a connection to a Pulsar server identified by the specified key.
func (*Connections) AddSolrConnection ¶
func (mc *Connections) AddSolrConnection(key, dsn, core string, timeoutSeconds time.Duration) error
AddSolrConnection adds a connection to a Solr server identified by the specified key.
func (*Connections) MongoConnByKey ¶
func (mc *Connections) MongoConnByKey(key string) (*mongoConnection, error)
MongoConnByKey returns the mongodb connection value at the specified key.
func (*Connections) OnlyMongoConnection ¶
func (mc *Connections) OnlyMongoConnection() (*mongoConnection, error)
OnlyMongoConnection is a convenience function that returns the Mongo connection if there is only one.
func (*Connections) OnlyPostgresConnection ¶
func (mc *Connections) OnlyPostgresConnection() (*postgresConnection, error)
OnlyPostgresConnection is a convenience function that returns the Postgres connection if there is only one.
func (*Connections) OnlyPulsarConnection ¶
func (mc *Connections) OnlyPulsarConnection() (*pulsarConnection, error)
OnlyPulsarConnection is a convenience function that returns the Pulsar connection if there is only one.
func (*Connections) OnlySolrConnection ¶
func (mc *Connections) OnlySolrConnection() (*solrConnection, error)
OnlySolrConnection is a convenience function that returns the Solr connection if there is only one.
func (*Connections) PostgresConnByKey ¶
func (mc *Connections) PostgresConnByKey(key string) (*postgresConnection, error)
PostgresConnByKey returns the postgres connection value at the specified key.
func (*Connections) PulsarConnByKey ¶
func (mc *Connections) PulsarConnByKey(key string) (*pulsarConnection, error)
PulsarConnByKey returns the Pulsar connection value at the specified key.
func (*Connections) SolrConnByKey ¶
func (mc *Connections) SolrConnByKey(key string) (*solrConnection, error)
SolrConnByKey returns the Solr connection value at the specified key.