Skip to content

Commit 8129a7b

Browse files
committed
Clean up README grammar and wording
1 parent 2239b85 commit 8129a7b

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

README.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@
22

33
[![GoDoc](https://godoc.org/github.com/olomix/go-test-pg?status.svg)](https://godoc.org/github.com/olomix/go-test-pg)
44

5-
v2 version depends on pgx/v5. If you want support for pgx/v4, use 1.x.x
6-
version of this package.
5+
v2 depends on pgx/v5. For pgx/v4 support, use the 1.x.x version of this
6+
package.
77

8-
The aim this package is to help test golang programs against PostgreSQL
9-
database. It creates an empty database for each test and drops it when test
10-
is complete.
8+
This package helps test Go programs against a PostgreSQL database. It
9+
creates a fresh database for each test and drops it when the test completes.
1110

12-
As a side effect tool checks that all resources are released when test exits.
13-
If any Rows is not closed or Conn is not released to pool, test fails.
11+
The tool also checks that all resources are released when the test exits.
12+
If any `Rows` are not closed or a `Conn` is not released to the pool, the
13+
test fails.
1414

15-
`go-test-pg` uses schema file to initialize database with. It creates
16-
template database with this schema. Then each temporary database for every test
17-
creates from this template database. If the template database for this
18-
schema is exists, it will be reused. The name of the template database
19-
is composed of `baseName` and md5 hashsum of schema file content. If schema file
20-
is empty, then use default PostgreSQL empty database `template1`.
15+
`go-test-pg` uses a schema file to set up the database. It creates a
16+
template database from this schema, and each test gets its own copy of
17+
that template. If a template database for the schema already exists, it
18+
is reused. The template name is composed of `baseName` and the MD5 hash
19+
of the schema file content. If no schema file is provided, the default
20+
PostgreSQL `template1` database is used.
2121

22-
On complete, temporary databases would be dropped, template database will not
23-
be dropped and would remain for future reuse.
22+
When a test completes, its temporary database is dropped. The template
23+
database is kept for future reuse.
2424

25-
Template database would be created only on first use. If you call `NewPool`
26-
and do not call `With<something>` on it, real database would not be touched.
25+
The template database is created on first use. If you create a `Pgpool`
26+
but never call any `With*` method, no database is touched.
2727

28-
Each method was `Std` version that returns `*sql.DB`. For example,
29-
default method `WithFixtures` returns `*pgxpool.Pool` and `WithStdFixtures`
30-
returns `*sql.DB`.
28+
Each method has a `Std` variant that returns `*sql.DB`. For example,
29+
`WithFixtures` returns `*pgxpool.Pool` and `WithStdFixtures` returns
30+
`*sql.DB`.
3131

3232
## Example usage
3333

@@ -57,12 +57,11 @@ func TestX(t *testing.T) {
5757
}
5858
```
5959

60-
Connection to database configured using standard PostgreSQL environment
61-
variable https://www.postgresql.org/docs/11/libpq-envars.html. User needs
62-
permissions to create databases.
60+
The database connection is configured using standard PostgreSQL environment
61+
variables (https://www.postgresql.org/docs/11/libpq-envars.html). The user
62+
needs permissions to create databases.
6363

64-
If you want to skip all database tests, you need to set `Skip` field in Pgpool
65-
struct to `true`.
64+
To skip all database tests, set `Skip` to `true`:
6665

6766
```go
6867
var dbpool = &ptg.Pgpool{Skip: true}

0 commit comments

Comments
 (0)