diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml
new file mode 100644
index 0000000..7e51a21
--- /dev/null
+++ b/.github/workflows/integration_test.yml
@@ -0,0 +1,41 @@
+name: Integration test
+
+on: [push]
+
+jobs:
+ integration:
+ services:
+ postgres:
+ image: postgres:14.5-alpine3.16
+ env:
+ POSTGRES_DB: test
+ POSTGRES_PASSWORD: passwd
+ POSTGRES_USER: test
+ ports:
+ - 5432:5432
+ options: >-
+ --health-cmd pg_isready
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 5
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Set up Go
+ uses: actions/setup-go@v3
+ with:
+ go-version: 1.22.0
+
+ - name: Run migrations
+ run: |
+ go version
+
+ - name: Run migrations
+ run: |
+ cd test/integration/migration
+ go run . -cmd up -url "postgresql://test:passwd@localhost:5432/test?sslmode=disable"
+ - name: Run integration tests
+ run: |
+ cd test
+ go test ./...
diff --git a/Makefile b/Makefile
index 628e861..26a1988 100644
--- a/Makefile
+++ b/Makefile
@@ -15,9 +15,10 @@ tools.update: ## Update or install tools
.PHONT: deps.update
deps.update: ## Update dependencies versions (root and sub modules)
- @go get -u all
+ @GOTOOLCHAIN=local go get -u all
@go mod tidy
@for d in */ ; do pushd "$$d" && go get -u all && go mod tidy && popd; done
+ @go work sync
.PHONT: go.sync
go.sync: ## Sync modules
diff --git a/Readme.md b/Readme.md
index da70828..f6eedf7 100644
--- a/Readme.md
+++ b/Readme.md
@@ -7,7 +7,7 @@
![GitHub last commit](https://img.shields.io/github/last-commit/kozmod/oniontx)
[![GitHub MIT license](https://img.shields.io/github/license/kozmod/oniontx)](https://github.com/kozmod/oniontx/blob/dev/LICENSE)
-`oniotx` allows to move transferring transaction management from the `Persistence` (repository) layer to the `Application` (service) layer using owner defined contract.
+`oniontx` allows to move transferring transaction management from the `Persistence` (repository) layer to the `Application` (service) layer using owner defined contract.
#
🔴 **NOTE:** `Transactor` was designed to work with only the same instance of the "repository" (`*sql.DB`, etc.)
### The key features:
@@ -88,8 +88,8 @@ func (r *repoB) InsertInTx(ctx context.Context, val string) error {
return nil
}
```
-[oniontx-examples](https://github.com/kozmod/oniontx-examples) contains more complicated
-[example](https://github.com/kozmod/oniontx-examples/tree/master/internal/stdlib).
+[test/integration](https://github.com/kozmod/oniont/tree/master/test]) package contains more complicated
+[example](https://github.com/kozmod/oniont/tree/master/test/integration).
---
### Default implementation for database libs
@@ -99,9 +99,9 @@ func (r *repoB) InsertInTx(ctx context.Context, val string) error {
[gorm](https://github.com/go-gorm/gorm).
Examples:
-- [sqlx](https://github.com/kozmod/oniontx-examples/tree/master/internal/sqlx)
-- [pgx](https://github.com/kozmod/oniontx-examples/tree/master/internal/pgx)
-- [gorm](https://github.com/kozmod/oniontx-examples/tree/master/internal/gorm)
+- [sqlx](https://github.com/kozmod/oniontx/tree/master/test/integration/internal/sqlx)
+- [pgx](https://github.com/kozmod/oniontx/tree/master/test/integration/internal/pgx)
+- [gorm](https://github.com/kozmod/oniontx/tree/master/test/integration/internal/gorm)
---
@@ -529,6 +529,6 @@ func main() {
### Testing
-[oniontx-examples](https://github.com/kozmod/oniontx-examples) repository contains useful examples for creating unit test:
+[test](https://github.com/kozmod/oniontx/tree/master/test) package contains useful examples for creating unit test:
-- [vektra/mockery **+** stretchr/testify](https://github.com/kozmod/oniontx-examples/tree/master/internal/mock/mockery)
\ No newline at end of file
+- [vektra/mockery **+** stretchr/testify](https://github.com/kozmod/oniontx/tree/master/test/internal/integration/mock/mockery)
\ No newline at end of file
diff --git a/go.work b/go.work
index 3233e1d..af41fe1 100644
--- a/go.work
+++ b/go.work
@@ -6,4 +6,6 @@ use (
pgx
sqlx
stdlib
+ test
+ test/integration/migration
)
diff --git a/go.work.sum b/go.work.sum
index 9ef99b3..26f6a93 100644
--- a/go.work.sum
+++ b/go.work.sum
@@ -1,20 +1,49 @@
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
-github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
-github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
+github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
+github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f h1:JOrtw2xFKzlg+cbHpyrpLDmnN1HqhBfnX7WDiW7eG2c=
+github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A=
+github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
+github.com/go-kit/log v0.1.0 h1:DGJh0Sm43HbOeYDNnVZFl8BvcYVvjD5bqYJvp0REbwQ=
+github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
+github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
+github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
+github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
+github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
+github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
+github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA=
+github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
+github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
+github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
+github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
+github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
+github.com/microsoft/go-mssqldb v1.6.0 h1:mM3gYdVwEPFrlg/Dvr2DNVEgYFG7L42l+dGc67NNNpc=
+github.com/microsoft/go-mssqldb v1.6.0/go.mod h1:00mDtPbeQCRGC1HwOOR5K/gr30P1NcEG0vx6Kbv2aJU=
+github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
+github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc=
+github.com/rs/zerolog v1.15.0 h1:uPRuwkWF4J6fGsJ2R0Gn2jB1EQiav9k3S6CSdygQJXY=
+github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
-github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
+github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
+github.com/zenazn/goji v0.9.0 h1:RSQQAbXGArQ0dIDEq+PI6WqN6if+5KHu6x2Cx/GXLTQ=
+github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
+github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
+go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
+go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
+go.uber.org/zap v1.13.0 h1:nR6NoDBgAf67s68NhaXbsojM+2gxp3S1hWkHDl27pVU=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
-golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
-gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
-gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
-gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
+gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=
+gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec h1:RlWgLqCMMIYYEVcAR5MDsuHlVkaIPDAF+5Dehzg8L5A=
+honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
diff --git a/gorm/Redme.md b/gorm/Redme.md
index 7553c46..bd5c1cc 100644
--- a/gorm/Redme.md
+++ b/gorm/Redme.md
@@ -1,4 +1,4 @@
-## gorm/oniontx
+## oniontx/gorm
Default implementation `gorm` of the `Transactor`.
diff --git a/gorm/go.mod b/gorm/go.mod
index 382d107..b4409ef 100644
--- a/gorm/go.mod
+++ b/gorm/go.mod
@@ -5,7 +5,7 @@ go 1.22
replace github.com/kozmod/oniontx => ../
require (
- github.com/kozmod/oniontx v0.0.0
+ github.com/kozmod/oniontx v0.3.1
gorm.io/gorm v1.25.7
)
diff --git a/pgx/Redme.md b/pgx/Redme.md
index b8344d5..3e0c273 100644
--- a/pgx/Redme.md
+++ b/pgx/Redme.md
@@ -1,4 +1,4 @@
-## pgx/oniontx
+## oniontx/pgx
Default implementation of the `Transactor` for `pgx` integration.
diff --git a/pgx/go.mod b/pgx/go.mod
index f0bc33c..516fcb1 100644
--- a/pgx/go.mod
+++ b/pgx/go.mod
@@ -6,7 +6,7 @@ replace github.com/kozmod/oniontx => ../
require (
github.com/jackc/pgx/v5 v5.5.3
- github.com/kozmod/oniontx v0.0.0
+ github.com/kozmod/oniontx v0.3.1
)
require (
diff --git a/pgx/go.sum b/pgx/go.sum
index d5ec929..67ae5cd 100644
--- a/pgx/go.sum
+++ b/pgx/go.sum
@@ -1,5 +1,6 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA=
@@ -7,17 +8,21 @@ github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZ
github.com/jackc/pgx/v5 v5.5.3 h1:Ces6/M3wbDXYpM8JyyPD57ivTtJACFZJd885pdIaV2s=
github.com/jackc/pgx/v5 v5.5.3/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
+github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
+github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
+golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/sqlx/Redme.md b/sqlx/Redme.md
index 509e3fb..4598ca5 100644
--- a/sqlx/Redme.md
+++ b/sqlx/Redme.md
@@ -1,4 +1,4 @@
-## sqlx/oniontx
+## oniontx/sqlx
Default implementation of the `Transactor` for `sqlx` integration.
diff --git a/sqlx/go.mod b/sqlx/go.mod
index 5652c52..9a95d1a 100644
--- a/sqlx/go.mod
+++ b/sqlx/go.mod
@@ -6,6 +6,6 @@ replace github.com/kozmod/oniontx => ../
require (
github.com/jmoiron/sqlx v1.3.5
- github.com/kozmod/oniontx v0.0.0
+ github.com/kozmod/oniontx v0.3.1
github.com/lib/pq v1.10.9
)
diff --git a/stdlib/Redme.md b/stdlib/Redme.md
index 2d1448a..477c803 100644
--- a/stdlib/Redme.md
+++ b/stdlib/Redme.md
@@ -1,4 +1,4 @@
-## stdlib/oniontx
+## oniontx/stdlib
Default implementation of the `Transactor` for `stdlib` integration.
diff --git a/stdlib/go.mod b/stdlib/go.mod
index 1fe39db..14ead3f 100644
--- a/stdlib/go.mod
+++ b/stdlib/go.mod
@@ -4,4 +4,4 @@ go 1.22
replace github.com/kozmod/oniontx => ../
-require github.com/kozmod/oniontx v0.0.0
+require github.com/kozmod/oniontx v0.3.1
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..112509b
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,41 @@
+.PHONT: tools
+tools: ## Run tools (vet, gofmt, goimports, tidy, etc.)
+ @go version
+ gofmt -w .
+ goimports -w .
+ go mod tidy
+ go vet ./...
+
+.PHONT: tools.update
+tools.update: ## Update or install tools
+ go install golang.org/x/tools/cmd/goimports@latest
+ go install github.com/vektra/mockery/v2@v2.40.1
+
+.PHONT: deps.update
+deps.update: ## Update dependencies versions
+ go get -u all
+ go mod tidy
+
+.PHONT: test
+test: ## Run all tests
+ go test ./...
+
+.PHONY: down
+down:
+ docker compose down -f docker-compose.yml
+
+.PHONY: up
+up: ## Up dest database
+ COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f docker-compose.yml up
+
+.PHONY: up.d
+up.d: ## Up dest database (detached)
+ COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f docker-compose.yml up -d
+
+.PHONY: help
+help: ## List all make targets with description
+ @grep -h -E '^[.a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
+
+.PHONY: list
+list: ## List all make targets
+ @${MAKE} -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | sort
diff --git a/test/Redme.md b/test/Redme.md
new file mode 100644
index 0000000..e1a8182
--- /dev/null
+++ b/test/Redme.md
@@ -0,0 +1,17 @@
+## oniontx/test
+
+Package for additional test.
+
+### Run local
+1. Run environment
+ ```bash
+ make up
+ # or
+ make up.d
+ ```
+2. Run tests
+ ```
+ make test
+ # or
+ go test ./...
+ ```
\ No newline at end of file
diff --git a/test/docker-compose.yml b/test/docker-compose.yml
new file mode 100644
index 0000000..ce34316
--- /dev/null
+++ b/test/docker-compose.yml
@@ -0,0 +1,26 @@
+version: '3.8'
+
+services:
+ postgres:
+ container_name: postgres-oniontx
+ image: postgres:14.5-alpine3.16
+ shm_size: '256m'
+ environment:
+ - POSTGRES_DB=test
+ - POSTGRES_PASSWORD=passwd
+ - POSTGRES_USER=test
+ expose:
+ - "5432"
+ ports:
+ - "5432:5432"
+
+ migration:
+ container_name: migration-oniontx
+ build:
+ context: integration/migration
+ depends_on:
+ - postgres
+ entrypoint:
+ - "/bin/sh"
+ - "-ecx"
+ - "./migration -cmd up -url postgresql://test:passwd@postgres-oniontx:5432/test?sslmode=disable"
diff --git a/test/go.mod b/test/go.mod
new file mode 100644
index 0000000..322c5ef
--- /dev/null
+++ b/test/go.mod
@@ -0,0 +1,43 @@
+module github.com/kozmod/oniontx/test
+
+go 1.22
+
+replace (
+ github.com/kozmod/oniontx => ../
+ github.com/kozmod/oniontx/gorm => ../gorm
+ github.com/kozmod/oniontx/pgx => ../pgx
+ github.com/kozmod/oniontx/sqlx => ../sqlx
+ github.com/kozmod/oniontx/stdlib => ../stdlib
+)
+
+require (
+ github.com/jackc/pgx/v5 v5.5.3
+ github.com/jmoiron/sqlx v1.3.5
+ github.com/kozmod/oniontx/gorm v0.3.1
+ github.com/kozmod/oniontx/pgx v0.3.1
+ github.com/kozmod/oniontx/sqlx v0.3.1
+ github.com/kozmod/oniontx/stdlib v0.3.1
+ github.com/stretchr/testify v1.9.0
+ gorm.io/driver/postgres v1.5.6
+ gorm.io/gorm v1.25.7
+)
+
+require (
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/go-sql-driver/mysql v1.7.1 // indirect
+ github.com/jackc/pgpassfile v1.0.0 // indirect
+ github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
+ github.com/jackc/puddle/v2 v2.2.1 // indirect
+ github.com/jinzhu/inflection v1.0.0 // indirect
+ github.com/jinzhu/now v1.1.5 // indirect
+ github.com/kozmod/oniontx v0.3.1 // indirect
+ github.com/kr/text v0.2.0 // indirect
+ github.com/lib/pq v1.10.9 // indirect
+ github.com/pmezard/go-difflib v1.0.0 // indirect
+ github.com/rogpeppe/go-internal v1.12.0 // indirect
+ github.com/stretchr/objx v0.5.2 // indirect
+ golang.org/x/crypto v0.20.0 // indirect
+ golang.org/x/sync v0.6.0 // indirect
+ golang.org/x/text v0.14.0 // indirect
+ gopkg.in/yaml.v3 v3.0.1 // indirect
+)
diff --git a/test/go.sum b/test/go.sum
new file mode 100644
index 0000000..8b307d9
--- /dev/null
+++ b/test/go.sum
@@ -0,0 +1,57 @@
+github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
+github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
+github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
+github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
+github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
+github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA=
+github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
+github.com/jackc/pgx/v5 v5.5.3 h1:Ces6/M3wbDXYpM8JyyPD57ivTtJACFZJd885pdIaV2s=
+github.com/jackc/pgx/v5 v5.5.3/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
+github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
+github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
+github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
+github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
+github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
+github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
+github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
+github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=
+github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
+github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
+github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
+github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
+github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
+github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
+github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
+github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
+golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
+golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
+golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gorm.io/driver/postgres v1.5.6 h1:ydr9xEd5YAM0vxVDY0X139dyzNz10spDiDlC7+ibLeU=
+gorm.io/driver/postgres v1.5.6/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA=
+gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A=
+gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
diff --git a/test/integration/internal/entity/entity.go b/test/integration/internal/entity/entity.go
new file mode 100644
index 0000000..9483b0e
--- /dev/null
+++ b/test/integration/internal/entity/entity.go
@@ -0,0 +1,13 @@
+package entity
+
+import (
+ "fmt"
+)
+
+const (
+ ConnectionString = "postgresql://test:passwd@localhost:5432/test?sslmode=disable"
+)
+
+var (
+ ErrExpected = fmt.Errorf("expected fake error")
+)
diff --git a/test/integration/internal/gorm/helper_test.go b/test/integration/internal/gorm/helper_test.go
new file mode 100644
index 0000000..29ff612
--- /dev/null
+++ b/test/integration/internal/gorm/helper_test.go
@@ -0,0 +1,35 @@
+package gorm
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "gorm.io/driver/postgres"
+ "gorm.io/gorm"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+func ConnectDB(t *testing.T) *gorm.DB {
+ db, err := gorm.Open(postgres.Open(entity.ConnectionString), &gorm.Config{})
+ assert.NoError(t, err)
+ return db
+}
+
+func ClearDB(db *gorm.DB) error {
+ ex := db.Exec(`TRUNCATE TABLE gorm;`)
+ if ex.Error != nil {
+ return fmt.Errorf("clear DB: %w", ex.Error)
+ }
+ return nil
+}
+
+func GetTextRecords(db *gorm.DB) ([]Text, error) {
+ var texts []Text
+ db = db.Find(&texts)
+ if err := db.Error; err != nil {
+ return nil, fmt.Errorf("get `text` records: %w", err)
+ }
+ return texts, nil
+}
diff --git a/test/integration/internal/gorm/repository.go b/test/integration/internal/gorm/repository.go
new file mode 100644
index 0000000..d81d426
--- /dev/null
+++ b/test/integration/internal/gorm/repository.go
@@ -0,0 +1,60 @@
+package gorm
+
+import (
+ "context"
+ "fmt"
+
+ "gorm.io/gorm"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+type (
+ repoTransactor interface {
+ GetExecutor(ctx context.Context) *gorm.DB
+ }
+)
+
+type Text struct {
+ Val string `gorm:"column:val"`
+}
+
+func (t *Text) TableName() string {
+ return "gorm"
+}
+
+type TextRepository struct {
+ transactor repoTransactor
+ errorExpected bool
+}
+
+func NewTextRepository(transactor repoTransactor, errorExpected bool) *TextRepository {
+ return &TextRepository{
+ transactor: transactor,
+ errorExpected: errorExpected,
+ }
+}
+
+func (r *TextRepository) RawInsert(ctx context.Context, val string) error {
+ if r.errorExpected {
+ return entity.ErrExpected
+ }
+ ex := r.transactor.GetExecutor(ctx)
+ ex = ex.Exec(`INSERT INTO gorm (val) VALUES ($1)`, val)
+ if ex.Error != nil {
+ return fmt.Errorf("gorm repository - raw insert: %w", ex.Error)
+ }
+ return nil
+}
+
+func (r *TextRepository) Insert(ctx context.Context, text Text) error {
+ if r.errorExpected {
+ return entity.ErrExpected
+ }
+ ex := r.transactor.GetExecutor(ctx)
+ ex = ex.Create(text)
+ if ex.Error != nil {
+ return fmt.Errorf("gorm repository - raw insert: %w", ex.Error)
+ }
+ return nil
+}
diff --git a/test/integration/internal/gorm/usecase.go b/test/integration/internal/gorm/usecase.go
new file mode 100644
index 0000000..48c2e14
--- /dev/null
+++ b/test/integration/internal/gorm/usecase.go
@@ -0,0 +1,100 @@
+package gorm
+
+import (
+ "context"
+ "fmt"
+
+ "gorm.io/gorm"
+)
+
+type (
+ repository interface {
+ RawInsert(ctx context.Context, val string) error
+ Insert(ctx context.Context, text Text) error
+ }
+
+ useCase interface {
+ CreateTextRecords(ctx context.Context, text string) error
+ CreateText(ctx context.Context, text Text) error
+ }
+
+ transactor interface {
+ WithinTx(ctx context.Context, fn func(ctx context.Context) error) (err error)
+ GetExecutor(ctx context.Context) *gorm.DB
+ }
+)
+
+type UseCases struct {
+ useCaseA useCase
+ useCaseB useCase
+
+ transactor transactor
+}
+
+func NewUseCases(useCaseA useCase, useCaseB useCase, transactor transactor) *UseCases {
+ return &UseCases{
+ useCaseA: useCaseA,
+ useCaseB: useCaseB,
+ transactor: transactor,
+ }
+}
+
+func (u *UseCases) CreateTextRecords(ctx context.Context, text string) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.useCaseA.CreateTextRecords(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text usecase A: %w", err)
+ }
+
+ err = u.useCaseA.CreateTextRecords(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text usecase B: %w", err)
+ }
+ return nil
+ })
+}
+
+type UseCase struct {
+ textRepoA repository
+ textRepoB repository
+
+ transactor transactor
+}
+
+func NewUseCase(textRepoA repository, textRepoB repository, transactor transactor) *UseCase {
+ return &UseCase{
+ textRepoA: textRepoA,
+ textRepoB: textRepoB,
+ transactor: transactor,
+ }
+}
+
+func (u *UseCase) CreateTextRecords(ctx context.Context, text string) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.textRepoA.RawInsert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo A: %w", err)
+ }
+
+ err = u.textRepoB.RawInsert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo B: %w", err)
+ }
+ return nil
+ })
+}
+
+func (u *UseCase) CreateText(ctx context.Context, text Text) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.textRepoA.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo A: %w", err)
+ }
+
+ err = u.textRepoB.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo B: %w", err)
+ }
+ return nil
+ })
+}
diff --git a/test/integration/internal/gorm/usecase_test.go b/test/integration/internal/gorm/usecase_test.go
new file mode 100644
index 0000000..c6607db
--- /dev/null
+++ b/test/integration/internal/gorm/usecase_test.go
@@ -0,0 +1,199 @@
+package gorm
+
+import (
+ "context"
+ "testing"
+
+ ogorm "github.com/kozmod/oniontx/gorm"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+const (
+ textRecord = "text_A"
+)
+
+func Test_UseCase_CreateTextRecords(t *testing.T) {
+ var (
+ db = ConnectDB(t)
+ )
+
+ err := ClearDB(db)
+ assert.NoError(t, err)
+
+ t.Run("success_create", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ogorm.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, false)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateTextRecords(ctx, textRecord)
+ assert.NoError(t, err)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 2)
+ for _, record := range records {
+ assert.Equal(t, Text{Val: textRecord}, record)
+ }
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+ t.Run("error_and_rollback", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ogorm.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, true)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateTextRecords(ctx, textRecord)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, entity.ErrExpected)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 0)
+
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+}
+
+func Test_UseCase_CreateText(t *testing.T) {
+ var (
+ db = ConnectDB(t)
+
+ text = Text{
+ Val: textRecord,
+ }
+ )
+
+ err := ClearDB(db)
+ assert.NoError(t, err)
+
+ t.Run("success_create", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ogorm.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, false)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateText(ctx, text)
+ assert.NoError(t, err)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 2)
+ for _, record := range records {
+ assert.Equal(t, Text{Val: textRecord}, record)
+ }
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+ t.Run("error_and_rollback", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ogorm.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, true)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateText(ctx, text)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, entity.ErrExpected)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 0)
+
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+}
+
+func Test_UseCases(t *testing.T) {
+ var (
+ db = ConnectDB(t)
+ )
+
+ err := ClearDB(db)
+ assert.NoError(t, err)
+
+ t.Run("single_repository", func(t *testing.T) {
+ t.Run("success_create", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ogorm.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, false)
+ useCases = NewUseCases(
+ NewUseCase(repositoryA, repositoryB, transactor),
+ NewUseCase(repositoryA, repositoryB, transactor),
+ transactor,
+ )
+ )
+
+ err := useCases.CreateTextRecords(ctx, textRecord)
+ assert.NoError(t, err)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 4)
+ for _, record := range records {
+ assert.Equal(t, Text{Val: textRecord}, record)
+ }
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+ t.Run("error_and_rollback", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ogorm.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, true)
+ useCases = NewUseCases(
+ NewUseCase(repositoryA, repositoryB, transactor),
+ NewUseCase(repositoryA, repositoryB, transactor),
+ transactor,
+ )
+ )
+
+ err := useCases.CreateTextRecords(ctx, textRecord)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, entity.ErrExpected)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 0)
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+ })
+}
diff --git a/test/integration/internal/mock/mockery/mock_repository_test.go b/test/integration/internal/mock/mockery/mock_repository_test.go
new file mode 100644
index 0000000..1a90b9e
--- /dev/null
+++ b/test/integration/internal/mock/mockery/mock_repository_test.go
@@ -0,0 +1,46 @@
+// Code generated by mockery v2.40.1. DO NOT EDIT.
+
+package mockery
+
+import (
+ context "context"
+
+ mock "github.com/stretchr/testify/mock"
+)
+
+// repositoryMock is an autogenerated mock type for the repository type
+type repositoryMock struct {
+ mock.Mock
+}
+
+// Insert provides a mock function with given fields: ctx, val
+func (_m *repositoryMock) Insert(ctx context.Context, val string) error {
+ ret := _m.Called(ctx, val)
+
+ if len(ret) == 0 {
+ panic("no return value specified for Insert")
+ }
+
+ var r0 error
+ if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
+ r0 = rf(ctx, val)
+ } else {
+ r0 = ret.Error(0)
+ }
+
+ return r0
+}
+
+// newRepositoryMock creates a new instance of repositoryMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
+// The first argument is typically a *testing.T value.
+func newRepositoryMock(t interface {
+ mock.TestingT
+ Cleanup(func())
+}) *repositoryMock {
+ mock := &repositoryMock{}
+ mock.Mock.Test(t)
+
+ t.Cleanup(func() { mock.AssertExpectations(t) })
+
+ return mock
+}
diff --git a/test/integration/internal/mock/mockery/mock_transactor_test.go b/test/integration/internal/mock/mockery/mock_transactor_test.go
new file mode 100644
index 0000000..dc955a1
--- /dev/null
+++ b/test/integration/internal/mock/mockery/mock_transactor_test.go
@@ -0,0 +1,46 @@
+// Code generated by mockery v2.40.1. DO NOT EDIT.
+
+package mockery
+
+import (
+ context "context"
+
+ mock "github.com/stretchr/testify/mock"
+)
+
+// transactorMock is an autogenerated mock type for the transactor type
+type transactorMock struct {
+ mock.Mock
+}
+
+// WithinTx provides a mock function with given fields: ctx, fn
+func (_m *transactorMock) WithinTx(ctx context.Context, fn func(context.Context) error) error {
+ ret := _m.Called(ctx, fn)
+
+ if len(ret) == 0 {
+ panic("no return value specified for WithinTx")
+ }
+
+ var r0 error
+ if rf, ok := ret.Get(0).(func(context.Context, func(context.Context) error) error); ok {
+ r0 = rf(ctx, fn)
+ } else {
+ r0 = ret.Error(0)
+ }
+
+ return r0
+}
+
+// newTransactorMock creates a new instance of transactorMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
+// The first argument is typically a *testing.T value.
+func newTransactorMock(t interface {
+ mock.TestingT
+ Cleanup(func())
+}) *transactorMock {
+ mock := &transactorMock{}
+ mock.Mock.Test(t)
+
+ t.Cleanup(func() { mock.AssertExpectations(t) })
+
+ return mock
+}
diff --git a/test/integration/internal/mock/mockery/mockery_test.go b/test/integration/internal/mock/mockery/mockery_test.go
new file mode 100644
index 0000000..b16b6e4
--- /dev/null
+++ b/test/integration/internal/mock/mockery/mockery_test.go
@@ -0,0 +1,80 @@
+package mockery
+
+import (
+ "context"
+ "fmt"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/mock"
+)
+
+const (
+ textValue = "some_text"
+
+ repositoryMethodInsert = "Insert"
+ transactorMethodWithinTx = "WithinTx"
+)
+
+func Test_mockery(t *testing.T) {
+ t.Run("assert_success", func(t *testing.T) {
+ ctx := context.Background()
+ transactorMock := new(transactorMock)
+ transactorMock.On(transactorMethodWithinTx,
+ ctx,
+ mock.MatchedBy(func(i any) bool {
+ fn, ok := i.(func(context.Context) error)
+ assert.True(t, ok)
+ return assert.NoError(t, fn(ctx))
+ })).Return(nil)
+
+ repositoryMockA := new(repositoryMock)
+ repositoryMockA.On(repositoryMethodInsert, ctx, textValue).Return(nil)
+
+ repositoryMockB := new(repositoryMock)
+ repositoryMockB.On(repositoryMethodInsert, ctx, textValue).Return(nil)
+
+ useCase := UseCase{
+ transactor: transactorMock,
+ textRepoA: repositoryMockA,
+ textRepoB: repositoryMockB,
+ }
+
+ err := useCase.CreateTextRecords(ctx, textValue)
+ assert.NoError(t, err)
+ })
+
+ t.Run("assert_error", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ expError = fmt.Errorf("some_error")
+ trsnsactorErr = fmt.Errorf("transactor_error")
+ )
+
+ transactorMock := new(transactorMock)
+ transactorMock.On(transactorMethodWithinTx,
+ ctx,
+ mock.MatchedBy(func(i any) bool {
+ fn, ok := i.(func(context.Context) error)
+ assert.True(t, ok)
+ return assert.Error(t, fn(ctx))
+ }),
+ ).Return(trsnsactorErr)
+
+ repositoryMockA := new(repositoryMock)
+ repositoryMockA.On(repositoryMethodInsert, ctx, textValue).Return(nil)
+
+ repositoryMockB := new(repositoryMock)
+ repositoryMockB.On(repositoryMethodInsert, ctx, textValue).Return(expError)
+
+ useCase := UseCase{
+ transactor: transactorMock,
+ textRepoA: repositoryMockA,
+ textRepoB: repositoryMockB,
+ }
+
+ err := useCase.CreateTextRecords(ctx, textValue)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, trsnsactorErr)
+ })
+}
diff --git a/test/integration/internal/mock/mockery/usecase.go b/test/integration/internal/mock/mockery/usecase.go
new file mode 100644
index 0000000..dd5e650
--- /dev/null
+++ b/test/integration/internal/mock/mockery/usecase.go
@@ -0,0 +1,42 @@
+package mockery
+
+//go:generate mockery --dir=. --name=repository --outpkg=mockery --output=. --filename=mock_repository_test.go --structname=repositoryMock
+//go:generate mockery --dir=. --name=transactor --outpkg=mockery --output=. --filename=mock_transactor_test.go --structname=transactorMock
+//go:generate git add .
+
+import (
+ "context"
+ "fmt"
+)
+
+type (
+ repository interface {
+ Insert(ctx context.Context, val string) error
+ }
+
+ transactor interface {
+ WithinTx(ctx context.Context, fn func(ctx context.Context) error) (err error)
+ }
+)
+
+type UseCase struct {
+ textRepoA repository
+ textRepoB repository
+
+ transactor transactor
+}
+
+func (u *UseCase) CreateTextRecords(ctx context.Context, text string) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.textRepoA.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo A: %w", err)
+ }
+
+ err = u.textRepoB.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo B: %w", err)
+ }
+ return nil
+ })
+}
diff --git a/test/integration/internal/pgx/helper_test.go b/test/integration/internal/pgx/helper_test.go
new file mode 100644
index 0000000..c6768b0
--- /dev/null
+++ b/test/integration/internal/pgx/helper_test.go
@@ -0,0 +1,47 @@
+package pgx
+
+import (
+ "context"
+ "fmt"
+ "testing"
+
+ "github.com/jackc/pgx/v5"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+func ConnectDB(ctx context.Context, t *testing.T) *pgx.Conn {
+ conn, err := pgx.Connect(ctx, entity.ConnectionString)
+ assert.NoError(t, err)
+
+ err = conn.Ping(ctx)
+ assert.NoError(t, err)
+ return conn
+}
+
+func ClearDB(ctx context.Context, db *pgx.Conn) error {
+ _, err := db.Exec(ctx, `TRUNCATE TABLE pgx;`)
+ if err != nil {
+ return fmt.Errorf("clear DB: %w", err)
+ }
+ return nil
+}
+
+func GetTextRecords(ctx context.Context, db *pgx.Conn) ([]string, error) {
+ row, err := db.Query(ctx, "SELECT val FROM pgx;")
+ if err != nil {
+ return nil, fmt.Errorf("get `text` records: %w", err)
+ }
+
+ var texts []string
+ for row.Next() {
+ var text string
+ err = row.Scan(&text)
+ if err != nil {
+ return nil, fmt.Errorf("scan `text` records: %w", err)
+ }
+ texts = append(texts, text)
+ }
+ return texts, nil
+}
diff --git a/test/integration/internal/pgx/repository.go b/test/integration/internal/pgx/repository.go
new file mode 100644
index 0000000..5520047
--- /dev/null
+++ b/test/integration/internal/pgx/repository.go
@@ -0,0 +1,40 @@
+package pgx
+
+import (
+ "context"
+ "fmt"
+
+ oniontx "github.com/kozmod/oniontx/pgx"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+type (
+ repoTransactor interface {
+ GetExecutor(ctx context.Context) oniontx.Executor
+ }
+)
+
+type TextRepository struct {
+ transactor repoTransactor
+ errorExpected bool
+}
+
+func NewTextRepository(transactor repoTransactor, errorExpected bool) *TextRepository {
+ return &TextRepository{
+ transactor: transactor,
+ errorExpected: errorExpected,
+ }
+}
+
+func (r *TextRepository) Insert(ctx context.Context, val string) error {
+ if r.errorExpected {
+ return entity.ErrExpected
+ }
+ ex := r.transactor.GetExecutor(ctx)
+ _, err := ex.Exec(ctx, `INSERT INTO pgx (val) VALUES ($1)`, val)
+ if err != nil {
+ return fmt.Errorf("pgx repository - raw insert: %w", err)
+ }
+ return nil
+}
diff --git a/test/integration/internal/pgx/usecase.go b/test/integration/internal/pgx/usecase.go
new file mode 100644
index 0000000..cab433a
--- /dev/null
+++ b/test/integration/internal/pgx/usecase.go
@@ -0,0 +1,80 @@
+package pgx
+
+import (
+ "context"
+ "fmt"
+)
+
+type (
+ repository interface {
+ Insert(ctx context.Context, val string) error
+ }
+
+ useCase interface {
+ CreateTextRecords(ctx context.Context, text string) error
+ }
+
+ transactor interface {
+ WithinTx(ctx context.Context, fn func(ctx context.Context) error) (err error)
+ }
+)
+
+type UseCases struct {
+ useCaseA useCase
+ useCaseB useCase
+
+ transactor transactor
+}
+
+func NewUseCases(useCaseA useCase, useCaseB useCase, transactor transactor) *UseCases {
+ return &UseCases{
+ useCaseA: useCaseA,
+ useCaseB: useCaseB,
+ transactor: transactor,
+ }
+}
+
+func (u *UseCases) CreateTextRecords(ctx context.Context, text string) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.useCaseA.CreateTextRecords(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text usecase A: %w", err)
+ }
+
+ err = u.useCaseA.CreateTextRecords(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text usecase B: %w", err)
+ }
+ return nil
+ })
+}
+
+type UseCase struct {
+ textRepoA repository
+ textRepoB repository
+
+ transactor transactor
+}
+
+func NewUseCase(textRepoA repository, textRepoB repository, transactor transactor) *UseCase {
+ return &UseCase{
+ textRepoA: textRepoA,
+ textRepoB: textRepoB,
+ transactor: transactor,
+ }
+}
+
+func (u *UseCase) CreateTextRecords(ctx context.Context, text string) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.textRepoA.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo A: %w", err)
+ }
+
+ err = u.textRepoB.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo B: %w", err)
+ }
+ return nil
+ })
+}
diff --git a/test/integration/internal/pgx/usecase_test.go b/test/integration/internal/pgx/usecase_test.go
new file mode 100644
index 0000000..c472abd
--- /dev/null
+++ b/test/integration/internal/pgx/usecase_test.go
@@ -0,0 +1,148 @@
+package pgx
+
+import (
+ "context"
+ "testing"
+
+ opgx "github.com/kozmod/oniontx/pgx"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+const (
+ textRecord = "text_A"
+)
+
+func Test_UseCase_CreateTextRecords(t *testing.T) {
+ var (
+ globalCtx = context.Background()
+ db = ConnectDB(globalCtx, t)
+ )
+ defer func() {
+ err := db.Close(globalCtx)
+ assert.NoError(t, err)
+ }()
+
+ err := ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+
+ t.Run("success_create", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = opgx.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, false)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateTextRecords(ctx, textRecord)
+ assert.NoError(t, err)
+
+ {
+ records, err := GetTextRecords(globalCtx, db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 2)
+ for _, record := range records {
+ assert.Equal(t, textRecord, record)
+ }
+ }
+
+ err = ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+ })
+ t.Run("error_and_rollback", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = opgx.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, true)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateTextRecords(ctx, textRecord)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, entity.ErrExpected)
+
+ {
+ records, err := GetTextRecords(globalCtx, db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 0)
+
+ }
+
+ err = ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+ })
+}
+
+func Test_UseCases(t *testing.T) {
+ var (
+ globalCtx = context.Background()
+ db = ConnectDB(globalCtx, t)
+ )
+ defer func() {
+ err := db.Close(globalCtx)
+ assert.NoError(t, err)
+ }()
+
+ err := ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+
+ t.Run("single_repository", func(t *testing.T) {
+ t.Run("success_create", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = opgx.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, false)
+ useCases = NewUseCases(
+ NewUseCase(repositoryA, repositoryB, transactor),
+ NewUseCase(repositoryA, repositoryB, transactor),
+ transactor,
+ )
+ )
+
+ err := useCases.CreateTextRecords(ctx, textRecord)
+ assert.NoError(t, err)
+
+ {
+ records, err := GetTextRecords(globalCtx, db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 4)
+ for _, record := range records {
+ assert.Equal(t, textRecord, record)
+ }
+ }
+
+ err = ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+ })
+ t.Run("error_and_rollback", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = opgx.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, true)
+ useCases = NewUseCases(
+ NewUseCase(repositoryA, repositoryB, transactor),
+ NewUseCase(repositoryA, repositoryB, transactor),
+ transactor,
+ )
+ )
+
+ err := useCases.CreateTextRecords(ctx, textRecord)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, entity.ErrExpected)
+
+ {
+ records, err := GetTextRecords(globalCtx, db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 0)
+ }
+
+ err = ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+ })
+ })
+}
diff --git a/test/integration/internal/sqlx/helper_test.go b/test/integration/internal/sqlx/helper_test.go
new file mode 100644
index 0000000..16cd063
--- /dev/null
+++ b/test/integration/internal/sqlx/helper_test.go
@@ -0,0 +1,47 @@
+package sqlx
+
+import (
+ "context"
+ "fmt"
+ "testing"
+
+ "github.com/jmoiron/sqlx"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+func ConnectDB(t *testing.T) *sqlx.DB {
+ db, err := sqlx.Connect("postgres", entity.ConnectionString)
+ assert.NoError(t, err)
+
+ err = db.Ping()
+ assert.NoError(t, err)
+ return db
+}
+
+func ClearDB(ctx context.Context, db *sqlx.DB) error {
+ _, err := db.ExecContext(ctx, `TRUNCATE TABLE sqlx;`)
+ if err != nil {
+ return fmt.Errorf("clear DB: %w", err)
+ }
+ return nil
+}
+
+func GetTextRecords(ctx context.Context, db *sqlx.DB) ([]string, error) {
+ row, err := db.QueryContext(ctx, "SELECT val FROM sqlx;")
+ if err != nil {
+ return nil, fmt.Errorf("get `text` records: %w", err)
+ }
+
+ var texts []string
+ for row.Next() {
+ var text string
+ err = row.Scan(&text)
+ if err != nil {
+ return nil, fmt.Errorf("scan `text` records: %w", err)
+ }
+ texts = append(texts, text)
+ }
+ return texts, nil
+}
diff --git a/test/integration/internal/sqlx/repository.go b/test/integration/internal/sqlx/repository.go
new file mode 100644
index 0000000..663c650
--- /dev/null
+++ b/test/integration/internal/sqlx/repository.go
@@ -0,0 +1,40 @@
+package sqlx
+
+import (
+ "context"
+ "fmt"
+
+ osqlx "github.com/kozmod/oniontx/sqlx"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+type (
+ repoTransactor interface {
+ GetExecutor(ctx context.Context) osqlx.Executor
+ }
+)
+
+type TextRepository struct {
+ transactor repoTransactor
+ errorExpected bool
+}
+
+func NewTextRepository(transactor repoTransactor, errorExpected bool) *TextRepository {
+ return &TextRepository{
+ transactor: transactor,
+ errorExpected: errorExpected,
+ }
+}
+
+func (r *TextRepository) Insert(ctx context.Context, val string) error {
+ if r.errorExpected {
+ return entity.ErrExpected
+ }
+ ex := r.transactor.GetExecutor(ctx)
+ _, err := ex.ExecContext(ctx, `INSERT INTO sqlx (val) VALUES ($1)`, val)
+ if err != nil {
+ return fmt.Errorf("sqlx repository - raw insert: %w", err)
+ }
+ return nil
+}
diff --git a/test/integration/internal/sqlx/usecase.go b/test/integration/internal/sqlx/usecase.go
new file mode 100644
index 0000000..3cce005
--- /dev/null
+++ b/test/integration/internal/sqlx/usecase.go
@@ -0,0 +1,80 @@
+package sqlx
+
+import (
+ "context"
+ "fmt"
+)
+
+type (
+ repository interface {
+ Insert(ctx context.Context, val string) error
+ }
+
+ useCase interface {
+ CreateTextRecords(ctx context.Context, text string) error
+ }
+
+ transactor interface {
+ WithinTx(ctx context.Context, fn func(ctx context.Context) error) (err error)
+ }
+)
+
+type UseCases struct {
+ useCaseA useCase
+ useCaseB useCase
+
+ transactor transactor
+}
+
+func NewUseCases(useCaseA useCase, useCaseB useCase, transactor transactor) *UseCases {
+ return &UseCases{
+ useCaseA: useCaseA,
+ useCaseB: useCaseB,
+ transactor: transactor,
+ }
+}
+
+func (u *UseCases) CreateTextRecords(ctx context.Context, text string) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.useCaseA.CreateTextRecords(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text usecase A: %w", err)
+ }
+
+ err = u.useCaseA.CreateTextRecords(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text usecase B: %w", err)
+ }
+ return nil
+ })
+}
+
+type UseCase struct {
+ textRepoA repository
+ textRepoB repository
+
+ transactor transactor
+}
+
+func NewUseCase(textRepoA repository, textRepoB repository, transactor transactor) *UseCase {
+ return &UseCase{
+ textRepoA: textRepoA,
+ textRepoB: textRepoB,
+ transactor: transactor,
+ }
+}
+
+func (u *UseCase) CreateTextRecords(ctx context.Context, text string) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.textRepoA.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo A: %w", err)
+ }
+
+ err = u.textRepoB.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo B: %w", err)
+ }
+ return nil
+ })
+}
diff --git a/test/integration/internal/sqlx/usecase_test.go b/test/integration/internal/sqlx/usecase_test.go
new file mode 100644
index 0000000..902deaf
--- /dev/null
+++ b/test/integration/internal/sqlx/usecase_test.go
@@ -0,0 +1,148 @@
+package sqlx
+
+import (
+ "context"
+ "testing"
+
+ osqlx "github.com/kozmod/oniontx/sqlx"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+const (
+ textRecord = "text_A"
+)
+
+func Test_UseCase_CreateTextRecords(t *testing.T) {
+ var (
+ globalCtx = context.Background()
+ db = ConnectDB(t)
+ )
+ defer func() {
+ err := db.Close()
+ assert.NoError(t, err)
+ }()
+
+ err := ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+
+ t.Run("success_create", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = osqlx.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, false)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateTextRecords(ctx, textRecord)
+ assert.NoError(t, err)
+
+ {
+ records, err := GetTextRecords(globalCtx, db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 2)
+ for _, record := range records {
+ assert.Equal(t, textRecord, record)
+ }
+ }
+
+ err = ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+ })
+ t.Run("error_and_rollback", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = osqlx.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, true)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateTextRecords(ctx, textRecord)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, entity.ErrExpected)
+
+ {
+ records, err := GetTextRecords(globalCtx, db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 0)
+
+ }
+
+ err = ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+ })
+}
+
+func Test_UseCases(t *testing.T) {
+ var (
+ globalCtx = context.Background()
+ db = ConnectDB(t)
+ )
+ defer func() {
+ err := db.Close()
+ assert.NoError(t, err)
+ }()
+
+ err := ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+
+ t.Run("single_repository", func(t *testing.T) {
+ t.Run("success_create", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = osqlx.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, false)
+ useCases = NewUseCases(
+ NewUseCase(repositoryA, repositoryB, transactor),
+ NewUseCase(repositoryA, repositoryB, transactor),
+ transactor,
+ )
+ )
+
+ err := useCases.CreateTextRecords(ctx, textRecord)
+ assert.NoError(t, err)
+
+ {
+ records, err := GetTextRecords(globalCtx, db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 4)
+ for _, record := range records {
+ assert.Equal(t, textRecord, record)
+ }
+ }
+
+ err = ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+ })
+ t.Run("error_and_rollback", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = osqlx.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, true)
+ useCases = NewUseCases(
+ NewUseCase(repositoryA, repositoryB, transactor),
+ NewUseCase(repositoryA, repositoryB, transactor),
+ transactor,
+ )
+ )
+
+ err := useCases.CreateTextRecords(ctx, textRecord)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, entity.ErrExpected)
+
+ {
+ records, err := GetTextRecords(globalCtx, db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 0)
+ }
+
+ err = ClearDB(globalCtx, db)
+ assert.NoError(t, err)
+ })
+ })
+}
diff --git a/test/integration/internal/stdlib/helper_test.go b/test/integration/internal/stdlib/helper_test.go
new file mode 100644
index 0000000..4de4caa
--- /dev/null
+++ b/test/integration/internal/stdlib/helper_test.go
@@ -0,0 +1,53 @@
+package stdlib
+
+import (
+ "database/sql"
+ "fmt"
+ "testing"
+
+ "github.com/jackc/pgx/v5"
+ "github.com/jackc/pgx/v5/stdlib"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+func ConnectDB(t *testing.T) *sql.DB {
+ connConfig, err := pgx.ParseConfig(entity.ConnectionString)
+ assert.NoError(t, err)
+
+ connStr := stdlib.RegisterConnConfig(connConfig)
+ db, err := sql.Open("pgx", connStr)
+ assert.NoError(t, err)
+
+ err = db.Ping()
+ assert.NoError(t, err)
+
+ return db
+}
+
+func ClearDB(db *sql.DB) error {
+ _, err := db.Exec("TRUNCATE TABLE stdlib;")
+ if err != nil {
+ return fmt.Errorf("clear DB: %w", err)
+ }
+ return nil
+}
+
+func GetTextRecords(db *sql.DB) ([]string, error) {
+ row, err := db.Query("SELECT val FROM stdlib;")
+ if err != nil {
+ return nil, fmt.Errorf("get `text` records: %w", err)
+ }
+
+ var texts []string
+ for row.Next() {
+ var text string
+ err = row.Scan(&text)
+ if err != nil {
+ return nil, fmt.Errorf("scan `text` records: %w", err)
+ }
+ texts = append(texts, text)
+ }
+ return texts, nil
+}
diff --git a/test/integration/internal/stdlib/repository.go b/test/integration/internal/stdlib/repository.go
new file mode 100644
index 0000000..bda6639
--- /dev/null
+++ b/test/integration/internal/stdlib/repository.go
@@ -0,0 +1,40 @@
+package stdlib
+
+import (
+ "context"
+ "fmt"
+
+ ostdlib "github.com/kozmod/oniontx/stdlib"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+type (
+ repoTransactor interface {
+ GetExecutor(ctx context.Context) ostdlib.Executor
+ }
+)
+
+type TextRepository struct {
+ transactor repoTransactor
+ errorExpected bool
+}
+
+func NewTextRepository(transactor repoTransactor, errorExpected bool) *TextRepository {
+ return &TextRepository{
+ transactor: transactor,
+ errorExpected: errorExpected,
+ }
+}
+
+func (r *TextRepository) Insert(ctx context.Context, val string) error {
+ if r.errorExpected {
+ return entity.ErrExpected
+ }
+ ex := r.transactor.GetExecutor(ctx)
+ _, err := ex.ExecContext(ctx, `INSERT INTO stdlib (val) VALUES ($1)`, val)
+ if err != nil {
+ return fmt.Errorf("stdlib repository: %w", err)
+ }
+ return nil
+}
diff --git a/test/integration/internal/stdlib/usecase.go b/test/integration/internal/stdlib/usecase.go
new file mode 100644
index 0000000..f85096d
--- /dev/null
+++ b/test/integration/internal/stdlib/usecase.go
@@ -0,0 +1,80 @@
+package stdlib
+
+import (
+ "context"
+ "fmt"
+)
+
+type (
+ repository interface {
+ Insert(ctx context.Context, val string) error
+ }
+
+ useCase interface {
+ CreateTextRecords(ctx context.Context, text string) error
+ }
+
+ transactor interface {
+ WithinTx(ctx context.Context, fn func(ctx context.Context) error) (err error)
+ }
+)
+
+type UseCases struct {
+ useCaseA useCase
+ useCaseB useCase
+
+ transactor transactor
+}
+
+func NewUseCases(useCaseA useCase, useCaseB useCase, transactor transactor) *UseCases {
+ return &UseCases{
+ useCaseA: useCaseA,
+ useCaseB: useCaseB,
+ transactor: transactor,
+ }
+}
+
+func (u *UseCases) CreateTextRecords(ctx context.Context, text string) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.useCaseA.CreateTextRecords(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text usecase A: %w", err)
+ }
+
+ err = u.useCaseA.CreateTextRecords(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text usecase B: %w", err)
+ }
+ return nil
+ })
+}
+
+type UseCase struct {
+ textRepoA repository
+ textRepoB repository
+
+ transactor transactor
+}
+
+func NewUseCase(textRepoA repository, textRepoB repository, transactor transactor) *UseCase {
+ return &UseCase{
+ textRepoA: textRepoA,
+ textRepoB: textRepoB,
+ transactor: transactor,
+ }
+}
+
+func (u *UseCase) CreateTextRecords(ctx context.Context, text string) error {
+ return u.transactor.WithinTx(ctx, func(ctx context.Context) error {
+ err := u.textRepoA.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo A: %w", err)
+ }
+
+ err = u.textRepoB.Insert(ctx, text)
+ if err != nil {
+ return fmt.Errorf("text repo B: %w", err)
+ }
+ return nil
+ })
+}
diff --git a/test/integration/internal/stdlib/usecase_test.go b/test/integration/internal/stdlib/usecase_test.go
new file mode 100644
index 0000000..4d33c2d
--- /dev/null
+++ b/test/integration/internal/stdlib/usecase_test.go
@@ -0,0 +1,145 @@
+package stdlib
+
+import (
+ "context"
+ "testing"
+
+ ostdlib "github.com/kozmod/oniontx/stdlib"
+ "github.com/stretchr/testify/assert"
+
+ "github.com/kozmod/oniontx/test/integration/internal/entity"
+)
+
+const (
+ textRecord = "text_A"
+)
+
+func Test_UseCase(t *testing.T) {
+ var (
+ db = ConnectDB(t)
+ )
+ defer func() {
+ err := db.Close()
+ assert.NoError(t, err)
+ }()
+
+ err := ClearDB(db)
+ assert.NoError(t, err)
+
+ t.Run("success_create", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ostdlib.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, false)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateTextRecords(ctx, textRecord)
+ assert.NoError(t, err)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 2)
+ for _, record := range records {
+ assert.Equal(t, textRecord, record)
+ }
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+ t.Run("error_and_rollback", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ostdlib.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, true)
+ useCase = NewUseCase(repositoryA, repositoryB, transactor)
+ )
+
+ err := useCase.CreateTextRecords(ctx, textRecord)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, entity.ErrExpected)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 0)
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+}
+
+func Test_UseCases(t *testing.T) {
+ var (
+ db = ConnectDB(t)
+ )
+ defer func() {
+ err := db.Close()
+ assert.NoError(t, err)
+ }()
+
+ err := ClearDB(db)
+ assert.NoError(t, err)
+
+ t.Run("single_repository", func(t *testing.T) {
+ t.Run("success_create", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ostdlib.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, false)
+ useCases = NewUseCases(
+ NewUseCase(repositoryA, repositoryB, transactor),
+ NewUseCase(repositoryA, repositoryB, transactor),
+ transactor,
+ )
+ )
+
+ err := useCases.CreateTextRecords(ctx, textRecord)
+ assert.NoError(t, err)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 4)
+ for _, record := range records {
+ assert.Equal(t, textRecord, record)
+ }
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+ t.Run("error_and_rollback", func(t *testing.T) {
+ var (
+ ctx = context.Background()
+ transactor = ostdlib.NewTransactor(db)
+ repositoryA = NewTextRepository(transactor, false)
+ repositoryB = NewTextRepository(transactor, true)
+ useCases = NewUseCases(
+ NewUseCase(repositoryA, repositoryB, transactor),
+ NewUseCase(repositoryA, repositoryB, transactor),
+ transactor,
+ )
+ )
+
+ err := useCases.CreateTextRecords(ctx, textRecord)
+ assert.Error(t, err)
+ assert.ErrorIs(t, err, entity.ErrExpected)
+
+ {
+ records, err := GetTextRecords(db)
+ assert.NoError(t, err)
+ assert.Len(t, records, 0)
+ }
+
+ err = ClearDB(db)
+ assert.NoError(t, err)
+ })
+ })
+}
diff --git a/test/integration/migration/Dockerfile b/test/integration/migration/Dockerfile
new file mode 100644
index 0000000..a666f01
--- /dev/null
+++ b/test/integration/migration/Dockerfile
@@ -0,0 +1,11 @@
+FROM golang:1.22-alpine
+
+RUN --mount=type=cache,target=/var/cache/apk apk --update --upgrade add ca-certificates gcc libc-dev
+
+ENV GO111MODULE on
+ENV CGO_ENABLED 1
+ENV GOOS linux
+
+WORKDIR /go/migration
+ADD . /go/migration
+RUN go build -o migration .
diff --git a/test/integration/migration/Makefile b/test/integration/migration/Makefile
new file mode 100644
index 0000000..1e19ccd
--- /dev/null
+++ b/test/integration/migration/Makefile
@@ -0,0 +1,20 @@
+.PHONT: tools
+tools: ## Run tools (vet, gofmt, goimports, tidy, etc.)
+ @go version
+ gofmt -w .
+ goimports -w .
+ go mod tidy
+ go vet ./...
+
+.PHONT: deps.update
+deps.update: ## Update dependencies versions
+ go get -u all
+ go mod tidy
+
+.PHONY: help
+help: ## List all make targets with description
+ @grep -h -E '^[.a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
+
+.PHONY: list
+list: ## List all make targets
+ @${MAKE} -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | sort
diff --git a/test/integration/migration/go.mod b/test/integration/migration/go.mod
new file mode 100644
index 0000000..9695193
--- /dev/null
+++ b/test/integration/migration/go.mod
@@ -0,0 +1,28 @@
+module github.com/kozmod/oniontx-examples/migration
+
+go 1.22
+
+require (
+ github.com/jackc/pgx/v4 v4.18.1
+ github.com/pkg/errors v0.9.1
+ github.com/pressly/goose/v3 v3.17.0
+)
+
+require (
+ github.com/gofrs/uuid v4.4.0+incompatible // indirect
+ github.com/google/uuid v1.5.0 // indirect
+ github.com/jackc/chunkreader/v2 v2.0.1 // indirect
+ github.com/jackc/pgconn v1.14.1 // indirect
+ github.com/jackc/pgio v1.0.0 // indirect
+ github.com/jackc/pgpassfile v1.0.0 // indirect
+ github.com/jackc/pgproto3/v2 v2.3.2 // indirect
+ github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
+ github.com/jackc/pgtype v1.14.1 // indirect
+ github.com/lib/pq v1.10.9 // indirect
+ github.com/sethvargo/go-retry v0.2.4 // indirect
+ github.com/stretchr/testify v1.8.4 // indirect
+ go.uber.org/multierr v1.11.0 // indirect
+ golang.org/x/crypto v0.18.0 // indirect
+ golang.org/x/sync v0.6.0 // indirect
+ golang.org/x/text v0.14.0 // indirect
+)
diff --git a/test/integration/migration/go.sum b/test/integration/migration/go.sum
new file mode 100644
index 0000000..37cf136
--- /dev/null
+++ b/test/integration/migration/go.sum
@@ -0,0 +1,358 @@
+github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
+github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/ClickHouse/ch-go v0.58.2 h1:jSm2szHbT9MCAB1rJ3WuCJqmGLi5UTjlNu+f530UTS0=
+github.com/ClickHouse/ch-go v0.58.2/go.mod h1:Ap/0bEmiLa14gYjCiRkYGbXvbe8vwdrfTYWhsuQ99aw=
+github.com/ClickHouse/clickhouse-go/v2 v2.16.0 h1:rhMfnPewXPnY4Q4lQRGdYuTLRBRKJEIEYHtbUMrzmvI=
+github.com/ClickHouse/clickhouse-go/v2 v2.16.0/go.mod h1:J7SPfIxwR+x4mQ+o8MLSe0oY50NNntEqCIjFe/T1VPM=
+github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
+github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
+github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
+github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
+github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
+github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
+github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI=
+github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
+github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
+github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
+github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
+github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
+github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8=
+github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
+github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg=
+github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
+github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM=
+github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
+github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
+github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
+github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
+github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
+github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
+github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
+github.com/elastic/go-sysinfo v1.11.2 h1:mcm4OSYVMyws6+n2HIVMGkln5HOpo5Ie1ZmbbNn0jg4=
+github.com/elastic/go-sysinfo v1.11.2/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ=
+github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0=
+github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss=
+github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw=
+github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw=
+github.com/go-faster/errors v0.6.1 h1:nNIPOBkprlKzkThvS/0YaX8Zs9KewLCOSFQS5BU06FI=
+github.com/go-faster/errors v0.6.1/go.mod h1:5MGV2/2T9yvlrbhe9pD9LO5Z/2zCSq2T8j+Jpi2LAyY=
+github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
+github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
+github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
+github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
+github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
+github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
+github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
+github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
+github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
+github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
+github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
+github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
+github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
+github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
+github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
+github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
+github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
+github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
+github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
+github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
+github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
+github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA=
+github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE=
+github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s=
+github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o=
+github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY=
+github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
+github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E=
+github.com/jackc/pgconn v1.14.1 h1:smbxIaZA08n6YuxEX1sDyjV/qkbtUtkH20qLkR9MUR4=
+github.com/jackc/pgconn v1.14.1/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E=
+github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
+github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
+github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
+github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c=
+github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc=
+github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak=
+github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
+github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
+github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
+github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
+github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
+github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
+github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
+github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
+github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
+github.com/jackc/pgproto3/v2 v2.3.2 h1:7eY55bdBeCz1F2fTzSz69QC+pG46jYq9/jtSPiJ5nn0=
+github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
+github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
+github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
+github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA=
+github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
+github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg=
+github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc=
+github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw=
+github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM=
+github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
+github.com/jackc/pgtype v1.14.1 h1:LyDar7M2K0tShCWqzJ/ctzF1QC3Wzc9c8a6cHE0PFdc=
+github.com/jackc/pgtype v1.14.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
+github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y=
+github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM=
+github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc=
+github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs=
+github.com/jackc/pgx/v4 v4.18.1 h1:YP7G1KABtKpB5IHrO9vYwSrCOhs7p3uqhvhhQBptya0=
+github.com/jackc/pgx/v4 v4.18.1/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE=
+github.com/jackc/pgx/v5 v5.5.1 h1:5I9etrGkLrN+2XPCsi6XLlV5DITbSL/xBZdmAxFcXPI=
+github.com/jackc/pgx/v5 v5.5.1/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA=
+github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
+github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
+github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
+github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0=
+github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
+github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
+github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
+github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4=
+github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak=
+github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4=
+github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
+github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
+github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4=
+github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
+github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
+github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
+github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
+github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
+github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
+github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
+github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
+github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
+github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
+github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
+github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI=
+github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
+github.com/opencontainers/runc v1.1.10 h1:EaL5WeO9lv9wmS6SASjszOeQdSctvpbu0DdBQBizE40=
+github.com/opencontainers/runc v1.1.10/go.mod h1:+/R6+KmDlh+hOO8NkjmgkG9Qzvypzk0yXxAPYYR65+M=
+github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4=
+github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg=
+github.com/paulmach/orb v0.10.0 h1:guVYVqzxHE/CQ1KpfGO077TR0ATHSNjp4s6XGLn3W9s=
+github.com/paulmach/orb v0.10.0/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU=
+github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ=
+github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pressly/goose/v3 v3.17.0 h1:fT4CL3LRm4kfyLuPWzDFAoxjR5ZHjeJ6uQhibQtBaIs=
+github.com/pressly/goose/v3 v3.17.0/go.mod h1:22aw7NpnCPlS86oqkO/+3+o9FuCaJg4ZVWRUO3oGzHQ=
+github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
+github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
+github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
+github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
+github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
+github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
+github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
+github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
+github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
+github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
+github.com/sethvargo/go-retry v0.2.4 h1:T+jHEQy/zKJf5s95UkguisicE0zuF9y7+/vgz08Ocec=
+github.com/sethvargo/go-retry v0.2.4/go.mod h1:1afjQuvh7s4gflMObvjLPaWgluLLyhA1wmVZ6KLpICw=
+github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
+github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
+github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
+github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
+github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
+github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
+github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
+github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/vertica/vertica-sql-go v1.3.3 h1:fL+FKEAEy5ONmsvya2WH5T8bhkvY27y/Ik3ReR2T+Qw=
+github.com/vertica/vertica-sql-go v1.3.3/go.mod h1:jnn2GFuv+O2Jcjktb7zyc4Utlbu9YVqpHH/lx63+1M4=
+github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
+github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
+github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
+github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
+github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
+github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
+github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd h1:dzWP1Lu+A40W883dK/Mr3xyDSM/2MggS8GtHT0qgAnE=
+github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I=
+github.com/ydb-platform/ydb-go-sdk/v3 v3.54.2 h1:E0yUuuX7UmPxXm92+yQCjMveLFO3zfvYFIJVuAqsVRA=
+github.com/ydb-platform/ydb-go-sdk/v3 v3.54.2/go.mod h1:fjBLQ2TdQNl4bMjuWl9adoTGBypwUTPoGC+EqYqiIcU=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
+go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc=
+go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs=
+go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ=
+go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU=
+go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
+go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
+go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
+go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
+go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
+go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
+go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
+go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
+go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
+go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
+go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
+golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
+golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
+golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
+golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
+golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
+golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
+golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
+golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=
+golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
+golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA=
+google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
+google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
+google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
+google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
+howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
+howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
+lukechampine.com/uint128 v1.3.0 h1:cDdUVfRwDUDovz610ABgFD17nXD4/uDgVHl2sC3+sbo=
+lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
+modernc.org/cc/v3 v3.41.0 h1:QoR1Sn3YWlmA1T4vLaKZfawdVtSiGx8H+cEojbC7v1Q=
+modernc.org/cc/v3 v3.41.0/go.mod h1:Ni4zjJYJ04CDOhG7dn640WGfwBzfE0ecX8TyMB0Fv0Y=
+modernc.org/ccgo/v3 v3.16.15 h1:KbDR3ZAVU+wiLyMESPtbtE/Add4elztFyfsWoNTgxS0=
+modernc.org/ccgo/v3 v3.16.15/go.mod h1:yT7B+/E2m43tmMOT51GMoM98/MtHIcQQSleGnddkUNI=
+modernc.org/libc v1.32.0 h1:yXatHTrACp3WaKNRCoZwUK7qj5V8ep1XyY0ka4oYcNc=
+modernc.org/libc v1.32.0/go.mod h1:YAXkAZ8ktnkCKaN9sw/UDeUVkGYJ/YquGO4FTi5nmHE=
+modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
+modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
+modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E=
+modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E=
+modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
+modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
+modernc.org/sqlite v1.28.0 h1:Zx+LyDDmXczNnEQdvPuEfcFVA2ZPyaD7UCZDjef3BHQ=
+modernc.org/sqlite v1.28.0/go.mod h1:Qxpazz0zH8Z1xCFyi5GSL3FzbtZ3fvbjmywNogldEW0=
+modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
+modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
+modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
+modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
diff --git a/test/integration/migration/main.go b/test/integration/migration/main.go
new file mode 100644
index 0000000..4bc1202
--- /dev/null
+++ b/test/integration/migration/main.go
@@ -0,0 +1,91 @@
+package main
+
+import (
+ "database/sql"
+ "embed"
+ "flag"
+ "log"
+ "strings"
+ "time"
+
+ "github.com/jackc/pgx/v4"
+ "github.com/jackc/pgx/v4/stdlib"
+ "github.com/pkg/errors"
+ "github.com/pressly/goose/v3"
+)
+
+const (
+ statusCmd = "status"
+ upCmd = "up"
+ downCmd = "down"
+)
+
+//go:embed migrations/*.sql
+var embedMigrations embed.FS
+
+func main() {
+ log.Printf("migration start")
+
+ cmd := flag.String("cmd", "status", "goose command")
+ connString := flag.String("url", "", "connection postgres URL")
+ flag.Parse()
+
+ *connString = prepareConnString(*connString)
+
+ connConfig, err := pgx.ParseConfig(*connString)
+ if err != nil {
+ log.Fatal(errors.WithMessage(err, "parse config"))
+ }
+
+ connStr := stdlib.RegisterConnConfig(connConfig)
+ db, err := sql.Open("pgx", connStr)
+ if err != nil {
+ log.Fatal(errors.WithMessage(err, "open db"))
+ }
+
+ if err := retryPing(db, 3, 30*time.Second); err != nil {
+ log.Fatal(errors.WithMessage(err, "ping db"))
+ }
+
+ goose.SetBaseFS(embedMigrations)
+
+ log.Printf("migration start with command '%s' with connection string '%s'", *cmd, *connString)
+
+ switch {
+ case strings.EqualFold(*cmd, statusCmd):
+ err = goose.Status(db, "migrations")
+ case strings.EqualFold(*cmd, upCmd):
+ err = goose.Up(db, "migrations")
+ case strings.EqualFold(*cmd, downCmd):
+ err = goose.Down(db, "migrations")
+ default:
+ log.Fatal("cmd is not fit for 'goose'")
+ }
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ log.Println("migration finished")
+}
+
+//goland:noinspection SpellCheckingInspection
+func retryPing(db *sql.DB, retries int, timeout time.Duration) error {
+ for i := 1; i <= retries; i++ {
+ if err := db.Ping(); err != nil {
+ log.Printf("%d ping DB error: %v", i, err)
+ time.Sleep(timeout)
+ continue
+ }
+ return nil
+ }
+ return errors.New("DB unreacheble")
+}
+
+func prepareConnString(connString string) string {
+ const prefix = "postgresql://"
+ if strings.Index(connString, prefix) == 0 {
+ return connString
+ }
+ connString = prefix + connString
+ return connString
+}
diff --git a/test/integration/migration/migrations/001_init_test_table.sql b/test/integration/migration/migrations/001_init_test_table.sql
new file mode 100644
index 0000000..105dedb
--- /dev/null
+++ b/test/integration/migration/migrations/001_init_test_table.sql
@@ -0,0 +1,26 @@
+-- +goose Up
+CREATE TABLE IF NOT EXISTS gorm
+(
+ val text NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS pgx
+(
+ val text NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS sqlx
+(
+ val text NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS stdlib
+(
+ val text NOT NULL
+);
+
+-- +goose Down
+DROP TABLE IF EXISTS gorm;
+DROP TABLE IF EXISTS pgx;
+DROP TABLE IF EXISTS sqlx;
+DROP TABLE IF EXISTS stdlib;