This commit is contained in:
jdl
2024-11-12 20:57:56 +01:00
parent 63e58089a1
commit b894b639ea
2 changed files with 112 additions and 26 deletions

View File

@@ -2,9 +2,7 @@
## Transactions
Simplify postgres transactions using `WithTx` for serializable transactions,
or `WithTxDefault` for the default isolation level. Use the `SerialTxRunner`
type to get automatic retries of serialization errors.
Simplify transactions using `WithTx`.
## Migrations
@@ -20,26 +18,3 @@ func init() {
Migrate(db, migrations) // Check the error, of course.
}
```
## Testing
In order to test this packge, we need to create a test user and database:
```
sudo su postgres
psql
CREATE DATABASE test;
CREATE USER test WITH ENCRYPTED PASSWORD 'test';
GRANT ALL PRIVILEGES ON DATABASE test TO test;
use test
GRANT ALL ON SCHEMA public TO test;
```
Check that you can connect via the command line:
```
psql -h 127.0.0.1 -U test --password test
```