https://github.com/orsinium-labs/pgxtester
Go package for testing code that uses PostgreSQL
https://github.com/orsinium-labs/pgxtester
fixture fixtures go golang pgx postgres postgresql psql sql sqlc test testing
Last synced: about 1 month ago
JSON representation
Go package for testing code that uses PostgreSQL
- Host: GitHub
- URL: https://github.com/orsinium-labs/pgxtester
- Owner: orsinium-labs
- License: mit
- Created: 2024-12-08T09:02:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-08T09:03:12.000Z (over 1 year ago)
- Last Synced: 2025-03-30T23:41:12.974Z (about 1 year ago)
- Topics: fixture, fixtures, go, golang, pgx, postgres, postgresql, psql, sql, sqlc, test, testing
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pgxtester
A Go package for testing code that uses PostgreSQL. It establishes a concurrency-safe [pgx](https://github.com/jackc/pgx) connection, wraps it into a transaction, and rolls back the transaction at the end of the test. This ensures that changes done in a test will not affect other tests.
## Installation
```bash
go get github.com/orsinium-labs/pgxtester
```
## Usage
```go
func SomeTest(t *testing.T) {
conn := pgxtester.Connect(t, pgxtester.Config{URL: "..."})
// ...
}
```