From 1d7410b20f27342857265767d0576b89649ef9d3 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Wed, 5 Feb 2025 03:31:13 +0100 Subject: [PATCH 1/6] chore: move main to root-level (rm cmd) and update dependencies --- README.md | 8 +++- go.mod | 40 ++++++++-------- go.sum | 76 +++++++++++++++--------------- cmd/pgxtutorial/main.go => main.go | 0 4 files changed, 65 insertions(+), 59 deletions(-) rename cmd/pgxtutorial/main.go => main.go (100%) diff --git a/README.md b/README.md index 9bdb290..4951f24 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,17 @@ $ export PGDATABASE=pgxtutorial # Run migrations $ tern migrate -m ./migrations # Execute application -$ go run ./cmd/pgxtutorial +$ go run . 2021/11/22 07:21:21 HTTP server listening at localhost:8080 2021/11/22 07:21:21 gRPC server listening at 127.0.0.1:8082 ``` +You could also +``` +go install github.com/henvic/pgxtutorial@latest +``` +to just get the `pgxtutorial` binary. + ## See also * [pgtools](https://github.com/henvic/pgtools/) * [pgq](https://github.com/henvic/pgq) diff --git a/go.mod b/go.mod index 6a95812..7700ada 100644 --- a/go.mod +++ b/go.mod @@ -1,29 +1,29 @@ module github.com/henvic/pgxtutorial -go 1.22.4 +go 1.22 require ( - github.com/exaring/otelpgx v0.5.4 + github.com/exaring/otelpgx v0.6.2 github.com/felixge/fgprof v0.9.4 github.com/google/go-cmp v0.6.0 github.com/henvic/pgtools v0.2.0 github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438 github.com/jackc/pgx/v5 v5.6.0 - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 - go.opentelemetry.io/otel v1.27.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 - go.opentelemetry.io/otel/metric v1.27.0 - go.opentelemetry.io/otel/sdk v1.27.0 - go.opentelemetry.io/otel/sdk/metric v1.27.0 - go.opentelemetry.io/otel/trace v1.27.0 + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 + go.opentelemetry.io/otel v1.28.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.28.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 + go.opentelemetry.io/otel/metric v1.28.0 + go.opentelemetry.io/otel/sdk v1.28.0 + go.opentelemetry.io/otel/sdk/metric v1.28.0 + go.opentelemetry.io/otel/trace v1.28.0 go.uber.org/automaxprocs v1.5.3 go.uber.org/mock v0.4.0 - google.golang.org/grpc v1.64.0 - google.golang.org/protobuf v1.34.1 + google.golang.org/grpc v1.65.0 + google.golang.org/protobuf v1.34.2 ) require ( @@ -34,7 +34,7 @@ require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect + github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect @@ -47,13 +47,13 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/spf13/cast v1.6.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect - go.opentelemetry.io/proto/otlp v1.2.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect golang.org/x/crypto v0.24.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect ) diff --git a/go.sum b/go.sum index 3e64c98..6ff97ad 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38 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/exaring/otelpgx v0.5.4 h1:uytSs8A9/8tpnJ4J8jsusbRtNgP6Cn5npnffCxE2Unk= -github.com/exaring/otelpgx v0.5.4/go.mod h1:DuRveXIeRNz6VJrMTj2uCBFqiocMx4msCN1mIMmbZUI= +github.com/exaring/otelpgx v0.6.2 h1:z1ayuDusPITNOhzvmx3nLpFax+tv7Hu7mdrjtgW3ZeA= +github.com/exaring/otelpgx v0.6.2/go.mod h1:DuRveXIeRNz6VJrMTj2uCBFqiocMx4msCN1mIMmbZUI= github.com/felixge/fgprof v0.9.4 h1:ocDNwMFlnA0NU0zSB3I52xkO4sFXk80VK9lXjLClu88= github.com/felixge/fgprof v0.9.4/go.mod h1:yKl+ERSa++RYOs32d8K6WEXCB4uXdLls4ZaZPpayhMM= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -35,8 +35,8 @@ github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/K github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= -github.com/google/pprof v0.0.0-20240528025155-186aa0362fba h1:ql1qNgCyOB7iAEk8JTNM+zJrgIbnyCKX/wdlyPufP5g= -github.com/google/pprof v0.0.0-20240528025155-186aa0362fba/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 h1:e+8XbKB6IMn8A4OAyZccO4pYfB3s7bt6azNIPE7AnPg= +github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -100,32 +100,32 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 h1:vS1Ao/R55RNV4O7TA2Qopok8yN+X0LIP6RVWLFkprck= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0/go.mod h1:BMsdeOxN04K0L5FNUBfjFdvwWGNe/rkmSwH4Aelu/X0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0= -go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= -go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 h1:bFgvUr3/O4PHj3VQcFEuYKvRZJX1SJDQ+11JXuSB3/w= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0/go.mod h1:xJntEd2KL6Qdg5lwp97HMLQDVeAhrYxmzFseAMDPQ8I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 h1:R9DE4kQ4k+YtfLI2ULwX82VtNQ2J8yZmA7ZIF/D+7Mc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0/go.mod h1:OQFyQVrDlbe+R7xrEyDr/2Wr67Ol0hRUgsfA+V5A95s= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 h1:qFffATk0X+HD+f1Z8lswGiOQYKHRlzfmdJm0wEaVrFA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 h1:/jlt1Y8gXWiHG9FBx6cJaIC5hYx5Fe64nC8w5Cylt/0= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0/go.mod h1:bmToOGOBZ4hA9ghphIc1PAf66VA8KOtsuy3+ScStG20= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 h1:/0YaXu3755A/cFbtXp+21lkXgI0QE5avTWA2HjU9/WE= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0/go.mod h1:m7SFxp0/7IxmJPLIY3JhOcU9CoFzDaCPL6xxQIxhA+o= -go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= -go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= -go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= -go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= -go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= -go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= -go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= -go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94= -go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 h1:U2guen0GhqH8o/G2un8f/aG/y++OuW6MyCo6hT9prXk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0/go.mod h1:yeGZANgEcpdx/WK0IvvRFC+2oLiMS2u4L/0Rj2M2Qr0= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 h1:R3X6ZXmNPRR8ul6i3WgFURCHzaXjHdm0karRG/+dj3s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0/go.mod h1:QWFXnDavXWwMx2EEcZsf3yxgEKAqsxQ+Syjp+seyInw= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.28.0 h1:BJee2iLkfRfl9lc7aFmBwkWxY/RI1RDdXepSF6y8TPE= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.28.0/go.mod h1:DIzlHs3DRscCIBU3Y9YSzPfScwnYnzfnCd4g8zA7bZc= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 h1:EVSnY9JbEEW92bEkIYOVMw4q1WJxIAGoFTrtYOzWuRQ= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0/go.mod h1:Ea1N1QQryNXpCD0I1fdLibBAIpQuBkznMmkdKrapk1Y= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= +go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/sdk/metric v1.28.0 h1:OkuaKgKrgAbYrrY0t92c+cC+2F6hsFNnCQArXCKlg08= +go.opentelemetry.io/otel/sdk/metric v1.28.0/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -171,14 +171,14 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 h1:QW9+G6Fir4VcRXVH8x3LilNAb6cxBGLa6+GM4hRwexE= -google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3/go.mod h1:kdrSS/OiLkPrNUpzD4aHgCq2rVuC/YRxok32HXZ4vRE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 h1:9Xyg6I9IWQZhRVfCWjKK+l6kI0jHcPesVlMnT//aHNo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= +google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/cmd/pgxtutorial/main.go b/main.go similarity index 100% rename from cmd/pgxtutorial/main.go rename to main.go From f7e3d317fc180a137bc5f589a1350a2b3f6c5cae Mon Sep 17 00:00:00 2001 From: Henrique Vicente Date: Thu, 6 Feb 2025 05:53:29 +0100 Subject: [PATCH 2/6] mod: update deps and explicitly download deps on integration tests --- .github/workflows/integration.yml | 6 +- .github/workflows/lint.yml | 2 +- go.mod | 104 +++++++---- go.sum | 256 +++++++++++++++------------- internal/api/grpc.go | 2 +- internal/apiv1/apipb/api.pb.go | 2 +- internal/apiv1/apipb/api_grpc.pb.go | 2 +- 7 files changed, 219 insertions(+), 155 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index b4ab850..8f71ca1 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -39,7 +39,11 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.22.x' + go-version: '1.24.x' + - name: Verify dependencies + run: | + go mod verify + go mod download - name: Run Postgres tests run: go test -v -race -count 1 -covermode atomic -coverprofile=profile.cov ./... - name: Code coverage diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0804abd..903211e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v5 with: - go-version: "1.22.x" + go-version: "1.24.x" - name: Check out code uses: actions/checkout@v4 diff --git a/go.mod b/go.mod index 7700ada..9c6c69e 100644 --- a/go.mod +++ b/go.mod @@ -1,59 +1,91 @@ module github.com/henvic/pgxtutorial -go 1.22 +go 1.24 require ( - github.com/exaring/otelpgx v0.6.2 - github.com/felixge/fgprof v0.9.4 + github.com/exaring/otelpgx v0.9.0 + github.com/felixge/fgprof v0.9.5 github.com/google/go-cmp v0.6.0 github.com/henvic/pgtools v0.2.0 github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438 - github.com/jackc/pgx/v5 v5.6.0 - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 - go.opentelemetry.io/otel v1.28.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.28.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 - go.opentelemetry.io/otel/metric v1.28.0 - go.opentelemetry.io/otel/sdk v1.28.0 - go.opentelemetry.io/otel/sdk/metric v1.28.0 - go.opentelemetry.io/otel/trace v1.28.0 - go.uber.org/automaxprocs v1.5.3 - go.uber.org/mock v0.4.0 - google.golang.org/grpc v1.65.0 - google.golang.org/protobuf v1.34.2 + github.com/jackc/pgx/v5 v5.7.2 + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 + go.opentelemetry.io/otel v1.34.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 + go.opentelemetry.io/otel/metric v1.34.0 + go.opentelemetry.io/otel/sdk v1.34.0 + go.opentelemetry.io/otel/sdk/metric v1.34.0 + go.opentelemetry.io/otel/trace v1.34.0 + go.uber.org/automaxprocs v1.6.0 + go.uber.org/mock v0.5.0 + google.golang.org/grpc v1.70.0 + google.golang.org/protobuf v1.36.5 ) require ( + cloud.google.com/go v0.118.2 // indirect + cloud.google.com/go/ai v0.10.0 // indirect + cloud.google.com/go/auth v0.14.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.7 // indirect + cloud.google.com/go/compute/metadata v0.6.0 // indirect + cloud.google.com/go/longrunning v0.6.4 // indirect + dario.cat/mergo v1.0.1 // indirect + github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.2.1 // indirect - github.com/Masterminds/sprig/v3 v3.2.3 // indirect + github.com/Masterminds/semver/v3 v3.3.1 // indirect + github.com/Masterminds/sprig/v3 v3.3.0 // indirect + github.com/ccojocar/zxcvbn-go v1.0.2 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 // indirect + github.com/google/generative-ai-go v0.19.0 // indirect + github.com/google/pprof v0.0.0-20250208200701-d0013a598941 // indirect + github.com/google/s2a-go v0.1.9 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect + github.com/googleapis/gax-go/v2 v2.14.1 // indirect + github.com/gookit/color v1.5.4 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 // indirect github.com/huandu/xstrings v1.5.0 // indirect - github.com/imdario/mergo v0.3.16 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect - github.com/jackc/puddle/v2 v2.2.1 // indirect - github.com/jackc/tern/v2 v2.2.0 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/jackc/tern/v2 v2.3.2 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/securego/gosec/v2 v2.22.1 // indirect github.com/shopspring/decimal v1.4.0 // indirect - github.com/spf13/cast v1.6.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect - go.opentelemetry.io/proto/otlp v1.3.1 // indirect - golang.org/x/crypto v0.24.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + github.com/spf13/cast v1.7.1 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect + go.opentelemetry.io/proto/otlp v1.5.0 // indirect + golang.org/x/crypto v0.33.0 // indirect + golang.org/x/exp/typeparams v0.0.0-20250215185904-eff6e970281f // indirect + golang.org/x/mod v0.23.0 // indirect + golang.org/x/net v0.35.0 // indirect + golang.org/x/oauth2 v0.26.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/telemetry v0.0.0-20250214215356-6f9b61db478c // indirect + golang.org/x/text v0.22.0 // indirect + golang.org/x/time v0.10.0 // indirect + golang.org/x/tools v0.30.0 // indirect + golang.org/x/vuln v1.1.4 // indirect + google.golang.org/api v0.221.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + honnef.co/go/tools v0.6.0 // indirect +) + +tool ( + github.com/securego/gosec/v2/cmd/gosec + golang.org/x/vuln/cmd/govulncheck + honnef.co/go/tools/cmd/staticcheck ) diff --git a/go.sum b/go.sum index 6ff97ad..c681237 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,27 @@ +cloud.google.com/go v0.118.2 h1:bKXO7RXMFDkniAAvvuMrAPtQ/VHrs9e7J5UT3yrGdTY= +cloud.google.com/go v0.118.2/go.mod h1:CFO4UPEPi8oV21xoezZCrd3d81K4fFkDTEJu4R8K+9M= +cloud.google.com/go/ai v0.10.0 h1:hwj6CI6sMKubXodoJJGTy/c2T1RbbLGM6TL3QoAvzU8= +cloud.google.com/go/ai v0.10.0/go.mod h1:kvnt2KeHqX8+41PVeMRBETDyQAp/RFvBWGdx/aGjNMo= +cloud.google.com/go/auth v0.14.1 h1:AwoJbzUdxA/whv1qj3TLKwh3XX5sikny2fc40wUl+h0= +cloud.google.com/go/auth v0.14.1/go.mod h1:4JHUxlGXisL0AW8kXPtUF6ztuOksyfUQNFjfsOCXkPM= +cloud.google.com/go/auth/oauth2adapt v0.2.7 h1:/Lc7xODdqcEw8IrZ9SvwnlLX6j9FHQM74z6cBk9Rw6M= +cloud.google.com/go/auth/oauth2adapt v0.2.7/go.mod h1:NTbTTzfvPl1Y3V1nPpOgl2w6d/FjO7NNUQaWSox6ZMc= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= +cloud.google.com/go/longrunning v0.6.4 h1:3tyw9rO3E2XVXzSApn1gyEEnH2K9SynNQjMlBi3uHLg= +cloud.google.com/go/longrunning v0.6.4/go.mod h1:ttZpLCe6e7EXvn9OxpBRx7kZEB0efv8yBO6YnVMfhJs= +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= -github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= +github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4= +github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= +github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= +github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I3Vg= +github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs= @@ -16,10 +33,10 @@ github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38 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/exaring/otelpgx v0.6.2 h1:z1ayuDusPITNOhzvmx3nLpFax+tv7Hu7mdrjtgW3ZeA= -github.com/exaring/otelpgx v0.6.2/go.mod h1:DuRveXIeRNz6VJrMTj2uCBFqiocMx4msCN1mIMmbZUI= -github.com/felixge/fgprof v0.9.4 h1:ocDNwMFlnA0NU0zSB3I52xkO4sFXk80VK9lXjLClu88= -github.com/felixge/fgprof v0.9.4/go.mod h1:yKl+ERSa++RYOs32d8K6WEXCB4uXdLls4ZaZPpayhMM= +github.com/exaring/otelpgx v0.9.0 h1:Bo0RIhBNrzLlVzih46qBy/KQRvRs9vwRbgT/fE363NM= +github.com/exaring/otelpgx v0.9.0/go.mod h1:ANkRZDfgfmN6yJS1xKMkshbnsHO8at5sYwtVEYOX8hc= +github.com/felixge/fgprof v0.9.5 h1:8+vR6yu2vvSKn08urWyEuxx75NWPEvybbkBirEpsbVY= +github.com/felixge/fgprof v0.9.5/go.mod h1:yKl+ERSa++RYOs32d8K6WEXCB4uXdLls4ZaZPpayhMM= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -29,40 +46,53 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/generative-ai-go v0.19.0 h1:R71szggh8wHMCUlEMsW2A/3T+5LdEIkiaHSYgSpUgdg= +github.com/google/generative-ai-go v0.19.0/go.mod h1:JYolL13VG7j79kM5BtHz4qwONHkeJQzOCkKXnpqtS/E= +github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786 h1:rcv+Ippz6RAtvaGgKxc+8FQIpxHgsF+HBzPyYL2cyVU= +github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786/go.mod h1:apVn/GCasLZUVpAJ6oWAuyP7Ne7CEsQbTnc0plM3m+o= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= -github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 h1:e+8XbKB6IMn8A4OAyZccO4pYfB3s7bt6azNIPE7AnPg= -github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/pprof v0.0.0-20250208200701-d0013a598941 h1:43XjGa6toxLpeksjcxs1jIoIyr+vUfOqY2c6HB4bpoc= +github.com/google/pprof v0.0.0-20250208200701-d0013a598941/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= +github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= +github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= +github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q= +github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA= +github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= +github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 h1:e9Rjr40Z98/clHv5Yg79Is0NtosR5LXRvdr7o/6NwbA= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1/go.mod h1:tIxuGz/9mpox++sgp9fJjHO0+q1X9/UOWd798aAm22M= github.com/henvic/pgtools v0.2.0 h1:1Sca4p5TJrjXAhxUgzWe0Dn5kCCh3+8WrJ1WRG6areQ= github.com/henvic/pgtools v0.2.0/go.mod h1:4lq4zJmN6WZZUzMyDQUcdfu5wyKKvUxUuCO2BPeLfsc= -github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438 h1:Dj0L5fhJ9F82ZJyVOmBx6msDp/kfd1t9GRfny/mfJA0= github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438/go.mod h1:a/s9Lp5W7n/DD0VrVoyJ00FbP2ytTPDVOivvn2bMlds= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY= -github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw= -github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= -github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= -github.com/jackc/tern/v2 v2.2.0 h1:qL3KgOOuIN0W5ntQd796aIVsq8kMWO7kVWb9SBll6S4= -github.com/jackc/tern/v2 v2.2.0/go.mod h1:thNyC7gVBGYWsAJJSvAX0ML/1lAmOw7+DVH8aSE5rto= +github.com/jackc/pgx/v5 v5.7.2 h1:mLoDLV6sonKlvjIEsV56SkWNCnuNv531l94GaIzO+XI= +github.com/jackc/pgx/v5 v5.7.2/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jackc/tern/v2 v2.3.2 h1:/d3ML6jyQGDDtvKCGnHp8HY0swh86VcNvTMkC65+frk= +github.com/jackc/tern/v2 v2.3.2/go.mod h1:cJYmwlpXLs3vBtbkfKdgoZL0G96mH56W+fugKx+k3zw= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -70,118 +100,116 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU= +github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk= +github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= +github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0= 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/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/securego/gosec/v2 v2.22.1 h1:IcBt3TpI5Y9VN1YlwjSpM2cHu0i3Iw52QM+PQeg7jN8= +github.com/securego/gosec/v2 v2.22.1/go.mod h1:4bb95X4Jz7VSEPdVjC0hD7C/yR6kdeUBvCPOy9gDQ0g= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= +github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.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.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 h1:U2guen0GhqH8o/G2un8f/aG/y++OuW6MyCo6hT9prXk= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0/go.mod h1:yeGZANgEcpdx/WK0IvvRFC+2oLiMS2u4L/0Rj2M2Qr0= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 h1:R3X6ZXmNPRR8ul6i3WgFURCHzaXjHdm0karRG/+dj3s= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0/go.mod h1:QWFXnDavXWwMx2EEcZsf3yxgEKAqsxQ+Syjp+seyInw= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.28.0 h1:BJee2iLkfRfl9lc7aFmBwkWxY/RI1RDdXepSF6y8TPE= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.28.0/go.mod h1:DIzlHs3DRscCIBU3Y9YSzPfScwnYnzfnCd4g8zA7bZc= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 h1:EVSnY9JbEEW92bEkIYOVMw4q1WJxIAGoFTrtYOzWuRQ= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0/go.mod h1:Ea1N1QQryNXpCD0I1fdLibBAIpQuBkznMmkdKrapk1Y= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= -go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= -go.opentelemetry.io/otel/sdk/metric v1.28.0 h1:OkuaKgKrgAbYrrY0t92c+cC+2F6hsFNnCQArXCKlg08= -go.opentelemetry.io/otel/sdk/metric v1.28.0/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= -go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= -go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= -go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= -go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 h1:rgMkmiGfix9vFJDcDi1PK8WEQP4FLQwLDfhp5ZLpFeE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0/go.mod h1:ijPqXp5P6IRRByFVVg9DY8P5HkxkHE5ARIa+86aXPf4= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 h1:CV7UdSGJt/Ao6Gp4CXckLxVRRsRgDHoI8XjbL3PDl8s= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0/go.mod h1:FRmFuRJfag1IZ2dPkHnEoSFVgTVPUd2qf5Vi69hLb8I= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 h1:ajl4QczuJVA2TU9W9AGw++86Xga/RKt//16z/yxPgdk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0/go.mod h1:Vn3/rlOJ3ntf/Q3zAI0V5lDnTbHGaUsNUeF6nZmm7pA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0 h1:czJDQwFrMbOr9Kk+BPo1y8WZIIFIK58SA1kykuVeiOU= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.34.0/go.mod h1:lT7bmsxOe58Tq+JIOkTQMCGXdu47oA+VJKLZHbaBKbs= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 h1:jBpDk4HAUsrnVO1FsfCfCOTEc/MkInJmvfCHYLFiT80= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0/go.mod h1:H9LUIM1daaeZaz91vZcfeM0fejXPmgCYE8ZhzqfJuiU= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= +go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= +go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= +golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= +golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/exp/typeparams v0.0.0-20250215185904-eff6e970281f h1:lwUSxjTFq2sP4q5JdTtCEuDDSl3udvTn2UEksv8OHFY= +golang.org/x/exp/typeparams v0.0.0-20250215185904-eff6e970281f/go.mod h1:LKZHyeOpPuZcMgxeHjJp4p5yvxrCX1xDvH10zYHhjjQ= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= +golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= +golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE= +golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/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.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -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.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= -google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/telemetry v0.0.0-20250214215356-6f9b61db478c h1:cA79rhMsZfyISI2vyH5j2XJb+QKQ7w/qWJNsR1PsRCI= +golang.org/x/telemetry v0.0.0-20250214215356-6f9b61db478c/go.mod h1:bDzXkYUaHzz51CtDy5kh/jR4lgPxsdbqC37kp/dzhCc= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= +golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4= +golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= +golang.org/x/vuln v1.1.4 h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I= +golang.org/x/vuln v1.1.4/go.mod h1:F+45wmU18ym/ca5PLTPLsSzr2KppzswxPP603ldA67s= +google.golang.org/api v0.221.0 h1:qzaJfLhDsbMeFee8zBRdt/Nc+xmOuafD/dbdgGfutOU= +google.golang.org/api v0.221.0/go.mod h1:7sOU2+TL4TxUTdbi0gWgAIg7tH5qBXxoyhtL+9x3biQ= +google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b h1:i+d0RZa8Hs2L/MuaOQYI+krthcxdEbEM2N+Tf3kJ4zk= +google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:iYONQfRdizDB8JJBybql13nArx91jcUk7zCXEsOofM4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b h1:FQtJ1MxbXoIIrZHZ33M+w5+dAP9o86rgpjoKr/ZmT7k= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk= +google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ= +google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw= +google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= +google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.6.0 h1:TAODvD3knlq75WCp2nyGJtT4LeRV/o7NN9nYPeVJXf8= +honnef.co/go/tools v0.6.0/go.mod h1:3puzxxljPCe8RGJX7BIy1plGbxEOZni5mR2aXe3/uk4= diff --git a/internal/api/grpc.go b/internal/api/grpc.go index 01661b8..d26ba21 100644 --- a/internal/api/grpc.go +++ b/internal/api/grpc.go @@ -179,7 +179,7 @@ func grpcAPIError(err error) error { case err == context.Canceled: return status.Error(codes.Canceled, err.Error()) case errors.As(err, &inventory.ValidationError{}): - return status.Errorf(codes.InvalidArgument, err.Error()) + return status.Error(codes.InvalidArgument, err.Error()) default: return err } diff --git a/internal/apiv1/apipb/api.pb.go b/internal/apiv1/apipb/api.pb.go index 47bc187..ef66190 100644 --- a/internal/apiv1/apipb/api.pb.go +++ b/internal/apiv1/apipb/api.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.1 -// protoc v5.26.1 +// protoc v5.27.3 // source: api.proto package apipb diff --git a/internal/apiv1/apipb/api_grpc.pb.go b/internal/apiv1/apipb/api_grpc.pb.go index 62bd213..2a97423 100644 --- a/internal/apiv1/apipb/api_grpc.pb.go +++ b/internal/apiv1/apipb/api_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.4.0 -// - protoc v5.26.1 +// - protoc v5.27.3 // source: api.proto package apipb From 8f94e5bcb385039361b62f412348f691f6ab3d1d Mon Sep 17 00:00:00 2001 From: Henrique Vicente Date: Sun, 16 Feb 2025 07:43:07 +0100 Subject: [PATCH 3/6] ci: use "go tool" for static analysis From Go 1.24 onwards, we can use "go tool" to version such dependencies. --- .github/workflows/lint.yml | 3 --- .github/workflows/osv-scanner.yml | 18 ++++-------------- scripts/ci-lint-install.sh | 7 ------- scripts/ci-lint.sh | 7 +++---- scripts/lib.sh | 13 ------------- 5 files changed, 7 insertions(+), 41 deletions(-) delete mode 100755 scripts/ci-lint-install.sh delete mode 100644 scripts/lib.sh diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 903211e..4ccaba0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,8 +28,5 @@ jobs: go mod verify go mod download - - name: Installing static code analysis tools - run: ./scripts/ci-lint-install.sh - - name: Run checks run: ./scripts/ci-lint.sh diff --git a/.github/workflows/osv-scanner.yml b/.github/workflows/osv-scanner.yml index 0dcecbf..f900e32 100644 --- a/.github/workflows/osv-scanner.yml +++ b/.github/workflows/osv-scanner.yml @@ -22,6 +22,8 @@ on: branches: [ "main" ] permissions: + # Required to upload SARIF file to CodeQL. See: https://github.com/github/codeql-action/issues/2117 + actions: read # Require writing security events to upload SARIF file to security tab security-events: write # Read commit contents @@ -30,19 +32,7 @@ permissions: jobs: scan-scheduled: if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} - uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@3c399db9dd6dd8106a27d280d53c55077d3f7cea" # v1.8.1 - with: - # Example of specifying custom arguments - scan-args: |- - -r - --skip-git - ./ + uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@v1.9.1" scan-pr: if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} - uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@3c399db9dd6dd8106a27d280d53c55077d3f7cea" # v1.8.1 - with: - # Example of specifying custom arguments - scan-args: |- - -r - --skip-git - ./ + uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@v1.9.1" diff --git a/scripts/ci-lint-install.sh b/scripts/ci-lint-install.sh deleted file mode 100755 index 2f2ba4c..0000000 --- a/scripts/ci-lint-install.sh +++ /dev/null @@ -1,7 +0,0 @@ -source scripts/lib.sh - -# TODO(henvic): Version these developer dependencies. - -ensure_go_binary honnef.co/go/tools/cmd/staticcheck -ensure_go_binary github.com/securego/gosec/v2/cmd/gosec -ensure_go_binary golang.org/x/vuln/cmd/govulncheck diff --git a/scripts/ci-lint.sh b/scripts/ci-lint.sh index 155e921..74be56d 100755 --- a/scripts/ci-lint.sh +++ b/scripts/ci-lint.sh @@ -5,12 +5,11 @@ IFS=$'\n\t' # Static analysis scripts cd $(dirname $0)/.. -source scripts/ci-lint-install.sh source scripts/ci-lint-fmt.sh set -x go vet ./... -staticcheck ./... -gosec -quiet ./... +go tool honnef.co/go/tools/cmd/staticcheck ./... +go tool github.com/securego/gosec/v2/cmd/gosec -quiet -exclude-generated ./... # Run govulncheck only informationally for the time being. -govulncheck ./... || true +go tool golang.org/x/vuln/cmd/govulncheck ./... || true diff --git a/scripts/lib.sh b/scripts/lib.sh deleted file mode 100644 index 6331b5f..0000000 --- a/scripts/lib.sh +++ /dev/null @@ -1,13 +0,0 @@ -# ensure_go_binary verifies that a binary exists in $PATH corresponding to the -# given go-gettable URI. If no such binary exists, it is fetched via `go get`. -# Reference: https://github.com/golang/pkgsite/blob/65d33554b34b666d37b22bed7de136b562d5dba8/all.bash#L93-L103 -# Copyright 2019 The Go Authors. -ensure_go_binary() { - local binary=$(basename $1) - if ! [ -x "$(command -v $binary)" ]; then - echo "Installing: $1" - # Run in a subshell for convenience, so that we don't have to worry about - # our PWD. - (set -x; cd && go install $1@latest) - fi -} From d3be9ad6f6a24c530a10b3135e4e128e4480cdf7 Mon Sep 17 00:00:00 2001 From: Henrique Vicente Date: Sun, 16 Feb 2025 08:20:52 +0100 Subject: [PATCH 4/6] api: use gRPC 2023 edition opaque API Also, just use int32 for Score type instead of converting between types. --- internal/api/grpc.go | 130 +- internal/apiv1/api.proto | 22 +- internal/apiv1/apipb/api.pb.go | 2540 ++++++++++++++++++--------- internal/apiv1/apipb/api_grpc.pb.go | 27 +- internal/inventory/inventory.go | 2 +- internal/inventory/review.go | 8 +- internal/inventory/review_test.go | 6 +- internal/postgres/postgres.go | 2 +- internal/postgres/postgres_test.go | 6 +- 9 files changed, 1859 insertions(+), 884 deletions(-) diff --git a/internal/api/grpc.go b/internal/api/grpc.go index d26ba21..c8a9ec3 100644 --- a/internal/api/grpc.go +++ b/internal/api/grpc.go @@ -8,6 +8,7 @@ import ( "github.com/henvic/pgxtutorial/internal/inventory" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" ) // InventoryGRPC services. @@ -18,18 +19,12 @@ type InventoryGRPC struct { func (i *InventoryGRPC) SearchProducts(ctx context.Context, req *apipb.SearchProductsRequest) (*apipb.SearchProductsResponse, error) { params := inventory.SearchProductsParams{ - QueryString: req.QueryString, - } - if req.MinPrice != nil { - params.MinPrice = int(*req.MinPrice) - } - if req.MaxPrice != nil { - params.MaxPrice = int(*req.MaxPrice) - } - page, pp := 1, 50 - if req.Page != nil { - page = int(*req.Page) + QueryString: req.GetQueryString(), + MinPrice: int(req.GetMinPrice()), + MaxPrice: int(req.GetMaxPrice()), } + page, pp := int(req.GetPage()), 50 + params.Pagination = inventory.Pagination{ Limit: pp * page, Offset: pp * (page - 1), @@ -41,26 +36,26 @@ func (i *InventoryGRPC) SearchProducts(ctx context.Context, req *apipb.SearchPro items := []*apipb.Product{} for _, p := range products.Items { - items = append(items, &apipb.Product{ - Id: p.ID, - Price: int64(p.Price), - Name: p.Name, - Description: p.Description, - }) - } - return &apipb.SearchProductsResponse{ - Total: int32(products.Total), + items = append(items, apipb.Product_builder{ + Id: proto.String(p.ID), + Price: proto.Int64(int64(p.Price)), + Name: proto.String(p.Name), + Description: proto.String(p.Description), + }.Build()) + } + return apipb.SearchProductsResponse_builder{ + Total: proto.Int32(int32(products.Total)), Items: items, - }, nil + }.Build(), nil } // CreateProduct on the inventory. func (i *InventoryGRPC) CreateProduct(ctx context.Context, req *apipb.CreateProductRequest) (*apipb.CreateProductResponse, error) { if err := i.Inventory.CreateProduct(ctx, inventory.CreateProductParams{ - ID: req.Id, - Name: req.Name, - Description: req.Description, - Price: int(req.Price), + ID: req.GetId(), + Name: req.GetName(), + Description: req.GetDescription(), + Price: int(req.GetPrice()), }); err != nil { return nil, grpcAPIError(err) } @@ -70,12 +65,16 @@ func (i *InventoryGRPC) CreateProduct(ctx context.Context, req *apipb.CreateProd // UpdateProduct on the inventory. func (i *InventoryGRPC) UpdateProduct(ctx context.Context, req *apipb.UpdateProductRequest) (*apipb.UpdateProductResponse, error) { params := inventory.UpdateProductParams{ - ID: req.Id, - Name: req.Name, - Description: req.Description, + ID: req.GetId(), + } + if req.HasName() { + params.Name = proto.String(req.GetName()) + } + if req.HasDescription() { + params.Description = proto.String(req.GetDescription()) } - if req.Price != nil { - price := int(*req.Price) + if req.HasPrice() { + price := int(req.GetPrice()) params.Price = &price } if err := i.Inventory.UpdateProduct(ctx, params); err != nil { @@ -86,7 +85,7 @@ func (i *InventoryGRPC) UpdateProduct(ctx context.Context, req *apipb.UpdateProd // DeleteProduct on the inventory. func (i *InventoryGRPC) DeleteProduct(ctx context.Context, req *apipb.DeleteProductRequest) (*apipb.DeleteProductResponse, error) { - if err := i.Inventory.DeleteProduct(ctx, req.Id); err != nil { + if err := i.Inventory.DeleteProduct(ctx, req.GetId()); err != nil { return nil, grpcAPIError(err) } return &apipb.DeleteProductResponse{}, nil @@ -94,49 +93,48 @@ func (i *InventoryGRPC) DeleteProduct(ctx context.Context, req *apipb.DeleteProd // GetProduct on the inventory. func (i *InventoryGRPC) GetProduct(ctx context.Context, req *apipb.GetProductRequest) (*apipb.GetProductResponse, error) { - product, err := i.Inventory.GetProduct(ctx, req.Id) + product, err := i.Inventory.GetProduct(ctx, req.GetId()) if err != nil { return nil, grpcAPIError(err) } if product == nil { return nil, status.Error(codes.NotFound, "product not found") } - return &apipb.GetProductResponse{ - Id: product.ID, - Price: int64(product.Price), - Name: product.Name, - Description: product.Description, - CreatedAt: product.CreatedAt.String(), - ModifiedAt: product.ModifiedAt.String(), - }, nil + return apipb.GetProductResponse_builder{ + Id: proto.String(product.ID), + Price: proto.Int64(int64(product.Price)), + Name: proto.String(product.Name), + Description: proto.String(product.Description), + CreatedAt: proto.String(product.CreatedAt.String()), + ModifiedAt: proto.String(product.ModifiedAt.String()), + }.Build(), nil } // CreateProductReview on the inventory. func (i *InventoryGRPC) CreateProductReview(ctx context.Context, req *apipb.CreateProductReviewRequest) (*apipb.CreateProductReviewResponse, error) { id, err := i.Inventory.CreateProductReview(ctx, inventory.CreateProductReviewParams{ - ProductID: req.ProductId, - ReviewerID: req.ReviewerId, - Score: int(req.Score), - Title: req.Title, - Description: req.Description, + ProductID: req.GetProductId(), + ReviewerID: req.GetReviewerId(), + Score: req.GetScore(), + Title: req.GetTitle(), + Description: req.GetDescription(), }) if err != nil { return nil, grpcAPIError(err) } - return &apipb.CreateProductReviewResponse{ - Id: id, - }, nil + return apipb.CreateProductReviewResponse_builder{ + Id: proto.String(id), + }.Build(), nil } func (i *InventoryGRPC) UpdateProductReview(ctx context.Context, req *apipb.UpdateProductReviewRequest) (*apipb.UpdateProductReviewResponse, error) { params := inventory.UpdateProductReviewParams{ - ID: req.Id, - Title: req.Title, - Description: req.Description, + ID: req.GetId(), + Title: proto.String(req.GetTitle()), + Description: proto.String(req.GetDescription()), } - if req.Score != nil { - score := int(*req.Score) - params.Score = &score + if req.HasScore() { + params.Score = proto.Int32(req.GetScore()) } if err := i.Inventory.UpdateProductReview(ctx, params); err != nil { return nil, grpcAPIError(err) @@ -145,30 +143,30 @@ func (i *InventoryGRPC) UpdateProductReview(ctx context.Context, req *apipb.Upda } func (i *InventoryGRPC) DeleteProductReview(ctx context.Context, req *apipb.DeleteProductReviewRequest) (*apipb.DeleteProductReviewResponse, error) { - if err := i.Inventory.DeleteProductReview(ctx, req.Id); err != nil { + if err := i.Inventory.DeleteProductReview(ctx, req.GetId()); err != nil { return nil, grpcAPIError(err) } return &apipb.DeleteProductReviewResponse{}, nil } func (i *InventoryGRPC) GetProductReview(ctx context.Context, req *apipb.GetProductReviewRequest) (*apipb.GetProductReviewResponse, error) { - review, err := i.Inventory.GetProductReview(ctx, req.Id) + review, err := i.Inventory.GetProductReview(ctx, req.GetId()) if err != nil { return nil, grpcAPIError(err) } if review == nil { return nil, status.Error(codes.NotFound, "review not found") } - return &apipb.GetProductReviewResponse{ - Id: review.ID, - ProductId: review.ProductID, - ReviewerId: review.ReviewerID, - Score: int32(review.Score), - Title: review.Title, - Description: review.Description, - CreatedAt: review.CreatedAt.String(), - ModifiedAt: review.ModifiedAt.String(), - }, nil + return apipb.GetProductReviewResponse_builder{ + Id: proto.String(review.ID), + ProductId: proto.String(review.ProductID), + ReviewerId: proto.String(review.ReviewerID), + Score: proto.Int32(int32(review.Score)), + Title: proto.String(review.Title), + Description: proto.String(review.Description), + CreatedAt: proto.String(review.CreatedAt.String()), + ModifiedAt: proto.String(review.ModifiedAt.String()), + }.Build(), nil } // grpcAPIError wraps an error with gRPC API codes, when possible. diff --git a/internal/apiv1/api.proto b/internal/apiv1/api.proto index 66048cb..d4f8c70 100644 --- a/internal/apiv1/api.proto +++ b/internal/apiv1/api.proto @@ -1,8 +1,10 @@ -syntax = "proto3"; +edition = "2023"; package api.v1; +import "google/protobuf/go_features.proto"; option go_package = "github.com/henvic/pgxtutorial/internal/apiv1/apipb"; +option features.(pb.go).api_level = API_OPAQUE; // Inventory gRPC API service. service Inventory { @@ -21,9 +23,9 @@ service Inventory { // SearchProductsRequest message. message SearchProductsRequest { string query_string = 1; - optional int64 min_price = 2; - optional int64 max_price = 3; - optional int32 page = 4; + int64 min_price = 2; + int64 max_price = 3; + int32 page = 4 [default = 1]; } // SearchProductsResponse message. @@ -54,9 +56,9 @@ message CreateProductResponse {} // UpdateProductRequest message. message UpdateProductRequest { string id = 1; - optional string name = 2; - optional string description = 3; - optional int64 price = 4; + string name = 2; + string description = 3; + int64 price = 4; } // UpdateProductResponse message. @@ -102,9 +104,9 @@ message CreateProductReviewResponse { // UpdateProductReviewRequest message. message UpdateProductReviewRequest { string id = 1; - optional int32 score = 4; - optional string title = 5; - optional string description = 6; + int32 score = 4; + string title = 5; + string description = 6; } // UpdateProductReviewResponse message. diff --git a/internal/apiv1/apipb/api.pb.go b/internal/apiv1/apipb/api.pb.go index ef66190..ad1ce9b 100644 --- a/internal/apiv1/apipb/api.pb.go +++ b/internal/apiv1/apipb/api.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v5.27.3 +// protoc-gen-go v1.36.5 +// protoc v5.29.3 // source: api.proto package apipb @@ -9,8 +9,9 @@ package apipb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/gofeaturespb" reflect "reflect" - sync "sync" + unsafe "unsafe" ) const ( @@ -22,23 +23,27 @@ const ( // SearchProductsRequest message. type SearchProductsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - QueryString string `protobuf:"bytes,1,opt,name=query_string,json=queryString,proto3" json:"query_string,omitempty"` - MinPrice *int64 `protobuf:"varint,2,opt,name=min_price,json=minPrice,proto3,oneof" json:"min_price,omitempty"` - MaxPrice *int64 `protobuf:"varint,3,opt,name=max_price,json=maxPrice,proto3,oneof" json:"max_price,omitempty"` - Page *int32 `protobuf:"varint,4,opt,name=page,proto3,oneof" json:"page,omitempty"` -} + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_QueryString *string `protobuf:"bytes,1,opt,name=query_string,json=queryString"` + xxx_hidden_MinPrice int64 `protobuf:"varint,2,opt,name=min_price,json=minPrice"` + xxx_hidden_MaxPrice int64 `protobuf:"varint,3,opt,name=max_price,json=maxPrice"` + xxx_hidden_Page int32 `protobuf:"varint,4,opt,name=page,def=1"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +// Default values for SearchProductsRequest fields. +const ( + Default_SearchProductsRequest_Page = int32(1) +) func (x *SearchProductsRequest) Reset() { *x = SearchProductsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SearchProductsRequest) String() string { @@ -49,7 +54,7 @@ func (*SearchProductsRequest) ProtoMessage() {} func (x *SearchProductsRequest) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -59,56 +64,154 @@ func (x *SearchProductsRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SearchProductsRequest.ProtoReflect.Descriptor instead. -func (*SearchProductsRequest) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{0} -} - func (x *SearchProductsRequest) GetQueryString() string { if x != nil { - return x.QueryString + if x.xxx_hidden_QueryString != nil { + return *x.xxx_hidden_QueryString + } + return "" } return "" } func (x *SearchProductsRequest) GetMinPrice() int64 { - if x != nil && x.MinPrice != nil { - return *x.MinPrice + if x != nil { + return x.xxx_hidden_MinPrice } return 0 } func (x *SearchProductsRequest) GetMaxPrice() int64 { - if x != nil && x.MaxPrice != nil { - return *x.MaxPrice + if x != nil { + return x.xxx_hidden_MaxPrice } return 0 } func (x *SearchProductsRequest) GetPage() int32 { - if x != nil && x.Page != nil { - return *x.Page + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 3) { + return x.xxx_hidden_Page + } } - return 0 + return Default_SearchProductsRequest_Page +} + +func (x *SearchProductsRequest) SetQueryString(v string) { + x.xxx_hidden_QueryString = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *SearchProductsRequest) SetMinPrice(v int64) { + x.xxx_hidden_MinPrice = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *SearchProductsRequest) SetMaxPrice(v int64) { + x.xxx_hidden_MaxPrice = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *SearchProductsRequest) SetPage(v int32) { + x.xxx_hidden_Page = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *SearchProductsRequest) HasQueryString() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *SearchProductsRequest) HasMinPrice() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *SearchProductsRequest) HasMaxPrice() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *SearchProductsRequest) HasPage() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *SearchProductsRequest) ClearQueryString() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_QueryString = nil +} + +func (x *SearchProductsRequest) ClearMinPrice() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_MinPrice = 0 +} + +func (x *SearchProductsRequest) ClearMaxPrice() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_MaxPrice = 0 +} + +func (x *SearchProductsRequest) ClearPage() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) +} + +type SearchProductsRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + QueryString *string + MinPrice *int64 + MaxPrice *int64 + Page *int32 +} + +func (b0 SearchProductsRequest_builder) Build() *SearchProductsRequest { + m0 := &SearchProductsRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.QueryString != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_QueryString = b.QueryString + } + if b.MinPrice != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_MinPrice = *b.MinPrice + } + if b.MaxPrice != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_MaxPrice = *b.MaxPrice + } + if b.Page != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_Page = *b.Page + } + return m0 } // SearchProductsResponse message. type SearchProductsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Total int32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` - Items []*Product `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Total int32 `protobuf:"varint,1,opt,name=total"` + xxx_hidden_Items *[]*Product `protobuf:"bytes,2,rep,name=items"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SearchProductsResponse) Reset() { *x = SearchProductsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SearchProductsResponse) String() string { @@ -119,7 +222,7 @@ func (*SearchProductsResponse) ProtoMessage() {} func (x *SearchProductsResponse) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -129,44 +232,80 @@ func (x *SearchProductsResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SearchProductsResponse.ProtoReflect.Descriptor instead. -func (*SearchProductsResponse) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{1} -} - func (x *SearchProductsResponse) GetTotal() int32 { if x != nil { - return x.Total + return x.xxx_hidden_Total } return 0 } func (x *SearchProductsResponse) GetItems() []*Product { if x != nil { - return x.Items + if x.xxx_hidden_Items != nil { + return *x.xxx_hidden_Items + } } return nil } +func (x *SearchProductsResponse) SetTotal(v int32) { + x.xxx_hidden_Total = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *SearchProductsResponse) SetItems(v []*Product) { + x.xxx_hidden_Items = &v +} + +func (x *SearchProductsResponse) HasTotal() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *SearchProductsResponse) ClearTotal() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Total = 0 +} + +type SearchProductsResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Total *int32 + Items []*Product +} + +func (b0 SearchProductsResponse_builder) Build() *SearchProductsResponse { + m0 := &SearchProductsResponse{} + b, x := &b0, m0 + _, _ = b, x + if b.Total != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Total = *b.Total + } + x.xxx_hidden_Items = &b.Items + return m0 +} + // Product message. type Product struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Price int64 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + xxx_hidden_Price int64 `protobuf:"varint,2,opt,name=price"` + xxx_hidden_Name *string `protobuf:"bytes,3,opt,name=name"` + xxx_hidden_Description *string `protobuf:"bytes,4,opt,name=description"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Product) Reset() { *x = Product{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Product) String() string { @@ -177,7 +316,7 @@ func (*Product) ProtoMessage() {} func (x *Product) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -187,58 +326,161 @@ func (x *Product) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Product.ProtoReflect.Descriptor instead. -func (*Product) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{2} -} - func (x *Product) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } func (x *Product) GetPrice() int64 { if x != nil { - return x.Price + return x.xxx_hidden_Price } return 0 } func (x *Product) GetName() string { if x != nil { - return x.Name + if x.xxx_hidden_Name != nil { + return *x.xxx_hidden_Name + } + return "" } return "" } func (x *Product) GetDescription() string { if x != nil { - return x.Description + if x.xxx_hidden_Description != nil { + return *x.xxx_hidden_Description + } + return "" } return "" } +func (x *Product) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *Product) SetPrice(v int64) { + x.xxx_hidden_Price = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *Product) SetName(v string) { + x.xxx_hidden_Name = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *Product) SetDescription(v string) { + x.xxx_hidden_Description = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *Product) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Product) HasPrice() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Product) HasName() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *Product) HasDescription() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *Product) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +func (x *Product) ClearPrice() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Price = 0 +} + +func (x *Product) ClearName() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Name = nil +} + +func (x *Product) ClearDescription() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Description = nil +} + +type Product_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string + Price *int64 + Name *string + Description *string +} + +func (b0 Product_builder) Build() *Product { + m0 := &Product{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_Id = b.Id + } + if b.Price != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_Price = *b.Price + } + if b.Name != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_Name = b.Name + } + if b.Description != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_Description = b.Description + } + return m0 +} + // CreateProductRequest message. type CreateProductRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Price int64 `protobuf:"varint,4,opt,name=price,proto3" json:"price,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + xxx_hidden_Name *string `protobuf:"bytes,2,opt,name=name"` + xxx_hidden_Description *string `protobuf:"bytes,3,opt,name=description"` + xxx_hidden_Price int64 `protobuf:"varint,4,opt,name=price"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateProductRequest) Reset() { *x = CreateProductRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateProductRequest) String() string { @@ -249,7 +491,7 @@ func (*CreateProductRequest) ProtoMessage() {} func (x *CreateProductRequest) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -259,53 +501,155 @@ func (x *CreateProductRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateProductRequest.ProtoReflect.Descriptor instead. -func (*CreateProductRequest) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{3} -} - func (x *CreateProductRequest) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } func (x *CreateProductRequest) GetName() string { if x != nil { - return x.Name + if x.xxx_hidden_Name != nil { + return *x.xxx_hidden_Name + } + return "" } return "" } func (x *CreateProductRequest) GetDescription() string { if x != nil { - return x.Description + if x.xxx_hidden_Description != nil { + return *x.xxx_hidden_Description + } + return "" } return "" } func (x *CreateProductRequest) GetPrice() int64 { if x != nil { - return x.Price + return x.xxx_hidden_Price } return 0 } +func (x *CreateProductRequest) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *CreateProductRequest) SetName(v string) { + x.xxx_hidden_Name = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *CreateProductRequest) SetDescription(v string) { + x.xxx_hidden_Description = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *CreateProductRequest) SetPrice(v int64) { + x.xxx_hidden_Price = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *CreateProductRequest) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *CreateProductRequest) HasName() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CreateProductRequest) HasDescription() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *CreateProductRequest) HasPrice() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *CreateProductRequest) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +func (x *CreateProductRequest) ClearName() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Name = nil +} + +func (x *CreateProductRequest) ClearDescription() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Description = nil +} + +func (x *CreateProductRequest) ClearPrice() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Price = 0 +} + +type CreateProductRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string + Name *string + Description *string + Price *int64 +} + +func (b0 CreateProductRequest_builder) Build() *CreateProductRequest { + m0 := &CreateProductRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_Id = b.Id + } + if b.Name != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_Name = b.Name + } + if b.Description != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_Description = b.Description + } + if b.Price != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_Price = *b.Price + } + return m0 +} + // CreateProductResponse message. type CreateProductResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateProductResponse) Reset() { *x = CreateProductResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateProductResponse) String() string { @@ -316,7 +660,7 @@ func (*CreateProductResponse) ProtoMessage() {} func (x *CreateProductResponse) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -326,30 +670,36 @@ func (x *CreateProductResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateProductResponse.ProtoReflect.Descriptor instead. -func (*CreateProductResponse) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{4} +type CreateProductResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 CreateProductResponse_builder) Build() *CreateProductResponse { + m0 := &CreateProductResponse{} + b, x := &b0, m0 + _, _ = b, x + return m0 } // UpdateProductRequest message. type UpdateProductRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name *string `protobuf:"bytes,2,opt,name=name,proto3,oneof" json:"name,omitempty"` - Description *string `protobuf:"bytes,3,opt,name=description,proto3,oneof" json:"description,omitempty"` - Price *int64 `protobuf:"varint,4,opt,name=price,proto3,oneof" json:"price,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + xxx_hidden_Name *string `protobuf:"bytes,2,opt,name=name"` + xxx_hidden_Description *string `protobuf:"bytes,3,opt,name=description"` + xxx_hidden_Price int64 `protobuf:"varint,4,opt,name=price"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateProductRequest) Reset() { *x = UpdateProductRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateProductRequest) String() string { @@ -360,7 +710,7 @@ func (*UpdateProductRequest) ProtoMessage() {} func (x *UpdateProductRequest) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -370,53 +720,155 @@ func (x *UpdateProductRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UpdateProductRequest.ProtoReflect.Descriptor instead. -func (*UpdateProductRequest) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{5} -} - func (x *UpdateProductRequest) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } func (x *UpdateProductRequest) GetName() string { - if x != nil && x.Name != nil { - return *x.Name + if x != nil { + if x.xxx_hidden_Name != nil { + return *x.xxx_hidden_Name + } + return "" } return "" } func (x *UpdateProductRequest) GetDescription() string { - if x != nil && x.Description != nil { - return *x.Description + if x != nil { + if x.xxx_hidden_Description != nil { + return *x.xxx_hidden_Description + } + return "" } return "" } func (x *UpdateProductRequest) GetPrice() int64 { - if x != nil && x.Price != nil { - return *x.Price + if x != nil { + return x.xxx_hidden_Price } return 0 } +func (x *UpdateProductRequest) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *UpdateProductRequest) SetName(v string) { + x.xxx_hidden_Name = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *UpdateProductRequest) SetDescription(v string) { + x.xxx_hidden_Description = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *UpdateProductRequest) SetPrice(v int64) { + x.xxx_hidden_Price = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *UpdateProductRequest) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *UpdateProductRequest) HasName() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *UpdateProductRequest) HasDescription() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *UpdateProductRequest) HasPrice() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *UpdateProductRequest) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +func (x *UpdateProductRequest) ClearName() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Name = nil +} + +func (x *UpdateProductRequest) ClearDescription() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Description = nil +} + +func (x *UpdateProductRequest) ClearPrice() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Price = 0 +} + +type UpdateProductRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string + Name *string + Description *string + Price *int64 +} + +func (b0 UpdateProductRequest_builder) Build() *UpdateProductRequest { + m0 := &UpdateProductRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_Id = b.Id + } + if b.Name != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_Name = b.Name + } + if b.Description != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_Description = b.Description + } + if b.Price != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_Price = *b.Price + } + return m0 +} + // UpdateProductResponse message. type UpdateProductResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateProductResponse) Reset() { *x = UpdateProductResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateProductResponse) String() string { @@ -427,7 +879,7 @@ func (*UpdateProductResponse) ProtoMessage() {} func (x *UpdateProductResponse) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -437,27 +889,33 @@ func (x *UpdateProductResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UpdateProductResponse.ProtoReflect.Descriptor instead. -func (*UpdateProductResponse) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{6} +type UpdateProductResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 UpdateProductResponse_builder) Build() *UpdateProductResponse { + m0 := &UpdateProductResponse{} + b, x := &b0, m0 + _, _ = b, x + return m0 } // DeleteProductRequest message. type DeleteProductRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteProductRequest) Reset() { *x = DeleteProductRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteProductRequest) String() string { @@ -468,7 +926,7 @@ func (*DeleteProductRequest) ProtoMessage() {} func (x *DeleteProductRequest) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -478,32 +936,62 @@ func (x *DeleteProductRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeleteProductRequest.ProtoReflect.Descriptor instead. -func (*DeleteProductRequest) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{7} -} - func (x *DeleteProductRequest) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } +func (x *DeleteProductRequest) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *DeleteProductRequest) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *DeleteProductRequest) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +type DeleteProductRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string +} + +func (b0 DeleteProductRequest_builder) Build() *DeleteProductRequest { + m0 := &DeleteProductRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_Id = b.Id + } + return m0 +} + // DeleteProductResponse message. type DeleteProductResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteProductResponse) Reset() { *x = DeleteProductResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteProductResponse) String() string { @@ -514,7 +1002,7 @@ func (*DeleteProductResponse) ProtoMessage() {} func (x *DeleteProductResponse) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -524,27 +1012,33 @@ func (x *DeleteProductResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeleteProductResponse.ProtoReflect.Descriptor instead. -func (*DeleteProductResponse) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{8} +type DeleteProductResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 DeleteProductResponse_builder) Build() *DeleteProductResponse { + m0 := &DeleteProductResponse{} + b, x := &b0, m0 + _, _ = b, x + return m0 } // GetProductRequest message. type GetProductRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetProductRequest) Reset() { *x = GetProductRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetProductRequest) String() string { @@ -555,7 +1049,7 @@ func (*GetProductRequest) ProtoMessage() {} func (x *GetProductRequest) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -565,39 +1059,70 @@ func (x *GetProductRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetProductRequest.ProtoReflect.Descriptor instead. -func (*GetProductRequest) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{9} -} - func (x *GetProductRequest) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } +func (x *GetProductRequest) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *GetProductRequest) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *GetProductRequest) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +type GetProductRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string +} + +func (b0 GetProductRequest_builder) Build() *GetProductRequest { + m0 := &GetProductRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_Id = b.Id + } + return m0 +} + // GetProductResponse message. type GetProductResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Price int64 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - CreatedAt string `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - ModifiedAt string `protobuf:"bytes,6,opt,name=modified_at,json=modifiedAt,proto3" json:"modified_at,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + xxx_hidden_Price int64 `protobuf:"varint,2,opt,name=price"` + xxx_hidden_Name *string `protobuf:"bytes,3,opt,name=name"` + xxx_hidden_Description *string `protobuf:"bytes,4,opt,name=description"` + xxx_hidden_CreatedAt *string `protobuf:"bytes,5,opt,name=created_at,json=createdAt"` + xxx_hidden_ModifiedAt *string `protobuf:"bytes,6,opt,name=modified_at,json=modifiedAt"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetProductResponse) Reset() { *x = GetProductResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetProductResponse) String() string { @@ -608,7 +1133,7 @@ func (*GetProductResponse) ProtoMessage() {} func (x *GetProductResponse) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -618,73 +1143,226 @@ func (x *GetProductResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetProductResponse.ProtoReflect.Descriptor instead. -func (*GetProductResponse) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{10} -} - func (x *GetProductResponse) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } func (x *GetProductResponse) GetPrice() int64 { if x != nil { - return x.Price + return x.xxx_hidden_Price } return 0 } func (x *GetProductResponse) GetName() string { if x != nil { - return x.Name + if x.xxx_hidden_Name != nil { + return *x.xxx_hidden_Name + } + return "" } return "" } func (x *GetProductResponse) GetDescription() string { if x != nil { - return x.Description + if x.xxx_hidden_Description != nil { + return *x.xxx_hidden_Description + } + return "" } return "" } func (x *GetProductResponse) GetCreatedAt() string { if x != nil { - return x.CreatedAt + if x.xxx_hidden_CreatedAt != nil { + return *x.xxx_hidden_CreatedAt + } + return "" } return "" } func (x *GetProductResponse) GetModifiedAt() string { if x != nil { - return x.ModifiedAt + if x.xxx_hidden_ModifiedAt != nil { + return *x.xxx_hidden_ModifiedAt + } + return "" } return "" } +func (x *GetProductResponse) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 6) +} + +func (x *GetProductResponse) SetPrice(v int64) { + x.xxx_hidden_Price = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 6) +} + +func (x *GetProductResponse) SetName(v string) { + x.xxx_hidden_Name = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 6) +} + +func (x *GetProductResponse) SetDescription(v string) { + x.xxx_hidden_Description = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 6) +} + +func (x *GetProductResponse) SetCreatedAt(v string) { + x.xxx_hidden_CreatedAt = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 6) +} + +func (x *GetProductResponse) SetModifiedAt(v string) { + x.xxx_hidden_ModifiedAt = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 6) +} + +func (x *GetProductResponse) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *GetProductResponse) HasPrice() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *GetProductResponse) HasName() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *GetProductResponse) HasDescription() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *GetProductResponse) HasCreatedAt() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *GetProductResponse) HasModifiedAt() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *GetProductResponse) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +func (x *GetProductResponse) ClearPrice() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Price = 0 +} + +func (x *GetProductResponse) ClearName() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Name = nil +} + +func (x *GetProductResponse) ClearDescription() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Description = nil +} + +func (x *GetProductResponse) ClearCreatedAt() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_CreatedAt = nil +} + +func (x *GetProductResponse) ClearModifiedAt() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_ModifiedAt = nil +} + +type GetProductResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string + Price *int64 + Name *string + Description *string + CreatedAt *string + ModifiedAt *string +} + +func (b0 GetProductResponse_builder) Build() *GetProductResponse { + m0 := &GetProductResponse{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 6) + x.xxx_hidden_Id = b.Id + } + if b.Price != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 6) + x.xxx_hidden_Price = *b.Price + } + if b.Name != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 6) + x.xxx_hidden_Name = b.Name + } + if b.Description != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 6) + x.xxx_hidden_Description = b.Description + } + if b.CreatedAt != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 6) + x.xxx_hidden_CreatedAt = b.CreatedAt + } + if b.ModifiedAt != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 6) + x.xxx_hidden_ModifiedAt = b.ModifiedAt + } + return m0 +} + // CreateProductReviewRequest message. type CreateProductReviewRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` - ReviewerId string `protobuf:"bytes,3,opt,name=reviewer_id,json=reviewerId,proto3" json:"reviewer_id,omitempty"` - Score int32 `protobuf:"varint,4,opt,name=score,proto3" json:"score,omitempty"` - Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ProductId *string `protobuf:"bytes,2,opt,name=product_id,json=productId"` + xxx_hidden_ReviewerId *string `protobuf:"bytes,3,opt,name=reviewer_id,json=reviewerId"` + xxx_hidden_Score int32 `protobuf:"varint,4,opt,name=score"` + xxx_hidden_Title *string `protobuf:"bytes,5,opt,name=title"` + xxx_hidden_Description *string `protobuf:"bytes,6,opt,name=description"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateProductReviewRequest) Reset() { *x = CreateProductReviewRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateProductReviewRequest) String() string { @@ -695,7 +1373,7 @@ func (*CreateProductReviewRequest) ProtoMessage() {} func (x *CreateProductReviewRequest) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -705,62 +1383,190 @@ func (x *CreateProductReviewRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateProductReviewRequest.ProtoReflect.Descriptor instead. -func (*CreateProductReviewRequest) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{11} -} - func (x *CreateProductReviewRequest) GetProductId() string { if x != nil { - return x.ProductId + if x.xxx_hidden_ProductId != nil { + return *x.xxx_hidden_ProductId + } + return "" } return "" } func (x *CreateProductReviewRequest) GetReviewerId() string { if x != nil { - return x.ReviewerId + if x.xxx_hidden_ReviewerId != nil { + return *x.xxx_hidden_ReviewerId + } + return "" } return "" } func (x *CreateProductReviewRequest) GetScore() int32 { if x != nil { - return x.Score + return x.xxx_hidden_Score } return 0 } func (x *CreateProductReviewRequest) GetTitle() string { if x != nil { - return x.Title + if x.xxx_hidden_Title != nil { + return *x.xxx_hidden_Title + } + return "" + } + return "" +} + +func (x *CreateProductReviewRequest) GetDescription() string { + if x != nil { + if x.xxx_hidden_Description != nil { + return *x.xxx_hidden_Description + } + return "" + } + return "" +} + +func (x *CreateProductReviewRequest) SetProductId(v string) { + x.xxx_hidden_ProductId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 5) +} + +func (x *CreateProductReviewRequest) SetReviewerId(v string) { + x.xxx_hidden_ReviewerId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 5) +} + +func (x *CreateProductReviewRequest) SetScore(v int32) { + x.xxx_hidden_Score = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 5) +} + +func (x *CreateProductReviewRequest) SetTitle(v string) { + x.xxx_hidden_Title = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 5) +} + +func (x *CreateProductReviewRequest) SetDescription(v string) { + x.xxx_hidden_Description = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 5) +} + +func (x *CreateProductReviewRequest) HasProductId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *CreateProductReviewRequest) HasReviewerId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CreateProductReviewRequest) HasScore() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *CreateProductReviewRequest) HasTitle() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *CreateProductReviewRequest) HasDescription() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *CreateProductReviewRequest) ClearProductId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_ProductId = nil +} + +func (x *CreateProductReviewRequest) ClearReviewerId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_ReviewerId = nil +} + +func (x *CreateProductReviewRequest) ClearScore() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Score = 0 +} + +func (x *CreateProductReviewRequest) ClearTitle() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Title = nil +} + +func (x *CreateProductReviewRequest) ClearDescription() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Description = nil +} + +type CreateProductReviewRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + ProductId *string + ReviewerId *string + Score *int32 + Title *string + Description *string +} + +func (b0 CreateProductReviewRequest_builder) Build() *CreateProductReviewRequest { + m0 := &CreateProductReviewRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.ProductId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 5) + x.xxx_hidden_ProductId = b.ProductId + } + if b.ReviewerId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 5) + x.xxx_hidden_ReviewerId = b.ReviewerId + } + if b.Score != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 5) + x.xxx_hidden_Score = *b.Score + } + if b.Title != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 5) + x.xxx_hidden_Title = b.Title } - return "" -} - -func (x *CreateProductReviewRequest) GetDescription() string { - if x != nil { - return x.Description + if b.Description != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 5) + x.xxx_hidden_Description = b.Description } - return "" + return m0 } // CreateProductReviewResponse message. type CreateProductReviewResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateProductReviewResponse) Reset() { *x = CreateProductReviewResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CreateProductReviewResponse) String() string { @@ -771,7 +1577,7 @@ func (*CreateProductReviewResponse) ProtoMessage() {} func (x *CreateProductReviewResponse) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -781,37 +1587,68 @@ func (x *CreateProductReviewResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateProductReviewResponse.ProtoReflect.Descriptor instead. -func (*CreateProductReviewResponse) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{12} -} - func (x *CreateProductReviewResponse) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } +func (x *CreateProductReviewResponse) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *CreateProductReviewResponse) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *CreateProductReviewResponse) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +type CreateProductReviewResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string +} + +func (b0 CreateProductReviewResponse_builder) Build() *CreateProductReviewResponse { + m0 := &CreateProductReviewResponse{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_Id = b.Id + } + return m0 +} + // UpdateProductReviewRequest message. type UpdateProductReviewRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Score *int32 `protobuf:"varint,4,opt,name=score,proto3,oneof" json:"score,omitempty"` - Title *string `protobuf:"bytes,5,opt,name=title,proto3,oneof" json:"title,omitempty"` - Description *string `protobuf:"bytes,6,opt,name=description,proto3,oneof" json:"description,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + xxx_hidden_Score int32 `protobuf:"varint,4,opt,name=score"` + xxx_hidden_Title *string `protobuf:"bytes,5,opt,name=title"` + xxx_hidden_Description *string `protobuf:"bytes,6,opt,name=description"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateProductReviewRequest) Reset() { *x = UpdateProductReviewRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateProductReviewRequest) String() string { @@ -822,7 +1659,7 @@ func (*UpdateProductReviewRequest) ProtoMessage() {} func (x *UpdateProductReviewRequest) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -832,53 +1669,155 @@ func (x *UpdateProductReviewRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UpdateProductReviewRequest.ProtoReflect.Descriptor instead. -func (*UpdateProductReviewRequest) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{13} -} - func (x *UpdateProductReviewRequest) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } func (x *UpdateProductReviewRequest) GetScore() int32 { - if x != nil && x.Score != nil { - return *x.Score + if x != nil { + return x.xxx_hidden_Score } return 0 } func (x *UpdateProductReviewRequest) GetTitle() string { - if x != nil && x.Title != nil { - return *x.Title + if x != nil { + if x.xxx_hidden_Title != nil { + return *x.xxx_hidden_Title + } + return "" } return "" } func (x *UpdateProductReviewRequest) GetDescription() string { - if x != nil && x.Description != nil { - return *x.Description + if x != nil { + if x.xxx_hidden_Description != nil { + return *x.xxx_hidden_Description + } + return "" } return "" } +func (x *UpdateProductReviewRequest) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *UpdateProductReviewRequest) SetScore(v int32) { + x.xxx_hidden_Score = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *UpdateProductReviewRequest) SetTitle(v string) { + x.xxx_hidden_Title = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *UpdateProductReviewRequest) SetDescription(v string) { + x.xxx_hidden_Description = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *UpdateProductReviewRequest) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *UpdateProductReviewRequest) HasScore() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *UpdateProductReviewRequest) HasTitle() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *UpdateProductReviewRequest) HasDescription() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *UpdateProductReviewRequest) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +func (x *UpdateProductReviewRequest) ClearScore() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Score = 0 +} + +func (x *UpdateProductReviewRequest) ClearTitle() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Title = nil +} + +func (x *UpdateProductReviewRequest) ClearDescription() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Description = nil +} + +type UpdateProductReviewRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string + Score *int32 + Title *string + Description *string +} + +func (b0 UpdateProductReviewRequest_builder) Build() *UpdateProductReviewRequest { + m0 := &UpdateProductReviewRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_Id = b.Id + } + if b.Score != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_Score = *b.Score + } + if b.Title != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_Title = b.Title + } + if b.Description != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_Description = b.Description + } + return m0 +} + // UpdateProductReviewResponse message. type UpdateProductReviewResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UpdateProductReviewResponse) Reset() { *x = UpdateProductReviewResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UpdateProductReviewResponse) String() string { @@ -889,7 +1828,7 @@ func (*UpdateProductReviewResponse) ProtoMessage() {} func (x *UpdateProductReviewResponse) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -899,27 +1838,33 @@ func (x *UpdateProductReviewResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UpdateProductReviewResponse.ProtoReflect.Descriptor instead. -func (*UpdateProductReviewResponse) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{14} +type UpdateProductReviewResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 UpdateProductReviewResponse_builder) Build() *UpdateProductReviewResponse { + m0 := &UpdateProductReviewResponse{} + b, x := &b0, m0 + _, _ = b, x + return m0 } // DeleteProductReviewRequest message. type DeleteProductReviewRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteProductReviewRequest) Reset() { *x = DeleteProductReviewRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteProductReviewRequest) String() string { @@ -930,7 +1875,7 @@ func (*DeleteProductReviewRequest) ProtoMessage() {} func (x *DeleteProductReviewRequest) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -940,32 +1885,62 @@ func (x *DeleteProductReviewRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeleteProductReviewRequest.ProtoReflect.Descriptor instead. -func (*DeleteProductReviewRequest) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{15} -} - func (x *DeleteProductReviewRequest) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } +func (x *DeleteProductReviewRequest) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *DeleteProductReviewRequest) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *DeleteProductReviewRequest) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +type DeleteProductReviewRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string +} + +func (b0 DeleteProductReviewRequest_builder) Build() *DeleteProductReviewRequest { + m0 := &DeleteProductReviewRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_Id = b.Id + } + return m0 +} + // DeleteProductReviewResponse message. type DeleteProductReviewResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeleteProductReviewResponse) Reset() { *x = DeleteProductReviewResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeleteProductReviewResponse) String() string { @@ -976,7 +1951,7 @@ func (*DeleteProductReviewResponse) ProtoMessage() {} func (x *DeleteProductReviewResponse) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -986,27 +1961,33 @@ func (x *DeleteProductReviewResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeleteProductReviewResponse.ProtoReflect.Descriptor instead. -func (*DeleteProductReviewResponse) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{16} +type DeleteProductReviewResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 DeleteProductReviewResponse_builder) Build() *DeleteProductReviewResponse { + m0 := &DeleteProductReviewResponse{} + b, x := &b0, m0 + _, _ = b, x + return m0 } // GetProductReviewRequest message. type GetProductReviewRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetProductReviewRequest) Reset() { *x = GetProductReviewRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetProductReviewRequest) String() string { @@ -1017,7 +1998,7 @@ func (*GetProductReviewRequest) ProtoMessage() {} func (x *GetProductReviewRequest) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1027,41 +2008,72 @@ func (x *GetProductReviewRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetProductReviewRequest.ProtoReflect.Descriptor instead. -func (*GetProductReviewRequest) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{17} -} - func (x *GetProductReviewRequest) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } +func (x *GetProductReviewRequest) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *GetProductReviewRequest) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *GetProductReviewRequest) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +type GetProductReviewRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string +} + +func (b0 GetProductReviewRequest_builder) Build() *GetProductReviewRequest { + m0 := &GetProductReviewRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_Id = b.Id + } + return m0 +} + // GetProductReviewResponse message. type GetProductReviewResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` - ReviewerId string `protobuf:"bytes,3,opt,name=reviewer_id,json=reviewerId,proto3" json:"reviewer_id,omitempty"` - Score int32 `protobuf:"varint,4,opt,name=score,proto3" json:"score,omitempty"` - Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` - CreatedAt string `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - ModifiedAt string `protobuf:"bytes,8,opt,name=modified_at,json=modifiedAt,proto3" json:"modified_at,omitempty"` + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *string `protobuf:"bytes,1,opt,name=id"` + xxx_hidden_ProductId *string `protobuf:"bytes,2,opt,name=product_id,json=productId"` + xxx_hidden_ReviewerId *string `protobuf:"bytes,3,opt,name=reviewer_id,json=reviewerId"` + xxx_hidden_Score int32 `protobuf:"varint,4,opt,name=score"` + xxx_hidden_Title *string `protobuf:"bytes,5,opt,name=title"` + xxx_hidden_Description *string `protobuf:"bytes,6,opt,name=description"` + xxx_hidden_CreatedAt *string `protobuf:"bytes,7,opt,name=created_at,json=createdAt"` + xxx_hidden_ModifiedAt *string `protobuf:"bytes,8,opt,name=modified_at,json=modifiedAt"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetProductReviewResponse) Reset() { *x = GetProductReviewResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_api_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GetProductReviewResponse) String() string { @@ -1072,7 +2084,7 @@ func (*GetProductReviewResponse) ProtoMessage() {} func (x *GetProductReviewResponse) ProtoReflect() protoreflect.Message { mi := &file_api_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1082,253 +2094,439 @@ func (x *GetProductReviewResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetProductReviewResponse.ProtoReflect.Descriptor instead. -func (*GetProductReviewResponse) Descriptor() ([]byte, []int) { - return file_api_proto_rawDescGZIP(), []int{18} -} - func (x *GetProductReviewResponse) GetId() string { if x != nil { - return x.Id + if x.xxx_hidden_Id != nil { + return *x.xxx_hidden_Id + } + return "" } return "" } func (x *GetProductReviewResponse) GetProductId() string { if x != nil { - return x.ProductId + if x.xxx_hidden_ProductId != nil { + return *x.xxx_hidden_ProductId + } + return "" } return "" } func (x *GetProductReviewResponse) GetReviewerId() string { if x != nil { - return x.ReviewerId + if x.xxx_hidden_ReviewerId != nil { + return *x.xxx_hidden_ReviewerId + } + return "" } return "" } func (x *GetProductReviewResponse) GetScore() int32 { if x != nil { - return x.Score + return x.xxx_hidden_Score } return 0 } func (x *GetProductReviewResponse) GetTitle() string { if x != nil { - return x.Title + if x.xxx_hidden_Title != nil { + return *x.xxx_hidden_Title + } + return "" } return "" } func (x *GetProductReviewResponse) GetDescription() string { if x != nil { - return x.Description + if x.xxx_hidden_Description != nil { + return *x.xxx_hidden_Description + } + return "" } return "" } func (x *GetProductReviewResponse) GetCreatedAt() string { if x != nil { - return x.CreatedAt + if x.xxx_hidden_CreatedAt != nil { + return *x.xxx_hidden_CreatedAt + } + return "" } return "" } func (x *GetProductReviewResponse) GetModifiedAt() string { if x != nil { - return x.ModifiedAt + if x.xxx_hidden_ModifiedAt != nil { + return *x.xxx_hidden_ModifiedAt + } + return "" } return "" } +func (x *GetProductReviewResponse) SetId(v string) { + x.xxx_hidden_Id = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 8) +} + +func (x *GetProductReviewResponse) SetProductId(v string) { + x.xxx_hidden_ProductId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 8) +} + +func (x *GetProductReviewResponse) SetReviewerId(v string) { + x.xxx_hidden_ReviewerId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 8) +} + +func (x *GetProductReviewResponse) SetScore(v int32) { + x.xxx_hidden_Score = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 8) +} + +func (x *GetProductReviewResponse) SetTitle(v string) { + x.xxx_hidden_Title = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 8) +} + +func (x *GetProductReviewResponse) SetDescription(v string) { + x.xxx_hidden_Description = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 8) +} + +func (x *GetProductReviewResponse) SetCreatedAt(v string) { + x.xxx_hidden_CreatedAt = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 6, 8) +} + +func (x *GetProductReviewResponse) SetModifiedAt(v string) { + x.xxx_hidden_ModifiedAt = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 7, 8) +} + +func (x *GetProductReviewResponse) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *GetProductReviewResponse) HasProductId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *GetProductReviewResponse) HasReviewerId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *GetProductReviewResponse) HasScore() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *GetProductReviewResponse) HasTitle() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *GetProductReviewResponse) HasDescription() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *GetProductReviewResponse) HasCreatedAt() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 6) +} + +func (x *GetProductReviewResponse) HasModifiedAt() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 7) +} + +func (x *GetProductReviewResponse) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +func (x *GetProductReviewResponse) ClearProductId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_ProductId = nil +} + +func (x *GetProductReviewResponse) ClearReviewerId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_ReviewerId = nil +} + +func (x *GetProductReviewResponse) ClearScore() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Score = 0 +} + +func (x *GetProductReviewResponse) ClearTitle() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Title = nil +} + +func (x *GetProductReviewResponse) ClearDescription() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_Description = nil +} + +func (x *GetProductReviewResponse) ClearCreatedAt() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 6) + x.xxx_hidden_CreatedAt = nil +} + +func (x *GetProductReviewResponse) ClearModifiedAt() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 7) + x.xxx_hidden_ModifiedAt = nil +} + +type GetProductReviewResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id *string + ProductId *string + ReviewerId *string + Score *int32 + Title *string + Description *string + CreatedAt *string + ModifiedAt *string +} + +func (b0 GetProductReviewResponse_builder) Build() *GetProductReviewResponse { + m0 := &GetProductReviewResponse{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 8) + x.xxx_hidden_Id = b.Id + } + if b.ProductId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 8) + x.xxx_hidden_ProductId = b.ProductId + } + if b.ReviewerId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 8) + x.xxx_hidden_ReviewerId = b.ReviewerId + } + if b.Score != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 8) + x.xxx_hidden_Score = *b.Score + } + if b.Title != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 8) + x.xxx_hidden_Title = b.Title + } + if b.Description != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 8) + x.xxx_hidden_Description = b.Description + } + if b.CreatedAt != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 6, 8) + x.xxx_hidden_CreatedAt = b.CreatedAt + } + if b.ModifiedAt != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 7, 8) + x.xxx_hidden_ModifiedAt = b.ModifiedAt + } + return m0 +} + var File_api_proto protoreflect.FileDescriptor -var file_api_proto_rawDesc = []byte{ +var file_api_proto_rawDesc = string([]byte{ 0x0a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x22, 0xbc, 0x01, 0x0a, 0x15, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, - 0x0c, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x12, 0x20, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x50, 0x72, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x05, 0x48, 0x02, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, - 0x0a, 0x5f, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, - 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x70, 0x61, - 0x67, 0x65, 0x22, 0x55, 0x0a, 0x16, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x64, - 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, - 0x61, 0x6c, 0x12, 0x25, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x65, 0x0a, 0x07, 0x50, 0x72, 0x6f, - 0x64, 0x75, 0x63, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x2e, 0x76, 0x31, 0x1a, 0x21, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x67, 0x6f, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8b, 0x01, 0x0a, 0x15, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x21, 0x0a, 0x0c, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x69, 0x63, 0x65, + 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x15, 0x0a, + 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x3a, 0x01, 0x31, 0x52, 0x04, + 0x70, 0x61, 0x67, 0x65, 0x22, 0x55, 0x0a, 0x16, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x25, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x65, 0x0a, 0x07, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x72, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x72, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, - 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, - 0x72, 0x69, 0x63, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa4, 0x01, - 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x25, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x03, 0x48, 0x02, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x70, - 0x72, 0x69, 0x63, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x0a, - 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x17, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, - 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, - 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x22, 0xb0, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, - 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, - 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x41, 0x74, 0x22, 0xaa, 0x01, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x76, 0x69, 0x65, - 0x77, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, - 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, - 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x2d, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, - 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x22, 0xad, 0x01, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, - 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x74, - 0x69, 0x74, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x1d, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x72, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, + 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, + 0x69, 0x63, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x0a, 0x14, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x22, 0x17, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x0a, + 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x22, 0xb0, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, + 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x41, 0x74, 0x22, 0xaa, 0x01, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, + 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, + 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x2d, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x2c, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, + 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x22, 0x7a, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, - 0x1d, 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, - 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, - 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, - 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xf8, 0x01, 0x0a, 0x18, 0x47, 0x65, - 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, - 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x76, 0x69, - 0x65, 0x77, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, - 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x41, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, - 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x41, 0x74, 0x32, 0x94, 0x06, 0x0a, 0x09, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, - 0x72, 0x79, 0x12, 0x51, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x64, - 0x75, 0x63, 0x74, 0x73, 0x12, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, - 0x72, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, - 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, - 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, - 0x75, 0x63, 0x74, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x1d, 0x0a, + 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, + 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x0a, 0x1a, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, + 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1d, 0x0a, 0x1b, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, + 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x0a, 0x17, 0x47, 0x65, 0x74, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x22, 0xf8, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, + 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1f, + 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x41, 0x74, 0x32, + 0x94, 0x06, 0x0a, 0x09, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x51, 0x0a, + 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x12, + 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x4e, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x4e, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x4e, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, + 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x45, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x13, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, - 0x69, 0x65, 0x77, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, + 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x22, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, - 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x60, - 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, - 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, - 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, - 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x60, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, - 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, - 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x57, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, - 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, - 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x34, 0x5a, 0x32, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x6e, 0x76, 0x69, 0x63, - 0x2f, 0x70, 0x67, 0x78, 0x74, 0x75, 0x74, 0x6f, 0x72, 0x69, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x61, 0x70, 0x69, 0x76, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_proto_rawDescOnce sync.Once - file_api_proto_rawDescData = file_api_proto_rawDesc -) - -func file_api_proto_rawDescGZIP() []byte { - file_api_proto_rawDescOnce.Do(func() { - file_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_proto_rawDescData) - }) - return file_api_proto_rawDescData -} + 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, + 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x13, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, + 0x65, 0x77, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, + 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x57, 0x0a, + 0x10, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, + 0x77, 0x12, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x3c, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x6e, 0x76, 0x69, 0x63, 0x2f, 0x70, 0x67, 0x78, 0x74, + 0x75, 0x74, 0x6f, 0x72, 0x69, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x2f, 0x61, 0x70, 0x69, 0x76, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x70, 0x62, 0x92, 0x03, 0x05, 0xd2, + 0x3e, 0x02, 0x10, 0x03, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, + 0x07, +}) var file_api_proto_msgTypes = make([]protoimpl.MessageInfo, 19) -var file_api_proto_goTypes = []interface{}{ +var file_api_proto_goTypes = []any{ (*SearchProductsRequest)(nil), // 0: api.v1.SearchProductsRequest (*SearchProductsResponse)(nil), // 1: api.v1.SearchProductsResponse (*Product)(nil), // 2: api.v1.Product @@ -1381,244 +2579,11 @@ func file_api_proto_init() { if File_api_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchProductsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchProductsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Product); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateProductRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateProductResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateProductRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateProductResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteProductRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteProductResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetProductRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetProductResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateProductReviewRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateProductReviewResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateProductReviewRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateProductReviewResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteProductReviewRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteProductReviewResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetProductReviewRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetProductReviewResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_api_proto_msgTypes[0].OneofWrappers = []interface{}{} - file_api_proto_msgTypes[5].OneofWrappers = []interface{}{} - file_api_proto_msgTypes[13].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_proto_rawDesc), len(file_api_proto_rawDesc)), NumEnums: 0, NumMessages: 19, NumExtensions: 0, @@ -1629,7 +2594,6 @@ func file_api_proto_init() { MessageInfos: file_api_proto_msgTypes, }.Build() File_api_proto = out.File - file_api_proto_rawDesc = nil file_api_proto_goTypes = nil file_api_proto_depIdxs = nil } diff --git a/internal/apiv1/apipb/api_grpc.pb.go b/internal/apiv1/apipb/api_grpc.pb.go index 2a97423..10213aa 100644 --- a/internal/apiv1/apipb/api_grpc.pb.go +++ b/internal/apiv1/apipb/api_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.3 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 // source: api.proto package apipb @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Inventory_SearchProducts_FullMethodName = "/api.v1.Inventory/SearchProducts" @@ -147,7 +147,7 @@ func (c *inventoryClient) GetProductReview(ctx context.Context, in *GetProductRe // InventoryServer is the server API for Inventory service. // All implementations must embed UnimplementedInventoryServer -// for forward compatibility +// for forward compatibility. // // Inventory gRPC API service. type InventoryServer interface { @@ -163,9 +163,12 @@ type InventoryServer interface { mustEmbedUnimplementedInventoryServer() } -// UnimplementedInventoryServer must be embedded to have forward compatible implementations. -type UnimplementedInventoryServer struct { -} +// UnimplementedInventoryServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedInventoryServer struct{} func (UnimplementedInventoryServer) SearchProducts(context.Context, *SearchProductsRequest) (*SearchProductsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SearchProducts not implemented") @@ -195,6 +198,7 @@ func (UnimplementedInventoryServer) GetProductReview(context.Context, *GetProduc return nil, status.Errorf(codes.Unimplemented, "method GetProductReview not implemented") } func (UnimplementedInventoryServer) mustEmbedUnimplementedInventoryServer() {} +func (UnimplementedInventoryServer) testEmbeddedByValue() {} // UnsafeInventoryServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to InventoryServer will @@ -204,6 +208,13 @@ type UnsafeInventoryServer interface { } func RegisterInventoryServer(s grpc.ServiceRegistrar, srv InventoryServer) { + // If the following call pancis, it indicates UnimplementedInventoryServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Inventory_ServiceDesc, srv) } diff --git a/internal/inventory/inventory.go b/internal/inventory/inventory.go index 41a2551..0deab93 100644 --- a/internal/inventory/inventory.go +++ b/internal/inventory/inventory.go @@ -122,7 +122,7 @@ func (p *SearchProductsParams) validate() error { // SearchProductsResponse from SearchProducts. type SearchProductsResponse struct { Items []*Product - Total int + Total int32 } // SearchProducts returns a list of products. diff --git a/internal/inventory/review.go b/internal/inventory/review.go index 2b9dad2..0346765 100644 --- a/internal/inventory/review.go +++ b/internal/inventory/review.go @@ -11,7 +11,7 @@ type ProductReview struct { ID string ProductID string ReviewerID string - Score int + Score int32 Title string Description string CreatedAt time.Time @@ -22,7 +22,7 @@ type ProductReview struct { type CreateProductReviewParams struct { ProductID string ReviewerID string - Score int + Score int32 Title string Description string } @@ -47,7 +47,7 @@ func (p *CreateProductReviewParams) validate() error { } // validateScore checks if the score is between 0 to 5. -func validateScore(score int) error { +func validateScore(score int32) error { if score < 0 || score > 5 { return ValidationError{"invalid score"} } @@ -82,7 +82,7 @@ func (s *Service) CreateProductReview(ctx context.Context, params CreateProductR // UpdateProductReviewParams to use when updating an existing review. type UpdateProductReviewParams struct { ID string - Score *int + Score *int32 Title *string Description *string } diff --git a/internal/inventory/review_test.go b/internal/inventory/review_test.go index 999b411..b433cd3 100644 --- a/internal/inventory/review_test.go +++ b/internal/inventory/review_test.go @@ -260,7 +260,7 @@ func TestServiceUpdateProductReview(t *testing.T) { ctx: context.Background(), params: inventory.UpdateProductReviewParams{ ID: "invalid_review_score", - Score: ptr(-5), + Score: ptr(int32(-5)), }, }, wantErr: "invalid score", @@ -336,7 +336,7 @@ func TestServiceUpdateProductReview(t *testing.T) { ctx: context.Background(), params: inventory.UpdateProductReviewParams{ ID: firstReviewID, - Score: ptr(3), + Score: ptr(int32(3)), Title: ptr("updated title"), Description: ptr("updated desc"), }, @@ -355,7 +355,7 @@ func TestServiceUpdateProductReview(t *testing.T) { ctx: context.Background(), params: inventory.UpdateProductReviewParams{ ID: secondReviewID, - Score: ptr(5), + Score: ptr(int32(5)), }, }, want: &inventory.ProductReview{ diff --git a/internal/postgres/postgres.go b/internal/postgres/postgres.go index e26d7f8..4c45b7b 100644 --- a/internal/postgres/postgres.go +++ b/internal/postgres/postgres.go @@ -381,7 +381,7 @@ type review struct { ID string ProductID string ReviewerID string - Score int + Score int32 Title string Description string CreatedAt time.Time diff --git a/internal/postgres/postgres_test.go b/internal/postgres/postgres_test.go index 9753e0a..97e5d8f 100644 --- a/internal/postgres/postgres_test.go +++ b/internal/postgres/postgres_test.go @@ -1137,7 +1137,7 @@ func TestUpdateProductReview(t *testing.T) { ctx: context.Background(), params: inventory.UpdateProductReviewParams{ ID: "review_update_score", - Score: ptr(5), + Score: ptr(int32(5)), }, }, want: &inventory.ProductReview{ @@ -1155,7 +1155,7 @@ func TestUpdateProductReview(t *testing.T) { ctx: context.Background(), params: inventory.UpdateProductReviewParams{ ID: "review_update_score", - Score: ptr(542), + Score: ptr(int32(542)), }, }, wantErr: "invalid score", @@ -1213,7 +1213,7 @@ func TestUpdateProductReview(t *testing.T) { ctx: context.Background(), params: inventory.UpdateProductReviewParams{ ID: "review_update_multiple", - Score: ptr(5), + Score: ptr(int32(5)), Title: ptr("hello, world"), Description: ptr("abc"), }, From 813ece0d1610f35c7c4034180d9bd88ef9e95f71 Mon Sep 17 00:00:00 2001 From: Henrique Vicente Date: Sun, 16 Feb 2025 08:36:49 +0100 Subject: [PATCH 5/6] tests: use t.Context instead of context.Background where it makes sense --- internal/database/database_test.go | 6 +- internal/inventory/helper_test.go | 14 +- internal/inventory/inventory_test.go | 94 +++++----- internal/inventory/review_test.go | 78 ++++---- internal/postgres/helper_test.go | 12 +- internal/postgres/postgres_test.go | 176 +++++++++--------- .../telemetrytest/telemetrytest_test.go | 9 +- 7 files changed, 194 insertions(+), 195 deletions(-) diff --git a/internal/database/database_test.go b/internal/database/database_test.go index 9b5268d..2a6b789 100644 --- a/internal/database/database_test.go +++ b/internal/database/database_test.go @@ -24,7 +24,7 @@ func TestMain(m *testing.M) { func TestNewPGXPool(t *testing.T) { t.Parallel() - pool, err := NewPGXPool(context.Background(), "", &PGXStdLogger{ + pool, err := NewPGXPool(t.Context(), "", &PGXStdLogger{ Logger: slog.Default(), }, tracelog.LogLevelInfo, nil) if err != nil { @@ -33,7 +33,7 @@ func TestNewPGXPool(t *testing.T) { defer pool.Close() // Check reachability. - if _, err = pool.Exec(context.Background(), `SELECT 1`); err != nil { + if _, err = pool.Exec(t.Context(), `SELECT 1`); err != nil { t.Errorf("pool.Exec() error: %v", err) } } @@ -55,7 +55,7 @@ func TestNewPGXPoolErrors(t *testing.T) { { name: "invalid_connection_string", args: args{ - ctx: context.Background(), + ctx: t.Context(), connString: "http://localhost", logger: testingadapter.NewLogger(t), logLevel: tracelog.LogLevelInfo, diff --git a/internal/inventory/helper_test.go b/internal/inventory/helper_test.go index 989da62..6839119 100644 --- a/internal/inventory/helper_test.go +++ b/internal/inventory/helper_test.go @@ -14,28 +14,28 @@ import ( func createProducts(t testing.TB, s *inventory.Service, products []inventory.CreateProductParams) { for _, p := range products { - if err := s.CreateProduct(context.Background(), p); err != nil { + if err := s.CreateProduct(t.Context(), p); err != nil { t.Errorf("Service.CreateProduct() error = %v", err) } } } func createProductReview(t testing.TB, s *inventory.Service, review inventory.CreateProductReviewParams) (id string) { - id, err := s.CreateProductReview(context.Background(), review) + id, err := s.CreateProductReview(t.Context(), review) if err != nil { t.Errorf("DB.CreateProductReview() error = %v", err) } return id } -func canceledContext() context.Context { - ctx, cancel := context.WithCancel(context.Background()) +func canceledContext(ctx context.Context) context.Context { + ctx, cancel := context.WithCancel(ctx) cancel() return ctx } -func deadlineExceededContext() context.Context { - ctx, cancel := context.WithTimeout(context.Background(), -time.Second) +func deadlineExceededContext(ctx context.Context) context.Context { + ctx, cancel := context.WithTimeout(ctx, -time.Second) cancel() return ctx } @@ -58,7 +58,7 @@ func serviceWithPostgres(t *testing.T) *inventory.Service { TemporaryDatabasePrefix: "test_inventory_pkg", // Avoid a clash between database names of packages on parallel execution. Files: os.DirFS("../../migrations"), }) - db = inventory.NewService(postgres.NewDB(migration.Setup(context.Background(), ""), slog.Default())) + db = inventory.NewService(postgres.NewDB(migration.Setup(t.Context(), ""), slog.Default())) } return db } diff --git a/internal/inventory/inventory_test.go b/internal/inventory/inventory_test.go index 71c922c..6c34d27 100644 --- a/internal/inventory/inventory_test.go +++ b/internal/inventory/inventory_test.go @@ -42,7 +42,7 @@ func TestServiceCreateProduct(t *testing.T) { { name: "empty", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{}, }, wantErr: "missing product ID", @@ -50,7 +50,7 @@ func TestServiceCreateProduct(t *testing.T) { { name: "simple", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "simple", Name: "product name", @@ -71,7 +71,7 @@ func TestServiceCreateProduct(t *testing.T) { { name: "no_product_name", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "no_product_name", Name: "", @@ -84,7 +84,7 @@ func TestServiceCreateProduct(t *testing.T) { { name: "no_product_description", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "no_product_description", Name: "product name", @@ -96,7 +96,7 @@ func TestServiceCreateProduct(t *testing.T) { { name: "negative_price", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "negative_price", Name: "product name", @@ -109,7 +109,7 @@ func TestServiceCreateProduct(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), params: inventory.CreateProductParams{ ID: "simple", Name: "product name", @@ -134,7 +134,7 @@ func TestServiceCreateProduct(t *testing.T) { return m }, args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "simple", Name: "product name", @@ -211,7 +211,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "empty", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{}, }, wantErr: "missing product ID", @@ -219,7 +219,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "no_product_name", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "no_product_name", Name: ptr(""), @@ -232,7 +232,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "no_product_description", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "no_product_description", Name: ptr("product name"), @@ -245,7 +245,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "negative_price", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "negative_price", Name: ptr("product name"), @@ -258,7 +258,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "product_name_change", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "product", Name: ptr("A new name"), @@ -274,7 +274,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "product_description_change", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "product", Description: ptr("A new description"), @@ -290,7 +290,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "product_changes", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "product", Name: ptr("Even another name"), @@ -308,7 +308,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "World", Name: ptr("Earth"), @@ -319,7 +319,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "update_product_check_violation", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "product", Name: ptr(""), @@ -330,7 +330,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), params: inventory.UpdateProductParams{ ID: "product", Name: ptr("Earth"), @@ -341,7 +341,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), params: inventory.UpdateProductParams{ ID: "product", Name: ptr("Earth"), @@ -352,7 +352,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "another_product_price_change", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "another", Price: ptr(97), @@ -368,7 +368,7 @@ func TestServiceUpdateProduct(t *testing.T) { { name: "no_changes", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "no_changes", }, @@ -390,7 +390,7 @@ func TestServiceUpdateProduct(t *testing.T) { return m }, args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "simple", Name: ptr("product name"), @@ -461,7 +461,7 @@ func TestServiceDeleteProduct(t *testing.T) { { name: "missing_product_id", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "", }, wantErr: "missing product ID", @@ -469,7 +469,7 @@ func TestServiceDeleteProduct(t *testing.T) { { name: "product", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "product", }, wantErr: "", @@ -478,7 +478,7 @@ func TestServiceDeleteProduct(t *testing.T) { { name: "product_already_deleted", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "product", }, wantErr: "", @@ -487,14 +487,14 @@ func TestServiceDeleteProduct(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "xyz", }, }, { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), id: "product", }, wantErr: "context canceled", @@ -502,7 +502,7 @@ func TestServiceDeleteProduct(t *testing.T) { { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), id: "product", }, wantErr: "context deadline exceeded", @@ -510,7 +510,7 @@ func TestServiceDeleteProduct(t *testing.T) { { name: "database_error", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "product", }, mock: func(t testing.TB) *inventory.MockDB { @@ -565,7 +565,7 @@ func TestServiceGetProduct(t *testing.T) { { name: "missing_product_id", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "", }, wantErr: "missing product ID", @@ -573,7 +573,7 @@ func TestServiceGetProduct(t *testing.T) { { name: "product", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "product", }, want: &inventory.Product{ @@ -588,7 +588,7 @@ func TestServiceGetProduct(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "not_found", }, want: nil, @@ -596,7 +596,7 @@ func TestServiceGetProduct(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), id: "product", }, wantErr: "context canceled", @@ -604,7 +604,7 @@ func TestServiceGetProduct(t *testing.T) { { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), id: "product", }, wantErr: "context deadline exceeded", @@ -612,7 +612,7 @@ func TestServiceGetProduct(t *testing.T) { { name: "database_error", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "product", }, mock: func(t testing.TB) *inventory.MockDB { @@ -692,7 +692,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "product", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "plain desk", Pagination: inventory.Pagination{ @@ -718,7 +718,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "missing_search_term", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "", Pagination: inventory.Pagination{ @@ -731,7 +731,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "negative_min_price", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "value", MinPrice: -1, @@ -745,7 +745,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "negative_max_price", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "value", MaxPrice: -1, @@ -759,7 +759,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "missing_pagination_limit", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "plain desk", }, @@ -769,7 +769,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "bad_pagination_offset", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "plain desk", Pagination: inventory.Pagination{ @@ -783,7 +783,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "product_very_expensive", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "plain desk", MinPrice: 900, @@ -801,7 +801,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "home", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "home", Pagination: inventory.Pagination{ @@ -835,7 +835,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "home_paginated", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "home", Pagination: inventory.Pagination{ @@ -862,7 +862,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "home_cheaper", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "home", MaxPrice: 130, @@ -889,7 +889,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "xyz", Pagination: inventory.Pagination{ @@ -905,7 +905,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), params: inventory.SearchProductsParams{ QueryString: "xyz", Pagination: inventory.Pagination{ @@ -918,7 +918,7 @@ func TestServiceSearchProducts(t *testing.T) { { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), params: inventory.SearchProductsParams{ QueryString: "xyz", Pagination: inventory.Pagination{ diff --git a/internal/inventory/review_test.go b/internal/inventory/review_test.go index b433cd3..e55fd9b 100644 --- a/internal/inventory/review_test.go +++ b/internal/inventory/review_test.go @@ -43,7 +43,7 @@ func TestServiceCreateProductReview(t *testing.T) { { name: "missing_product_id", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewParams{ ReviewerID: "customer", Score: 5, @@ -56,7 +56,7 @@ func TestServiceCreateProductReview(t *testing.T) { { name: "missing_reviewer_id", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewParams{ ProductID: "product", Score: 5, @@ -69,7 +69,7 @@ func TestServiceCreateProductReview(t *testing.T) { { name: "missing_title", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewParams{ ProductID: "product", ReviewerID: "customer", @@ -82,7 +82,7 @@ func TestServiceCreateProductReview(t *testing.T) { { name: "missing_description", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewParams{ ProductID: "product", ReviewerID: "customer", @@ -95,7 +95,7 @@ func TestServiceCreateProductReview(t *testing.T) { { name: "invalid_score", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewParams{ ProductID: "product", ReviewerID: "customer", @@ -109,7 +109,7 @@ func TestServiceCreateProductReview(t *testing.T) { { name: "success", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewParams{ ProductID: "product", ReviewerID: "customer", @@ -132,7 +132,7 @@ func TestServiceCreateProductReview(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), params: inventory.CreateProductReviewParams{ ProductID: "product", ReviewerID: "customer", @@ -155,7 +155,7 @@ func TestServiceCreateProductReview(t *testing.T) { return m }, args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewParams{ ProductID: "product", ReviewerID: "customer", @@ -249,7 +249,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "empty", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{}, }, wantErr: "missing review ID", @@ -257,7 +257,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "invalid_review_score", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "invalid_review_score", Score: ptr(int32(-5)), @@ -268,7 +268,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "no_product_review_title", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "no_product_review_title", Title: ptr(""), @@ -279,7 +279,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "no_product_review_description", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "no_product_review_desc", Description: ptr(""), @@ -290,7 +290,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "World", Title: ptr("Earth"), @@ -301,7 +301,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), params: inventory.UpdateProductReviewParams{ ID: "product_review", Title: ptr("Earth"), @@ -312,7 +312,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), params: inventory.UpdateProductReviewParams{ ID: "product_review", Title: ptr("Earth"), @@ -323,7 +323,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "no_changes", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "no_changes", }, @@ -333,7 +333,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "success", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: firstReviewID, Score: ptr(int32(3)), @@ -352,7 +352,7 @@ func TestServiceUpdateProductReview(t *testing.T) { { name: "success_score", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: secondReviewID, Score: ptr(int32(5)), @@ -380,7 +380,7 @@ func TestServiceUpdateProductReview(t *testing.T) { return m }, args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "simple", Title: ptr("product review title"), @@ -460,7 +460,7 @@ func TestServiceDeleteProductReview(t *testing.T) { { name: "missing_product_review_id", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "", }, wantErr: "missing review ID", @@ -468,7 +468,7 @@ func TestServiceDeleteProductReview(t *testing.T) { { name: "success", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: reviewID, }, wantErr: "", @@ -477,7 +477,7 @@ func TestServiceDeleteProductReview(t *testing.T) { { name: "already_deleted", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: reviewID, }, wantErr: "", @@ -486,14 +486,14 @@ func TestServiceDeleteProductReview(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "xyz", }, }, { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), id: "abc", }, wantErr: "context canceled", @@ -501,7 +501,7 @@ func TestServiceDeleteProductReview(t *testing.T) { { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), id: "def", }, wantErr: "context deadline exceeded", @@ -509,7 +509,7 @@ func TestServiceDeleteProductReview(t *testing.T) { { name: "database_error", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "ghi", }, mock: func(t testing.TB) *inventory.MockDB { @@ -578,7 +578,7 @@ func TestServiceGetProductReview(t *testing.T) { { name: "missing_product_review_id", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "", }, wantErr: "missing review ID", @@ -586,7 +586,7 @@ func TestServiceGetProductReview(t *testing.T) { { name: "success", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: firstReviewID, }, want: &inventory.ProductReview{ @@ -602,7 +602,7 @@ func TestServiceGetProductReview(t *testing.T) { { name: "other", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: secondReviewID, }, want: &inventory.ProductReview{ @@ -618,7 +618,7 @@ func TestServiceGetProductReview(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "not_found", }, want: nil, @@ -626,7 +626,7 @@ func TestServiceGetProductReview(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), id: "review_id", }, wantErr: "context canceled", @@ -634,7 +634,7 @@ func TestServiceGetProductReview(t *testing.T) { { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), id: "review_id", }, wantErr: "context deadline exceeded", @@ -642,7 +642,7 @@ func TestServiceGetProductReview(t *testing.T) { { name: "database_error", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "review_id", }, mock: func(t testing.TB) *inventory.MockDB { @@ -749,7 +749,7 @@ func TestServiceGetProductReviews(t *testing.T) { { name: "success", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.ProductReviewsParams{ ProductID: "desk", Pagination: inventory.Pagination{ @@ -796,7 +796,7 @@ func TestServiceGetProductReviews(t *testing.T) { { name: "reviewer", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.ProductReviewsParams{ ReviewerID: "hacker", Pagination: inventory.Pagination{ @@ -833,7 +833,7 @@ func TestServiceGetProductReviews(t *testing.T) { { name: "missing_params", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.ProductReviewsParams{ Pagination: inventory.Pagination{ Limit: 10, @@ -845,7 +845,7 @@ func TestServiceGetProductReviews(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.ProductReviewsParams{ ProductID: "wardrobe", Pagination: inventory.Pagination{ @@ -861,7 +861,7 @@ func TestServiceGetProductReviews(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), params: inventory.ProductReviewsParams{ ProductID: "bench", Pagination: inventory.Pagination{ @@ -874,7 +874,7 @@ func TestServiceGetProductReviews(t *testing.T) { { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), params: inventory.ProductReviewsParams{ ReviewerID: "glazier", Pagination: inventory.Pagination{ diff --git a/internal/postgres/helper_test.go b/internal/postgres/helper_test.go index c530d86..0107f98 100644 --- a/internal/postgres/helper_test.go +++ b/internal/postgres/helper_test.go @@ -10,7 +10,7 @@ import ( func createProducts(t testing.TB, db DB, products []inventory.CreateProductParams) { for _, p := range products { - if err := db.CreateProduct(context.Background(), p); err != nil { + if err := db.CreateProduct(t.Context(), p); err != nil { t.Errorf("DB.CreateProduct() error = %v", err) } } @@ -18,20 +18,20 @@ func createProducts(t testing.TB, db DB, products []inventory.CreateProductParam func createProductReviews(t testing.TB, db DB, reviews []inventory.CreateProductReviewDBParams) { for _, r := range reviews { - if err := db.CreateProductReview(context.Background(), r); err != nil { + if err := db.CreateProductReview(t.Context(), r); err != nil { t.Errorf("DB.CreateProductReview() error = %v", err) } } } -func canceledContext() context.Context { - ctx, cancel := context.WithCancel(context.Background()) +func canceledContext(ctx context.Context) context.Context { + ctx, cancel := context.WithCancel(ctx) cancel() return ctx } -func deadlineExceededContext() context.Context { - ctx, cancel := context.WithTimeout(context.Background(), -time.Second) +func deadlineExceededContext(ctx context.Context) context.Context { + ctx, cancel := context.WithTimeout(ctx, -time.Second) cancel() return ctx } diff --git a/internal/postgres/postgres_test.go b/internal/postgres/postgres_test.go index 97e5d8f..c030c1b 100644 --- a/internal/postgres/postgres_test.go +++ b/internal/postgres/postgres_test.go @@ -32,10 +32,10 @@ func TestTransactionContext(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) - ctx, err := db.TransactionContext(context.Background()) + ctx, err := db.TransactionContext(t.Context()) if err != nil { t.Errorf("cannot create transaction context: %v", err) } @@ -53,10 +53,10 @@ func TestTransactionContextCanceled(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) - canceledCtx, immediateCancel := context.WithCancel(context.Background()) + canceledCtx, immediateCancel := context.WithCancel(t.Context()) immediateCancel() if _, err := db.TransactionContext(canceledCtx); err != context.Canceled { @@ -68,7 +68,7 @@ func TestCommitNoTransaction(t *testing.T) { t.Parallel() db := &DB{} - if err := db.Commit(context.Background()); err.Error() != "context has no transaction" { + if err := db.Commit(t.Context()); err.Error() != "context has no transaction" { t.Errorf("unexpected error value: %v", err) } } @@ -77,7 +77,7 @@ func TestRollbackNoTransaction(t *testing.T) { t.Parallel() db := &DB{} - if err := db.Rollback(context.Background()); err.Error() != "context has no transaction" { + if err := db.Rollback(t.Context()); err.Error() != "context has no transaction" { t.Errorf("unexpected error value: %v", err) } } @@ -88,11 +88,11 @@ func TestWithAcquire(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) // Reuse the same connection for executing SQL commands. - dbCtx, err := db.WithAcquire(context.Background()) + dbCtx, err := db.WithAcquire(t.Context()) if err != nil { t.Fatalf("unexpected DB.WithAcquire() error = %v", err) } @@ -118,7 +118,7 @@ func TestWithAcquireClosedPool(t *testing.T) { Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) migration.Teardown(context.Background()) if _, err := db.WithAcquire(context.Background()); err == nil { @@ -132,7 +132,7 @@ func TestCreateProduct(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) type args struct { @@ -148,7 +148,7 @@ func TestCreateProduct(t *testing.T) { { name: "hello", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "Hello", Name: "A name", @@ -168,7 +168,7 @@ func TestCreateProduct(t *testing.T) { { name: "world", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "World", Name: "Earth", @@ -188,7 +188,7 @@ func TestCreateProduct(t *testing.T) { { name: "world_already_exists", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "World", Name: "Earth", @@ -201,7 +201,7 @@ func TestCreateProduct(t *testing.T) { { name: "create_product_check_empty_id", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "", Name: "name", @@ -214,7 +214,7 @@ func TestCreateProduct(t *testing.T) { { name: "create_product_check_empty_name", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "id", Name: "", @@ -227,7 +227,7 @@ func TestCreateProduct(t *testing.T) { { name: "create_product_check_negative_price", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductParams{ ID: "id", Name: "name", @@ -240,14 +240,14 @@ func TestCreateProduct(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, @@ -280,7 +280,7 @@ func TestUpdateProduct(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) // Add some products that will be modified next: @@ -318,7 +318,7 @@ func TestUpdateProduct(t *testing.T) { { name: "product_name_change", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "product", Name: ptr("A new name"), @@ -334,7 +334,7 @@ func TestUpdateProduct(t *testing.T) { { name: "product_description_change", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "product", Description: ptr("A new description"), @@ -350,7 +350,7 @@ func TestUpdateProduct(t *testing.T) { { name: "product_changes", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "product", Name: ptr("Even another name"), @@ -368,7 +368,7 @@ func TestUpdateProduct(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "World", Name: ptr("Earth"), @@ -379,7 +379,7 @@ func TestUpdateProduct(t *testing.T) { { name: "update_product_check_empty_name", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "product", Name: ptr(""), @@ -390,21 +390,21 @@ func TestUpdateProduct(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, { name: "another_product_price_change", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductParams{ ID: "another", Price: ptr(97), @@ -446,7 +446,7 @@ func TestUpdateProduct(t *testing.T) { } // Verify UPDATE has a WHERE clause avoiding changing unrelated rows: - got, err := db.GetProduct(context.Background(), "do_not_change") + got, err := db.GetProduct(t.Context(), "do_not_change") if err != nil { t.Errorf("DB.GetProduct() error = %v", err) } @@ -471,7 +471,7 @@ func TestGetProduct(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) createProducts(t, db, []inventory.CreateProductParams{ @@ -496,7 +496,7 @@ func TestGetProduct(t *testing.T) { { name: "product", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "product", }, want: &inventory.Product{ @@ -511,7 +511,7 @@ func TestGetProduct(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "not_found", }, want: nil, @@ -519,14 +519,14 @@ func TestGetProduct(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, @@ -554,12 +554,12 @@ func TestSearchProducts(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) // On this test, reuse the same connection for executing SQL commands // to check acquiring and releasing a connection passed via context is working as expected. - dbCtx, err := db.WithAcquire(context.Background()) + dbCtx, err := db.WithAcquire(t.Context()) if err != nil { t.Fatalf("unexpected DB.WithAcquire() error = %v", err) } @@ -725,7 +725,7 @@ func TestSearchProducts(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.SearchProductsParams{ QueryString: "xyz", }, @@ -738,14 +738,14 @@ func TestSearchProducts(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, @@ -773,7 +773,7 @@ func TestDeleteProduct(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) createProducts(t, db, []inventory.CreateProductParams{ @@ -802,7 +802,7 @@ func TestDeleteProduct(t *testing.T) { { name: "product", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "product", }, wantErr: "", @@ -811,7 +811,7 @@ func TestDeleteProduct(t *testing.T) { { name: "product_already_deleted", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "product", }, wantErr: "", @@ -820,21 +820,21 @@ func TestDeleteProduct(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "xyz", }, }, { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, @@ -849,7 +849,7 @@ func TestDeleteProduct(t *testing.T) { if err != nil { return } - got, err := db.GetProduct(context.Background(), tt.args.id) + got, err := db.GetProduct(t.Context(), tt.args.id) if err != nil { t.Errorf("DB.GetProduct() error = %v, wantErr %v", err, tt.wantErr) } @@ -860,7 +860,7 @@ func TestDeleteProduct(t *testing.T) { } // Check if a limited number of rows were deleted by verifying one product ("do_not_erase") exists on the database. var total int - if err := pool.QueryRow(context.Background(), `SELECT COUNT(*) as total FROM "product"`).Scan(&total); err != nil { + if err := pool.QueryRow(t.Context(), `SELECT COUNT(*) as total FROM "product"`).Scan(&total); err != nil { t.Fatalf(`failed to query "product" table: %v`, err) } if total != 1 { @@ -874,7 +874,7 @@ func TestCreateProductReview(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) createProducts(t, db, []inventory.CreateProductParams{ @@ -899,7 +899,7 @@ func TestCreateProductReview(t *testing.T) { { name: "success", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewDBParams{ ID: "review1", CreateProductReviewParams: inventory.CreateProductReviewParams{ @@ -925,7 +925,7 @@ func TestCreateProductReview(t *testing.T) { { name: "invalid_id", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewDBParams{ ID: "", CreateProductReviewParams: inventory.CreateProductReviewParams{ @@ -942,7 +942,7 @@ func TestCreateProductReview(t *testing.T) { { name: "invalid_title", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewDBParams{ ID: "xyz", CreateProductReviewParams: inventory.CreateProductReviewParams{ @@ -959,7 +959,7 @@ func TestCreateProductReview(t *testing.T) { { name: "invalid_score", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewDBParams{ ID: "xyz", CreateProductReviewParams: inventory.CreateProductReviewParams{ @@ -976,7 +976,7 @@ func TestCreateProductReview(t *testing.T) { { name: "review1_already_exists", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewDBParams{ ID: "review1", CreateProductReviewParams: inventory.CreateProductReviewParams{ @@ -993,7 +993,7 @@ func TestCreateProductReview(t *testing.T) { { name: "product_id_not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.CreateProductReviewDBParams{ ID: "review_has_no_product_on_database", CreateProductReviewParams: inventory.CreateProductReviewParams{ @@ -1010,14 +1010,14 @@ func TestCreateProductReview(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, @@ -1050,7 +1050,7 @@ func TestUpdateProductReview(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) // Add some products that will be modified next: @@ -1134,7 +1134,7 @@ func TestUpdateProductReview(t *testing.T) { { name: "update_score", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "review_update_score", Score: ptr(int32(5)), @@ -1152,7 +1152,7 @@ func TestUpdateProductReview(t *testing.T) { { name: "update_invalid_score", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "review_update_score", Score: ptr(int32(542)), @@ -1163,7 +1163,7 @@ func TestUpdateProductReview(t *testing.T) { { name: "update_title", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "review_update_title", Title: ptr("my review is really good"), @@ -1181,7 +1181,7 @@ func TestUpdateProductReview(t *testing.T) { { name: "update_invalid_title", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "review_update_score", Title: ptr(""), @@ -1192,7 +1192,7 @@ func TestUpdateProductReview(t *testing.T) { { name: "update_desc", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "review_update_desc", Description: ptr("this is a string, right?"), @@ -1210,7 +1210,7 @@ func TestUpdateProductReview(t *testing.T) { { name: "update_multiple", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "review_update_multiple", Score: ptr(int32(5)), @@ -1230,7 +1230,7 @@ func TestUpdateProductReview(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.UpdateProductReviewParams{ ID: "World", Title: ptr("Earth"), @@ -1241,14 +1241,14 @@ func TestUpdateProductReview(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, @@ -1281,7 +1281,7 @@ func TestUpdateProductReview(t *testing.T) { } // Verify UPDATE has a WHERE clause avoiding changing unrelated rows: - got, err := db.GetProductReview(context.Background(), "do_not_change") + got, err := db.GetProductReview(t.Context(), "do_not_change") if err != nil { t.Errorf("DB.GetProductReview() error = %v", err) } @@ -1308,7 +1308,7 @@ func TestGetProductReview(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) createProducts(t, db, []inventory.CreateProductParams{ @@ -1355,7 +1355,7 @@ func TestGetProductReview(t *testing.T) { { name: "success", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "review1", }, want: &inventory.ProductReview{ @@ -1372,7 +1372,7 @@ func TestGetProductReview(t *testing.T) { { name: "success_2", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "review2", }, want: &inventory.ProductReview{ @@ -1389,7 +1389,7 @@ func TestGetProductReview(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "not_found", }, want: nil, @@ -1397,14 +1397,14 @@ func TestGetProductReview(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, @@ -1432,7 +1432,7 @@ func TestGetProductReviews(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) createProducts(t, db, []inventory.CreateProductParams{ @@ -1497,7 +1497,7 @@ func TestGetProductReviews(t *testing.T) { { name: "success", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.ProductReviewsParams{ ProductID: "greatproduct", }, @@ -1527,7 +1527,7 @@ func TestGetProductReviews(t *testing.T) { { name: "limit", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.ProductReviewsParams{ ProductID: "greatproduct", Pagination: inventory.Pagination{ @@ -1553,7 +1553,7 @@ func TestGetProductReviews(t *testing.T) { { name: "limit", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.ProductReviewsParams{ ProductID: "greatproduct", Pagination: inventory.Pagination{ @@ -1578,7 +1578,7 @@ func TestGetProductReviews(t *testing.T) { { name: "other", args: args{ - ctx: context.Background(), + ctx: t.Context(), params: inventory.ProductReviewsParams{ ProductID: "goodproduct", }, @@ -1600,14 +1600,14 @@ func TestGetProductReviews(t *testing.T) { { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, @@ -1636,7 +1636,7 @@ func TestDeleteProductReview(t *testing.T) { Force: *force, Files: os.DirFS("../../migrations"), }) - pool := migration.Setup(context.Background(), "") + pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) createProducts(t, db, []inventory.CreateProductParams{ @@ -1692,7 +1692,7 @@ func TestDeleteProductReview(t *testing.T) { { name: "success", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "a", }, wantErr: "", @@ -1701,7 +1701,7 @@ func TestDeleteProductReview(t *testing.T) { { name: "a_again", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "a", }, wantErr: "", @@ -1710,7 +1710,7 @@ func TestDeleteProductReview(t *testing.T) { { name: "b", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "b", }, wantErr: "", @@ -1719,21 +1719,21 @@ func TestDeleteProductReview(t *testing.T) { { name: "not_found", args: args{ - ctx: context.Background(), + ctx: t.Context(), id: "xyz", }, }, { name: "canceled_ctx", args: args{ - ctx: canceledContext(), + ctx: canceledContext(t.Context()), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ - ctx: deadlineExceededContext(), + ctx: deadlineExceededContext(t.Context()), }, wantErr: "context deadline exceeded", }, @@ -1748,7 +1748,7 @@ func TestDeleteProductReview(t *testing.T) { if err != nil { return } - got, err := db.GetProductReview(context.Background(), tt.args.id) + got, err := db.GetProductReview(t.Context(), tt.args.id) if err != nil { t.Errorf("DB.GetProductReview() error = %v, wantErr %v", err, tt.wantErr) } @@ -1759,7 +1759,7 @@ func TestDeleteProductReview(t *testing.T) { } // Check if a limited number of rows were deleted by verifying one review ("do_not_erase") exists on the database. var total int - if err := pool.QueryRow(context.Background(), `SELECT COUNT(*) as total FROM "review"`).Scan(&total); err != nil { + if err := pool.QueryRow(t.Context(), `SELECT COUNT(*) as total FROM "review"`).Scan(&total); err != nil { t.Fatalf(`failed to query "review" table: %v`, err) } if total != 1 { diff --git a/internal/telemetry/telemetrytest/telemetrytest_test.go b/internal/telemetry/telemetrytest/telemetrytest_test.go index 59238d4..9ce39b9 100644 --- a/internal/telemetry/telemetrytest/telemetrytest_test.go +++ b/internal/telemetry/telemetrytest/telemetrytest_test.go @@ -1,7 +1,6 @@ package telemetrytest_test import ( - "context" "strings" "testing" @@ -18,7 +17,7 @@ func TestProvider(t *testing.T) { t.Errorf("mem.Log() = %v doesn't contain %v", got, want) } - _, span := tel.Tracer().Start(context.Background(), "span") + _, span := tel.Tracer().Start(t.Context(), "span") span.AddEvent("an_event") span.End() spans := mem.Trace() @@ -32,12 +31,12 @@ func TestProvider(t *testing.T) { if err != nil { t.Errorf("tel.Meter().Int64Counter() = %v, want nil", err) } - i.Add(context.Background(), 63) + i.Add(t.Context(), 63) if !strings.Contains(mem.Meter(), "onecounter") { t.Errorf("mem.Meter() = %v, want to contain %v", mem.Meter(), "onecounter") } mem.Reset() - i.Add(context.Background(), 1337) + i.Add(t.Context(), 1337) if mem.Log() != "" { t.Errorf("mem.Log() = %v, want empty", mem.Log()) } @@ -47,7 +46,7 @@ func TestProvider(t *testing.T) { if !strings.Contains(mem.Meter(), `"Value":1400`) { t.Errorf("mem.Meter() = %v, want to contain %v", mem.Meter(), `"Value":1400`) } - tel.Propagator().Inject(context.Background(), propagation.HeaderCarrier{ + tel.Propagator().Inject(t.Context(), propagation.HeaderCarrier{ "abc": []string{"def"}, }) if len(tel.Propagator().Fields()) != 3 { From 865c8eadf47dcf3e6c30d49d7ff04ebf9d0804bd Mon Sep 17 00:00:00 2001 From: Henrique Vicente Date: Sun, 16 Feb 2025 08:39:18 +0100 Subject: [PATCH 6/6] tests: simplify database migrations Open ./migrations fs.FS as a directory tree and just once. --- internal/postgres/postgres_test.go | 37 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/internal/postgres/postgres_test.go b/internal/postgres/postgres_test.go index c030c1b..e65e647 100644 --- a/internal/postgres/postgres_test.go +++ b/internal/postgres/postgres_test.go @@ -3,6 +3,7 @@ package postgres import ( "context" "flag" + "io/fs" "log" "log/slog" "os" @@ -17,11 +18,19 @@ import ( var force = flag.Bool("force", false, "Force cleaning the database before starting") +// migrations for testing the database. +var migrations fs.FS + func TestMain(m *testing.M) { if os.Getenv("INTEGRATION_TESTDB") != "true" { log.Printf("Skipping tests that require database connection") return } + migRoot, err := os.OpenRoot("../../migrations") + if err != nil { + log.Fatalf("cannot open DB migrations: %v", err) + } + migrations = migRoot.FS() os.Exit(m.Run()) } @@ -30,7 +39,7 @@ func TestTransactionContext(t *testing.T) { migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -51,7 +60,7 @@ func TestTransactionContextCanceled(t *testing.T) { migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -86,7 +95,7 @@ func TestWithAcquire(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -116,7 +125,7 @@ func TestWithAcquireClosedPool(t *testing.T) { // Opt out of automatic tearing down migration as we want to close the connection pool before t.Cleanup() is called. SkipTeardown: true, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -130,7 +139,7 @@ func TestCreateProduct(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -278,7 +287,7 @@ func TestUpdateProduct(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -469,7 +478,7 @@ func TestGetProduct(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -552,7 +561,7 @@ func TestSearchProducts(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -771,7 +780,7 @@ func TestDeleteProduct(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -872,7 +881,7 @@ func TestCreateProductReview(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -1048,7 +1057,7 @@ func TestUpdateProductReview(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -1306,7 +1315,7 @@ func TestGetProductReview(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -1430,7 +1439,7 @@ func TestGetProductReviews(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default()) @@ -1634,7 +1643,7 @@ func TestDeleteProductReview(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, - Files: os.DirFS("../../migrations"), + Files: migrations, }) pool := migration.Setup(t.Context(), "") db := NewDB(pool, slog.Default())