Documentation
¶
Index ¶
Constants ¶
View Source
const ( ExposedPort string = "27017" User string = "mongo" Pass string = "mongo" )
Variables ¶
This section is empty.
Functions ¶
func BuildConnectionString ¶
func BuildConnectionString(ctx context.Context, container testcontainers.Container, opts ...MongoOption) (string, error)
Return a MongoDB connection string for the given container with default options
Example: "mongodb://mongo:mongo@localhost:27017/"
func WithMongoContainer ¶
func WithMongoContainer() container.ContainerOption
Return a new container definition for a MongoDB container with default options
DockerImage: "mongo:7" Exposed ports: "27017" Environment variables: MONGO_INITDB_ROOT_USERNAME: "mongo" MONGO_INITDB_ROOT_PASSWORD: "mongo" WaitingForLog: "Waiting for connections" StartupTimeout: "30 seconds"
Types ¶
type MongoOption ¶
type MongoOption func(*Options)
MongoOption is a type that represents a MongoDB option
func WithExposedPort ¶
func WithExposedPort(exposedPort string) MongoOption
WithExposedPort is a MongoOption that sets the exposed port of the MongoDB container
Default: "27017"
func WithPass ¶
func WithPass(pass string) MongoOption
WithPass is a MongoOption that sets the password of the MongoDB container
Default: "test"
func WithUser ¶
func WithUser(user string) MongoOption
WithUser is a MongoOption that sets the user of the MongoDB container
Default: "test"
Click to show internal directories.
Click to hide internal directories.