diff --git a/.gitignore b/.gitignore index f0492cc..f85c28a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.secret .env +*.ini # System files .DS_Store diff --git a/api/proto/misc.pb.go b/api/proto/misc.pb.go index c0f3890..b761f02 100644 --- a/api/proto/misc.pb.go +++ b/api/proto/misc.pb.go @@ -175,17 +175,17 @@ type Auth struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"type" + // @inject_tag: json:"type" Type AuthType `protobuf:"varint,1,opt,name=Type,proto3,enum=api.AuthType" json:"type"` - // @inject_tag: json:"username" + // @inject_tag: json:"username" Username string `protobuf:"bytes,2,opt,name=Username,proto3" json:"username"` - // @inject_tag: json:"password" + // @inject_tag: json:"password" Password string `protobuf:"bytes,3,opt,name=Password,proto3" json:"password"` - // @inject_tag: json:"access_id" + // @inject_tag: json:"access_id" AccessID string `protobuf:"bytes,4,opt,name=AccessID,proto3" json:"access_id"` - // @inject_tag: json:"secret_key" + // @inject_tag: json:"secret_key" SecretKey string `protobuf:"bytes,5,opt,name=SecretKey,proto3" json:"secret_key"` - // @inject_tag: json:"nobitex_token" + // @inject_tag: json:"nobitex_token" NobitexToken string `protobuf:"bytes,6,opt,name=NobitexToken,proto3" json:"nobitex_token"` } diff --git a/deploy/docker-compose.local.yml b/deploy/docker-compose.local.yml index 9b29642..27e3ddb 100644 --- a/deploy/docker-compose.local.yml +++ b/deploy/docker-compose.local.yml @@ -12,7 +12,7 @@ services: limits: cpus: '0.2' memory: '250m' - image: postgres + image: postgres:15 environment: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} volumes: @@ -174,27 +174,27 @@ services: # - postgres restart: always - telegram_bot: - container_name: telegramBot - deploy: - resources: - limits: - cpus: '0.02' - memory: '50m' - image: telegram_bot:${TELEGRAM_BOT_VERSION} - build: - context: .. - dockerfile: services/telegramBot/deploy/Dockerfile - args: - VERSION: ${TELEGRAM_BOT_VERSION} - volumes: - - /srv/configs/telegramBot/app.yaml:/app/configs/config.yaml - networks: - - gate -# depends_on: -# - postgres -# - redis - restart: always +# telegram_bot: +# container_name: telegramBot +# deploy: +# resources: +# limits: +# cpus: '0.02' +# memory: '50m' +# image: telegram_bot:${TELEGRAM_BOT_VERSION} +# build: +# context: .. +# dockerfile: services/telegramBot/deploy/Dockerfile +# args: +# VERSION: ${TELEGRAM_BOT_VERSION} +# volumes: +# - /srv/configs/telegramBot/app.yaml:/app/configs/config.yaml +# networks: +# - gate +## depends_on: +## - postgres +## - redis +# restart: always volumes: postgres_gate_data: diff --git a/go.mod b/go.mod index 901ff77..241e2c4 100644 --- a/go.mod +++ b/go.mod @@ -1,84 +1,105 @@ module github.com/h-varmazyar/Gate -go 1.18 +go 1.22.5 require ( - github.com/caarlos0/env/v6 v6.9.3 + github.com/caarlos0/env/v6 v6.10.1 + github.com/gin-gonic/gin v1.10.0 github.com/go-redis/redis/v8 v8.11.5 github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 - github.com/golang/protobuf v1.5.2 - github.com/google/uuid v1.3.0 - github.com/gorilla/mux v1.8.0 + github.com/golang/protobuf v1.5.4 + github.com/google/martian v2.1.0+incompatible + github.com/google/uuid v1.6.0 + github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/h-varmazyar/gopack v0.0.0-20220610164634-ed526fc19938 - github.com/joho/godotenv v1.4.0 - github.com/lib/pq v1.10.2 - github.com/rs/cors v1.8.2 - github.com/sirupsen/logrus v1.8.1 - github.com/spf13/viper v1.15.0 - github.com/streadway/amqp v1.0.0 - github.com/swaggo/http-swagger/v2 v2.0.1 - github.com/swaggo/swag v1.16.1 - golang.ngrok.com/ngrok v1.3.1 - google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef - google.golang.org/grpc v1.52.0 - google.golang.org/protobuf v1.28.1 - gorm.io/driver/mysql v1.3.5 - gorm.io/driver/postgres v1.3.7 - gorm.io/gorm v1.23.8 + github.com/h-varmazyar/gopack v0.0.0-20240530064019-5c10758f4ae9 + github.com/joho/godotenv v1.5.1 + github.com/lib/pq v1.10.9 + github.com/rs/cors v1.11.0 + github.com/sirupsen/logrus v1.9.3 + github.com/spf13/viper v1.19.0 + github.com/streadway/amqp v1.1.0 + github.com/swaggo/http-swagger/v2 v2.0.2 + github.com/swaggo/swag v1.16.3 + go.uber.org/fx v1.22.1 + golang.ngrok.com/ngrok v1.10.0 + golang.org/x/net v0.27.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf + google.golang.org/grpc v1.65.0 + google.golang.org/protobuf v1.34.2 + gorm.io/driver/mysql v1.5.7 + gorm.io/driver/postgres v1.5.9 + gorm.io/gorm v1.25.11 ) require ( github.com/KyleBanks/depth v1.2.1 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/spec v0.20.9 // indirect - github.com/go-openapi/swag v0.22.4 // indirect - github.com/go-playground/locales v0.14.0 // indirect - github.com/go-playground/universal-translator v0.18.0 // indirect - github.com/go-playground/validator/v10 v10.11.0 // indirect - github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.20.0 // indirect + github.com/go-openapi/spec v0.20.6 // indirect + github.com/go-openapi/swag v0.19.15 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/go-stack/stack v1.8.1 // indirect - github.com/gofrs/uuid v4.2.0+incompatible // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/log15 v3.0.0-testing.3+incompatible // indirect github.com/inconshreveable/log15/v3 v3.0.0-testing.5 // indirect - github.com/jackc/chunkreader/v2 v2.0.1 // indirect - github.com/jackc/pgconn v1.12.1 // indirect - github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgproto3/v2 v2.3.0 // indirect - github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect - github.com/jackc/pgtype v1.11.0 // indirect - github.com/jackc/pgx/v4 v4.16.1 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgx/v5 v5.5.5 // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect - github.com/leodido/go-urn v1.2.1 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect github.com/magiconair/properties v1.8.7 // indirect - github.com/mailru/easyjson v0.7.7 // indirect + github.com/mailru/easyjson v0.7.6 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect - github.com/spf13/afero v1.9.3 // indirect - github.com/spf13/cast v1.5.0 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.4.2 // indirect + github.com/subosito/gotenv v1.6.0 // indirect github.com/swaggo/files/v2 v2.0.0 // indirect - go.uber.org/multierr v1.10.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + go.uber.org/dig v1.17.1 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.26.0 // indirect golang.ngrok.com/muxado/v2 v2.0.0 // indirect - golang.org/x/crypto v0.10.0 // indirect - golang.org/x/net v0.11.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/term v0.9.0 // indirect - golang.org/x/text v0.10.0 // indirect - golang.org/x/tools v0.10.0 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/crypto v0.25.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/term v0.22.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 8666365..d8c5a1c 100644 --- a/go.sum +++ b/go.sum @@ -1,750 +1,333 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= -github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= -github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/caarlos0/env/v6 v6.9.3 h1:Tyg69hoVXDnpO5Qvpsu8EoquarbPyQb+YwExWHP8wWU= -github.com/caarlos0/env/v6 v6.9.3/go.mod h1:hvp/ryKXKipEkcuYjs9mI4bBCg+UI0Yhgm5Zu0ddvwc= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/caarlos0/env/v6 v6.10.1 h1:t1mPSxNpei6M5yAeu1qtRdPAK29Nbcf/n3G7x+b3/II= +github.com/caarlos0/env/v6 v6.10.1/go.mod h1:hvp/ryKXKipEkcuYjs9mI4bBCg+UI0Yhgm5Zu0ddvwc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= -github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= +github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/spec v0.20.9 h1:xnlYNQAwKd2VQRRfwTEI0DcK+2cbuvI/0c7jx3gA8/8= -github.com/go-openapi/spec v0.20.9/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/spec v0.20.6 h1:ich1RQ3WDbfoeTqTAb+5EIxNmpKVJZWBNah9RAT0jIQ= +github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= -github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.11.0 h1:0W+xRM511GY47Yy3bZUbJVitCNg2BOGlCyvTqsp/xIw= -github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= -github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGiUaOtXxdrINDz1b0J1w0SzqDc= github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8= -github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0= -github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +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/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +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/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/h-varmazyar/gopack v0.0.0-20220610164634-ed526fc19938 h1:Sm95syFrltI+jiTvdIAudWKGB541fkhXOlhYBVGaja4= -github.com/h-varmazyar/gopack v0.0.0-20220610164634-ed526fc19938/go.mod h1:+2m8bpXaxtSbTryH69He6JXsnBzuuIKO2hRGiOWFA8o= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/h-varmazyar/gopack v0.0.0-20240530064019-5c10758f4ae9 h1:iE1Q8J/9tj2c95P+Mz9UCCHSShM0fztADXtzwTipBEI= +github.com/h-varmazyar/gopack v0.0.0-20240530064019-5c10758f4ae9/go.mod h1:4CAX/R6srmGGCEi3BjJbvzTcj8k7mgLigy6hMK0frpk= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/inconshreveable/log15 v3.0.0-testing.3+incompatible h1:zaX5fYT98jX5j4UhO/WbfY8T1HkgVrydiDMC9PWqGCo= github.com/inconshreveable/log15 v3.0.0-testing.3+incompatible/go.mod h1:cOaXtrgN4ScfRrD9Bre7U1thNq5RtJ8ZoP4iXVGRj6o= github.com/inconshreveable/log15/v3 v3.0.0-testing.5 h1:h4e0f3kjgg+RJBlKOabrohjHe47D3bbAB9BgMrc3DYA= github.com/inconshreveable/log15/v3 v3.0.0-testing.5/go.mod h1:3GQg1SVrLoWGfRv/kAZMsdyU5cp8eFc1P3cw+Wwku94= -github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= -github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= -github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= -github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= -github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= -github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= -github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= -github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.12.1 h1:rsDFzIpRk7xT4B8FufgpCCeyjdNpKyghZeSefViE5W8= -github.com/jackc/pgconn v1.12.1/go.mod h1:ZkhRC59Llhrq3oSfrikvwQ5NaxYExr6twkdkMLaKono= -github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= -github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= -github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= -github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.3.0 h1:brH0pCGBDkBW07HWlN/oSBXrmo3WB0UvZd1pIuDcL8Y= -github.com/jackc/pgproto3/v2 v2.3.0/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= -github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= -github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= -github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.11.0 h1:u4uiGPz/1hryuXzyaBhSk6dnIyyG2683olG2OV+UUgs= -github.com/jackc/pgtype v1.11.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= -github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= -github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= -github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= -github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.16.1 h1:JzTglcal01DrghUqt+PmzWsZx/Yh7SC/CTQmSBMTd0Y= -github.com/jackc/pgx/v4 v4.16.1/go.mod h1:SIhx0D5hoADaiXZVyv+3gSm3LCIIINTVO0PficsvWGQ= -github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.5.5 h1:amBjrZVmksIdNjxGW/IiIMzxMKZFelXbUoPNb+8sjQw= +github.com/jackc/pgx/v5 v5.5.5/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= -github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= -github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= -github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= -github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= -github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= -github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= -github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= +github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +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/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= -github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= -github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo= -github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= +github.com/streadway/amqp v1.1.0 h1:py12iX8XSyI7aN/3dUT8DFIDJazNJsVJdxNVEpnQTZM= +github.com/streadway/amqp v1.1.0/go.mod h1:WYSrTEYHOXHd0nwFeUXAe2G2hRnQT+deZJJf88uS9Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/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.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.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/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= -github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +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/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/swaggo/files/v2 v2.0.0 h1:hmAt8Dkynw7Ssz46F6pn8ok6YmGZqHSVLZ+HQM7i0kw= github.com/swaggo/files/v2 v2.0.0/go.mod h1:24kk2Y9NYEJ5lHuCra6iVwkMjIekMCaFq/0JQj66kyM= -github.com/swaggo/http-swagger/v2 v2.0.1 h1:mNOBLxDjSNwCKlMxcErjjvct/xhc9t2KIO48xzz/V/k= -github.com/swaggo/http-swagger/v2 v2.0.1/go.mod h1:XYhrQVIKz13CxuKD4p4kvpaRB4jJ1/MlfQXVOE+CX8Y= -github.com/swaggo/swag v1.16.1 h1:fTNRhKstPKxcnoKsytm4sahr8FaYzUcT7i1/3nd/fBg= -github.com/swaggo/swag v1.16.1/go.mod h1:9/LMvHycG3NFHfR6LwvikHv5iFvmPADQ359cKikGxto= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= -go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +github.com/swaggo/http-swagger/v2 v2.0.2 h1:FKCdLsl+sFCx60KFsyM0rDarwiUSZ8DqbfSyIKC9OBg= +github.com/swaggo/http-swagger/v2 v2.0.2/go.mod h1:r7/GBkAWIfK6E/OLnE8fXnviHiDeAHmgIyooa4xm3AQ= +github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= +github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= +go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.22.1 h1:nvvln7mwyT5s1q201YE29V/BFrGor6vMiDNpU/78Mys= +go.uber.org/fx v1.22.1/go.mod h1:HT2M7d7RHo+ebKGh9NRcrsrHHfpZ60nW3QRubMRfv48= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.ngrok.com/muxado/v2 v2.0.0 h1:bu9eIDhRdYNtIXNnqat/HyMeHYOAbUH55ebD7gTvW6c= golang.ngrok.com/muxado/v2 v2.0.0/go.mod h1:wzxJYX4xiAtmwumzL+QsukVwFRXmPNv86vB8RPpOxyM= -golang.ngrok.com/ngrok v1.3.1 h1:ZTr4ijIJXY6+b9Zaq/Hd3azpNGMPJ1dplhpCkLhkc6w= -golang.ngrok.com/ngrok v1.3.1/go.mod h1:8a8GVoqR305t0O51ld211Xq2UeKgm32o8px24ddvXZI= +golang.ngrok.com/ngrok v1.10.0 h1:Pr7WK8/oDRO1jb/qoGsL3EgqrkOzoQ8vGLYhANoMf+M= +golang.ngrok.com/ngrok v1.10.0/go.mod h1:DrWT2BcTdcnHMsP/bHEIP/Ebs0pN5VVYDpbZ3bWrwY4= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/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-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= -golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= +golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +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-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= -golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= -golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef h1:uQ2vjV/sHTsWSqdKeLqmwitzgvjMl7o4IdtHwUDXSJY= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= +google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= +google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= +google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf h1:liao9UHurZLtiEwBgT9LMOnKYsHze6eA6w1KQCMVN2Q= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +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/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/mysql v1.3.5 h1:iWBTVW/8Ij5AG4e0G/zqzaJblYkBI1VIL1LG2HUGsvY= -gorm.io/driver/mysql v1.3.5/go.mod h1:sSIebwZAVPiT+27jK9HIwvsqOGKx3YMPmrA3mBJR10c= -gorm.io/driver/postgres v1.3.7 h1:FKF6sIMDHDEvvMF/XJvbnCl0nu6KSKUaPXevJ4r+VYQ= -gorm.io/driver/postgres v1.3.7/go.mod h1:f02ympjIcgtHEGFMZvdgTxODZ9snAHDb4hXfigBVuNI= -gorm.io/gorm v1.23.4/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= -gorm.io/gorm v1.23.8 h1:h8sGJ+biDgBA1AD1Ha9gFCx7h8npU7AsLdlkX0n2TpE= -gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo= +gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= +gorm.io/driver/postgres v1.5.9 h1:DkegyItji119OlcaLjqN11kHoUgZ/j13E0jkJZgD6A8= +gorm.io/driver/postgres v1.5.9/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkweRGI= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg= +gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/pkg/grpcext/connection.go b/pkg/grpcext/connection.go index 9fcaf34..261137f 100644 --- a/pkg/grpcext/connection.go +++ b/pkg/grpcext/connection.go @@ -30,7 +30,7 @@ func (c *Connection) conn() (*grpc.ClientConn, error) { if c.clientConn != nil && c.clientConn.GetState() == connectivity.Ready { return c.clientConn, nil } - conn, err := grpc.Dial(c.target, grpc.WithInsecure()) + conn, err := grpc.NewClient(c.target, grpc.WithInsecure()) if err != nil { return nil, err } diff --git a/services/chipmunk/api/proto/indicator.go b/services/chipmunk/api/proto/indicator.go index c7e9a55..1653e3b 100644 --- a/services/chipmunk/api/proto/indicator.go +++ b/services/chipmunk/api/proto/indicator.go @@ -1,148 +1,149 @@ package proto -import ( - "database/sql/driver" - "encoding/json" -) - -func (IndicatorType) InRange(v interface{}) bool { - i, ok := IndicatorType_value[v.(IndicatorType).String()] - return ok && i > 0 -} -func (d *IndicatorType) Scan(value interface{}) error { - *d = IndicatorType(IndicatorType_value[value.(string)]) - return nil -} -func (d IndicatorType) Value() (driver.Value, error) { - return d.String(), nil -} -func (d *IndicatorType) UnmarshalJSON(b []byte) error { - var str string - if err := json.Unmarshal(b, &str); err != nil { - return err - } - *d = IndicatorType(IndicatorType_value[str]) - return nil -} -func (d IndicatorType) MarshalJSON() ([]byte, error) { - return json.Marshal(d.String()) -} - -//******************************************************** -func (Source) InRange(v interface{}) bool { - i, ok := Source_value[v.(Source).String()] - return ok && i > 0 -} -func (d *Source) Scan(value interface{}) error { - *d = Source(Source_value[value.(string)]) - return nil -} -func (d Source) Value() (driver.Value, error) { - return d.String(), nil -} -func (d *Source) UnmarshalJSON(b []byte) error { - var str string - if err := json.Unmarshal(b, &str); err != nil { - return err - } - *d = Source(Source_value[str]) - return nil -} -func (d Source) MarshalJSON() ([]byte, error) { - return json.Marshal(d.String()) -} - -//******************************************************** -//func ToIndicatorValue(data interface{}) *IndicatorValue { -// switch data.(type) { -// case *repository.RSIValue: -// return ToRSIValue(data.(*repository.RSIValue)) -// case *repository.StochasticValue: -// return ToStochasticValue(data.(*repository.StochasticValue)) -// case *repository.BollingerBandsValue: -// return ToBollingerBandsValue(data.(*repository.BollingerBandsValue)) -// case *repository.MovingAverageValue: -// return ToMovingAverageValue(data.(*repository.MovingAverageValue)) +// +//import ( +// "database/sql/driver" +// "encoding/json" +//) +// +//func (IndicatorType) InRange(v interface{}) bool { +// i, ok := IndicatorType_value[v.(IndicatorType).String()] +// return ok && i > 0 +//} +//func (d *IndicatorType) Scan(value interface{}) error { +// *d = IndicatorType(IndicatorType_value[value.(string)]) +// return nil +//} +//func (d IndicatorType) Value() (driver.Value, error) { +// return d.String(), nil +//} +//func (d *IndicatorType) UnmarshalJSON(b []byte) error { +// var str string +// if err := json.Unmarshal(b, &str); err != nil { +// return err // } +// *d = IndicatorType(IndicatorType_value[str]) // return nil //} +//func (d IndicatorType) MarshalJSON() ([]byte, error) { +// return json.Marshal(d.String()) +//} // -//func ToRSIValue(data *repository.RSIValue) *IndicatorValue { -// return &IndicatorValue{ -// Type: Indicator_RSI, -// Value: &IndicatorValue_RSI{ -// RSI: &RSI{ -// RSI: data.RSI, -// }, -// }, +//// ******************************************************** +//func (Source) InRange(v interface{}) bool { +// i, ok := Source_value[v.(Source).String()] +// return ok && i > 0 +//} +//func (d *Source) Scan(value interface{}) error { +// *d = Source(Source_value[value.(string)]) +// return nil +//} +//func (d Source) Value() (driver.Value, error) { +// return d.String(), nil +//} +//func (d *Source) UnmarshalJSON(b []byte) error { +// var str string +// if err := json.Unmarshal(b, &str); err != nil { +// return err // } +// *d = Source(Source_value[str]) +// return nil //} - -func GetRSIValue(data *IndicatorValue) *RSI { - switch t := data.Value.(type) { - case *IndicatorValue_RSI: - return t.RSI - } - return nil -} - -//func ToStochasticValue(data *repository.StochasticValue) *IndicatorValue { -// return &IndicatorValue{ -// Type: Indicator_Stochastic, -// Value: &IndicatorValue_Stochastic{ -// Stochastic: &Stochastic{ -// IndexK: data.IndexK, -// IndexD: data.IndexD, -// }, -// }, +//func (d Source) MarshalJSON() ([]byte, error) { +// return json.Marshal(d.String()) +//} +// +////******************************************************** +////func ToIndicatorValue(data interface{}) *IndicatorValue { +//// switch data.(type) { +//// case *repository.RSIValue: +//// return ToRSIValue(data.(*repository.RSIValue)) +//// case *repository.StochasticValue: +//// return ToStochasticValue(data.(*repository.StochasticValue)) +//// case *repository.BollingerBandsValue: +//// return ToBollingerBandsValue(data.(*repository.BollingerBandsValue)) +//// case *repository.MovingAverageValue: +//// return ToMovingAverageValue(data.(*repository.MovingAverageValue)) +//// } +//// return nil +////} +//// +////func ToRSIValue(data *repository.RSIValue) *IndicatorValue { +//// return &IndicatorValue{ +//// Type: Indicator_RSI, +//// Value: &IndicatorValue_RSI{ +//// RSI: &RSI{ +//// RSI: data.RSI, +//// }, +//// }, +//// } +////} +// +//func GetRSIValue(data *IndicatorValue) *RSI { +// switch t := data.Value.(type) { +// case *IndicatorValue_RSI: +// return t.RSI // } +// return nil //} - -func GetStochasticValue(data *IndicatorValue) *Stochastic { - switch t := data.Value.(type) { - case *IndicatorValue_Stochastic: - return t.Stochastic - } - return nil -} - -//func ToBollingerBandsValue(data *repository.BollingerBandsValue) *IndicatorValue { -// return &IndicatorValue{ -// Type: Indicator_BollingerBands, -// Value: &IndicatorValue_BollingerBands{ -// BollingerBands: &BollingerBands{ -// UpperBand: data.UpperBand, -// LowerBand: data.LowerBand, -// MA: data.MA, -// }, -// }, +// +////func ToStochasticValue(data *repository.StochasticValue) *IndicatorValue { +//// return &IndicatorValue{ +//// Type: Indicator_Stochastic, +//// Value: &IndicatorValue_Stochastic{ +//// Stochastic: &Stochastic{ +//// IndexK: data.IndexK, +//// IndexD: data.IndexD, +//// }, +//// }, +//// } +////} +// +//func GetStochasticValue(data *IndicatorValue) *Stochastic { +// switch t := data.Value.(type) { +// case *IndicatorValue_Stochastic: +// return t.Stochastic // } +// return nil //} - -func GetBollingerBandsValue(data *IndicatorValue) *BollingerBands { - switch t := data.Value.(type) { - case *IndicatorValue_BollingerBands: - return t.BollingerBands - } - return nil -} - -//func ToMovingAverageValue(data *repository.MovingAverageValue) *IndicatorValue { -// return &IndicatorValue{ -// Type: Indicator_MovingAverage, -// Value: &IndicatorValue_MovingAverage{ -// MovingAverage: &MovingAverage{ -// Simple: data.Simple, -// Exponential: data.Exponential, -// }, -// }, +// +////func ToBollingerBandsValue(data *repository.BollingerBandsValue) *IndicatorValue { +//// return &IndicatorValue{ +//// Type: Indicator_BollingerBands, +//// Value: &IndicatorValue_BollingerBands{ +//// BollingerBands: &BollingerBands{ +//// UpperBand: data.UpperBand, +//// LowerBand: data.LowerBand, +//// MA: data.MA, +//// }, +//// }, +//// } +////} +// +//func GetBollingerBandsValue(data *IndicatorValue) *BollingerBands { +// switch t := data.Value.(type) { +// case *IndicatorValue_BollingerBands: +// return t.BollingerBands // } +// return nil +//} +// +////func ToMovingAverageValue(data *repository.MovingAverageValue) *IndicatorValue { +//// return &IndicatorValue{ +//// Type: Indicator_MovingAverage, +//// Value: &IndicatorValue_MovingAverage{ +//// MovingAverage: &MovingAverage{ +//// Simple: data.Simple, +//// Exponential: data.Exponential, +//// }, +//// }, +//// } +////} +// +//func GetMovingAverageValue(data *IndicatorValue) *MovingAverage { +// switch t := data.Value.(type) { +// case *IndicatorValue_MovingAverage: +// return t.MovingAverage +// } +// return nil //} - -func GetMovingAverageValue(data *IndicatorValue) *MovingAverage { - switch t := data.Value.(type) { - case *IndicatorValue_MovingAverage: - return t.MovingAverage - } - return nil -} diff --git a/services/chipmunk/api/proto/indicator.pb.go b/services/chipmunk/api/proto/indicator.pb.go deleted file mode 100644 index 218d077..0000000 --- a/services/chipmunk/api/proto/indicator.pb.go +++ /dev/null @@ -1,1402 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.12.4 -// source: services/chipmunk/api/proto/src/indicator.proto - -package proto - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Source int32 - -const ( - Source_Custom Source = 0 - Source_OHLC4 Source = 1 - Source_Close Source = 2 - Source_Open Source = 3 - Source_High Source = 4 - Source_HLC3 Source = 5 - Source_Low Source = 6 - Source_HL2 Source = 7 -) - -// Enum value maps for Source. -var ( - Source_name = map[int32]string{ - 0: "Custom", - 1: "OHLC4", - 2: "Close", - 3: "Open", - 4: "High", - 5: "HLC3", - 6: "Low", - 7: "HL2", - } - Source_value = map[string]int32{ - "Custom": 0, - "OHLC4": 1, - "Close": 2, - "Open": 3, - "High": 4, - "HLC3": 5, - "Low": 6, - "HL2": 7, - } -) - -func (x Source) Enum() *Source { - p := new(Source) - *p = x - return p -} - -func (x Source) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Source) Descriptor() protoreflect.EnumDescriptor { - return file_services_chipmunk_api_proto_src_indicator_proto_enumTypes[0].Descriptor() -} - -func (Source) Type() protoreflect.EnumType { - return &file_services_chipmunk_api_proto_src_indicator_proto_enumTypes[0] -} - -func (x Source) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Source.Descriptor instead. -func (Source) EnumDescriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{0} -} - -type IndicatorType int32 - -const ( - Indicator_All IndicatorType = 0 - Indicator_RSI IndicatorType = 1 - Indicator_Stochastic IndicatorType = 2 - Indicator_MovingAverage IndicatorType = 3 - Indicator_BollingerBands IndicatorType = 4 -) - -// Enum value maps for IndicatorType. -var ( - IndicatorType_name = map[int32]string{ - 0: "All", - 1: "RSI", - 2: "Stochastic", - 3: "MovingAverage", - 4: "BollingerBands", - } - IndicatorType_value = map[string]int32{ - "All": 0, - "RSI": 1, - "Stochastic": 2, - "MovingAverage": 3, - "BollingerBands": 4, - } -) - -func (x IndicatorType) Enum() *IndicatorType { - p := new(IndicatorType) - *p = x - return p -} - -func (x IndicatorType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (IndicatorType) Descriptor() protoreflect.EnumDescriptor { - return file_services_chipmunk_api_proto_src_indicator_proto_enumTypes[1].Descriptor() -} - -func (IndicatorType) Type() protoreflect.EnumType { - return &file_services_chipmunk_api_proto_src_indicator_proto_enumTypes[1] -} - -func (x IndicatorType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use IndicatorType.Descriptor instead. -func (IndicatorType) EnumDescriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{0, 0} -} - -type Indicator struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"id" - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"id"` - // @inject_tag: json:"name" - Type IndicatorType `protobuf:"varint,2,opt,name=Type,proto3,enum=chipmunkApi.IndicatorType" json:"name"` - // @inject_tag: json:"configs" - Configs *IndicatorConfigs `protobuf:"bytes,3,opt,name=Configs,proto3" json:"configs"` -} - -func (x *Indicator) Reset() { - *x = Indicator{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Indicator) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Indicator) ProtoMessage() {} - -func (x *Indicator) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Indicator.ProtoReflect.Descriptor instead. -func (*Indicator) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{0} -} - -func (x *Indicator) GetID() string { - if x != nil { - return x.ID - } - return "" -} - -func (x *Indicator) GetType() IndicatorType { - if x != nil { - return x.Type - } - return Indicator_All -} - -func (x *Indicator) GetConfigs() *IndicatorConfigs { - if x != nil { - return x.Configs - } - return nil -} - -type IndicatorConfigs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"rsi,omitempty" - RSI *RsiConfigs `protobuf:"bytes,1,opt,name=RSI,proto3" json:"rsi,omitempty"` - // @inject_tag: json:"stochastic,omitempty" - Stochastic *StochasticConfigs `protobuf:"bytes,2,opt,name=Stochastic,proto3" json:"stochastic,omitempty"` - // @inject_tag: json:"moving_average,omitempty" - MovingAverage *MovingAverageConfigs `protobuf:"bytes,3,opt,name=MovingAverage,proto3" json:"moving_average,omitempty"` - // @inject_tag: json:"bollinger_bands,omitempty" - BollingerBands *BollingerBandsConfigs `protobuf:"bytes,4,opt,name=BollingerBands,proto3" json:"bollinger_bands,omitempty"` -} - -func (x *IndicatorConfigs) Reset() { - *x = IndicatorConfigs{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IndicatorConfigs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IndicatorConfigs) ProtoMessage() {} - -func (x *IndicatorConfigs) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IndicatorConfigs.ProtoReflect.Descriptor instead. -func (*IndicatorConfigs) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{1} -} - -func (x *IndicatorConfigs) GetRSI() *RsiConfigs { - if x != nil { - return x.RSI - } - return nil -} - -func (x *IndicatorConfigs) GetStochastic() *StochasticConfigs { - if x != nil { - return x.Stochastic - } - return nil -} - -func (x *IndicatorConfigs) GetMovingAverage() *MovingAverageConfigs { - if x != nil { - return x.MovingAverage - } - return nil -} - -func (x *IndicatorConfigs) GetBollingerBands() *BollingerBandsConfigs { - if x != nil { - return x.BollingerBands - } - return nil -} - -type IndicatorValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"type" - Type IndicatorType `protobuf:"varint,1,opt,name=Type,proto3,enum=chipmunkApi.IndicatorType" json:"type"` - // @inject_tag: json:"value" - // - // Types that are assignable to Value: - // *IndicatorValue_BollingerBands - // *IndicatorValue_MovingAverage - // *IndicatorValue_Stochastic - // *IndicatorValue_RSI - Value isIndicatorValue_Value `protobuf_oneof:"Value" json:"value"` -} - -func (x *IndicatorValue) Reset() { - *x = IndicatorValue{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IndicatorValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IndicatorValue) ProtoMessage() {} - -func (x *IndicatorValue) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IndicatorValue.ProtoReflect.Descriptor instead. -func (*IndicatorValue) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{2} -} - -func (x *IndicatorValue) GetType() IndicatorType { - if x != nil { - return x.Type - } - return Indicator_All -} - -func (m *IndicatorValue) GetValue() isIndicatorValue_Value { - if m != nil { - return m.Value - } - return nil -} - -func (x *IndicatorValue) GetBollingerBands() *BollingerBands { - if x, ok := x.GetValue().(*IndicatorValue_BollingerBands); ok { - return x.BollingerBands - } - return nil -} - -func (x *IndicatorValue) GetMovingAverage() *MovingAverage { - if x, ok := x.GetValue().(*IndicatorValue_MovingAverage); ok { - return x.MovingAverage - } - return nil -} - -func (x *IndicatorValue) GetStochastic() *Stochastic { - if x, ok := x.GetValue().(*IndicatorValue_Stochastic); ok { - return x.Stochastic - } - return nil -} - -func (x *IndicatorValue) GetRSI() *RSI { - if x, ok := x.GetValue().(*IndicatorValue_RSI); ok { - return x.RSI - } - return nil -} - -type isIndicatorValue_Value interface { - isIndicatorValue_Value() -} - -type IndicatorValue_BollingerBands struct { - // @inject_tag: json:"bollinger_band,omitempty" - BollingerBands *BollingerBands `protobuf:"bytes,2,opt,name=BollingerBands,proto3,oneof" json:"bollinger_band,omitempty"` -} - -type IndicatorValue_MovingAverage struct { - // @inject_tag: json:"moving_average,omitempty" - MovingAverage *MovingAverage `protobuf:"bytes,3,opt,name=MovingAverage,proto3,oneof" json:"moving_average,omitempty"` -} - -type IndicatorValue_Stochastic struct { - // @inject_tag: json:"stochastic,omitempty" - Stochastic *Stochastic `protobuf:"bytes,4,opt,name=Stochastic,proto3,oneof" json:"stochastic,omitempty"` -} - -type IndicatorValue_RSI struct { - // @inject_tag: json:"rsi,omitempty" - RSI *RSI `protobuf:"bytes,5,opt,name=RSI,proto3,oneof" json:"rsi,omitempty"` -} - -func (*IndicatorValue_BollingerBands) isIndicatorValue_Value() {} - -func (*IndicatorValue_MovingAverage) isIndicatorValue_Value() {} - -func (*IndicatorValue_Stochastic) isIndicatorValue_Value() {} - -func (*IndicatorValue_RSI) isIndicatorValue_Value() {} - -type BollingerBands struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"upper_band" - UpperBand float64 `protobuf:"fixed64,1,opt,name=UpperBand,proto3" json:"upper_band"` - // @inject_tag: json:"lower_band" - LowerBand float64 `protobuf:"fixed64,2,opt,name=LowerBand,proto3" json:"lower_band"` - // @inject_tag: json:"ma" - MA float64 `protobuf:"fixed64,3,opt,name=MA,proto3" json:"ma"` -} - -func (x *BollingerBands) Reset() { - *x = BollingerBands{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BollingerBands) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BollingerBands) ProtoMessage() {} - -func (x *BollingerBands) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BollingerBands.ProtoReflect.Descriptor instead. -func (*BollingerBands) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{3} -} - -func (x *BollingerBands) GetUpperBand() float64 { - if x != nil { - return x.UpperBand - } - return 0 -} - -func (x *BollingerBands) GetLowerBand() float64 { - if x != nil { - return x.LowerBand - } - return 0 -} - -func (x *BollingerBands) GetMA() float64 { - if x != nil { - return x.MA - } - return 0 -} - -type MovingAverage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"simple" - Simple float64 `protobuf:"fixed64,1,opt,name=Simple,proto3" json:"simple"` - // @inject_tag: json:"exponential" - Exponential float64 `protobuf:"fixed64,2,opt,name=Exponential,proto3" json:"exponential"` -} - -func (x *MovingAverage) Reset() { - *x = MovingAverage{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MovingAverage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MovingAverage) ProtoMessage() {} - -func (x *MovingAverage) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MovingAverage.ProtoReflect.Descriptor instead. -func (*MovingAverage) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{4} -} - -func (x *MovingAverage) GetSimple() float64 { - if x != nil { - return x.Simple - } - return 0 -} - -func (x *MovingAverage) GetExponential() float64 { - if x != nil { - return x.Exponential - } - return 0 -} - -type Stochastic struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"index_k" - IndexK float64 `protobuf:"fixed64,1,opt,name=IndexK,proto3" json:"index_k"` - // @inject_tag: json:"index_d" - IndexD float64 `protobuf:"fixed64,2,opt,name=IndexD,proto3" json:"index_d"` -} - -func (x *Stochastic) Reset() { - *x = Stochastic{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Stochastic) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Stochastic) ProtoMessage() {} - -func (x *Stochastic) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Stochastic.ProtoReflect.Descriptor instead. -func (*Stochastic) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{5} -} - -func (x *Stochastic) GetIndexK() float64 { - if x != nil { - return x.IndexK - } - return 0 -} - -func (x *Stochastic) GetIndexD() float64 { - if x != nil { - return x.IndexD - } - return 0 -} - -type RSI struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"rsi" - RSI float64 `protobuf:"fixed64,1,opt,name=RSI,proto3" json:"rsi"` -} - -func (x *RSI) Reset() { - *x = RSI{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RSI) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RSI) ProtoMessage() {} - -func (x *RSI) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RSI.ProtoReflect.Descriptor instead. -func (*RSI) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{6} -} - -func (x *RSI) GetRSI() float64 { - if x != nil { - return x.RSI - } - return 0 -} - -type IndicatorReturnReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"id" - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"id"` -} - -func (x *IndicatorReturnReq) Reset() { - *x = IndicatorReturnReq{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IndicatorReturnReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IndicatorReturnReq) ProtoMessage() {} - -func (x *IndicatorReturnReq) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IndicatorReturnReq.ProtoReflect.Descriptor instead. -func (*IndicatorReturnReq) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{7} -} - -func (x *IndicatorReturnReq) GetID() string { - if x != nil { - return x.ID - } - return "" -} - -type RsiConfigs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"length" - Length int32 `protobuf:"varint,1,opt,name=Length,proto3" json:"length"` -} - -func (x *RsiConfigs) Reset() { - *x = RsiConfigs{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RsiConfigs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RsiConfigs) ProtoMessage() {} - -func (x *RsiConfigs) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RsiConfigs.ProtoReflect.Descriptor instead. -func (*RsiConfigs) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{8} -} - -func (x *RsiConfigs) GetLength() int32 { - if x != nil { - return x.Length - } - return 0 -} - -type StochasticConfigs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"length" - Length int32 `protobuf:"varint,1,opt,name=Length,proto3" json:"length"` - // @inject_tag: json:"smooth_k" - SmoothK int32 `protobuf:"varint,2,opt,name=SmoothK,proto3" json:"smooth_k"` - // @inject_tag: json:"smooth_d" - SmoothD int32 `protobuf:"varint,3,opt,name=SmoothD,proto3" json:"smooth_d"` -} - -func (x *StochasticConfigs) Reset() { - *x = StochasticConfigs{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StochasticConfigs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StochasticConfigs) ProtoMessage() {} - -func (x *StochasticConfigs) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StochasticConfigs.ProtoReflect.Descriptor instead. -func (*StochasticConfigs) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{9} -} - -func (x *StochasticConfigs) GetLength() int32 { - if x != nil { - return x.Length - } - return 0 -} - -func (x *StochasticConfigs) GetSmoothK() int32 { - if x != nil { - return x.SmoothK - } - return 0 -} - -func (x *StochasticConfigs) GetSmoothD() int32 { - if x != nil { - return x.SmoothD - } - return 0 -} - -type MovingAverageConfigs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"length" - Length int32 `protobuf:"varint,1,opt,name=Length,proto3" json:"length"` - // @inject_tag: json:"source" - Source Source `protobuf:"varint,2,opt,name=Source,proto3,enum=chipmunkApi.Source" json:"source"` -} - -func (x *MovingAverageConfigs) Reset() { - *x = MovingAverageConfigs{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MovingAverageConfigs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MovingAverageConfigs) ProtoMessage() {} - -func (x *MovingAverageConfigs) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MovingAverageConfigs.ProtoReflect.Descriptor instead. -func (*MovingAverageConfigs) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{10} -} - -func (x *MovingAverageConfigs) GetLength() int32 { - if x != nil { - return x.Length - } - return 0 -} - -func (x *MovingAverageConfigs) GetSource() Source { - if x != nil { - return x.Source - } - return Source_Custom -} - -type BollingerBandsConfigs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"length" - Length int32 `protobuf:"varint,1,opt,name=Length,proto3" json:"length"` - // @inject_tag: json:"deviation" - Deviation int32 `protobuf:"varint,2,opt,name=Deviation,proto3" json:"deviation"` - // @inject_tag: json:"source" - Source Source `protobuf:"varint,3,opt,name=Source,proto3,enum=chipmunkApi.Source" json:"source"` -} - -func (x *BollingerBandsConfigs) Reset() { - *x = BollingerBandsConfigs{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BollingerBandsConfigs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BollingerBandsConfigs) ProtoMessage() {} - -func (x *BollingerBandsConfigs) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BollingerBandsConfigs.ProtoReflect.Descriptor instead. -func (*BollingerBandsConfigs) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{11} -} - -func (x *BollingerBandsConfigs) GetLength() int32 { - if x != nil { - return x.Length - } - return 0 -} - -func (x *BollingerBandsConfigs) GetDeviation() int32 { - if x != nil { - return x.Deviation - } - return 0 -} - -func (x *BollingerBandsConfigs) GetSource() Source { - if x != nil { - return x.Source - } - return Source_Custom -} - -type IndicatorListReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"type" - Type IndicatorType `protobuf:"varint,1,opt,name=Type,proto3,enum=chipmunkApi.IndicatorType" json:"type"` -} - -func (x *IndicatorListReq) Reset() { - *x = IndicatorListReq{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IndicatorListReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IndicatorListReq) ProtoMessage() {} - -func (x *IndicatorListReq) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IndicatorListReq.ProtoReflect.Descriptor instead. -func (*IndicatorListReq) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{12} -} - -func (x *IndicatorListReq) GetType() IndicatorType { - if x != nil { - return x.Type - } - return Indicator_All -} - -type Indicators struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // @inject_tag: json:"elements" - Elements []*Indicator `protobuf:"bytes,1,rep,name=Elements,proto3" json:"elements"` -} - -func (x *Indicators) Reset() { - *x = Indicators{} - if protoimpl.UnsafeEnabled { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Indicators) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Indicators) ProtoMessage() {} - -func (x *Indicators) ProtoReflect() protoreflect.Message { - mi := &file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Indicators.ProtoReflect.Descriptor instead. -func (*Indicators) Descriptor() ([]byte, []int) { - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP(), []int{13} -} - -func (x *Indicators) GetElements() []*Indicator { - if x != nil { - return x.Elements - } - return nil -} - -var File_services_chipmunk_api_proto_src_indicator_proto protoreflect.FileDescriptor - -var file_services_chipmunk_api_proto_src_indicator_proto_rawDesc = []byte{ - 0x0a, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x68, 0x69, 0x70, 0x6d, - 0x75, 0x6e, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, - 0x63, 0x2f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0b, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x22, 0xd6, - 0x01, 0x0a, 0x09, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x2f, 0x0a, 0x04, - 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x63, 0x68, 0x69, - 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, - 0x6f, 0x72, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, - 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, - 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x07, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x22, 0x4f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x07, - 0x0a, 0x03, 0x41, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x53, 0x49, 0x10, 0x01, - 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x10, 0x02, - 0x12, 0x11, 0x0a, 0x0d, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, - 0x65, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, - 0x42, 0x61, 0x6e, 0x64, 0x73, 0x10, 0x04, 0x22, 0x92, 0x02, 0x0a, 0x10, 0x49, 0x6e, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x29, 0x0a, 0x03, - 0x52, 0x53, 0x49, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x68, 0x69, 0x70, - 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x52, 0x73, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x73, 0x52, 0x03, 0x52, 0x53, 0x49, 0x12, 0x3e, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x63, 0x68, - 0x61, 0x73, 0x74, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x68, - 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, - 0x73, 0x74, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x0a, 0x53, 0x74, 0x6f, - 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x12, 0x47, 0x0a, 0x0d, 0x4d, 0x6f, 0x76, 0x69, 0x6e, - 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, - 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x4d, 0x6f, 0x76, - 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x73, 0x52, 0x0d, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, - 0x12, 0x4a, 0x0a, 0x0e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, - 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, - 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, - 0x42, 0x61, 0x6e, 0x64, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x0e, 0x42, 0x6f, - 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x22, 0xb6, 0x02, 0x0a, - 0x0e, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x2f, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, - 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x45, 0x0a, 0x0e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, - 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, - 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, - 0x42, 0x61, 0x6e, 0x64, 0x73, 0x48, 0x00, 0x52, 0x0e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, - 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x42, 0x0a, 0x0d, 0x4d, 0x6f, 0x76, 0x69, 0x6e, - 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x4d, 0x6f, 0x76, - 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x4d, 0x6f, - 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, 0x61, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x53, - 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x74, - 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x48, 0x00, 0x52, 0x0a, 0x53, 0x74, 0x6f, 0x63, - 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x12, 0x24, 0x0a, 0x03, 0x52, 0x53, 0x49, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, - 0x69, 0x2e, 0x52, 0x53, 0x49, 0x48, 0x00, 0x52, 0x03, 0x52, 0x53, 0x49, 0x42, 0x07, 0x0a, 0x05, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5c, 0x0a, 0x0e, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, - 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, 0x70, 0x65, 0x72, - 0x42, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x55, 0x70, 0x70, 0x65, - 0x72, 0x42, 0x61, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x4c, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x61, - 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x4c, 0x6f, 0x77, 0x65, 0x72, 0x42, - 0x61, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4d, 0x41, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x02, 0x4d, 0x41, 0x22, 0x49, 0x0a, 0x0d, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, - 0x72, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x45, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x0b, 0x45, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x3c, - 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x12, 0x16, 0x0a, 0x06, - 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x4b, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x44, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x44, 0x22, 0x17, 0x0a, 0x03, - 0x52, 0x53, 0x49, 0x12, 0x10, 0x0a, 0x03, 0x52, 0x53, 0x49, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x03, 0x52, 0x53, 0x49, 0x22, 0x24, 0x0a, 0x12, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, - 0x6f, 0x72, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x22, 0x24, 0x0a, 0x0a, 0x52, - 0x73, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x22, 0x5f, 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x63, 0x68, 0x61, 0x73, 0x74, 0x69, 0x63, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, - 0x0a, 0x07, 0x53, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x4b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x07, 0x53, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x4b, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x6d, 0x6f, 0x6f, - 0x74, 0x68, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x53, 0x6d, 0x6f, 0x6f, 0x74, - 0x68, 0x44, 0x22, 0x5b, 0x0a, 0x14, 0x4d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x41, 0x76, 0x65, 0x72, - 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x12, 0x2b, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, - 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, - 0x7a, 0x0a, 0x15, 0x42, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, - 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x12, 0x1c, 0x0a, 0x09, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x09, 0x44, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, - 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, - 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x53, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x43, 0x0a, 0x10, 0x49, - 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, - 0x2f, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, - 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, - 0x22, 0x40, 0x0a, 0x0a, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x32, - 0x0a, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, - 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x2a, 0x5a, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0a, 0x0a, 0x06, - 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4f, 0x48, 0x4c, 0x43, - 0x34, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10, 0x02, 0x12, 0x08, - 0x0a, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x69, 0x67, 0x68, - 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x4c, 0x43, 0x33, 0x10, 0x05, 0x12, 0x07, 0x0a, 0x03, - 0x4c, 0x6f, 0x77, 0x10, 0x06, 0x12, 0x07, 0x0a, 0x03, 0x48, 0x4c, 0x32, 0x10, 0x07, 0x32, 0x95, - 0x01, 0x0a, 0x10, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x06, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x12, 0x1f, 0x2e, - 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x16, - 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, - 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x3e, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1d, - 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, - 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, - 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x64, 0x69, - 0x63, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, 0x72, 0x6d, 0x61, 0x7a, 0x79, 0x61, 0x72, - 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, - 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_services_chipmunk_api_proto_src_indicator_proto_rawDescOnce sync.Once - file_services_chipmunk_api_proto_src_indicator_proto_rawDescData = file_services_chipmunk_api_proto_src_indicator_proto_rawDesc -) - -func file_services_chipmunk_api_proto_src_indicator_proto_rawDescGZIP() []byte { - file_services_chipmunk_api_proto_src_indicator_proto_rawDescOnce.Do(func() { - file_services_chipmunk_api_proto_src_indicator_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_chipmunk_api_proto_src_indicator_proto_rawDescData) - }) - return file_services_chipmunk_api_proto_src_indicator_proto_rawDescData -} - -var file_services_chipmunk_api_proto_src_indicator_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_services_chipmunk_api_proto_src_indicator_proto_msgTypes = make([]protoimpl.MessageInfo, 14) -var file_services_chipmunk_api_proto_src_indicator_proto_goTypes = []interface{}{ - (Source)(0), // 0: chipmunkApi.Source - (IndicatorType)(0), // 1: chipmunkApi.Indicator.type - (*Indicator)(nil), // 2: chipmunkApi.Indicator - (*IndicatorConfigs)(nil), // 3: chipmunkApi.IndicatorConfigs - (*IndicatorValue)(nil), // 4: chipmunkApi.indicatorValue - (*BollingerBands)(nil), // 5: chipmunkApi.BollingerBands - (*MovingAverage)(nil), // 6: chipmunkApi.MovingAverage - (*Stochastic)(nil), // 7: chipmunkApi.Stochastic - (*RSI)(nil), // 8: chipmunkApi.RSI - (*IndicatorReturnReq)(nil), // 9: chipmunkApi.IndicatorReturnReq - (*RsiConfigs)(nil), // 10: chipmunkApi.RsiConfigs - (*StochasticConfigs)(nil), // 11: chipmunkApi.StochasticConfigs - (*MovingAverageConfigs)(nil), // 12: chipmunkApi.MovingAverageConfigs - (*BollingerBandsConfigs)(nil), // 13: chipmunkApi.BollingerBandsConfigs - (*IndicatorListReq)(nil), // 14: chipmunkApi.IndicatorListReq - (*Indicators)(nil), // 15: chipmunkApi.Indicators -} -var file_services_chipmunk_api_proto_src_indicator_proto_depIdxs = []int32{ - 1, // 0: chipmunkApi.Indicator.Type:type_name -> chipmunkApi.Indicator.type - 3, // 1: chipmunkApi.Indicator.Configs:type_name -> chipmunkApi.IndicatorConfigs - 10, // 2: chipmunkApi.IndicatorConfigs.RSI:type_name -> chipmunkApi.RsiConfigs - 11, // 3: chipmunkApi.IndicatorConfigs.Stochastic:type_name -> chipmunkApi.StochasticConfigs - 12, // 4: chipmunkApi.IndicatorConfigs.MovingAverage:type_name -> chipmunkApi.MovingAverageConfigs - 13, // 5: chipmunkApi.IndicatorConfigs.BollingerBands:type_name -> chipmunkApi.BollingerBandsConfigs - 1, // 6: chipmunkApi.indicatorValue.Type:type_name -> chipmunkApi.Indicator.type - 5, // 7: chipmunkApi.indicatorValue.BollingerBands:type_name -> chipmunkApi.BollingerBands - 6, // 8: chipmunkApi.indicatorValue.MovingAverage:type_name -> chipmunkApi.MovingAverage - 7, // 9: chipmunkApi.indicatorValue.Stochastic:type_name -> chipmunkApi.Stochastic - 8, // 10: chipmunkApi.indicatorValue.RSI:type_name -> chipmunkApi.RSI - 0, // 11: chipmunkApi.MovingAverageConfigs.Source:type_name -> chipmunkApi.Source - 0, // 12: chipmunkApi.BollingerBandsConfigs.Source:type_name -> chipmunkApi.Source - 1, // 13: chipmunkApi.IndicatorListReq.Type:type_name -> chipmunkApi.Indicator.type - 2, // 14: chipmunkApi.Indicators.Elements:type_name -> chipmunkApi.Indicator - 9, // 15: chipmunkApi.indicatorService.Return:input_type -> chipmunkApi.IndicatorReturnReq - 14, // 16: chipmunkApi.indicatorService.List:input_type -> chipmunkApi.IndicatorListReq - 2, // 17: chipmunkApi.indicatorService.Return:output_type -> chipmunkApi.Indicator - 15, // 18: chipmunkApi.indicatorService.List:output_type -> chipmunkApi.Indicators - 17, // [17:19] is the sub-list for method output_type - 15, // [15:17] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name -} - -func init() { file_services_chipmunk_api_proto_src_indicator_proto_init() } -func file_services_chipmunk_api_proto_src_indicator_proto_init() { - if File_services_chipmunk_api_proto_src_indicator_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Indicator); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IndicatorConfigs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IndicatorValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BollingerBands); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MovingAverage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Stochastic); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RSI); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IndicatorReturnReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RsiConfigs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StochasticConfigs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MovingAverageConfigs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BollingerBandsConfigs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IndicatorListReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Indicators); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_services_chipmunk_api_proto_src_indicator_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*IndicatorValue_BollingerBands)(nil), - (*IndicatorValue_MovingAverage)(nil), - (*IndicatorValue_Stochastic)(nil), - (*IndicatorValue_RSI)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_services_chipmunk_api_proto_src_indicator_proto_rawDesc, - NumEnums: 2, - NumMessages: 14, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_services_chipmunk_api_proto_src_indicator_proto_goTypes, - DependencyIndexes: file_services_chipmunk_api_proto_src_indicator_proto_depIdxs, - EnumInfos: file_services_chipmunk_api_proto_src_indicator_proto_enumTypes, - MessageInfos: file_services_chipmunk_api_proto_src_indicator_proto_msgTypes, - }.Build() - File_services_chipmunk_api_proto_src_indicator_proto = out.File - file_services_chipmunk_api_proto_src_indicator_proto_rawDesc = nil - file_services_chipmunk_api_proto_src_indicator_proto_goTypes = nil - file_services_chipmunk_api_proto_src_indicator_proto_depIdxs = nil -} diff --git a/services/chipmunk/api/proto/indicator_grpc.pb.go b/services/chipmunk/api/proto/indicator_grpc.pb.go deleted file mode 100644 index 4cf2205..0000000 --- a/services/chipmunk/api/proto/indicator_grpc.pb.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.12.4 -// source: services/chipmunk/api/proto/src/indicator.proto - -package proto - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// 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.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// IndicatorServiceClient is the client API for IndicatorService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type IndicatorServiceClient interface { - Return(ctx context.Context, in *IndicatorReturnReq, opts ...grpc.CallOption) (*Indicator, error) - List(ctx context.Context, in *IndicatorListReq, opts ...grpc.CallOption) (*Indicators, error) -} - -type indicatorServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewIndicatorServiceClient(cc grpc.ClientConnInterface) IndicatorServiceClient { - return &indicatorServiceClient{cc} -} - -func (c *indicatorServiceClient) Return(ctx context.Context, in *IndicatorReturnReq, opts ...grpc.CallOption) (*Indicator, error) { - out := new(Indicator) - err := c.cc.Invoke(ctx, "/chipmunkApi.indicatorService/Return", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *indicatorServiceClient) List(ctx context.Context, in *IndicatorListReq, opts ...grpc.CallOption) (*Indicators, error) { - out := new(Indicators) - err := c.cc.Invoke(ctx, "/chipmunkApi.indicatorService/List", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// IndicatorServiceServer is the server API for IndicatorService service. -// All implementations should embed UnimplementedIndicatorServiceServer -// for forward compatibility -type IndicatorServiceServer interface { - Return(context.Context, *IndicatorReturnReq) (*Indicator, error) - List(context.Context, *IndicatorListReq) (*Indicators, error) -} - -// UnimplementedIndicatorServiceServer should be embedded to have forward compatible implementations. -type UnimplementedIndicatorServiceServer struct { -} - -func (UnimplementedIndicatorServiceServer) Return(context.Context, *IndicatorReturnReq) (*Indicator, error) { - return nil, status.Errorf(codes.Unimplemented, "method Return not implemented") -} -func (UnimplementedIndicatorServiceServer) List(context.Context, *IndicatorListReq) (*Indicators, error) { - return nil, status.Errorf(codes.Unimplemented, "method List not implemented") -} - -// UnsafeIndicatorServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to IndicatorServiceServer will -// result in compilation errors. -type UnsafeIndicatorServiceServer interface { - mustEmbedUnimplementedIndicatorServiceServer() -} - -func RegisterIndicatorServiceServer(s grpc.ServiceRegistrar, srv IndicatorServiceServer) { - s.RegisterService(&IndicatorService_ServiceDesc, srv) -} - -func _IndicatorService_Return_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IndicatorReturnReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(IndicatorServiceServer).Return(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/chipmunkApi.indicatorService/Return", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IndicatorServiceServer).Return(ctx, req.(*IndicatorReturnReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _IndicatorService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IndicatorListReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(IndicatorServiceServer).List(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/chipmunkApi.indicatorService/List", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(IndicatorServiceServer).List(ctx, req.(*IndicatorListReq)) - } - return interceptor(ctx, in, info, handler) -} - -// IndicatorService_ServiceDesc is the grpc.ServiceDesc for IndicatorService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var IndicatorService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "chipmunkApi.indicatorService", - HandlerType: (*IndicatorServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Return", - Handler: _IndicatorService_Return_Handler, - }, - { - MethodName: "List", - Handler: _IndicatorService_List_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "services/chipmunk/api/proto/src/indicator.proto", -} diff --git a/services/chipmunk/api/proto/post.go b/services/chipmunk/api/proto/post.go new file mode 100644 index 0000000..84ee9da --- /dev/null +++ b/services/chipmunk/api/proto/post.go @@ -0,0 +1,52 @@ +package proto + +import ( + "database/sql/driver" + "encoding/json" +) + +func (Provider) InRange(v interface{}) bool { + i, ok := Provider_value[v.(Provider).String()] + return ok && i > 0 +} +func (d *Provider) Scan(value interface{}) error { + *d = Provider(Provider_value[value.(string)]) + return nil +} +func (d Provider) Value() (driver.Value, error) { + return d.String(), nil +} +func (d *Provider) UnmarshalJSON(b []byte) error { + var str string + if err := json.Unmarshal(b, &str); err != nil { + return err + } + *d = Provider(Provider_value[str]) + return nil +} +func (d Provider) MarshalJSON() ([]byte, error) { + return json.Marshal(d.String()) +} + +func (Polarity) InRange(v interface{}) bool { + i, ok := Polarity_value[v.(Provider).String()] + return ok && i > 0 +} +func (d *Polarity) Scan(value interface{}) error { + *d = Polarity(Polarity_value[value.(string)]) + return nil +} +func (d Polarity) Value() (driver.Value, error) { + return d.String(), nil +} +func (d *Polarity) UnmarshalJSON(b []byte) error { + var str string + if err := json.Unmarshal(b, &str); err != nil { + return err + } + *d = Polarity(Polarity_value[str]) + return nil +} +func (d Polarity) MarshalJSON() ([]byte, error) { + return json.Marshal(d.String()) +} diff --git a/services/chipmunk/api/proto/post.pb.go b/services/chipmunk/api/proto/post.pb.go new file mode 100644 index 0000000..110d9b6 --- /dev/null +++ b/services/chipmunk/api/proto/post.pb.go @@ -0,0 +1,716 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: services/chipmunk/api/proto/src/post.proto + +package proto + +import ( + _ "github.com/h-varmazyar/Gate/api/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Provider int32 + +const ( + Provider_TWITTER Provider = 0 + Provider_SAHAMYAB Provider = 1 + Provider_COIN_MARKET_CAP Provider = 2 +) + +// Enum value maps for Provider. +var ( + Provider_name = map[int32]string{ + 0: "TWITTER", + 1: "SAHAMYAB", + 2: "COIN_MARKET_CAP", + } + Provider_value = map[string]int32{ + "TWITTER": 0, + "SAHAMYAB": 1, + "COIN_MARKET_CAP": 2, + } +) + +func (x Provider) Enum() *Provider { + p := new(Provider) + *p = x + return p +} + +func (x Provider) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Provider) Descriptor() protoreflect.EnumDescriptor { + return file_services_chipmunk_api_proto_src_post_proto_enumTypes[0].Descriptor() +} + +func (Provider) Type() protoreflect.EnumType { + return &file_services_chipmunk_api_proto_src_post_proto_enumTypes[0] +} + +func (x Provider) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Provider.Descriptor instead. +func (Provider) EnumDescriptor() ([]byte, []int) { + return file_services_chipmunk_api_proto_src_post_proto_rawDescGZIP(), []int{0} +} + +type Polarity int32 + +const ( + Polarity_NOT_DETECTED Polarity = 0 + Polarity_NEUTRAL Polarity = 1 + Polarity_POSITIVE Polarity = 2 + Polarity_NEGATIVE Polarity = 3 +) + +// Enum value maps for Polarity. +var ( + Polarity_name = map[int32]string{ + 0: "NOT_DETECTED", + 1: "NEUTRAL", + 2: "POSITIVE", + 3: "NEGATIVE", + } + Polarity_value = map[string]int32{ + "NOT_DETECTED": 0, + "NEUTRAL": 1, + "POSITIVE": 2, + "NEGATIVE": 3, + } +) + +func (x Polarity) Enum() *Polarity { + p := new(Polarity) + *p = x + return p +} + +func (x Polarity) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Polarity) Descriptor() protoreflect.EnumDescriptor { + return file_services_chipmunk_api_proto_src_post_proto_enumTypes[1].Descriptor() +} + +func (Polarity) Type() protoreflect.EnumType { + return &file_services_chipmunk_api_proto_src_post_proto_enumTypes[1] +} + +func (x Polarity) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Polarity.Descriptor instead. +func (Polarity) EnumDescriptor() ([]byte, []int) { + return file_services_chipmunk_api_proto_src_post_proto_rawDescGZIP(), []int{1} +} + +type Post struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + PostedAt int64 `protobuf:"varint,2,opt,name=posted_at,json=postedAt,proto3" json:"posted_at,omitempty"` + Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` + LikeCount uint32 `protobuf:"varint,4,opt,name=like_count,json=likeCount,proto3" json:"like_count,omitempty"` + ParentId string `protobuf:"bytes,5,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` + SenderUsername string `protobuf:"bytes,6,opt,name=sender_username,json=senderUsername,proto3" json:"sender_username,omitempty"` + Provider Provider `protobuf:"varint,7,opt,name=provider,proto3,enum=chipmunkApi.Provider" json:"provider,omitempty"` + Tags []string `protobuf:"bytes,8,rep,name=Tags,proto3" json:"Tags,omitempty"` + Polarity Polarity `protobuf:"varint,9,opt,name=polarity,proto3,enum=chipmunkApi.Polarity" json:"polarity,omitempty"` +} + +func (x *Post) Reset() { + *x = Post{} + if protoimpl.UnsafeEnabled { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Post) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Post) ProtoMessage() {} + +func (x *Post) ProtoReflect() protoreflect.Message { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Post.ProtoReflect.Descriptor instead. +func (*Post) Descriptor() ([]byte, []int) { + return file_services_chipmunk_api_proto_src_post_proto_rawDescGZIP(), []int{0} +} + +func (x *Post) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Post) GetPostedAt() int64 { + if x != nil { + return x.PostedAt + } + return 0 +} + +func (x *Post) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *Post) GetLikeCount() uint32 { + if x != nil { + return x.LikeCount + } + return 0 +} + +func (x *Post) GetParentId() string { + if x != nil { + return x.ParentId + } + return "" +} + +func (x *Post) GetSenderUsername() string { + if x != nil { + return x.SenderUsername + } + return "" +} + +func (x *Post) GetProvider() Provider { + if x != nil { + return x.Provider + } + return Provider_TWITTER +} + +func (x *Post) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Post) GetPolarity() Polarity { + if x != nil { + return x.Polarity + } + return Polarity_NOT_DETECTED +} + +type Posts struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Elements []*Post `protobuf:"bytes,1,rep,name=elements,proto3" json:"elements,omitempty"` + Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *Posts) Reset() { + *x = Posts{} + if protoimpl.UnsafeEnabled { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Posts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Posts) ProtoMessage() {} + +func (x *Posts) ProtoReflect() protoreflect.Message { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Posts.ProtoReflect.Descriptor instead. +func (*Posts) Descriptor() ([]byte, []int) { + return file_services_chipmunk_api_proto_src_post_proto_rawDescGZIP(), []int{1} +} + +func (x *Posts) GetElements() []*Post { + if x != nil { + return x.Elements + } + return nil +} + +func (x *Posts) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +type PostListReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Provider Provider `protobuf:"varint,1,opt,name=provider,proto3,enum=chipmunkApi.Provider" json:"provider,omitempty"` + Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` + PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` +} + +func (x *PostListReq) Reset() { + *x = PostListReq{} + if protoimpl.UnsafeEnabled { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostListReq) ProtoMessage() {} + +func (x *PostListReq) ProtoReflect() protoreflect.Message { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PostListReq.ProtoReflect.Descriptor instead. +func (*PostListReq) Descriptor() ([]byte, []int) { + return file_services_chipmunk_api_proto_src_post_proto_rawDescGZIP(), []int{2} +} + +func (x *PostListReq) GetProvider() Provider { + if x != nil { + return x.Provider + } + return Provider_TWITTER +} + +func (x *PostListReq) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *PostListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +type PostNonPolarityListReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MaxTokenCount int32 `protobuf:"varint,1,opt,name=MaxTokenCount,proto3" json:"MaxTokenCount,omitempty"` +} + +func (x *PostNonPolarityListReq) Reset() { + *x = PostNonPolarityListReq{} + if protoimpl.UnsafeEnabled { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostNonPolarityListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostNonPolarityListReq) ProtoMessage() {} + +func (x *PostNonPolarityListReq) ProtoReflect() protoreflect.Message { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PostNonPolarityListReq.ProtoReflect.Descriptor instead. +func (*PostNonPolarityListReq) Descriptor() ([]byte, []int) { + return file_services_chipmunk_api_proto_src_post_proto_rawDescGZIP(), []int{3} +} + +func (x *PostNonPolarityListReq) GetMaxTokenCount() int32 { + if x != nil { + return x.MaxTokenCount + } + return 0 +} + +type PostSubmitPolarityReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PostPolarities []*PostSubmitPolarityReq_PostPolarity `protobuf:"bytes,1,rep,name=post_polarities,json=postPolarities,proto3" json:"post_polarities,omitempty"` +} + +func (x *PostSubmitPolarityReq) Reset() { + *x = PostSubmitPolarityReq{} + if protoimpl.UnsafeEnabled { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostSubmitPolarityReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostSubmitPolarityReq) ProtoMessage() {} + +func (x *PostSubmitPolarityReq) ProtoReflect() protoreflect.Message { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PostSubmitPolarityReq.ProtoReflect.Descriptor instead. +func (*PostSubmitPolarityReq) Descriptor() ([]byte, []int) { + return file_services_chipmunk_api_proto_src_post_proto_rawDescGZIP(), []int{4} +} + +func (x *PostSubmitPolarityReq) GetPostPolarities() []*PostSubmitPolarityReq_PostPolarity { + if x != nil { + return x.PostPolarities + } + return nil +} + +type PostSubmitPolarityReq_PostPolarity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PostId string `protobuf:"bytes,1,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"` + Polarity Polarity `protobuf:"varint,2,opt,name=polarity,proto3,enum=chipmunkApi.Polarity" json:"polarity,omitempty"` +} + +func (x *PostSubmitPolarityReq_PostPolarity) Reset() { + *x = PostSubmitPolarityReq_PostPolarity{} + if protoimpl.UnsafeEnabled { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostSubmitPolarityReq_PostPolarity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostSubmitPolarityReq_PostPolarity) ProtoMessage() {} + +func (x *PostSubmitPolarityReq_PostPolarity) ProtoReflect() protoreflect.Message { + mi := &file_services_chipmunk_api_proto_src_post_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PostSubmitPolarityReq_PostPolarity.ProtoReflect.Descriptor instead. +func (*PostSubmitPolarityReq_PostPolarity) Descriptor() ([]byte, []int) { + return file_services_chipmunk_api_proto_src_post_proto_rawDescGZIP(), []int{4, 0} +} + +func (x *PostSubmitPolarityReq_PostPolarity) GetPostId() string { + if x != nil { + return x.PostId + } + return "" +} + +func (x *PostSubmitPolarityReq_PostPolarity) GetPolarity() Polarity { + if x != nil { + return x.Polarity + } + return Polarity_NOT_DETECTED +} + +var File_services_chipmunk_api_proto_src_post_proto protoreflect.FileDescriptor + +var file_services_chipmunk_api_proto_src_post_proto_rawDesc = []byte{ + 0x0a, 0x2a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x68, 0x69, 0x70, 0x6d, + 0x75, 0x6e, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, + 0x63, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x63, 0x68, + 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x1a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x6d, 0x69, 0x73, 0x63, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xac, 0x02, 0x0a, 0x04, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, + 0x70, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x08, 0x70, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x69, 0x6b, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x6c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, + 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x63, 0x68, 0x69, + 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x54, + 0x61, 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x54, 0x61, 0x67, 0x73, 0x12, + 0x31, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x15, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, + 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, + 0x74, 0x79, 0x22, 0x4c, 0x0a, 0x05, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x2d, 0x0a, 0x08, 0x65, + 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x50, 0x6f, 0x73, 0x74, + 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x71, 0x0a, 0x0b, 0x50, 0x6f, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, + 0x31, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x15, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, + 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, + 0x69, 0x7a, 0x65, 0x22, 0x3e, 0x0a, 0x16, 0x50, 0x6f, 0x73, 0x74, 0x4e, 0x6f, 0x6e, 0x50, 0x6f, + 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, + 0x0d, 0x4d, 0x61, 0x78, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x4d, 0x61, 0x78, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0xcd, 0x01, 0x0a, 0x15, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6d, + 0x69, 0x74, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x12, 0x58, 0x0a, + 0x0f, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, + 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, + 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x50, + 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x52, 0x0e, 0x70, 0x6f, 0x73, 0x74, 0x50, 0x6f, 0x6c, + 0x61, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x5a, 0x0a, 0x0c, 0x50, 0x6f, 0x73, 0x74, 0x50, + 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x73, 0x74, 0x49, 0x64, + 0x12, 0x31, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, + 0x2e, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x61, 0x72, + 0x69, 0x74, 0x79, 0x2a, 0x3a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, + 0x0b, 0x0a, 0x07, 0x54, 0x57, 0x49, 0x54, 0x54, 0x45, 0x52, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, + 0x53, 0x41, 0x48, 0x41, 0x4d, 0x59, 0x41, 0x42, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x4f, + 0x49, 0x4e, 0x5f, 0x4d, 0x41, 0x52, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x41, 0x50, 0x10, 0x02, 0x2a, + 0x45, 0x0a, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x12, 0x10, 0x0a, 0x0c, 0x4e, + 0x4f, 0x54, 0x5f, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, + 0x07, 0x4e, 0x45, 0x55, 0x54, 0x52, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, + 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x45, 0x47, 0x41, + 0x54, 0x49, 0x56, 0x45, 0x10, 0x03, 0x32, 0x43, 0x0a, 0x0b, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x18, 0x2e, + 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x50, 0x6f, 0x73, 0x74, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, + 0x6e, 0x6b, 0x41, 0x70, 0x69, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x42, 0x39, 0x5a, 0x37, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x2d, 0x76, 0x61, 0x72, 0x6d, + 0x61, 0x7a, 0x79, 0x61, 0x72, 0x2f, 0x47, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2f, 0x63, 0x68, 0x69, 0x70, 0x6d, 0x75, 0x6e, 0x6b, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_services_chipmunk_api_proto_src_post_proto_rawDescOnce sync.Once + file_services_chipmunk_api_proto_src_post_proto_rawDescData = file_services_chipmunk_api_proto_src_post_proto_rawDesc +) + +func file_services_chipmunk_api_proto_src_post_proto_rawDescGZIP() []byte { + file_services_chipmunk_api_proto_src_post_proto_rawDescOnce.Do(func() { + file_services_chipmunk_api_proto_src_post_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_chipmunk_api_proto_src_post_proto_rawDescData) + }) + return file_services_chipmunk_api_proto_src_post_proto_rawDescData +} + +var file_services_chipmunk_api_proto_src_post_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_services_chipmunk_api_proto_src_post_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_services_chipmunk_api_proto_src_post_proto_goTypes = []interface{}{ + (Provider)(0), // 0: chipmunkApi.Provider + (Polarity)(0), // 1: chipmunkApi.Polarity + (*Post)(nil), // 2: chipmunkApi.Post + (*Posts)(nil), // 3: chipmunkApi.Posts + (*PostListReq)(nil), // 4: chipmunkApi.PostListReq + (*PostNonPolarityListReq)(nil), // 5: chipmunkApi.PostNonPolarityListReq + (*PostSubmitPolarityReq)(nil), // 6: chipmunkApi.PostSubmitPolarityReq + (*PostSubmitPolarityReq_PostPolarity)(nil), // 7: chipmunkApi.PostSubmitPolarityReq.PostPolarity +} +var file_services_chipmunk_api_proto_src_post_proto_depIdxs = []int32{ + 0, // 0: chipmunkApi.Post.provider:type_name -> chipmunkApi.Provider + 1, // 1: chipmunkApi.Post.polarity:type_name -> chipmunkApi.Polarity + 2, // 2: chipmunkApi.Posts.elements:type_name -> chipmunkApi.Post + 0, // 3: chipmunkApi.PostListReq.provider:type_name -> chipmunkApi.Provider + 7, // 4: chipmunkApi.PostSubmitPolarityReq.post_polarities:type_name -> chipmunkApi.PostSubmitPolarityReq.PostPolarity + 1, // 5: chipmunkApi.PostSubmitPolarityReq.PostPolarity.polarity:type_name -> chipmunkApi.Polarity + 4, // 6: chipmunkApi.PostService.List:input_type -> chipmunkApi.PostListReq + 3, // 7: chipmunkApi.PostService.List:output_type -> chipmunkApi.Posts + 7, // [7:8] is the sub-list for method output_type + 6, // [6:7] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_services_chipmunk_api_proto_src_post_proto_init() } +func file_services_chipmunk_api_proto_src_post_proto_init() { + if File_services_chipmunk_api_proto_src_post_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_services_chipmunk_api_proto_src_post_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Post); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_chipmunk_api_proto_src_post_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Posts); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_chipmunk_api_proto_src_post_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostListReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_chipmunk_api_proto_src_post_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostNonPolarityListReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_chipmunk_api_proto_src_post_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostSubmitPolarityReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_chipmunk_api_proto_src_post_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostSubmitPolarityReq_PostPolarity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_services_chipmunk_api_proto_src_post_proto_rawDesc, + NumEnums: 2, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_services_chipmunk_api_proto_src_post_proto_goTypes, + DependencyIndexes: file_services_chipmunk_api_proto_src_post_proto_depIdxs, + EnumInfos: file_services_chipmunk_api_proto_src_post_proto_enumTypes, + MessageInfos: file_services_chipmunk_api_proto_src_post_proto_msgTypes, + }.Build() + File_services_chipmunk_api_proto_src_post_proto = out.File + file_services_chipmunk_api_proto_src_post_proto_rawDesc = nil + file_services_chipmunk_api_proto_src_post_proto_goTypes = nil + file_services_chipmunk_api_proto_src_post_proto_depIdxs = nil +} diff --git a/services/chipmunk/api/proto/post_grpc.pb.go b/services/chipmunk/api/proto/post_grpc.pb.go new file mode 100644 index 0000000..3f9f204 --- /dev/null +++ b/services/chipmunk/api/proto/post_grpc.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.12.4 +// source: services/chipmunk/api/proto/src/post.proto + +package proto + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// 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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// PostServiceClient is the client API for PostService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PostServiceClient interface { + // rpc NonPolarityList(PostNonPolarityListReq) returns (Posts); + List(ctx context.Context, in *PostListReq, opts ...grpc.CallOption) (*Posts, error) +} + +type postServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPostServiceClient(cc grpc.ClientConnInterface) PostServiceClient { + return &postServiceClient{cc} +} + +func (c *postServiceClient) List(ctx context.Context, in *PostListReq, opts ...grpc.CallOption) (*Posts, error) { + out := new(Posts) + err := c.cc.Invoke(ctx, "/chipmunkApi.PostService/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PostServiceServer is the server API for PostService service. +// All implementations should embed UnimplementedPostServiceServer +// for forward compatibility +type PostServiceServer interface { + // rpc NonPolarityList(PostNonPolarityListReq) returns (Posts); + List(context.Context, *PostListReq) (*Posts, error) +} + +// UnimplementedPostServiceServer should be embedded to have forward compatible implementations. +type UnimplementedPostServiceServer struct { +} + +func (UnimplementedPostServiceServer) List(context.Context, *PostListReq) (*Posts, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} + +// UnsafePostServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PostServiceServer will +// result in compilation errors. +type UnsafePostServiceServer interface { + mustEmbedUnimplementedPostServiceServer() +} + +func RegisterPostServiceServer(s grpc.ServiceRegistrar, srv PostServiceServer) { + s.RegisterService(&PostService_ServiceDesc, srv) +} + +func _PostService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PostListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PostServiceServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/chipmunkApi.PostService/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PostServiceServer).List(ctx, req.(*PostListReq)) + } + return interceptor(ctx, in, info, handler) +} + +// PostService_ServiceDesc is the grpc.ServiceDesc for PostService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PostService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "chipmunkApi.PostService", + HandlerType: (*PostServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "List", + Handler: _PostService_List_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "services/chipmunk/api/proto/src/post.proto", +} diff --git a/services/chipmunk/api/proto/src/post.proto b/services/chipmunk/api/proto/src/post.proto new file mode 100644 index 0000000..a6b5460 --- /dev/null +++ b/services/chipmunk/api/proto/src/post.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; +package chipmunkApi; +option go_package = "github.com/h-varmazyar/Gate/services/chipmunk/api/proto"; +import "api/proto/src/misc.proto"; + +service PostService { +// rpc NonPolarityList(PostNonPolarityListReq) returns (Posts); + rpc List(PostListReq) returns (Posts); +// rpc SubmitPolarity(PostSubmitPolarityReq) returns (api.Void); +} + +enum Provider { + TWITTER = 0; + SAHAMYAB = 1; + COIN_MARKET_CAP = 2; +} + +enum Polarity { + NOT_DETECTED = 0; + NEUTRAL = 1; + POSITIVE = 2; + NEGATIVE = 3; +} + +message Post { + string id = 1; + int64 posted_at = 2; + string content = 3; + uint32 like_count = 4; + string parent_id = 5; + string sender_username = 6; + Provider provider = 7; + repeated string Tags = 8; + Polarity polarity = 9; +} + +message Posts { + repeated Post elements = 1; + int64 count = 2; +} + +message PostListReq { + Provider provider = 1; + int32 page = 2; + int32 page_size = 3; +} + +message PostNonPolarityListReq{ + int32 MaxTokenCount = 1; +} + +message PostSubmitPolarityReq{ + message PostPolarity{ + string post_id = 1; + Polarity polarity = 2; + } + repeated PostPolarity post_polarities = 1; +} + diff --git a/services/chipmunk/cmd/configs.go b/services/chipmunk/cmd/configs.go index c7ef661..46afec6 100644 --- a/services/chipmunk/cmd/configs.go +++ b/services/chipmunk/cmd/configs.go @@ -4,8 +4,8 @@ import ( "github.com/h-varmazyar/Gate/pkg/amqpext" "github.com/h-varmazyar/Gate/pkg/gormext" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/candles" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/indicators" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/markets" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/posts" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/resolutions" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/wallets" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" @@ -19,7 +19,7 @@ type Configs struct { BufferConfigs *buffer.Configs `mapstructure:"buffer_configs"` MarketsApp markets.Configs `mapstructure:"markets_app"` CandlesApp candles.Configs `mapstructure:"candles_app"` - IndicatorsApp indicators.Configs `mapstructure:"indicators_app"` + PostsApp posts.Configs `mapstructure:"posts_app"` ResolutionsApp resolutions.Configs `mapstructure:"resolutions_app"` WalletsApp wallets.Configs `mapstructure:"wallets_app"` DB gormext.Configs `mapstructure:"db"` diff --git a/services/chipmunk/cmd/main.go b/services/chipmunk/cmd/main.go index 9bc80fb..ef0ea82 100644 --- a/services/chipmunk/cmd/main.go +++ b/services/chipmunk/cmd/main.go @@ -8,19 +8,11 @@ import ( "github.com/h-varmazyar/Gate/pkg/gormext" "github.com/h-varmazyar/Gate/pkg/service" "github.com/h-varmazyar/Gate/services/chipmunk/configs" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/assets" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/candles" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/indicators" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/markets" - marketsService "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/markets/service" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/resolutions" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/wallets" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/posts" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/db" log "github.com/sirupsen/logrus" "github.com/spf13/viper" - "google.golang.org/grpc" - "net" ) func main() { @@ -46,6 +38,7 @@ func main() { logger.Panicf("failed to initialize amqp: %v", err) } + logger.Infof("initializing candle buffer") buffer.InitializeCandleBuffer(conf.BufferConfigs) initializeAndRegisterApps(ctx, logger, dbInstance, conf) @@ -97,69 +90,75 @@ func loadDB(ctx context.Context, configs gormext.Configs) (*db.DB, error) { func initializeAndRegisterApps(ctx context.Context, logger *log.Logger, dbInstance *db.DB, configs *Configs) { var err error - var assetsApp *assets.App - assetsApp, err = assets.NewApp(ctx, logger, dbInstance) + _, err = posts.NewApp(ctx, logger, configs.PostsApp, dbInstance, nil) if err != nil { - logger.WithError(err).Panicf("failed to initiate ips app") + logger.WithError(err).Panicf("failed to initiate posts app") } - var indicatorsApp *indicators.App - indicatorsApp, err = indicators.NewApp(ctx, logger, dbInstance, configs.IndicatorsApp) - if err != nil { - logger.WithError(err).Panicf("failed to initiate indicator app") - } - - var resolutionsApp *resolutions.App - resolutionsApp, err = resolutions.NewApp(ctx, logger, dbInstance, configs.ResolutionsApp) - if err != nil { - logger.WithError(err).Panicf("failed to resolutions markets app") - } - - marketDependencies := &markets.AppDependencies{ - ServiceDependencies: &marketsService.Dependencies{ - AssetsService: assetsApp.Service, - IndicatorsService: indicatorsApp.Service, - ResolutionsService: resolutionsApp.Service, - }, - } - - var marketsApp *markets.App - marketsApp, err = markets.NewApp(ctx, logger, dbInstance, configs.MarketsApp, marketDependencies) - if err != nil { - logger.WithError(err).Panicf("failed to initiate markets app") - } - - candlesDependencies := &candles.AppDependencies{ - IndicatorService: indicatorsApp.Service, - ResolutionService: resolutionsApp.Service, - MarketService: marketsApp.Service, - } - var candlesApp *candles.App - candlesApp, err = candles.NewApp(ctx, logger, dbInstance, configs.CandlesApp, candlesDependencies) - if err != nil { - logger.WithError(err).Panicf("failed to initiate candles app") - } - - walletDependencies := &wallets.AppDependencies{ - MarketService: marketsApp.Service, - } - - var walletsApp *wallets.App - walletsApp, err = wallets.NewApp(ctx, logger, configs.WalletsApp, walletDependencies) - if err != nil { - logger.WithError(err).Panicf("failed to initiate wallets app") - } - - service.Serve(configs.GRPCPort, func(lst net.Listener) error { - server := grpc.NewServer() - assetsApp.Service.RegisterServer(server) - marketsApp.Service.RegisterServer(server) - candlesApp.Service.RegisterServer(server) - indicatorsApp.Service.RegisterServer(server) - resolutionsApp.Service.RegisterServer(server) - walletsApp.Service.RegisterServer(server) - return server.Serve(lst) - }) + //var assetsApp *assets.App + //assetsApp, err = assets.NewApp(ctx, logger, dbInstance) + //if err != nil { + // logger.WithError(err).Panicf("failed to initiate ips app") + //} + // + // + ////var indicatorsApp *indicators.App + ////indicatorsApp, err = indicators.NewApp(ctx, logger, dbInstance, configs.IndicatorsApp) + ////if err != nil { + //// logger.WithError(err).Panicf("failed to initiate indicator app") + ////} + // + //var resolutionsApp *resolutions.App + //resolutionsApp, err = resolutions.NewApp(ctx, logger, dbInstance, configs.ResolutionsApp) + //if err != nil { + // logger.WithError(err).Panicf("failed to resolutions markets app") + //} + // + //marketDependencies := &markets.AppDependencies{ + // ServiceDependencies: &marketsService.Dependencies{ + // AssetsService: assetsApp.Service, + // //IndicatorsService: indicatorsApp.Service, + // ResolutionsService: resolutionsApp.Service, + // }, + //} + // + //var marketsApp *markets.App + //marketsApp, err = markets.NewApp(ctx, logger, dbInstance, configs.MarketsApp, marketDependencies) + //if err != nil { + // logger.WithError(err).Panicf("failed to initiate markets app") + //} + // + //candlesDependencies := &candles.AppDependencies{ + // //IndicatorService: indicatorsApp.Service, + // ResolutionService: resolutionsApp.Service, + // MarketService: marketsApp.Service, + //} + //var candlesApp *candles.App + //candlesApp, err = candles.NewApp(ctx, logger, dbInstance, configs.CandlesApp, candlesDependencies) + //if err != nil { + // logger.WithError(err).Panicf("failed to initiate candles app") + //} + // + //walletDependencies := &wallets.AppDependencies{ + // MarketService: marketsApp.Service, + //} + // + //var walletsApp *wallets.App + //walletsApp, err = wallets.NewApp(ctx, logger, configs.WalletsApp, walletDependencies) + //if err != nil { + // logger.WithError(err).Panicf("failed to initiate wallets app") + //} + // + //service.Serve(configs.GRPCPort, func(lst net.Listener) error { + // server := grpc.NewServer() + // assetsApp.Service.RegisterServer(server) + // marketsApp.Service.RegisterServer(server) + // candlesApp.Service.RegisterServer(server) + // //indicatorsApp.Service.RegisterServer(server) + // resolutionsApp.Service.RegisterServer(server) + // walletsApp.Service.RegisterServer(server) + // return server.Serve(lst) + //}) service.Start(configs.ServiceName, configs.Version) } diff --git a/services/chipmunk/configs/default.go b/services/chipmunk/configs/default.go index 8f0114e..c70a8ec 100644 --- a/services/chipmunk/configs/default.go +++ b/services/chipmunk/configs/default.go @@ -6,7 +6,7 @@ service_name: "chipmunk" version: "v1.0.0" grpc_port: 11000 amqp_configs: - connection: "amqp://rabbitmq:rabbitmq@185.110.191.66" + connection: "amqp://rabbitmq:rabbitmq@localhost:5672" buffer_configs: candle_buffer_length: 400 markets_app: @@ -28,8 +28,12 @@ candles_app: missed_candles_interval: "10m" last_candles_interval: "3s" redundant_remover_interval: "15m" -indicators_app: - service_configs: +posts_app: + workers_configs: + network_address: "localhost:10101" + sahamyab_post_collector_url: "https://www.sahamyab.com/guest/twiter/list?v=0.1" + max_sentiment_detector_token_length: + sentiment_detector_token: resolutions_app: service_configs: wallets_app: @@ -43,8 +47,8 @@ db: type: "postgreSQL" username: "postgres" password: "postgres" - host: "185.110.191.66" - port: 5432 + host: "localhost" + port: 5433 name: "chipmunk" is_ssl_enable: false `) diff --git a/services/chipmunk/internal/app/candles/app.go b/services/chipmunk/internal/app/candles/app.go index a543d9e..0ec453d 100644 --- a/services/chipmunk/internal/app/candles/app.go +++ b/services/chipmunk/internal/app/candles/app.go @@ -7,7 +7,6 @@ import ( "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/candles/repository" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/candles/service" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/candles/workers" - indicatorService "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/indicators/service" marketService "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/markets/service" resolutionService "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/resolutions/service" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/db" @@ -27,7 +26,7 @@ type App struct { } type AppDependencies struct { - IndicatorService *indicatorService.Service + //IndicatorService *indicatorService.Service ResolutionService *resolutionService.Service MarketService *marketService.Service } diff --git a/services/chipmunk/internal/app/candles/service/service.go b/services/chipmunk/internal/app/candles/service/service.go index 3741090..e31143f 100644 --- a/services/chipmunk/internal/app/candles/service/service.go +++ b/services/chipmunk/internal/app/candles/service/service.go @@ -62,51 +62,51 @@ func (s *Service) List(_ context.Context, req *chipmunkApi.CandleListReq) (*chip for _, candle := range candles { element := new(chipmunkApi.Candle) mapper.Struct(candle, element) - element.IndicatorValues = make(map[string]*chipmunkApi.IndicatorValue) - for key, value := range candle.RSIs { - element.IndicatorValues[key.String()] = &chipmunkApi.IndicatorValue{ - Type: chipmunkApi.Indicator_RSI, - Value: &chipmunkApi.IndicatorValue_RSI{ - RSI: &chipmunkApi.RSI{ - RSI: value.RSI, - }, - }, - } - } - for key, value := range candle.Stochastics { - element.IndicatorValues[key.String()] = &chipmunkApi.IndicatorValue{ - Type: chipmunkApi.Indicator_Stochastic, - Value: &chipmunkApi.IndicatorValue_Stochastic{ - Stochastic: &chipmunkApi.Stochastic{ - IndexK: value.IndexK, - IndexD: value.IndexD, - }, - }, - } - } - for key, value := range candle.BollingerBands { - element.IndicatorValues[key.String()] = &chipmunkApi.IndicatorValue{ - Type: chipmunkApi.Indicator_BollingerBands, - Value: &chipmunkApi.IndicatorValue_BollingerBands{ - BollingerBands: &chipmunkApi.BollingerBands{ - UpperBand: value.UpperBand, - LowerBand: value.LowerBand, - MA: value.MA, - }, - }, - } - } - for key, value := range candle.MovingAverages { - element.IndicatorValues[key.String()] = &chipmunkApi.IndicatorValue{ - Type: chipmunkApi.Indicator_MovingAverage, - Value: &chipmunkApi.IndicatorValue_MovingAverage{ - MovingAverage: &chipmunkApi.MovingAverage{ - Simple: value.Simple, - Exponential: value.Exponential, - }, - }, - } - } + //element.IndicatorValues = make(map[string]*chipmunkApi.IndicatorValue) + //for key, value := range candle.RSIs { + // element.IndicatorValues[key.String()] = &chipmunkApi.IndicatorValue{ + // Type: chipmunkApi.Indicator_RSI, + // Value: &chipmunkApi.IndicatorValue_RSI{ + // RSI: &chipmunkApi.RSI{ + // RSI: value.RSI, + // }, + // }, + // } + //} + //for key, value := range candle.Stochastics { + // element.IndicatorValues[key.String()] = &chipmunkApi.IndicatorValue{ + // Type: chipmunkApi.Indicator_Stochastic, + // Value: &chipmunkApi.IndicatorValue_Stochastic{ + // Stochastic: &chipmunkApi.Stochastic{ + // IndexK: value.IndexK, + // IndexD: value.IndexD, + // }, + // }, + // } + //} + //for key, value := range candle.BollingerBands { + // element.IndicatorValues[key.String()] = &chipmunkApi.IndicatorValue{ + // Type: chipmunkApi.Indicator_BollingerBands, + // Value: &chipmunkApi.IndicatorValue_BollingerBands{ + // BollingerBands: &chipmunkApi.BollingerBands{ + // UpperBand: value.UpperBand, + // LowerBand: value.LowerBand, + // MA: value.MA, + // }, + // }, + // } + //} + //for key, value := range candle.MovingAverages { + // element.IndicatorValues[key.String()] = &chipmunkApi.IndicatorValue{ + // Type: chipmunkApi.Indicator_MovingAverage, + // Value: &chipmunkApi.IndicatorValue_MovingAverage{ + // MovingAverage: &chipmunkApi.MovingAverage{ + // Simple: value.Simple, + // Exponential: value.Exponential, + // }, + // }, + // } + //} response.Elements = append(response.Elements, element) } return response, nil @@ -157,7 +157,7 @@ func (s *Service) Update(ctx context.Context, _ *chipmunkApi.CandleUpdateReq) (* // lastVol -= last[i].Volume // } // -// c := &entity.Candle{ +// c := &entities.Candle{ // Time: last[len(last)-1].Time, // Open: last[len(last)-1].Open, // High: last[len(last)-1].High, diff --git a/services/chipmunk/internal/app/candles/service/utils.go b/services/chipmunk/internal/app/candles/service/utils.go index 1c995aa..30b89de 100644 --- a/services/chipmunk/internal/app/candles/service/utils.go +++ b/services/chipmunk/internal/app/candles/service/utils.go @@ -3,23 +3,21 @@ package service import ( "github.com/google/uuid" api "github.com/h-varmazyar/Gate/api/proto" - "github.com/h-varmazyar/Gate/pkg/mapper" chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" - indicatorsPkg "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/indicators" "gorm.io/gorm" "time" ) -func (s *Service) preparePrimaryDataRequests(platform api.Platform, market *chipmunkApi.Market, resolutions *chipmunkApi.Resolutions, indicators []indicatorsPkg.Indicator) { +func (s *Service) preparePrimaryDataRequests(platform api.Platform, market *chipmunkApi.Market, resolutions *chipmunkApi.Resolutions) { for _, resolution := range resolutions.Elements { - s.preparePrimaryDataRequestsByResolution(platform, market, resolution, indicators) + s.preparePrimaryDataRequestsByResolution(platform, market, resolution) } } -func (s *Service) preparePrimaryDataRequestsByResolution(platform api.Platform, market *chipmunkApi.Market, resolution *chipmunkApi.Resolution, indicators []indicatorsPkg.Indicator) { - from, err := s.prepareLocalCandles(market, resolution, indicators) +func (s *Service) preparePrimaryDataRequestsByResolution(platform api.Platform, market *chipmunkApi.Market, resolution *chipmunkApi.Resolution) { + from, err := s.prepareLocalCandles(market, resolution) if err != nil { return } @@ -27,7 +25,7 @@ func (s *Service) preparePrimaryDataRequestsByResolution(platform api.Platform, s.makePrimaryDataRequests(platform, market, resolution, from) } -func (s *Service) prepareLocalCandles(market *chipmunkApi.Market, resolution *chipmunkApi.Resolution, indicators []indicatorsPkg.Indicator) (time.Time, error) { +func (s *Service) prepareLocalCandles(market *chipmunkApi.Market, resolution *chipmunkApi.Resolution) (time.Time, error) { marketID, err := uuid.Parse(market.ID) if err != nil { s.logger.WithError(err).Errorf("invalid market id %v", market) @@ -54,10 +52,10 @@ func (s *Service) prepareLocalCandles(market *chipmunkApi.Market, resolution *ch } if len(candles) > 0 { - if err = s.calculateIndicators(candles, indicators); err != nil { - s.logger.WithError(err).Errorf("failed to calculate indicators for market %v in resolution %v", marketID, resolutionID) - return time.Unix(0, 0), err - } + //if err = s.calculateIndicators(candles, indicators); err != nil { + // s.logger.WithError(err).Errorf("failed to calculate indicators for market %v in resolution %v", marketID, resolutionID) + // return time.Unix(0, 0), err + //} from = candles[len(candles)-1].Time.Add(time.Duration(resolution.Duration)) for _, candle := range candles { @@ -88,15 +86,15 @@ func (s *Service) loadLocalCandles(marketID, resolutionID uuid.UUID) ([]*entity. return candles, nil } -func (s *Service) calculateIndicators(candles []*entity.Candle, indicators []indicatorsPkg.Indicator) error { - for _, indicator := range indicators { - err := indicator.Calculate(candles) - if err != nil { - return err - } - } - return nil -} +//func (s *Service) calculateIndicators(candles []*entity.Candle, indicators []indicatorsPkg.Indicator) error { +// for _, indicator := range indicators { +// err := indicator.Calculate(candles) +// if err != nil { +// return err +// } +// } +// return nil +//} func (s *Service) makePrimaryDataRequests(platform api.Platform, market *chipmunkApi.Market, resolution *chipmunkApi.Resolution, from time.Time) { //_, err := s.functionsService.AsyncOHLC(context.Background(), &coreApi.OHLCReq{ @@ -111,31 +109,31 @@ func (s *Service) makePrimaryDataRequests(platform api.Platform, market *chipmun //} } -func (s *Service) loadIndicators(indicators []*chipmunkApi.Indicator) ([]indicatorsPkg.Indicator, error) { - response := make([]indicatorsPkg.Indicator, 0) - for _, i := range indicators { - var indicatorCalculator indicatorsPkg.Indicator - var err error - indicator := new(entity.Indicator) - mapper.Struct(i, indicator) - indicator.ID, err = uuid.Parse(i.ID) - if err != nil { - return nil, err - } - switch indicator.Type { - case chipmunkApi.Indicator_RSI: - indicatorCalculator, err = indicatorsPkg.NewRSI(indicator.ID, indicator.Configs.RSI) - case chipmunkApi.Indicator_Stochastic: - indicatorCalculator, err = indicatorsPkg.NewStochastic(indicator.ID, indicator.Configs.Stochastic) - case chipmunkApi.Indicator_MovingAverage: - indicatorCalculator, err = indicatorsPkg.NewMovingAverage(indicator.ID, indicator.Configs.MovingAverage) - case chipmunkApi.Indicator_BollingerBands: - indicatorCalculator, err = indicatorsPkg.NewBollingerBands(indicator.ID, indicator.Configs.BollingerBands) - } - if err != nil { - return nil, err - } - response = append(response, indicatorCalculator) - } - return response, nil -} +//func (s *Service) loadIndicators(indicators []*chipmunkApi.Indicator) ([]indicatorsPkg.Indicator, error) { +// response := make([]indicatorsPkg.Indicator, 0) +// for _, i := range indicators { +// var indicatorCalculator indicatorsPkg.Indicator +// var err error +// indicator := new(entity.Indicator) +// mapper.Struct(i, indicator) +// indicator.ID, err = uuid.Parse(i.ID) +// if err != nil { +// return nil, err +// } +// switch indicator.Type { +// case chipmunkApi.Indicator_RSI: +// indicatorCalculator, err = indicatorsPkg.NewRSI(indicator.ID, indicator.Configs.RSI) +// case chipmunkApi.Indicator_Stochastic: +// indicatorCalculator, err = indicatorsPkg.NewStochastic(indicator.ID, indicator.Configs.Stochastic) +// case chipmunkApi.Indicator_MovingAverage: +// indicatorCalculator, err = indicatorsPkg.NewMovingAverage(indicator.ID, indicator.Configs.MovingAverage) +// case chipmunkApi.Indicator_BollingerBands: +// indicatorCalculator, err = indicatorsPkg.NewBollingerBands(indicator.ID, indicator.Configs.BollingerBands) +// } +// if err != nil { +// return nil, err +// } +// response = append(response, indicatorCalculator) +// } +// return response, nil +//} diff --git a/services/chipmunk/internal/app/candles/workers/candleReader.go b/services/chipmunk/internal/app/candles/workers/candleReader.go index f6af472..9b8567b 100644 --- a/services/chipmunk/internal/app/candles/workers/candleReader.go +++ b/services/chipmunk/internal/app/candles/workers/candleReader.go @@ -10,7 +10,6 @@ import ( "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/candles/repository" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" - indicatorsPkg "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/indicators" coreApi "github.com/h-varmazyar/Gate/services/core/api/proto" log "github.com/sirupsen/logrus" "github.com/streadway/amqp" @@ -18,11 +17,11 @@ import ( ) type CandleReader struct { - db repository.CandleRepository - logger *log.Logger - configs *Configs - queue *amqpext.Queue - indicators []indicatorsPkg.Indicator + db repository.CandleRepository + logger *log.Logger + configs *Configs + queue *amqpext.Queue + //indicators []indicatorsPkg.Indicator insertChan chan *entity.Candle } @@ -42,9 +41,9 @@ func NewCandleReaderWorker(_ context.Context, db repository.CandleRepository, co return reader, nil } -func (w *CandleReader) Start(indicators []indicatorsPkg.Indicator) { +func (w *CandleReader) Start() { w.logger.Infof("starting candle reader worker...") - w.indicators = indicators + //w.indicators = indicators deliveries := w.queue.Consume(w.configs.PrimaryDataQueue) for i := 0; i < w.configs.ConsumerCount; i++ { go func() { @@ -79,9 +78,9 @@ func (w *CandleReader) handle(delivery amqp.Delivery) { w.insertChan <- tmp } - for _, indicator := range w.indicators { - indicator.Update(localCandles) - } + //for _, indicator := range w.indicators { + // indicator.Update(localCandles) + //} for _, candle := range localCandles { buffer.CandleBuffer.Push(candle) diff --git a/services/chipmunk/internal/app/candles/workersHelper.go b/services/chipmunk/internal/app/candles/workersHelper.go index b3935dd..32e5442 100644 --- a/services/chipmunk/internal/app/candles/workersHelper.go +++ b/services/chipmunk/internal/app/candles/workersHelper.go @@ -4,12 +4,10 @@ import ( "context" "github.com/google/uuid" api "github.com/h-varmazyar/Gate/api/proto" - "github.com/h-varmazyar/Gate/pkg/mapper" chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/candles/repository" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/candles/workers" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" - indicatorsPkg "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/indicators" coreApi "github.com/h-varmazyar/Gate/services/core/api/proto" "strings" "time" @@ -33,21 +31,20 @@ func (app *App) initializeWorkers(ctx context.Context, configs *workers.Configs, } func (app *App) startWorkers(ctx context.Context, dependencies *AppDependencies, platforms []api.Platform) error { - indicators, err := dependencies.IndicatorService.List(ctx, &chipmunkApi.IndicatorListReq{Type: chipmunkApi.Indicator_All}) - if err != nil { - app.logger.WithError(err).Error("failed to fetch all indicatorService") - return err - } + //indicators, err := dependencies.IndicatorService.List(ctx, &chipmunkApi.IndicatorListReq{Type: chipmunkApi.Indicator_All}) + //if err != nil { + // app.logger.WithError(err).Error("failed to fetch all indicatorService") + // return err + //} - loadedIndicators, err := app.loadIndicators(indicators.Elements) - if err != nil { - return err - } + //loadedIndicators, err := app.loadIndicators(indicators.Elements) + //if err != nil { + // return err + //} pp := make([]*workers.PlatformPairs, 0) for _, platform := range platforms { - pairs := new(workers.PlatformPairs) - pairs, err = app.preparePlatformPairs(ctx, dependencies, platform) + pairs, err := app.preparePlatformPairs(ctx, dependencies, platform) if err != nil { app.logger.WithError(err).Error("failed to prepare worker runners") return err @@ -56,10 +53,10 @@ func (app *App) startWorkers(ctx context.Context, dependencies *AppDependencies, pp = append(pp, pairs) } - app.candleReaderWorker.Start(loadedIndicators) + app.candleReaderWorker.Start() go func() { - predictedInterval := app.preparePrimaryDataRequests(pp, loadedIndicators) + predictedInterval := app.preparePrimaryDataRequests(pp) app.logger.Infof("predicted interval: %v", predictedInterval) time.Sleep(time.Duration(predictedInterval)) app.lastCandleWorker.Start(pp) @@ -134,45 +131,45 @@ func (app *App) prepareRunners(ctx context.Context, dependencies *AppDependencie return runners, nil } -func (app *App) loadIndicators(indicators []*chipmunkApi.Indicator) ([]indicatorsPkg.Indicator, error) { - response := make([]indicatorsPkg.Indicator, 0) - for _, i := range indicators { - var indicatorCalculator indicatorsPkg.Indicator - var err error - indicator := new(entity.Indicator) - mapper.Struct(i, indicator) - indicator.ID, err = uuid.Parse(i.ID) - if err != nil { - return nil, err - } - switch indicator.Type { - case chipmunkApi.Indicator_RSI: - indicatorCalculator, err = indicatorsPkg.NewRSI(indicator.ID, indicator.Configs.RSI) - case chipmunkApi.Indicator_Stochastic: - indicatorCalculator, err = indicatorsPkg.NewStochastic(indicator.ID, indicator.Configs.Stochastic) - case chipmunkApi.Indicator_MovingAverage: - indicatorCalculator, err = indicatorsPkg.NewMovingAverage(indicator.ID, indicator.Configs.MovingAverage) - case chipmunkApi.Indicator_BollingerBands: - indicatorCalculator, err = indicatorsPkg.NewBollingerBands(indicator.ID, indicator.Configs.BollingerBands) - } - if err != nil { - return nil, err - } - response = append(response, indicatorCalculator) - } - return response, nil -} +//func (app *App) loadIndicators(indicators []*chipmunkApi.Indicator) ([]indicatorsPkg.Indicator, error) { +// response := make([]indicatorsPkg.Indicator, 0) +// for _, i := range indicators { +// var indicatorCalculator indicatorsPkg.Indicator +// var err error +// indicator := new(entity.Indicator) +// mapper.Struct(i, indicator) +// indicator.ID, err = uuid.Parse(i.ID) +// if err != nil { +// return nil, err +// } +// switch indicator.Type { +// case chipmunkApi.Indicator_RSI: +// indicatorCalculator, err = indicatorsPkg.NewRSI(indicator.ID, indicator.Configs.RSI) +// case chipmunkApi.Indicator_Stochastic: +// indicatorCalculator, err = indicatorsPkg.NewStochastic(indicator.ID, indicator.Configs.Stochastic) +// case chipmunkApi.Indicator_MovingAverage: +// indicatorCalculator, err = indicatorsPkg.NewMovingAverage(indicator.ID, indicator.Configs.MovingAverage) +// case chipmunkApi.Indicator_BollingerBands: +// indicatorCalculator, err = indicatorsPkg.NewBollingerBands(indicator.ID, indicator.Configs.BollingerBands) +// } +// if err != nil { +// return nil, err +// } +// response = append(response, indicatorCalculator) +// } +// return response, nil +//} -func (app *App) preparePrimaryDataRequests(platformsPairs []*workers.PlatformPairs, indicators []indicatorsPkg.Indicator) int64 { +func (app *App) preparePrimaryDataRequests(platformsPairs []*workers.PlatformPairs) int64 { app.logger.Infof("preparing primary candles") totalPredictedInterval := int64(0) for _, platformPairs := range platformsPairs { - totalPredictedInterval += app.makePrimaryDataRequests(platformPairs, indicators) + totalPredictedInterval += app.makePrimaryDataRequests(platformPairs) } return totalPredictedInterval } -func (app *App) prepareLocalCandlesItem(pair *workers.Pair, indicators []indicatorsPkg.Indicator) (*coreApi.OHLCItem, error) { +func (app *App) prepareLocalCandlesItem(pair *workers.Pair) (*coreApi.OHLCItem, error) { marketID, err := uuid.Parse(pair.Market.ID) if err != nil { app.logger.WithError(err).Errorf("invalid market id %v", marketID) @@ -214,7 +211,7 @@ func (app *App) prepareLocalCandlesItem(pair *workers.Pair, indicators []indicat app.logger.Infof("loaded candles: %v", last) //for _, candle := range candles { - // candle.IndicatorValues = entity.NewIndicatorValues() + // candle.IndicatorValues = entities.NewIndicatorValues() //} //if len(candles) > 0 { // if err = app.calculateIndicators(candles, indicators); err != nil { @@ -256,21 +253,21 @@ func (app *App) loadLocalCandles(marketID, resolutionID uuid.UUID) ([]*entity.Ca return candles, nil } -func (app *App) calculateIndicators(candles []*entity.Candle, indicators []indicatorsPkg.Indicator) error { - for _, indicator := range indicators { - err := indicator.Calculate(candles) - if err != nil { - return err - } - } - return nil -} +//func (app *App) calculateIndicators(candles []*entity.Candle, indicators []indicatorsPkg.Indicator) error { +// for _, indicator := range indicators { +// err := indicator.Calculate(candles) +// if err != nil { +// return err +// } +// } +// return nil +//} -func (app *App) makePrimaryDataRequests(platformPairs *workers.PlatformPairs, indicators []indicatorsPkg.Indicator) int64 { +func (app *App) makePrimaryDataRequests(platformPairs *workers.PlatformPairs) int64 { predictedInterval := int64(0) for _, pair := range platformPairs.Pairs { app.logger.Infof("market: %v", pair.Market.Name) - item, err := app.prepareLocalCandlesItem(pair, indicators) + item, err := app.prepareLocalCandlesItem(pair) if err != nil { app.logger.WithError(err).Errorf("failed to prepare local candle item") continue diff --git a/services/chipmunk/internal/app/indicators/app.go b/services/chipmunk/internal/app/indicators/app.go index 4805246..c6307e0 100644 --- a/services/chipmunk/internal/app/indicators/app.go +++ b/services/chipmunk/internal/app/indicators/app.go @@ -2,22 +2,20 @@ package indicators import ( "context" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/indicators/repository" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/indicators/service" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/db" log "github.com/sirupsen/logrus" ) type App struct { - Service *service.Service + //Service *service.Service } func NewApp(ctx context.Context, logger *log.Logger, db *db.DB, configs Configs) (*App, error) { - repositoryInstance, err := repository.NewRepository(ctx, logger, db) - if err != nil { - return nil, err - } + //repositoryInstance, err := repository.NewRepository(ctx, logger, db) + //if err != nil { + // return nil, err + //} return &App{ - Service: service.NewService(ctx, logger, configs.ServiceConfigs, repositoryInstance), + //Service: service.NewService(ctx, logger, configs.ServiceConfigs, repositoryInstance), }, nil } diff --git a/services/chipmunk/internal/app/indicators/repository/postgres.go b/services/chipmunk/internal/app/indicators/repository/postgres.go index b861e2c..5bbd375 100644 --- a/services/chipmunk/internal/app/indicators/repository/postgres.go +++ b/services/chipmunk/internal/app/indicators/repository/postgres.go @@ -1,51 +1,52 @@ package repository -import ( - "context" - "github.com/google/uuid" - "github.com/h-varmazyar/Gate/pkg/errors" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" - log "github.com/sirupsen/logrus" - "google.golang.org/grpc/codes" - "gorm.io/gorm" -) - -type indicatorPostgresRepository struct { - db *gorm.DB - logger *log.Logger -} - -func NewIndicatorPostgresRepository(ctx context.Context, logger *log.Logger, db *gorm.DB) (IndicatorRepository, error) { - if db == nil { - return nil, errors.New(ctx, codes.Internal).AddDetailF("invalid db instance") - } - return &indicatorPostgresRepository{ - db: db, - logger: logger, - }, nil -} - -func (r *indicatorPostgresRepository) Create(indicator *entity.Indicator) error { - return r.db.Save(indicator).Error -} - -func (r *indicatorPostgresRepository) Return(indicatorID uuid.UUID) (*entity.Indicator, error) { - indicator := new(entity.Indicator) - return indicator, r.db.Model(new(entity.Indicator)).Where("id = ?", indicatorID).First(indicator).Error -} - -func (r *indicatorPostgresRepository) List(_ context.Context, indicatorType chipmunkApi.IndicatorType) ([]*entity.Indicator, error) { - indicators := make([]*entity.Indicator, 0) - tx := r.db.Model(new(entity.Indicator)) - if indicatorType != chipmunkApi.Indicator_All { - tx.Where("type = ?", indicatorType) - } - err := tx.Find(&indicators).Error - if err != nil { - r.logger.WithError(err).Error("failed to load indicator list") - return nil, err - } - - return indicators, nil -} +// +//import ( +// "context" +// "github.com/google/uuid" +// "github.com/h-varmazyar/Gate/pkg/errors" +// chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" +// log "github.com/sirupsen/logrus" +// "google.golang.org/grpc/codes" +// "gorm.io/gorm" +//) +// +//type indicatorPostgresRepository struct { +// db *gorm.DB +// logger *log.Logger +//} +// +//func NewIndicatorPostgresRepository(ctx context.Context, logger *log.Logger, db *gorm.DB) (IndicatorRepository, error) { +// if db == nil { +// return nil, errors.New(ctx, codes.Internal).AddDetailF("invalid db instance") +// } +// return &indicatorPostgresRepository{ +// db: db, +// logger: logger, +// }, nil +//} +// +//func (r *indicatorPostgresRepository) Create(indicator *entity.Indicator) error { +// return r.db.Save(indicator).Error +//} +// +//func (r *indicatorPostgresRepository) Return(indicatorID uuid.UUID) (*entity.Indicator, error) { +// indicator := new(entity.Indicator) +// return indicator, r.db.Model(new(entity.Indicator)).Where("id = ?", indicatorID).First(indicator).Error +//} +// +//func (r *indicatorPostgresRepository) List(_ context.Context, indicatorType chipmunkApi.IndicatorType) ([]*entity.Indicator, error) { +// indicators := make([]*entity.Indicator, 0) +// tx := r.db.Model(new(entity.Indicator)) +// if indicatorType != chipmunkApi.Indicator_All { +// tx.Where("type = ?", indicatorType) +// } +// err := tx.Find(&indicators).Error +// if err != nil { +// r.logger.WithError(err).Error("failed to load indicator list") +// return nil, err +// } +// +// return indicators, nil +//} diff --git a/services/chipmunk/internal/app/indicators/repository/repository.go b/services/chipmunk/internal/app/indicators/repository/repository.go index cb7eb97..1cea8d0 100644 --- a/services/chipmunk/internal/app/indicators/repository/repository.go +++ b/services/chipmunk/internal/app/indicators/repository/repository.go @@ -3,10 +3,8 @@ package repository import ( "context" "github.com/google/uuid" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/db" "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" - log "github.com/sirupsen/logrus" "gorm.io/gorm" ) @@ -15,15 +13,15 @@ const tableName = "indicators" type IndicatorRepository interface { Create(indicator *entity.Indicator) error Return(indicatorID uuid.UUID) (*entity.Indicator, error) - List(ctx context.Context, indicatorType chipmunkApi.IndicatorType) ([]*entity.Indicator, error) + //List(ctx context.Context, indicatorType chipmunkApi.IndicatorType) ([]*entity.Indicator, error) } -func NewRepository(ctx context.Context, logger *log.Logger, db *db.DB) (IndicatorRepository, error) { - if err := migration(ctx, db); err != nil { - return nil, err - } - return NewIndicatorPostgresRepository(ctx, logger, db.PostgresDB) -} +//func NewRepository(ctx context.Context, logger *log.Logger, db *db.DB) (IndicatorRepository, error) { +// if err := migration(ctx, db); err != nil { +// return nil, err +// } +// return NewIndicatorPostgresRepository(ctx, logger, db.PostgresDB) +//} func migration(_ context.Context, dbInstance *db.DB) error { var err error diff --git a/services/chipmunk/internal/app/indicators/service/service.go b/services/chipmunk/internal/app/indicators/service/service.go index 2ec66c7..052bd78 100644 --- a/services/chipmunk/internal/app/indicators/service/service.go +++ b/services/chipmunk/internal/app/indicators/service/service.go @@ -1,63 +1,64 @@ package service -import ( - "context" - "github.com/google/uuid" - "github.com/h-varmazyar/Gate/pkg/mapper" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/indicators/repository" - log "github.com/sirupsen/logrus" - "google.golang.org/grpc" -) - -type Service struct { - logger *log.Logger - configs Configs - db repository.IndicatorRepository -} - -var ( - GrpcService *Service -) - -func NewService(_ context.Context, logger *log.Logger, configs Configs, db repository.IndicatorRepository) *Service { - if GrpcService == nil { - GrpcService = new(Service) - GrpcService.logger = logger - GrpcService.configs = configs - GrpcService.db = db - } - return GrpcService -} - -func (s *Service) RegisterServer(server *grpc.Server) { - chipmunkApi.RegisterIndicatorServiceServer(server, s) -} - -func (s *Service) Return(_ context.Context, req *chipmunkApi.IndicatorReturnReq) (*chipmunkApi.Indicator, error) { - id, err := uuid.Parse(req.ID) - if err != nil { - return nil, err - } - - indicator, err := s.db.Return(id) - if err != nil { - return nil, err - } - response := new(chipmunkApi.Indicator) - mapper.Struct(indicator, response) - return response, nil -} - -func (s *Service) List(ctx context.Context, req *chipmunkApi.IndicatorListReq) (*chipmunkApi.Indicators, error) { - indicators, err := s.db.List(ctx, req.Type) - if err != nil { - s.logger.WithError(err).Errorf("failed to get list of indicators with type %v", req.Type) - return nil, err - } - - resp := new(chipmunkApi.Indicators) - mapper.Slice(indicators, &resp.Elements) - - return resp, nil -} +// +//import ( +// "context" +// "github.com/google/uuid" +// "github.com/h-varmazyar/Gate/pkg/mapper" +// chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/indicators/repository" +// log "github.com/sirupsen/logrus" +// "google.golang.org/grpc" +//) +// +//type Service struct { +// logger *log.Logger +// configs Configs +// db repository.IndicatorRepository +//} +// +//var ( +// GrpcService *Service +//) +// +//func NewService(_ context.Context, logger *log.Logger, configs Configs, db repository.IndicatorRepository) *Service { +// if GrpcService == nil { +// GrpcService = new(Service) +// GrpcService.logger = logger +// GrpcService.configs = configs +// GrpcService.db = db +// } +// return GrpcService +//} +// +//func (s *Service) RegisterServer(server *grpc.Server) { +// chipmunkApi.RegisterIndicatorServiceServer(server, s) +//} +// +//func (s *Service) Return(_ context.Context, req *chipmunkApi.IndicatorReturnReq) (*chipmunkApi.Indicator, error) { +// id, err := uuid.Parse(req.ID) +// if err != nil { +// return nil, err +// } +// +// indicator, err := s.db.Return(id) +// if err != nil { +// return nil, err +// } +// response := new(chipmunkApi.Indicator) +// mapper.Struct(indicator, response) +// return response, nil +//} +// +//func (s *Service) List(ctx context.Context, req *chipmunkApi.IndicatorListReq) (*chipmunkApi.Indicators, error) { +// indicators, err := s.db.List(ctx, req.Type) +// if err != nil { +// s.logger.WithError(err).Errorf("failed to get list of indicators with type %v", req.Type) +// return nil, err +// } +// +// resp := new(chipmunkApi.Indicators) +// mapper.Slice(indicators, &resp.Elements) +// +// return resp, nil +//} diff --git a/services/chipmunk/internal/app/markets/app.go b/services/chipmunk/internal/app/markets/app.go index 81201b9..9c6bea7 100644 --- a/services/chipmunk/internal/app/markets/app.go +++ b/services/chipmunk/internal/app/markets/app.go @@ -29,7 +29,7 @@ func NewApp(ctx context.Context, logger *log.Logger, db *db.DB, configs Configs, if err != nil { return nil, err } - + return &App{ Service: service.NewService(ctx, logger, configs.ServiceConfigs, repositoryInstance, dependencies.ServiceDependencies), }, nil diff --git a/services/chipmunk/internal/app/markets/service/service.go b/services/chipmunk/internal/app/markets/service/service.go index 6afc859..9c38609 100644 --- a/services/chipmunk/internal/app/markets/service/service.go +++ b/services/chipmunk/internal/app/markets/service/service.go @@ -9,7 +9,6 @@ import ( "github.com/h-varmazyar/Gate/pkg/mapper" chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" assets "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/assets/service" - indicators "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/indicators/service" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/markets/repository" "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/markets/workers" resolutions "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/resolutions/service" @@ -32,9 +31,9 @@ type Service struct { brokerageService coreApi.BrokerageServiceClient resolutionsService *resolutions.Service assetsService *assets.Service - indicatorsService *indicators.Service - logger *log.Logger - db repository.MarketRepository + //indicatorsService *indicators.Service + logger *log.Logger + db repository.MarketRepository } var ( @@ -42,8 +41,8 @@ var ( ) type Dependencies struct { - AssetsService *assets.Service - IndicatorsService *indicators.Service + AssetsService *assets.Service + //IndicatorsService *indicators.Service ResolutionsService *resolutions.Service //PrimaryDataWorker *workers.PrimaryDataWorker StatisticsWorker *workers.StatisticsWorker @@ -59,7 +58,7 @@ func NewService(_ context.Context, logger *log.Logger, configs *Configs, db repo GrpcService.strategyService = eagleApi.NewStrategyServiceClient(eagleConn) GrpcService.functionsService = coreApi.NewFunctionsServiceClient(coreConn) GrpcService.assetsService = dependencies.AssetsService - GrpcService.indicatorsService = dependencies.IndicatorsService + //GrpcService.indicatorsService = dependencies.IndicatorsService GrpcService.resolutionsService = dependencies.ResolutionsService GrpcService.db = db GrpcService.logger = logger @@ -201,7 +200,7 @@ func (s *Service) Update(ctx context.Context, req *chipmunkApi.MarketUpdateReq) // log.WithError(err).Errorf("failed to load or create destination for market %v", market.Name) // continue // } -// localMarket := new(entity.Market) +// localMarket := new(entities.Market) // mapper.Struct(market, localMarket) // localMarket.SourceID = source.ID // localMarket.DestinationID = destination.ID @@ -333,7 +332,7 @@ OUTER: // response := make(map[uuid.UUID]indicatorsPkg.Indicator) // for _, strategyIndicator := range strategyIndicators.Elements { // indicatorResp, err := s.indicatorsService.Return(ctx, &chipmunkApi.IndicatorReturnReq{ID: strategyIndicator.IndicatorID}) -// indicator := new(entity.Indicator) +// indicator := new(entities.Indicator) // mapper.Struct(indicatorResp, indicator) // if err != nil { // return nil, err diff --git a/services/chipmunk/internal/app/posts/app.go b/services/chipmunk/internal/app/posts/app.go new file mode 100644 index 0000000..40abfa4 --- /dev/null +++ b/services/chipmunk/internal/app/posts/app.go @@ -0,0 +1,24 @@ +package posts + +import ( + "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/posts/workers" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/db" + log "github.com/sirupsen/logrus" + "golang.org/x/net/context" +) + +type App struct { +} + +type AppDependencies struct { +} + +func NewApp(ctx context.Context, logger *log.Logger, configs Configs, db *db.DB, _ *AppDependencies) (*App, error) { + logger.Infof("initiating posts app") + collectorWorker := workers.NewCollector(ctx, logger, configs.WorkersConfigs, db) + collectorWorker.Start(ctx) + + //workers.NewSentimentFiller(logger, configs.WorkersConfigs, db).Start(ctx) + + return &App{}, nil +} diff --git a/services/chipmunk/internal/app/posts/configs.go b/services/chipmunk/internal/app/posts/configs.go new file mode 100644 index 0000000..5135973 --- /dev/null +++ b/services/chipmunk/internal/app/posts/configs.go @@ -0,0 +1,7 @@ +package posts + +import "github.com/h-varmazyar/Gate/services/chipmunk/internal/app/posts/workers" + +type Configs struct { + WorkersConfigs workers.Configs `mapstructure:"workers_configs"` +} diff --git a/services/chipmunk/internal/app/posts/service/configs.go b/services/chipmunk/internal/app/posts/service/configs.go new file mode 100644 index 0000000..7a2cfd2 --- /dev/null +++ b/services/chipmunk/internal/app/posts/service/configs.go @@ -0,0 +1,4 @@ +package service + +type Configs struct { +} diff --git a/services/chipmunk/internal/app/posts/service/service.go b/services/chipmunk/internal/app/posts/service/service.go new file mode 100644 index 0000000..6cb296a --- /dev/null +++ b/services/chipmunk/internal/app/posts/service/service.go @@ -0,0 +1,37 @@ +package service + +import ( + "context" + "github.com/h-varmazyar/Gate/pkg/errors" + chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" + log "github.com/sirupsen/logrus" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +type Service struct { + logger *log.Logger +} + +var ( + GrpcService *Service +) + +type Dependencies struct { +} + +func NewService(_ context.Context, logger *log.Logger, configs *Configs, dependencies *Dependencies) *Service { + if GrpcService == nil { + GrpcService = new(Service) + GrpcService.logger = logger + } + return GrpcService +} + +func (s *Service) RegisterServer(server *grpc.Server) { + chipmunkApi.RegisterPostServiceServer(server, s) +} + +func (s *Service) List(ctx context.Context, req *chipmunkApi.PostListReq) (*chipmunkApi.Posts, error) { + return nil, errors.New(ctx, codes.Unimplemented) +} diff --git a/services/chipmunk/internal/app/posts/workers/collector.go b/services/chipmunk/internal/app/posts/workers/collector.go new file mode 100644 index 0000000..8eb6530 --- /dev/null +++ b/services/chipmunk/internal/app/posts/workers/collector.go @@ -0,0 +1,217 @@ +package workers + +import ( + "encoding/csv" + "fmt" + "github.com/h-varmazyar/Gate/pkg/errors" + "github.com/h-varmazyar/Gate/pkg/grpcext" + chipmunkAPI "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/postProviders" + networkAPI "github.com/h-varmazyar/Gate/services/network/api/proto" + log "github.com/sirupsen/logrus" + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "os" + "strconv" + "strings" + "time" +) + +type PostCollector interface { + Collect(ctx context.Context, asset *chipmunkAPI.Asset, lastLoadedId string) +} + +type CollectorRepository interface { + SavePost(ctx context.Context, post *entity.Post) error + BatchSave(ctx context.Context, posts []entity.Post) error + OldestPost(ctx context.Context, provider chipmunkAPI.Provider) (*entity.Post, error) +} + +type Collector struct { + configs Configs + log *log.Logger + sahamyabPostCollector PostCollector + postCallbackChan chan *entity.Post + repository CollectorRepository +} + +func NewCollector(_ context.Context, log *log.Logger, configs Configs, repository CollectorRepository) *Collector { + return &Collector{ + configs: configs, + log: log, + postCallbackChan: make(chan *entity.Post, 10000), + repository: repository, + } +} + +func (w *Collector) Start(ctx context.Context) { + w.log.Infof("starting collector worker") + networkConn := grpcext.NewConnection(w.configs.NetworkAddress) + w.log.Infof("network address: %v", w.configs.NetworkAddress) + networkService := networkAPI.NewRequestServiceClient(networkConn) + go w.listenPostCallback(ctx) + go w.collectSahamyabPosts(ctx, networkService) +} + +func (w *Collector) listenPostCallback(ctx context.Context) { + if w.postCallbackChan == nil { + err := errors.New(ctx, codes.FailedPrecondition).AddDetails("nil post callback channel not acceptable") + w.log.WithError(err) + return + } + + //providersPosts := make(map[chipmunkAPI.Provider][]*entity.Post) + posts := make([]entity.Post, 0) + for { + select { + case post := <-w.postCallbackChan: + posts = append(posts, *post) + if len(posts) > 999 { + w.log.Infof("saving batch posts at %v", time.Now()) + if err := w.repository.BatchSave(ctx, posts); err != nil { + w.log.WithError(err).Errorf("failed to save post: %v", post) + } + posts = make([]entity.Post, 0) + } + //provider := post.Provider + ////if post.PostedAt.Before(lastDay) { + //// filename := lastDay.Format(time.DateOnly) + //// if err := w.savePosts(filename, providersPosts[provider]); err != nil { + //// w.log.WithError(err).Errorf("failed to save post of %v into %v", provider, filename) + //// } + //// lastDay.Add(-1 * time.Hour * 24) + //// providersPosts[provider] = make([]*entity.Post, 0) + ////} + // + //if posts, ok := providersPosts[provider]; !ok { + // providersPosts[provider] = make([]*entity.Post, 0) + //} else { + // providersPosts[provider] = append(providersPosts[provider], post) + // + // if len(posts) == 1000 { + // filename := fmt.Sprintf("%v%v", strings.ToLower(provider.String()), count) + // if err := w.savePosts(filename, providersPosts[provider]); err != nil { + // w.log.WithError(err).Errorf("failed to save post of %v into %v", provider, filename) + // } + // providersPosts[provider] = make([]*entity.Post, 0) + // count++ + // } + //} + + } + } +} + +func (w *Collector) collectTwitterPosts(ctx context.Context) error { + return errors.New(ctx, codes.Unimplemented) +} + +func (w *Collector) collectSahamyabPosts(ctx context.Context, networkService networkAPI.RequestServiceClient) { + w.log.Infof("initiating sahamyab collector") + + //oldestPost, err := w.repository.OldestPost(ctx, chipmunkAPI.Provider_SAHAMYAB) + //if err != nil { + // if !sysErr.Is(err, gorm.ErrRecordNotFound) { + // w.log.WithError(err).Error("failed to find oldest post") + // return + // } + // w.log.Warnf("no oldest posts found") + //} + + w.sahamyabPostCollector = postProviders.NewSahamyab(w.log, w.configs.SahamyabPostCollectorURL, networkService, w.postCallbackChan) + + w.sahamyabPostCollector.Collect(ctx, nil, "13220384") + +} + +func (w *Collector) collectCoinMarketCapPosts(ctx context.Context) error { + return errors.New(ctx, codes.Unimplemented) +} + +func (w *Collector) savePosts(filename string, posts []*entity.Post) error { + w.log.Infof("saving %v", filename) + if len(posts) == 0 { + return nil + } + if !strings.HasSuffix(filename, ".csv") { + filename += ".csv" + } + f, err := os.Create(filename) + defer func() { + _ = f.Close() + }() + if err != nil { + return err + } + + writer := csv.NewWriter(f) + + header := []string{ + "id", + "postedAt", + "content", + "likeCount", + "parentId", + "senderUsername", + "tags", + } + err = writer.Write(header) + if err != nil { + return err + } + + for _, post := range posts { + record := []string{ + post.Id, + fmt.Sprint(post.PostedAt.Unix()), + post.Content, + fmt.Sprint(post.LikeCount), + post.ParentId, + post.SenderUsername, + strings.Join(post.Tags, " "), + } + err = writer.Write(record) + if err != nil { + return err + } + } + + return nil +} + +func findLastLoadedId(provider chipmunkAPI.Provider) (string, error) { + info, err := os.ReadDir("./") + if err != nil { + return "", err + } + last := 0 + for _, entry := range info { + fmt.Println(entry.Name()) + if strings.HasPrefix(entry.Name(), strings.ToLower(provider.String())) { + found, err := strconv.Atoi(strings.TrimSuffix(strings.TrimPrefix(entry.Name(), strings.ToLower(provider.String())), ".csv")) + if err != nil { + return "", err + } + + if found > last { + last = found + } + } + } + + filename := fmt.Sprintf("%v%v.csv", strings.ToLower(provider.String()), last) + f, err := os.Open(filename) + if err != nil { + return "", err + } + defer f.Close() + + r := csv.NewReader(f) + records, err := r.ReadAll() + if err != nil { + return "", err + } + + return records[len(records)-1][0], nil +} diff --git a/services/chipmunk/internal/app/posts/workers/configs.go b/services/chipmunk/internal/app/posts/workers/configs.go new file mode 100644 index 0000000..92efeb5 --- /dev/null +++ b/services/chipmunk/internal/app/posts/workers/configs.go @@ -0,0 +1,8 @@ +package workers + +type Configs struct { + NetworkAddress string `mapstructure:"network_address"` + SahamyabPostCollectorURL string `mapstructure:"sahamyab_post_collector_url"` + MaxSentimentDetectorTokenLength int64 `mapstructure:"max_sentiment_detector_token_length"` + SentimentDetectorToken string `mapstructure:"sentiment_detector_token"` +} diff --git a/services/chipmunk/internal/app/posts/workers/sentiment_filler.go b/services/chipmunk/internal/app/posts/workers/sentiment_filler.go new file mode 100644 index 0000000..8dfd30a --- /dev/null +++ b/services/chipmunk/internal/app/posts/workers/sentiment_filler.go @@ -0,0 +1,89 @@ +package workers + +import ( + "errors" + "github.com/h-varmazyar/Gate/pkg/grpcext" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/llmAssists" + networkAPI "github.com/h-varmazyar/Gate/services/network/api/proto" + log "github.com/sirupsen/logrus" + "golang.org/x/net/context" + "time" +) + +var ( + ErrDetectorLimitReach = errors.New("detector limit reach") +) + +type SentimentDetector interface { + DetectEmotions(ctx context.Context, posts []*entity.Post) ([]*entity.Post, error) +} + +type SentimentFillerRepository interface { + SavePost(ctx context.Context, post *entity.Post) error + ReturnEmotionlessPost(ctx context.Context, maxLength int64) (*entity.Post, error) +} + +type SentimentFiller struct { + configs Configs + log *log.Logger + sentimentDetector SentimentDetector + repository SentimentFillerRepository +} + +func NewSentimentFiller(log *log.Logger, configs Configs, repository SentimentFillerRepository) *SentimentFiller { + return &SentimentFiller{ + configs: configs, + log: log, + repository: repository, + } +} + +func (w *SentimentFiller) Start(ctx context.Context) { + w.log.Infof("starting sentiment filler worker") + networkConn := grpcext.NewConnection(w.configs.NetworkAddress) + networkService := networkAPI.NewRequestServiceClient(networkConn) + w.sentimentDetector = llmAssists.NewGemini(w.log, w.configs.SentimentDetectorToken, networkService) + + go w.detectPostsSentiment(ctx) +} + +func (w *SentimentFiller) detectPostsSentiment(ctx context.Context) { + w.log.Infof("detecting emotionless posts sentiment") + + ticker := time.NewTicker(time.Second * 2) + for { + select { + case <-ticker.C: + emotionlessPosts := make([]*entity.Post, 0) + remainingCharLength := w.configs.MaxSentimentDetectorTokenLength + for remainingCharLength > 0 { + emotionlessPost, err := w.repository.ReturnEmotionlessPost(ctx, remainingCharLength) + if err != nil { + break + } + remainingCharLength -= int64(len(emotionlessPost.Content)) + } + + emotionalPosts, err := w.sentimentDetector.DetectEmotions(ctx, emotionlessPosts) + if err != nil { + w.log.WithError(err).Error("failed to detect emotion of post") + w.handleDetectorError(err) + continue + } + + for _, post := range emotionalPosts { + if err = w.repository.SavePost(ctx, post); err != nil { + w.log.WithError(err).Errorf("failed to save emotional post: %v", post.Id) + } + } + } + } +} + +func (w *SentimentFiller) handleDetectorError(err error) { + switch { + case errors.Is(err, ErrDetectorLimitReach): + time.Sleep(time.Minute * 2) + } +} diff --git a/services/chipmunk/internal/controller/post/controller.go b/services/chipmunk/internal/controller/post/controller.go new file mode 100644 index 0000000..7fbdda9 --- /dev/null +++ b/services/chipmunk/internal/controller/post/controller.go @@ -0,0 +1,32 @@ +package post + +import ( + "github.com/gin-gonic/gin" + "go.uber.org/fx" +) + +type Controller struct { +} + +type Params struct { + fx.In +} + +type Result struct { + fx.Out + + Controller *Controller +} + +func New(p Params) Result { + controller := &Controller{} + return Result{Controller: controller} +} + +func (c Controller) SubmitPolarity(ctx *gin.Context) { + +} + +func (c Controller) NonPolarityList(ctx *gin.Context) { + +} diff --git a/services/chipmunk/internal/controller/post/dto.go b/services/chipmunk/internal/controller/post/dto.go new file mode 100644 index 0000000..51571e9 --- /dev/null +++ b/services/chipmunk/internal/controller/post/dto.go @@ -0,0 +1,21 @@ +package post + +type CreateLinkReq struct { + Key string `json:"key"` + RealUrl string `json:"real_url"` +} + +type CreateLinkResp struct { + Url string + Key string + Immediate bool +} + +type FetchLinkReq struct { + Key string +} + +type Link struct { + Url string + Immediate bool +} diff --git a/services/chipmunk/internal/pkg/buffer/markets.go b/services/chipmunk/internal/pkg/buffer/markets.go index b58333d..4b3d0af 100644 --- a/services/chipmunk/internal/pkg/buffer/markets.go +++ b/services/chipmunk/internal/pkg/buffer/markets.go @@ -2,7 +2,7 @@ package buffer //type markets struct { // lock *sync.RWMutex -// data map[uuid.UUID][]*entity.Candle +// data map[uuid.UUID][]*entities.Candle // BufferLength int //} // @@ -11,7 +11,7 @@ package buffer //func NewMarketInstance() { // Markets = &markets{ // lock: new(sync.RWMutex), -// data: make(map[uuid.UUID][]*entity.Candle), +// data: make(map[uuid.UUID][]*entities.Candle), // BufferLength: configs.Variables.CandleBufferLength, // } //} @@ -21,9 +21,9 @@ package buffer // defer m.lock.Unlock() // rateLimiters, ok := m.data[marketID] // if !ok || rateLimiters == nil || len(rateLimiters) == 0 { -// emptyCandles := make([]*entity.Candle, 0) +// emptyCandles := make([]*entities.Candle, 0) // for i := 0; i < m.BufferLength; i++ { -// emptyCandles = append(emptyCandles, new(entity.Candle)) +// emptyCandles = append(emptyCandles, new(entities.Candle)) // } // m.data[marketID] = emptyCandles // } @@ -35,12 +35,12 @@ package buffer // delete(m.data, marketID) //} // -//func (m *markets) Push(marketID uuid.UUID, candle *entity.Candle) { +//func (m *markets) Push(marketID uuid.UUID, candle *entities.Candle) { // m.lock.Lock() // defer m.lock.Unlock() // rateLimiters, ok := m.data[marketID] // if !ok || rateLimiters == nil || len(rateLimiters) == 0 { -// rateLimiters = make([]*entity.Candle, m.BufferLength) +// rateLimiters = make([]*entities.Candle, m.BufferLength) // } // // if rateLimiters[m.BufferLength-1] != nil && rateLimiters[m.BufferLength-1].Time.Equal(candle.Time) { @@ -51,13 +51,13 @@ package buffer // m.data[marketID] = rateLimiters //} // -//func (m *markets) GetLastNCandles(marketID uuid.UUID, n int) []*entity.Candle { +//func (m *markets) GetLastNCandles(marketID uuid.UUID, n int) []*entities.Candle { // m.lock.Lock() // defer m.lock.Unlock() // if rateLimiters, ok := m.data[marketID]; !ok || rateLimiters == nil { // return nil // } else { -// cloned := make([]*entity.Candle, n) +// cloned := make([]*entities.Candle, n) // j := m.BufferLength - n // for i := 0; i < n; i++ { // c := *rateLimiters[j] diff --git a/services/chipmunk/internal/pkg/db/db.go b/services/chipmunk/internal/pkg/db/db.go index 2a34783..76b0c0c 100644 --- a/services/chipmunk/internal/pkg/db/db.go +++ b/services/chipmunk/internal/pkg/db/db.go @@ -21,6 +21,7 @@ func NewDatabase(ctx context.Context, configs gormext.Configs) (*DB, error) { } db.PostgresDB = postgres + log.Infof(configs.Name, configs.Host, configs.Password) err = createMigrateTable(ctx, db) if err != nil { return nil, err @@ -31,9 +32,13 @@ func NewDatabase(ctx context.Context, configs gormext.Configs) (*DB, error) { } func createMigrateTable(_ context.Context, db *DB) error { - err := db.PostgresDB.AutoMigrate(new(Migration)) - if err != nil { + if err := db.PostgresDB.AutoMigrate(new(Migration)); err != nil { return err } + + if err := db.postsMigrations(); err != nil { + return err + } + return nil } diff --git a/services/chipmunk/internal/pkg/db/migration.go b/services/chipmunk/internal/pkg/db/migration.go index 912337a..8825ce0 100644 --- a/services/chipmunk/internal/pkg/db/migration.go +++ b/services/chipmunk/internal/pkg/db/migration.go @@ -9,4 +9,7 @@ type Migration struct { Description string } -const MigrationTable = "migrations" +const ( + MigrationTable = "migrations" + postsTable = "posts" +) diff --git a/services/chipmunk/internal/pkg/db/posts.go b/services/chipmunk/internal/pkg/db/posts.go new file mode 100644 index 0000000..ece38ca --- /dev/null +++ b/services/chipmunk/internal/pkg/db/posts.go @@ -0,0 +1,86 @@ +package db + +import ( + "fmt" + chipmunkAPI "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" + log "github.com/sirupsen/logrus" + "golang.org/x/net/context" + "gorm.io/gorm" +) + +func (db *DB) postsMigrations() error { + log.Infof("migrating posts") + var err error + migrations := make(map[string]struct{}) + tags := make([]string, 0) + err = db.PostgresDB.Table(MigrationTable).Where("table_name = ?", postsTable).Select("tag").Find(&tags).Error + if err != nil { + return err + } + + for _, tag := range tags { + migrations[tag] = struct{}{} + } + + newMigrations := make([]*Migration, 0) + err = db.PostgresDB.Transaction(func(tx *gorm.DB) error { + if _, ok := migrations["v1.0.0"]; !ok { + log.Infof("migrating v1") + err = tx.AutoMigrate(new(entity.Post)) + if err != nil { + return err + } + newMigrations = append(newMigrations, &Migration{ + TableName: postsTable, + Tag: "v1.0.0", + Description: fmt.Sprintf("create %v table", postsTable), + }) + } + if _, ok := migrations["v1.1.0"]; !ok { + if !tx.Migrator().HasColumn(new(entity.Post), "sentiment") { + err = tx.Migrator().AddColumn(new(entity.Post), "sentiment") + } + if err != nil { + return err + } + newMigrations = append(newMigrations, &Migration{ + TableName: postsTable, + Tag: "v1.1.0", + Description: fmt.Sprintf("add sentiment column to %v table", postsTable), + }) + } + + err = tx.Model(new(Migration)).CreateInBatches(newMigrations, 100).Error + if err != nil { + return err + } + return nil + }) + if err != nil { + return err + } + + return nil +} + +func (db *DB) ReturnEmotionlessPost(_ context.Context, maxLength int64) (*entity.Post, error) { + post := new(entity.Post) + + return post, db.PostgresDB.Model(new(entity.Post)). + Where("sentiment = ?", chipmunkAPI.Polarity_NOT_DETECTED). + Where("length(content) < ?", maxLength).First(post).Error +} + +func (db *DB) SavePost(_ context.Context, post *entity.Post) error { + return db.PostgresDB.Save(post).Error +} + +func (db *DB) BatchSave(_ context.Context, posts []entity.Post) error { + return db.PostgresDB.CreateInBatches(posts, 1000).Error +} + +func (db *DB) OldestPost(_ context.Context, provider chipmunkAPI.Provider) (*entity.Post, error) { + post := new(entity.Post) + return post, db.PostgresDB.Model(new(entity.Post)).Where("provider = ?", provider).Order("id ASC").First(post).Error +} diff --git a/services/chipmunk/internal/pkg/entity/indicators.go b/services/chipmunk/internal/pkg/entity/indicators.go index b4109eb..eb579bb 100644 --- a/services/chipmunk/internal/pkg/entity/indicators.go +++ b/services/chipmunk/internal/pkg/entity/indicators.go @@ -2,13 +2,12 @@ package entity import ( "github.com/h-varmazyar/Gate/pkg/gormext" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" ) type Indicator struct { gormext.UniversalModel - Type chipmunkApi.IndicatorType `gorm:"type:varchar(25);not null"` - Configs *IndicatorConfigs `gorm:"embedded;embeddedPrefix:configs_"` + //Type chipmunkApi.IndicatorType `gorm:"type:varchar(25);not null"` + Configs *IndicatorConfigs `gorm:"embedded;embeddedPrefix:configs_"` } type IndicatorConfigs struct { @@ -30,13 +29,13 @@ type StochasticConfigs struct { type MovingAverageConfigs struct { Length int - Source chipmunkApi.Source + //Source chipmunkApi.Source } type BollingerBandsConfigs struct { Length int Deviation int - Source chipmunkApi.Source + //Source chipmunkApi.Source } type BollingerBandsValue struct { diff --git a/services/chipmunk/internal/pkg/entity/post.go b/services/chipmunk/internal/pkg/entity/post.go new file mode 100644 index 0000000..0cc09c9 --- /dev/null +++ b/services/chipmunk/internal/pkg/entity/post.go @@ -0,0 +1,21 @@ +package entity + +import ( + chipmunkAPI "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" + "github.com/lib/pq" + "gorm.io/gorm" + "time" +) + +type Post struct { + gorm.Model + Id string `gorm:"primarykey"` + PostedAt time.Time `gorm:"not null"` + Content string `gorm:"type:varchar(4094)"` + LikeCount uint32 `gorm:"default:0"` + ParentId string `gorm:"type:varchar(32)"` + SenderUsername string `gorm:"type:varchar(64)"` + Provider chipmunkAPI.Provider `gorm:"type:varchar(32)"` + Tags pq.StringArray `gorm:"type:varchar(32)[]"` + Sentiment chipmunkAPI.Polarity `gorm:"type:varchar(32)"` +} diff --git a/services/chipmunk/internal/pkg/indicators/bollingerBands.go b/services/chipmunk/internal/pkg/indicators/bollingerBands.go index dc67326..a417406 100644 --- a/services/chipmunk/internal/pkg/indicators/bollingerBands.go +++ b/services/chipmunk/internal/pkg/indicators/bollingerBands.go @@ -1,188 +1,188 @@ package indicators -import ( - "errors" - "github.com/google/uuid" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" - log "github.com/sirupsen/logrus" - "math" -) - -type bollingerBands struct { - id uuid.UUID - entity.BollingerBandsConfigs - sma *movingAverage -} - -func NewBollingerBands(id uuid.UUID, configs *entity.BollingerBandsConfigs) (*bollingerBands, error) { - if err := validateBollingerBandsConfigs(configs); err != nil { - return nil, err - } - return &bollingerBands{ - id: id, - BollingerBandsConfigs: *configs, - sma: &movingAverage{ - id: id, - MovingAverageConfigs: entity.MovingAverageConfigs{ - Length: configs.Length, - Source: configs.Source, - }, - }, - }, nil -} - -func (conf *bollingerBands) GetType() chipmunkApi.IndicatorType { - return chipmunkApi.Indicator_BollingerBands -} - -func (conf *bollingerBands) GetLength() int { - return conf.Length -} - -func (conf *bollingerBands) Calculate(candles []*entity.Candle) error { - if err := conf.validateBollingerBand(len(candles)); err != nil { - return err - } - _, err := conf.sma.sma(candles) - if err != nil { - return err - } - for i := conf.Length - 1; i < len(candles); i++ { - conf.calculateBB(candles[1+i-conf.Length : i+1]) - //variance := float64(0) - //ma := rateLimiters[i].MovingAverages[conf.id].Simple - //for j := 1 + i - conf.Length; j <= i; j++ { - // sum := float64(0) - // switch conf.Source { - // case chipmunkApi.Source_Open: - // sum = rateLimiters[j].Open - // case chipmunkApi.Source_High: - // sum = rateLimiters[j].High - // case chipmunkApi.Source_Low: - // sum = rateLimiters[j].Low - // case chipmunkApi.Source_Close: - // sum = rateLimiters[j].Close - // case chipmunkApi.Source_OHLC4: - // sum = (rateLimiters[j].Open + rateLimiters[j].High + rateLimiters[j].Low + rateLimiters[j].Close) / 4 - // case chipmunkApi.Source_HLC3: - // sum = (rateLimiters[j].Low + rateLimiters[j].High + rateLimiters[j].Close) / 3 - // case chipmunkApi.Source_HL2: - // sum = (rateLimiters[j].Low + rateLimiters[j].High) / 2 - // } - // variance += math.Pow(ma-sum, 2) - //} - //variance /= float64(conf.Length) - // - //if rateLimiters[i] == nil { - // log.Errorf("nil candle") - //} - // - //rateLimiters[i].BollingerBands[conf.id] = &entity.BollingerBandsValue{ - // UpperBand: ma + float64(conf.Deviation)*math.Sqrt(variance), - // LowerBand: ma - float64(conf.Deviation)*math.Sqrt(variance), - // MA: ma, - //} - } - return nil -} - -func (conf *bollingerBands) Update(candles []*entity.Candle) { - if len(candles) == 0 { - return - } - first := candles[0] - start := buffer.CandleBuffer.Before(first.MarketID.String(), first.ResolutionID.String(), first.Time, conf.Length-1) - if len(start) == 0 { - return - } - - internalCandles := append(start, candles...) - - _, err := conf.sma.sma(internalCandles) - if err != nil { - log.WithError(err).Error("failed to calculate sma for bollinger bands") - return - } - - for i := conf.Length - 1; i < len(internalCandles); i++ { - conf.calculateBB(candles[1+i-conf.Length : i+1]) - //variance := float64(0) - //ma := internalCandles[i].MovingAverages[conf.id].Simple - //for j := 1 + i - conf.Length; j <= i; j++ { - // sum := float64(0) - // switch conf.Source { - // case chipmunkApi.Source_Open: - // sum = rateLimiters[j].Open - // case chipmunkApi.Source_High: - // sum = rateLimiters[j].High - // case chipmunkApi.Source_Low: - // sum = rateLimiters[j].Low - // case chipmunkApi.Source_Close: - // sum = rateLimiters[j].Close - // case chipmunkApi.Source_OHLC4: - // sum = (rateLimiters[j].Open + rateLimiters[j].High + rateLimiters[j].Low + rateLimiters[j].Close) / 4 - // case chipmunkApi.Source_HLC3: - // sum = (rateLimiters[j].Low + rateLimiters[j].High + rateLimiters[j].Close) / 3 - // case chipmunkApi.Source_HL2: - // sum = (rateLimiters[j].Low + rateLimiters[j].High) / 2 - // } - // variance += math.Pow(ma-sum, 2) - //} - //variance /= float64(conf.Length) - // - //rateLimiters[i].BollingerBands[conf.id] = &entity.BollingerBandsValue{ - // UpperBand: ma + float64(conf.Deviation)*math.Sqrt(variance), - // LowerBand: ma - float64(conf.Deviation)*math.Sqrt(variance), - // MA: ma, - //} - } -} - -func (conf *bollingerBands) calculateBB(candles []*entity.Candle) { - variance := float64(0) - index := len(candles) - 1 - ma := candles[index].MovingAverages[conf.id].Simple - for j := 0; j < len(candles); j++ { - sum := float64(0) - switch conf.Source { - case chipmunkApi.Source_Open: - sum = candles[j].Open - case chipmunkApi.Source_High: - sum = candles[j].High - case chipmunkApi.Source_Low: - sum = candles[j].Low - case chipmunkApi.Source_Close: - sum = candles[j].Close - case chipmunkApi.Source_OHLC4: - sum = (candles[j].Open + candles[j].High + candles[j].Low + candles[j].Close) / 4 - case chipmunkApi.Source_HLC3: - sum = (candles[j].Low + candles[j].High + candles[j].Close) / 3 - case chipmunkApi.Source_HL2: - sum = (candles[j].Low + candles[j].High) / 2 - } - variance += math.Pow(ma-sum, 2) - } - variance /= float64(conf.Length) - - candles[index].BollingerBands[conf.id] = &entity.BollingerBandsValue{ - UpperBand: ma + float64(conf.Deviation)*math.Sqrt(variance), - LowerBand: ma - float64(conf.Deviation)*math.Sqrt(variance), - MA: ma, - } -} - -func (conf *bollingerBands) validateBollingerBand(length int) error { - if length < conf.Length { - return errors.New("length must be bigger than or equal to rateLimiters length") - } - if conf.Deviation < 1 { - return errors.New("deviation value must be positive") - } - return nil -} - -func validateBollingerBandsConfigs(indicator *entity.BollingerBandsConfigs) error { - return nil -} +// +//import ( +// "errors" +// "github.com/google/uuid" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" +// log "github.com/sirupsen/logrus" +// "math" +//) +// +//type bollingerBands struct { +// id uuid.UUID +// entity.BollingerBandsConfigs +// sma *movingAverage +//} +// +//func NewBollingerBands(id uuid.UUID, configs *entity.BollingerBandsConfigs) (*bollingerBands, error) { +// if err := validateBollingerBandsConfigs(configs); err != nil { +// return nil, err +// } +// return &bollingerBands{ +// id: id, +// BollingerBandsConfigs: *configs, +// sma: &movingAverage{ +// id: id, +// MovingAverageConfigs: entity.MovingAverageConfigs{ +// Length: configs.Length, +// //Source: configs.Source, +// }, +// }, +// }, nil +//} +// +////func (conf *bollingerBands) GetType() chipmunkApi.IndicatorType { +//// return chipmunkApi.Indicator_BollingerBands +////} +// +//func (conf *bollingerBands) GetLength() int { +// return conf.Length +//} +// +//func (conf *bollingerBands) Calculate(candles []*entity.Candle) error { +// if err := conf.validateBollingerBand(len(candles)); err != nil { +// return err +// } +// _, err := conf.sma.sma(candles) +// if err != nil { +// return err +// } +// for i := conf.Length - 1; i < len(candles); i++ { +// conf.calculateBB(candles[1+i-conf.Length : i+1]) +// //variance := float64(0) +// //ma := rateLimiters[i].MovingAverages[conf.id].Simple +// //for j := 1 + i - conf.Length; j <= i; j++ { +// // sum := float64(0) +// // switch conf.Source { +// // case chipmunkApi.Source_Open: +// // sum = rateLimiters[j].Open +// // case chipmunkApi.Source_High: +// // sum = rateLimiters[j].High +// // case chipmunkApi.Source_Low: +// // sum = rateLimiters[j].Low +// // case chipmunkApi.Source_Close: +// // sum = rateLimiters[j].Close +// // case chipmunkApi.Source_OHLC4: +// // sum = (rateLimiters[j].Open + rateLimiters[j].High + rateLimiters[j].Low + rateLimiters[j].Close) / 4 +// // case chipmunkApi.Source_HLC3: +// // sum = (rateLimiters[j].Low + rateLimiters[j].High + rateLimiters[j].Close) / 3 +// // case chipmunkApi.Source_HL2: +// // sum = (rateLimiters[j].Low + rateLimiters[j].High) / 2 +// // } +// // variance += math.Pow(ma-sum, 2) +// //} +// //variance /= float64(conf.Length) +// // +// //if rateLimiters[i] == nil { +// // log.Errorf("nil candle") +// //} +// // +// //rateLimiters[i].BollingerBands[conf.id] = &entities.BollingerBandsValue{ +// // UpperBand: ma + float64(conf.Deviation)*math.Sqrt(variance), +// // LowerBand: ma - float64(conf.Deviation)*math.Sqrt(variance), +// // MA: ma, +// //} +// } +// return nil +//} +// +//func (conf *bollingerBands) Update(candles []*entity.Candle) { +// if len(candles) == 0 { +// return +// } +// first := candles[0] +// start := buffer.CandleBuffer.Before(first.MarketID.String(), first.ResolutionID.String(), first.Time, conf.Length-1) +// if len(start) == 0 { +// return +// } +// +// internalCandles := append(start, candles...) +// +// _, err := conf.sma.sma(internalCandles) +// if err != nil { +// log.WithError(err).Error("failed to calculate sma for bollinger bands") +// return +// } +// +// for i := conf.Length - 1; i < len(internalCandles); i++ { +// conf.calculateBB(candles[1+i-conf.Length : i+1]) +// //variance := float64(0) +// //ma := internalCandles[i].MovingAverages[conf.id].Simple +// //for j := 1 + i - conf.Length; j <= i; j++ { +// // sum := float64(0) +// // switch conf.Source { +// // case chipmunkApi.Source_Open: +// // sum = rateLimiters[j].Open +// // case chipmunkApi.Source_High: +// // sum = rateLimiters[j].High +// // case chipmunkApi.Source_Low: +// // sum = rateLimiters[j].Low +// // case chipmunkApi.Source_Close: +// // sum = rateLimiters[j].Close +// // case chipmunkApi.Source_OHLC4: +// // sum = (rateLimiters[j].Open + rateLimiters[j].High + rateLimiters[j].Low + rateLimiters[j].Close) / 4 +// // case chipmunkApi.Source_HLC3: +// // sum = (rateLimiters[j].Low + rateLimiters[j].High + rateLimiters[j].Close) / 3 +// // case chipmunkApi.Source_HL2: +// // sum = (rateLimiters[j].Low + rateLimiters[j].High) / 2 +// // } +// // variance += math.Pow(ma-sum, 2) +// //} +// //variance /= float64(conf.Length) +// // +// //rateLimiters[i].BollingerBands[conf.id] = &entities.BollingerBandsValue{ +// // UpperBand: ma + float64(conf.Deviation)*math.Sqrt(variance), +// // LowerBand: ma - float64(conf.Deviation)*math.Sqrt(variance), +// // MA: ma, +// //} +// } +//} +// +//func (conf *bollingerBands) calculateBB(candles []*entity.Candle) { +// variance := float64(0) +// index := len(candles) - 1 +// ma := candles[index].MovingAverages[conf.id].Simple +// for j := 0; j < len(candles); j++ { +// sum := float64(0) +// //switch conf.Source { +// //case chipmunkApi.Source_Open: +// // sum = candles[j].Open +// //case chipmunkApi.Source_High: +// // sum = candles[j].High +// //case chipmunkApi.Source_Low: +// // sum = candles[j].Low +// //case chipmunkApi.Source_Close: +// // sum = candles[j].Close +// //case chipmunkApi.Source_OHLC4: +// // sum = (candles[j].Open + candles[j].High + candles[j].Low + candles[j].Close) / 4 +// //case chipmunkApi.Source_HLC3: +// // sum = (candles[j].Low + candles[j].High + candles[j].Close) / 3 +// //case chipmunkApi.Source_HL2: +// // sum = (candles[j].Low + candles[j].High) / 2 +// //} +// variance += math.Pow(ma-sum, 2) +// } +// variance /= float64(conf.Length) +// +// candles[index].BollingerBands[conf.id] = &entity.BollingerBandsValue{ +// UpperBand: ma + float64(conf.Deviation)*math.Sqrt(variance), +// LowerBand: ma - float64(conf.Deviation)*math.Sqrt(variance), +// MA: ma, +// } +//} +// +//func (conf *bollingerBands) validateBollingerBand(length int) error { +// if length < conf.Length { +// return errors.New("length must be bigger than or equal to rateLimiters length") +// } +// if conf.Deviation < 1 { +// return errors.New("deviation value must be positive") +// } +// return nil +//} +// +//func validateBollingerBandsConfigs(indicator *entity.BollingerBandsConfigs) error { +// return nil +//} diff --git a/services/chipmunk/internal/pkg/indicators/indicator.go b/services/chipmunk/internal/pkg/indicators/indicator.go index 4d745c5..36bf92f 100644 --- a/services/chipmunk/internal/pkg/indicators/indicator.go +++ b/services/chipmunk/internal/pkg/indicators/indicator.go @@ -1,13 +1,13 @@ package indicators -import ( - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" -) - -type Indicator interface { - Calculate([]*entity.Candle) error - Update([]*entity.Candle) - GetType() chipmunkApi.IndicatorType - GetLength() int -} +//import ( +// chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" +//) +// +//type Indicator interface { +// Calculate([]*entity.Candle) error +// Update([]*entity.Candle) +// GetType() chipmunkApi.IndicatorType +// GetLength() int +//} diff --git a/services/chipmunk/internal/pkg/indicators/movingAverage.go b/services/chipmunk/internal/pkg/indicators/movingAverage.go index 691e7cb..8f706f5 100644 --- a/services/chipmunk/internal/pkg/indicators/movingAverage.go +++ b/services/chipmunk/internal/pkg/indicators/movingAverage.go @@ -1,177 +1,178 @@ package indicators -import ( - "errors" - "fmt" - "github.com/google/uuid" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" - log "github.com/sirupsen/logrus" -) - -type movingAverage struct { - id uuid.UUID - entity.MovingAverageConfigs - factor float64 -} - -func NewMovingAverage(id uuid.UUID, configs *entity.MovingAverageConfigs) (*movingAverage, error) { - return &movingAverage{ - id: id, - MovingAverageConfigs: *configs, - factor: 2 / float64(configs.Length+1), - }, nil -} - -func (conf *movingAverage) GetType() chipmunkApi.IndicatorType { - return chipmunkApi.Indicator_MovingAverage -} - -func (conf *movingAverage) GetLength() int { - return conf.Length -} - -func (conf *movingAverage) sma(candles []*entity.Candle) ([]float64, error) { - //todo: return value must be delete - response := make([]float64, len(candles)) - if err := conf.validateMA(len(candles)); err != nil { - return nil, err - } - for i := conf.Length - 1; i < len(candles); i++ { - sum := float64(0) - for _, innerCandle := range candles[i-conf.Length+1 : i+1] { - switch conf.Source { - case chipmunkApi.Source_Close: - sum += innerCandle.Close - case chipmunkApi.Source_Open: - sum += innerCandle.Open - case chipmunkApi.Source_High: - sum += innerCandle.High - case chipmunkApi.Source_Low: - sum += innerCandle.Low - case chipmunkApi.Source_HL2: - sum += (innerCandle.High + innerCandle.Low) / 2 - case chipmunkApi.Source_HLC3: - sum += (innerCandle.High + innerCandle.Low + innerCandle.Close) / 3 - case chipmunkApi.Source_OHLC4: - sum += (innerCandle.Open + innerCandle.Close + innerCandle.High + innerCandle.Low) / 4 - } - } - if candles[i].MovingAverages[conf.id] == nil { - candles[i].MovingAverages[conf.id] = new(entity.MovingAverageValue) - } - candles[i].MovingAverages[conf.id].Simple = sum / float64(conf.Length) - response[i] = sum / float64(conf.Length) - } - return response, nil -} - -//func (conf *movingAverage) updateSMA(rateLimiters []*entity.Candle) float64 { -// smaConf := movingAverage{ -// id: uuid.New(), -// MovingAverageConfigs: conf.MovingAverageConfigs, +// +//import ( +// "errors" +// "fmt" +// "github.com/google/uuid" +// chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" +// log "github.com/sirupsen/logrus" +//) +// +//type movingAverage struct { +// id uuid.UUID +// entity.MovingAverageConfigs +// factor float64 +//} +// +//func NewMovingAverage(id uuid.UUID, configs *entity.MovingAverageConfigs) (*movingAverage, error) { +// return &movingAverage{ +// id: id, +// MovingAverageConfigs: *configs, +// factor: 2 / float64(configs.Length+1), +// }, nil +//} +// +//func (conf *movingAverage) GetType() chipmunkApi.IndicatorType { +// return chipmunkApi.Indicator_MovingAverage +//} +// +//func (conf *movingAverage) GetLength() int { +// return conf.Length +//} +// +//func (conf *movingAverage) sma(candles []*entity.Candle) ([]float64, error) { +// //todo: return value must be delete +// response := make([]float64, len(candles)) +// if err := conf.validateMA(len(candles)); err != nil { +// return nil, err // } -// if sma, err := smaConf.sma(rateLimiters); err != nil { -// return float64(0) -// } else { -// return sma[len(rateLimiters)-1] +// for i := conf.Length - 1; i < len(candles); i++ { +// sum := float64(0) +// for _, innerCandle := range candles[i-conf.Length+1 : i+1] { +// switch conf.Source { +// case chipmunkApi.Source_Close: +// sum += innerCandle.Close +// case chipmunkApi.Source_Open: +// sum += innerCandle.Open +// case chipmunkApi.Source_High: +// sum += innerCandle.High +// case chipmunkApi.Source_Low: +// sum += innerCandle.Low +// case chipmunkApi.Source_HL2: +// sum += (innerCandle.High + innerCandle.Low) / 2 +// case chipmunkApi.Source_HLC3: +// sum += (innerCandle.High + innerCandle.Low + innerCandle.Close) / 3 +// case chipmunkApi.Source_OHLC4: +// sum += (innerCandle.Open + innerCandle.Close + innerCandle.High + innerCandle.Low) / 4 +// } +// } +// if candles[i].MovingAverages[conf.id] == nil { +// candles[i].MovingAverages[conf.id] = new(entity.MovingAverageValue) +// } +// candles[i].MovingAverages[conf.id].Simple = sum / float64(conf.Length) +// response[i] = sum / float64(conf.Length) +// } +// return response, nil +//} +// +////func (conf *movingAverage) updateSMA(rateLimiters []*entities.Candle) float64 { +//// smaConf := movingAverage{ +//// id: uuid.New(), +//// MovingAverageConfigs: conf.MovingAverageConfigs, +//// } +//// if sma, err := smaConf.sma(rateLimiters); err != nil { +//// return float64(0) +//// } else { +//// return sma[len(rateLimiters)-1] +//// } +////} +// +//func (conf *movingAverage) Calculate(candles []*entity.Candle) error { +// //values := make([]*entities.MovingAverageValue, 0) +// //var sma []float64 +// var err error +// for i := 0; i < len(candles); i++ { +// if candles[i].MovingAverages[conf.id] == nil { +// candles[i].MovingAverages[conf.id] = new(entity.MovingAverageValue) +// } +// } +// //if sma, err = conf.sma(rateLimiters, conf.id); err != nil { +// if _, err = conf.sma(candles); err != nil { +// log.WithError(err).Errorf("failed to calculate sma for moving average %v", conf.id) +// return err +// } +// //for _, value := range sma { +// // values = append(values, &entities.MovingAverageValue{ +// // Simple: value, +// // }) +// //} +// candles[conf.Length-1].MovingAverages[conf.id].Exponential = candles[conf.Length-1].MovingAverages[conf.id].Simple +// +// for i := conf.Length; i < len(candles); i++ { +// conf.calculateEMA(candles[i], candles[i-1]) +// } +// +// //for i := 0; i < len(rateLimiters); i++ { +// // rateLimiters[i].MovingAverages[conf.id] = &entities.MovingAverageValue{ +// // Simple: values[i].Simple, +// // Exponential: values[i].Exponential, +// // } +// //} +// return nil +//} +// +//func (conf *movingAverage) Update(candles []*entity.Candle) { +// if len(candles) == 0 { +// return +// } +// first := candles[0] +// start := buffer.CandleBuffer.Before(first.MarketID.String(), first.ResolutionID.String(), first.Time, conf.Length-1) +// if len(start) == 0 { +// return +// } +// +// internalCandles := append(start, candles...) +// +// _, err := conf.sma(internalCandles) +// if err != nil { +// log.WithError(err).Errorf("failed to calculate sma") +// return +// } +// +// for i := conf.Length - 1; i < len(internalCandles); i++ { +// conf.calculateEMA(candles[i-1], candles[i]) +// } +//} +// +//func (conf *movingAverage) calculateEMA(candle1, candle2 *entity.Candle) { +// price := float64(0) +// switch conf.Source { +// case chipmunkApi.Source_Close: +// price = candle2.Close +// case chipmunkApi.Source_Open: +// price = candle2.Open +// case chipmunkApi.Source_High: +// price = candle2.High +// case chipmunkApi.Source_Low: +// price = candle2.Low +// case chipmunkApi.Source_HL2: +// price = (candle2.High + candle2.Low) / 2 +// case chipmunkApi.Source_HLC3: +// price = (candle2.High + candle2.Low + candle2.Close) / 3 +// case chipmunkApi.Source_OHLC4: +// price = (candle2.Open + candle2.High + candle2.Low + candle2.Close) / 4 +// } +// candle2.MovingAverages[conf.id].Exponential = price*conf.factor + candle1.MovingAverages[conf.id].Exponential*(1-conf.factor) +//} +// +//func (conf *movingAverage) validateMA(length int) error { +// if length < conf.Length { +// return errors.New(fmt.Sprintf("rateLimiters length must be grater or equal than %d", conf.Length)) +// } +// switch conf.Source { +// case chipmunkApi.Source_Close, +// chipmunkApi.Source_Open, +// chipmunkApi.Source_High, +// chipmunkApi.Source_Low, +// chipmunkApi.Source_HL2, +// chipmunkApi.Source_HLC3, +// chipmunkApi.Source_OHLC4, +// chipmunkApi.Source_Custom: +// return nil +// default: +// return errors.New(fmt.Sprintf("moving average source not valid: %s", conf.Source)) // } //} - -func (conf *movingAverage) Calculate(candles []*entity.Candle) error { - //values := make([]*entity.MovingAverageValue, 0) - //var sma []float64 - var err error - for i := 0; i < len(candles); i++ { - if candles[i].MovingAverages[conf.id] == nil { - candles[i].MovingAverages[conf.id] = new(entity.MovingAverageValue) - } - } - //if sma, err = conf.sma(rateLimiters, conf.id); err != nil { - if _, err = conf.sma(candles); err != nil { - log.WithError(err).Errorf("failed to calculate sma for moving average %v", conf.id) - return err - } - //for _, value := range sma { - // values = append(values, &entity.MovingAverageValue{ - // Simple: value, - // }) - //} - candles[conf.Length-1].MovingAverages[conf.id].Exponential = candles[conf.Length-1].MovingAverages[conf.id].Simple - - for i := conf.Length; i < len(candles); i++ { - conf.calculateEMA(candles[i], candles[i-1]) - } - - //for i := 0; i < len(rateLimiters); i++ { - // rateLimiters[i].MovingAverages[conf.id] = &entity.MovingAverageValue{ - // Simple: values[i].Simple, - // Exponential: values[i].Exponential, - // } - //} - return nil -} - -func (conf *movingAverage) Update(candles []*entity.Candle) { - if len(candles) == 0 { - return - } - first := candles[0] - start := buffer.CandleBuffer.Before(first.MarketID.String(), first.ResolutionID.String(), first.Time, conf.Length-1) - if len(start) == 0 { - return - } - - internalCandles := append(start, candles...) - - _, err := conf.sma(internalCandles) - if err != nil { - log.WithError(err).Errorf("failed to calculate sma") - return - } - - for i := conf.Length - 1; i < len(internalCandles); i++ { - conf.calculateEMA(candles[i-1], candles[i]) - } -} - -func (conf *movingAverage) calculateEMA(candle1, candle2 *entity.Candle) { - price := float64(0) - switch conf.Source { - case chipmunkApi.Source_Close: - price = candle2.Close - case chipmunkApi.Source_Open: - price = candle2.Open - case chipmunkApi.Source_High: - price = candle2.High - case chipmunkApi.Source_Low: - price = candle2.Low - case chipmunkApi.Source_HL2: - price = (candle2.High + candle2.Low) / 2 - case chipmunkApi.Source_HLC3: - price = (candle2.High + candle2.Low + candle2.Close) / 3 - case chipmunkApi.Source_OHLC4: - price = (candle2.Open + candle2.High + candle2.Low + candle2.Close) / 4 - } - candle2.MovingAverages[conf.id].Exponential = price*conf.factor + candle1.MovingAverages[conf.id].Exponential*(1-conf.factor) -} - -func (conf *movingAverage) validateMA(length int) error { - if length < conf.Length { - return errors.New(fmt.Sprintf("rateLimiters length must be grater or equal than %d", conf.Length)) - } - switch conf.Source { - case chipmunkApi.Source_Close, - chipmunkApi.Source_Open, - chipmunkApi.Source_High, - chipmunkApi.Source_Low, - chipmunkApi.Source_HL2, - chipmunkApi.Source_HLC3, - chipmunkApi.Source_OHLC4, - chipmunkApi.Source_Custom: - return nil - default: - return errors.New(fmt.Sprintf("moving average source not valid: %s", conf.Source)) - } -} diff --git a/services/chipmunk/internal/pkg/indicators/rsi.go b/services/chipmunk/internal/pkg/indicators/rsi.go index b396066..b717e0b 100644 --- a/services/chipmunk/internal/pkg/indicators/rsi.go +++ b/services/chipmunk/internal/pkg/indicators/rsi.go @@ -1,105 +1,106 @@ package indicators -import ( - "errors" - "github.com/google/uuid" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" -) - -type rsi struct { - id uuid.UUID - entity.RsiConfigs -} - -func NewRSI(id uuid.UUID, configs *entity.RsiConfigs) (*rsi, error) { - return &rsi{ - id: id, - RsiConfigs: *configs, - }, nil -} - -func (conf *rsi) GetType() chipmunkApi.IndicatorType { - return chipmunkApi.Indicator_RSI -} - -func (conf *rsi) GetLength() int { - return conf.Length -} - -func (conf *rsi) Calculate(candles []*entity.Candle) error { - if err := conf.validateRSI(len(candles)); err != nil { - return err - } - - { //first RSI - gain := float64(0) - loss := float64(0) - for i := 1; i <= conf.Length; i++ { - if change := candles[i].Close - candles[i-1].Close; change > 0 { - gain += change - } else { - loss += change - } - } - loss *= -1 - gain = gain / float64(conf.Length) - loss = loss / float64(conf.Length) - rs := gain / loss - candles[conf.Length].RSIs[conf.id] = &entity.RSIValue{ - Gain: gain, - Loss: loss, - RSI: 100 - (100 / (1 + rs)), - } - } - - for i := conf.Length + 1; i < len(candles); i++ { - conf.calculateRSIValue(candles[i-1], candles[i]) - } - return nil -} - -func (conf *rsi) Update(candles []*entity.Candle) { - if len(candles) == 0 { - return - } - - start := buffer.CandleBuffer.Before(candles[0].MarketID.String(), candles[0].ResolutionID.String(), candles[0].Time, 1) - - if len(start) == 0 { - return - } - - internalCandles := append(start, candles...) - - for i := 1; i < len(internalCandles); i++ { - conf.calculateRSIValue(internalCandles[i-1], internalCandles[i]) - } -} - -func (conf *rsi) validateRSI(length int) error { - if length-1 < conf.Length { - return errors.New("rateLimiters length must bigger than indicators period length") - } - return nil -} - -func (conf *rsi) calculateRSIValue(candle1, candle2 *entity.Candle) { - gain, loss := float64(0), float64(0) - if change := candle2.Close - candle1.Close; change > 0 { - gain = change - } else { - loss = change - } - avgGain := (candle1.RSIs[conf.id].Gain*float64(conf.Length-1) + gain) / float64(conf.Length) - avgLoss := (candle1.RSIs[conf.id].Loss*float64(conf.Length-1) - loss) / float64(conf.Length) - rs := avgGain / avgLoss - rsiValue := 100 - (100 / (1 + rs)) - - candle2.RSIs[conf.id] = &entity.RSIValue{ - Gain: avgGain, - Loss: avgLoss, - RSI: rsiValue, - } -} +// +//import ( +// "errors" +// "github.com/google/uuid" +// chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" +//) +// +//type rsi struct { +// id uuid.UUID +// entity.RsiConfigs +//} +// +//func NewRSI(id uuid.UUID, configs *entity.RsiConfigs) (*rsi, error) { +// return &rsi{ +// id: id, +// RsiConfigs: *configs, +// }, nil +//} +// +//func (conf *rsi) GetType() chipmunkApi.IndicatorType { +// return chipmunkApi.Indicator_RSI +//} +// +//func (conf *rsi) GetLength() int { +// return conf.Length +//} +// +//func (conf *rsi) Calculate(candles []*entity.Candle) error { +// if err := conf.validateRSI(len(candles)); err != nil { +// return err +// } +// +// { //first RSI +// gain := float64(0) +// loss := float64(0) +// for i := 1; i <= conf.Length; i++ { +// if change := candles[i].Close - candles[i-1].Close; change > 0 { +// gain += change +// } else { +// loss += change +// } +// } +// loss *= -1 +// gain = gain / float64(conf.Length) +// loss = loss / float64(conf.Length) +// rs := gain / loss +// candles[conf.Length].RSIs[conf.id] = &entity.RSIValue{ +// Gain: gain, +// Loss: loss, +// RSI: 100 - (100 / (1 + rs)), +// } +// } +// +// for i := conf.Length + 1; i < len(candles); i++ { +// conf.calculateRSIValue(candles[i-1], candles[i]) +// } +// return nil +//} +// +//func (conf *rsi) Update(candles []*entity.Candle) { +// if len(candles) == 0 { +// return +// } +// +// start := buffer.CandleBuffer.Before(candles[0].MarketID.String(), candles[0].ResolutionID.String(), candles[0].Time, 1) +// +// if len(start) == 0 { +// return +// } +// +// internalCandles := append(start, candles...) +// +// for i := 1; i < len(internalCandles); i++ { +// conf.calculateRSIValue(internalCandles[i-1], internalCandles[i]) +// } +//} +// +//func (conf *rsi) validateRSI(length int) error { +// if length-1 < conf.Length { +// return errors.New("rateLimiters length must bigger than indicators period length") +// } +// return nil +//} +// +//func (conf *rsi) calculateRSIValue(candle1, candle2 *entity.Candle) { +// gain, loss := float64(0), float64(0) +// if change := candle2.Close - candle1.Close; change > 0 { +// gain = change +// } else { +// loss = change +// } +// avgGain := (candle1.RSIs[conf.id].Gain*float64(conf.Length-1) + gain) / float64(conf.Length) +// avgLoss := (candle1.RSIs[conf.id].Loss*float64(conf.Length-1) - loss) / float64(conf.Length) +// rs := avgGain / avgLoss +// rsiValue := 100 - (100 / (1 + rs)) +// +// candle2.RSIs[conf.id] = &entity.RSIValue{ +// Gain: avgGain, +// Loss: avgLoss, +// RSI: rsiValue, +// } +//} diff --git a/services/chipmunk/internal/pkg/indicators/stochastics.go b/services/chipmunk/internal/pkg/indicators/stochastics.go index 40ed248..0a3bbf4 100644 --- a/services/chipmunk/internal/pkg/indicators/stochastics.go +++ b/services/chipmunk/internal/pkg/indicators/stochastics.go @@ -1,136 +1,137 @@ package indicators -import ( - "errors" - "github.com/google/uuid" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" - "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" - "math" -) - -type stochastic struct { - id uuid.UUID - entity.StochasticConfigs -} - -func NewStochastic(id uuid.UUID, configs *entity.StochasticConfigs) (*stochastic, error) { - if err := validateStochasticConfigs(configs); err != nil { - return nil, err - } - return &stochastic{ - id: id, - StochasticConfigs: *configs, - }, nil -} - -func (conf *stochastic) GetType() chipmunkApi.IndicatorType { - return chipmunkApi.Indicator_Stochastic -} - -func (conf *stochastic) GetLength() int { - return conf.Length -} - -func (conf *stochastic) validateStochastic(length int) error { - if length <= conf.Length { - return errors.New("rateLimiters length must bigger or equal than indicators period length") - } - if conf.SmoothK >= conf.Length { - return errors.New("smoothK parameter must be smaller than indicators period length") - } - if conf.SmoothD >= conf.Length { - return errors.New("smoothD parameter must be smaller than indicators period length") - } - return nil -} - -func (conf *stochastic) Calculate(candles []*entity.Candle) error { - if err := conf.validateStochastic(len(candles)); err != nil { - return err - } - for _, candle := range candles { - if candle.Stochastics[conf.id] == nil { - candle.Stochastics[conf.id] = new(entity.StochasticValue) - } - } - - conf.calculateStochastic(candles) - - return nil -} - -func (conf *stochastic) Update(candles []*entity.Candle) { - first := candles[0] - start := buffer.CandleBuffer.Before(first.MarketID.String(), first.ResolutionID.String(), first.Time, conf.Length) - - internalCandles := append(start, candles...) - - conf.calculateStochastic(internalCandles) -} - -func (conf *stochastic) calculateStochastic(candles []*entity.Candle) { - for i := conf.Length - 1; i < len(candles); i++ { - lowest := math.MaxFloat64 - highest := float64(0) - for j := i - (conf.Length - 1); j <= i; j++ { - if candles[j].Low < lowest { - lowest = candles[j].Low - } - if candles[j].High > highest { - highest = candles[j].High - } - } - stochasticValue := new(entity.StochasticValue) - stochasticValue.FastK = 100 * ((candles[i].Close - lowest) / (highest - lowest)) - - sum := stochasticValue.FastK - for j := i - conf.SmoothK + 1; j < i; j++ { - sum += candles[j].Stochastics[conf.id].FastK - } - stochasticValue.IndexK = sum / float64(conf.SmoothK) - stochasticValue.IndexD = calculateIndexD(conf.id, candles[i-conf.SmoothD+1:i+1]) - - candles[i].Stochastics[conf.id] = stochasticValue - } -} - -//func (conf *stochastic) Update(rateLimiters []*entity.Candle) { -// lowest := math.MaxFloat64 -// highest := float64(0) -// lastIndex := len(rateLimiters) - 1 -// for i := len(rateLimiters) - conf.Length; i < len(rateLimiters); i++ { -// if rateLimiters[i].Low < lowest { -// lowest = rateLimiters[i].Low -// } -// if rateLimiters[i].High > highest { -// highest = rateLimiters[i].High +// +//import ( +// "errors" +// "github.com/google/uuid" +// chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/buffer" +// "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" +// "math" +//) +// +//type stochastic struct { +// id uuid.UUID +// entity.StochasticConfigs +//} +// +//func NewStochastic(id uuid.UUID, configs *entity.StochasticConfigs) (*stochastic, error) { +// if err := validateStochasticConfigs(configs); err != nil { +// return nil, err +// } +// return &stochastic{ +// id: id, +// StochasticConfigs: *configs, +// }, nil +//} +// +//func (conf *stochastic) GetType() chipmunkApi.IndicatorType { +// return chipmunkApi.Indicator_Stochastic +//} +// +//func (conf *stochastic) GetLength() int { +// return conf.Length +//} +// +//func (conf *stochastic) validateStochastic(length int) error { +// if length <= conf.Length { +// return errors.New("rateLimiters length must bigger or equal than indicators period length") +// } +// if conf.SmoothK >= conf.Length { +// return errors.New("smoothK parameter must be smaller than indicators period length") +// } +// if conf.SmoothD >= conf.Length { +// return errors.New("smoothD parameter must be smaller than indicators period length") +// } +// return nil +//} +// +//func (conf *stochastic) Calculate(candles []*entity.Candle) error { +// if err := conf.validateStochastic(len(candles)); err != nil { +// return err +// } +// for _, candle := range candles { +// if candle.Stochastics[conf.id] == nil { +// candle.Stochastics[conf.id] = new(entity.StochasticValue) // } // } -// fastK := 100 * ((rateLimiters[lastIndex].Close - lowest) / (highest - lowest)) // -// sum := fastK -// for j := len(rateLimiters) - conf.SmoothK; j < len(rateLimiters)-1; j++ { -// sum += rateLimiters[j].Stochastics[conf.id].FastK +// conf.calculateStochastic(candles) +// +// return nil +//} +// +//func (conf *stochastic) Update(candles []*entity.Candle) { +// first := candles[0] +// start := buffer.CandleBuffer.Before(first.MarketID.String(), first.ResolutionID.String(), first.Time, conf.Length) +// +// internalCandles := append(start, candles...) +// +// conf.calculateStochastic(internalCandles) +//} +// +//func (conf *stochastic) calculateStochastic(candles []*entity.Candle) { +// for i := conf.Length - 1; i < len(candles); i++ { +// lowest := math.MaxFloat64 +// highest := float64(0) +// for j := i - (conf.Length - 1); j <= i; j++ { +// if candles[j].Low < lowest { +// lowest = candles[j].Low +// } +// if candles[j].High > highest { +// highest = candles[j].High +// } +// } +// stochasticValue := new(entity.StochasticValue) +// stochasticValue.FastK = 100 * ((candles[i].Close - lowest) / (highest - lowest)) +// +// sum := stochasticValue.FastK +// for j := i - conf.SmoothK + 1; j < i; j++ { +// sum += candles[j].Stochastics[conf.id].FastK +// } +// stochasticValue.IndexK = sum / float64(conf.SmoothK) +// stochasticValue.IndexD = calculateIndexD(conf.id, candles[i-conf.SmoothD+1:i+1]) +// +// candles[i].Stochastics[conf.id] = stochasticValue // } +//} +// +////func (conf *stochastic) Update(rateLimiters []*entities.Candle) { +//// lowest := math.MaxFloat64 +//// highest := float64(0) +//// lastIndex := len(rateLimiters) - 1 +//// for i := len(rateLimiters) - conf.Length; i < len(rateLimiters); i++ { +//// if rateLimiters[i].Low < lowest { +//// lowest = rateLimiters[i].Low +//// } +//// if rateLimiters[i].High > highest { +//// highest = rateLimiters[i].High +//// } +//// } +//// fastK := 100 * ((rateLimiters[lastIndex].Close - lowest) / (highest - lowest)) +//// +//// sum := fastK +//// for j := len(rateLimiters) - conf.SmoothK; j < len(rateLimiters)-1; j++ { +//// sum += rateLimiters[j].Stochastics[conf.id].FastK +//// } +//// +//// return &entities.IndicatorValue{ +//// Stochastic: &entities.StochasticValue{ +//// IndexK: sum / float64(conf.SmoothK), +//// IndexD: calculateIndexD(conf.id, rateLimiters[lastIndex-conf.SmoothD+1:]), +//// FastK: fastK, +//// }, +//// } +////} // -// return &entity.IndicatorValue{ -// Stochastic: &entity.StochasticValue{ -// IndexK: sum / float64(conf.SmoothK), -// IndexD: calculateIndexD(conf.id, rateLimiters[lastIndex-conf.SmoothD+1:]), -// FastK: fastK, -// }, +//func calculateIndexD(id uuid.UUID, candles []*entity.Candle) float64 { +// sum := float64(0) +// for _, candle := range candles { +// sum += candle.Stochastics[id].IndexK // } +// return sum / float64(len(candles)) +//} +// +//func validateStochasticConfigs(indicator *entity.StochasticConfigs) error { +// return nil //} - -func calculateIndexD(id uuid.UUID, candles []*entity.Candle) float64 { - sum := float64(0) - for _, candle := range candles { - sum += candle.Stochastics[id].IndexK - } - return sum / float64(len(candles)) -} - -func validateStochasticConfigs(indicator *entity.StochasticConfigs) error { - return nil -} diff --git a/services/chipmunk/internal/pkg/llmAssists/gemini.go b/services/chipmunk/internal/pkg/llmAssists/gemini.go new file mode 100644 index 0000000..ee30966 --- /dev/null +++ b/services/chipmunk/internal/pkg/llmAssists/gemini.go @@ -0,0 +1,60 @@ +package llmAssists + +import ( + "errors" + "fmt" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" + networkAPI "github.com/h-varmazyar/Gate/services/network/api/proto" + log "github.com/sirupsen/logrus" + "golang.org/x/net/context" + "strings" +) + +type Gemini struct { + log *log.Logger + networkService networkAPI.RequestServiceClient + token string +} + +var errEmptyPosts = errors.New("empty posts") + +var ( + requestTokenTemplate = ` + describe the sentiment of below posts in the format of json like this: +[ +"id":"sentiment status(positive, negative or neutral)" +] + +each posts in the format of {id}- {content} + +%v +` +) + +func NewGemini(log *log.Logger, token string, networkService networkAPI.RequestServiceClient) *Gemini { + return &Gemini{ + log: log, + networkService: networkService, + token: token, + } +} + +func (g *Gemini) DetectEmotions(ctx context.Context, posts []*entity.Post) ([]*entity.Post, error) { + if len(posts) == 0 { + return nil, errEmptyPosts + } + + prompt := g.prepareRequestBody(ctx, posts) + fmt.Println(prompt) + + return nil, nil +} + +func (g *Gemini) prepareRequestBody(_ context.Context, posts []*entity.Post) string { + texts := "" + for _, post := range posts { + texts = fmt.Sprintf("%v\n\n%v- %v", texts, post.Id, post.Content) + } + + return fmt.Sprintf(requestTokenTemplate, strings.TrimSpace(texts)) +} diff --git a/services/chipmunk/internal/pkg/postProviders/sahamyab.go b/services/chipmunk/internal/pkg/postProviders/sahamyab.go new file mode 100644 index 0000000..b9e9ddc --- /dev/null +++ b/services/chipmunk/internal/pkg/postProviders/sahamyab.go @@ -0,0 +1,287 @@ +package postProviders + +import ( + "encoding/json" + "fmt" + "github.com/h-varmazyar/Gate/pkg/errors" + chipmunkAPI "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/pkg/entity" + networkAPI "github.com/h-varmazyar/Gate/services/network/api/proto" + log "github.com/sirupsen/logrus" + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "net/http" + "strconv" + "strings" + "time" +) + +type Sahamyab struct { + PostsCollectorURL string + SinglePostCollectorURL string + NetworkService networkAPI.RequestServiceClient + PostCallbackChan chan *entity.Post + Log *log.Logger + page int64 + //lastId string +} + +type PostResp struct { + ErrorCode string `json:"errorCode"` + ErrorTitle string `json:"errorTitle"` + HasMore bool `json:"hasMore"` + Items []*Item `json:"items"` + Success bool `json:"success"` + *Item +} + +type Item struct { + Id string `json:"id"` + Content string `json:"content"` + SendTime string `json:"sendTime"` + SenderUsername string `json:"senderUsername"` + Type string `json:"type"` + Advertise bool `json:"advertise"` + ParentId string `json:"parentId"` + LikeCount string `json:"likeCount"` +} + +func NewSahamyab(log *log.Logger, postCollectorURL string, networkService networkAPI.RequestServiceClient, postCallbackChan chan *entity.Post) *Sahamyab { + return &Sahamyab{ + PostsCollectorURL: postCollectorURL, + SinglePostCollectorURL: "https://www.sahamyab.com/guest/twiter/item?v=0.1", + NetworkService: networkService, + PostCallbackChan: postCallbackChan, + Log: log, + } +} + +func (c *Sahamyab) Collect(_ context.Context, _ *chipmunkAPI.Asset, lastLoadedId string) { + c.Log.Infof("collecting sahamyab posts. last id is %v", lastLoadedId) + c.page = int64(12) + + lastId, err := strconv.Atoi(lastLoadedId) + if err != nil { + return + } + + ticker := time.NewTicker(time.Second / 20) + for { + select { + case <-ticker.C: + if time.Now().Hour() == 8 { + c.Log.Infof("sleeping in market time...") + time.Sleep(time.Hour * 7) + c.Log.Infof("resuming after market time...") + } + go c.sendRequest(context.Background(), lastId) + } + lastId++ + } +} + +func (c *Sahamyab) sendRequest(ctx context.Context, lastId int) { + req := &networkAPI.Request{ + Method: networkAPI.Request_POST, + Headers: c.prepareHeaders(), + Params: c.prepareParams(fmt.Sprintf("%v", lastId)), + IssueTime: time.Now().Unix(), + } + if c.SinglePostCollectorURL != "" { + req.Endpoint = c.SinglePostCollectorURL + } else { + req.Endpoint = c.PostsCollectorURL + } + resp, err := c.NetworkService.Do(ctx, req) + if err != nil { + c.handleErr(ctx, err) + return + } + if resp.GetCode() == http.StatusOK { + posts, err := c.parseResponseBody(ctx, resp.GetBody()) + if err != nil || len(posts) == 0 { + return + } + err = c.publishPosts(ctx, posts) + if err != nil { + c.Log.WithError(err).Errorf("failed to publish sahamyab post") + return + } + } else { + c.handleFailedStatus(ctx, resp.GetCode()) + } +} + +func (c *Sahamyab) prepareHeaders() []*networkAPI.KV { + return []*networkAPI.KV{ + { + Key: "Accept", + Value: &networkAPI.KV_String_{String_: "application/json, text/plain, */*"}, + }, + //{ + // Key: "Accept-Encoding", + // Value: &networkAPI.KV_String_{String_: "gzip, deflate, br"}, + //}, + //{ + // Key: "Accept-Language", + // Value: &networkAPI.KV_String_{String_: "en-US,en;q=0.9"}, + //}, + //{ + // Key: "Content-Type", + // Value: &networkAPI.KV_String_{String_: "application/json"}, + //}, + //{ + // Key: "Origin", + // Value: &networkAPI.KV_String_{String_: "https://www.sahamyab.com"}, + //}, + //{ + // Key: "User-Agent", + // Value: &networkAPI.KV_String_{String_: "Mozilla/6.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/637.36"}, + //}, + //{ + // Key: "Referer", + // Value: &networkAPI.KV_String_{String_: "https://www.sahamyab.com/stocktwits"}, + //}, + //{ + // Key: "Sec-Ch-Ua", + // Value: &networkAPI.KV_String_{String_: `"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"`}, + //}, + //{ + // Key: "Sec-Ch-Ua-Mobile", + // Value: &networkAPI.KV_String_{String_: "?0"}, + //}, + //{ + // Key: "Sec-Ch-Ua-Platform", + // Value: &networkAPI.KV_String_{String_: "Linux"}, + //}, + //{ + // Key: "Cookie", + // Value: &networkAPI.KV_String_{String_: "_ga_EF12XEFLM6=GS1.1.1683704333.1.0.1683704333.0.0.0; _gid=GA1.2.577816098.1707575453; _gat_UA-39858392-1=1; _ga=GA1.2.1926163846.1686639997; _ga_15TLTHGBVQ=GS1.1.1707575452.57.1.1707575506.0.0.0"}, + //}, + //{ + // Key: "", + // Value: &networkAPI.KV_String_{String_: ""}, + //}, + //{ + // Key: "", + // Value: &networkAPI.KV_String_{String_: ""}, + //}, + } +} + +func (c *Sahamyab) prepareParams(lastId string) []*networkAPI.KV { + params := make([]*networkAPI.KV, 0) + + pageKV := &networkAPI.KV{ + Key: "page", + Value: &networkAPI.KV_Integer{Integer: c.page}, + } + params = append(params, pageKV) + if lastId != "" { + lastIdKV := &networkAPI.KV{ + Key: "id", + Value: &networkAPI.KV_String_{String_: lastId}, + } + params = append(params, lastIdKV) + } + + return params +} + +func (c *Sahamyab) parseResponseBody(ctx context.Context, body string) ([]*entity.Post, error) { + resp := new(PostResp) + if err := json.Unmarshal([]byte(body), resp); err != nil { + c.Log.WithError(err).Errorf("failed to parse response") + return nil, err + } + + if !resp.Success { + return nil, errors.New(ctx, codes.Unknown).AddDetails("unsuccessful data gathering") + } + + posts := make([]*entity.Post, 0) + + if len(resp.Items) > 0 { + for _, item := range resp.Items { + if item.Advertise { + continue + } + + if post := c.parsePost(item); post != nil { + posts = append(posts, post) + } + } + } else { + posts = append(posts, c.parsePost(resp.Item)) + } + + return posts, nil +} + +func (c *Sahamyab) parsePost(item *Item) *entity.Post { + if !hasValidContent(item.Content) { + return nil + } + + sendTime, err := time.Parse(time.RFC3339, item.SendTime) + if err != nil { + c.Log.Infof("failed to parse time: %v", err) + return nil + } + + likeCount, _ := strconv.Atoi(item.LikeCount) + + return &entity.Post{ + Id: item.Id, + PostedAt: sendTime, + Content: item.Content, + LikeCount: uint32(likeCount), + ParentId: item.ParentId, + SenderUsername: item.SenderUsername, + Provider: chipmunkAPI.Provider_SAHAMYAB, + Tags: fetchTags(item.Content), + } +} + +func (c *Sahamyab) publishPosts(ctx context.Context, posts []*entity.Post) error { + if c.PostCallbackChan == nil { + return errors.New(ctx, codes.FailedPrecondition).AddDetails("nil post callback channel for sahamyab") + } + for _, post := range posts { + if post != nil { + c.PostCallbackChan <- post + } + } + return nil +} + +func (c *Sahamyab) handleErr(_ context.Context, err error) { + c.Log.WithError(err).Errorf("sahamyab do request error") +} + +func (c *Sahamyab) handleFailedStatus(_ context.Context, code int32) { + c.Log.Errorf("sahamyab status code error: %v", code) + switch code { + case 429: + c.page++ + if c.page == 13 { + c.page = 0 + time.Sleep(time.Hour * 3) + } + } +} + +func hasValidContent(content string) bool { + strings.ReplaceAll(content, "\n", " ") + return len(strings.Split(content, " ")) > 2 +} + +func fetchTags(content string) []string { + tags := make([]string, 0) + for _, word := range strings.Split(content, " ") { + if strings.HasPrefix(word, "#") { + tags = append(tags, word) + } + } + return tags +} diff --git a/services/chipmunk/internal/router/router.go b/services/chipmunk/internal/router/router.go new file mode 100644 index 0000000..d0bcdb2 --- /dev/null +++ b/services/chipmunk/internal/router/router.go @@ -0,0 +1,77 @@ +package router + +import ( + "context" + "fmt" + "github.com/gin-gonic/gin" + "github.com/google/martian/log" + "go.uber.org/fx" + "net" + "net/http" +) + +type Router struct { + v1 V1 +} + +type Params struct { + fx.In + + GinEngine *gin.Engine + V1 V1 +} + +type Result struct { + fx.Out + + Router *Router +} + +func New(lc fx.Lifecycle, params Params) Result { + router := &Router{ + v1: params.V1, + } + router.RegisterRoutes(params.GinEngine) + + srv := &http.Server{ + Addr: ":8765", + Handler: params.GinEngine, + } + + lc.Append(fx.Hook{ + OnStart: func(ctx context.Context) error { + ln, err := net.Listen("tcp", srv.Addr) + if err != nil { + fmt.Println("[My Demo] Failed to start HTTP Server at", srv.Addr) + return err + } + go srv.Serve(ln) + fmt.Println("[My Demo]Succeeded to start HTTP Server at", srv.Addr) + return nil + }, + OnStop: func(ctx context.Context) error { + return srv.Shutdown(ctx) + }, + }) + + return Result{Router: router} +} + +func (r *Router) RegisterRoutes(ginRouter *gin.Engine) { + log.Infof("********** registering routes") + ginRouter.Use(func(c *gin.Context) { + c.Writer.Header().Set("Access-Control-Allow-Origin", "*") + c.Writer.Header().Set("Access-Control-Allow-Credentials", "true") + c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With") + c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, DELETE, PATCH") + + if c.Request.Method == "OPTIONS" { + c.AbortWithStatus(http.StatusNoContent) + return + } + + c.Next() + }) + apiRouter := ginRouter.Group("/api") + r.v1.RegisterRoutes(apiRouter) +} diff --git a/services/chipmunk/internal/router/v1.go b/services/chipmunk/internal/router/v1.go new file mode 100644 index 0000000..30acc2a --- /dev/null +++ b/services/chipmunk/internal/router/v1.go @@ -0,0 +1,41 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "github.com/h-varmazyar/Gate/services/chipmunk/internal/controller/post" + "go.uber.org/fx" +) + +type V1 struct { + postsController post.Controller +} + +type V1Params struct { + fx.In + + PostsController post.Controller +} + +type V1Result struct { + fx.Out + + V1Router *V1 +} + +func NewV1(params V1Params) V1Result { + router := &V1{ + postsController: params.PostsController, + } + + return V1Result{V1Router: router} +} + +func (r *V1) RegisterRoutes(ginRouter *gin.RouterGroup) { + v1Router := ginRouter.Group("/v1") + + { + posts := v1Router.Group("/posts") + posts.POST("/polarity", r.postsController.SubmitPolarity) + posts.GET("/non-polarity", r.postsController.NonPolarityList) + } +} diff --git a/services/eagle/internal/pkg/entity/strategy.go b/services/eagle/internal/pkg/entity/strategy.go index 5300b6c..fe7e4a5 100644 --- a/services/eagle/internal/pkg/entity/strategy.go +++ b/services/eagle/internal/pkg/entity/strategy.go @@ -3,7 +3,6 @@ package entity import ( "github.com/google/uuid" "github.com/h-varmazyar/Gate/pkg/gormext" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" eagleApi "github.com/h-varmazyar/Gate/services/eagle/api/proto" "github.com/lib/pq" ) @@ -26,7 +25,7 @@ type Strategy struct { } type StrategyIndicator struct { - StrategyID uuid.UUID `gorm:"primary_key;type:uuid REFERENCES strategies(id)"` - IndicatorID uuid.UUID `gorm:"primary_key;type:uuid"` - Type chipmunkApi.IndicatorType `gorm:"type:varchar(25);not null"` + StrategyID uuid.UUID `gorm:"primary_key;type:uuid REFERENCES strategies(id)"` + IndicatorID uuid.UUID `gorm:"primary_key;type:uuid"` + //Type chipmunkApi.IndicatorType `gorm:"type:varchar(25);not null"` } diff --git a/services/eagle/internal/pkg/strategies/automatedStrategy/automated.go b/services/eagle/internal/pkg/strategies/automatedStrategy/automated.go index bb3ecd0..b3d58f9 100644 --- a/services/eagle/internal/pkg/strategies/automatedStrategy/automated.go +++ b/services/eagle/internal/pkg/strategies/automatedStrategy/automated.go @@ -132,19 +132,19 @@ func (s *Automated) CheckForSignals(ctx context.Context, market *chipmunkApi.Mar func (s *Automated) calculateSignalStrength(candles []*chipmunkApi.Candle, market *chipmunkApi.Market) float64 { strength := float64(0) rsi, stochastic, bb := float64(0), float64(0), float64(0) - for _, strategyIndicator := range s.Indicators { - switch strategyIndicator.Type { - case chipmunkApi.Indicator_RSI: - rsi = s.checkRSI(candles, strategyIndicator.IndicatorID) - strength += rsi - case chipmunkApi.Indicator_Stochastic: - stochastic = s.checkStochastic(candles, strategyIndicator.IndicatorID) - strength += stochastic - case chipmunkApi.Indicator_BollingerBands: - bb = s.checkBollingerBand(candles, strategyIndicator.IndicatorID, market.MakerFeeRate, market.TakerFeeRate) - strength += bb - } - } + //for _, strategyIndicator := range s.Indicators { + // switch strategyIndicator.Type { + // case chipmunkApi.Indicator_RSI: + // rsi = s.checkRSI(candles, strategyIndicator.IndicatorID) + // strength += rsi + // case chipmunkApi.Indicator_Stochastic: + // stochastic = s.checkStochastic(candles, strategyIndicator.IndicatorID) + // strength += stochastic + // case chipmunkApi.Indicator_BollingerBands: + // bb = s.checkBollingerBand(candles, strategyIndicator.IndicatorID, market.MakerFeeRate, market.TakerFeeRate) + // strength += bb + // } + //} strength = strength / float64(len(s.Indicators)) log.Infof("market %v - total: %v - rsi: %v - stochastic: %v - bb: %v", market.Name, strength, rsi, stochastic, bb) return strength @@ -314,36 +314,36 @@ func (s *Automated) setSignalIntoPool(ctx context.Context, market *chipmunkApi.M } func (s *Automated) checkRSI(candles []*chipmunkApi.Candle, indicatorID uuid.UUID) float64 { - if chipmunkApi.GetRSIValue(candles[0].IndicatorValues[indicatorID.String()]).RSI < 30 && - chipmunkApi.GetRSIValue(candles[1].IndicatorValues[indicatorID.String()]).RSI >= 30 { - return 1 - } + //if chipmunkApi.GetRSIValue(candles[0].IndicatorValues[indicatorID.String()]).RSI < 30 && + // chipmunkApi.GetRSIValue(candles[1].IndicatorValues[indicatorID.String()]).RSI >= 30 { + // return 1 + //} return 0 } func (s *Automated) checkStochastic(candles []*chipmunkApi.Candle, indicatorID uuid.UUID) float64 { - stochastic0 := chipmunkApi.GetStochasticValue(candles[0].IndicatorValues[indicatorID.String()]) - stochastic1 := chipmunkApi.GetStochasticValue(candles[1].IndicatorValues[indicatorID.String()]) - if stochastic1.IndexD > 20 || stochastic0.IndexK > 20 { - return 0 - } - if stochastic0.IndexK < stochastic1.IndexK { - return 1 - } + //stochastic0 := chipmunkApi.GetStochasticValue(candles[0].IndicatorValues[indicatorID.String()]) + //stochastic1 := chipmunkApi.GetStochasticValue(candles[1].IndicatorValues[indicatorID.String()]) + //if stochastic1.IndexD > 20 || stochastic0.IndexK > 20 { + // return 0 + //} + //if stochastic0.IndexK < stochastic1.IndexK { + // return 1 + //} return 0 } func (s *Automated) checkBollingerBand(candles []*chipmunkApi.Candle, indicatorID uuid.UUID, makerFeeRate, takerFeeRate float64) float64 { - bb0 := chipmunkApi.GetBollingerBandsValue(candles[0].IndicatorValues[indicatorID.String()]) - bb1 := chipmunkApi.GetBollingerBandsValue(candles[1].IndicatorValues[indicatorID.String()]) - if candles[0].Low > bb0.LowerBand { - return 0 - } - - price := candles[1].Close * (1 + makerFeeRate/100) * (1 + s.MinProfitPerTradeRate/100) * (1 + takerFeeRate/100) - if price < bb1.UpperBand { - return 1 - } + //bb0 := chipmunkApi.GetBollingerBandsValue(candles[0].IndicatorValues[indicatorID.String()]) + //bb1 := chipmunkApi.GetBollingerBandsValue(candles[1].IndicatorValues[indicatorID.String()]) + //if candles[0].Low > bb0.LowerBand { + // return 0 + //} + // + //price := candles[1].Close * (1 + makerFeeRate/100) * (1 + s.MinProfitPerTradeRate/100) * (1 + takerFeeRate/100) + //if price < bb1.UpperBand { + // return 1 + //} return 0 } diff --git a/services/indicators/internal/workers/calculator.go b/services/indicators/internal/workers/calculator.go index effd869..a6e5cc5 100644 --- a/services/indicators/internal/workers/calculator.go +++ b/services/indicators/internal/workers/calculator.go @@ -72,6 +72,9 @@ func (w IndicatorCalculator) calculateMarketIndicators(key string) { MarketID: ids[1], Count: 1, } + + w.calculatePrimaryIndicatorsValue(key, ids) + ticker := time.NewTicker(w.configs.CalculatorInterval) for { select { @@ -106,3 +109,32 @@ func (w IndicatorCalculator) calculateMarketIndicators(key string) { } } } + +func (w IndicatorCalculator) calculatePrimaryIndicatorsValue(key string, ids []string) { + primaryCandles, err := w.candleService.List(context.Background(), &chipmunkAPI.CandleListReq{ + ResolutionID: ids[0], + MarketID: ids[1], + }) + if err != nil { + w.log.WithError(err).Errorf("failed to get primary candles for %v", ids) + return + } + + w.lock.Lock() + indicators, ok := w.indicatorsMap[key] + if !ok { + w.log.Errorf("no indicator map found with key %v", key) + return + } + w.lock.Unlock() + + for _, indicator := range indicators { + values, err := indicator.Calculate(context.Background(), primaryCandles.Elements) + for _, value := range values.Values { + if err = storage.AddValue(context.Background(), indicator.GetId(), value); err != nil { + w.log.WithError(err).Warnf("failed to save indicator value. id: %v", indicator.GetId()) + } + } + + } +} diff --git a/services/indicators/pkg/db/indicator.go b/services/indicators/pkg/db/indicator.go index 7c6ee49..2e37acd 100644 --- a/services/indicators/pkg/db/indicator.go +++ b/services/indicators/pkg/db/indicator.go @@ -12,3 +12,7 @@ type Indicators struct { func (r Indicators) Create(ctx context.Context, indicator *entities.Indicator) error { return nil } + +func (r Indicators) List(ctx context.Context) ([]*entities.Indicator, error) { + return nil, nil +} diff --git a/services/network/internal/pkg/requests/request.go b/services/network/internal/pkg/requests/request.go index 8605a89..8047719 100644 --- a/services/network/internal/pkg/requests/request.go +++ b/services/network/internal/pkg/requests/request.go @@ -18,6 +18,8 @@ const ( UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" ) +var counter = 0 + type Request struct { Endpoint string httpClient *http.Client @@ -26,27 +28,32 @@ type Request struct { body *bytes.Buffer method networkAPI.RequestMethod metadata string + proxyURL string } func NewNetworkRequest(input *networkAPI.Request, proxyURL *url.URL) (*Request, error) { requestTransport := new(http.Transport) - if proxyURL != nil { - requestTransport.Proxy = http.ProxyURL(proxyURL) - requestTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} - } - request := &Request{ Endpoint: input.Endpoint, - httpClient: &http.Client{ - Transport: requestTransport, - }, method: input.Method, body: new(bytes.Buffer), headers: http.Header{}, metadata: input.Metadata, } + if proxyURL != nil { + requestTransport.Proxy = http.ProxyURL(proxyURL) + requestTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} + request.proxyURL = proxyURL.String() + } else { + request.proxyURL = "localhost" + } + + request.httpClient = &http.Client{ + Transport: requestTransport, + } + request.AddHeaders(input.Headers) switch input.Method { case networkAPI.Request_POST: @@ -101,7 +108,8 @@ func (req *Request) Do() (*networkAPI.Response, error) { request.URL.RawQuery = req.queryParams } - log.Infof(request.URL.String()) + log.Infof("%v: over %v -> (%v)%v", counter, req.proxyURL, req.method, request.URL.String()) + counter++ response, err := req.httpClient.Do(request) if err != nil { log.WithError(err).Errorf("failed to make request") diff --git a/services/raven/cmd/main.go b/services/raven/cmd/main.go index bd708d1..ef507ab 100644 --- a/services/raven/cmd/main.go +++ b/services/raven/cmd/main.go @@ -25,17 +25,17 @@ import ( "time" ) -// @title Swagger Example API -// @version 1.0 -// @description This is a sample server Gate server. -// @termsOfService http://swagger.io/terms/ +// @title Swagger Example API +// @version 1.0 +// @description This is a sample server Gate server. +// @termsOfService http://swagger.io/terms/ -// @contact.name API Support -// @contact.url http://www.swagger.io/support -// @contact.email support@swagger.io +// @contact.name API Support +// @contact.url http://www.swagger.io/support +// @contact.email support@swagger.io -// @license.name Apache 2.0 -// @license.url http://www.apache.org/licenses/LICENSE-2.0.html +// @license.name Apache 2.0 +// @license.url http://www.apache.org/licenses/LICENSE-2.0.html func main() { ctx := context.Background() logger := log.New() diff --git a/services/raven/internal/app/chipmunk/indicators/controller.go b/services/raven/internal/app/chipmunk/indicators/controller.go index 04a2129..2c62d9f 100644 --- a/services/raven/internal/app/chipmunk/indicators/controller.go +++ b/services/raven/internal/app/chipmunk/indicators/controller.go @@ -2,8 +2,6 @@ package indicators import ( gorilla "github.com/gorilla/mux" - "github.com/h-varmazyar/Gate/pkg/grpcext" - chipmunkApi "github.com/h-varmazyar/Gate/services/chipmunk/api/proto" log "github.com/sirupsen/logrus" ) @@ -12,16 +10,16 @@ var ( ) type Controller struct { - indicatorsService chipmunkApi.IndicatorServiceClient - logger *log.Logger + //indicatorsService chipmunkApi.IndicatorServiceClient + logger *log.Logger } func ControllerInstance(logger *log.Logger, chipmunkAddress string) *Controller { if controller == nil { - chipmunkConn := grpcext.NewConnection(chipmunkAddress) + //chipmunkConn := grpcext.NewConnection(chipmunkAddress) controller = &Controller{ - indicatorsService: chipmunkApi.NewIndicatorServiceClient(chipmunkConn), - logger: logger, + //indicatorsService: chipmunkApi.NewIndicatorServiceClient(chipmunkConn), + logger: logger, } } return controller diff --git a/services/raven/internal/app/chipmunk/markets/controller.go b/services/raven/internal/app/chipmunk/markets/controller.go index 5ec990b..670a960 100644 --- a/services/raven/internal/app/chipmunk/markets/controller.go +++ b/services/raven/internal/app/chipmunk/markets/controller.go @@ -49,16 +49,17 @@ func (c Controller) RegisterRoutes(router *gorilla.Router) { } // marketCreate godoc -// @Summary Create new market manually -// @Description Create new market manually -// @Accept json -// @Produce json -// @Param market body MarketReq true "New Market" -// @Success 201 -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /chipmunk/markets/create [post] +// +// @Summary Create new market manually +// @Description Create new market manually +// @Accept json +// @Produce json +// @Param market body MarketReq true "New Market" +// @Success 201 +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /chipmunk/markets/create [post] func (c Controller) create(res http.ResponseWriter, req *http.Request) { market := new(chipmunkApi.MarketCreateReq) if err := httpext.BindModel(req, market); err != nil { @@ -74,16 +75,17 @@ func (c Controller) create(res http.ResponseWriter, req *http.Request) { } // marketList godoc -// @Summary get market list -// @Description get market list based on platform -// @Accept json -// @Produce json -// @Param platform query string true "Platform name" Enums:(Coinex,UnknownBrokerage,Nobitex,Mazdax,Binance) -// @Success 200 {object} proto.Markets -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /chipmunk/markets/list [get] +// +// @Summary get market list +// @Description get market list based on platform +// @Accept json +// @Produce json +// @Param platform query string true "Platform name" Enums:(Coinex,UnknownBrokerage,Nobitex,Mazdax,Binance) +// @Success 200 {object} proto.Markets +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /chipmunk/markets/list [get] func (c Controller) list(res http.ResponseWriter, req *http.Request) { fmt.Println("market list") list := new(chipmunkApi.MarketListReq) @@ -104,16 +106,17 @@ func (c Controller) list(res http.ResponseWriter, req *http.Request) { } // marketsUpdateRemotely godoc -// @Summary update markets remotely -// @Description update markets remotely -// @Accept json -// @Produce json -// @Param market body Platform true "update Markets" -// @Success 200 {object} proto.Markets -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /chipmunk/markets/Update-remotely [post] +// +// @Summary update markets remotely +// @Description update markets remotely +// @Accept json +// @Produce json +// @Param market body Platform true "update Markets" +// @Success 200 {object} proto.Markets +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /chipmunk/markets/Update-remotely [post] func (c Controller) updateDetails(res http.ResponseWriter, req *http.Request) { fmt.Println("update details") update := new(chipmunkApi.MarketUpdateFromPlatformReq) @@ -130,16 +133,17 @@ func (c Controller) updateDetails(res http.ResponseWriter, req *http.Request) { } // marketReturn godoc -// @Summary return market -// @Description return market based on id -// @Accept json -// @Produce json -// @Param market_id path string true "market id" -// @Success 200 {object} proto.Market -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /chipmunk/markets/{market_id} [get] +// +// @Summary return market +// @Description return market based on id +// @Accept json +// @Produce json +// @Param market_id path string true "market id" +// @Success 200 {object} proto.Market +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /chipmunk/markets/{market_id} [get] func (c Controller) get(res http.ResponseWriter, req *http.Request) { getRequest := new(chipmunkApi.MarketReturnReq) getRequest.ID = mux.PathParam(req, "market-id") @@ -152,17 +156,18 @@ func (c Controller) get(res http.ResponseWriter, req *http.Request) { } // marketUpdate godoc -// @Summary update new market manually -// @Description update new market manually -// @Accept json -// @Produce json -// @Param market_id path string true "market id" -// @Param market body MarketReq true "update Market" -// @Success 201 -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /chipmunk/markets/{market_id} [put] +// +// @Summary update new market manually +// @Description update new market manually +// @Accept json +// @Produce json +// @Param market_id path string true "market id" +// @Param market body MarketReq true "update Market" +// @Success 201 +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /chipmunk/markets/{market_id} [put] func (c Controller) update(res http.ResponseWriter, req *http.Request) { update := new(chipmunkApi.MarketUpdateReq) if err := httpext.BindModel(req, update); err != nil { diff --git a/services/raven/internal/app/chipmunk/resolutions/constroller.go b/services/raven/internal/app/chipmunk/resolutions/constroller.go index d70fd82..53726a4 100644 --- a/services/raven/internal/app/chipmunk/resolutions/constroller.go +++ b/services/raven/internal/app/chipmunk/resolutions/constroller.go @@ -43,16 +43,17 @@ func (c Controller) RegisterRoutes(router *gorilla.Router) { } // resolutionCreate godoc -// @Summary Create new resolution manually -// @Description Create new resolution manually -// @Accept json -// @Produce json -// @Param resolution body ResolutionSetReq true "New Resolution" -// @Success 201 -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /chipmunk/resolutions/create [post] +// +// @Summary Create new resolution manually +// @Description Create new resolution manually +// @Accept json +// @Produce json +// @Param resolution body ResolutionSetReq true "New Resolution" +// @Success 201 +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /chipmunk/resolutions/create [post] func (c Controller) create(res http.ResponseWriter, req *http.Request) { resolution := new(chipmunkApi.Resolution) if err := httpext.BindModel(req, resolution); err != nil { @@ -67,16 +68,17 @@ func (c Controller) create(res http.ResponseWriter, req *http.Request) { } // resolutionList godoc -// @Summary get resolution list -// @Description get resolution list based on platform -// @Accept json -// @Produce json -// @Param platform query string true "Platform name" Enums:(Coinex,UnknownBrokerage,Nobitex,Mazdax,Binance) -// @Success 200 {object} proto.Resolutions -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /chipmunk/resolutions/list [get] +// +// @Summary get resolution list +// @Description get resolution list based on platform +// @Accept json +// @Produce json +// @Param platform query string true "Platform name" Enums:(Coinex,UnknownBrokerage,Nobitex,Mazdax,Binance) +// @Success 200 {object} proto.Resolutions +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /chipmunk/resolutions/list [get] func (c Controller) list(res http.ResponseWriter, req *http.Request) { listReq := new(chipmunkApi.ResolutionListReq) @@ -97,16 +99,17 @@ func (c Controller) list(res http.ResponseWriter, req *http.Request) { } // resolutionList godoc -// @Summary get single resolution -// @Description get single resolution based on resolution id -// @Accept json -// @Produce json -// @Param resolution-id path string true "Resolution id" -// @Success 200 {object} proto.Resolution -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /chipmunk/resolutions/{resolution-id} [get] +// +// @Summary get single resolution +// @Description get single resolution based on resolution id +// @Accept json +// @Produce json +// @Param resolution-id path string true "Resolution id" +// @Success 200 {object} proto.Resolution +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /chipmunk/resolutions/{resolution-id} [get] func (c Controller) get(res http.ResponseWriter, req *http.Request) { getReq := new(chipmunkApi.ResolutionReturnByIDReq) @@ -120,17 +123,18 @@ func (c Controller) get(res http.ResponseWriter, req *http.Request) { } // resolutionList godoc -// @Summary update single resolution -// @Description update single resolution based on resolution id -// @Accept json -// @Produce json -// @Param resolution-id path string true "Resolution id" -// @Param resolution body ResolutionSetReq true "New Resolution" -// @Success 200 -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /chipmunk/resolutions/{resolution-id} [put] +// +// @Summary update single resolution +// @Description update single resolution based on resolution id +// @Accept json +// @Produce json +// @Param resolution-id path string true "Resolution id" +// @Param resolution body ResolutionSetReq true "New Resolution" +// @Success 200 +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /chipmunk/resolutions/{resolution-id} [put] func (c Controller) update(res http.ResponseWriter, req *http.Request) { resolution := new(chipmunkApi.Resolution) if err := httpext.BindModel(req, resolution); err != nil { diff --git a/services/raven/internal/app/network/ips/controller.go b/services/raven/internal/app/network/ips/controller.go index 57ffd9c..de07337 100644 --- a/services/raven/internal/app/network/ips/controller.go +++ b/services/raven/internal/app/network/ips/controller.go @@ -39,16 +39,17 @@ func (c Controller) RegisterRoutes(router *gorilla.Router) { } // ipCreate godoc -// @Summary Create new IP -// @Description Create new IP -// @Accept json -// @Produce json -// @Param IP body proto.IPCreateReq true "New IP" -// @Success 201 {object} proto.IP -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /network/ips/create [post] +// +// @Summary Create new IP +// @Description Create new IP +// @Accept json +// @Produce json +// @Param IP body proto.IPCreateReq true "New IP" +// @Success 201 {object} proto.IP +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /network/ips/create [post] func (c Controller) create(res http.ResponseWriter, req *http.Request) { ipCreateReq := new(networkApi.IPCreateReq) if err := httpext.BindModel(req, ipCreateReq); err != nil { @@ -64,15 +65,16 @@ func (c Controller) create(res http.ResponseWriter, req *http.Request) { } // ipList godoc -// @Summary return IP list -// @Description return IP list -// @Accept json -// @Produce json -// @Success 200 {object} proto.IPs -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /network/ips/list [get] +// +// @Summary return IP list +// @Description return IP list +// @Accept json +// @Produce json +// @Success 200 {object} proto.IPs +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /network/ips/list [get] func (c Controller) list(res http.ResponseWriter, req *http.Request) { if ips, err := c.ipsService.List(req.Context(), new(networkApi.IPListReq)); err != nil { httpext.SendError(res, req, err) @@ -82,16 +84,17 @@ func (c Controller) list(res http.ResponseWriter, req *http.Request) { } // ipReturn godoc -// @Summary return IP with ID -// @Description return IP with ID -// @Accept json -// @Produce json -// @Param ip_id path string true "IP ID" -// @Success 200 {object} proto.IP -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /network/ips/{ip_id} [get] +// +// @Summary return IP with ID +// @Description return IP with ID +// @Accept json +// @Produce json +// @Param ip_id path string true "IP ID" +// @Success 200 {object} proto.IP +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /network/ips/{ip_id} [get] func (c Controller) returnByID(res http.ResponseWriter, req *http.Request) { ipReq := new(networkApi.IPReturnReq) diff --git a/services/raven/internal/app/network/rateLimiters/controller.go b/services/raven/internal/app/network/rateLimiters/controller.go index b49f0ce..3a87be9 100644 --- a/services/raven/internal/app/network/rateLimiters/controller.go +++ b/services/raven/internal/app/network/rateLimiters/controller.go @@ -40,16 +40,17 @@ func (c Controller) RegisterRoutes(router *gorilla.Router) { } // rateLimiterCreate godoc -// @Summary Create new rate limiter -// @Description Create new rate limiter -// @Accept json -// @Produce json -// @Param RateLimiter body RateLimiter true "New rate limiter" -// @Success 201 {object} proto.RateLimiter -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /network/rate-limiters/create [post] +// +// @Summary Create new rate limiter +// @Description Create new rate limiter +// @Accept json +// @Produce json +// @Param RateLimiter body RateLimiter true "New rate limiter" +// @Success 201 {object} proto.RateLimiter +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /network/rate-limiters/create [post] func (c Controller) create(res http.ResponseWriter, req *http.Request) { rateLimiterCreateReq := new(networkApi.RateLimiterCreateReq) if err := httpext.BindModel(req, rateLimiterCreateReq); err != nil { @@ -65,16 +66,17 @@ func (c Controller) create(res http.ResponseWriter, req *http.Request) { } // rateLimiterList godoc -// @Summary return rate limiter list -// @Description return rate limiter list -// @Accept json -// @Produce json -// @Param type query string true "rate limiter type" Enums:(Spread,Immediate) -// @Success 200 {object} proto.RateLimiters -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /network/rate-limiters/list [get] +// +// @Summary return rate limiter list +// @Description return rate limiter list +// @Accept json +// @Produce json +// @Param type query string true "rate limiter type" Enums:(Spread,Immediate) +// @Success 200 {object} proto.RateLimiters +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /network/rate-limiters/list [get] func (c Controller) list(res http.ResponseWriter, req *http.Request) { if rateLimiters, err := c.rateLimitersService.List(req.Context(), new(networkApi.RateLimiterListReq)); err != nil { httpext.SendError(res, req, err) @@ -84,16 +86,17 @@ func (c Controller) list(res http.ResponseWriter, req *http.Request) { } // rateLimiterReturn godoc -// @Summary return rate limiter with ID -// @Description return rate limiter with ID -// @Accept json -// @Produce json -// @Param rate_limiter_id path string true "rate limiter ID" -// @Success 200 {object} proto.RateLimiter -// @Failure 400 {object} errors.Error -// @Failure 404 {object} errors.Error -// @Failure 500 {object} errors.Error -// @Router /network/rate-limiters/{rate_limiter_id} [get] +// +// @Summary return rate limiter with ID +// @Description return rate limiter with ID +// @Accept json +// @Produce json +// @Param rate_limiter_id path string true "rate limiter ID" +// @Success 200 {object} proto.RateLimiter +// @Failure 400 {object} errors.Error +// @Failure 404 {object} errors.Error +// @Failure 500 {object} errors.Error +// @Router /network/rate-limiters/{rate_limiter_id} [get] func (c Controller) returnByID(res http.ResponseWriter, req *http.Request) { rateLimiterReturnReq := new(networkApi.RateLimiterReturnReq) diff --git a/services/sentiment/api/__init__.py b/services/sentiment/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/services/sentiment/config/__init__.py b/services/sentiment/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/services/sentiment/config/configs.py b/services/sentiment/config/configs.py new file mode 100644 index 0000000..1109ef3 --- /dev/null +++ b/services/sentiment/config/configs.py @@ -0,0 +1,28 @@ +from configparser import ConfigParser + +class AppConfigs: + def __init__(self, filename='./config/default.ini'): + config = ConfigParser() + config.read(filename) + + self.database = self.DatabaseConfig(config['database']) + self.api = self.APIConfig(config['api']) +# self.logging = self.LoggingConfig(config['logging']) + + class DatabaseConfig: + def __init__(self, db_config): + self.host = db_config['host'] + self.port = db_config['port'] + self.user = db_config['user'] + self.password = db_config['password'] + self.name = db_config['name'] + + class APIConfig: + def __init__(self, api_config): + self.host = api_config['host'] + self.port = api_config['port'] + + class LoggingConfig: + def __init__(self, logging_config): + self.level = logging_config['level'] + self.file = logging_config['file'] diff --git a/services/sentiment/database/__init__.py b/services/sentiment/database/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/services/sentiment/database/db.py b/services/sentiment/database/db.py new file mode 100644 index 0000000..628b644 --- /dev/null +++ b/services/sentiment/database/db.py @@ -0,0 +1,10 @@ +import psycopg2 +# from config.configs import AppConfigs.DatabaseConfig + +def connect(configs): + conn = psycopg2.connect(user = configs.user, + password = configs.password, + host = configs.host, + port = configs.port, + database = configs.name) + return conn diff --git a/services/sentiment/main.py b/services/sentiment/main.py new file mode 100644 index 0000000..acef814 --- /dev/null +++ b/services/sentiment/main.py @@ -0,0 +1,26 @@ +import database +from config.configs import AppConfigs +from database import db +# import uvicorn +# from configparser import ConfigParser + +# def config(filename='config/config.ini', section='api'): +# parser = ConfigParser() +# parser.read(filename) +# +# api_config = {} +# if parser.has_section(section): +# params = parser.items(section) +# for param in params: +# api_config[param[0]] = param[1] +# else: +# raise Exception(f'Section {section} not found in the {filename} file') +# +# return api_config + +if __name__ == "__main__": + conf = AppConfigs('./config/default.ini') + + db = db.connect(conf.database) +# api_config = config() +# uvicorn.run("api.server:app", host=api_config['host'], port=int(api_config['port']), reload=True) diff --git a/services/sentiment/requirements.txt b/services/sentiment/requirements.txt new file mode 100644 index 0000000..718e8ba --- /dev/null +++ b/services/sentiment/requirements.txt @@ -0,0 +1,2 @@ +google-generativeai==0.7.2 +psycopg2-binary==2.9.9 \ No newline at end of file diff --git a/services/sentiment/services/__init__.py b/services/sentiment/services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/services/sentiment/tagger/gemini.py b/services/sentiment/tagger/gemini.py new file mode 100644 index 0000000..13df88d --- /dev/null +++ b/services/sentiment/tagger/gemini.py @@ -0,0 +1,28 @@ +import os +import google.generativeai as genai + +genai.configure(api_key=os.environ["GEMINI_API_KEY"]) + +# Create the model +# See https://ai.google.dev/api/python/google/generativeai/GenerativeModel +generation_config = { + "temperature": 1, + "top_p": 0.95, + "top_k": 64, + "max_output_tokens": 8192, + "response_mime_type": "application/json", +} + +model = genai.GenerativeModel( + model_name="gemini-1.5-flash", + generation_config=generation_config, +) + +chat_session = model.start_chat( + history=[ + ] +) + +response = chat_session.send_message("INSERT_INPUT_HERE") + +print(response.text) \ No newline at end of file diff --git a/services/sentiment/tests/__init__.py b/services/sentiment/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/services/sentiment/utils/__init__.py b/services/sentiment/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/services/sentiment/utils/providers/gemini.py b/services/sentiment/utils/providers/gemini.py new file mode 100644 index 0000000..18ec9a5 --- /dev/null +++ b/services/sentiment/utils/providers/gemini.py @@ -0,0 +1,16 @@ +import os +import google.generativeai as genai +from .provider import Provider + +# A token is equivalent to about 4 characters for Gemini models +class GeminiProvider(Provider): + def send_request(self, posts): + genai.configure(api_key=provider.token) + # Choose a model that's appropriate for your use case. + model = genai.GenerativeModel('gemini-1.5-flash') + + prompt = "Write a story about a magic backpack." + + response = model.generate_content(prompt) + + print(response.text) diff --git a/services/sentiment/utils/providers/provider.py b/services/sentiment/utils/providers/provider.py new file mode 100644 index 0000000..fe3998f --- /dev/null +++ b/services/sentiment/utils/providers/provider.py @@ -0,0 +1,44 @@ +import time + +class Provider: + def __init__(self, name, token, tokens_per_minute, requests_per_day, tokens_per_day): + self.name = name + self.token = token + self.requests_per_minute = requests_per_minute + self.tokens_per_minutes = tokens_per_minutes + self.requests_per_day = requests_per_day + self.tokens_per_day = tokens_per_day + + self.last_reset_time = time.time() + + def reset_quota(self): + if time.time() - self.last_reset_time >= self.quota_reset_interval: + self.quota = self.max_quota + self.last_reset_time = time.time() + + def can_handle(self): + self.reset_quota() + return self.quota > 0 + + def handle_request(self, posts): + if not self.can_handle(): + return False + + response = self.send_request(posts) + if response: + self.quota -= 1 + return response + return False + + def send_request(self, posts): + raise NotImplementedError("Subclasses should implement this method") + +def create_providers(configs): + from .gemini import GeminiProvider + + providers = [] + providers.append(GeminiProvider(name='gemini-1.5-pro', request_per_minute=2, tokens_per_minute=32000,requests_per_day=50)) + providers.append(GeminiProvider(name='gemini-1.5-flash', request_per_minute=15, tokens_per_minute=1000000,requests_per_day=1500)) + providers.append(GeminiProvider(name='gemini-1.0-pro', request_per_minute=15, tokens_per_minute=32000,requests_per_day=1500)) + + return providers diff --git a/services/sentiment/workers/tagger.py b/services/sentiment/workers/tagger.py new file mode 100644 index 0000000..ccac651 --- /dev/null +++ b/services/sentiment/workers/tagger.py @@ -0,0 +1,36 @@ +import time +import requests +from providers.provider import create_providers +from config.configs import provider_configs + +class Tagger: + def __init__(self, configs): + self.chipmunkAddress = configs['chipmunkAddress'] + self.providers = create_providers(provider_configs) + + def get_posts(self): + response = requests.get('{self.chipmunkAddress}/v1/posts/non-polarity') + if response.status_code == 200: + return response.json() + return [] + + def send_polarity(self, posts, response): + data = {'posts': posts, 'response': response} + requests.post('{self.chipmunkAddress}/v1/posts/polarity', json=data) + + def start(): + while True: + posts = get_posts() + if not posts: + time.sleep(5) + continue + + for provider in providers: + if provider.can_handle(): + response = provider.handle_request(posts) + if response: + send_polarity(posts, response) + break + else: + print("No available provider, waiting...") + time.sleep(10) \ No newline at end of file diff --git a/services/telegramBot/api/app.pb.go b/services/telegramBot/api/app.pb.go index 8ab4924..b87b425 100644 --- a/services/telegramBot/api/app.pb.go +++ b/services/telegramBot/api/app.pb.go @@ -26,11 +26,11 @@ type Message struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // @inject_tag: json:"chat_id" + // @inject_tag: json:"chat_id" ChatID int64 `protobuf:"varint,1,opt,name=ChatID,proto3" json:"chat_id"` - // @inject_tag: json:"reply_to" + // @inject_tag: json:"reply_to" ReplyTo int32 `protobuf:"varint,2,opt,name=ReplyTo,proto3" json:"reply_to"` - // @inject_tag: json:"text" + // @inject_tag: json:"text" Text string `protobuf:"bytes,3,opt,name=Text,proto3" json:"text"` }