achiku / pgtxdb

Single transaction sql driver for golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pgtxdb

test GitHub license Go Report Card

Description

Single transaction sql driver for Golang x PostgreSQL. This is almost clone of go-txdb with a bit of PostgreSQL tweeks.

  • When conn.Begin() is called, this library executes SAVEPOINT pgtxdb_xxx; instead of actually begins transaction.
  • tx.Commit() does nothing.
  • ROLLBACK TO SAVEPOINT pgtxdb_xxx; will be executed upon tx.Rollback() call so that it can emulate transaction rollback.
  • Above features enable us to emulate multiple transactions in one test case.

Run test

Make sure PostgreSQL is running.

create database pgtxdbtest;
create user pgtxdbtest;

If you have Docker installed on your machine, run make test.

About

Single transaction sql driver for golang

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Go 98.1%Language:Makefile 1.2%Language:Dockerfile 0.7%