go-txdb | Immutable transaction isolated sql driver for golang | Testing library
kandi X-RAY | go-txdb Summary
kandi X-RAY | go-txdb Summary
Immutable transaction isolated sql driver for golang
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of go-txdb
go-txdb Key Features
go-txdb Examples and Code Snippets
Community Discussions
Trending Discussions on go-txdb
QUESTION
I'm trying to use txdb for migrating my database inside an isolated transaction, for the purpose of testing code that interact with the database and also for tests with the migrations themselves. But every time I run my code an error is returned and some warnings are yell by Gorm:
...ANSWER
Answered 2019-Aug-16 at 02:09The problem seams to be that gorm
uses the first gorm.Open
argument as a dialect name (it has a set of predefined dialects) and not as a database/sql
driver name.
So you need to use a gorm
known dialect name as the first argument, in this case you want "postgres"
since you will be using postgresql as the underlying database hence you need gorm
using the corresponding sql dialect.
Then you tell gorm
to use the "txdb"
driver and "tx_1"
as the connection url.
This seem to work:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install go-txdb
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page