Documentation ¶
Index ¶
- func Connect(opts ConnectionOptions) mongo.Client
- func ConnectURI(uri string) mongo.Client
- func Disconnect(aliases ...string) error
- func GetConnection(alias ...string) mongo.Client
- func Off(event string, alias ...string)
- func On(event string, handler func(), alias ...string)
- func Use(database string, alias ...string) *mongo.Database
- func UseDefault(alias ...string) *mongo.Database
- type ConnectionOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(opts ConnectionOptions) mongo.Client
func ConnectURI ¶
Simplest form of connect with just a URI and no options
func Disconnect ¶
Disconnect a set of connections by alias or disconnect all connections if no alias is provided
@param aliases - The aliases of the connections to disconnect
func GetConnection ¶
Get the database connection for a given alias or the default connection if no alias is provided
@param alias - The alias of the connection to get
func Off ¶
Remove a listener from a connection
@param event - The event to remove the listener from
@param alias - The alias of the connection to remove the listener from
func On ¶
Add a listener to a connection
@param event - The event to listen for
@param handler - The function to call when the event is triggered
@param alias - The alias of the connection to listen to
func Use ¶
Use a specific database on a connection
@param database - The name of the database to use
@param alias - The alias of the connection to use
func UseDefault ¶
Use the default database on a connection. Uses the default connection if no alias is provided
@param alias - The alias of the connection to use
Types ¶
type ConnectionOptions ¶
type ConnectionOptions struct { Alias string URI string ClientOptions *options.ClientOptions PoolMonitor *event.PoolMonitor }