package
0.0.0-20220510040844-a2f2f7a04fec
Repository: https://github.com/ddvkid/learngo.git
Documentation: pkg.go.dev

# Functions

No description provided by the author
GetEphemeralDBPort returns the local port mapped to the postgreSQL 5432 port in the docker container; the callers of RunWithContainer function must only use the returned port to compose the connection string; do not make any assumption on the port number as it is managed by the dockertest library and is subjective to changes.
NewInvalid creates an invalid connection value waiting to be initialized by RunWithContainer.
#nosec */.
RunWithContainer let the given function `proc` (procedure) to run in a well-prepared environment where: - A dockertest container (postgres container) is up and running; - The container has passed the connection test (Ping() returns no error) - A deferred teardown routine will clean up the container, as long as `proc` does not panic() nor calling os.Exit(..) The typical use case is to run this function with the TestMain(m *testing.M) function.
WithDir joins dir and basename to get the full path of the log file, i.e.
WithTempDir call the standard library's TempDir function to get a writable location; this depends on the operating system's libc implementation.

# Structs

No description provided by the author
EphemeralConnection is populated by RunWithContainer and is automatically passed to to the test runner functions.
EphemeralDB represents the database running inside the docker container.
Logging is enabled by an environment variable `ENABLE_DOCKERTEST_LOGGING`; (its value doesn't matter, as long as it is defined in the calling environment) by default, when this var is undefined, the logging structure won't initialize the log output directory, and won't set the postgres command line parameters; this design is to simplify the caller's work.
No description provided by the author