devroach

package module
v0.0.0-...-5c22ade Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 8 Imported by: 0

README

devroach

devroach is a simple CLI for starting a local in-memory CockroachDB for development run auto-running migrations in a directory like from prisma.

Installation

To run a CockroachDB instance locally and run migrations, you can install devroach using the following command:

go run github.com/robinbraemer/devroach@latest
# or
go install github.com/robinbraemer/devroach@latest
devroach -h

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(ctx context.Context, pool *pgxpool.Pool, migrationsFS fs.FS, globs ...string) error

Migrate runs all migrations against the given connection.

func MigrateT

func MigrateT(t *testing.T, pool *pgxpool.Pool, migrationsFS fs.FS, globs ...string)

MigrateT runs all migrations against the given connection.

func NewPool

func NewPool(ctx context.Context, migrationsFS fs.FS, globs ...string) (pool *pgxpool.Pool, clean func(), err error)

NewPool creates a new pgxpool.Pool instance for testing. 1. Check if the server is already running. 2. If not, start a new test server. 3. Create a new pool. 4. Apply migrations.

func NewPoolT

func NewPoolT(t *testing.T, migrationsFS fs.FS, globs ...string) *pgxpool.Pool

NewPoolT creates a new pgxpool.Pool instance for testing.

It is backed by a new in-memory cockroachdb instance and migrations are applied automatically. When the test is finished, the cockroachdb instance is stopped and connections are closed automatically.

func StartTestServer

func StartTestServer(ctx context.Context) (testserver.TestServer, error)

StartTestServer starts a new test server if not already running.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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