diff --git a/go.mod b/go.mod index 4d930c7..48d3ce3 100644 --- a/go.mod +++ b/go.mod @@ -11,13 +11,18 @@ require ( ) require ( + github.com/cockroachdb/apd v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect go.uber.org/atomic v1.7.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( - github.com/avito-tech/go-transaction-manager v1.4.0 github.com/distribution/reference v0.5.0 // indirect github.com/docker/distribution v2.8.3+incompatible // indirect github.com/docker/docker v24.0.6+incompatible // indirect @@ -32,7 +37,7 @@ require ( github.com/jackc/pgx/v5 v5.4.3 github.com/lib/pq v1.10.2 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/stretchr/testify v1.8.4 // indirect + github.com/stretchr/testify v1.8.4 go.uber.org/multierr v1.10.0 // indirect golang.org/x/crypto v0.9.0 golang.org/x/text v0.9.0 // indirect diff --git a/go.sum b/go.sum index d30e0da..87eeb23 100644 --- a/go.sum +++ b/go.sum @@ -1,25 +1,10 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -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/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/avito-tech/go-transaction-manager v1.4.0 h1:r5JFaWk1YhnAsjFUJoR7uosk4PZ+Le7EQzFxjO4ShC0= -github.com/avito-tech/go-transaction-manager v1.4.0/go.mod h1:As4bqT+4otNEPUSLxi9LAAh1ZbpDWOcRCJM38Cm7j5Y= -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 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= -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/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/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dhui/dktest v0.3.16 h1:i6gq2YQEtcrjKbeJpBkWjE8MmLZPYllcjOFbTZuPDnw= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= @@ -29,23 +14,12 @@ github.com/docker/docker v24.0.6+incompatible h1:hceabKCtUgDqPu+qm0NgsaXf28Ljf4/ github.com/docker/docker v24.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -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-chi/chi v1.5.5 h1:vOB/HbEMt9QqBqErz07QehcOKHaWFtuj87tTDVz2qXE= github.com/go-chi/chi v1.5.5/go.mod h1:C9JqLr3tIYjDOZpzn+BCuxY8z8vmca43EeMgyZt7irw= github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= -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/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -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-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= 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/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -53,366 +27,72 @@ github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJ github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang-migrate/migrate/v4 v4.16.2 h1:8coYbMKUyInrFk1lfGfRovTLAW7PhWp8qQDT2iKfuoA= github.com/golang-migrate/migrate/v4 v4.16.2/go.mod h1:pfcJX4nPHaVdc5nmdCikFBWtm+UBpiZjRNNsyBbp0/o= -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/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/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/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -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/fake v0.0.0-20150926172116-812a484cc733 h1:vr3AYkKovP8uR8AvSGGUK1IDqRa5lAAvEkZG1LKaCRc= github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= -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/pgerrcode v0.0.0-20220416144525-469b46aa5efa h1:s+4MhCQ6YrzisK6hFJUX53drDT4UsSW3DEhKn0ifuHw= github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa/go.mod h1:a/s9Lp5W7n/DD0VrVoyJ00FbP2ytTPDVOivvn2bMlds= -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 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= -github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.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 h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= 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 v3.6.2+incompatible h1:2zP5OD7kiyR3xzRYMhOcXVvkDZsImVXfj+yIyTQf3/o= github.com/jackc/pgx v3.6.2+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= -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.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= github.com/jackc/pgx/v5 v5.4.3/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/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.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= -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/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/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -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/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 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-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-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/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -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/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/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/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= -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/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -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/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= -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.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/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/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.1/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= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.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/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= -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-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/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= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.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= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.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/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -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/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/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/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/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= -gorm.io/driver/mysql v1.5.1/go.mod h1:Jo3Xu7mMhCyj8dlrb3WoCaRd1FhsVh+yMXb1jUInf5o= -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.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= -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/internal/infrastructure/repository/order.go b/internal/infrastructure/repository/order.go index 12079fd..00225c1 100644 --- a/internal/infrastructure/repository/order.go +++ b/internal/infrastructure/repository/order.go @@ -6,21 +6,25 @@ import ( "errors" "github.com/Chystik/gophermart/internal/models" + "github.com/Chystik/gophermart/pkg/logger" + "github.com/Chystik/gophermart/pkg/transaction" - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" "github.com/jackc/pgx/v5/pgconn" "github.com/jmoiron/sqlx" + "go.uber.org/zap" ) type orderRepository struct { *sqlx.DB - getter *trmsqlx.CtxGetter + getter transaction.CtxGetter + logger logger.AppLogger } -func NewOrderRepository(db *sqlx.DB, getter *trmsqlx.CtxGetter) *orderRepository { +func NewOrderRepository(db *sqlx.DB, getter transaction.CtxGetter, logger logger.AppLogger) *orderRepository { return &orderRepository{ DB: db, getter: getter, + logger: logger, } } @@ -30,7 +34,9 @@ func (or *orderRepository) Create(ctx context.Context, order models.Order) error VALUES (:number, :user_id, :status, :accrual, :uploaded_at) ON CONFLICT (number) DO NOTHING` - _, err := sqlx.NamedExecContext(ctx, or.getter.DefaultTrOrDB(ctx, or.DB), query, order) + or.logger.Debug("OrderRepository.Create", zap.String("query", query)) + + _, err := sqlx.NamedExecContext(ctx, or.getter.GetTrxOrDB(ctx, or.DB), query, order) if err != nil { pgErr, ok := err.(*pgconn.PgError) if !ok { @@ -49,7 +55,9 @@ func (or *orderRepository) Get(ctx context.Context, order models.Order) (models. FROM praktikum.order WHERE number = $1` - err := sqlx.GetContext(ctx, or.getter.DefaultTrOrDB(ctx, or.DB), &order, query, order.Number) + or.logger.Debug("OrderRepository.Get", zap.String("query", query)) + + err := sqlx.GetContext(ctx, or.getter.GetTrxOrDB(ctx, or.DB), &order, query, order.Number) if err != nil { if errors.Is(err, sql.ErrNoRows) { return order, &models.AppError{Op: "orderRepository.Get", Code: models.ErrNotFound, Message: "order not found"} @@ -70,7 +78,9 @@ func (or *orderRepository) GetList(ctx context.Context, login models.User) ([]mo WHERE user_id = :login ORDER BY uploaded_at ASC` - rows, err := sqlx.NamedQueryContext(ctx, or.getter.DefaultTrOrDB(ctx, or.DB), query, login) + or.logger.Debug("OrderRepository.GetList", zap.String("query", query)) + + rows, err := sqlx.NamedQueryContext(ctx, or.getter.GetTrxOrDB(ctx, or.DB), query, login) if err != nil { return nil, err } @@ -94,7 +104,9 @@ func (or *orderRepository) Update(ctx context.Context, order models.Order) error SET status = :status, accrual = :accrual WHERE number = :number` - _, err := sqlx.NamedExecContext(ctx, or.getter.DefaultTrOrDB(ctx, or.DB), query, order) + or.logger.Debug("OrderRepository.Update", zap.String("query", query)) + + _, err := sqlx.NamedExecContext(ctx, or.getter.GetTrxOrDB(ctx, or.DB), query, order) return err } @@ -108,7 +120,9 @@ func (or *orderRepository) GetUnprocessed(ctx context.Context) ([]models.Order, FROM praktikum.order WHERE status = ANY ($1)` - err := sqlx.SelectContext(ctx, or.getter.DefaultTrOrDB(ctx, or.DB), &orders, query, stat) + or.logger.Debug("OrderRepository.GetUnprocessed", zap.String("query", query)) + + err := sqlx.SelectContext(ctx, or.getter.GetTrxOrDB(ctx, or.DB), &orders, query, stat) if err != nil { return nil, err } diff --git a/internal/infrastructure/repository/user.go b/internal/infrastructure/repository/user.go index 0b598e7..dcfd761 100644 --- a/internal/infrastructure/repository/user.go +++ b/internal/infrastructure/repository/user.go @@ -6,21 +6,25 @@ import ( "errors" "github.com/Chystik/gophermart/internal/models" + "github.com/Chystik/gophermart/pkg/logger" + "github.com/Chystik/gophermart/pkg/transaction" - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" "github.com/jackc/pgx/v5/pgconn" "github.com/jmoiron/sqlx" + "go.uber.org/zap" ) type userRepository struct { *sqlx.DB - getter *trmsqlx.CtxGetter + getter transaction.CtxGetter + logger logger.AppLogger } -func NewUserRepository(db *sqlx.DB, getter *trmsqlx.CtxGetter) *userRepository { +func NewUserRepository(db *sqlx.DB, getter transaction.CtxGetter, logger logger.AppLogger) *userRepository { return &userRepository{ DB: db, getter: getter, + logger: logger, } } @@ -29,7 +33,9 @@ func (ur *userRepository) Create(ctx context.Context, user models.User) error { INSERT INTO praktikum.user (login, password, balance, withdrawn) VALUES (:login, :password, :balance, :withdrawn)` - _, err := sqlx.NamedExecContext(ctx, ur.getter.DefaultTrOrDB(ctx, ur.DB), query, user) + ur.logger.Debug("UserRepository.Create", zap.String("query", query)) + + _, err := sqlx.NamedExecContext(ctx, ur.getter.GetTrxOrDB(ctx, ur.DB), query, user) if err != nil { pgErr, ok := err.(*pgconn.PgError) if !ok { @@ -49,7 +55,9 @@ func (ur *userRepository) Get(ctx context.Context, user models.User) (models.Use FROM praktikum.user WHERE login = :login` - rows, err := sqlx.NamedQueryContext(ctx, ur.getter.DefaultTrOrDB(ctx, ur.DB), query, user) + ur.logger.Debug("UserRepository.Get", zap.String("query", query)) + + rows, err := sqlx.NamedQueryContext(ctx, ur.getter.GetTrxOrDB(ctx, ur.DB), query, user) if err != nil { if errors.Is(err, sql.ErrNoRows) { return user, &models.AppError{Op: "userRepository.Get", Code: models.ErrNotFound, Message: "user not found"} @@ -78,7 +86,9 @@ func (ur *userRepository) Update(ctx context.Context, user models.User) error { SET balance = :balance, withdrawn = :withdrawn WHERE login = :login` - _, err := sqlx.NamedExecContext(ctx, ur.getter.DefaultTrOrDB(ctx, ur.DB), query, user) + ur.logger.Debug("UserRepository.Update", zap.String("query", query)) + + _, err := sqlx.NamedExecContext(ctx, ur.getter.GetTrxOrDB(ctx, ur.DB), query, user) return err } diff --git a/internal/infrastructure/repository/withdrawal.go b/internal/infrastructure/repository/withdrawal.go index 864a424..25a4d26 100644 --- a/internal/infrastructure/repository/withdrawal.go +++ b/internal/infrastructure/repository/withdrawal.go @@ -4,20 +4,24 @@ import ( "context" "github.com/Chystik/gophermart/internal/models" + "github.com/Chystik/gophermart/pkg/logger" + "github.com/Chystik/gophermart/pkg/transaction" - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" "github.com/jmoiron/sqlx" + "go.uber.org/zap" ) type withdrawalRepository struct { *sqlx.DB - getter *trmsqlx.CtxGetter + getter transaction.CtxGetter + logger logger.AppLogger } -func NewWithdrawalRepository(db *sqlx.DB, getter *trmsqlx.CtxGetter) *withdrawalRepository { +func NewWithdrawalRepository(db *sqlx.DB, getter transaction.CtxGetter, logger logger.AppLogger) *withdrawalRepository { return &withdrawalRepository{ DB: db, getter: getter, + logger: logger, } } @@ -26,7 +30,9 @@ func (wr *withdrawalRepository) Create(ctx context.Context, w models.Withdrawal) INSERT INTO praktikum.withdrawal (order_id, sum, processed_at) VALUES (:order_id, :sum, :processed_at)` - _, err := sqlx.NamedExecContext(ctx, wr.getter.DefaultTrOrDB(ctx, wr.DB), query, w) + wr.logger.Debug("WithdrawalRepository.Create", zap.String("query", query)) + + _, err := sqlx.NamedExecContext(ctx, wr.getter.GetTrxOrDB(ctx, wr.DB), query, w) if err != nil { return err } @@ -42,7 +48,9 @@ func (wr *withdrawalRepository) GetAll(ctx context.Context) ([]models.Withdrawal FROM praktikum.withdrawal ORDER BY processed_at ASC` - err := sqlx.SelectContext(ctx, wr.getter.DefaultTrOrDB(ctx, wr.DB), &w, query) + wr.logger.Debug("WithdrawalRepository.GetAll", zap.String("query", query)) + + err := sqlx.SelectContext(ctx, wr.getter.GetTrxOrDB(ctx, wr.DB), &w, query) if err != nil { return nil, err } diff --git a/internal/middleware/logger.go b/internal/middleware/logger.go index 3c8b18c..c005d8b 100644 --- a/internal/middleware/logger.go +++ b/internal/middleware/logger.go @@ -55,14 +55,18 @@ func (l *midLogger) WithLogging(next http.Handler) http.Handler { ResponseWriter: w, responseData: responseData, } + l.Info( + "request started", + zap.String("uri", r.RequestURI), + zap.String("method", r.Method), + ) + next.ServeHTTP(&lw, r) duration := time.Since(start) l.Info( - "request started", - zap.String("uri", r.RequestURI), - zap.String("method", r.Method), + "response completed", zap.Int("status", responseData.status), zap.Duration("duration", duration), zap.Int("size", responseData.size), diff --git a/internal/usecase/mocks/accrual_web_api.go b/internal/usecase/mocks/accrual_web_api.go new file mode 100644 index 0000000..8648ae1 --- /dev/null +++ b/internal/usecase/mocks/accrual_web_api.go @@ -0,0 +1,90 @@ +// Code generated by mockery v2.23.4. DO NOT EDIT. + +package mocks + +import ( + context "context" + + models "github.com/Chystik/gophermart/internal/models" + mock "github.com/stretchr/testify/mock" +) + +// AccrualWebAPI is an autogenerated mock type for the AccrualWebAPI type +type AccrualWebAPI struct { + mock.Mock +} + +type AccrualWebAPI_Expecter struct { + mock *mock.Mock +} + +func (_m *AccrualWebAPI) EXPECT() *AccrualWebAPI_Expecter { + return &AccrualWebAPI_Expecter{mock: &_m.Mock} +} + +// GetOrder provides a mock function with given fields: _a0, _a1 +func (_m *AccrualWebAPI) GetOrder(_a0 context.Context, _a1 models.Order) (models.Order, error) { + ret := _m.Called(_a0, _a1) + + var r0 models.Order + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, models.Order) (models.Order, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, models.Order) models.Order); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Get(0).(models.Order) + } + + if rf, ok := ret.Get(1).(func(context.Context, models.Order) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AccrualWebAPI_GetOrder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOrder' +type AccrualWebAPI_GetOrder_Call struct { + *mock.Call +} + +// GetOrder is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.Order +func (_e *AccrualWebAPI_Expecter) GetOrder(_a0 interface{}, _a1 interface{}) *AccrualWebAPI_GetOrder_Call { + return &AccrualWebAPI_GetOrder_Call{Call: _e.mock.On("GetOrder", _a0, _a1)} +} + +func (_c *AccrualWebAPI_GetOrder_Call) Run(run func(_a0 context.Context, _a1 models.Order)) *AccrualWebAPI_GetOrder_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.Order)) + }) + return _c +} + +func (_c *AccrualWebAPI_GetOrder_Call) Return(_a0 models.Order, _a1 error) *AccrualWebAPI_GetOrder_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *AccrualWebAPI_GetOrder_Call) RunAndReturn(run func(context.Context, models.Order) (models.Order, error)) *AccrualWebAPI_GetOrder_Call { + _c.Call.Return(run) + return _c +} + +// NewAccrualWebAPI creates a new instance of AccrualWebAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAccrualWebAPI(t interface { + mock.TestingT + Cleanup(func()) +}) *AccrualWebAPI { + mock := &AccrualWebAPI{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/usecase/mocks/mocks.go b/internal/usecase/mocks/mocks.go new file mode 100644 index 0000000..0f70689 --- /dev/null +++ b/internal/usecase/mocks/mocks.go @@ -0,0 +1,3 @@ +package mocks + +//go:generate mockery --name=.* --recursive=false --case=underscore --dir ./.. --output . --with-expecter diff --git a/internal/usecase/mocks/order_interactor.go b/internal/usecase/mocks/order_interactor.go new file mode 100644 index 0000000..4473e57 --- /dev/null +++ b/internal/usecase/mocks/order_interactor.go @@ -0,0 +1,135 @@ +// Code generated by mockery v2.23.4. DO NOT EDIT. + +package mocks + +import ( + context "context" + + models "github.com/Chystik/gophermart/internal/models" + mock "github.com/stretchr/testify/mock" +) + +// OrderInteractor is an autogenerated mock type for the OrderInteractor type +type OrderInteractor struct { + mock.Mock +} + +type OrderInteractor_Expecter struct { + mock *mock.Mock +} + +func (_m *OrderInteractor) EXPECT() *OrderInteractor_Expecter { + return &OrderInteractor_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: _a0, _a1 +func (_m *OrderInteractor) Create(_a0 context.Context, _a1 models.Order) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, models.Order) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// OrderInteractor_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type OrderInteractor_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.Order +func (_e *OrderInteractor_Expecter) Create(_a0 interface{}, _a1 interface{}) *OrderInteractor_Create_Call { + return &OrderInteractor_Create_Call{Call: _e.mock.On("Create", _a0, _a1)} +} + +func (_c *OrderInteractor_Create_Call) Run(run func(_a0 context.Context, _a1 models.Order)) *OrderInteractor_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.Order)) + }) + return _c +} + +func (_c *OrderInteractor_Create_Call) Return(_a0 error) *OrderInteractor_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OrderInteractor_Create_Call) RunAndReturn(run func(context.Context, models.Order) error) *OrderInteractor_Create_Call { + _c.Call.Return(run) + return _c +} + +// GetList provides a mock function with given fields: _a0, _a1 +func (_m *OrderInteractor) GetList(_a0 context.Context, _a1 models.User) ([]models.Order, error) { + ret := _m.Called(_a0, _a1) + + var r0 []models.Order + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, models.User) ([]models.Order, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, models.User) []models.Order); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]models.Order) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, models.User) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrderInteractor_GetList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetList' +type OrderInteractor_GetList_Call struct { + *mock.Call +} + +// GetList is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.User +func (_e *OrderInteractor_Expecter) GetList(_a0 interface{}, _a1 interface{}) *OrderInteractor_GetList_Call { + return &OrderInteractor_GetList_Call{Call: _e.mock.On("GetList", _a0, _a1)} +} + +func (_c *OrderInteractor_GetList_Call) Run(run func(_a0 context.Context, _a1 models.User)) *OrderInteractor_GetList_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.User)) + }) + return _c +} + +func (_c *OrderInteractor_GetList_Call) Return(_a0 []models.Order, _a1 error) *OrderInteractor_GetList_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OrderInteractor_GetList_Call) RunAndReturn(run func(context.Context, models.User) ([]models.Order, error)) *OrderInteractor_GetList_Call { + _c.Call.Return(run) + return _c +} + +// NewOrderInteractor creates a new instance of OrderInteractor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewOrderInteractor(t interface { + mock.TestingT + Cleanup(func()) +}) *OrderInteractor { + mock := &OrderInteractor{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/usecase/mocks/order_repository.go b/internal/usecase/mocks/order_repository.go new file mode 100644 index 0000000..a62b559 --- /dev/null +++ b/internal/usecase/mocks/order_repository.go @@ -0,0 +1,285 @@ +// Code generated by mockery v2.23.4. DO NOT EDIT. + +package mocks + +import ( + context "context" + + models "github.com/Chystik/gophermart/internal/models" + mock "github.com/stretchr/testify/mock" +) + +// OrderRepository is an autogenerated mock type for the OrderRepository type +type OrderRepository struct { + mock.Mock +} + +type OrderRepository_Expecter struct { + mock *mock.Mock +} + +func (_m *OrderRepository) EXPECT() *OrderRepository_Expecter { + return &OrderRepository_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: _a0, _a1 +func (_m *OrderRepository) Create(_a0 context.Context, _a1 models.Order) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, models.Order) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// OrderRepository_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type OrderRepository_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.Order +func (_e *OrderRepository_Expecter) Create(_a0 interface{}, _a1 interface{}) *OrderRepository_Create_Call { + return &OrderRepository_Create_Call{Call: _e.mock.On("Create", _a0, _a1)} +} + +func (_c *OrderRepository_Create_Call) Run(run func(_a0 context.Context, _a1 models.Order)) *OrderRepository_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.Order)) + }) + return _c +} + +func (_c *OrderRepository_Create_Call) Return(_a0 error) *OrderRepository_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OrderRepository_Create_Call) RunAndReturn(run func(context.Context, models.Order) error) *OrderRepository_Create_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *OrderRepository) Get(_a0 context.Context, _a1 models.Order) (models.Order, error) { + ret := _m.Called(_a0, _a1) + + var r0 models.Order + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, models.Order) (models.Order, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, models.Order) models.Order); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Get(0).(models.Order) + } + + if rf, ok := ret.Get(1).(func(context.Context, models.Order) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrderRepository_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type OrderRepository_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.Order +func (_e *OrderRepository_Expecter) Get(_a0 interface{}, _a1 interface{}) *OrderRepository_Get_Call { + return &OrderRepository_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *OrderRepository_Get_Call) Run(run func(_a0 context.Context, _a1 models.Order)) *OrderRepository_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.Order)) + }) + return _c +} + +func (_c *OrderRepository_Get_Call) Return(_a0 models.Order, _a1 error) *OrderRepository_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OrderRepository_Get_Call) RunAndReturn(run func(context.Context, models.Order) (models.Order, error)) *OrderRepository_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetList provides a mock function with given fields: _a0, _a1 +func (_m *OrderRepository) GetList(_a0 context.Context, _a1 models.User) ([]models.Order, error) { + ret := _m.Called(_a0, _a1) + + var r0 []models.Order + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, models.User) ([]models.Order, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, models.User) []models.Order); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]models.Order) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, models.User) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrderRepository_GetList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetList' +type OrderRepository_GetList_Call struct { + *mock.Call +} + +// GetList is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.User +func (_e *OrderRepository_Expecter) GetList(_a0 interface{}, _a1 interface{}) *OrderRepository_GetList_Call { + return &OrderRepository_GetList_Call{Call: _e.mock.On("GetList", _a0, _a1)} +} + +func (_c *OrderRepository_GetList_Call) Run(run func(_a0 context.Context, _a1 models.User)) *OrderRepository_GetList_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.User)) + }) + return _c +} + +func (_c *OrderRepository_GetList_Call) Return(_a0 []models.Order, _a1 error) *OrderRepository_GetList_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OrderRepository_GetList_Call) RunAndReturn(run func(context.Context, models.User) ([]models.Order, error)) *OrderRepository_GetList_Call { + _c.Call.Return(run) + return _c +} + +// GetUnprocessed provides a mock function with given fields: _a0 +func (_m *OrderRepository) GetUnprocessed(_a0 context.Context) ([]models.Order, error) { + ret := _m.Called(_a0) + + var r0 []models.Order + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) ([]models.Order, error)); ok { + return rf(_a0) + } + if rf, ok := ret.Get(0).(func(context.Context) []models.Order); ok { + r0 = rf(_a0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]models.Order) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(_a0) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// OrderRepository_GetUnprocessed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUnprocessed' +type OrderRepository_GetUnprocessed_Call struct { + *mock.Call +} + +// GetUnprocessed is a helper method to define mock.On call +// - _a0 context.Context +func (_e *OrderRepository_Expecter) GetUnprocessed(_a0 interface{}) *OrderRepository_GetUnprocessed_Call { + return &OrderRepository_GetUnprocessed_Call{Call: _e.mock.On("GetUnprocessed", _a0)} +} + +func (_c *OrderRepository_GetUnprocessed_Call) Run(run func(_a0 context.Context)) *OrderRepository_GetUnprocessed_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *OrderRepository_GetUnprocessed_Call) Return(_a0 []models.Order, _a1 error) *OrderRepository_GetUnprocessed_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OrderRepository_GetUnprocessed_Call) RunAndReturn(run func(context.Context) ([]models.Order, error)) *OrderRepository_GetUnprocessed_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: _a0, _a1 +func (_m *OrderRepository) Update(_a0 context.Context, _a1 models.Order) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, models.Order) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// OrderRepository_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type OrderRepository_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.Order +func (_e *OrderRepository_Expecter) Update(_a0 interface{}, _a1 interface{}) *OrderRepository_Update_Call { + return &OrderRepository_Update_Call{Call: _e.mock.On("Update", _a0, _a1)} +} + +func (_c *OrderRepository_Update_Call) Run(run func(_a0 context.Context, _a1 models.Order)) *OrderRepository_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.Order)) + }) + return _c +} + +func (_c *OrderRepository_Update_Call) Return(_a0 error) *OrderRepository_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OrderRepository_Update_Call) RunAndReturn(run func(context.Context, models.Order) error) *OrderRepository_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewOrderRepository creates a new instance of OrderRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewOrderRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *OrderRepository { + mock := &OrderRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/usecase/mocks/user_interactor.go b/internal/usecase/mocks/user_interactor.go new file mode 100644 index 0000000..318aef2 --- /dev/null +++ b/internal/usecase/mocks/user_interactor.go @@ -0,0 +1,274 @@ +// Code generated by mockery v2.23.4. DO NOT EDIT. + +package mocks + +import ( + context "context" + + models "github.com/Chystik/gophermart/internal/models" + mock "github.com/stretchr/testify/mock" +) + +// UserInteractor is an autogenerated mock type for the UserInteractor type +type UserInteractor struct { + mock.Mock +} + +type UserInteractor_Expecter struct { + mock *mock.Mock +} + +func (_m *UserInteractor) EXPECT() *UserInteractor_Expecter { + return &UserInteractor_Expecter{mock: &_m.Mock} +} + +// Authenticate provides a mock function with given fields: _a0, _a1 +func (_m *UserInteractor) Authenticate(_a0 context.Context, _a1 models.User) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, models.User) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UserInteractor_Authenticate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authenticate' +type UserInteractor_Authenticate_Call struct { + *mock.Call +} + +// Authenticate is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.User +func (_e *UserInteractor_Expecter) Authenticate(_a0 interface{}, _a1 interface{}) *UserInteractor_Authenticate_Call { + return &UserInteractor_Authenticate_Call{Call: _e.mock.On("Authenticate", _a0, _a1)} +} + +func (_c *UserInteractor_Authenticate_Call) Run(run func(_a0 context.Context, _a1 models.User)) *UserInteractor_Authenticate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.User)) + }) + return _c +} + +func (_c *UserInteractor_Authenticate_Call) Return(_a0 error) *UserInteractor_Authenticate_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *UserInteractor_Authenticate_Call) RunAndReturn(run func(context.Context, models.User) error) *UserInteractor_Authenticate_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *UserInteractor) Get(_a0 context.Context, _a1 models.User) (models.User, error) { + ret := _m.Called(_a0, _a1) + + var r0 models.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, models.User) (models.User, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, models.User) models.User); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Get(0).(models.User) + } + + if rf, ok := ret.Get(1).(func(context.Context, models.User) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserInteractor_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type UserInteractor_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.User +func (_e *UserInteractor_Expecter) Get(_a0 interface{}, _a1 interface{}) *UserInteractor_Get_Call { + return &UserInteractor_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *UserInteractor_Get_Call) Run(run func(_a0 context.Context, _a1 models.User)) *UserInteractor_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.User)) + }) + return _c +} + +func (_c *UserInteractor_Get_Call) Return(_a0 models.User, _a1 error) *UserInteractor_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserInteractor_Get_Call) RunAndReturn(run func(context.Context, models.User) (models.User, error)) *UserInteractor_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetWithdrawals provides a mock function with given fields: _a0 +func (_m *UserInteractor) GetWithdrawals(_a0 context.Context) ([]models.Withdrawal, error) { + ret := _m.Called(_a0) + + var r0 []models.Withdrawal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) ([]models.Withdrawal, error)); ok { + return rf(_a0) + } + if rf, ok := ret.Get(0).(func(context.Context) []models.Withdrawal); ok { + r0 = rf(_a0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]models.Withdrawal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(_a0) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserInteractor_GetWithdrawals_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWithdrawals' +type UserInteractor_GetWithdrawals_Call struct { + *mock.Call +} + +// GetWithdrawals is a helper method to define mock.On call +// - _a0 context.Context +func (_e *UserInteractor_Expecter) GetWithdrawals(_a0 interface{}) *UserInteractor_GetWithdrawals_Call { + return &UserInteractor_GetWithdrawals_Call{Call: _e.mock.On("GetWithdrawals", _a0)} +} + +func (_c *UserInteractor_GetWithdrawals_Call) Run(run func(_a0 context.Context)) *UserInteractor_GetWithdrawals_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *UserInteractor_GetWithdrawals_Call) Return(_a0 []models.Withdrawal, _a1 error) *UserInteractor_GetWithdrawals_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserInteractor_GetWithdrawals_Call) RunAndReturn(run func(context.Context) ([]models.Withdrawal, error)) *UserInteractor_GetWithdrawals_Call { + _c.Call.Return(run) + return _c +} + +// Register provides a mock function with given fields: _a0, _a1 +func (_m *UserInteractor) Register(_a0 context.Context, _a1 models.User) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, models.User) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UserInteractor_Register_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Register' +type UserInteractor_Register_Call struct { + *mock.Call +} + +// Register is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.User +func (_e *UserInteractor_Expecter) Register(_a0 interface{}, _a1 interface{}) *UserInteractor_Register_Call { + return &UserInteractor_Register_Call{Call: _e.mock.On("Register", _a0, _a1)} +} + +func (_c *UserInteractor_Register_Call) Run(run func(_a0 context.Context, _a1 models.User)) *UserInteractor_Register_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.User)) + }) + return _c +} + +func (_c *UserInteractor_Register_Call) Return(_a0 error) *UserInteractor_Register_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *UserInteractor_Register_Call) RunAndReturn(run func(context.Context, models.User) error) *UserInteractor_Register_Call { + _c.Call.Return(run) + return _c +} + +// Withdraw provides a mock function with given fields: _a0, _a1, _a2 +func (_m *UserInteractor) Withdraw(_a0 context.Context, _a1 models.Withdrawal, _a2 models.User) error { + ret := _m.Called(_a0, _a1, _a2) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, models.Withdrawal, models.User) error); ok { + r0 = rf(_a0, _a1, _a2) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UserInteractor_Withdraw_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Withdraw' +type UserInteractor_Withdraw_Call struct { + *mock.Call +} + +// Withdraw is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.Withdrawal +// - _a2 models.User +func (_e *UserInteractor_Expecter) Withdraw(_a0 interface{}, _a1 interface{}, _a2 interface{}) *UserInteractor_Withdraw_Call { + return &UserInteractor_Withdraw_Call{Call: _e.mock.On("Withdraw", _a0, _a1, _a2)} +} + +func (_c *UserInteractor_Withdraw_Call) Run(run func(_a0 context.Context, _a1 models.Withdrawal, _a2 models.User)) *UserInteractor_Withdraw_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.Withdrawal), args[2].(models.User)) + }) + return _c +} + +func (_c *UserInteractor_Withdraw_Call) Return(_a0 error) *UserInteractor_Withdraw_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *UserInteractor_Withdraw_Call) RunAndReturn(run func(context.Context, models.Withdrawal, models.User) error) *UserInteractor_Withdraw_Call { + _c.Call.Return(run) + return _c +} + +// NewUserInteractor creates a new instance of UserInteractor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewUserInteractor(t interface { + mock.TestingT + Cleanup(func()) +}) *UserInteractor { + mock := &UserInteractor{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/usecase/mocks/user_repository.go b/internal/usecase/mocks/user_repository.go new file mode 100644 index 0000000..864dd8b --- /dev/null +++ b/internal/usecase/mocks/user_repository.go @@ -0,0 +1,176 @@ +// Code generated by mockery v2.23.4. DO NOT EDIT. + +package mocks + +import ( + context "context" + + models "github.com/Chystik/gophermart/internal/models" + mock "github.com/stretchr/testify/mock" +) + +// UserRepository is an autogenerated mock type for the UserRepository type +type UserRepository struct { + mock.Mock +} + +type UserRepository_Expecter struct { + mock *mock.Mock +} + +func (_m *UserRepository) EXPECT() *UserRepository_Expecter { + return &UserRepository_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: _a0, _a1 +func (_m *UserRepository) Create(_a0 context.Context, _a1 models.User) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, models.User) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UserRepository_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type UserRepository_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.User +func (_e *UserRepository_Expecter) Create(_a0 interface{}, _a1 interface{}) *UserRepository_Create_Call { + return &UserRepository_Create_Call{Call: _e.mock.On("Create", _a0, _a1)} +} + +func (_c *UserRepository_Create_Call) Run(run func(_a0 context.Context, _a1 models.User)) *UserRepository_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.User)) + }) + return _c +} + +func (_c *UserRepository_Create_Call) Return(_a0 error) *UserRepository_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *UserRepository_Create_Call) RunAndReturn(run func(context.Context, models.User) error) *UserRepository_Create_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *UserRepository) Get(_a0 context.Context, _a1 models.User) (models.User, error) { + ret := _m.Called(_a0, _a1) + + var r0 models.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, models.User) (models.User, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, models.User) models.User); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Get(0).(models.User) + } + + if rf, ok := ret.Get(1).(func(context.Context, models.User) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserRepository_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type UserRepository_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.User +func (_e *UserRepository_Expecter) Get(_a0 interface{}, _a1 interface{}) *UserRepository_Get_Call { + return &UserRepository_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *UserRepository_Get_Call) Run(run func(_a0 context.Context, _a1 models.User)) *UserRepository_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.User)) + }) + return _c +} + +func (_c *UserRepository_Get_Call) Return(_a0 models.User, _a1 error) *UserRepository_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserRepository_Get_Call) RunAndReturn(run func(context.Context, models.User) (models.User, error)) *UserRepository_Get_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: _a0, _a1 +func (_m *UserRepository) Update(_a0 context.Context, _a1 models.User) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, models.User) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UserRepository_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type UserRepository_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.User +func (_e *UserRepository_Expecter) Update(_a0 interface{}, _a1 interface{}) *UserRepository_Update_Call { + return &UserRepository_Update_Call{Call: _e.mock.On("Update", _a0, _a1)} +} + +func (_c *UserRepository_Update_Call) Run(run func(_a0 context.Context, _a1 models.User)) *UserRepository_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.User)) + }) + return _c +} + +func (_c *UserRepository_Update_Call) Return(_a0 error) *UserRepository_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *UserRepository_Update_Call) RunAndReturn(run func(context.Context, models.User) error) *UserRepository_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewUserRepository creates a new instance of UserRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewUserRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *UserRepository { + mock := &UserRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/usecase/mocks/withdrawal_repository.go b/internal/usecase/mocks/withdrawal_repository.go new file mode 100644 index 0000000..a0a4f2e --- /dev/null +++ b/internal/usecase/mocks/withdrawal_repository.go @@ -0,0 +1,134 @@ +// Code generated by mockery v2.23.4. DO NOT EDIT. + +package mocks + +import ( + context "context" + + models "github.com/Chystik/gophermart/internal/models" + mock "github.com/stretchr/testify/mock" +) + +// WithdrawalRepository is an autogenerated mock type for the WithdrawalRepository type +type WithdrawalRepository struct { + mock.Mock +} + +type WithdrawalRepository_Expecter struct { + mock *mock.Mock +} + +func (_m *WithdrawalRepository) EXPECT() *WithdrawalRepository_Expecter { + return &WithdrawalRepository_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: _a0, _a1 +func (_m *WithdrawalRepository) Create(_a0 context.Context, _a1 models.Withdrawal) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, models.Withdrawal) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// WithdrawalRepository_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type WithdrawalRepository_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 models.Withdrawal +func (_e *WithdrawalRepository_Expecter) Create(_a0 interface{}, _a1 interface{}) *WithdrawalRepository_Create_Call { + return &WithdrawalRepository_Create_Call{Call: _e.mock.On("Create", _a0, _a1)} +} + +func (_c *WithdrawalRepository_Create_Call) Run(run func(_a0 context.Context, _a1 models.Withdrawal)) *WithdrawalRepository_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(models.Withdrawal)) + }) + return _c +} + +func (_c *WithdrawalRepository_Create_Call) Return(_a0 error) *WithdrawalRepository_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WithdrawalRepository_Create_Call) RunAndReturn(run func(context.Context, models.Withdrawal) error) *WithdrawalRepository_Create_Call { + _c.Call.Return(run) + return _c +} + +// GetAll provides a mock function with given fields: _a0 +func (_m *WithdrawalRepository) GetAll(_a0 context.Context) ([]models.Withdrawal, error) { + ret := _m.Called(_a0) + + var r0 []models.Withdrawal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) ([]models.Withdrawal, error)); ok { + return rf(_a0) + } + if rf, ok := ret.Get(0).(func(context.Context) []models.Withdrawal); ok { + r0 = rf(_a0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]models.Withdrawal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(_a0) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WithdrawalRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll' +type WithdrawalRepository_GetAll_Call struct { + *mock.Call +} + +// GetAll is a helper method to define mock.On call +// - _a0 context.Context +func (_e *WithdrawalRepository_Expecter) GetAll(_a0 interface{}) *WithdrawalRepository_GetAll_Call { + return &WithdrawalRepository_GetAll_Call{Call: _e.mock.On("GetAll", _a0)} +} + +func (_c *WithdrawalRepository_GetAll_Call) Run(run func(_a0 context.Context)) *WithdrawalRepository_GetAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *WithdrawalRepository_GetAll_Call) Return(_a0 []models.Withdrawal, _a1 error) *WithdrawalRepository_GetAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WithdrawalRepository_GetAll_Call) RunAndReturn(run func(context.Context) ([]models.Withdrawal, error)) *WithdrawalRepository_GetAll_Call { + _c.Call.Return(run) + return _c +} + +// NewWithdrawalRepository creates a new instance of WithdrawalRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewWithdrawalRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *WithdrawalRepository { + mock := &WithdrawalRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/usecase/order.go b/internal/usecase/order.go index c9bd012..b8ec660 100644 --- a/internal/usecase/order.go +++ b/internal/usecase/order.go @@ -6,15 +6,15 @@ import ( "time" "github.com/Chystik/gophermart/internal/models" - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/Chystik/gophermart/pkg/transaction" ) type orderInteractor struct { orderRepo OrderRepository - trm trm.Manager + trm transaction.TransactionManager } -func NewOrderInteractor(or OrderRepository, trm trm.Manager) *orderInteractor { +func NewOrderInteractor(or OrderRepository, trm transaction.TransactionManager) *orderInteractor { return &orderInteractor{ orderRepo: or, trm: trm, @@ -25,7 +25,7 @@ func (oi *orderInteractor) Create(ctx context.Context, order models.Order) error var err error var o models.Order - err = oi.trm.Do(ctx, func(ctx context.Context) error { + err = oi.trm.WithTransaction(ctx, func(ctx context.Context) error { o, err = oi.orderRepo.Get(ctx, order) if err != nil { var target *models.AppError @@ -50,7 +50,7 @@ func (oi *orderInteractor) GetList(ctx context.Context, login models.User) ([]mo var o []models.Order var err error - err = oi.trm.Do(ctx, func(ctx context.Context) error { + err = oi.trm.WithTransaction(ctx, func(ctx context.Context) error { o, err = oi.orderRepo.GetList(ctx, login) return err }) diff --git a/internal/usecase/order_test.go b/internal/usecase/order_test.go new file mode 100644 index 0000000..b2a5e7d --- /dev/null +++ b/internal/usecase/order_test.go @@ -0,0 +1 @@ +package usecase diff --git a/internal/usecase/syncer/syncer.go b/internal/usecase/syncer/syncer.go index cd8103f..e5d7d82 100644 --- a/internal/usecase/syncer/syncer.go +++ b/internal/usecase/syncer/syncer.go @@ -10,8 +10,7 @@ import ( "github.com/Chystik/gophermart/internal/models" "github.com/Chystik/gophermart/internal/usecase" "github.com/Chystik/gophermart/pkg/logger" - - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/Chystik/gophermart/pkg/transaction" ) const ( @@ -27,13 +26,13 @@ type syncer struct { tick time.Ticker quit chan struct{} once sync.Once - trm trm.Manager + trm transaction.TransactionManager } func NewSyncer( ur usecase.UserRepository, or usecase.OrderRepository, - trm trm.Manager, + trm transaction.TransactionManager, acc usecase.AccrualWebAPI, l logger.AppLogger, opts ...Options) *syncer { @@ -130,7 +129,7 @@ func (s *syncer) sync(ctx context.Context) error { // if the new status is valid for accrual - change user balance if newStatus == models.Processed { - err = s.trm.Do(ctx, func(ctx context.Context) error { + err = s.trm.WithTransaction(ctx, func(ctx context.Context) error { user, err := s.userRepo.Get(ctx, models.User{Login: orders[i].User}) if err != nil { s.logger.Error(err.Error()) diff --git a/internal/usecase/user.go b/internal/usecase/user.go index 3e3fd97..adf8d55 100644 --- a/internal/usecase/user.go +++ b/internal/usecase/user.go @@ -5,17 +5,16 @@ import ( "time" "github.com/Chystik/gophermart/internal/models" - - "github.com/avito-tech/go-transaction-manager/trm" + "github.com/Chystik/gophermart/pkg/transaction" ) type userInteractor struct { userRepo UserRepository withdrawalRepo WithdrawalRepository - trm trm.Manager + trm transaction.TransactionManager } -func NewUserInteractor(ur UserRepository, wr WithdrawalRepository, trm trm.Manager) *userInteractor { +func NewUserInteractor(ur UserRepository, wr WithdrawalRepository, trm transaction.TransactionManager) *userInteractor { return &userInteractor{ userRepo: ur, withdrawalRepo: wr, @@ -24,7 +23,7 @@ func NewUserInteractor(ur UserRepository, wr WithdrawalRepository, trm trm.Manag } func (ui *userInteractor) Register(ctx context.Context, user models.User) error { - err := ui.trm.Do(ctx, func(ctx context.Context) error { + err := ui.trm.WithTransaction(ctx, func(ctx context.Context) error { err := ui.userRepo.Create(ctx, user) return err }) @@ -43,7 +42,7 @@ func (ui *userInteractor) Authenticate(ctx context.Context, user models.User) er func (ui *userInteractor) Get(ctx context.Context, user models.User) (models.User, error) { var err error - err = ui.trm.Do(ctx, func(ctx context.Context) error { + err = ui.trm.WithTransaction(ctx, func(ctx context.Context) error { user, err = ui.userRepo.Get(ctx, user) return err }) @@ -55,7 +54,7 @@ func (ui *userInteractor) Withdraw(ctx context.Context, w models.Withdrawal, use var err error var actual models.User - err = ui.trm.Do(ctx, func(ctx context.Context) error { + err = ui.trm.WithTransaction(ctx, func(ctx context.Context) error { actual, err = ui.userRepo.Get(ctx, user) if err != nil { return err @@ -84,7 +83,7 @@ func (ui *userInteractor) Withdraw(ctx context.Context, w models.Withdrawal, use func (ui *userInteractor) GetWithdrawals(ctx context.Context) ([]models.Withdrawal, error) { var err error var w []models.Withdrawal - err = ui.trm.Do(ctx, func(ctx context.Context) error { + err = ui.trm.WithTransaction(ctx, func(ctx context.Context) error { w, err = ui.withdrawalRepo.GetAll(ctx) return err }) diff --git a/internal/usecase/user_test.go b/internal/usecase/user_test.go new file mode 100644 index 0000000..b2a5e7d --- /dev/null +++ b/internal/usecase/user_test.go @@ -0,0 +1 @@ +package usecase diff --git a/pkg/transaction/context.go b/pkg/transaction/context.go new file mode 100644 index 0000000..bf7703c --- /dev/null +++ b/pkg/transaction/context.go @@ -0,0 +1,31 @@ +package transaction + +import ( + "context" + + "github.com/jmoiron/sqlx" +) + +type txKey struct{} + +type ctxGetter struct { + txKey txKey +} + +func NewCtxGetter() *ctxGetter { + return &ctxGetter{txKey: txKey{}} +} + +// GetTrxOrDB gets and returns sqlx.Tx from the ctx context.Context, +// or returns sqlx.ExtContext on failure. +func (g *ctxGetter) GetTrxOrDB(ctx context.Context, db sqlx.ExtContext) sqlx.ExtContext { + if tx, ok := ctx.Value(txKey{}).(*sqlx.Tx); ok { + return tx + } + + return db +} + +type CtxGetter interface { + GetTrxOrDB(ctx context.Context, db sqlx.ExtContext) sqlx.ExtContext +} diff --git a/pkg/transaction/transaction.go b/pkg/transaction/transaction.go new file mode 100644 index 0000000..85fff1a --- /dev/null +++ b/pkg/transaction/transaction.go @@ -0,0 +1,58 @@ +package transaction + +import ( + "context" + "database/sql" + + "github.com/Chystik/gophermart/internal/models" + "github.com/Chystik/gophermart/pkg/logger" + "github.com/jmoiron/sqlx" +) + +type TransactionManager interface { + WithTransaction(ctx context.Context, fn TxFn) error +} + +type TxFn func(ctx context.Context) error + +type manager struct { + *sqlx.DB + logger logger.AppLogger +} + +func NewManager(db *sqlx.DB, l logger.AppLogger) *manager { + return &manager{ + DB: db, + logger: l, + } +} + +// WithTransaction creates a new transaction and handles rollback/commit based on the +// error object returned by the `TxFn`. +func (m *manager) WithTransaction(ctx context.Context, fn TxFn) error { + //logger := ctxval.GetLogger(ctx) + tx, err := m.BeginTxx(ctx, &sql.TxOptions{ + Isolation: sql.LevelDefault, + ReadOnly: false, + }) + if err != nil { + m.logger.Error(err.Error()) + return &models.AppError{Op: "transaction.managerWithTransaction", Message: "cannot begin transaction", Err: err} + } + + m.logger.Debug("Starting database transaction") + err = fn(injectTx(ctx, tx)) + if err != nil { + m.logger.Debug("Rolling database transaction back") + tx.Rollback() + return err + } + + m.logger.Debug("Committing database transaction") + return tx.Commit() +} + +// injectTx injects transaction to context +func injectTx(ctx context.Context, tx *sqlx.Tx) context.Context { + return context.WithValue(ctx, txKey{}, tx) +} diff --git a/run/app.go b/run/app.go index b351cb5..8697c1d 100644 --- a/run/app.go +++ b/run/app.go @@ -17,15 +17,14 @@ import ( "github.com/Chystik/gophermart/pkg/httpserver" "github.com/Chystik/gophermart/pkg/logger" "github.com/Chystik/gophermart/pkg/postgres" + "github.com/Chystik/gophermart/pkg/transaction" - trmsqlx "github.com/avito-tech/go-transaction-manager/sqlx" - "github.com/avito-tech/go-transaction-manager/trm/manager" "github.com/go-chi/chi/v5" "go.uber.org/zap" ) const ( - defaultLogLevel = "info" + defaultLogLevel = "debug" defaultShutdownTimeout = 5 * time.Second accrualAddrScheme = "http" @@ -72,10 +71,12 @@ func App(cfg *config.App, quit chan os.Signal) { accrualWebAPI := webapi.NewAccrualWebAPI(httpClient, webapi.Address(cfg.AccrualAddress.String())) // Repository - trManager := manager.Must(trmsqlx.NewDefaultFactory(pg.DB)) - userRepo := repository.NewUserRepository(pg.DB, trmsqlx.DefaultCtxGetter) - orderRepo := repository.NewOrderRepository(pg.DB, trmsqlx.DefaultCtxGetter) - withdrawalRepo := repository.NewWithdrawalRepository(pg.DB, trmsqlx.DefaultCtxGetter) + trManager := transaction.NewManager(pg.DB, logger) + trCtxGetter := transaction.NewCtxGetter() + + userRepo := repository.NewUserRepository(pg.DB, trCtxGetter, logger) + orderRepo := repository.NewOrderRepository(pg.DB, trCtxGetter, logger) + withdrawalRepo := repository.NewWithdrawalRepository(pg.DB, trCtxGetter, logger) // Interactor userInteractor := usecase.NewUserInteractor(userRepo, withdrawalRepo, trManager)