Documentation ¶
Overview ¶
Package mongodb provides a mongodb fx module.
import "github.com/lucaskatayama/fx-contrib/mongodb"
Example ¶
This is a simple usage of mongodb.Module with fx
package main import ( "go.uber.org/fx" "github.com/lucaskatayama/fx-contrib/mongodb" ) func main() { // export MONGODB_DATABASE=db app := fx.New( mongodb.Module, ) app.Run() }
Output:
Example (Example1) ¶
Setting MONGODB_URI
package main import ( "go.uber.org/fx" "github.com/lucaskatayama/fx-contrib/mongodb" ) func main() { // export MONGODB_URI=mongodb://localhost:27017 app := fx.New( mongodb.Module, ) app.Run() }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDBNameRequired is returned when MONGODB_DATABASE name is not defined on environment variables ErrDBNameRequired = errors.New("MONGODB_DATABASE is required") )
View Source
var Module = fx.Options( fx.Provide(new), fx.Provide(newDatabase), fx.Provide(check), fx.Invoke(lifecycle), )
Module defines a mongodb module for fx.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.