removed dependencies

This commit is contained in:
Денис Евстигнеев 2023-08-13 00:09:57 +03:00
parent dc0c660021
commit 85d1191dd9
15 changed files with 117 additions and 275 deletions

18
go.mod
View File

@ -11,10 +11,8 @@ require (
github.com/lib/pq v1.10.2
github.com/mattn/go-sqlite3 v1.14.16
github.com/pkg/errors v0.9.1
go.unistack.org/cms-service v0.0.1
go.unistack.org/micro-config-flag/v4 v4.0.2
go.unistack.org/micro-proto/v4 v4.0.1
go.unistack.org/micro-server-http/v3 v3.11.6
go.unistack.org/micro-server-http/v4 v4.0.9
go.unistack.org/micro/v4 v4.0.6
go.unistack.org/protoc-gen-go-micro/v4 v4.0.6
@ -51,7 +49,6 @@ require (
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c // indirect
github.com/jackc/pgx/v5 v5.3.1 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
@ -61,30 +58,18 @@ require (
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sijms/go-ora/v2 v2.6.7 // indirect
github.com/skeema/knownhosts v1.2.0 // indirect
github.com/spf13/afero v1.3.3 // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.uber.org/atomic v1.6.0 // indirect
go.unistack.org/cms-api-proto v0.0.4 // indirect
go.unistack.org/micro-broker-service/v3 v3.8.2 // indirect
go.unistack.org/micro-codec-yaml/v3 v3.10.0 // indirect
go.unistack.org/micro-config-env/v3 v3.8.5 // indirect
go.unistack.org/micro-config-file/v3 v3.8.3 // indirect
go.unistack.org/micro-config-flag/v3 v3.8.9 // indirect
go.unistack.org/micro-config-service/v3 v3.8.1 // indirect
go.unistack.org/micro-proto/v3 v3.3.1 // indirect
go.unistack.org/micro/v3 v3.10.18 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/tools v0.11.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.54.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/uint128 v1.3.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
@ -96,5 +81,4 @@ require (
modernc.org/sqlite v1.21.0 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.1.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

42
go.sum
View File

@ -578,7 +578,6 @@ github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ
github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
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/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
@ -640,8 +639,6 @@ github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9s
github.com/jackc/pgx/v4 v4.10.1/go.mod h1:QlrWebbs3kqEZPHCTGyxecvzG6tvIsYu+A5b1raylkA=
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c h1:Dznn52SgVIVst9UyOT9brctYUgxs+CvVfPaC3jKrA50=
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs=
github.com/jackc/pgx/v5 v5.3.1 h1:Fcr8QJ1ZeLi5zsPZqQeUZhNhxfkkKBOgJuYkJHoBOtU=
github.com/jackc/pgx/v5 v5.3.1/go.mod h1:t3JDKnCBlYIc0ewLF0Q7B8MXmoIaBOZj/ic7iHozM/8=
github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
@ -895,9 +892,6 @@ github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhr
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sijms/go-ora/v2 v2.6.7 h1:1tXyBLTkN+oGZwtQviClcCg7LYfcHZw069q+n1CUutM=
github.com/sijms/go-ora/v2 v2.6.7/go.mod h1:EHxlY6x7y9HAsdfumurRfTd+v8NrEOTR3Xl4FWlH6xk=
github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
@ -936,6 +930,8 @@ github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
@ -943,7 +939,10 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
@ -1014,37 +1013,14 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.unistack.org/cms-api-proto v0.0.4 h1:YFlnlr/rB0IadPiPhBC2B6/U9e4NLgkNvXTsgbu4bcw=
go.unistack.org/cms-api-proto v0.0.4/go.mod h1:t5+6CxtaK1CxOv8fG/UJvj911K8+e9d86AHymNR6wDA=
go.unistack.org/cms-service v0.0.1 h1:XKKZqjQD3ViPGRzjadnVX94wQlKcWxompZac9YTeTjw=
go.unistack.org/cms-service v0.0.1/go.mod h1:3apbDEEgmoPfnPRpzgN40fCqbn/BdfXDk/Hvly8+bGk=
go.unistack.org/micro-broker-service/v3 v3.8.2 h1:K30wBLsoLO0WbD9rhPi8S8asU9pfes/M2X9tX9HLr24=
go.unistack.org/micro-broker-service/v3 v3.8.2/go.mod h1:qTlBl4vdJSl66SFIjdjOWFWKO0BFQ2ImbwiPCti/H8M=
go.unistack.org/micro-client-http/v4 v4.0.2 h1:0xsm2RCRWMfb1moeXQQ220uz52XE0R/PZvM9was/4lM=
go.unistack.org/micro-client-http/v4 v4.0.2/go.mod h1:Z9QT/upeqrp/rXVkL0lk6AzrkTdes0W3QlFlZ+ytkqM=
go.unistack.org/micro-codec-yaml/v3 v3.10.0 h1:cnNiWQZ3F+jsCX9DhEHBdIw8CjBItxb+TrKGGdlQ8F8=
go.unistack.org/micro-codec-yaml/v3 v3.10.0/go.mod h1:UzwC3QZZ6+PgKSudlGZNLkugXzOFkp3sxhs/CctEwBY=
go.unistack.org/micro-config-env/v3 v3.8.5 h1:k0BKpQflJ9mutzK//VcYw4XAKlKHTvg2GtkHTrEjbko=
go.unistack.org/micro-config-env/v3 v3.8.5/go.mod h1:jz300Fzc9eDDogsfeJdEARW0TGXF7Pnp6CtiPhTjoA0=
go.unistack.org/micro-config-file/v3 v3.8.3 h1:yoAyDtmWutlUkVgFUtc7JhwCX7H/2Jz0nFOC0XEx4Kk=
go.unistack.org/micro-config-file/v3 v3.8.3/go.mod h1:dl+MQ27/P41+hINmSrZFltDSDYP1y2LItIDYb2jHFog=
go.unistack.org/micro-config-flag/v3 v3.8.9 h1:I4eoJVV28CpxQvQ63TJ1fqK5JcV1gHmOZPveT2Vl5Iw=
go.unistack.org/micro-config-flag/v3 v3.8.9/go.mod h1:eWI90dcZh5AOhkd83fF0KY17ea/DZPebkJ8K61yky+8=
go.unistack.org/micro-config-flag/v4 v4.0.2 h1:qoDpT/H8a8TYZS9ucoNC0bLhNdp+UFlhnRWOuqIKAyo=
go.unistack.org/micro-config-flag/v4 v4.0.2/go.mod h1:s0AYvz8rRtMHG2tkXoSmF8xFuHG12x3v1NERdMHDdiQ=
go.unistack.org/micro-config-service/v3 v3.8.1 h1:Q+RPWCb88VGz5+EQUx45Xeysf+Mon9Q2IvqCF3e8LZM=
go.unistack.org/micro-config-service/v3 v3.8.1/go.mod h1:KdZJEuYwninyT04ysFkgEQa3OaMRa0kSQVPQHlumQoA=
go.unistack.org/micro-proto/v3 v3.3.1 h1:nQ0MtWvP2G3QrpOgawVOPhpZZYkq6umTGDqs8FxJYIo=
go.unistack.org/micro-proto/v3 v3.3.1/go.mod h1:cwRyv8uInM2I7EbU7O8Fx2Ls3N90Uw9UCCcq4olOdfE=
go.unistack.org/micro-proto/v4 v4.0.1 h1:2RKHgtCOOcAFgKsnngGK5bqM/6MWXOjVCdw03dbuoF8=
go.unistack.org/micro-proto/v4 v4.0.1/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec=
go.unistack.org/micro-server-http/v3 v3.11.6 h1:BSjPyXrJ6OTyuCDE14XOGjLDJEICz2CEo2WfmSR3hqM=
go.unistack.org/micro-server-http/v3 v3.11.6/go.mod h1:phNG9aosjbneXvZxEVaVQI+NHLLZ3eA82mOH6gGSShY=
go.unistack.org/micro-server-http/v4 v4.0.9 h1:ye7LVVJSXlvE1TBvEuk4m3iZrAJk0rzs6vD2/qO/o2w=
go.unistack.org/micro-server-http/v4 v4.0.9/go.mod h1:Cu4utVz2u98fychmjA2Ls6clXrja0sqH6Xu/JTamf7Y=
go.unistack.org/micro/v3 v3.10.14/go.mod h1:uMAc0U/x7dmtICCrblGf0ZLgYegu3VwQAquu+OFCw1Q=
go.unistack.org/micro/v3 v3.10.18 h1:iz193N8eZKGrKPXuX6XMsGIRHMqdvUaZSfb9mzwlUYM=
go.unistack.org/micro/v3 v3.10.18/go.mod h1:uMAc0U/x7dmtICCrblGf0ZLgYegu3VwQAquu+OFCw1Q=
go.unistack.org/micro/v4 v4.0.6 h1:YFWvTh3VwyOd6NHYTQcf47n2TF5+p/EhpnbuBQX3qhk=
go.unistack.org/micro/v4 v4.0.6/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk=
go.unistack.org/protoc-gen-go-micro/v4 v4.0.6 h1:qe6huziuXqRnsgvDSiaT1DR20iL676w37PMkdBEjvEk=
@ -1534,7 +1510,6 @@ google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0/go.mod h1:ob2IJxKr
google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU=
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
@ -1565,7 +1540,6 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag=
google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
@ -1580,7 +1554,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
@ -1614,12 +1587,9 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg=
@ -1720,5 +1690,3 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=

View File

@ -12,6 +12,12 @@ const (
notFound = `Source Not Found`
)
const (
internalErrorCode = "1"
badRequestCode = "2"
notFoundErrorCode = "3"
)
type UnmarshalError struct {
err error
}

View File

@ -4,10 +4,8 @@ import (
"context"
"database/sql"
"errors"
cmsstorage "go.unistack.org/cms-service/storage"
httpsrv "go.unistack.org/micro-server-http/v4"
"go.unistack.org/micro/v4"
"go.unistack.org/unistack-org/pkgdash/config"
pb "go.unistack.org/unistack-org/pkgdash/proto"
cligit "go.unistack.org/unistack-org/pkgdash/service/client_git"
"go.unistack.org/unistack-org/pkgdash/storage"
@ -20,7 +18,6 @@ type Handler struct {
svc micro.Service
store storage.Storage
writer writer
protojson.MarshalOptions
protojson.UnmarshalOptions
@ -143,20 +140,15 @@ func NewHandler(svc micro.Service, client cligit.Client) *Handler {
return h
}
// TODO add conn db
func (h *Handler) Init(ctx context.Context) error {
store := cmsstorage.InterfaceFromContext(h.svc.Options().Context)
if store == nil {
return cmsstorage.ErrMissingStorage
}
st, ok := store.(storage.Storage)
if !ok {
return errors.New(config.ServiceName, "error init storage", 1)
store, err := storage.FromContext(h.svc.Options().Context)
if err != nil {
return errors.New("missing storage")
}
h.chanUrl = h.git.Run(ctx, st)
h.chanUrl = h.git.Run(ctx, store)
h.store = st
h.store = store
return nil
}

View File

@ -1,34 +0,0 @@
package handler
import (
"context"
"errors"
"net/http"
pb "go.unistack.org/unistack-org/pkgdash/proto"
)
const (
internalErrorCode = "1"
badRequestCode = "2"
notFoundErrorCode = "3"
)
func mapError(ctx context.Context, err error) (result *pb.Error, status int) {
status = http.StatusBadRequest
switch errors.Unwrap(err).(type) {
case *UnmarshalError:
result = &pb.Error{Code: badRequestCode, Title: "Bad request"}
case *ParametersMissingError:
result = &pb.Error{Code: badRequestCode, Title: "Required parameters are missing"}
case *NotFoundError:
result = &pb.Error{Code: notFoundErrorCode, Title: "Not found"}
status = http.StatusNotFound
default:
status = http.StatusInternalServerError
result = &pb.Error{Code: internalErrorCode, Title: "Internal error", Details: err.Error()}
}
return
}

View File

@ -1,21 +0,0 @@
package handler
import "net/http"
func Methods(m string, next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
if req.Method != m {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
}
switch req.Method {
case http.MethodPost:
w.WriteHeader(http.StatusCreated)
case http.MethodPut:
w.WriteHeader(http.StatusNoContent)
}
next.ServeHTTP(w, req)
}
}

View File

@ -1,77 +0,0 @@
package handler
import (
"context"
"net/http"
"github.com/pkg/errors"
"go.unistack.org/micro/v4/logger"
pb "go.unistack.org/unistack-org/pkgdash/proto"
)
type encoder interface {
Success(rw http.ResponseWriter, response interface{}) error
Error(rw http.ResponseWriter, err *pb.Error, status int) error
}
type writer interface {
Response(ctx context.Context, rw http.ResponseWriter, value interface{})
}
// nolint
type stackTracer interface {
StackTrace() errors.StackTrace
}
type Writer struct {
encoder encoder
}
func NewWriter(encoder encoder) (*Writer, error) {
if encoder == nil {
return nil, errors.New("empty encoder")
}
return &Writer{encoder: encoder}, nil
}
func (w *Writer) Response(ctx context.Context, rw http.ResponseWriter, value interface{}) {
var err error
if v, ok := value.(error); ok {
err = w.error(ctx, rw, v)
} else {
err = w.success(rw, value)
}
if err != nil {
logger.Error(ctx, "Response writing error: ", err)
}
}
func (w *Writer) error(ctx context.Context, rw http.ResponseWriter, err error) error {
e, status := mapError(ctx, err)
/*
switch {
case status >= http.StatusInternalServerError:
logger.Errorf(ctx, "error: %s, code: %s, http status: %d, uuid: %s", err, e.Code, status, e.Uuid)
if err, ok := err.(stackTracer); ok {
logger.Errorf(ctx, "error stacktrace: %+v, uuid: %s", err.StackTrace(), e.Uuid)
}
default:
logger.Infof(ctx, "error: %s, code: %s, http status: %d, uuid: %s", err, e.Code, status, e.Uuid)
if err, ok := err.(stackTracer); ok {
logger.Infof(ctx, "error stacktrace: %+v, uuid: %s", err.StackTrace(), e.Uuid)
}
}
*/
return w.encoder.Error(rw, e, status)
}
func (w *Writer) success(rw http.ResponseWriter, value interface{}) error {
return w.encoder.Success(rw, value)
}

View File

@ -72,7 +72,7 @@ func (c *client) Done() <-chan struct{} {
}
func runner(ctx context.Context, st storage.Storage, req *pb.AddPackageReq) {
modules, err := getGoModule(ctx, req.Url.Value)
modules, err := getGoModule(ctx, req.Url)
if err != nil {
logger.Error(ctx, err)
return

View File

@ -3,12 +3,12 @@ package client_git
import (
"context"
"database/sql"
"embed"
"fmt"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"go.unistack.org/unistack-org/pkgdash/storage"
"go.unistack.org/unistack-org/pkgdash/storage/postgres"
"go.unistack.org/unistack-org/pkgdash/storage/sqlite"
"google.golang.org/protobuf/types/known/wrapperspb"
"testing"
)
@ -23,11 +23,8 @@ func TestClientPG(t *testing.T) {
t.Fatal(err)
}
st, err := postgres.NewStorage(conn)
if err != nil {
t.Fatal(err)
}
fucntion := postgres.NewStorage()
st := fucntion(conn, embed.FS{})
s, ok := st.(storage.Storage)
if !ok {
t.Fatal("typecast error")
@ -40,8 +37,8 @@ func TestClientPG(t *testing.T) {
ch := cli.Run(ctx, s)
data := &pb.AddPackageReq{
Name: wrapperspb.String("test"),
Url: wrapperspb.String("https://github.com/dantedenis/service_history.git"),
Name: "test",
Url: "https://github.com/dantedenis/service_history.git",
}
ch <- data
@ -59,11 +56,8 @@ func TestClientLite(t *testing.T) {
t.Fatal(err)
}
st, err := sqlite.NewStorage(conn)
if err != nil {
t.Fatal(err)
}
function := sqlite.NewStorage()
st := function(conn, embed.FS{})
s, ok := st.(storage.Storage)
if !ok {
t.Fatal("typecast error")
@ -76,8 +70,8 @@ func TestClientLite(t *testing.T) {
ch := cli.Run(ctx, s)
data := &pb.AddPackageReq{
Name: wrapperspb.String("test"),
Url: wrapperspb.String("https://github.com/dantedenis/service_history.git"),
Name: "test",
Url: "https://github.com/dantedenis/service_history.git",
}
ch <- data

View File

@ -1,9 +0,0 @@
package service
import (
service "go.unistack.org/cms-service"
)
func init() {
service.RegisterService("pkgdash", NewService)
}

View File

@ -2,8 +2,8 @@ package service
import (
"context"
cmsstorage "go.unistack.org/cms-service/storage" // TODO
httpsrv "go.unistack.org/micro-server-http/v3"
"database/sql"
httpsrv "go.unistack.org/micro-server-http/v4"
"go.unistack.org/micro/v4"
"go.unistack.org/micro/v4/config"
microcfg "go.unistack.org/micro/v4/config"
@ -16,6 +16,8 @@ import (
pb "go.unistack.org/unistack-org/pkgdash/proto"
"go.unistack.org/unistack-org/pkgdash/service/client_git"
"go.unistack.org/unistack-org/pkgdash/storage"
"net/url"
"strings"
)
func NewService(ctx context.Context) (micro.Service, error) {
@ -72,45 +74,60 @@ func NewService(ctx context.Context) (micro.Service, error) {
)
return svc.Init(micro.Logger(log))
}),
micro.BeforeStart(func(_ context.Context) error { // TODO
micro.BeforeStart(func(ctx context.Context) error {
var connstr string
if v, ok := cfg.StorageDSN[cfg.App.Name]; ok {
connstr = v
} else if v, ok = cfg.StorageDSN["all"]; ok {
connstr = v
}
scheme, dsn, err := cmsstorage.StorageOptions(connstr)
scheme, dsn, err := storageOptions(connstr)
if err != nil {
return err
}
db, dbok := cmsstorage.FromContext(svc.Options().Context)
if !dbok {
db, err = cmsstorage.NewStorage(scheme, dsn)
if err != nil {
return err
}
}
store, err := storage.NewStorage(scheme, db)
conn, err := connectDataBase(scheme, dsn)
if err != nil {
return err
}
return svc.Init(micro.Context(cmsstorage.InterfaceNewContext(svc.Options().Context, store)))
store, err := storage.NewStorage(scheme, conn)
if err != nil {
return err
}
ctx = storage.InContext(ctx, store)
return svc.Init(micro.Context(ctx))
}),
); err != nil {
return nil, err
}
//mux := http.NewServeMux()
//mux.HandleFunc("/listPackage", handler.Methods(http.MethodGet, h.ListPackage))
//mux.HandleFunc("/updatePackage", handler.Methods(http.MethodPost, h.UpdatePackage))
//mux.HandleFunc("/addComment", handler.Methods(http.MethodPut, h.AddComment))
//mux.HandleFunc("/addPackage", handler.Methods(http.MethodPost, h.AddPackage))
//mux.HandleFunc("/getModule", handler.Methods(http.MethodGet, h.GetModule))
if err := pb.RegisterPkgdashServiceServer(mgsrv, h); err != nil {
logger.Fatalf(ctx, "failed to register handler: %v", err)
}
return svc, nil
}
func storageOptions(dsn string) (string, string, error) {
u, err := url.Parse(dsn)
if err != nil {
return "", "", err
}
scheme := u.Scheme
if idx := strings.Index(u.Scheme, "+"); idx > 0 {
scheme = u.Scheme[:idx]
u.Scheme = u.Scheme[idx+1:]
}
return scheme, u.String(), nil
}
func connectDataBase(driverName, dsn string) (*sql.DB, error) {
conn, err := sql.Open(driverName, dsn)
if err != nil {
return nil, err
}
if err = conn.Ping(); err != nil {
return nil, err
}
return conn, err
}

View File

@ -27,13 +27,9 @@ type Postgres struct {
fs embed.FS
}
func NewStorage(db *sql.DB) (interface{}, error) {
return &Postgres{db: db}, nil
}
func NewStorageFS(fs embed.FS) func(*sql.DB) (interface{}, error) {
return func(db *sql.DB) (interface{}, error) {
return &Postgres{db: db, fs: fs}, nil
func NewStorage() func(*sql.DB, embed.FS) interface{} {
return func(db *sql.DB, fs embed.FS) interface{} {
return &Postgres{db: db, fs: fs}
}
}

View File

@ -28,13 +28,9 @@ type Sqlite struct {
fs embed.FS
}
func NewStorage(db *sql.DB) (interface{}, error) {
return &Sqlite{db: db}, nil
}
func NewStorageFS(fs embed.FS) func(*sql.DB) (interface{}, error) {
return func(db *sql.DB) (interface{}, error) {
return &Sqlite{db: db, fs: fs}, nil
func NewStorage() func(*sql.DB, embed.FS) interface{} {
return func(db *sql.DB, fs embed.FS) interface{} {
return &Sqlite{db: db, fs: fs}
}
}
@ -142,7 +138,7 @@ func (s *Sqlite) AddComment(ctx context.Context, req *pb.AddCommentReq) (id uint
if err = tx.QueryRowContext(ctx, queryAddComment, req.Text, req.IdPackage).Scan(&id); err != nil {
return id, err
}
return id, err
}

View File

@ -4,8 +4,8 @@ import (
"context"
"database/sql"
"embed"
"errors"
cmsstorage "go.unistack.org/cms-service/storage"
"go.unistack.org/unistack-org/pkgdash/models"
pb "go.unistack.org/unistack-org/pkgdash/proto"
"go.unistack.org/unistack-org/pkgdash/storage/postgres"
@ -15,15 +15,26 @@ import (
//go:embed migrations
var fs embed.FS
var storages = cmsstorage.NewStorageInterface()
var (
storages = map[string]func(*sql.DB, embed.FS) interface{}{
"postgres": postgres.NewStorage(),
"sqlite": sqlite.NewStorage(),
}
)
func init() {
storages.RegisterStorage("postgres", postgres.NewStorageFS(fs))
storages.RegisterStorage("sqlite", sqlite.NewStorageFS(fs))
type contextKey string
var (
storeIdent = contextKey("store")
)
type Migrate interface {
MigrateUp() error
MigrateDown() error
}
type Storage interface {
cmsstorage.Migrator
Migrate
ListPackage(ctx context.Context) (models.ListPackage, error)
UpdatePackage(ctx context.Context, req *pb.UpdatePackageReq) error
@ -33,6 +44,27 @@ type Storage interface {
GetModule(ctx context.Context, req *pb.GetModuleReq) (models.ListModule, error)
}
func NewStorage(name string, db *sql.DB) (interface{}, error) {
return storages.NewStorage(name, db)
func NewStorage(name string, db *sql.DB) (Storage, error) {
function, ok := storages[name]
if !ok {
return nil, errors.New("incorrect name store")
}
store := function(db, fs)
database, ok := store.(Storage)
if !ok {
return nil, errors.New("dont implements interface Storage")
}
return database, nil
}
func InContext(ctx context.Context, val Storage) context.Context {
return context.WithValue(ctx, storeIdent, val)
}
func FromContext(ctx context.Context) (Storage, error) {
if store, ok := ctx.Value(storeIdent).(Storage); !ok {
return nil, errors.New("empty store")
} else {
return store, nil
}
}

View File

@ -19,18 +19,16 @@ func TestGetModule(t *testing.T) {
t.Fatal(err)
}
st, err := sqlite.NewStorage(conn)
if err != nil {
t.Fatal(err)
}
st := sqlite.NewStorage()
store := st(conn, fs)
s, ok := st.(Storage)
s, ok := store.(Storage)
if !ok {
t.Fatal("typecast error")
t.Fatal("dont implements interface Storage")
}
req := &pb.GetModuleReq{
Id: []uint64{1, 2, 5, 40},
Id: []uint64{1, 2, 3},
}
module, err := s.GetModule(context.Background(), req)