testutils

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestMongoServer

type TestMongoServer struct {
	Client   *mongo.Client
	Database *mongo.Database
	URI      string
	// contains filtered or unexported fields
}

TestMongoServer representa un servidor MongoDB en memoria para pruebas

func NewTestMongoServer

func NewTestMongoServer(dbName string) (*TestMongoServer, error)

NewTestMongoServer crea una nueva instancia de MongoDB para pruebas. Si MONGO_REPO es "memory", usará MongoDB en memoria. De lo contrario, usará la URL especificada en MONGO_REPO (por defecto "mongodb://localhost:27017/").

func (*TestMongoServer) CleanDB

func (s *TestMongoServer) CleanDB() error

CleanDB elimina todas las colecciones de la base de datos

func (*TestMongoServer) Close

func (s *TestMongoServer) Close()

Close detiene el servidor y cierra la conexión

Jump to

Keyboard shortcuts

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