From 7aa7c88f439e6b88067a1f1ba7fd16fabfaad894 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Wed, 16 Feb 2022 10:58:15 +0100 Subject: [PATCH 1/3] Add Dgraph investigation --- docs/investigation/local-hub-v2/README.md | 9 ++ .../local-hub-v2/dgraph/README.md | 112 +++++++++++++++ .../local-hub-v2/dgraph/assets/populate.sh | 8 ++ .../dgraph/assets/scenario.graphql | 116 ++++++++++++++++ .../local-hub-v2/dgraph/assets/schema.graphql | 37 +++++ .../local-hub-v2/dgraph/docker-compose.yml | 34 +++++ .../local-hub-v2/dgraph/lambda/.dockerignore | 2 + .../local-hub-v2/dgraph/lambda/Dockerfile | 14 ++ .../local-hub-v2/dgraph/lambda/README.md | 22 +++ .../dgraph/lambda/docker-compose.yml | 20 +++ .../local-hub-v2/dgraph/lambda/go.mod | 11 ++ .../local-hub-v2/dgraph/lambda/go.sum | 131 ++++++++++++++++++ .../lambda/internal/generated/generated.go | 106 ++++++++++++++ .../lambda/internal/model/models_gen.go | 13 ++ .../internal/resolvers/field.resolver.go | 28 ++++ .../internal/resolvers/middleware.resolver.go | 9 ++ .../internal/resolvers/mutation.resolver.go | 9 ++ .../internal/resolvers/query.resolver.go | 9 ++ .../lambda/internal/resolvers/resolver.go | 6 + .../internal/resolvers/webhook.resolver.go | 9 ++ .../local-hub-v2/dgraph/lambda/lambda.yaml | 21 +++ .../local-hub-v2/dgraph/lambda/main.go | 50 +++++++ .../postresql}/README.md | 14 +- .../postresql}/graphjin/Dockerfile | 2 +- .../postresql}/graphjin/README.md | 0 .../postresql}/graphjin/cloudbuild.yaml | 0 .../postresql}/graphjin/config/dev.yml | 0 .../graphjin/config/migrations/0_init.sql | 0 .../postresql}/graphjin/config/prod.yml | 0 .../postresql}/graphjin/config/seed.js | 0 .../postresql}/graphjin/docker-compose.yml | 0 31 files changed, 784 insertions(+), 8 deletions(-) create mode 100644 docs/investigation/local-hub-v2/README.md create mode 100644 docs/investigation/local-hub-v2/dgraph/README.md create mode 100755 docs/investigation/local-hub-v2/dgraph/assets/populate.sh create mode 100644 docs/investigation/local-hub-v2/dgraph/assets/scenario.graphql create mode 100644 docs/investigation/local-hub-v2/dgraph/assets/schema.graphql create mode 100644 docs/investigation/local-hub-v2/dgraph/docker-compose.yml create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/.dockerignore create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/Dockerfile create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/README.md create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/docker-compose.yml create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/go.mod create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/go.sum create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/internal/generated/generated.go create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/internal/model/models_gen.go create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/field.resolver.go create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/middleware.resolver.go create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/mutation.resolver.go create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/query.resolver.go create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/resolver.go create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/webhook.resolver.go create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/lambda.yaml create mode 100644 docs/investigation/local-hub-v2/dgraph/lambda/main.go rename docs/investigation/{local-hub-psql => local-hub-v2/postresql}/README.md (97%) rename docs/investigation/{local-hub-psql => local-hub-v2/postresql}/graphjin/Dockerfile (64%) rename docs/investigation/{local-hub-psql => local-hub-v2/postresql}/graphjin/README.md (100%) rename docs/investigation/{local-hub-psql => local-hub-v2/postresql}/graphjin/cloudbuild.yaml (100%) rename docs/investigation/{local-hub-psql => local-hub-v2/postresql}/graphjin/config/dev.yml (100%) rename docs/investigation/{local-hub-psql => local-hub-v2/postresql}/graphjin/config/migrations/0_init.sql (100%) rename docs/investigation/{local-hub-psql => local-hub-v2/postresql}/graphjin/config/prod.yml (100%) rename docs/investigation/{local-hub-psql => local-hub-v2/postresql}/graphjin/config/seed.js (100%) rename docs/investigation/{local-hub-psql => local-hub-v2/postresql}/graphjin/docker-compose.yml (100%) diff --git a/docs/investigation/local-hub-v2/README.md b/docs/investigation/local-hub-v2/README.md new file mode 100644 index 000000000..0c98db41a --- /dev/null +++ b/docs/investigation/local-hub-v2/README.md @@ -0,0 +1,9 @@ +# Local Hub + +The following directory contains different investigations of using different backend for Local Hub implementation. +We're looking for a good replacement to Neo4j, to resolve problems with high resource consumption and licensing. +Ideally, we want to implement Local Hub in Go. + +There are the following proof of concept projects: +- [PostgreSQL](./postresql/README.md) - The goal of this investigation is to find an efficient way to implement Local Hub backed with PostgreSQL. +- [Dgraph](./dgraph/README.md) - The goal of this investigation is to check whether Dgraph can be used as a Local Hub replacement. diff --git a/docs/investigation/local-hub-v2/dgraph/README.md b/docs/investigation/local-hub-v2/dgraph/README.md new file mode 100644 index 000000000..bbeb97289 --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/README.md @@ -0,0 +1,112 @@ +# Dgraph as the Local Hub + +This is a second approach to Dgraph project after [the first investigation](../../graph-db/dgraph/README.md) done about a year ago. + +## Motivation + +We're looking for a good replacement to Neo4j, to resolve problems with high resource consumption and licensing. Ideally, we want to implement Local Hub in Go. + +### Goal + +The main goal is to check whether Dgraph can be used as a replacement for current Neo4j implementation to speed up Local Hub extensibility and reduce resource consumption. + +Phases: +1. Check what was changed after a year. +2. Try to port existing Local Hub in minimal scope: + - Query TypeInstances, + - and TypInstances mutation with relation. +3. Use `@custom` or `@lambda` functionality to resolve delegated storage concern. + - Instead of official [JavaScript](https://github.com/dgraph-io/dgraph-lambda) implementation, use [dgraph-lambda-go](https://github.com/Schartey/dgraph-lambda-go) server created by community. +4. If porting was possible, do the benchmarking between current and new solution. + +### Non-goal + +Even thought that, Public and Local Hubs share the same Neo4j instance, checking if Public Hub can be ported it's **not a goal** of this investigation. +Additionally, we don't want to use the Dgraph only as of the database and create our own GraphQL server with dedicated resolvers' implementation for each entity. + +## Prerequisite + +- Install Go +- Install Docker +- **(optional)** Install [Insomnia](https://insomnia.rest/download) + +## What has changed? + +In general, they mostly do a [bug fix releases](https://github.com/dgraph-io/dgraph/blob/12c3ef564cde11ecc3de96ec1516b3148e52d795/CHANGELOG.md). + +### Architecture + +Dgraph doesn't allow adding custom logic directly in Dgraph server. To change the Dgraph behavior, you can: +- use `@custom` directive to redirect resolution of a given queries, mutations and fields. Resolution is done by calling the defined HTTP server. +- use `@lambda` directive to redirect resolution to lambda server. Dgraph provides lambda server only for JavaScript. In general, this is the same concept of executing HTTP calls against a registered Lambda server. + +Dgraph is written in Go, but it cannot be directly extended in Go. Custom resolvers are always an HTTP call to your service. + +It's due to the fact that Dgraph's GraphQL calls are not translated but directly executed on Dgraph server. In the official docs, you read: +> Dgraph is the world’s first, and at this time only, service to offer a specification-compliant GraphQL endpoint without the need for an additional translation layer in the tech stack. You will not find a hidden layer of GraphQL resolvers in Dgraph. GraphQL is natively executed within the core of Dgraph itself. + +In comparison to current Neo4j implementation. We can do exactly the same, but we need to write delegation logic in JavaScript, as a result we can use any protocol we want to. Dgraph just gives a syntax sugar for extensions, but at the same time restrict it to HTTP only. + +#### Give it a try + +1. Ensure that Docker is running on your localhost. +2. Run the Dgraph and lambda server and load GraphQL schema: + ```bash + docker compose up --build + ``` +3. Run all queries and mutations from [scenario.graphql](./assets/scenario.graphql) one by one. + +#### Findings + +After running the above example, you can notice that: + +- The `@custom` or `@lambda` directives are only allowed on fields where the type definition has a field with type `ID!` or a field with `@id` directive. +- A type must have at least one field that is not of `ID!` type and doesn't have `@custom` or `@lambda` directive. +- In `@custom` and `@lambda` you have access only to primitive fields available on the root. In our case, we are not able to get the **backend** property when resolving `version`. +- If a field is marked with `@custom` or `@lambda` directive, it's not included in mutation. +- To prepare the demo scenario I had to check the Dgraph code directly as snippets described in Dgraph documentation are sometimes invalid. + +At the beginning, I thought that lambdas on fields will be able to speed up our development. Due to, found issues, I don't think it will. + +### Migration problems + +I tried to migrate the current [Local Hub schema](../../../../hub-js/graphql/local/schema.graphql) to Dgraph and I spotted such issues: + +- No option to add webhooks to protect the mutation. The current webhooks are just asynchronously triggered with a given event. + + **Why required?** This was needed to protect TypeInstance deletion when it's locked. + +- No option to hide or rename generated query/mutation. + + **Why required?** Because of the above point, we will need to write a custom logic to protect the TypeInstance deletion when it's locked. To do so, I wanted to reuse automatically generated DQL instead of writing our own logic. + +- [Custom DQL is still not supported on GraphQL mutation](https://discuss.dgraph.io/t/why-does-custom-dql-not-support-mutation/10366/12) + + **Why required?** We are not able to easily customize mutations as we can with Cypher in Neo4j. + +- [We are not able to customize generated names for queries/mutations/filters.](https://discuss.dgraph.io/t/custom-names-for-crud-operations/13780/10) + + **Why required?** Without that, we are not able to keep backward compatibility. They suggest to use lambda for aliasing, but then GraphQL server will expose both variants. If we disable the default generation, then we need to write the DGL query by our own. + +- [No option to define custom scalars.](https://discuss.dgraph.io/t/graphql-custom-scalar-types/16742) + + **Why required?** Without that, we won't have a readable API. + +- [JSONSchema needs to be exposed as String.](https://discuss.dgraph.io/t/json-blob-as-a-scalar/11034/10) + + **Why required?** Without that, we are not able to keep backward compatibility. + +- [No option to skip a given field on create](https://discuss.dgraph.io/t/graphql-error-non-nullable-field-was-not-present-in-result-from-dgraph/9503/6). + + **Why required?** We want to ignore the **lockedBy** property which is automatically generated for TypeInstance mutation. This field should be managed by other mutation but still visible in TypeInstance type for all queries. We could use `@lambda` resolver to overcome this issue. But this is more a hack than a proper solution. + + +Conclusion: +> Hmm… 😬 I started full-on with Dgraph’s GraphQL but have slowed down tremendously due to numerous feature requests/ bug fixes required for true production readiness. (...) + +_source: https://discuss.dgraph.io/t/graphql-error-non-nullable-field-was-not-present-in-result-from-dgraph/9503/11_ + +## Summary + +After a year, Dgraph didn't change too much. I failed to easily port current logic into Dgraph because of its limitations. In Dgraph we will need to implement almost all by our self. As a result, this won't speed up our current development. +Porting to Dgraph only makes sens when we want to reduce the resources and license issues. We need to be aware that there is no Cypher alternative in Dgraph. diff --git a/docs/investigation/local-hub-v2/dgraph/assets/populate.sh b/docs/investigation/local-hub-v2/dgraph/assets/populate.sh new file mode 100755 index 000000000..f9f6ab13f --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/assets/populate.sh @@ -0,0 +1,8 @@ +# Retry a command +n=0 +until [ "$n" -ge 5 ] +do + curl -X POST http://dgraph:8080/admin/schema --data-binary '@schema.graphql' && break # substitute your command here + n=$((n+1)) + sleep 5 +done diff --git a/docs/investigation/local-hub-v2/dgraph/assets/scenario.graphql b/docs/investigation/local-hub-v2/dgraph/assets/scenario.graphql new file mode 100644 index 000000000..04f3a16bb --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/assets/scenario.graphql @@ -0,0 +1,116 @@ +# Create Backend +mutation BackendRef { + addTypeInstanceBackendReference(input: { abstract: true }) { + typeInstanceBackendReference { + id + abstract + } + } +} + +# Create first TypeInstance +mutation TypeInstance1 { + addTypeInstance( + input: { + typeRef: { path: "cap.type.db.psql.config", revision: "0.1.0" } + spec: { backend: { id: "0x2" } backendID: "123"} + } + ) { + typeInstance { + id + uses { + id + typeRef { + path + } + } + usedBy { + id + typeRef { + path + } + } + } + } +} + +# Create second TypeInstance +# TODO: update in `uses` property to match the TypeInstance1 +mutation TypeInstance2 { + addTypeInstance( + input: { + typeRef: { path: "cap.type.db.psql.config", revision: "0.1.0" } + spec: { backend: { id: "0x2" }} + uses: [{ id: "0x5" }] + } + ) { + typeInstance { + id + uses { + id + typeRef { + path + } + } + usedBy { + id + typeRef { + path + } + } + } + } +} + +query GetAllTypeInstances { + queryTypeInstance { + ...TypeInstanceFields + uses { + ...TypeInstanceFields + } + usedBy { + ...TypeInstanceFields + } + } +} + +query FilterTypeInstance { + queryTypeInstance(filter: { id: "0x7" }) { + ...TypeInstanceFields + uses { + ...TypeInstanceFields + } + usedBy { + ...TypeInstanceFields + } + } +} + +query QuerySingleTypeInstance { + getTypeInstance(id: "0x7" ) { + ...TypeInstanceFields + uses { + ...TypeInstanceFields + } + usedBy { + ...TypeInstanceFields + } + } +} + + +fragment TypeInstanceFields on TypeInstance { + id + lockedBy + typeRef { + path + revision + } + spec { + backend { + id + abstract + } + value + } +} diff --git a/docs/investigation/local-hub-v2/dgraph/assets/schema.graphql b/docs/investigation/local-hub-v2/dgraph/assets/schema.graphql new file mode 100644 index 000000000..dd4d011a5 --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/assets/schema.graphql @@ -0,0 +1,37 @@ + +type TypeInstance { + id: ID! + + # `lockedBy` field cannot be ignored only on mutation. + # Maybe they will support that in the future: https://discuss.dgraph.io/t/graphql-error-non-nullable-field-was-not-present-in-result-from-dgraph/9503/6 + lockedBy: String + + """ + Common properties for all TypeInstances which cannot be changed + """ + typeRef: TypeInstanceTypeReference! + uses: [TypeInstance!] + usedBy: [TypeInstance!] @hasInverse(field: uses) + + spec: TypeInstanceResourceVersionSpec +} + + +type TypeInstanceResourceVersionSpec { + id: ID! + # Moved from TypeInstance to be visible in value's @lambda resolver. + backend: TypeInstanceBackendReference! + backendID: String! + value: String! @lambda +} + +type TypeInstanceTypeReference { + path: String! + revision: String! +} + +type TypeInstanceBackendReference { + id: ID! + abstract: Boolean! +} + diff --git a/docs/investigation/local-hub-v2/dgraph/docker-compose.yml b/docs/investigation/local-hub-v2/dgraph/docker-compose.yml new file mode 100644 index 000000000..7af87667f --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/docker-compose.yml @@ -0,0 +1,34 @@ +services: + dgraph: + image: dgraph/standalone:latest + environment: + DGRAPH_ALPHA_LAMBDA: "url=http://lambda:8686/graphql-worker" + ports: + - "8080:8080" + - "9080:9080" + - "8000:8000" + depends_on: + - lambda + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080"] + interval: 30s + timeout: 10s + retries: 5 + lambda: + build: ./lambda + ports: + - "8686:8686" + environment: + DQL_URL: dgraph:9080 + DGRAPHQL_URL: http://dgraph:8080 + DGRAPH_URL: http://dgraph:8080 + populate: + image: alpine/curl:latest + entrypoint: sh + command: ./populate.sh + working_dir: /mnt + restart: on-failure + depends_on: + - dgraph + volumes: + - ./assets:/mnt diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/.dockerignore b/docs/investigation/local-hub-v2/dgraph/lambda/.dockerignore new file mode 100644 index 000000000..5898374a6 --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/.dockerignore @@ -0,0 +1,2 @@ +docker-compose.yml +lambda.yaml diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/Dockerfile b/docs/investigation/local-hub-v2/dgraph/lambda/Dockerfile new file mode 100644 index 000000000..9659d755e --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/Dockerfile @@ -0,0 +1,14 @@ +# syntax=docker/dockerfile:1 + +FROM golang:1.17-alpine + +WORKDIR /app + +COPY . ./ +RUN go mod download + +RUN go build -o /lambda + +EXPOSE 8686 + +CMD [ "/lambda" ] diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/README.md b/docs/investigation/local-hub-v2/dgraph/lambda/README.md new file mode 100644 index 000000000..2d25311fa --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/README.md @@ -0,0 +1,22 @@ +# Dgraph Go Lambda Server + +It is a Go implementation of Dgraph [lambda server](https://dgraph.io/docs/master/graphql/lambda/server/) with a custom logic for demo purposes. + +This project was generated using [dgraph-lambda-go](https://github.com/Schartey/dgraph-lambda-go). + +## Prerequisites + +- [Go](https://golang.org) +- [Docker](https://docs.docker.com/get-docker/) + +## Usage + +To run the lambda server use the following command: +```bash +go run main.go +``` + +To start the whole Dgraph ecosystem, run: +```bash +docker compose up --build +``` diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/docker-compose.yml b/docs/investigation/local-hub-v2/dgraph/lambda/docker-compose.yml new file mode 100644 index 000000000..10a4b1c81 --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/docker-compose.yml @@ -0,0 +1,20 @@ +services: + dgraph: + image: dgraph/standalone:latest + environment: + DGRAPH_ALPHA_LAMBDA: "url=http://lambda:8686/graphql-worker" + ports: + - "8080:8080" + - "9080:9080" + - "8000:8000" + depends_on: + - lambda + lambda: + build: . + + ports: + - "8686:8686" + environment: + DQL_URL: dgraph:9080 + DGRAPHQL_URL: http://dgraph:8080 + DGRAPH_URL: http://dgraph:8080 diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/go.mod b/docs/investigation/local-hub-v2/dgraph/lambda/go.mod new file mode 100644 index 000000000..88210be2e --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/go.mod @@ -0,0 +1,11 @@ +module capactio/lambda + +go 1.17 + +require github.com/schartey/dgraph-lambda-go v0.8.24 + +require ( + github.com/go-chi/chi v4.1.2+incompatible // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/sanity-io/litter v1.5.2 // indirect +) diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/go.sum b/docs/investigation/local-hub-v2/dgraph/lambda/go.sum new file mode 100644 index 000000000..bbd72eca5 --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/go.sum @@ -0,0 +1,131 @@ +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/DATA-DOG/go-sqlmock v1.3.2/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= +github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= +github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= +github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= +github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec= +github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/huandu/xstrings v1.3.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/ory/dockertest/v3 v3.6.0/go.mod h1:4ZOpj8qBUmh8fcBSVzkH2bws2s91JdGvHUqan4GHEuQ= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sanity-io/litter v1.5.2 h1:AnC8s9BMORWH5a4atZ4D6FPVvKGzHcnc5/IVTa87myw= +github.com/sanity-io/litter v1.5.2/go.mod h1:5Z71SvaYy5kcGtyglXOC9rrUi3c1E8CamFWjQsazTh0= +github.com/schartey/dgraph-lambda-go v0.8.24 h1:MQfgPROYisQDFXVbOCbclmxN8VJGA1UGM/6aFaGs9LA= +github.com/schartey/dgraph-lambda-go v0.8.24/go.mod h1:tXPAI9iB8/fYhOk1+PcYEl9Q0aaAHJ6rNo+TGdM+N6A= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +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/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +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.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= +github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/twpayne/go-geom v1.4.1/go.mod h1:k/zktXdL+qnA6OgKsdEGUTA17jbQ2ZPTUa3CCySuGpE= +github.com/twpayne/go-kml v1.5.2/go.mod h1:kz8jAiIz6FIdU2Zjce9qGlVtgFYES9vt7BTPBHf5jl4= +github.com/twpayne/go-polyline v1.0.0/go.mod h1:ICh24bcLYBX8CknfvNPKqoTbe+eg+MX1NPyJmSBo7pU= +github.com/twpayne/go-waypoint v0.0.0-20200706203930-b263a7f6e4e8/go.mod h1:qj5pHncxKhu9gxtZEYWypA/z097sxhFlbTyOyt9gcnU= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/vektah/gqlparser/v2 v2.2.0/go.mod h1:i3mQIGIrbK2PD1RrCeMTlVbkF2FJ6WkU1KJlJlC+3F4= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191003171128-d98b1b443823/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211108170745-6635138e15ea h1:FosBMXtOc8Tp9Hbo4ltl1WJSrTVewZU8MPnTPY2HdH8= +golang.org/x/net v0.0.0-20211108170745-6635138e15ea/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-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-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-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200121082415-34d275377bf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211107104306-e0b2ad06fe42/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/generated/generated.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/generated/generated.go new file mode 100644 index 000000000..658bfe78f --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/generated/generated.go @@ -0,0 +1,106 @@ +// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +package generated + +import ( + "capactio/lambda/internal/model" + "capactio/lambda/internal/resolvers" + "context" + "encoding/json" + "errors" + "net/http" + "strings" + + "github.com/schartey/dgraph-lambda-go/api" +) + +type Executer struct { + api.ExecuterInterface + fieldResolver resolvers.FieldResolver + queryResolver resolvers.QueryResolver + mutationResolver resolvers.MutationResolver + middlewareResolver resolvers.MiddlewareResolver + webhookResolver resolvers.WebhookResolver +} + +func NewExecuter(resolver *resolvers.Resolver) api.ExecuterInterface { + return Executer{fieldResolver: resolvers.FieldResolver{Resolver: resolver}, queryResolver: resolvers.QueryResolver{Resolver: resolver}, mutationResolver: resolvers.MutationResolver{Resolver: resolver}, middlewareResolver: resolvers.MiddlewareResolver{Resolver: resolver}, webhookResolver: resolvers.WebhookResolver{Resolver: resolver}} +} + +func (e Executer) Resolve(ctx context.Context, request *api.Request) (response []byte, err *api.LambdaError) { + if request.Resolver == "$webhook" { + return nil, e.resolveWebhook(ctx, request) + } else { + parentsBytes, underlyingError := request.Parents.MarshalJSON() + if underlyingError != nil { + return nil, &api.LambdaError{Underlying: underlyingError, Status: http.StatusInternalServerError} + } + + mc := &api.MiddlewareContext{Ctx: ctx, Request: request} + if err = e.middleware(mc); err != nil { + return nil, err + } + ctx = mc.Ctx + request = mc.Request + + if strings.HasPrefix(request.Resolver, "Query.") { + return e.resolveQuery(ctx, request) + } else if strings.HasPrefix(request.Resolver, "Mutation.") { + return e.resolveMutation(ctx, request) + } else { + return e.resolveField(ctx, request, parentsBytes) + } + } +} + +func (e Executer) middleware(mc *api.MiddlewareContext) (err *api.LambdaError) { + switch mc.Request.Resolver { + } + return nil +} + +func (e Executer) resolveField(ctx context.Context, request *api.Request, parentsBytes []byte) (response []byte, err *api.LambdaError) { + switch request.Resolver { + case "TypeInstanceResourceVersionSpec.value": + { + var parents []*model.TypeInstanceResourceVersionSpec + json.Unmarshal(parentsBytes, &parents) + + result, err := e.fieldResolver.TypeInstanceResourceVersionSpec_value(ctx, parents, request.AuthHeader) + if err != nil { + return nil, err + } + + var underlyingError error + response, underlyingError = json.Marshal(result) + if underlyingError != nil { + return nil, &api.LambdaError{Underlying: underlyingError, Status: http.StatusInternalServerError} + } else { + return response, nil + } + break + } + } + + return nil, &api.LambdaError{Underlying: errors.New("could not find query resolver"), Status: http.StatusNotFound} +} + +func (e Executer) resolveQuery(ctx context.Context, request *api.Request) (response []byte, err *api.LambdaError) { + switch request.Resolver { + } + + return nil, &api.LambdaError{Underlying: errors.New("could not find query resolver"), Status: http.StatusNotFound} +} + +func (e Executer) resolveMutation(ctx context.Context, request *api.Request) (response []byte, err *api.LambdaError) { + switch request.Resolver { + } + + return nil, &api.LambdaError{Underlying: errors.New("could not find query resolver"), Status: http.StatusNotFound} +} + +func (e Executer) resolveWebhook(ctx context.Context, request *api.Request) (err *api.LambdaError) { + switch request.Event.TypeName { + } + + return &api.LambdaError{Underlying: errors.New("could not find webhook resolver"), Status: http.StatusNotFound} +} diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/model/models_gen.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/model/models_gen.go new file mode 100644 index 000000000..3d6d2a85b --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/model/models_gen.go @@ -0,0 +1,13 @@ +// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +package model + +type TypeInstanceBackendReference struct { + Id string `json:"id" dql:"uid"` + Abstract bool `json:"abstract" dql:"TypeInstanceBackendReference.abstract"` +} +type TypeInstanceResourceVersionSpec struct { + Id string `json:"id" dql:"uid"` + Backend *TypeInstanceBackendReference `json:"backend" dql:"TypeInstanceResourceVersionSpec.backend"` + BackendID string `json:"backendID" dql:"TypeInstanceResourceVersionSpec.backendID"` + Value string `json:"value" dql:"TypeInstanceResourceVersionSpec.value"` +} diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/field.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/field.resolver.go new file mode 100644 index 000000000..32f7dbb07 --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/field.resolver.go @@ -0,0 +1,28 @@ +// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +package resolvers + +import ( + "capactio/lambda/internal/model" + "context" + "fmt" + + "github.com/sanity-io/litter" + "github.com/schartey/dgraph-lambda-go/api" +) + +type FieldResolverInterface interface { + TypeInstanceResourceVersionSpec_value(ctx context.Context, parents []*model.TypeInstanceResourceVersionSpec, authHeader api.AuthHeader) ([]string, *api.LambdaError) +} + +type FieldResolver struct { + *Resolver +} + +func (f *FieldResolver) TypeInstanceResourceVersionSpec_value(ctx context.Context, parents []*model.TypeInstanceResourceVersionSpec, authHeader api.AuthHeader) ([]string, *api.LambdaError) { + litter.Dump(parents) + var out []string + for idx := range parents { + out = append(out, fmt.Sprintf("value for %d", idx)) + } + return out, nil +} diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/middleware.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/middleware.resolver.go new file mode 100644 index 000000000..2e767baea --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/middleware.resolver.go @@ -0,0 +1,9 @@ +// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +package resolvers + +type MiddlewareResolverInterface interface { +} + +type MiddlewareResolver struct { + *Resolver +} diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/mutation.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/mutation.resolver.go new file mode 100644 index 000000000..14760b4fa --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/mutation.resolver.go @@ -0,0 +1,9 @@ +// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +package resolvers + +type MutationResolverInterface interface { +} + +type MutationResolver struct { + *Resolver +} diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/query.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/query.resolver.go new file mode 100644 index 000000000..144690226 --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/query.resolver.go @@ -0,0 +1,9 @@ +// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +package resolvers + +type QueryResolverInterface interface { +} + +type QueryResolver struct { + *Resolver +} diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/resolver.go new file mode 100644 index 000000000..07a49671c --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/resolver.go @@ -0,0 +1,6 @@ +// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +package resolvers + +// Add objects to your desire +type Resolver struct { +} diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/webhook.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/webhook.resolver.go new file mode 100644 index 000000000..4cab5d111 --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/webhook.resolver.go @@ -0,0 +1,9 @@ +// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +package resolvers + +type WebhookResolverInterface interface { +} + +type WebhookResolver struct { + *Resolver +} diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/lambda.yaml b/docs/investigation/local-hub-v2/dgraph/lambda/lambda.yaml new file mode 100644 index 000000000..0cd499053 --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/lambda.yaml @@ -0,0 +1,21 @@ +schema: + - ../schema.graphql + +exec: + filename: internal/generated/generated.go + package: generated + +model: + filename: internal/model/models_gen.go + package: model + +autobind: + # - "github.com/schartey/dgraph-lambda-go/examples/models" + +resolver: + dir: internal/resolvers + package: resolvers + filename_template: "{resolver}.resolver.go" # also allow "{name}.resolvers.go" + +server: + standalone: true diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/main.go b/docs/investigation/local-hub-v2/dgraph/lambda/main.go new file mode 100644 index 000000000..16201884a --- /dev/null +++ b/docs/investigation/local-hub-v2/dgraph/lambda/main.go @@ -0,0 +1,50 @@ +package main + +import ( + "context" + "fmt" + "os" + "os/signal" + "sync" + "time" + + "capactio/lambda/internal/generated" + "capactio/lambda/internal/resolvers" + + "github.com/schartey/dgraph-lambda-go/api" +) + +func main() { + + // Catch interrupt signal + c := make(chan os.Signal, 1) + signal.Notify(c, os.Interrupt) + + // WaitGroup for server shutdown + wg := &sync.WaitGroup{} + wg.Add(1) + + resolver := &resolvers.Resolver{} + executer := generated.NewExecuter(resolver) + lambda := api.New(executer) + srv, err := lambda.Serve(wg) + if err != nil { + fmt.Println(err) + } + + // Interrupt signal received + <-c + fmt.Println("Shutdown request (Ctrl-C) caught.") + fmt.Println("Shutting down...") + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + // Shutdown server + if err := srv.Shutdown(ctx); err != nil { + fmt.Println(err) + } + // Wait for server shutdown + wg.Wait() + +} diff --git a/docs/investigation/local-hub-psql/README.md b/docs/investigation/local-hub-v2/postresql/README.md similarity index 97% rename from docs/investigation/local-hub-psql/README.md rename to docs/investigation/local-hub-v2/postresql/README.md index b644eb25c..2c2fc201d 100644 --- a/docs/investigation/local-hub-psql/README.md +++ b/docs/investigation/local-hub-v2/postresql/README.md @@ -4,10 +4,10 @@ This document aggregates raw notes from a short investigation as a part of the [ ## Goal -The goal of this investigation is to find an efficient way to implement Local Hub backed with PostgreSQL. We believe that PostgreSQL could be a good replacement to Neo4j, to resolve problems with high resource consumption and licensing. +The goal of this investigation is to find an efficient way to implement Local Hub backed with PostgreSQL. We believe that PostgreSQL could be a good replacement to Neo4j, to resolve problems with high resource consumption and licensing. Ideally, we want to implement Local Hub in Go, but we will also consider Node.js if there are convenient libraries and framework that highly increase development pace. -The investigation influences how we will implement the initial version of the [Delegated Storage](../../proposal/20211207-delegated-storage.md) concept. +The investigation influences how we will implement the initial version of the [Delegated Storage](../../../proposal/20211207-delegated-storage.md) concept. ## Graph solutions for PostgreSQL @@ -31,13 +31,13 @@ To avoid implementing and maintaining our own solution, we could save time and u #### [Apache AGE](https://github.com/apache/incubator-age) -- PostgreSQL extension with OpenCypher implementation +- PostgreSQL extension with OpenCypher implementation - Missing support for apoc; we would still need to rewrite our queries - Inspired by AgensGraph - PostgreSQL 11 only support (until 2022 Q1, as the docs say) - Drivers: - [Official Golang driver](https://github.com/apache/incubator-age/tree/master/drivers/golang) seems to be at a very early stage - - [Unofficial Golang driver](https://github.com/rhizome-ai/apache-age-go) is at a very early stage (`v.0.0.4`), created by a single person, and can't be considered right now + - [Unofficial Golang driver](https://github.com/rhizome-ai/apache-age-go) is at a very early stage (`v.0.0.4`), created by a single person, and can't be considered right now - [NodeJS client](https://github.com/apache/incubator-age/tree/master/drivers/nodejs) is very simple, introduced around a year ago with [not many changes over time](https://github.com/apache/incubator-age/commits/master/drivers/nodejs) - We cannot treat it as a replacement of Neo4j and simply use different DB with the [`neo4j-graphql`](https://github.com/neo4j/graphql) library, as it uses different driver with different protocol (bolt). @@ -64,7 +64,7 @@ There are not many solutions when we would like to use Go as the language for ou id name } - } + } ``` Read more in the [docs](https://github.com/dosco/graphjin/wiki/Guide-to-GraphQL) @@ -130,7 +130,7 @@ This paragraph describes how we can actually implement Local Hub, based on knowl We can use [ltree](https://www.postgresql.org/docs/current/ltree.html) extension. However, in general, implementing and maintaining our own graph solution doesn't seem like the most efficient approach. Also, IMHO it won't scale well when we would like to rewrite our Public Hub as well. -### Use existing graph implementation for PostgreSQL +### Use existing graph implementation for PostgreSQL - Implement Local Hub in Go with AgensGraph, using official, abandoned Go client, [gorm](https://github.com/go-gorm/gorm) and our own custom OpenCypher queries @@ -147,6 +147,6 @@ We decided to reevaluate [dgraph](https://github.com/dgraph-io/dgraph) first. - If `dgraph` suits our needs, we will replace the graph database in Local Hub, implementing it in Go. The Delegated Storage backends will be initially implemented as built-in Local Hub functionality. - If not, then: - 1. We will keep the Local Hub implemented in Node.js with Neo4j database for the time being, and implement Delegated Storage as an extension (custom GraphQL resolvers) for the current TypeScript codebase. The storage backends will be implemented as external Go services communicated via gRPC + Protocol Buffers, as the proposal says. + 1. We will keep the Local Hub implemented in Node.js with Neo4j database for the time being, and implement Delegated Storage as an extension (custom GraphQL resolvers) for the current TypeScript codebase. The storage backends will be implemented as external Go services communicated via gRPC + Protocol Buffers, as the proposal says. 2. Once the Delegated Storage is implemented, we will switch to PostgreSQL as database storage, and refactor Local Hub to use [JoinMonster](#joinmonsterhttpsgithubcomjoin-monsterjoin-monster) or some newer GraphQL-first alternative if it is founded. To implement graph relations, we will use a dedicated PostgreSQL extension, such as [ltree](https://www.postgresql.org/docs/current/ltree.html) and write our custom GraphQL resolvers to resolve `uses` and `usedBy` TypeInstance relations. diff --git a/docs/investigation/local-hub-psql/graphjin/Dockerfile b/docs/investigation/local-hub-v2/postresql/graphjin/Dockerfile similarity index 64% rename from docs/investigation/local-hub-psql/graphjin/Dockerfile rename to docs/investigation/local-hub-v2/postresql/graphjin/Dockerfile index 3786e9e71..e7de373ef 100644 --- a/docs/investigation/local-hub-psql/graphjin/Dockerfile +++ b/docs/investigation/local-hub-v2/postresql/graphjin/Dockerfile @@ -1,4 +1,4 @@ FROM dosco/graphjin:latest WORKDIR / -COPY config/ /config/ \ No newline at end of file +COPY config /config/ diff --git a/docs/investigation/local-hub-psql/graphjin/README.md b/docs/investigation/local-hub-v2/postresql/graphjin/README.md similarity index 100% rename from docs/investigation/local-hub-psql/graphjin/README.md rename to docs/investigation/local-hub-v2/postresql/graphjin/README.md diff --git a/docs/investigation/local-hub-psql/graphjin/cloudbuild.yaml b/docs/investigation/local-hub-v2/postresql/graphjin/cloudbuild.yaml similarity index 100% rename from docs/investigation/local-hub-psql/graphjin/cloudbuild.yaml rename to docs/investigation/local-hub-v2/postresql/graphjin/cloudbuild.yaml diff --git a/docs/investigation/local-hub-psql/graphjin/config/dev.yml b/docs/investigation/local-hub-v2/postresql/graphjin/config/dev.yml similarity index 100% rename from docs/investigation/local-hub-psql/graphjin/config/dev.yml rename to docs/investigation/local-hub-v2/postresql/graphjin/config/dev.yml diff --git a/docs/investigation/local-hub-psql/graphjin/config/migrations/0_init.sql b/docs/investigation/local-hub-v2/postresql/graphjin/config/migrations/0_init.sql similarity index 100% rename from docs/investigation/local-hub-psql/graphjin/config/migrations/0_init.sql rename to docs/investigation/local-hub-v2/postresql/graphjin/config/migrations/0_init.sql diff --git a/docs/investigation/local-hub-psql/graphjin/config/prod.yml b/docs/investigation/local-hub-v2/postresql/graphjin/config/prod.yml similarity index 100% rename from docs/investigation/local-hub-psql/graphjin/config/prod.yml rename to docs/investigation/local-hub-v2/postresql/graphjin/config/prod.yml diff --git a/docs/investigation/local-hub-psql/graphjin/config/seed.js b/docs/investigation/local-hub-v2/postresql/graphjin/config/seed.js similarity index 100% rename from docs/investigation/local-hub-psql/graphjin/config/seed.js rename to docs/investigation/local-hub-v2/postresql/graphjin/config/seed.js diff --git a/docs/investigation/local-hub-psql/graphjin/docker-compose.yml b/docs/investigation/local-hub-v2/postresql/graphjin/docker-compose.yml similarity index 100% rename from docs/investigation/local-hub-psql/graphjin/docker-compose.yml rename to docs/investigation/local-hub-v2/postresql/graphjin/docker-compose.yml From d0961ca92a1b2ddd0e5d82d7ed1b567e901c74a4 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Mon, 28 Feb 2022 11:06:28 +0100 Subject: [PATCH 2/3] Apply suggestions after review --- docs/investigation/local-hub-v2/dgraph/README.md | 14 ++++++++------ .../local-hub-v2/dgraph/assets/populate.sh | 2 ++ .../dgraph/lambda/internal/generated/generated.go | 2 +- .../dgraph/lambda/internal/model/models_gen.go | 2 +- .../lambda/internal/resolvers/field.resolver.go | 2 +- .../internal/resolvers/middleware.resolver.go | 2 +- .../lambda/internal/resolvers/mutation.resolver.go | 2 +- .../lambda/internal/resolvers/query.resolver.go | 2 +- .../dgraph/lambda/internal/resolvers/resolver.go | 2 +- .../lambda/internal/resolvers/webhook.resolver.go | 2 +- .../local-hub-v2/dgraph/lambda/main.go | 1 + 11 files changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/investigation/local-hub-v2/dgraph/README.md b/docs/investigation/local-hub-v2/dgraph/README.md index bbeb97289..a0f7c134c 100644 --- a/docs/investigation/local-hub-v2/dgraph/README.md +++ b/docs/investigation/local-hub-v2/dgraph/README.md @@ -28,13 +28,13 @@ Additionally, we don't want to use the Dgraph only as of the database and create - Install Go - Install Docker -- **(optional)** Install [Insomnia](https://insomnia.rest/download) +- Install [Insomnia](https://insomnia.rest/download) ## What has changed? In general, they mostly do a [bug fix releases](https://github.com/dgraph-io/dgraph/blob/12c3ef564cde11ecc3de96ec1516b3148e52d795/CHANGELOG.md). -### Architecture +## Overview Dgraph doesn't allow adding custom logic directly in Dgraph server. To change the Dgraph behavior, you can: - use `@custom` directive to redirect resolution of a given queries, mutations and fields. Resolution is done by calling the defined HTTP server. @@ -47,16 +47,18 @@ It's due to the fact that Dgraph's GraphQL calls are not translated but directly In comparison to current Neo4j implementation. We can do exactly the same, but we need to write delegation logic in JavaScript, as a result we can use any protocol we want to. Dgraph just gives a syntax sugar for extensions, but at the same time restrict it to HTTP only. -#### Give it a try +## Give it a try 1. Ensure that Docker is running on your localhost. 2. Run the Dgraph and lambda server and load GraphQL schema: ```bash docker compose up --build ``` -3. Run all queries and mutations from [scenario.graphql](./assets/scenario.graphql) one by one. + >**NOTE:** If the data was not populated successfully, run: `docker compose run populate`. +3. Use [Insomnia](https://insomnia.rest/download) to run all queries and mutations from [scenario.graphql](./assets/scenario.graphql) one by one. + >**NOTE:** GraphQL address: http://localhost:8080 -#### Findings +### Findings After running the above example, you can notice that: @@ -66,7 +68,7 @@ After running the above example, you can notice that: - If a field is marked with `@custom` or `@lambda` directive, it's not included in mutation. - To prepare the demo scenario I had to check the Dgraph code directly as snippets described in Dgraph documentation are sometimes invalid. -At the beginning, I thought that lambdas on fields will be able to speed up our development. Due to, found issues, I don't think it will. +At the beginning, I thought that lambdas on fields will be able to speed up our development. Due to, found issues, I don't think they will. ### Migration problems diff --git a/docs/investigation/local-hub-v2/dgraph/assets/populate.sh b/docs/investigation/local-hub-v2/dgraph/assets/populate.sh index f9f6ab13f..ce392ce48 100755 --- a/docs/investigation/local-hub-v2/dgraph/assets/populate.sh +++ b/docs/investigation/local-hub-v2/dgraph/assets/populate.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Retry a command n=0 until [ "$n" -ge 5 ] diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/generated/generated.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/generated/generated.go index 658bfe78f..c742b659b 100644 --- a/docs/investigation/local-hub-v2/dgraph/lambda/internal/generated/generated.go +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/generated/generated.go @@ -1,4 +1,4 @@ -// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +// @generated - This was created as a part of investigation. We mark it as generate to exclude it from goreportcard to do not have misleading issues. package generated import ( diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/model/models_gen.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/model/models_gen.go index 3d6d2a85b..684dbfb1b 100644 --- a/docs/investigation/local-hub-v2/dgraph/lambda/internal/model/models_gen.go +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/model/models_gen.go @@ -1,4 +1,4 @@ -// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +// @generated - This was created as a part of investigation. We mark it as generate to exclude it from goreportcard to do not have misleading issues. package model type TypeInstanceBackendReference struct { diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/field.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/field.resolver.go index 32f7dbb07..e353060ef 100644 --- a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/field.resolver.go +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/field.resolver.go @@ -1,4 +1,4 @@ -// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +// @generated - This was created as a part of investigation. We mark it as generate to exclude it from goreportcard to do not have misleading issues. package resolvers import ( diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/middleware.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/middleware.resolver.go index 2e767baea..7aa1431d4 100644 --- a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/middleware.resolver.go +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/middleware.resolver.go @@ -1,4 +1,4 @@ -// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +// @generated - This was created as a part of investigation. We mark it as generate to exclude it from goreportcard to do not have misleading issues. package resolvers type MiddlewareResolverInterface interface { diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/mutation.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/mutation.resolver.go index 14760b4fa..6fa1d7009 100644 --- a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/mutation.resolver.go +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/mutation.resolver.go @@ -1,4 +1,4 @@ -// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +// @generated - This was created as a part of investigation. We mark it as generate to exclude it from goreportcard to do not have misleading issues. package resolvers type MutationResolverInterface interface { diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/query.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/query.resolver.go index 144690226..c2ee39c98 100644 --- a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/query.resolver.go +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/query.resolver.go @@ -1,4 +1,4 @@ -// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +// @generated - This was created as a part of investigation. We mark it as generate to exclude it from goreportcard to do not have misleading issues. package resolvers type QueryResolverInterface interface { diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/resolver.go index 07a49671c..1a927411c 100644 --- a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/resolver.go +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/resolver.go @@ -1,4 +1,4 @@ -// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +// @generated - This was created as a part of investigation. We mark it as generate to exclude it from goreportcard to do not have misleading issues. package resolvers // Add objects to your desire diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/webhook.resolver.go b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/webhook.resolver.go index 4cab5d111..b019062e0 100644 --- a/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/webhook.resolver.go +++ b/docs/investigation/local-hub-v2/dgraph/lambda/internal/resolvers/webhook.resolver.go @@ -1,4 +1,4 @@ -// @generated - This was created as a part of investigation. We mark it as generate to exlude it from goreportcard to do not have missleading issues.:golint +// @generated - This was created as a part of investigation. We mark it as generate to exclude it from goreportcard to do not have misleading issues. package resolvers type WebhookResolverInterface interface { diff --git a/docs/investigation/local-hub-v2/dgraph/lambda/main.go b/docs/investigation/local-hub-v2/dgraph/lambda/main.go index 16201884a..42eaeb09b 100644 --- a/docs/investigation/local-hub-v2/dgraph/lambda/main.go +++ b/docs/investigation/local-hub-v2/dgraph/lambda/main.go @@ -1,3 +1,4 @@ +// @generated - This was created as a part of investigation. We mark it as generate to exclude it from goreportcard to do not have misleading issues. package main import ( From 700e9ff897d8ddb5c03deb5461ac9cba2374fc14 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Mon, 28 Feb 2022 12:33:50 +0100 Subject: [PATCH 3/3] Fix CLI path --- .github/workflows/pr-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 7138209cc..7727fbd29 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -406,7 +406,7 @@ jobs: permissions: contents: read env: - CAPACT_BINARY: "${{ github.workspace}}/capact_linux_amd64/capact" + CAPACT_BINARY: "${{ github.workspace}}/capact" steps: - name: Checkout code