diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 6c327e0..ed0435c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -112,30 +112,40 @@ jobs: - name: Tests with real databases run: make test.coverage.with_real_db - - name: Code coverage data - run: | - set -x - COVERAGE_TOTAL=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` - echo "COVERAGE_TOTAL=$COVERAGE_TOTAL" >> $GITHUB_ENV - - uses: jandelgado/gcov2lcov-action@v1.0.9 - with: - outfile: ./coverage.lcov - - name: Coveralls - uses: coverallsapp/github-action@master + uses: coverallsapp/github-action@v2 with: - path-to-lcov: ./coverage.lcov + format: golang + file: ./coverage.out github-token: ${{ secrets.GITHUB_TOKEN }} - golangci: - name: lint + # https://github.com/golangci/golangci-lint/issues/828 + generate-pkgs-matrix: runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Fetch Repository + uses: actions/checkout@v4 + - id: set-matrix + run: | + DIRECTORIES=$(find . -not -path "*/vendor/*" -type f -name go.mod -exec sh -c 'echo $(dirname {})' \; | jq -R -s -c 'split("\n")[:-1]') + echo "matrix=${DIRECTORIES}" >> $GITHUB_OUTPUT + + lint: + needs: generate-pkgs-matrix + runs-on: ubuntu-latest + strategy: + matrix: + modules: ${{fromJson(needs.generate-pkgs-matrix.outputs.matrix)}} steps: - - uses: actions/setup-go@v3 + - name: Fetch Repository + uses: actions/checkout@v4 + - uses: actions/setup-go@v4 with: go-version: ${{ env.GO_TARGET_VERSION }} - - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: args: --timeout=3m -v + working-directory: ${{ matrix.modules }} diff --git a/.gitignore b/.gitignore index 3bb6dc3..6e206e7 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ vendor/ # Code coverage coverage.* +coverage/ diff --git a/.golangci.yml b/.golangci.yml index 177a71f..db3db84 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,3 @@ -linters-settings: - enable-all: true - run: skip-dirs: - trm/mock @@ -68,9 +65,6 @@ linters: issues: exclude-use-default: false - errcheck: - check-type-assertions: true - check-blank: true exclude: - ST1000 # ST1000: at least one file in a package should have a package comment exclude-rules: @@ -95,14 +89,14 @@ issues: linters: - staticcheck text: "SA1029: should not use built-in type string as key for value; define your own type to avoid collisions" - - path: .+/context\.go + - path: (.+/)?context\.go linters: - ireturn - - path: .+/transaction\.go + - path: (.+/)?transaction\.go linters: - ireturn source: \) Begin\(ctx - - path: .+/settings\.go + - path: (.+/)?settings\.go linters: - ireturn source: "(?:EnrichBy|SetPropagation|SetCtxKey|CtxKey|SetCancelable|SetTimeout)" @@ -110,13 +104,13 @@ issues: - gochecknoglobals source: "DefaultCtxGetter" - &internal_text - path: ^internal + path: (^trm/internal|^internal) text: "var-naming: don't use an underscore in package name" - <<: *internal_text text: "package-comments: should have a package comment" - <<: *internal_text text: "ST1003: should not use underscores in package names" - - path: (_test\.go|^internal) + - path: (_test\.go|^trm/internal|^internal) linters: - funlen - gochecknoglobals diff --git a/Makefile b/Makefile index 549c51c..b2e402b 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,58 @@ -CVPKG=go list ./... | grep -v mocks | grep -v internal/ -GO_TEST=go test `$(CVPKG)` -race -GO_TEST_WITH_REAL_DB=$(GO_TEST) --tags=with_real_db -COVERAGE_FILE="coverage.out" +DIR=$(PWD) + +GO_TEST=cd ./sh && bash ./go.test.sh +GO_TEST_COVERAGE=cd ./sh && bash ./go.test.coverage.sh + +GO_TEST_WITH_REAL_DB=--tags=with_real_db test: $(GO_TEST) test.with_real_db: - $(GO_TEST_WITH_REAL_DB) + $(GO_TEST) $(GO_TEST_WITH_REAL_DB) test.coverage: - $(GO_TEST) -covermode=atomic -coverprofile=$(COVERAGE_FILE) + $(GO_TEST_COVERAGE) test.coverage.with_real_db: - $(GO_TEST_WITH_REAL_DB) -covermode=atomic -coverprofile=$(COVERAGE_FILE) + $(GO_TEST_COVERAGE) $(GO_TEST_WITH_REAL_DB) fmt: - go fmt ./... + cd sh && sh ./go.fmt.sh lint: - golangci-lint run -v --timeout=2m + cd sh && sh ./lint.sh + +lint.verbose: + cd sh && sh ./lint.sh -v + +lint.cache.clean: + golangci-lint cache clean generate: go generate ./... + +go.mod.tidy: + cd sh && sh ./go.mod.tidy.sh + +go.mod.vendor: + cd sh && sh ./go.mod.vendor.sh + +go.work.sync: + go work sync + + +tag: git.tag tag.pkg + +tag.pkg: + cd sh && sh ./tag.pkg.sh $(version) + +git.tag: git.tag.create git.tag.push + +# 1.0, "v2." added automatically +# make git.tag version="0.0-rc1" +git.tag.create: + cd sh && sh ./git.tag.sh $(version) + +git.tag.push: + git push origin --tags diff --git a/README.md b/README.md index 344b13e..c783c62 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Go transaction manager -[![Go Reference](https://pkg.go.dev/badge/github.com/avito-tech/go-transaction-manager.svg)](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager) +[![Go Reference](https://pkg.go.dev/badge/github.com/avito-tech/go-transaction-manager.svg)](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/trm/v2) [![Test Status](https://github.com/avito-tech/go-transaction-manager/actions/workflows/main.yaml/badge.svg)](https://github.com/avito-tech/go-transaction-manager/actions?query=branch%3Amain) [![Coverage Status](https://coveralls.io/repos/github/avito-tech/go-transaction-manager/badge.svg?branch=main)](https://coveralls.io/github/avito-tech/go-transaction-manager?branch=main) -[![Go Report Card](https://goreportcard.com/badge/github.com/avito-tech/go-transaction-manager)](https://goreportcard.com/report/github.com/avito-tech/go-transaction-manager) +[![Go Report Card](https://goreportcard.com/badge/github.com/avito-tech/go-transaction-manager)](https://goreportcard.com/report/github.com/avito-tech/go-transaction-manager/) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) Transaction manager is an abstraction to coordinate database transaction boundaries. @@ -12,20 +12,31 @@ Easiest way to get the perfect repository. ## Supported implementations -* [database/sql](https://pkg.go.dev/database/sql), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/sql) (Go 1.13) -* [jmoiron/sqlx](https://github.com/jmoiron/sqlx), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/sqlx) (Go 1.13) -* [gorm](https://github.com/go-gorm/gorm), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/gorm) (Go 1.16) -* [mongo-go-driver](https://github.com/mongodb/mongo-go-driver), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/mongo) (Go 1.13) -* [go-redis/redis](https://github.com/go-redis/redis), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/redis) (Go 1.17) -* [pgx_v4](https://github.com/jackc/pgx/tree/v4), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/pgxv4) (Go 1.16) -* [pgx_v5](https://github.com/jackc/pgx), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/pgxv5) (Go 1.19) +* [database/sql](https://pkg.go.dev/database/sql), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/drivers/sql/v2) ( + Go 1.13) +* [jmoiron/sqlx](https://github.com/jmoiron/sqlx), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2) ( + Go 1.13) +* [gorm](https://github.com/go-gorm/gorm), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/drivers/gorm/v2) ( + Go 1.18) +* [mongo-go-driver](https://github.com/mongodb/mongo-go-driver), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/drivers/mongo/v2) ( + Go 1.13) +* [go-redis/redis](https://github.com/go-redis/redis), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/drivers/goredis8/v2) ( + Go 1.17) +* [pgx_v4](https://github.com/jackc/pgx/tree/v4), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/drivers/pgxv4/v2) ( + Go 1.16) +* [pgx_v5](https://github.com/jackc/pgx), [docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/drivers/pgxv5/v2) ( + Go 1.19) ## Installation ```bash -go get github.com/avito-tech/go-transaction-manager +go get github.com/avito-tech/go-transaction-manager/trm/v2 ``` +To install some support database use `go get github.com/avito-tech/go-transaction-manager/drivers/{name}`. + +For example `go get github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2`. + ### Backwards Compatibility The library is compatible with the most recent two versions of Go. @@ -33,24 +44,24 @@ Compatibility beyond that is not guaranteed. ## Usage -**To use multiple transactions from different databases**, you need to set CtxKey in [Settings](trm/settings.go) by [WithCtxKey](trm/settings/option.go). +**To use multiple transactions from different databases**, you need to set CtxKey in [Settings](trm/settings.go) +by [WithCtxKey](trm/settings/option.go) ([docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/trm/v2)). -**For nested transactions with different transaction managers**, you need to use [ChainedMW](trm/manager/chain.go) ([docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/trm/manager)). +**For nested transactions with different transaction managers**, you need to use [ChainedMW](trm/manager/chain.go) ([docs](https://pkg.go.dev/github.com/avito-tech/go-transaction-manager/trm/v2/manager)). -**To skip a transaction rollback due to an error, use [ErrSkip](trm/manager.go#L20) or [Skippable](trm/manager.go#L24)** +**To skip a transaction rollback due to an error, use [ErrSkip](manager.go#L20) or [Skippable](manager.go#L24)** -### Explanation of the approach ([English](https://www.youtube.com/watch?v=aRsea6FFAyA), [Russian](https://habr.com/ru/companies/avito/articles/727168/)) +### Explanation of the approach [English](https://www.youtube.com/watch?v=aRsea6FFAyA), Russian [article](https://habr.com/ru/companies/avito/articles/727168/) and [youtube](https://www.youtube.com/watch?v=fcdckM5sUxA). ### Examples with an ideal *repository* and nested transactions. -* [database/sql](sql/example_test.go) -* [jmoiron/sqlx](sqlx/example_test.go) -* [gorm](gorm/example_test.go) -* [mongo-go-driver](mongo/example_test.go) -* [go-redis/redis](redis/example_test.go) -* [pgx_v4](pgxv4/example_test.go) -* [pgx_v5](pgxv5/example_test.go) - +* [database/sql](drivers/sql/example_test.go) +* [jmoiron/sqlx](drivers/sqlx/example_test.go) +* [gorm](drivers/gorm/example_test.go) +* [mongo-go-driver](drivers/mongo/example_test.go) +* [go-redis/redis](drivers/goredis8/example_test.go) +* [pgx_v4](drivers/pgxv4/example_test.go) +* [pgx_v5](drivers/pgxv5/example_test.go) Below is an example how to start usage. @@ -64,8 +75,8 @@ import ( "github.com/jmoiron/sqlx" _ "github.com/mattn/go-sqlite3" - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" - "github.com/avito-tech/go-transaction-manager/trm/manager" + trmsqlx "github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) func main() { @@ -85,6 +96,7 @@ func main() { err = trManager.Do(ctx, func(ctx context.Context) error { checkErr(r.Save(ctx, u)) + // example of nested transactions return trManager.Do(ctx, func(ctx context.Context) error { u.Username = "new_username" return r.Save(ctx, u) @@ -146,4 +158,12 @@ func (r *repo) Save(ctx context.Context, u *user) error { ## Benchmark -[Comparing](internal/benchmark/with_or_without_trm/README.md) examples with and without trm. +[Comparing](trm/internal/benchmark/with_or_without_trm/README.md) examples with and without trm. + +## Contribution + +1. To local development sync dependencies use `make go.work.sync`. +2. After finalizing of changes bump up version in all drivers. + +* To install all dependencies use `make go.mod.tidy` or `make go.mod.vendor`. +* To run all tests use `make go.test` or `make go.test.with_real_db` for integration tests. diff --git a/redis/context.go b/drivers/goredis8/context.go similarity index 71% rename from redis/context.go rename to drivers/goredis8/context.go index 3084007..d1fc01c 100644 --- a/redis/context.go +++ b/drivers/goredis8/context.go @@ -1,18 +1,18 @@ -package redis +package goredis8 import ( "context" "github.com/go-redis/redis/v8" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" + "github.com/avito-tech/go-transaction-manager/trm/v2" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" ) // DefaultCtxGetter is the CtxGetter with settings.DefaultCtxKey. var DefaultCtxGetter = NewCtxGetter(trmcontext.DefaultManager) -// CtxGetter gets redis.Pipeliner from trm.СtxManager by casting trm.Transaction to redis.UniversalClient. +// CtxGetter gets goredis8.Pipeliner from trm.СtxManager by casting trm.Transaction to redis.UniversalClient. type CtxGetter struct { ctxManager trm.СtxManager } @@ -22,7 +22,7 @@ func NewCtxGetter(c trm.СtxManager) *CtxGetter { return &CtxGetter{ctxManager: c} } -// DefaultTrOrDB returns Cmdable from context.Context or DB(redis.Cmdable) otherwise. +// DefaultTrOrDB returns Cmdable from context.Context or DB(goredis8.Cmdable) otherwise. func (c *CtxGetter) DefaultTrOrDB(ctx context.Context, db redis.Cmdable) redis.Cmdable { if tr := c.ctxManager.Default(ctx); tr != nil { return c.convert(tr) @@ -31,7 +31,7 @@ func (c *CtxGetter) DefaultTrOrDB(ctx context.Context, db redis.Cmdable) redis.C return db } -// TrOrDB returns Cmdable from context.Context by trm.CtxKey or DB(redis.Cmdable) otherwise. +// TrOrDB returns Cmdable from context.Context by trm.CtxKey or DB(goredis8.Cmdable) otherwise. func (c *CtxGetter) TrOrDB(ctx context.Context, key trm.CtxKey, db redis.Cmdable) redis.Cmdable { if tr := c.ctxManager.ByKey(ctx, key); tr != nil { return c.convert(tr) diff --git a/redis/example_test.go b/drivers/goredis8/example_test.go similarity index 91% rename from redis/example_test.go rename to drivers/goredis8/example_test.go index f4f5a90..8a6f9d4 100644 --- a/redis/example_test.go +++ b/drivers/goredis8/example_test.go @@ -1,7 +1,7 @@ //go:build with_real_db // +build with_real_db -package redis_test +package goredis8_test import ( "context" @@ -10,10 +10,11 @@ import ( "github.com/go-redis/redis/v8" - trmredis "github.com/avito-tech/go-transaction-manager/redis" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + trmredis "github.com/avito-tech/go-transaction-manager/drivers/goredis8/v2" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) // Example demonstrates the implementation of the Repository pattern by trm.Manager. diff --git a/redis/factory.go b/drivers/goredis8/factory.go similarity index 82% rename from redis/factory.go rename to drivers/goredis8/factory.go index 714799e..00b2b05 100644 --- a/redis/factory.go +++ b/drivers/goredis8/factory.go @@ -1,11 +1,11 @@ -package redis +package goredis8 import ( "context" "github.com/go-redis/redis/v8" - "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" ) // NewDefaultFactory creates default trm.Transaction(redis.UniversalClient). diff --git a/drivers/goredis8/go.mod b/drivers/goredis8/go.mod new file mode 100644 index 0000000..4da1d63 --- /dev/null +++ b/drivers/goredis8/go.mod @@ -0,0 +1,14 @@ +module github.com/avito-tech/go-transaction-manager/drivers/goredis8/v2 + +go 1.14 + +require ( + github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 + github.com/go-redis/redis/v8 v8.11.5 + github.com/go-redis/redismock/v8 v8.11.5 + github.com/kr/pretty v0.3.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/stretchr/testify v1.8.2 + golang.org/x/net v0.10.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect +) diff --git a/internal/example/habr/finished/go.sum b/drivers/goredis8/go.sum similarity index 69% rename from internal/example/habr/finished/go.sum rename to drivers/goredis8/go.sum index 15dd76c..2f6e2a2 100644 --- a/internal/example/habr/finished/go.sum +++ b/drivers/goredis8/go.sum @@ -1,23 +1,25 @@ -github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= -github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/avito-tech/go-transaction-manager v1.2.1 h1:E1e7jkAr3Ng2eKTl8RiUEGZrc52r7T9MHSpLrWlxUII= -github.com/avito-tech/go-transaction-manager v1.2.1/go.mod h1:7U3IXmoi/YiuGVLZQIEinTQhm2OD2ED3P8i9PLiaLL8= +github.com/DATA-DOG/go-sqlmock v1.5.1/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 h1:4/jYpusMcFLlMI2cz0fXPxK959A6kIMrwCwyjqvpthM= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6/go.mod h1:efBmVaj9GiucjXsVk7rIwgWXsfoS+1XJqLF9g4TKKZE= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +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/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= +github.com/go-redis/redismock/v8 v8.11.5 h1:RJFIiua58hrBrSpXhnGX3on79AU3S271H4ZhRI1wyVo= github.com/go-redis/redismock/v8 v8.11.5/go.mod h1:UaAU9dEe1C+eGr+FHV5prCWIt0hafyPWbGMEWE0UWdA= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= -github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= @@ -29,82 +31,63 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= -github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= +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/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= -github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ= github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= -github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8AyFNU9d0= -github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= -github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= -github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= -github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= -github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= -github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= -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/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +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.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.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= -github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.mongodb.org/mongo-driver v1.11.3/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= @@ -113,13 +96,11 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 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= @@ -128,18 +109,16 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/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.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -155,33 +134,33 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/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.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/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.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -190,21 +169,21 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.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/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/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= -gorm.io/driver/mysql v1.4.7/go.mod h1:SxzItlnT1cb6e1e4ZRpgJN2VYtcqJgqnHxWr4wsP8oc= -gorm.io/driver/sqlite v1.4.4/go.mod h1:0Aq3iPO+v9ZKbcdiz8gLWRw5VOPcBOPUQJFLq5e2ecI= -gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= -gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= -gorm.io/gorm v1.24.6/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= diff --git a/redis/option.go b/drivers/goredis8/option.go similarity index 98% rename from redis/option.go rename to drivers/goredis8/option.go index 2ebc3a4..b302117 100644 --- a/redis/option.go +++ b/drivers/goredis8/option.go @@ -1,4 +1,4 @@ -package redis +package goredis8 import "github.com/go-redis/redis/v8" diff --git a/redis/readonly_func_without_tx.go b/drivers/goredis8/readonly_func_without_tx.go similarity index 99% rename from redis/readonly_func_without_tx.go rename to drivers/goredis8/readonly_func_without_tx.go index 3acc3fd..f6c71ae 100644 --- a/redis/readonly_func_without_tx.go +++ b/drivers/goredis8/readonly_func_without_tx.go @@ -1,4 +1,4 @@ -package redis +package goredis8 import ( "context" diff --git a/redis/readonly_func_without_tx_test.go b/drivers/goredis8/readonly_func_without_tx_test.go similarity index 99% rename from redis/readonly_func_without_tx_test.go rename to drivers/goredis8/readonly_func_without_tx_test.go index a069285..a736603 100644 --- a/redis/readonly_func_without_tx_test.go +++ b/drivers/goredis8/readonly_func_without_tx_test.go @@ -1,7 +1,4 @@ -//go:build go1.14 -// +build go1.14 - -package redis +package goredis8 import ( "context" diff --git a/redis/settings.go b/drivers/goredis8/settings.go similarity index 97% rename from redis/settings.go rename to drivers/goredis8/settings.go index f834c60..a79e45e 100644 --- a/redis/settings.go +++ b/drivers/goredis8/settings.go @@ -1,9 +1,9 @@ -package redis +package goredis8 import ( "github.com/go-redis/redis/v8" - "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" ) const ( diff --git a/redis/transaction.go b/drivers/goredis8/transaction.go similarity index 94% rename from redis/transaction.go rename to drivers/goredis8/transaction.go index c296829..b9ada9e 100644 --- a/redis/transaction.go +++ b/drivers/goredis8/transaction.go @@ -1,5 +1,5 @@ -// Package redis is an implementation of trm.Transaction interface by Transaction for redis.UniversalClient. -package redis +// Package goredis8 is an implementation of trm.Transaction interface by Transaction for redis.UniversalClient. +package goredis8 import ( "context" diff --git a/redis/transaction_test.go b/drivers/goredis8/transaction_test.go similarity index 91% rename from redis/transaction_test.go rename to drivers/goredis8/transaction_test.go index 5452f87..4d90d27 100644 --- a/redis/transaction_test.go +++ b/drivers/goredis8/transaction_test.go @@ -1,7 +1,4 @@ -//go:build go1.14 -// +build go1.14 - -package redis +package goredis8 import ( "context" @@ -14,11 +11,15 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/avito-tech/go-transaction-manager/internal/mock" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2/mock" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" + + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) const OK = "OK" diff --git a/redis/watcher.go b/drivers/goredis8/watcher.go similarity index 97% rename from redis/watcher.go rename to drivers/goredis8/watcher.go index 25ed8c2..8d6ffee 100644 --- a/redis/watcher.go +++ b/drivers/goredis8/watcher.go @@ -1,4 +1,4 @@ -package redis +package goredis8 import ( "context" diff --git a/redis/watcher_test.go b/drivers/goredis8/watcher_test.go similarity index 86% rename from redis/watcher_test.go rename to drivers/goredis8/watcher_test.go index 30e5ffd..8a515df 100644 --- a/redis/watcher_test.go +++ b/drivers/goredis8/watcher_test.go @@ -1,7 +1,7 @@ //go:build with_real_db // +build with_real_db -package redis_test +package goredis8_test import ( "context" @@ -10,10 +10,11 @@ import ( "github.com/go-redis/redis/v8" - trmredis "github.com/avito-tech/go-transaction-manager/redis" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + trmredis "github.com/avito-tech/go-transaction-manager/drivers/goredis8/v2" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) // Example demonstrates the watching of updated keys. diff --git a/gorm/context.go b/drivers/gorm/context.go similarity index 87% rename from gorm/context.go rename to drivers/gorm/context.go index 6bcf5b8..911ad9c 100644 --- a/gorm/context.go +++ b/drivers/gorm/context.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - package gorm import ( @@ -8,8 +5,8 @@ import ( "gorm.io/gorm" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" + "github.com/avito-tech/go-transaction-manager/trm/v2" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" ) // DefaultCtxGetter is the CtxGetter with settings.DefaultCtxKey. diff --git a/gorm/example_test.go b/drivers/gorm/example_test.go similarity index 86% rename from gorm/example_test.go rename to drivers/gorm/example_test.go index be97dac..742a70b 100644 --- a/gorm/example_test.go +++ b/drivers/gorm/example_test.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - package gorm_test import ( @@ -11,15 +8,16 @@ import ( "gorm.io/driver/sqlite" "gorm.io/gorm" - trmgorm "github.com/avito-tech/go-transaction-manager/gorm" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + trmgorm "github.com/avito-tech/go-transaction-manager/drivers/gorm/v2" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) // Example demonstrates the implementation of the Repository pattern by trm.Manager. func Example() { - db, err := gorm.Open(sqlite.Open("file:test.db?mode=memory")) + db, err := gorm.Open(sqlite.Open("file:test.drivers?mode=memory")) checkErr(err) // Migrate the schema diff --git a/gorm/factory.go b/drivers/gorm/factory.go similarity index 79% rename from gorm/factory.go rename to drivers/gorm/factory.go index 2af6348..f108276 100644 --- a/gorm/factory.go +++ b/drivers/gorm/factory.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - package gorm import ( @@ -8,7 +5,7 @@ import ( "gorm.io/gorm" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // NewDefaultFactory creates default trm.Transaction(sqlx.Tx). diff --git a/drivers/gorm/go.mod b/drivers/gorm/go.mod new file mode 100644 index 0000000..1ef572e --- /dev/null +++ b/drivers/gorm/go.mod @@ -0,0 +1,28 @@ +module github.com/avito-tech/go-transaction-manager/drivers/gorm/v2 + +go 1.18 + +require ( + github.com/DATA-DOG/go-sqlmock v1.5.1 + github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 + github.com/mattn/go-sqlite3 v1.14.18 + github.com/stretchr/testify v1.8.2 + gorm.io/driver/mysql v1.5.2 + gorm.io/driver/sqlite v1.5.4 + gorm.io/gorm v1.25.5 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/kr/pretty v0.3.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/drivers/gorm/go.sum b/drivers/gorm/go.sum new file mode 100644 index 0000000..8e33f58 --- /dev/null +++ b/drivers/gorm/go.sum @@ -0,0 +1,88 @@ +github.com/DATA-DOG/go-sqlmock v1.5.1 h1:FK6RCIUSfmbnI/imIICmboyQBkOckutaa6R5YYlLZyo= +github.com/DATA-DOG/go-sqlmock v1.5.1/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 h1:4/jYpusMcFLlMI2cz0fXPxK959A6kIMrwCwyjqvpthM= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6/go.mod h1:efBmVaj9GiucjXsVk7rIwgWXsfoS+1XJqLF9g4TKKZE= +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.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +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/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.18 h1:JL0eqdCOq6DJVNPSvArO/bIV9/P7fbGrV00LZHc+5aI= +github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +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.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +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.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.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.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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +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= +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/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +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/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs= +gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8= +gorm.io/driver/sqlite v1.5.4 h1:IqXwXi8M/ZlPzH/947tn5uik3aYQslP9BVveoax0nV0= +gorm.io/driver/sqlite v1.5.4/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= +gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= diff --git a/gorm/settings.go b/drivers/gorm/settings.go similarity index 93% rename from gorm/settings.go rename to drivers/gorm/settings.go index a649978..bd96a0d 100644 --- a/gorm/settings.go +++ b/drivers/gorm/settings.go @@ -1,12 +1,9 @@ -//go:build go1.16 -// +build go1.16 - package gorm import ( "database/sql" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Opt is a type to configure Settings. diff --git a/gorm/settings_test.go b/drivers/gorm/settings_test.go similarity index 91% rename from gorm/settings_test.go rename to drivers/gorm/settings_test.go index 1ee5b5d..2d351bd 100644 --- a/gorm/settings_test.go +++ b/drivers/gorm/settings_test.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - package gorm import ( @@ -9,8 +6,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) func TestSettings_EnrichBy(t *testing.T) { diff --git a/gorm/transaction.go b/drivers/gorm/transaction.go similarity index 96% rename from gorm/transaction.go rename to drivers/gorm/transaction.go index 18693e8..fa7b8bf 100644 --- a/gorm/transaction.go +++ b/drivers/gorm/transaction.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - // Package gorm is an implementation of trm.Transaction interface by Transaction for *gorm.DB. package gorm @@ -13,7 +10,7 @@ import ( "gorm.io/gorm" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) var errRollbackTx = errors.New("rollback transaction") diff --git a/gorm/transaction_test.go b/drivers/gorm/transaction_test.go similarity index 93% rename from gorm/transaction_test.go rename to drivers/gorm/transaction_test.go index 57a99bc..fe96eb3 100644 --- a/gorm/transaction_test.go +++ b/drivers/gorm/transaction_test.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - package gorm import ( @@ -17,11 +14,15 @@ import ( "gorm.io/driver/sqlite" "gorm.io/gorm" - "github.com/avito-tech/go-transaction-manager/internal/mock" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2/mock" + + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" + + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) func TestTransaction(t *testing.T) { diff --git a/mongo/contract.go b/drivers/mongo/contract.go similarity index 100% rename from mongo/contract.go rename to drivers/mongo/contract.go diff --git a/mongo/example_test.go b/drivers/mongo/example_test.go similarity index 85% rename from mongo/example_test.go rename to drivers/mongo/example_test.go index 425dc75..ef9d9d7 100644 --- a/mongo/example_test.go +++ b/drivers/mongo/example_test.go @@ -12,21 +12,20 @@ import ( "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" - trmmongo "github.com/avito-tech/go-transaction-manager/mongo" - trmsql "github.com/avito-tech/go-transaction-manager/sql" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + + trmmongo "github.com/avito-tech/go-transaction-manager/drivers/mongo/v2" + trmsql "github.com/avito-tech/go-transaction-manager/drivers/sql/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) // Example demonstrates the implementation of the Repository pattern by trm.Manager. func Example() { - client, err := mongo.NewClient(options.Client(). - ApplyURI("mongodb://127.0.0.1:27017")) - checkErr(err) - ctx := context.Background() - checkErr(client.Connect(ctx)) + client, err := mongo.Connect(ctx, options.Client(). + ApplyURI("mongodb://127.0.0.1:27017")) + checkErr(err) collection := client.Database("test").Collection("users") diff --git a/mongo/factory.go b/drivers/mongo/factory.go similarity index 86% rename from mongo/factory.go rename to drivers/mongo/factory.go index 5426a61..5377d60 100644 --- a/mongo/factory.go +++ b/drivers/mongo/factory.go @@ -3,7 +3,7 @@ package mongo import ( "context" - "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" ) // NewDefaultFactory creates default trm.Transaction(mongo.Session). diff --git a/drivers/mongo/go.mod b/drivers/mongo/go.mod new file mode 100644 index 0000000..5384640 --- /dev/null +++ b/drivers/mongo/go.mod @@ -0,0 +1,16 @@ +module github.com/avito-tech/go-transaction-manager/drivers/mongo/v2 + +go 1.13 + +require ( + github.com/avito-tech/go-transaction-manager/drivers/sql/v2 v2.0.0-rc6 + github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 + github.com/google/go-cmp v0.5.5 // indirect + github.com/kr/pretty v0.3.0 // indirect + github.com/mattn/go-sqlite3 v1.14.18 + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/stretchr/testify v1.8.2 + go.mongodb.org/mongo-driver v1.13.1 + golang.org/x/crypto v0.9.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect +) diff --git a/drivers/mongo/go.sum b/drivers/mongo/go.sum new file mode 100644 index 0000000..d33a971 --- /dev/null +++ b/drivers/mongo/go.sum @@ -0,0 +1,131 @@ +github.com/DATA-DOG/go-sqlmock v1.5.1 h1:FK6RCIUSfmbnI/imIICmboyQBkOckutaa6R5YYlLZyo= +github.com/DATA-DOG/go-sqlmock v1.5.1/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= +github.com/avito-tech/go-transaction-manager/drivers/sql/v2 v2.0.0-rc6 h1:aLd6YRH0sAW5ev/Y4EZ6e1s9ZvhAJEoWZNvDTt9760E= +github.com/avito-tech/go-transaction-manager/drivers/sql/v2 v2.0.0-rc6/go.mod h1:00Cif8xUIQfAtpQ5cuPt9T9dDNJ9bGcY9ev/JpcR0tc= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 h1:4/jYpusMcFLlMI2cz0fXPxK959A6kIMrwCwyjqvpthM= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6/go.mod h1:efBmVaj9GiucjXsVk7rIwgWXsfoS+1XJqLF9g4TKKZE= +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/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.18 h1:JL0eqdCOq6DJVNPSvArO/bIV9/P7fbGrV00LZHc+5aI= +github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +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.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +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.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.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.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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= +go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +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-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +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.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/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.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/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.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +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/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +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/mongo/settings.go b/drivers/mongo/settings.go similarity index 97% rename from mongo/settings.go rename to drivers/mongo/settings.go index c22ef62..9d266fa 100644 --- a/mongo/settings.go +++ b/drivers/mongo/settings.go @@ -3,7 +3,7 @@ package mongo import ( "go.mongodb.org/mongo-driver/mongo/options" - "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Opt is a type to configure Settings. diff --git a/mongo/settings_test.go b/drivers/mongo/settings_test.go similarity index 95% rename from mongo/settings_test.go rename to drivers/mongo/settings_test.go index de299a1..c39cbcf 100644 --- a/mongo/settings_test.go +++ b/drivers/mongo/settings_test.go @@ -7,8 +7,8 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/readconcern" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) func TestSettings_EnrichBy(t *testing.T) { diff --git a/mongo/transaction.go b/drivers/mongo/transaction.go similarity index 100% rename from mongo/transaction.go rename to drivers/mongo/transaction.go diff --git a/mongo/transaction_test.go b/drivers/mongo/transaction_test.go similarity index 93% rename from mongo/transaction_test.go rename to drivers/mongo/transaction_test.go index 9ac9d34..54724be 100644 --- a/mongo/transaction_test.go +++ b/drivers/mongo/transaction_test.go @@ -15,11 +15,12 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/writeconcern" - "github.com/avito-tech/go-transaction-manager/internal/mock" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" + "github.com/avito-tech/go-transaction-manager/trm/v2/mock" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) type user struct { @@ -53,7 +54,6 @@ func TestTransaction(t *testing.T) { t, mtest.NewOptions().ClientType(mtest.Mock), ) - defer mt.Close() tests := map[string]struct { fields func(mt *mtest.T) fields @@ -199,7 +199,6 @@ func TestTransaction_awaitDone(t *testing.T) { ClientType(mtest.Mock). ShareClient(true), ) - defer mt.Close() wg := sync.WaitGroup{} wg.Add(1) diff --git a/pgxv4/context.go b/drivers/pgxv4/context.go similarity index 86% rename from pgxv4/context.go rename to drivers/pgxv4/context.go index bcb4f0b..2b09f59 100644 --- a/pgxv4/context.go +++ b/drivers/pgxv4/context.go @@ -1,13 +1,10 @@ -//go:build go1.16 -// +build go1.16 - package pgxv4 import ( "context" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" + "github.com/avito-tech/go-transaction-manager/trm/v2" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" ) // DefaultCtxGetter is the CtxGetter with settings.DefaultCtxKey. diff --git a/pgxv4/contract.go b/drivers/pgxv4/contract.go similarity index 97% rename from pgxv4/contract.go rename to drivers/pgxv4/contract.go index fdf7f08..90929b7 100644 --- a/pgxv4/contract.go +++ b/drivers/pgxv4/contract.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - // Package pgxv4 is an implementation of trm.Transaction interface by Transaction for pgx.Tx. package pgxv4 diff --git a/pgxv4/example_test.go b/drivers/pgxv4/example_test.go similarity index 91% rename from pgxv4/example_test.go rename to drivers/pgxv4/example_test.go index 70b4d24..0bf1dd7 100644 --- a/pgxv4/example_test.go +++ b/drivers/pgxv4/example_test.go @@ -9,8 +9,9 @@ import ( "github.com/jackc/pgx/v4/pgxpool" - trmpgx "github.com/avito-tech/go-transaction-manager/pgxv4" - "github.com/avito-tech/go-transaction-manager/trm/manager" + trmpgx "github.com/avito-tech/go-transaction-manager/drivers/pgxv4/v2" + + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) // Example demonstrates the implementation of the Repository pattern by trm.Manager. @@ -26,7 +27,7 @@ func Example() { defer pool.Close() - sqlStmt := `CREATE TABLE IF NOT EXISTS users_v4 (user_id serial, username TEXT)` + sqlStmt := `CREATE TABLE IF NOT EXISTS users_v4 (user_id SERIAL, username TEXT)` _, err = pool.Exec(ctx, sqlStmt) checkErr(err, sqlStmt) diff --git a/pgxv4/factory.go b/drivers/pgxv4/factory.go similarity index 83% rename from pgxv4/factory.go rename to drivers/pgxv4/factory.go index 687b076..a131ba0 100644 --- a/pgxv4/factory.go +++ b/drivers/pgxv4/factory.go @@ -1,12 +1,9 @@ -//go:build go1.16 -// +build go1.16 - package pgxv4 import ( "context" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // NewDefaultFactory creates default trm.Transaction(pgx.Tx). diff --git a/drivers/pgxv4/go.mod b/drivers/pgxv4/go.mod new file mode 100644 index 0000000..91331d8 --- /dev/null +++ b/drivers/pgxv4/go.mod @@ -0,0 +1,15 @@ +module github.com/avito-tech/go-transaction-manager/drivers/pgxv4/v2 + +go 1.16 + +require ( + github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 + github.com/jackc/pgconn v1.14.1 + github.com/jackc/pgx/v4 v4.18.1 + github.com/kr/pretty v0.3.0 // indirect + github.com/pashagolub/pgxmock v1.8.0 + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/stretchr/testify v1.8.2 + golang.org/x/crypto v0.9.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect +) diff --git a/go.sum b/drivers/pgxv4/go.sum similarity index 60% rename from go.sum rename to drivers/pgxv4/go.sum index 0a68cf4..4423308 100644 --- a/go.sum +++ b/drivers/pgxv4/go.sum @@ -1,13 +1,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DATA-DOG/go-sqlmock v1.5.1 h1:FK6RCIUSfmbnI/imIICmboyQBkOckutaa6R5YYlLZyo= github.com/DATA-DOG/go-sqlmock v1.5.1/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= -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/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 h1:4/jYpusMcFLlMI2cz0fXPxK959A6kIMrwCwyjqvpthM= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6/go.mod h1:efBmVaj9GiucjXsVk7rIwgWXsfoS+1XJqLF9g4TKKZE= 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/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -17,52 +12,15 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 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/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= 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-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= -github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= -github.com/go-redis/redismock/v8 v8.11.5 h1:RJFIiua58hrBrSpXhnGX3on79AU3S271H4ZhRI1wyVo= -github.com/go-redis/redismock/v8 v8.11.5/go.mod h1:UaAU9dEe1C+eGr+FHV5prCWIt0hafyPWbGMEWE0UWdA= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= -github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= @@ -115,29 +73,16 @@ github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgS github.com/jackc/pgx/v4 v4.17.0/go.mod h1:Gd6RmOhtFLTu8cp/Fhq4kP195KrshxYJH3oW8AWJ1pw= 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.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= -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.2.1/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/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= -github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= -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/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= -github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= 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= @@ -160,49 +105,18 @@ github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd 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-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= -github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= -github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8AyFNU9d0= -github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= -github.com/onsi/ginkgo/v2 v2.5.0 h1:TRtrvv2vdQqzkwrQ1ke6vtXf7IK34RBUJafIy1wMwls= -github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= -github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= -github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= -github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= -github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E= -github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= +github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/pashagolub/pgxmock v1.8.0 h1:05JB+jng7yPdeC6i04i8TC4H1Kr7TfcFeQyf4JP6534= github.com/pashagolub/pgxmock v1.8.0/go.mod h1:kDkER7/KJdD3HQjNvFw5siwR7yREKmMvwf8VhAgTK5o= -github.com/pashagolub/pgxmock/v2 v2.12.0 h1:IVRmQtVFNCoq7NOZ+PdfvB6fwnLJmEuWDhnc3yrDxBs= -github.com/pashagolub/pgxmock/v2 v2.12.0/go.mod h1:D3YslkN/nJ4+umVqWmbwfSXugJIjPMChkGBG47OJpNw= github.com/pashagolub/pgxstruct v0.0.0-20210217101842-40d357eec200/go.mod h1:fOTLLi1PtVUDXx28olVT/D2UMFCmBEYpnY5QIzghmDc= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.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/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +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/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= @@ -227,21 +141,9 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= -github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= -github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= 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.mongodb.org/mongo-driver v1.12.2 h1:gbWY1bJkkmUB9jjZzcdhOL8O85N9H+Vvsf2yFN0RDws= -go.mongodb.org/mongo-driver v1.12.2/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= 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= @@ -267,87 +169,53 @@ golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWP 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.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= 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.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 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-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/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.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/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-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/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-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/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.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -356,8 +224,6 @@ 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.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= @@ -370,50 +236,22 @@ golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtn 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.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.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/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -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= -gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs= -gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8= -gorm.io/driver/sqlite v1.5.1 h1:hYyrLkAWE71bcarJDPdZNTLWtr8XrSjOWyjUYI6xdL4= -gorm.io/driver/sqlite v1.5.1/go.mod h1:7MZZ2Z8bqyfSQA1gYEV6MagQWj3cpUkJj9Z+d1HEMEQ= -gorm.io/gorm v1.25.0/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= -gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= -gorm.io/gorm v1.25.3 h1:zi4rHZj1anhZS2EuEODMhDisGy+Daq9jtPrNGgbQYD8= -gorm.io/gorm v1.25.3/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/pgxv4/settings.go b/drivers/pgxv4/settings.go similarity index 94% rename from pgxv4/settings.go rename to drivers/pgxv4/settings.go index f749198..e4a0b54 100644 --- a/pgxv4/settings.go +++ b/drivers/pgxv4/settings.go @@ -1,12 +1,9 @@ -//go:build go1.16 -// +build go1.16 - package pgxv4 import ( "github.com/jackc/pgx/v4" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Opt is a type to configure Settings. diff --git a/pgxv4/settings_test.go b/drivers/pgxv4/settings_test.go similarity index 91% rename from pgxv4/settings_test.go rename to drivers/pgxv4/settings_test.go index 9423fb3..3b4652e 100644 --- a/pgxv4/settings_test.go +++ b/drivers/pgxv4/settings_test.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - package pgxv4 import ( @@ -9,8 +6,8 @@ import ( "github.com/jackc/pgx/v4" "github.com/stretchr/testify/assert" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) func TestSettings_EnrichBy(t *testing.T) { diff --git a/pgxv4/transaction.go b/drivers/pgxv4/transaction.go similarity index 94% rename from pgxv4/transaction.go rename to drivers/pgxv4/transaction.go index 55673ce..4c7e4a7 100644 --- a/pgxv4/transaction.go +++ b/drivers/pgxv4/transaction.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - package pgxv4 import ( @@ -9,7 +6,7 @@ import ( "github.com/jackc/pgx/v4" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Transaction is trm.Transaction for pgx.Tx. diff --git a/pgxv4/transaction_test.go b/drivers/pgxv4/transaction_test.go similarity index 93% rename from pgxv4/transaction_test.go rename to drivers/pgxv4/transaction_test.go index a1b6b01..7a64c89 100644 --- a/pgxv4/transaction_test.go +++ b/drivers/pgxv4/transaction_test.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - package pgxv4 import ( @@ -15,11 +12,13 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/avito-tech/go-transaction-manager/internal/mock" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2/mock" + + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) func TestTransaction(t *testing.T) { diff --git a/pgxv5/context.go b/drivers/pgxv5/context.go similarity index 86% rename from pgxv5/context.go rename to drivers/pgxv5/context.go index 988b243..2433045 100644 --- a/pgxv5/context.go +++ b/drivers/pgxv5/context.go @@ -1,13 +1,10 @@ -//go:build go1.19 -// +build go1.19 - package pgxv5 import ( "context" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" + "github.com/avito-tech/go-transaction-manager/trm/v2" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" ) // DefaultCtxGetter is the CtxGetter with settings.DefaultCtxKey. diff --git a/pgxv5/contract.go b/drivers/pgxv5/contract.go similarity index 96% rename from pgxv5/contract.go rename to drivers/pgxv5/contract.go index 7be7cc0..e4d257b 100644 --- a/pgxv5/contract.go +++ b/drivers/pgxv5/contract.go @@ -1,6 +1,3 @@ -//go:build go1.19 -// +build go1.19 - // Package pgxv5 is an implementation of trm.Transaction interface by Transaction for pgx.Tx. package pgxv5 diff --git a/pgxv5/example_test.go b/drivers/pgxv5/example_test.go similarity index 89% rename from pgxv5/example_test.go rename to drivers/pgxv5/example_test.go index 17e2e03..763d3b4 100644 --- a/pgxv5/example_test.go +++ b/drivers/pgxv5/example_test.go @@ -1,5 +1,5 @@ -//go:build go1.19 && with_real_db -// +build go1.19,with_real_db +//go:build with_real_db +// +build with_real_db package pgxv5_test @@ -9,8 +9,9 @@ import ( "github.com/jackc/pgx/v5/pgxpool" - trmpgx "github.com/avito-tech/go-transaction-manager/pgxv5" - "github.com/avito-tech/go-transaction-manager/trm/manager" + trmpgx "github.com/avito-tech/go-transaction-manager/drivers/pgxv5/v2" + + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) // Example demonstrates the implementation of the Repository pattern by trm.Manager. @@ -26,7 +27,7 @@ func Example() { defer pool.Close() - sqlStmt := `CREATE TABLE IF NOT EXISTS users_v5 (user_id serial, username TEXT)` + sqlStmt := `CREATE TABLE IF NOT EXISTS users_v5 (user_id SERIAL, username TEXT)` _, err = pool.Exec(ctx, sqlStmt) checkErr(err, sqlStmt) diff --git a/pgxv5/factory.go b/drivers/pgxv5/factory.go similarity index 83% rename from pgxv5/factory.go rename to drivers/pgxv5/factory.go index 82295c8..0e931fa 100644 --- a/pgxv5/factory.go +++ b/drivers/pgxv5/factory.go @@ -1,12 +1,9 @@ -//go:build go1.19 -// +build go1.19 - package pgxv5 import ( "context" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // NewDefaultFactory creates default trm.Transaction(pgx.Tx). diff --git a/drivers/pgxv5/go.mod b/drivers/pgxv5/go.mod new file mode 100644 index 0000000..5eef2a5 --- /dev/null +++ b/drivers/pgxv5/go.mod @@ -0,0 +1,27 @@ +module github.com/avito-tech/go-transaction-manager/drivers/pgxv5/v2 + +go 1.19 + +require ( + github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 + github.com/jackc/pgx/v5 v5.5.1 + github.com/pashagolub/pgxmock/v2 v2.12.0 + github.com/stretchr/testify v1.8.2 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + golang.org/x/crypto v0.9.0 // indirect + golang.org/x/sync v0.1.0 // indirect + golang.org/x/text v0.9.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/drivers/pgxv5/go.sum b/drivers/pgxv5/go.sum new file mode 100644 index 0000000..d03078b --- /dev/null +++ b/drivers/pgxv5/go.sum @@ -0,0 +1,80 @@ +github.com/DATA-DOG/go-sqlmock v1.5.1/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 h1:4/jYpusMcFLlMI2cz0fXPxK959A6kIMrwCwyjqvpthM= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6/go.mod h1:efBmVaj9GiucjXsVk7rIwgWXsfoS+1XJqLF9g4TKKZE= +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/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +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-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +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/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +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/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/pashagolub/pgxmock/v2 v2.12.0 h1:IVRmQtVFNCoq7NOZ+PdfvB6fwnLJmEuWDhnc3yrDxBs= +github.com/pashagolub/pgxmock/v2 v2.12.0/go.mod h1:D3YslkN/nJ4+umVqWmbwfSXugJIjPMChkGBG47OJpNw= +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.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.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.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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +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/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +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= +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/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/pgxv5/settings.go b/drivers/pgxv5/settings.go similarity index 94% rename from pgxv5/settings.go rename to drivers/pgxv5/settings.go index 82ed2cb..6f162b1 100644 --- a/pgxv5/settings.go +++ b/drivers/pgxv5/settings.go @@ -1,12 +1,9 @@ -//go:build go1.19 -// +build go1.19 - package pgxv5 import ( "github.com/jackc/pgx/v5" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Opt is a type to configure Settings. diff --git a/pgxv5/settings_test.go b/drivers/pgxv5/settings_test.go similarity index 91% rename from pgxv5/settings_test.go rename to drivers/pgxv5/settings_test.go index 9a5e3aa..a3892cd 100644 --- a/pgxv5/settings_test.go +++ b/drivers/pgxv5/settings_test.go @@ -1,6 +1,3 @@ -//go:build go1.19 -// +build go1.19 - package pgxv5 import ( @@ -9,8 +6,8 @@ import ( "github.com/jackc/pgx/v5" "github.com/stretchr/testify/assert" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) func TestSettings_EnrichBy(t *testing.T) { diff --git a/pgxv5/transaction.go b/drivers/pgxv5/transaction.go similarity index 94% rename from pgxv5/transaction.go rename to drivers/pgxv5/transaction.go index 7e713f0..138e408 100644 --- a/pgxv5/transaction.go +++ b/drivers/pgxv5/transaction.go @@ -1,6 +1,3 @@ -//go:build go1.19 -// +build go1.19 - package pgxv5 import ( @@ -9,7 +6,7 @@ import ( "github.com/jackc/pgx/v5" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Transaction is trm.Transaction for pgx.Tx. diff --git a/pgxv5/transaction_test.go b/drivers/pgxv5/transaction_test.go similarity index 93% rename from pgxv5/transaction_test.go rename to drivers/pgxv5/transaction_test.go index 709f308..7092202 100644 --- a/pgxv5/transaction_test.go +++ b/drivers/pgxv5/transaction_test.go @@ -1,6 +1,3 @@ -//go:build go1.19 -// +build go1.19 - package pgxv5 import ( @@ -11,15 +8,19 @@ import ( "time" "github.com/jackc/pgx/v5" - "github.com/pashagolub/pgxmock/v2" + pgxmock "github.com/pashagolub/pgxmock/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/avito-tech/go-transaction-manager/internal/mock" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2/mock" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" + + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) func TestTransaction(t *testing.T) { diff --git a/sql/context.go b/drivers/sql/context.go similarity index 89% rename from sql/context.go rename to drivers/sql/context.go index dac65a4..0a83bdc 100644 --- a/sql/context.go +++ b/drivers/sql/context.go @@ -4,8 +4,8 @@ import ( "context" "database/sql" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" + "github.com/avito-tech/go-transaction-manager/trm/v2" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" ) // DefaultCtxGetter is the CtxGetter with settings.DefaultCtxKey. diff --git a/sql/contract.go b/drivers/sql/contract.go similarity index 100% rename from sql/contract.go rename to drivers/sql/contract.go diff --git a/sql/example_test.go b/drivers/sql/example_test.go similarity index 92% rename from sql/example_test.go rename to drivers/sql/example_test.go index 0d6a508..240f68a 100644 --- a/sql/example_test.go +++ b/drivers/sql/example_test.go @@ -7,9 +7,11 @@ import ( _ "github.com/mattn/go-sqlite3" - trmsql "github.com/avito-tech/go-transaction-manager/sql" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" + trmsql "github.com/avito-tech/go-transaction-manager/drivers/sql/v2" + + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) // Example demonstrates the implementation of the Repository pattern by trm.Manager. diff --git a/sql/factory.go b/drivers/sql/factory.go similarity index 89% rename from sql/factory.go rename to drivers/sql/factory.go index 14abb9f..6f0c525 100644 --- a/sql/factory.go +++ b/drivers/sql/factory.go @@ -4,7 +4,7 @@ import ( "context" "database/sql" - "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" ) // NewDefaultFactory creates default trm.Transaction(sql.Tx). diff --git a/drivers/sql/go.mod b/drivers/sql/go.mod new file mode 100644 index 0000000..f1c5bfa --- /dev/null +++ b/drivers/sql/go.mod @@ -0,0 +1,21 @@ +module github.com/avito-tech/go-transaction-manager/drivers/sql/v2 + +go 1.13 + +require ( + github.com/DATA-DOG/go-sqlmock v1.5.1 + github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 + github.com/golang/mock v1.6.0 + github.com/kr/pretty v0.3.0 // indirect + github.com/mattn/go-sqlite3 v1.14.18 + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/stretchr/testify v1.8.2 + go.uber.org/multierr v1.9.0 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect +) + +// go mod edit -replace=github.com/avito-tech/go-transaction-manager/trm/v2=../../ +// go get github.com/avito-tech/go-transaction-manager/trm/v2 +// go mod edit -dropreplace=github.com/avito-tech/go-transaction-manager/trm/v2 + +// replace github.com/avito-tech/go-transaction-manager/trm/v2 => ../../trm diff --git a/drivers/sql/go.sum b/drivers/sql/go.sum new file mode 100644 index 0000000..71d55ba --- /dev/null +++ b/drivers/sql/go.sum @@ -0,0 +1,88 @@ +github.com/DATA-DOG/go-sqlmock v1.5.1 h1:FK6RCIUSfmbnI/imIICmboyQBkOckutaa6R5YYlLZyo= +github.com/DATA-DOG/go-sqlmock v1.5.1/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 h1:4/jYpusMcFLlMI2cz0fXPxK959A6kIMrwCwyjqvpthM= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6/go.mod h1:efBmVaj9GiucjXsVk7rIwgWXsfoS+1XJqLF9g4TKKZE= +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/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.18 h1:JL0eqdCOq6DJVNPSvArO/bIV9/P7fbGrV00LZHc+5aI= +github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +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.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +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.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.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.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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +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-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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/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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +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= +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/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +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/sql/mock/savepoint.go b/drivers/sql/mock/savepoint.go similarity index 100% rename from sql/mock/savepoint.go rename to drivers/sql/mock/savepoint.go diff --git a/sql/savepoint.go b/drivers/sql/savepoint.go similarity index 100% rename from sql/savepoint.go rename to drivers/sql/savepoint.go diff --git a/sql/settings.go b/drivers/sql/settings.go similarity index 95% rename from sql/settings.go rename to drivers/sql/settings.go index 8295a82..def985e 100644 --- a/sql/settings.go +++ b/drivers/sql/settings.go @@ -3,7 +3,7 @@ package sql import ( "database/sql" - "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Opt is a type to configure Settings. diff --git a/sql/settings_test.go b/drivers/sql/settings_test.go similarity index 93% rename from sql/settings_test.go rename to drivers/sql/settings_test.go index cd329c5..ef47929 100644 --- a/sql/settings_test.go +++ b/drivers/sql/settings_test.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" ) func TestSettings_EnrichBy(t *testing.T) { diff --git a/sql/transaction.go b/drivers/sql/transaction.go similarity index 97% rename from sql/transaction.go rename to drivers/sql/transaction.go index e8e6d1a..6fc08fb 100644 --- a/sql/transaction.go +++ b/drivers/sql/transaction.go @@ -8,7 +8,7 @@ import ( "go.uber.org/multierr" - "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Transaction is trm.Transaction for sql.Tx. diff --git a/sql/transaction_test.go b/drivers/sql/transaction_test.go similarity index 94% rename from sql/transaction_test.go rename to drivers/sql/transaction_test.go index 7d1eefa..13c5613 100644 --- a/sql/transaction_test.go +++ b/drivers/sql/transaction_test.go @@ -11,11 +11,15 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/avito-tech/go-transaction-manager/internal/mock" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2/mock" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" + + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) func TestTransaction(t *testing.T) { diff --git a/sqlx/chained_example_test.go b/drivers/sqlx/chained_example_test.go similarity index 84% rename from sqlx/chained_example_test.go rename to drivers/sqlx/chained_example_test.go index 2ff7c48..aa1492d 100644 --- a/sqlx/chained_example_test.go +++ b/drivers/sqlx/chained_example_test.go @@ -6,11 +6,12 @@ import ( _ "github.com/mattn/go-sqlite3" - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" + + trmsqlx "github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2" ) // Example demonstrates a work of manager.ChainedMW. diff --git a/sqlx/context.go b/drivers/sqlx/context.go similarity index 89% rename from sqlx/context.go rename to drivers/sqlx/context.go index 59c6399..64c82ab 100644 --- a/sqlx/context.go +++ b/drivers/sqlx/context.go @@ -5,8 +5,8 @@ import ( "github.com/jmoiron/sqlx" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" + "github.com/avito-tech/go-transaction-manager/trm/v2" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" ) // DefaultCtxGetter is the CtxGetter with settings.DefaultCtxKey. diff --git a/sqlx/contract.go b/drivers/sqlx/contract.go similarity index 100% rename from sqlx/contract.go rename to drivers/sqlx/contract.go diff --git a/sqlx/example_test.go b/drivers/sqlx/example_test.go similarity index 95% rename from sqlx/example_test.go rename to drivers/sqlx/example_test.go index 60a7fdd..1707c2d 100644 --- a/sqlx/example_test.go +++ b/drivers/sqlx/example_test.go @@ -7,8 +7,8 @@ import ( "github.com/jmoiron/sqlx" _ "github.com/mattn/go-sqlite3" - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" - "github.com/avito-tech/go-transaction-manager/trm/manager" + trmsqlx "github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) // Example demonstrates the implementation of the Repository pattern by trm.Manager. diff --git a/sqlx/factory.go b/drivers/sqlx/factory.go similarity index 80% rename from sqlx/factory.go rename to drivers/sqlx/factory.go index 59daaf3..db6a9ea 100644 --- a/sqlx/factory.go +++ b/drivers/sqlx/factory.go @@ -5,8 +5,9 @@ import ( "github.com/jmoiron/sqlx" - trmsql "github.com/avito-tech/go-transaction-manager/sql" - "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" + + trmsql "github.com/avito-tech/go-transaction-manager/drivers/sql/v2" ) // NewDefaultFactory creates default trm.Transaction(sqlx.Tx). diff --git a/drivers/sqlx/go.mod b/drivers/sqlx/go.mod new file mode 100644 index 0000000..c857108 --- /dev/null +++ b/drivers/sqlx/go.mod @@ -0,0 +1,18 @@ +module github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2 + +go 1.13 + +require ( + github.com/DATA-DOG/go-sqlmock v1.5.1 + github.com/avito-tech/go-transaction-manager/drivers/sql/v2 v2.0.0-rc6 + github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/jmoiron/sqlx v1.3.5 + github.com/kr/pretty v0.3.0 // indirect + github.com/lib/pq v1.10.2 // indirect + github.com/mattn/go-sqlite3 v1.14.18 + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/stretchr/testify v1.8.2 + go.uber.org/multierr v1.9.0 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect +) diff --git a/drivers/sqlx/go.sum b/drivers/sqlx/go.sum new file mode 100644 index 0000000..cd4d2eb --- /dev/null +++ b/drivers/sqlx/go.sum @@ -0,0 +1,95 @@ +github.com/DATA-DOG/go-sqlmock v1.5.1 h1:FK6RCIUSfmbnI/imIICmboyQBkOckutaa6R5YYlLZyo= +github.com/DATA-DOG/go-sqlmock v1.5.1/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= +github.com/avito-tech/go-transaction-manager/drivers/sql/v2 v2.0.0-rc6 h1:aLd6YRH0sAW5ev/Y4EZ6e1s9ZvhAJEoWZNvDTt9760E= +github.com/avito-tech/go-transaction-manager/drivers/sql/v2 v2.0.0-rc6/go.mod h1:00Cif8xUIQfAtpQ5cuPt9T9dDNJ9bGcY9ev/JpcR0tc= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6 h1:4/jYpusMcFLlMI2cz0fXPxK959A6kIMrwCwyjqvpthM= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6/go.mod h1:efBmVaj9GiucjXsVk7rIwgWXsfoS+1XJqLF9g4TKKZE= +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.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= +github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.18 h1:JL0eqdCOq6DJVNPSvArO/bIV9/P7fbGrV00LZHc+5aI= +github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +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.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +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.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.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.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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +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-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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/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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +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= +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/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +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/transaction.go b/drivers/sqlx/transaction.go similarity index 95% rename from sqlx/transaction.go rename to drivers/sqlx/transaction.go index c8873b2..ca10feb 100644 --- a/sqlx/transaction.go +++ b/drivers/sqlx/transaction.go @@ -9,8 +9,8 @@ import ( "github.com/jmoiron/sqlx" "go.uber.org/multierr" - trmsql "github.com/avito-tech/go-transaction-manager/sql" - "github.com/avito-tech/go-transaction-manager/trm" + trmsql "github.com/avito-tech/go-transaction-manager/drivers/sql/v2" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Transaction is trm.Transaction for sqlx.Tx. diff --git a/sqlx/transaction_test.go b/drivers/sqlx/transaction_test.go similarity index 94% rename from sqlx/transaction_test.go rename to drivers/sqlx/transaction_test.go index 3d048cb..c35c7fe 100644 --- a/sqlx/transaction_test.go +++ b/drivers/sqlx/transaction_test.go @@ -12,11 +12,15 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/avito-tech/go-transaction-manager/internal/mock" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2/mock" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" + + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) func TestTransaction(t *testing.T) { diff --git a/go.mod b/go.mod deleted file mode 100644 index f50524f..0000000 --- a/go.mod +++ /dev/null @@ -1,25 +0,0 @@ -module github.com/avito-tech/go-transaction-manager - -go 1.13 - -require ( - github.com/DATA-DOG/go-sqlmock v1.5.1 - github.com/go-redis/redis/v8 v8.11.5 - github.com/go-redis/redismock/v8 v8.11.5 - github.com/golang/mock v1.6.0 - github.com/jackc/pgconn v1.14.1 - github.com/jackc/pgx/v4 v4.18.1 - github.com/jackc/pgx/v5 v5.5.1 - github.com/jinzhu/copier v0.3.5 - github.com/jmoiron/sqlx v1.3.5 - github.com/mattn/go-sqlite3 v1.14.16 - github.com/onsi/gomega v1.24.1 // indirect - github.com/pashagolub/pgxmock v1.8.0 - github.com/pashagolub/pgxmock/v2 v2.12.0 - github.com/stretchr/testify v1.8.2 - go.mongodb.org/mongo-driver v1.12.2 - go.uber.org/multierr v1.9.0 - gorm.io/driver/mysql v1.5.2 - gorm.io/driver/sqlite v1.5.1 - gorm.io/gorm v1.25.3 -) diff --git a/go.work b/go.work new file mode 100644 index 0000000..47ded15 --- /dev/null +++ b/go.work @@ -0,0 +1,12 @@ +go 1.21 + +use ( + ./drivers/goredis8 + ./drivers/gorm + ./drivers/mongo + ./drivers/pgxv4 + ./drivers/pgxv5 + ./drivers/sql + ./drivers/sqlx + ./trm +) diff --git a/go.work.sum b/go.work.sum new file mode 100644 index 0000000..f834cc1 --- /dev/null +++ b/go.work.sum @@ -0,0 +1,238 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +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/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +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-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= +github.com/go-redis/redismock/v8 v8.11.5/go.mod h1:UaAU9dEe1C+eGr+FHV5prCWIt0hafyPWbGMEWE0UWdA= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +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/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.13.0/go.mod h1:AnowpAqO4CMIIJNZl2VJp+KrkAZciAkhEl0W0JIobpI= +github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E= +github.com/jackc/pgconn v1.14.1/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E= +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/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= +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.0.7/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.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +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/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.12.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgtype v1.14.0/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.17.0/go.mod h1:Gd6RmOhtFLTu8cp/Fhq4kP195KrshxYJH3oW8AWJ1pw= +github.com/jackc/pgx/v4 v4.18.1/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE= +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.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +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/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= +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/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/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= +github.com/pashagolub/pgxmock v1.8.0/go.mod h1:kDkER7/KJdD3HQjNvFw5siwR7yREKmMvwf8VhAgTK5o= +github.com/pashagolub/pgxmock/v2 v2.12.0/go.mod h1:D3YslkN/nJ4+umVqWmbwfSXugJIjPMChkGBG47OJpNw= +github.com/pashagolub/pgxstruct v0.0.0-20210217101842-40d357eec200/go.mod h1:fOTLLi1PtVUDXx28olVT/D2UMFCmBEYpnY5QIzghmDc= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +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/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/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +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/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +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.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= +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/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-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-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-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +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.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/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-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-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/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-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +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.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +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-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8= +gorm.io/driver/sqlite v1.5.4/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= +gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/internal/example/habr/finished/.gitignore b/internal/example/habr/finished/.gitignore deleted file mode 100644 index 05ba2b1..0000000 --- a/internal/example/habr/finished/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/vendor - -/test.db \ No newline at end of file diff --git a/internal/example/habr/finished/domain/order.go b/internal/example/habr/finished/domain/order.go deleted file mode 100644 index 6ddcae3..0000000 --- a/internal/example/habr/finished/domain/order.go +++ /dev/null @@ -1,43 +0,0 @@ -package domain - -import "errors" - -var ( - ErrInvalidUserID = errors.New("invalid user id") - ErrInvalidProductID = errors.New("invalid product id") - ErrInvalidQuantity = errors.New("quantity should be more 1") -) - -type OrderID int64 -type ProductID int64 - -type Order struct { - ID OrderID - ProductID ProductID - UserID UserID - Quantity int64 -} - -func NewOrder(userID UserID, productID ProductID, quantity int64) (*Order, error) { - if userID <= 0 { - return nil, ErrInvalidUserID - } - - if productID <= 0 { - return nil, ErrInvalidProductID - } - - if quantity <= 0 { - return nil, ErrInvalidQuantity - } - - return &Order{ - UserID: userID, - ProductID: productID, - Quantity: quantity, - }, nil -} - -type Purchased struct { - ID OrderID -} diff --git a/internal/example/habr/finished/domain/repository.go b/internal/example/habr/finished/domain/repository.go deleted file mode 100644 index c884044..0000000 --- a/internal/example/habr/finished/domain/repository.go +++ /dev/null @@ -1,16 +0,0 @@ -package domain - -import ( - "context" -) - -type UserRepo interface { - GetByID(context.Context, UserID) (*User, error) - Save(context.Context, *User) error -} - -type OrderRepo interface { - GetByID(context.Context, OrderID) (*Order, error) - GetByUserID(context.Context, UserID) (*Order, error) - Save(context.Context, *Order) error -} diff --git a/internal/example/habr/finished/domain/user.go b/internal/example/habr/finished/domain/user.go deleted file mode 100644 index fa1286a..0000000 --- a/internal/example/habr/finished/domain/user.go +++ /dev/null @@ -1,46 +0,0 @@ -package domain - -import "errors" - -var ( - ErrEmptyUsername = errors.New("empty username") - ErrEmptyPassword = errors.New("empty password") -) - -type UserID int64 - -type User struct { - ID UserID - Username string - // В реальном проекте Пароли храните в захэшированном виде! - Password string - Notification Notification -} - -func NewUser(username string, password string) (*User, error) { - if username == "" { - return nil, ErrEmptyUsername - } - - if password == "" { - return nil, ErrEmptyPassword - } - - return &User{ - Username: username, - Password: password, - Notification: Notification{ - Email: false, - SMS: true, - }, - }, nil -} - -type Notification struct { - Email bool - SMS bool -} - -type Registered struct { - ID UserID -} diff --git a/internal/example/habr/finished/go.mod b/internal/example/habr/finished/go.mod deleted file mode 100644 index da4321e..0000000 --- a/internal/example/habr/finished/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module finish - -go 1.18 - -require ( - github.com/avito-tech/go-transaction-manager v1.2.1 - github.com/jmoiron/sqlx v1.3.5 - github.com/mattn/go-sqlite3 v1.14.16 -) diff --git a/internal/example/habr/finished/main_test.go b/internal/example/habr/finished/main_test.go deleted file mode 100644 index 630da45..0000000 --- a/internal/example/habr/finished/main_test.go +++ /dev/null @@ -1,103 +0,0 @@ -package main - -import ( - "context" - "encoding/json" - "fmt" - "log" - - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" - "github.com/avito-tech/go-transaction-manager/trm/manager" - "github.com/jmoiron/sqlx" - _ "github.com/mattn/go-sqlite3" - - "finish/domain" - "finish/queue" - "finish/repo" - "finish/usecase/fast_purchase" - purchaseUC "finish/usecase/purchase" - registerUC "finish/usecase/register" -) - -// language=SQLite -const sqlStmt = ` -DROP TABLE IF EXISTS "user"; -CREATE TABLE IF NOT EXISTS "user" -( - id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - username TEXT NOT NULL, - password TEXT NOT NULL, - notification TEXT -); -INSERT INTO "user" (username, password, notification) VALUES ('user1', 'password1', 'email1'); - -DROP TABLE IF EXISTS "order"; -CREATE TABLE IF NOT EXISTS "order" -( - id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - user_id INTEGER NOT NULL, - product_id INTEGER NOT NULL, - quantity INTEGER NOT NULL -); -` - -func Example() { - db, err := sqlx.Open("sqlite3", "file:test.db") - if err != nil { - log.Fatal(err) - } - - _, err = db.Exec(sqlStmt) - if err != nil { - log.Fatal(err) - } - - // Repo - trManager := manager.Must(trmsqlx.NewDefaultFactory(db)) - userRepo := repo.NewUserRepo(db, trmsqlx.DefaultCtxGetter) - orderRepo := repo.NewOrderRepo(db, trmsqlx.DefaultCtxGetter) - - queueRegistered := queue.Queue[domain.Registered]{} - queuePurchased := queue.Queue[domain.Purchased]{} - - // usecase - register := registerUC.New(userRepo, trManager, queueRegistered) - purchase := purchaseUC.New(orderRepo, trManager, queuePurchased) - fastPurchase := fast_purchase.New(trManager, register, purchase) - - ctx := context.Background() - - out, err := fastPurchase.Handle(ctx, fast_purchase.In{ - Register: fast_purchase.RegisterIn{ - Username: "username", - }, - Purchase: fast_purchase.PurchaseIn{ - ProductID: 1, - Quantity: 10, - }, - }) - if err != nil { - log.Fatal(err) - } - - res, _ := json.MarshalIndent(out, "", "\t") - fmt.Println(string(res)) - - // Output: { - // "User": { - // "ID": 2, - // "Username": "username", - // "Password": "", - // "Notification": { - // "Email": false, - // "SMS": true - // } - // }, - // "Order": { - // "ID": 1, - // "ProductID": 1, - // "UserID": 2, - // "Quantity": 10 - // } - //} -} diff --git a/internal/example/habr/finished/queue/queue.go b/internal/example/habr/finished/queue/queue.go deleted file mode 100644 index bfe37ba..0000000 --- a/internal/example/habr/finished/queue/queue.go +++ /dev/null @@ -1,11 +0,0 @@ -package queue - -import ( - "context" -) - -type Queue[In any] struct{} - -func (Queue[In]) Publish(_ context.Context, in In) error { - return nil -} diff --git a/internal/example/habr/finished/repo/order.go b/internal/example/habr/finished/repo/order.go deleted file mode 100644 index 6268edb..0000000 --- a/internal/example/habr/finished/repo/order.go +++ /dev/null @@ -1,95 +0,0 @@ -package repo - -import ( - "context" - - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" - "github.com/jmoiron/sqlx" - - "finish/domain" -) - -type orderRow struct { - ID domain.OrderID `db:"id"` - ProductID domain.ProductID `db:"product_id"` - UserID domain.UserID `db:"user_id"` - Quantity int64 `db:"quantity"` -} - -type orderRepo struct { - db *sqlx.DB - getter *trmsqlx.CtxGetter -} - -func NewOrderRepo(db *sqlx.DB, getter *trmsqlx.CtxGetter) *orderRepo { - return &orderRepo{db: db, getter: getter} -} - -func (r *orderRepo) GetByID(ctx context.Context, id domain.OrderID) (*domain.Order, error) { - query := `SELECT * FROM "order" WHERE id = ?;` - row := orderRow{} - - err := r.getter.DefaultTrOrDB(ctx, r.db).GetContext(ctx, &row, r.db.Rebind(query), id) - if err != nil { - return nil, err - } - - return r.toModel(row), nil -} - -func (r *orderRepo) GetByUserID(ctx context.Context, id domain.UserID) (*domain.Order, error) { - query := `SELECT * FROM "order" WHERE user_id = ?;` - row := orderRow{} - - err := r.getter.DefaultTrOrDB(ctx, r.db).GetContext(ctx, &row, r.db.Rebind(query), id) - if err != nil { - return nil, err - } - - return r.toModel(row), nil -} - -func (r *orderRepo) Save(ctx context.Context, o *domain.Order) error { - query := `INSERT INTO "order" (product_id, user_id, quantity) -VALUES (:product_id, :user_id, :quantity) -ON CONFLICT (id) DO UPDATE SET product_id = excluded.product_id, - quantity = excluded.quantity -RETURNING id` - - rows, err := sqlx.NamedQueryContext( - ctx, - r.getter.DefaultTrOrDB(ctx, r.db), - r.db.Rebind(query), - r.toRow(o), - ) - if err != nil { - return err - } - - defer rows.Close() - if !rows.Next() { - return rows.Err() - } - - err = rows.Scan(&o.ID) - - return err -} - -func (r orderRepo) toModel(row orderRow) *domain.Order { - return &domain.Order{ - ID: row.ID, - ProductID: row.ProductID, - UserID: row.UserID, - Quantity: row.Quantity, - } -} - -func (r orderRepo) toRow(u *domain.Order) orderRow { - return orderRow{ - ID: u.ID, - ProductID: u.ProductID, - UserID: u.UserID, - Quantity: u.Quantity, - } -} diff --git a/internal/example/habr/finished/repo/tr/deps.go b/internal/example/habr/finished/repo/tr/deps.go deleted file mode 100644 index 7be3961..0000000 --- a/internal/example/habr/finished/repo/tr/deps.go +++ /dev/null @@ -1,15 +0,0 @@ -package tr - -import ( - "context" - - "github.com/jmoiron/sqlx" -) - -type Tr interface { - Get(dest interface{}, query string, args ...interface{}) error - GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error - - sqlx.Ext - sqlx.ExtContext -} diff --git a/internal/example/habr/finished/repo/user.go b/internal/example/habr/finished/repo/user.go deleted file mode 100644 index a02ef96..0000000 --- a/internal/example/habr/finished/repo/user.go +++ /dev/null @@ -1,117 +0,0 @@ -package repo - -import ( - "context" - "database/sql/driver" - "encoding/json" - "errors" - "fmt" - - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" - "github.com/jmoiron/sqlx" - - "finish/domain" -) - -type userRow struct { - ID domain.UserID `db:"id"` - Username string `db:"username"` - Password string `db:"password"` - Notification notification `db:"notification"` -} - -type notification struct { - Email bool `json:"email"` - SMS bool `json:"sms"` -} - -func (n notification) Scan(src any) error { - switch v := src.(type) { - case []byte: - return json.Unmarshal(v, &n) - case string: - return json.Unmarshal([]byte(v), &n) - default: - return errors.New(fmt.Sprintf("Unsupported type: %T", v)) - } -} - -func (n notification) Value() (driver.Value, error) { - return json.Marshal(n) -} - -type userRepo struct { - db *sqlx.DB - getter *trmsqlx.CtxGetter -} - -func NewUserRepo(db *sqlx.DB, getter *trmsqlx.CtxGetter) *userRepo { - return &userRepo{ - db: db, - getter: getter, - } -} -func (r *userRepo) GetByID(ctx context.Context, id domain.UserID) (*domain.User, error) { - query := `SELECT * FROM "user" WHERE id = ?;` - row := userRow{} - - err := r.getter.DefaultTrOrDB(ctx, r.db).GetContext(ctx, &row, r.db.Rebind(query), id) - if err != nil { - return nil, err - } - - return r.toModel(row), nil -} - -func (r *userRepo) Save(ctx context.Context, u *domain.User) error { - query := `INSERT INTO "user" (username, password, notification) -VALUES (:username, :password, :notification) -ON CONFLICT (id) - DO UPDATE SET username = excluded.username, - password = excluded.password, - notification = excluded.notification -RETURNING id;` - - rows, err := sqlx.NamedQueryContext( - ctx, - r.getter.DefaultTrOrDB(ctx, r.db), - r.db.Rebind(query), - r.toRow(u), - ) - if err != nil { - return err - } - - defer rows.Close() - if !rows.Next() { - return rows.Err() - } - - err = rows.Scan(&u.ID) - - return err -} - -func (r userRepo) toModel(row userRow) *domain.User { - return &domain.User{ - ID: row.ID, - Username: row.Username, - Password: row.Password, - Notification: domain.Notification{ - Email: row.Notification.Email, - SMS: row.Notification.SMS, - }, - } -} - -func (r userRepo) toRow(u *domain.User) userRow { - return userRow{ - ID: u.ID, - Username: u.Username, - Password: u.Password, - Notification: notification{ - Email: u.Notification.Email, - SMS: u.Notification.SMS, - }, - } -} diff --git a/internal/example/habr/finished/usecase/decorator/struct.go b/internal/example/habr/finished/usecase/decorator/struct.go deleted file mode 100644 index 2c41911..0000000 --- a/internal/example/habr/finished/usecase/decorator/struct.go +++ /dev/null @@ -1,52 +0,0 @@ -// detailed description https://threedots.tech/post/increasing-cohesion-in-go-with-generic-decorators/ -package decorator - -import ( - "context" - "fmt" - - "github.com/avito-tech/go-transaction-manager/trm" -) - -type Usecase[In any, Out any] interface { - Handle(ctx context.Context, in In) (Out, error) -} - -type txDecorator[In any, Out any] struct { - manager trm.Manager - usecase Usecase[In, Out] -} - -func TxDecorate[In any, Out any](m trm.Manager, u Usecase[In, Out]) Usecase[In, Out] { - return &txDecorator[In, Out]{manager: m, usecase: u} -} - -func (d *txDecorator[In, Out]) Handle(ctx context.Context, in In) (out Out, err error) { - var emptyOut Out - - err = d.manager.Do(ctx, func(ctx context.Context) error { - out, err = d.usecase.Handle(ctx, in) - - return err - }) - if err != nil { - return emptyOut, err - } - - return out, nil -} - -type fmtDecorator[In any, Out any] struct { - usecase Usecase[In, Out] -} - -func FMTDecorator[In any, Out any](u Usecase[In, Out]) Usecase[In, Out] { - return &fmtDecorator[In, Out]{usecase: u} -} - -func (d *fmtDecorator[In, Out]) Handle(ctx context.Context, in In) (out Out, err error) { - fmt.Println("start") - defer fmt.Println("finish") - - return d.usecase.Handle(ctx, in) -} diff --git a/internal/example/habr/finished/usecase/decorator/struct_test.go b/internal/example/habr/finished/usecase/decorator/struct_test.go deleted file mode 100644 index 637beb8..0000000 --- a/internal/example/habr/finished/usecase/decorator/struct_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package decorator - -import ( - "context" - "fmt" -) - -type usecase struct{} - -func (u usecase) Handle(ctx context.Context, in string) (string, error) { - fmt.Println("inside", in) - - return "result", nil -} - -func ExampleFMTDecorator() { - uc := FMTDecorator[string, string](usecase{}) - - fmt.Println(uc.Handle(context.Background(), "in")) - - // Output: start - //inside in - //finish - //result -} diff --git a/internal/example/habr/finished/usecase/fast_purchase/usecase.go b/internal/example/habr/finished/usecase/fast_purchase/usecase.go deleted file mode 100644 index 543a132..0000000 --- a/internal/example/habr/finished/usecase/fast_purchase/usecase.go +++ /dev/null @@ -1,66 +0,0 @@ -package fast_purchase - -import ( - "context" - - "github.com/avito-tech/go-transaction-manager/trm" - - "finish/domain" - "finish/usecase/purchase" - "finish/usecase/register" -) - -type In struct { - Register RegisterIn - Purchase PurchaseIn -} - -type RegisterIn struct { - Username string - Password string -} - -type PurchaseIn struct { - ProductID domain.ProductID - Quantity int64 -} - -type Out struct { - User *domain.User - Order *domain.Order -} - -type FastPurchase struct { - trm trm.Manager - register *register.Register - purchase *purchase.Purchase -} - -func New(trm trm.Manager, register *register.Register, purchase *purchase.Purchase) *FastPurchase { - return &FastPurchase{trm: trm, register: register, purchase: purchase} -} - -func (u *FastPurchase) Handle(ctx context.Context, in In) (out Out, err error) { - err = u.trm.Do(ctx, func(ctx context.Context) error { - out.User, err = u.register.Handle(ctx, register.In{ - Username: in.Register.Username, - Password: in.Register.Password, - }) - if err != nil { - return err - } - - out.Order, err = u.purchase.Handle(ctx, purchase.In{ - UserID: out.User.ID, - ProductID: in.Purchase.ProductID, - Quantity: in.Purchase.Quantity, - }) - - return err - }) - if err != nil { - return Out{}, err - } - - return out, nil -} diff --git a/internal/example/habr/finished/usecase/purchase/usecase.go b/internal/example/habr/finished/usecase/purchase/usecase.go deleted file mode 100644 index a6c577e..0000000 --- a/internal/example/habr/finished/usecase/purchase/usecase.go +++ /dev/null @@ -1,46 +0,0 @@ -package purchase - -import ( - "context" - - "github.com/avito-tech/go-transaction-manager/trm" - - "finish/domain" - "finish/queue" -) - -type In struct { - UserID domain.UserID - ProductID domain.ProductID - Quantity int64 -} - -type Purchase struct { - orderRepo domain.OrderRepo - trm trm.Manager - queue queue.Queue[domain.Purchased] -} - -func New(orderRepo domain.OrderRepo, trm trm.Manager, queue queue.Queue[domain.Purchased]) *Purchase { - return &Purchase{orderRepo: orderRepo, trm: trm, queue: queue} -} - -func (u *Purchase) Handle(ctx context.Context, in In) (order *domain.Order, err error) { - order, err = domain.NewOrder(in.UserID, in.ProductID, in.Quantity) - if err != nil { - return nil, err - } - - err = u.trm.Do(ctx, func(ctx context.Context) error { - if err = u.orderRepo.Save(ctx, order); err != nil { - return err - } - - return u.queue.Publish(ctx, domain.Purchased{ID: order.ID}) - }) - if err != nil { - return nil, err - } - - return order, nil -} diff --git a/internal/example/habr/finished/usecase/register/usecase.go b/internal/example/habr/finished/usecase/register/usecase.go deleted file mode 100644 index ecd55f7..0000000 --- a/internal/example/habr/finished/usecase/register/usecase.go +++ /dev/null @@ -1,45 +0,0 @@ -package register - -import ( - "context" - - "github.com/avito-tech/go-transaction-manager/trm" - - "finish/domain" - "finish/queue" -) - -type In struct { - Username string - Password string -} - -type Register struct { - userRepo domain.UserRepo - trm trm.Manager - queue queue.Queue[domain.Registered] -} - -func New(userRepo domain.UserRepo, trm trm.Manager, queue queue.Queue[domain.Registered]) *Register { - return &Register{userRepo: userRepo, trm: trm, queue: queue} -} - -func (u *Register) Handle(ctx context.Context, in In) (user *domain.User, err error) { - user, err = domain.NewUser(in.Username, in.Password) - if err != nil { - return nil, err - } - - err = u.trm.Do(ctx, func(ctx context.Context) error { - if err = u.userRepo.Save(ctx, user); err != nil { - return err - } - - return u.queue.Publish(ctx, domain.Registered{ID: user.ID}) - }) - if err != nil { - return nil, err - } - - return user, nil -} diff --git a/internal/example/habr/init/.gitignore b/internal/example/habr/init/.gitignore deleted file mode 100644 index 05ba2b1..0000000 --- a/internal/example/habr/init/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/vendor - -/test.db \ No newline at end of file diff --git a/internal/example/habr/init/domain/deps.go b/internal/example/habr/init/domain/deps.go deleted file mode 100644 index cafc669..0000000 --- a/internal/example/habr/init/domain/deps.go +++ /dev/null @@ -1,15 +0,0 @@ -package domain - -import ( - "context" - - "github.com/jmoiron/sqlx" -) - -type Tr interface { - Get(dest interface{}, query string, args ...interface{}) error - GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error - - sqlx.Ext - sqlx.ExtContext -} diff --git a/internal/example/habr/init/domain/order.go b/internal/example/habr/init/domain/order.go deleted file mode 100644 index 6ddcae3..0000000 --- a/internal/example/habr/init/domain/order.go +++ /dev/null @@ -1,43 +0,0 @@ -package domain - -import "errors" - -var ( - ErrInvalidUserID = errors.New("invalid user id") - ErrInvalidProductID = errors.New("invalid product id") - ErrInvalidQuantity = errors.New("quantity should be more 1") -) - -type OrderID int64 -type ProductID int64 - -type Order struct { - ID OrderID - ProductID ProductID - UserID UserID - Quantity int64 -} - -func NewOrder(userID UserID, productID ProductID, quantity int64) (*Order, error) { - if userID <= 0 { - return nil, ErrInvalidUserID - } - - if productID <= 0 { - return nil, ErrInvalidProductID - } - - if quantity <= 0 { - return nil, ErrInvalidQuantity - } - - return &Order{ - UserID: userID, - ProductID: productID, - Quantity: quantity, - }, nil -} - -type Purchased struct { - ID OrderID -} diff --git a/internal/example/habr/init/domain/repository.go b/internal/example/habr/init/domain/repository.go deleted file mode 100644 index a848fc2..0000000 --- a/internal/example/habr/init/domain/repository.go +++ /dev/null @@ -1,12 +0,0 @@ -package domain - -type UserRepo interface { - GetByID(Tr, UserID) (*User, error) - Save(Tr, *User) error -} - -type OrderRepo interface { - GetByID(Tr, OrderID) (*Order, error) - GetByUserID(Tr, UserID) (*Order, error) - Save(Tr, *Order) error -} diff --git a/internal/example/habr/init/domain/user.go b/internal/example/habr/init/domain/user.go deleted file mode 100644 index dd2615e..0000000 --- a/internal/example/habr/init/domain/user.go +++ /dev/null @@ -1,41 +0,0 @@ -package domain - -import "errors" - -var ( - ErrEmptyUsername = errors.New("empty username") -) - -type UserID int64 - -type User struct { - ID UserID - Username string - // В реальном проекте Пароли храните в захэшированном виде! - Password string - Notification Notification -} - -func NewUser(username string, password string) (*User, error) { - if username == "" { - return nil, ErrEmptyUsername - } - - return &User{ - Username: username, - Password: password, - Notification: Notification{ - Email: false, - SMS: true, - }, - }, nil -} - -type Notification struct { - Email bool - SMS bool -} - -type Registered struct { - ID UserID -} diff --git a/internal/example/habr/init/go.mod b/internal/example/habr/init/go.mod deleted file mode 100644 index 8b75753..0000000 --- a/internal/example/habr/init/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module init - -go 1.18 - -require ( - github.com/jmoiron/sqlx v1.3.5 - github.com/mattn/go-sqlite3 v1.14.16 -) diff --git a/internal/example/habr/init/go.sum b/internal/example/habr/init/go.sum deleted file mode 100644 index d167db2..0000000 --- a/internal/example/habr/init/go.sum +++ /dev/null @@ -1,9 +0,0 @@ -github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= -github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= -github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= -github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= diff --git a/internal/example/habr/init/main_test.go b/internal/example/habr/init/main_test.go deleted file mode 100644 index c1f3065..0000000 --- a/internal/example/habr/init/main_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - - "github.com/jmoiron/sqlx" - _ "github.com/mattn/go-sqlite3" - - "init/domain" - "init/queue" - "init/repo" - "init/usecase/fast_purchase" - purchaseUC "init/usecase/purchase" - registerUC "init/usecase/register" -) - -// language=SQLite -const sqlStmt = ` -DROP TABLE IF EXISTS "user"; -CREATE TABLE IF NOT EXISTS "user" -( - id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - username TEXT NOT NULL, - password TEXT NOT NULL, - notification TEXT -); -INSERT INTO "user" (username, password, notification) VALUES ('user1', 'password1', 'email1'); - -DROP TABLE IF EXISTS "order"; -CREATE TABLE IF NOT EXISTS "order" -( - id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - user_id INTEGER NOT NULL, - product_id INTEGER NOT NULL, - quantity INTEGER NOT NULL -); -` - -func Example() { - db, err := sqlx.Open("sqlite3", "file:test.db") - if err != nil { - log.Fatal(err) - } - - _, err = db.Exec(sqlStmt) - if err != nil { - log.Fatal(err) - } - - // Repo - userRepo := repo.NewUserRepo(db) - orderRepo := repo.NewOrdrRepo(db) - - queueRegistered := queue.Queue[domain.Registered]{} - queuePurchased := queue.Queue[domain.Purchased]{} - - // usecase - register := registerUC.New(userRepo, db, queueRegistered) - purchase := purchaseUC.New(orderRepo, db, queuePurchased) - fastPurchase := fast_purchase.New(db, register, purchase) - - out, err := fastPurchase.Handle(fast_purchase.In{ - Register: fast_purchase.RegisterIn{ - Username: "username", - Password: "password", - }, - Purchase: fast_purchase.PurchaseIn{ - ProductID: 1, - Quantity: 10, - }, - }) - if err != nil { - log.Fatal(err) - } - - res, _ := json.MarshalIndent(out, "", "\t") - fmt.Println(string(res)) - - // Output: { - // "User": { - // "ID": 2, - // "Username": "username", - // "Password": "", - // "Notification": { - // "Email": false, - // "SMS": true - // } - // }, - // "Order": { - // "ID": 1, - // "ProductID": 1, - // "UserID": 2, - // "Quantity": 10 - // } - //} -} diff --git a/internal/example/habr/init/queue/queue.go b/internal/example/habr/init/queue/queue.go deleted file mode 100644 index b84a22f..0000000 --- a/internal/example/habr/init/queue/queue.go +++ /dev/null @@ -1,9 +0,0 @@ -package queue - -import "init/domain" - -type Queue[In any] struct{} - -func (Queue[In]) Publish(_ domain.Tr, in In) error { - return nil -} diff --git a/internal/example/habr/init/repo/order.go b/internal/example/habr/init/repo/order.go deleted file mode 100644 index f3e3d1b..0000000 --- a/internal/example/habr/init/repo/order.go +++ /dev/null @@ -1,96 +0,0 @@ -package repo - -import ( - "github.com/jmoiron/sqlx" - - "init/domain" -) - -type orderRow struct { - ID domain.OrderID `db:"id"` - ProductID domain.ProductID `db:"product_id"` - UserID domain.UserID `db:"user_id"` - Quantity int64 `db:"quantity"` -} - -type ordrRepo struct { - db *sqlx.DB -} - -func NewOrdrRepo(db *sqlx.DB) *ordrRepo { - return &ordrRepo{db: db} -} - -func (r *ordrRepo) GetByID(tr domain.Tr, id domain.OrderID) (*domain.Order, error) { - query := `SELECT * FROM "order" WHERE id = ?;` - row := orderRow{} - - if tr != nil { - tr = r.db - } - - if err := tr.Get(&row, r.db.Rebind(query), id); err != nil { - return nil, err - } - - return r.toModel(row), nil -} - -func (r *ordrRepo) GetByUserID(tr domain.Tr, id domain.UserID) (*domain.Order, error) { - query := `SELECT * FROM "order" WHERE user_id = ?;` - row := orderRow{} - - if tr != nil { - tr = r.db - } - - if err := tr.Get(&row, r.db.Rebind(query), id); err != nil { - return nil, err - } - - return r.toModel(row), nil -} - -func (r *ordrRepo) Save(tr domain.Tr, o *domain.Order) error { - query := `INSERT INTO "order" (product_id, user_id, quantity) -VALUES (:product_id, :user_id, :quantity) -ON CONFLICT (id) DO UPDATE SET product_id = excluded.product_id, - quantity = excluded.quantity -RETURNING id` - - if tr != nil { - tr = r.db - } - - rows, err := sqlx.NamedQuery(tr, query, r.toRow(o)) - if err != nil { - return err - } - - defer rows.Close() - if !rows.Next() { - return rows.Err() - } - - err = rows.Scan(&o.ID) - - return err -} - -func (r ordrRepo) toModel(row orderRow) *domain.Order { - return &domain.Order{ - ID: row.ID, - ProductID: row.ProductID, - UserID: row.UserID, - Quantity: row.Quantity, - } -} - -func (r ordrRepo) toRow(u *domain.Order) orderRow { - return orderRow{ - ID: u.ID, - ProductID: u.ProductID, - UserID: u.UserID, - Quantity: u.Quantity, - } -} diff --git a/internal/example/habr/init/repo/user.go b/internal/example/habr/init/repo/user.go deleted file mode 100644 index 47a19c7..0000000 --- a/internal/example/habr/init/repo/user.go +++ /dev/null @@ -1,114 +0,0 @@ -package repo - -import ( - "database/sql/driver" - "encoding/json" - "errors" - "fmt" - - "github.com/jmoiron/sqlx" - - "init/domain" -) - -type userRow struct { - ID domain.UserID `db:"id"` - Username string `db:"username"` - Password string `db:"password"` - Notification notification `db:"notification"` -} - -type notification struct { - Email bool `json:"email"` - SMS bool `json:"sms"` -} - -func (n notification) Scan(src any) error { - switch v := src.(type) { - case []byte: - return json.Unmarshal(v, &n) - case string: - return json.Unmarshal([]byte(v), &n) - default: - return errors.New(fmt.Sprintf("Unsupported type: %T", v)) - } -} - -func (n notification) Value() (driver.Value, error) { - return json.Marshal(n) -} - -type userRepo struct { - db *sqlx.DB -} - -func NewUserRepo(db *sqlx.DB) *userRepo { - return &userRepo{db: db} -} - -func (r *userRepo) GetByID(tr domain.Tr, id domain.UserID) (*domain.User, error) { - query := `SELECT * FROM "user" WHERE id = ?;` - uRow := userRow{} - - if tr != nil { - tr = r.db - } - - if err := tr.Get(&uRow, r.db.Rebind(query), id); err != nil { - return nil, err - } - - return r.toModel(uRow), nil -} - -func (r *userRepo) Save(tr domain.Tr, u *domain.User) error { - query := `INSERT INTO "user" (username, password, notification) -VALUES (:username, :password, :notification) -ON CONFLICT (id) - DO UPDATE SET username = excluded.username, - password = excluded.password, - notification = excluded.notification -RETURNING id;` - - if tr != nil { - tr = r.db - } - - rows, err := sqlx.NamedQuery(tr, query, r.toRow(u)) - if err != nil { - return err - } - - defer rows.Close() - if !rows.Next() { - return rows.Err() - } - - err = rows.Scan(&u.ID) - - return err -} - -func (r userRepo) toModel(row userRow) *domain.User { - return &domain.User{ - ID: row.ID, - Username: row.Username, - Password: row.Password, - Notification: domain.Notification{ - Email: row.Notification.Email, - SMS: row.Notification.SMS, - }, - } -} - -func (r userRepo) toRow(u *domain.User) userRow { - return userRow{ - ID: u.ID, - Username: u.Username, - Password: u.Password, - Notification: notification{ - Email: u.Notification.Email, - SMS: u.Notification.SMS, - }, - } -} diff --git a/internal/example/habr/init/repo/with_transaction.go b/internal/example/habr/init/repo/with_transaction.go deleted file mode 100644 index 7d3a90b..0000000 --- a/internal/example/habr/init/repo/with_transaction.go +++ /dev/null @@ -1,39 +0,0 @@ -package repo - -import ( - "github.com/jmoiron/sqlx" -) - -var DB *sqlx.DB - -func SetDB(db *sqlx.DB) { - DB = db -} - -func WithTransaction(tx *sqlx.Tx, fn func(*sqlx.Tx) error) (err error) { - hasExternalTx := true - if tx == nil { - tx, err = DB.Beginx() - if err != nil { - return err - } - hasExternalTx = false - } - - defer func() { - if !hasExternalTx && err != nil { - tx.Rollback() - } - }() - - err = fn(tx) // call a usecase - if err != nil { - return err - } - - if !hasExternalTx { - err = tx.Commit() // or tr.Rollback() - } - - return nil -} diff --git a/internal/example/habr/init/repo/withoutTx/user.go b/internal/example/habr/init/repo/withoutTx/user.go deleted file mode 100644 index c70b80e..0000000 --- a/internal/example/habr/init/repo/withoutTx/user.go +++ /dev/null @@ -1,106 +0,0 @@ -package withoutTx - -import ( - "database/sql/driver" - "encoding/json" - "errors" - "fmt" - - "github.com/jmoiron/sqlx" - - "init/domain" -) - -type userRow struct { - ID domain.UserID `db:"id"` - Username string `db:"username"` - Password string `db:"password"` - Notification notification `db:"notification"` -} - -type notification struct { - Email bool `json:"email"` - SMS bool `json:"sms"` -} - -func (n notification) Scan(src any) error { - switch v := src.(type) { - case []byte: - return json.Unmarshal(v, &n) - case string: - return json.Unmarshal([]byte(v), &n) - default: - return errors.New(fmt.Sprintf("Unsupported type: %T", v)) - } -} - -func (n notification) Value() (driver.Value, error) { - return json.Marshal(n) -} - -type userRepo struct { - db *sqlx.DB -} - -func NewUserRepo(db *sqlx.DB) *userRepo { - return &userRepo{db: db} -} - -func (r *userRepo) GetByID(id domain.UserID) (*domain.User, error) { - query := `SELECT * FROM "user" WHERE id = ?;` - uRow := userRow{} - - if err := r.db.Get(&uRow, r.db.Rebind(query), id); err != nil { - return nil, err - } - - return r.toModel(uRow), nil -} - -func (r *userRepo) Save(u *domain.User) error { - query := `INSERT INTO "user" (username, password, notification) -VALUES (:username, :password, :notification) -ON CONFLICT (id) - DO UPDATE SET excluded.username = :username, - excluded.password = :password, - excluded.notification = :notification -RETURNING id;` - - rows, err := r.db.Query(query, r.toRow(u)) - if err != nil { - return err - } - - defer rows.Close() - if !rows.Next() { - return rows.Err() - } - - err = rows.Scan(&u.ID) - - return err -} - -func (r userRepo) toModel(row userRow) *domain.User { - return &domain.User{ - ID: row.ID, - Username: row.Username, - Password: row.Password, - Notification: domain.Notification{ - Email: row.Notification.Email, - SMS: row.Notification.SMS, - }, - } -} - -func (r userRepo) toRow(u *domain.User) userRow { - return userRow{ - ID: u.ID, - Username: u.Username, - Password: u.Password, - Notification: notification{ - Email: u.Notification.Email, - SMS: u.Notification.SMS, - }, - } -} diff --git a/internal/example/habr/init/usecase/fast_purchase/usecase.go b/internal/example/habr/init/usecase/fast_purchase/usecase.go deleted file mode 100644 index e25cf37..0000000 --- a/internal/example/habr/init/usecase/fast_purchase/usecase.go +++ /dev/null @@ -1,72 +0,0 @@ -package fast_purchase - -import ( - "github.com/jmoiron/sqlx" - - "init/domain" - "init/usecase/purchase" - "init/usecase/register" -) - -type In struct { - Register RegisterIn - Purchase PurchaseIn -} - -type RegisterIn struct { - Username string - Password string -} - -type PurchaseIn struct { - ProductID domain.ProductID - Quantity int64 -} - -type Out struct { - User *domain.User - Order *domain.Order -} - -type FastPurchase struct { - db *sqlx.DB - register *register.Register - purchase *purchase.Purchase -} - -func New(db *sqlx.DB, register *register.Register, purchase *purchase.Purchase) *FastPurchase { - return &FastPurchase{db: db, register: register, purchase: purchase} -} - -func (u *FastPurchase) Handle(in In) (out Out, err error) { - tx, err := u.db.Beginx() - if err != nil { - return Out{}, err - } - - defer func() { - if err != nil { - tx.Rollback() - } - }() - - if out.User, err = u.register.Handle(tx, register.In{ - Username: in.Register.Username, - }); err != nil { - return Out{}, err - } - - if out.Order, err = u.purchase.Handle(tx, purchase.In{ - UserID: out.User.ID, - ProductID: in.Purchase.ProductID, - Quantity: in.Purchase.Quantity, - }); err != nil { - return Out{}, err - } - - if err = tx.Commit(); err != nil { - return Out{}, err - } - - return out, nil -} diff --git a/internal/example/habr/init/usecase/purchase/usecase.go b/internal/example/habr/init/usecase/purchase/usecase.go deleted file mode 100644 index 29a056f..0000000 --- a/internal/example/habr/init/usecase/purchase/usecase.go +++ /dev/null @@ -1,60 +0,0 @@ -package purchase - -import ( - "github.com/jmoiron/sqlx" - - "init/domain" - "init/queue" -) - -type In struct { - UserID domain.UserID - ProductID domain.ProductID - Quantity int64 -} - -type Purchase struct { - orderRepo domain.OrderRepo - db *sqlx.DB - queue queue.Queue[domain.Purchased] -} - -func New(orderRepo domain.OrderRepo, db *sqlx.DB, queue queue.Queue[domain.Purchased]) *Purchase { - return &Purchase{orderRepo: orderRepo, db: db, queue: queue} -} - -func (u *Purchase) Handle(tx *sqlx.Tx, in In) (order *domain.Order, err error) { - hasExternalTx := true - tr := domain.Tr(tx) - if tx == nil { - if tr, err = u.db.Beginx(); err != nil { - return nil, err - } - hasExternalTx = false - } - - defer func() { - if !hasExternalTx && err != nil { - tx.Rollback() - } - }() - - order, err = domain.NewOrder(in.UserID, in.ProductID, in.Quantity) - if err != nil { - return nil, err - } - - if err = u.orderRepo.Save(tr, order); err != nil { - return nil, err - } - - if err = u.queue.Publish(tr, domain.Purchased{ID: order.ID}); err != nil { - return nil, err - } - - if !hasExternalTx { - return nil, tx.Commit() - } - - return order, nil -} diff --git a/internal/example/habr/init/usecase/register/usecase.go b/internal/example/habr/init/usecase/register/usecase.go deleted file mode 100644 index 70e8e57..0000000 --- a/internal/example/habr/init/usecase/register/usecase.go +++ /dev/null @@ -1,59 +0,0 @@ -package register - -import ( - "github.com/jmoiron/sqlx" - - "init/domain" - "init/queue" -) - -type In struct { - Username string - Password string -} - -type Register struct { - userRepo domain.UserRepo - db *sqlx.DB - queue queue.Queue[domain.Registered] -} - -func New(userRepo domain.UserRepo, db *sqlx.DB, queue queue.Queue[domain.Registered]) *Register { - return &Register{userRepo: userRepo, db: db, queue: queue} -} - -func (u *Register) Handle(tx *sqlx.Tx, in In) (user *domain.User, err error) { - hasExternalTx := true - tr := domain.Tr(tx) - if tx == nil { - if tr, err = u.db.Beginx(); err != nil { - return nil, err - } - hasExternalTx = false - } - - defer func() { - if !hasExternalTx && err != nil { - tx.Rollback() - } - }() - - user, err = domain.NewUser(in.Username, in.Password) - if err != nil { - return nil, err - } - - if err = u.userRepo.Save(tr, user); err != nil { - return nil, err - } - - if err = u.queue.Publish(tr, domain.Registered{ID: user.ID}); err != nil { - return nil, err - } - - if !hasExternalTx { - return nil, tx.Commit() - } - - return user, nil -} diff --git a/internal/example/habr/init/usecase/register_withTransaction/usecase.go b/internal/example/habr/init/usecase/register_withTransaction/usecase.go deleted file mode 100644 index 4b12f40..0000000 --- a/internal/example/habr/init/usecase/register_withTransaction/usecase.go +++ /dev/null @@ -1,44 +0,0 @@ -package register - -import ( - "github.com/jmoiron/sqlx" - - "init/domain" - "init/queue" - "init/repo" -) - -type In struct { - Username string - Password string -} - -type Register struct { - userRepo domain.UserRepo - db *sqlx.DB - queue queue.Queue[domain.Registered] -} - -func New(userRepo domain.UserRepo, db *sqlx.DB, queue queue.Queue[domain.Registered]) *Register { - return &Register{userRepo: userRepo, db: db, queue: queue} -} - -func (u *Register) Handle(tx *sqlx.Tx, in In) (user *domain.User, err error) { - user, err = domain.NewUser(in.Username, in.Password) - if err != nil { - return nil, err - } - - err = repo.WithTransaction(tx, func(tx *sqlx.Tx) error { - if err = u.userRepo.Save(tx, user); err != nil { - return err - } - - return u.queue.Publish(tx, domain.Registered{ID: user.ID}) - }) - if err != nil { - return nil, err - } - - return user, nil -} diff --git a/sh/git.tag.sh b/sh/git.tag.sh new file mode 100755 index 0000000..8467ed1 --- /dev/null +++ b/sh/git.tag.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +DIR=$(pwd) +drivers=$($DIR/utils/drivers.sh) + +cd ../ + +ROOT=$(pwd) + +tagVersion="v2.$1" + +echo "\ntrm" +git tag trm/$tagVersion + +for driver in $drivers; do + if [ -d "$driver" ]; then + echo "\n$driver" + git tag $driver/$tagVersion + fi +done diff --git a/sh/go.fmt.sh b/sh/go.fmt.sh new file mode 100755 index 0000000..dc332e0 --- /dev/null +++ b/sh/go.fmt.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +DIR=$(pwd) +drivers=$($DIR/utils/drivers.sh) + +cd ../ + +ROOT=$(pwd) + +echo "\ntrm" +cd trm && go fmt ./... +cd $ROOT + +for driver in $drivers; do + if [ -d "$driver" ]; then + echo "\n$driver" + cd $driver && go fmt ./... + + cd $ROOT + fi +done diff --git a/sh/go.mod.tidy.sh b/sh/go.mod.tidy.sh new file mode 100755 index 0000000..69fe335 --- /dev/null +++ b/sh/go.mod.tidy.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +DIR=$(pwd) +drivers=$($DIR/utils/drivers.sh) + +cd ../ + +ROOT=$(pwd) + +echo "\ntrm" +cd trm && go mod tidy +cd $ROOT + +for driver in $drivers; do + if [ -d "$driver" ]; then + echo "\n$driver" + cd $driver && go mod tidy + + cd $ROOT + fi +done diff --git a/sh/go.mod.vendor.sh b/sh/go.mod.vendor.sh new file mode 100755 index 0000000..934a383 --- /dev/null +++ b/sh/go.mod.vendor.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +DIR=$(pwd) +drivers=$($DIR/utils/drivers.sh) + +cd ../ + +ROOT=$(pwd) + +echo "\ntrm" +cd trm && go mod vendor +cd $ROOT + +for driver in $drivers; do + if [ -d "$driver" ]; then + echo "\n$driver" + cd $driver && go mod vendor + + cd $ROOT + fi +done diff --git a/sh/go.test.coverage.sh b/sh/go.test.coverage.sh new file mode 100755 index 0000000..0db5634 --- /dev/null +++ b/sh/go.test.coverage.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +ROOT="$(pwd)/.." + +COVERAGE_TEST="-cover -covermode=atomic -test.gocoverdir=$ROOT/coverage" + +mkdir -p $ROOT/coverage + +./go.test.sh $COVERAGE_TEST "$@" + +go tool covdata textfmt -i="$ROOT/coverage" -o "$ROOT/coverage.out" + +rm $ROOT/coverage/* diff --git a/sh/go.test.sh b/sh/go.test.sh new file mode 100755 index 0000000..65fc7ea --- /dev/null +++ b/sh/go.test.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +DIR=$(pwd) + +drivers=$($DIR/utils/drivers.sh) + +cd ../ + +ROOT=$(pwd) + +golist() { + go list ./... | grep -v mock | grep -v internal/ +} + +gotest() { + cd $driver + + go test $(golist) "$@" + + cd $ROOT +} + +cd trm && go test $(golist) $@ & +cd $ROOT + +for driver in $drivers; do + if [ -d "$driver" ]; then + gotest $@ & + fi +done + +wait diff --git a/sh/lint.sh b/sh/lint.sh new file mode 100755 index 0000000..64b2bb6 --- /dev/null +++ b/sh/lint.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +DIR=$(pwd) +drivers=$($DIR/utils/drivers.sh) + +cd ../ + +ROOT=$(pwd) + +echo "\ntrm" +cd trm && golangci-lint run -c $ROOT/.golangci.yml --timeout=2m --path-prefix=trm $@ +cd $ROOT + +for driver in $drivers; do + if [ -d "$driver" ]; then + echo "\n$driver" + cd $driver && golangci-lint run -c $ROOT/.golangci.yml --timeout=2m --path-prefix=$driver $@ + + cd $ROOT + fi +done diff --git a/sh/tag.pkg.sh b/sh/tag.pkg.sh new file mode 100755 index 0000000..e74e361 --- /dev/null +++ b/sh/tag.pkg.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +DIR=$(pwd) +drivers=$($DIR/utils/drivers.sh) + +cd ../ + +tagVersion="v2.$1" + +echo "\ntrm" +curl https://proxy.golang.org/github.com/avito-tech/go-transaction-manager/trm/v2/@v/$tagVersion.info + +for driver in $drivers; do + if [ -d "$driver" ]; then + echo "\n$driver" + curl https://proxy.golang.org/github.com/avito-tech/go-transaction-manager/$driver/v2/@v/$tagVersion.info + fi +done diff --git a/sh/utils/drivers.sh b/sh/utils/drivers.sh new file mode 100755 index 0000000..2f63581 --- /dev/null +++ b/sh/utils/drivers.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd ../ + +echo drivers/* diff --git a/sh/utils/go.mod.dropreplace.default.sh b/sh/utils/go.mod.dropreplace.default.sh new file mode 100755 index 0000000..ef6bae4 --- /dev/null +++ b/sh/utils/go.mod.dropreplace.default.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +go mod edit -dropreplace=github.com/avito-tech/go-transaction-manager/trm/v2@v2=../../ + +# https://github.com/golang/go/issues/51932 +# https://go.dev/doc/tutorial/workspaces diff --git a/sh/utils/go.mod.replace.default.sh b/sh/utils/go.mod.replace.default.sh new file mode 100755 index 0000000..d4a749b --- /dev/null +++ b/sh/utils/go.mod.replace.default.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +go mod edit -replace=github.com/avito-tech/go-transaction-manager/trm/v2@v2=../../ diff --git a/trm/context/context.go b/trm/context/context.go index 5fb4377..62fa18f 100644 --- a/trm/context/context.go +++ b/trm/context/context.go @@ -4,8 +4,9 @@ package context import ( "context" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" + + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // DefaultManager is a trm.СtxManager with settings.DefaultCtxKey. diff --git a/trm/context/key.go b/trm/context/key.go index c6ace0c..4a1c975 100644 --- a/trm/context/key.go +++ b/trm/context/key.go @@ -3,7 +3,7 @@ package context import ( "sync/atomic" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) //nolint:gochecknoglobals diff --git a/trm/go.mod b/trm/go.mod new file mode 100644 index 0000000..e6329ca --- /dev/null +++ b/trm/go.mod @@ -0,0 +1,19 @@ +module github.com/avito-tech/go-transaction-manager/trm/v2 + +go 1.13 + +require ( + github.com/DATA-DOG/go-sqlmock v1.5.1 + github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2 v2.0.0-rc6 + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/golang/mock v1.6.0 + github.com/jinzhu/copier v0.4.0 + github.com/jmoiron/sqlx v1.3.5 + github.com/kr/pretty v0.3.0 // indirect + github.com/lib/pq v1.10.2 // indirect + github.com/mattn/go-sqlite3 v1.14.18 + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/stretchr/testify v1.8.2 + go.uber.org/multierr v1.9.0 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect +) diff --git a/trm/go.sum b/trm/go.sum new file mode 100644 index 0000000..cd62230 --- /dev/null +++ b/trm/go.sum @@ -0,0 +1,97 @@ +github.com/DATA-DOG/go-sqlmock v1.5.1 h1:FK6RCIUSfmbnI/imIICmboyQBkOckutaa6R5YYlLZyo= +github.com/DATA-DOG/go-sqlmock v1.5.1/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= +github.com/avito-tech/go-transaction-manager/drivers/sql/v2 v2.0.0-rc6 h1:aLd6YRH0sAW5ev/Y4EZ6e1s9ZvhAJEoWZNvDTt9760E= +github.com/avito-tech/go-transaction-manager/drivers/sql/v2 v2.0.0-rc6/go.mod h1:00Cif8xUIQfAtpQ5cuPt9T9dDNJ9bGcY9ev/JpcR0tc= +github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2 v2.0.0-rc6 h1:EaGR/tdyQ/hZHvg2gseCkYwiMFlSg3um4PXS16ZDRjE= +github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2 v2.0.0-rc6/go.mod h1:WkB+h0Fx4qiLAgeFw1xLc1gGwqhOdtndUUmHC6Cww/M= +github.com/avito-tech/go-transaction-manager/trm/v2 v2.0.0-rc6/go.mod h1:efBmVaj9GiucjXsVk7rIwgWXsfoS+1XJqLF9g4TKKZE= +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.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= +github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.18 h1:JL0eqdCOq6DJVNPSvArO/bIV9/P7fbGrV00LZHc+5aI= +github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +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.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +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.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.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.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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +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-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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/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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +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= +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/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +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/internal/benchmark/allocation/README.md b/trm/internal/benchmark/allocation/README.md similarity index 100% rename from internal/benchmark/allocation/README.md rename to trm/internal/benchmark/allocation/README.md diff --git a/internal/benchmark/allocation/key_in_ctx.go b/trm/internal/benchmark/allocation/key_in_ctx.go similarity index 81% rename from internal/benchmark/allocation/key_in_ctx.go rename to trm/internal/benchmark/allocation/key_in_ctx.go index fdb8d4f..e61255f 100644 --- a/internal/benchmark/allocation/key_in_ctx.go +++ b/trm/internal/benchmark/allocation/key_in_ctx.go @@ -4,7 +4,7 @@ import ( "context" "sync" - "github.com/avito-tech/go-transaction-manager/internal/benchmark/common" + "github.com/avito-tech/go-transaction-manager/trm/v2/internal/benchmark/common" ) func keyInContext() { diff --git a/internal/benchmark/allocation/main.go b/trm/internal/benchmark/allocation/main.go similarity index 100% rename from internal/benchmark/allocation/main.go rename to trm/internal/benchmark/allocation/main.go diff --git a/internal/benchmark/allocation/tx_in_ctx.go b/trm/internal/benchmark/allocation/tx_in_ctx.go similarity index 82% rename from internal/benchmark/allocation/tx_in_ctx.go rename to trm/internal/benchmark/allocation/tx_in_ctx.go index cc7089a..11e0291 100644 --- a/internal/benchmark/allocation/tx_in_ctx.go +++ b/trm/internal/benchmark/allocation/tx_in_ctx.go @@ -6,7 +6,7 @@ import ( "github.com/jmoiron/sqlx" - "github.com/avito-tech/go-transaction-manager/internal/benchmark/common" + "github.com/avito-tech/go-transaction-manager/trm/v2/internal/benchmark/common" ) func trInContext() { diff --git a/internal/benchmark/common/ctx.go b/trm/internal/benchmark/common/ctx.go similarity index 100% rename from internal/benchmark/common/ctx.go rename to trm/internal/benchmark/common/ctx.go diff --git a/internal/benchmark/common/error.go b/trm/internal/benchmark/common/error.go similarity index 100% rename from internal/benchmark/common/error.go rename to trm/internal/benchmark/common/error.go diff --git a/internal/benchmark/map_vs_context/README.md b/trm/internal/benchmark/map_vs_context/README.md similarity index 100% rename from internal/benchmark/map_vs_context/README.md rename to trm/internal/benchmark/map_vs_context/README.md diff --git a/internal/benchmark/map_vs_context/common.go b/trm/internal/benchmark/map_vs_context/common.go similarity index 90% rename from internal/benchmark/map_vs_context/common.go rename to trm/internal/benchmark/map_vs_context/common.go index fd59957..a42d37f 100644 --- a/internal/benchmark/map_vs_context/common.go +++ b/trm/internal/benchmark/map_vs_context/common.go @@ -6,7 +6,7 @@ import ( "github.com/jinzhu/copier" - "github.com/avito-tech/go-transaction-manager/internal/benchmark/common" + "github.com/avito-tech/go-transaction-manager/trm/v2/internal/benchmark/common" ) func getDB() *sql.DB { diff --git a/internal/benchmark/map_vs_context/context_test.go b/trm/internal/benchmark/map_vs_context/context_test.go similarity index 93% rename from internal/benchmark/map_vs_context/context_test.go rename to trm/internal/benchmark/map_vs_context/context_test.go index b42570a..2cdf50a 100644 --- a/internal/benchmark/map_vs_context/context_test.go +++ b/trm/internal/benchmark/map_vs_context/context_test.go @@ -8,7 +8,7 @@ import ( _ "github.com/mattn/go-sqlite3" - "github.com/avito-tech/go-transaction-manager/internal/benchmark/common" + "github.com/avito-tech/go-transaction-manager/trm/v2/internal/benchmark/common" ) const ( diff --git a/internal/benchmark/map_vs_context/map_test.go b/trm/internal/benchmark/map_vs_context/map_test.go similarity index 95% rename from internal/benchmark/map_vs_context/map_test.go rename to trm/internal/benchmark/map_vs_context/map_test.go index 64f2bde..baa69b5 100644 --- a/internal/benchmark/map_vs_context/map_test.go +++ b/trm/internal/benchmark/map_vs_context/map_test.go @@ -8,7 +8,7 @@ import ( _ "github.com/mattn/go-sqlite3" - "github.com/avito-tech/go-transaction-manager/internal/benchmark/common" + "github.com/avito-tech/go-transaction-manager/trm/v2/internal/benchmark/common" ) // run with -test.benchtime=1s -test.benchmem diff --git a/internal/benchmark/with_or_without_trm/README.md b/trm/internal/benchmark/with_or_without_trm/README.md similarity index 100% rename from internal/benchmark/with_or_without_trm/README.md rename to trm/internal/benchmark/with_or_without_trm/README.md diff --git a/internal/benchmark/with_or_without_trm/clean_test.go b/trm/internal/benchmark/with_or_without_trm/clean_test.go similarity index 100% rename from internal/benchmark/with_or_without_trm/clean_test.go rename to trm/internal/benchmark/with_or_without_trm/clean_test.go diff --git a/internal/benchmark/with_or_without_trm/common_test.go b/trm/internal/benchmark/with_or_without_trm/common_test.go similarity index 100% rename from internal/benchmark/with_or_without_trm/common_test.go rename to trm/internal/benchmark/with_or_without_trm/common_test.go diff --git a/internal/benchmark/with_or_without_trm/model.go b/trm/internal/benchmark/with_or_without_trm/model.go similarity index 100% rename from internal/benchmark/with_or_without_trm/model.go rename to trm/internal/benchmark/with_or_without_trm/model.go diff --git a/internal/benchmark/with_or_without_trm/repo.go b/trm/internal/benchmark/with_or_without_trm/repo.go similarity index 100% rename from internal/benchmark/with_or_without_trm/repo.go rename to trm/internal/benchmark/with_or_without_trm/repo.go diff --git a/internal/benchmark/with_or_without_trm/trm_test.go b/trm/internal/benchmark/with_or_without_trm/trm_test.go similarity index 88% rename from internal/benchmark/with_or_without_trm/trm_test.go rename to trm/internal/benchmark/with_or_without_trm/trm_test.go index 57f980b..d1099d7 100644 --- a/internal/benchmark/with_or_without_trm/trm_test.go +++ b/trm/internal/benchmark/with_or_without_trm/trm_test.go @@ -8,8 +8,9 @@ import ( _ "github.com/mattn/go-sqlite3" "github.com/stretchr/testify/require" - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" - "github.com/avito-tech/go-transaction-manager/trm/manager" + trmsqlx "github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2" + + "github.com/avito-tech/go-transaction-manager/trm/v2/manager" ) func BenchmarkTRM_MockDB(b *testing.B) { diff --git a/internal/benchmark/with_or_without_trm/trmrepo.go b/trm/internal/benchmark/with_or_without_trm/trmrepo.go similarity index 92% rename from internal/benchmark/with_or_without_trm/trmrepo.go rename to trm/internal/benchmark/with_or_without_trm/trmrepo.go index aa67a4b..7a21865 100644 --- a/internal/benchmark/with_or_without_trm/trmrepo.go +++ b/trm/internal/benchmark/with_or_without_trm/trmrepo.go @@ -5,7 +5,7 @@ import ( "github.com/jmoiron/sqlx" - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" + trmsqlx "github.com/avito-tech/go-transaction-manager/drivers/sqlx/v2" ) type trmRepo struct { diff --git a/internal/codegen/redis/README.md b/trm/internal/codegen/redis/README.md similarity index 100% rename from internal/codegen/redis/README.md rename to trm/internal/codegen/redis/README.md diff --git a/internal/recover_defer/defer_test.go b/trm/internal/recover_defer/defer_test.go similarity index 100% rename from internal/recover_defer/defer_test.go rename to trm/internal/recover_defer/defer_test.go diff --git a/internal/recover_defer/recover_test.go b/trm/internal/recover_defer/recover_test.go similarity index 100% rename from internal/recover_defer/recover_test.go rename to trm/internal/recover_defer/recover_test.go diff --git a/trm/manager/chain.go b/trm/manager/chain.go index 6f3d401..75d9230 100644 --- a/trm/manager/chain.go +++ b/trm/manager/chain.go @@ -3,7 +3,7 @@ package manager import ( "context" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // ChainedMW starts transactions in the order given and commit/rollback in reverse order. diff --git a/trm/manager/chain_test.go b/trm/manager/chain_test.go index eca8a6e..18fa62c 100644 --- a/trm/manager/chain_test.go +++ b/trm/manager/chain_test.go @@ -8,9 +8,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/avito-tech/go-transaction-manager/trm" - "github.com/avito-tech/go-transaction-manager/trm/mock" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2/mock" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" + + "github.com/avito-tech/go-transaction-manager/trm/v2" ) func TestChainedMW_Do(t *testing.T) { diff --git a/trm/manager/closer.go b/trm/manager/closer.go index 6a99cfd..605141b 100644 --- a/trm/manager/closer.go +++ b/trm/manager/closer.go @@ -7,7 +7,7 @@ import ( "go.uber.org/multierr" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // Closer closes trm.Transaction. diff --git a/trm/manager/manager.go b/trm/manager/manager.go index 8466b5d..be625b5 100644 --- a/trm/manager/manager.go +++ b/trm/manager/manager.go @@ -6,9 +6,10 @@ import ( "go.uber.org/multierr" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - "github.com/avito-tech/go-transaction-manager/trm/settings" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" + + "github.com/avito-tech/go-transaction-manager/trm/v2" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" ) // Opt is a type to configure Manager. diff --git a/trm/manager/manager_test.go b/trm/manager/manager_test.go index 53712fa..70e28e1 100644 --- a/trm/manager/manager_test.go +++ b/trm/manager/manager_test.go @@ -11,12 +11,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - trmmock "github.com/avito-tech/go-transaction-manager/internal/mock" - "github.com/avito-tech/go-transaction-manager/trm" - trmcontext "github.com/avito-tech/go-transaction-manager/trm/context" - mock_log "github.com/avito-tech/go-transaction-manager/trm/manager/mock" - "github.com/avito-tech/go-transaction-manager/trm/mock" - "github.com/avito-tech/go-transaction-manager/trm/settings" + trmcontext "github.com/avito-tech/go-transaction-manager/trm/v2/context" + mock_log "github.com/avito-tech/go-transaction-manager/trm/v2/manager/mock" + "github.com/avito-tech/go-transaction-manager/trm/v2/mock" + "github.com/avito-tech/go-transaction-manager/trm/v2/settings" + + "github.com/avito-tech/go-transaction-manager/trm/v2" ) func Test_transactionManager_Do(t *testing.T) { @@ -573,7 +573,7 @@ func Test_transactionManager_Do_Panic(t *testing.T) { testPanic := "panic" testRollbackErr := errors.New("rollback error") - log := trmmock.NewLog() + log := mock.NewLog() factory := func(ctx context.Context, _ trm.Settings) (context.Context, trm.Transaction, error) { tx := mock.NewMockTransaction(ctrl) @@ -776,7 +776,7 @@ func TestManager_WithOpts(t *testing.T) { t.Run("set", func(t *testing.T) { t.Parallel() - l := trmmock.NewZeroLog() + l := mock.NewZeroLog() m := Must(nil, WithLog(l), WithSettings(s{})) assert.Equal(t, l, m.log) diff --git a/trm/manager/option.go b/trm/manager/option.go index 20dd0e3..0bcc9e0 100644 --- a/trm/manager/option.go +++ b/trm/manager/option.go @@ -1,6 +1,6 @@ package manager -import "github.com/avito-tech/go-transaction-manager/trm" +import "github.com/avito-tech/go-transaction-manager/trm/v2" // WithLog sets logger for Manager. func WithLog(l logger) Opt { diff --git a/trm/manager/struct_test.go b/trm/manager/struct_test.go index a94171e..0c7ae35 100644 --- a/trm/manager/struct_test.go +++ b/trm/manager/struct_test.go @@ -4,7 +4,7 @@ package manager import ( "time" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) type s struct{} diff --git a/internal/mock/log.go b/trm/mock/log.go similarity index 94% rename from internal/mock/log.go rename to trm/mock/log.go index 7b2041d..daf08c1 100644 --- a/internal/mock/log.go +++ b/trm/mock/log.go @@ -14,7 +14,9 @@ type Log struct { // NewLog create mock Log. func NewLog() *Log { - return &Log{} + return &Log{ + Logged: nil, + } } func (l *Log) Warning(_ context.Context, msg string) { diff --git a/trm/mock/manager.go b/trm/mock/manager.go index b6d3db2..1e3c99e 100644 --- a/trm/mock/manager.go +++ b/trm/mock/manager.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - trm "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" gomock "github.com/golang/mock/gomock" ) diff --git a/trm/mock/settings.go b/trm/mock/settings.go index f7cbb71..34fef61 100644 --- a/trm/mock/settings.go +++ b/trm/mock/settings.go @@ -8,7 +8,7 @@ import ( reflect "reflect" time "time" - trm "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" gomock "github.com/golang/mock/gomock" ) diff --git a/trm/mock/transaction.go b/trm/mock/transaction.go index f02025b..42f1665 100644 --- a/trm/mock/transaction.go +++ b/trm/mock/transaction.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - trm "github.com/avito-tech/go-transaction-manager/trm" + trm "github.com/avito-tech/go-transaction-manager/trm/v2" gomock "github.com/golang/mock/gomock" ) diff --git a/trm/settings.go b/trm/settings.go index ca92fa8..aedc623 100644 --- a/trm/settings.go +++ b/trm/settings.go @@ -2,7 +2,9 @@ package trm //go:generate mockgen -source=$GOFILE -destination=mock/$GOFILE -package=mock -import "time" +import ( + "time" +) // Settings is the configuration of the Manager. // Preferable to implement as an immutable struct. diff --git a/trm/settings/option.go b/trm/settings/option.go index 99ee51b..c0b5153 100644 --- a/trm/settings/option.go +++ b/trm/settings/option.go @@ -3,7 +3,7 @@ package settings import ( "time" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // WithCtxKey sets up trm.CtxKey for the trm.Settings. diff --git a/trm/settings/settings.go b/trm/settings/settings.go index 284ae78..d01bb16 100644 --- a/trm/settings/settings.go +++ b/trm/settings/settings.go @@ -4,7 +4,7 @@ package settings import ( "time" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) // DefaultCtxKey is a default key to store Transaction. diff --git a/trm/settings/settings_test.go b/trm/settings/settings_test.go index 6099ec0..bfc3f73 100644 --- a/trm/settings/settings_test.go +++ b/trm/settings/settings_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/avito-tech/go-transaction-manager/trm/v2" ) func TestSettings_EnrichBy(t *testing.T) {