diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 3acfb67..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Build and deploy container image - -on: - push: - branches: - - main - -permissions: - id-token: write - -env: - TAG_NAME: octovy:${{ github.sha }} - GCP_IMAGE_NAME: asia-northeast1-docker.pkg.dev/octovy-service/service-images/octovy:${{ github.sha }} - GCP_PROJECT_ID: octovy-service - SERVICE_ID: octovy - CLOUD_RUN_REGION: asia-northeast1 - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v2 - - name: Set up Docker buildx - uses: docker/setup-buildx-action@v1 - - name: Build Docker image - run: docker build . -t ${{ env.TAG_NAME }} - - name: Rename image - run: docker tag ${{ env.TAG_NAME }} ${{ env.GCP_IMAGE_NAME }} - - id: "auth" - name: "Authenticate to GCP" - uses: "google-github-actions/auth@v0.4.3" - with: - create_credentials_file: "true" - workload_identity_provider: "projects/533751496677/locations/global/workloadIdentityPools/github-oidc-pool/providers/oidc-github-provider" - service_account: "deployer@octovy-service.iam.gserviceaccount.com" - - name: "Login gcloud" - run: gcloud auth login --brief --cred-file="${{ steps.auth.outputs.credentials_file_path }}" - - name: Configure Docker - run: gcloud auth configure-docker asia-northeast1-docker.pkg.dev - - name: Push image - run: docker push ${{ env.GCP_IMAGE_NAME }} - - uses: google-github-actions/setup-gcloud@master - - run: gcloud components install beta - - run: | - gcloud beta run deploy "${SERVICE_ID}" \ - --project="${GCP_PROJECT_ID}" \ - --image "${GCP_IMAGE_NAME}" \ - --region="${CLOUD_RUN_REGION}" \ - --platform="managed" \ - --cpu=1 \ - --memory=512Mi \ - --port 9080 \ - --allow-unauthenticated \ - --ingress=all \ - --set-env-vars "OCTOVY_LOG_LEVEL=debug, - OCTOVY_LOG_FORMAT=json, - OCTOVY_FRONTEND_URL=https://octovy.dev, - OCTOVY_GITHUB_APP_ID=109024, - OCTOVY_GITHUB_CLIENT_ID=Iv1.6fbf414816a6e06b, - OCTOVY_ADDR=0.0.0.0, - OCTOVY_DB_TYPE=postgres, - OCTOVY_TRIVY_DB_PATH=tmp/trivy.db, - OCTOVY_OPA_URL=https://opa-server-h6tk4k5hyq-an.a.run.app, - OCTOVY_OPA_PATH=octovy/check, - OCTOVY_DISABLE_WEBHOOK_TRIVY=1, - GIN_MODE=release" \ - --service-account="octovy-service@octovy-service.iam.gserviceaccount.com" - - # teardown - - uses: actions/checkout@v2 - - name: Slack Notification - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_MESSAGE: "Deployed octovy server ${{ github.sha }}" diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index 013f8da..47bfe4b 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -1,4 +1,4 @@ -name: "Security Scan" +name: "gosec" # Run workflow each time code is pushed to your repository and on a schedule. # The scheduled workflow runs every at 00:00 on Sunday UTC time. @@ -17,7 +17,7 @@ jobs: uses: securego/gosec@master with: # we let the report trigger content trigger a failure using the GitHub Security features. - args: '-no-fail -fmt sarif -out results.sarif ./...' + args: "-no-fail -fmt sarif -out results.sarif ./..." - name: Upload SARIF file uses: github/codeql-action/upload-sarif@v1 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a18bc07..6d0afee 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,9 +7,6 @@ env: TAG_NAME: octovy:${{ github.sha }} GITHUB_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/octovy GITHUB_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/octovy:${{ github.sha }} - GCP_IMAGE_REPO: gcr.io/octovy/octovy - GCP_IMAGE_NAME: gcr.io/octovy/octovy:${{ github.sha }} - GCP_PROJECT_ID: octovy jobs: build: @@ -39,39 +36,6 @@ jobs: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_MESSAGE: "Pushed to ${{ env.GITHUB_IMAGE_NAME }}" - push-gcp: - runs-on: ubuntu-latest - needs: build - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') - steps: - - name: checkout - uses: actions/checkout@v2 - - name: GCP Authenticate - uses: google-github-actions/setup-gcloud@master - with: - project_id: ${{ env.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} - export_default_credentials: true - - name: Configure Docker - run: gcloud auth configure-docker --quiet - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Pull Docker image - run: docker pull ${{ env.GITHUB_IMAGE_NAME }} - - name: Rename Docker image (tag name) - run: docker tag ${{ env.GITHUB_IMAGE_NAME }} "${{ env.GCP_IMAGE_NAME }}" - - name: Push Docker image (tag name) - run: docker push "${{ env.GCP_IMAGE_NAME }}" - - name: Slack Notification - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_MESSAGE: "Pushed to ${{ env.GCP_IMAGE_NAME }}" - release-ghcr: runs-on: ubuntu-latest needs: build @@ -105,39 +69,3 @@ jobs: env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} SLACK_MESSAGE: "Pushed to ${{ env.GITHUB_IMAGE_REPO }}:${{ steps.tag.outputs.tag }}" - - release-gcp: - runs-on: ubuntu-latest - needs: build - if: startsWith(github.ref, 'refs/tags/') - steps: - - name: checkout - uses: actions/checkout@v2 - - name: extract tag - id: tag - run: | - TAG=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g") - echo ::set-output name=tag::$TAG - - name: GCP Authenticate - uses: google-github-actions/setup-gcloud@master - with: - project_id: ${{ env.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} - export_default_credentials: true - - name: Configure Docker - run: gcloud auth configure-docker --quiet - - name: Push Docker image - run: docker pull ${{ env.GITHUB_IMAGE_NAME }} - - name: Rename Docker image (tag name) - run: docker tag ${{ env.GITHUB_IMAGE_NAME }} "${{ env.GCP_IMAGE_REPO }}:${{ steps.tag.outputs.tag }}" - - name: Rename Docker image (latest) - run: docker tag ${{ env.GITHUB_IMAGE_NAME }} "${{ env.GCP_IMAGE_REPO }}:latest" - - name: Push Docker image (tag name) - run: docker push "${{ env.GCP_IMAGE_REPO }}:${{ steps.tag.outputs.tag }}" - - name: Push Docker image (latest) - run: docker push "${{ env.GCP_IMAGE_REPO }}:latest" - - name: Slack Notification - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_MESSAGE: "Pushed to ${{ env.GCP_IMAGE_REPO }}:${{ steps.tag.outputs.tag }}" diff --git a/.github/workflows/sqlc.yml b/.github/workflows/sqlc.yml new file mode 100644 index 0000000..297d8cf --- /dev/null +++ b/.github/workflows/sqlc.yml @@ -0,0 +1,17 @@ +name: sqlc + +on: [push] + +jobs: + testing: + runs-on: ubuntu-latest + + steps: + - name: Checkout upstream repo + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + - uses: sqlc-dev/setup-sqlc@v4 + with: + sqlc-version: "1.21.0" + - run: sqlc diff diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 68f8945..827617c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,18 +1,36 @@ -name: Unit test +name: test on: [push] jobs: testing: runs-on: ubuntu-latest + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: pguser + POSTGRES_PASSWORD: pgpass + POSTGRES_DB: testdb + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - name: Checkout upstream repo uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v4 with: - go-version: "1.16" + go-version-file: "go.mod" + - run: | + curl -Lsf -O https://github.com/k0kubun/sqldef/releases/download/v0.16.5/psqldef_linux_amd64.tar.gz + tar xzf psqldef_linux_amd64.tar.gz + ./psqldef -U pguser -f ./database/schema.sql testdb + env: + PGPASSWORD: pgpass - run: go test --tags github ./... + env: + TEST_DB_DSN: "user=pguser password=pgpass dbname=testdb sslmode=disable" - run: go vet --tags github ./... diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index 754708a..dc13c96 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -1,4 +1,4 @@ -name: Vulnerability scan +name: trivy on: [push] @@ -15,6 +15,7 @@ jobs: uses: aquasecurity/trivy-action@master with: scan-type: "fs" + scan-ref: "." ignore-unfixed: true format: "template" template: "@/contrib/sarif.tpl" diff --git a/.gitignore b/.gitignore index f89a99a..16de438 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ node_modules assets/out assets/.next +/*.json tmp diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6eee728..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -dist: bionic -language: go -sudo: false -service: - - docker - -env: GO111MODULE=on - -os: - - linux - -go: - - 1.16.x - -git: - depth: 1 - -notifications: - email: false - -before_install: - - docker run -d -p 127.0.0.1:8000:8000 amazon/dynamodb-local - -script: - - go vet ./pkg/... - - go test ./pkg/... diff --git a/Dockerfile b/Dockerfile index 302c4a8..5bf52b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,15 @@ -FROM node:16.10.0-buster AS build-node -ADD . /app -WORKDIR /app/assets -RUN npm i -RUN npm run export -# -FROM golang:1.16 AS build-go -COPY --from=build-node /app /app +FROM golang:1.21 AS build-go +COPY . /app WORKDIR /app +ENV CGO_ENABLED=0 RUN go build . -#gcr.io/distroless/static is not enough because of github.com/mattn/go-sqlite3 FROM gcr.io/distroless/base COPY --from=build-go /app/octovy /octovy -COPY --from=aquasec/trivy:0.21.2 /usr/local/bin/trivy /trivy +COPY --from=build-go /app/database /database +COPY --from=aquasec/trivy:0.45.1 /usr/local/bin/trivy /trivy WORKDIR / -ENV OCTOVY_ADDR="0.0.0.0" +ENV OCTOVY_ADDR="0.0.0.0:8000" ENV OCTOVY_TRIVY_PATH=/trivy -EXPOSE 9080 +EXPOSE 8000 ENTRYPOINT ["/octovy"] diff --git a/LICENSE b/LICENSE index 9e3a491..a6c2bf9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,201 @@ -The MIT License (MIT) + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -Copyright 2021 Masayoshi Mizutani +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +1. Definitions. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2023 Masayoshi Mizutani + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index b50eeff..318ba69 100644 --- a/README.md +++ b/README.md @@ -1,134 +1,67 @@ -# Octovy [![Go Report Card](https://goreportcard.com/badge/github.com/m-mizutani/octovy)](https://goreportcard.com/report/github.com/m-mizutani/octovy) [![Unit test](https://github.com/m-mizutani/octovy/actions/workflows/test.yml/badge.svg)](https://github.com/m-mizutani/octovy/actions/workflows/test.yml) [![Vulnerability scan](https://github.com/m-mizutani/octovy/actions/workflows/trivy.yml/badge.svg)](https://github.com/m-mizutani/octovy/actions/workflows/trivy.yml) [![Security scan](https://github.com/m-mizutani/octovy/actions/workflows/gosec.yml/badge.svg)](https://github.com/m-mizutani/octovy/actions/workflows/gosec.yml) +# Octovy -![SampleView](https://user-images.githubusercontent.com/605953/137612896-ce9bc9b7-9af5-4963-bd02-6372a81f0108.png) -Demo site: https://octovy.dev +Octovy is a GitHub application designed to identify and alert you to any dependencies in your repository that could be potentially vulnerable. It uses [trivy](https://github.com/aquasecurity/trivy) for detection and then stores the results in a database for your reference. -## Overview +![architecture](https://github.com/m-mizutani/octovy/assets/605953/81eeb92d-a4e9-4baf-aae0-ace6b9dc447f) -`Octovy` is a vulnerability management tool for 3rd party OSS packages based on [Trivy](https://github.com/aquasecurity/trivy). It works as GitHub App and scan source code of a repository that is installed the GitHub App by Trivy. The scan result is stored into database and developer and security administrator can see and manage vulnerability via Web console. +## Setup -## Features +### 1. Creating a GitHub App -- **Organization-wide vulnerability detection**: Vulnerability detection and handling needs an organization-wide effort. Octovy scans all repositories that are installed GitHub App. It prepends misconfiguration of each repository. Also Octovy stores all scanned vulnerability package list and presents the necessary information to security administrator. - - List newly detected vulnerabilities in your organization - - List all repositories that have specified vulnerability -- **Vulnerability management**: Octovy provides Web user interface to manage vulnerability status. A user can change status and put a comment to share vulnerability handling decision with a team. Status can be selected from below: - - `To be fixed`: Vulnerability should be fixed later - - `Snoozed`: Waiting vulnerability fix. E.g.) a package author have not update vulnerable code. - - `Unaffected`: The vulnerability is not used in your product. - - `Mitigated`: Developer have changed settings to disable the vulnerability. +Start by creating a GitHub App [here](https://github.com/settings/apps). You can use any name and description you like. However, ensure you set the following configurations: -Also, Octovy notifies changes of vulnerability in Pull Request of GitHub. Developer can see new/fixed package vulnerabilities by own commit in a comment of the PR. +- **General** + - **Webhook URL**: `https:///webhook/github` + - **Webhook secret**: A string of your choosing (e.g. `mysecret_XOIJPOIFEA`) -![Comment to PR](https://user-images.githubusercontent.com/605953/137613080-ba866f19-cfa6-40b8-ab41-d7e2269356f2.png) +- **Permissions & events** + - Repository Permissions + - **Contents**: Set to Read-only + - **Metadata**: Set to Read-only + - **Pull Requests**: Set to Read & Write + - Subscribe to events + - **Pull request** + - **Push** +Once complete, note down the following information from the **General** section for later: -## Architecture +- **App ID** (e.g. `123456`) +- **Private Key**: Click `Generate a private key` and download the key file (e.g. `your-app-name.2023-08-14.private-key.pem`) -![architecture](https://user-images.githubusercontent.com/605953/137614140-f5005f39-0ead-49bf-a097-fc6507697305.jpg) +### 2. Setting Up the Database -## Usage +Octovy requires a PostgreSQL database. You can use any PostgreSQL instance you like, but we recommend cloud-based database services such as [Google Cloud SQL](https://cloud.google.com/sql) or [Amazon RDS](https://aws.amazon.com/rds/). -### Prerequisite +For database migration, [sqldef](https://github.com/k0kubun/sqldef) is recommended. After installing sqldef, you can migrate your database schema using the command below. Be sure to replace the placeholders with your actual database information. -- Prepare your own domain name. (e.g. `octovy.dev`) -- PostgreSQL 13 database - -### Setup GitHub App - -Replace `{your-domain}` to your own domain name. - -1. Create your own GitHub app at https://github.com/settings/apps/ -2. Configure `General` tab - - Set `Callback URL` to `https://{your-domain}/auth/github/callback` - - Set `Webhook URL` to `https://{your-domain}/webhook/github` - - (Optional) Set `Webhook secret` if you need. The secret value should be provided as environment variable `OCTOVY_GITHUB_WEBHOOK_SECRET` to octovy runtime. - - Generate `Client secrets` - - Generate `Private keys` -3. Configure `Permissions & events` tab - - In `Repository permissions` - - Change `Contents` to `Read-only` - - Change `Pull requests` to `Read & Write` - - In `Subscribe to events` - - Enable `Pull request` - - Enable `Push` - -If you want to use auto generated URL (e.g. provided by API gateway of AWS or Cloud Run of Google Cloud), `Callback URL` and `Webhook URL` can be configured later. - -Please note to remember to push `Save changes` button. - -### Deploy container image - -Octovy container image is published into both of GitHub Container Registry `ghcr.io/m-mizutani/octovy` and Google Container Registry `gcr.io/octovy/octovy`. +```bash +# NOTICE: Be careful not to save the password to shell history +$ export PGPASSWORD=[db_password] +$ psqldef -U [db_user] -p [db_port] -h [db_host] -f database/schema.sql [db_name] +``` -| Registry | Commit | Release | Latest | -|:--------------------------|:------:|:-------:|:------:| -| GitHub Container Registry | x | x | x | -| Google Container Registry | | x | x | +### 3. Deploying Octovy -- Commit: Images built by all push event on `main` branch. Tag is commit ID (e.g. `ghcr.io/m-mizutani/octovy:2e96dedacb63c7c8ddf51fccac7780822081057a`) -- Release: Image built by release. Tag is version number (e.g. `ghcr.io/m-mizutani/octovy:v0.1.0`) -- Latest: Image built by latest release. Tag is `latest`. +The recommended method of deploying Octovy is via a container image, available at `ghcr.io/m-mizutani/octovy`. This image is built using GitHub Actions and published to the GitHub Container Registry. -Run container image with following environment variables. +To run Octovy, set the following environment variables: -- General - - `OCTOVY_FRONTEND_URL`: Set `https://{your-domain}` - - `OCTOVY_ADDR`: Recommend to use `0.0.0.0` - - `OCTOVY_PORT`: (Optional) Can change port number of octovy if you needed - - `OCTOVY_LOG_LEVEL`: (Optional) Choose log level from `trace`, `debug`, ` - - `OCTOVY_LOG_FORMAT`: (Optional) Recommend to use `json` in cloud environment. - - `GIN_MODE`: (Optional) Set `release` if you want to avoid debug log of gin-gonic. - GitHub App - - `OCTOVY_GITHUB_APP_ID`: Set App ID of your GitHub App - - `OCTOVY_GITHUB_CLIENT_ID`: Set Client ID of your GitHub App - - `OCTOVY_GITHUB_APP_PRIVATE_KEY`: Set private key value (content of key file) of your GitHub App - - `OCTOVY_GITHUB_SECRET`: Set Client secret of your GitHub App - - `OCTOVY_GITHUB_WEBHOOK_SECRET`: (Optional) Set webhook secret that you set + - `OCTOVY_GITHUB_APP_ID`: App ID of your GitHub App + - `OCTOVY_GITHUB_APP_PRIVATE_KEY`: Private key of your GitHub App + - `OCTOVY_GITHUB_SECRET`: Webhook secret of your GitHub App +- Network + - `OCTOVY_ADDR`: Listening address (e.g. `0.0.0.0:8080`) - Database - - `OCTOVY_DB_TYPE`: Database type. Recommend to use `postgres` - - `OCTOVY_DB_CONFIG`: DSN of your database. Example: `host=x.x.x.x port=5432 user=octovy_app dbname=octovy_db password=xxxxxx` -- Custom GitHub check rule by Rego policy - - `OCTOVY_CHECK_POLICY_DATA`: Check result policy in Rego (plain text) - - `OCTOVY_CHECK_POLICY_FILE`: Check result policy in Rego (file path) -- Custom GitHub check rule by OPA server - - `OCTOVY_OPA_URL`: OPA server URL (e.g. https://opa.example.com) - - `OCTOVY_OPA_PATH`: Additional path of OPA. For example, octovy accesses `https://opa.example.com/v1/data/mypolicy/check` by setting `OCTOVY_OPA_PATH` = `mypolicy`. - - `OCTOVY_OPA_IAP`: Set "1" if you want to access OPA server through Google IAP - -`OCTOVY_GITHUB_APP_PRIVATE_KEY`, `OCTOVY_GITHUB_SECRET`, `OCTOVY_GITHUB_WEBHOOK_SECRET` and `OCTOVY_DB_CONFIG` may contain secret values. I highly recommend to use secret variable management service (e.g. [Secret Manager](https://cloud.google.com/secret-manager) of Google Cloud and [AWS Secrets Manager](https://aws.amazon.com/jp/secrets-manager/)). - -An example of deploy script to Cloud Run is available in [tools/deploy_cloud_run.sh](tools/deploy_cloud_run.sh). - -### Custom GitHub check policy - -You can define custom policy for result of GitHub check run by [Rego](https://www.openpolicyagent.org/docs/latest/). - -#### Example - -A following example is a policy to make CI fail if the commit has a package that has `CVE-2021-0000` vulnerability. - -```rego -package octovy.check - -default result = "success" - -result = "failure" { - vulnID := input.sources[_].packages[_].vuln_ids[_] - vulnID == "CVE-2021-0000" -} -``` - -#### Policy specification - -- Package - - `package octovy.check` is required at head line of policy -- Input - - `model.ScanReport` of scan result -- Output: - - `result` as string type (required): It must be either one of `conclusion` in [GitHub check parameters](https://docs.github.com/en/rest/reference/checks#update-a-check-run--parameters). - - `msg` as string type (optional): The message will be appeared in title of check result if given. + - `OCTOVY_DB_HOST`: Hostname of your PostgreSQL database + - `OCTOVY_DB_PORT`: Port number of your PostgreSQL database + - `OCTOVY_DB_USER`: Username of your PostgreSQL database + - `OCTOVY_DB_PASSWORD`: Password of your PostgreSQL database + - `OCTOVY_DB_NAME`: Database name of your PostgreSQL database +- Logging + - `OCTOVY_LOG_LEVEL`: Log level (e.g. `debug`, `info`, `warn`, `error`) + - `OCTOVY_LOG_FORMAT`: Log format, recommend to use `json` ## License -The MIT License, Copyright 2021 Masayoshi Mizutani \ No newline at end of file +Octovy is licensed under the Apache License 2.0. Copyright 2023 Masayoshi Mizutani \ No newline at end of file diff --git a/assets/dummy.go b/assets/dummy.go deleted file mode 100644 index a7481e2..0000000 --- a/assets/dummy.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build github -// +build github - -package assets - -import "embed" - -var assets embed.FS - -func Assets() *embed.FS { - return &assets -} diff --git a/assets/embed.go b/assets/embed.go deleted file mode 100644 index cdbde64..0000000 --- a/assets/embed.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build !github -// +build !github - -package assets - -import "embed" - -//go:embed out/* -//go:embed out/_next/static/*/* -//go:embed out/_next/static/*/*.js -//go:embed out/_next/static/chunks/pages/*.js -//go:embed out/_next/static/chunks/pages/*/*.js -var assets embed.FS - -func Assets() *embed.FS { - return &assets -} diff --git a/assets/embed_test.go b/assets/embed_test.go deleted file mode 100644 index 493792f..0000000 --- a/assets/embed_test.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build !github -// +build !github - -package assets_test - -import ( - "os" - "testing" - - "github.com/m-mizutani/octovy/assets" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestAssets(t *testing.T) { - if _, ok := os.LookupEnv("GITHUB_WORKFLOW"); ok { - t.Skip("bundle.js is not generated in GitHub Actions") - } - - t.Run("index.html loadable", func(t *testing.T) { - raw, err := assets.Assets().ReadFile("out/index.html") - require.NoError(t, err) - assert.Contains(t, string(raw), "") - }) - - t.Run("files in out of ./out/ directory can not be loaded", func(t *testing.T) { - _, err := assets.Assets().ReadFile("assets.go") - require.Error(t, err) - }) -} diff --git a/assets/next.config.js b/assets/next.config.js deleted file mode 100644 index 1874326..0000000 --- a/assets/next.config.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - async rewrites() { - return [ - { - source: "/api/:path*", - destination: "http://127.0.0.1:9080/api/:path*", - }, - { - source: "/auth/:path*", - destination: "http://127.0.0.1:9080/auth/:path*", - }, - ]; - }, -}; diff --git a/assets/package-lock.json b/assets/package-lock.json deleted file mode 100644 index 7ebdf21..0000000 --- a/assets/package-lock.json +++ /dev/null @@ -1,9585 +0,0 @@ -{ - "name": "assets", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "assets", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "@emotion/react": "^11.4.1", - "@emotion/styled": "^11.3.0", - "@mui/icons-material": "^5.0.0", - "@mui/material": "^5.0.0", - "@mui/styles": "^5.0.0", - "javascript-time-ago": "^2.3.10", - "next": "^11.1.2", - "react": "^17.0.2", - "react-color": "^2.19.3", - "react-dom": "^17.0.2", - "react-markdown": "^7.0.1", - "react-time-ago": "^7.1.4", - "strftime": "^0.10.0" - }, - "devDependencies": { - "@types/react": "^17.0.22", - "typescript": "^4.4.3" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", - "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", - "dependencies": { - "@babel/highlight": "^7.10.4" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.15.0.tgz", - "integrity": "sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==", - "peer": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.15.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.5.tgz", - "integrity": "sha512-pYgXxiwAgQpgM1bNkZsDEq85f0ggXMA5L7c+o3tskGMh2BunCI9QUwB9Z4jpvXUOuMdyGKiGKQiRe11VS6Jzvg==", - "peer": true, - "dependencies": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.4", - "@babel/helpers": "^7.15.4", - "@babel/parser": "^7.15.5", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/core/node_modules/@babel/code-frame": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", - "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", - "peer": true, - "dependencies": { - "@babel/highlight": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core/node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "peer": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@babel/core/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "peer": true - }, - "node_modules/@babel/core/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@babel/generator": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.4.tgz", - "integrity": "sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==", - "peer": true, - "dependencies": { - "@babel/types": "^7.15.4", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/generator/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/generator/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz", - "integrity": "sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==", - "peer": true, - "dependencies": { - "@babel/compat-data": "^7.15.0", - "@babel/helper-validator-option": "^7.14.5", - "browserslist": "^4.16.6", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", - "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", - "peer": true, - "dependencies": { - "@babel/helper-get-function-arity": "^7.15.4", - "@babel/template": "^7.15.4", - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-get-function-arity": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", - "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", - "peer": true, - "dependencies": { - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-get-function-arity/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", - "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", - "peer": true, - "dependencies": { - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz", - "integrity": "sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA==", - "peer": true, - "dependencies": { - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz", - "integrity": "sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA==", - "dependencies": { - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.7.tgz", - "integrity": "sha512-ZNqjjQG/AuFfekFTY+7nY4RgBSklgTu970c7Rj3m/JOhIu5KPBUuTA9AY6zaKcUvk4g6EbDXdBnhi35FAssdSw==", - "peer": true, - "dependencies": { - "@babel/helper-module-imports": "^7.15.4", - "@babel/helper-replace-supers": "^7.15.4", - "@babel/helper-simple-access": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/helper-validator-identifier": "^7.15.7", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz", - "integrity": "sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw==", - "peer": true, - "dependencies": { - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-optimise-call-expression/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz", - "integrity": "sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz", - "integrity": "sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw==", - "peer": true, - "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.15.4", - "@babel/helper-optimise-call-expression": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-replace-supers/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz", - "integrity": "sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg==", - "peer": true, - "dependencies": { - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", - "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", - "peer": true, - "dependencies": { - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", - "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", - "peer": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.4.tgz", - "integrity": "sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ==", - "peer": true, - "dependencies": { - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", - "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.5", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.7.tgz", - "integrity": "sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g==", - "peer": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.14.5.tgz", - "integrity": "sha512-ohuFIsOMXJnbOMRfX7/w7LocdR6R7whhuRD4ax8IipLcLPlZGJKkBxgHp++U4N/vKyU16/YDQr2f5seajD3jIw==", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/runtime": { - "version": "7.15.3", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.3.tgz", - "integrity": "sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA==", - "dependencies": { - "regenerator-runtime": "^0.13.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", - "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", - "peer": true, - "dependencies": { - "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template/node_modules/@babel/code-frame": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", - "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", - "peer": true, - "dependencies": { - "@babel/highlight": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", - "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", - "peer": true, - "dependencies": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-function-name": "^7.15.4", - "@babel/helper-hoist-variables": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4", - "debug": "^4.1.0", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse/node_modules/@babel/code-frame": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", - "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", - "peer": true, - "dependencies": { - "@babel/highlight": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse/node_modules/@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse/node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "peer": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@babel/traverse/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "peer": true - }, - "node_modules/@babel/types": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.0.tgz", - "integrity": "sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ==", - "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@emotion/babel-plugin": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.3.0.tgz", - "integrity": "sha512-UZKwBV2rADuhRp+ZOGgNWg2eYgbzKzQXfQPtJbu/PLy8onurxlNCLvxMQEvlr1/GudguPI5IU9qIY1+2z1M5bA==", - "dependencies": { - "@babel/helper-module-imports": "^7.12.13", - "@babel/plugin-syntax-jsx": "^7.12.13", - "@babel/runtime": "^7.13.10", - "@emotion/hash": "^0.8.0", - "@emotion/memoize": "^0.7.5", - "@emotion/serialize": "^1.0.2", - "babel-plugin-macros": "^2.6.1", - "convert-source-map": "^1.5.0", - "escape-string-regexp": "^4.0.0", - "find-root": "^1.1.0", - "source-map": "^0.5.7", - "stylis": "^4.0.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@emotion/babel-plugin/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@emotion/babel-plugin/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@emotion/babel-plugin/node_modules/stylis": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", - "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" - }, - "node_modules/@emotion/cache": { - "version": "11.4.0", - "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz", - "integrity": "sha512-Zx70bjE7LErRO9OaZrhf22Qye1y4F7iDl+ITjet0J+i+B88PrAOBkKvaAWhxsZf72tDLajwCgfCjJ2dvH77C3g==", - "dependencies": { - "@emotion/memoize": "^0.7.4", - "@emotion/sheet": "^1.0.0", - "@emotion/utils": "^1.0.0", - "@emotion/weak-memoize": "^0.2.5", - "stylis": "^4.0.3" - } - }, - "node_modules/@emotion/cache/node_modules/stylis": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", - "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" - }, - "node_modules/@emotion/hash": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", - "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" - }, - "node_modules/@emotion/is-prop-valid": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.1.0.tgz", - "integrity": "sha512-9RkilvXAufQHsSsjQ3PIzSns+pxuX4EW8EbGeSPjZMHuMx6z/MOzb9LpqNieQX4F3mre3NWS2+X3JNRHTQztUQ==", - "dependencies": { - "@emotion/memoize": "^0.7.4" - } - }, - "node_modules/@emotion/memoize": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.5.tgz", - "integrity": "sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ==" - }, - "node_modules/@emotion/react": { - "version": "11.4.1", - "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.4.1.tgz", - "integrity": "sha512-pRegcsuGYj4FCdZN6j5vqCALkNytdrKw3TZMekTzNXixRg4wkLsU5QEaBG5LC6l01Vppxlp7FE3aTHpIG5phLg==", - "dependencies": { - "@babel/runtime": "^7.13.10", - "@emotion/cache": "^11.4.0", - "@emotion/serialize": "^1.0.2", - "@emotion/sheet": "^1.0.2", - "@emotion/utils": "^1.0.0", - "@emotion/weak-memoize": "^0.2.5", - "hoist-non-react-statics": "^3.3.1" - }, - "peerDependencies": { - "@babel/core": "^7.0.0", - "react": ">=16.8.0" - }, - "peerDependenciesMeta": { - "@babel/core": { - "optional": true - }, - "@types/react": { - "optional": true - } - } - }, - "node_modules/@emotion/serialize": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.2.tgz", - "integrity": "sha512-95MgNJ9+/ajxU7QIAruiOAdYNjxZX7G2mhgrtDWswA21VviYIRP1R5QilZ/bDY42xiKsaktP4egJb3QdYQZi1A==", - "dependencies": { - "@emotion/hash": "^0.8.0", - "@emotion/memoize": "^0.7.4", - "@emotion/unitless": "^0.7.5", - "@emotion/utils": "^1.0.0", - "csstype": "^3.0.2" - } - }, - "node_modules/@emotion/sheet": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.2.tgz", - "integrity": "sha512-QQPB1B70JEVUHuNtzjHftMGv6eC3Y9wqavyarj4x4lg47RACkeSfNo5pxIOKizwS9AEFLohsqoaxGQj4p0vSIw==" - }, - "node_modules/@emotion/styled": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.3.0.tgz", - "integrity": "sha512-fUoLcN3BfMiLlRhJ8CuPUMEyKkLEoM+n+UyAbnqGEsCd5IzKQ7VQFLtzpJOaCD2/VR2+1hXQTnSZXVJeiTNltA==", - "dependencies": { - "@babel/runtime": "^7.13.10", - "@emotion/babel-plugin": "^11.3.0", - "@emotion/is-prop-valid": "^1.1.0", - "@emotion/serialize": "^1.0.2", - "@emotion/utils": "^1.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0", - "@emotion/react": "^11.0.0-rc.0", - "react": ">=16.8.0" - }, - "peerDependenciesMeta": { - "@babel/core": { - "optional": true - }, - "@types/react": { - "optional": true - } - } - }, - "node_modules/@emotion/unitless": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", - "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" - }, - "node_modules/@emotion/utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", - "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==" - }, - "node_modules/@emotion/weak-memoize": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", - "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" - }, - "node_modules/@hapi/accept": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@hapi/accept/-/accept-5.0.2.tgz", - "integrity": "sha512-CmzBx/bXUR8451fnZRuZAJRlzgm0Jgu5dltTX/bszmR2lheb9BpyN47Q1RbaGTsvFzn0PXAEs+lXDKfshccYZw==", - "dependencies": { - "@hapi/boom": "9.x.x", - "@hapi/hoek": "9.x.x" - } - }, - "node_modules/@hapi/boom": { - "version": "9.1.4", - "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", - "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", - "dependencies": { - "@hapi/hoek": "9.x.x" - } - }, - "node_modules/@hapi/hoek": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", - "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" - }, - "node_modules/@icons/material": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@icons/material/-/material-0.2.4.tgz", - "integrity": "sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw==", - "peerDependencies": { - "react": "*" - } - }, - "node_modules/@mui/core": { - "version": "5.0.0-alpha.47", - "resolved": "https://registry.npmjs.org/@mui/core/-/core-5.0.0-alpha.47.tgz", - "integrity": "sha512-/GCIWOq+ydeY8HTWexrvQw7OsmRRvdzW+BB4vQ+V6alaECKSXPQrTDuQtd+lgI2il4p7uhPIKIqjcaAZ/FaNHA==", - "dependencies": { - "@babel/runtime": "^7.14.8", - "@emotion/is-prop-valid": "^1.1.0", - "@mui/utils": "^5.0.0", - "clsx": "^1.1.1", - "prop-types": "^15.7.2", - "react-is": "^17.0.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "@types/react": "^16.8.6 || ^17.0.0", - "react": "^17.0.2", - "react-dom": "^17.0.2" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/icons-material": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.0.0.tgz", - "integrity": "sha512-Vl5pMIdD1MC+LVBEKDQkWeoU/0mdxx/WLBuTVo5y2yzOzEp8gcwkegtiUyN1gubiXcqzNNZQNvJ6/YSdFRr84Q==", - "dependencies": { - "@babel/runtime": "^7.14.8" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "@mui/material": "^5.0.0-rc.0", - "@types/react": "^16.8.6 || ^17.0.0", - "react": "^17.0.2" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/material": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.0.0.tgz", - "integrity": "sha512-XZNPYQocFyS2Q8Wc7PMudazKa8VDaXADK9PxUfOF6Q0GQNXjLkOn1vRWlyF9EOZQ4QLbgJHyHDlH7ELBN0CA0w==", - "dependencies": { - "@babel/runtime": "^7.14.8", - "@mui/core": "5.0.0-alpha.47", - "@mui/system": "^5.0.0", - "@mui/types": "^7.0.0", - "@mui/utils": "^5.0.0", - "@popperjs/core": "^2.4.4", - "@types/react-transition-group": "^4.4.2", - "clsx": "^1.1.1", - "csstype": "^3.0.8", - "hoist-non-react-statics": "^3.3.2", - "prop-types": "^15.7.2", - "react-is": "^17.0.2", - "react-transition-group": "^4.4.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/material-ui" - }, - "peerDependencies": { - "@emotion/react": "^11.4.1", - "@emotion/styled": "^11.3.0", - "@types/react": "^16.8.6 || ^17.0.0", - "react": "^17.0.2", - "react-dom": "^17.0.2" - }, - "peerDependenciesMeta": { - "@emotion/react": { - "optional": true - }, - "@emotion/styled": { - "optional": true - }, - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/private-theming": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.0.0.tgz", - "integrity": "sha512-xCaQss6B6EyEPxyn/vv5CwidqihrF6AJlrCYDgOAqYHtCgBhzMjWhh/n4L3jlrt4SmE+STHD2FdA8DImpEgItg==", - "dependencies": { - "@babel/runtime": "^7.14.8", - "@mui/utils": "^5.0.0", - "prop-types": "^15.7.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/material-ui" - }, - "peerDependencies": { - "@types/react": "^16.8.6 || ^17.0.0", - "react": "^17.0.2" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/styled-engine": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.0.0.tgz", - "integrity": "sha512-JoZLKLB6WoXYPbMNDzz2gC8incY6zyx0dd1jFg3faOzp2NuzEremDbY/Lmo93M22cOjd3cLInoup+Wm7O05d0A==", - "dependencies": { - "@babel/runtime": "^7.14.8", - "@emotion/cache": "^11.4.0", - "prop-types": "^15.7.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/material-ui" - }, - "peerDependencies": { - "@emotion/react": "^11.4.1", - "@emotion/styled": "^11.3.0", - "react": "^17.0.2" - }, - "peerDependenciesMeta": { - "@emotion/react": { - "optional": true - }, - "@emotion/styled": { - "optional": true - } - } - }, - "node_modules/@mui/styles": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/styles/-/styles-5.0.0.tgz", - "integrity": "sha512-J4Cg43m1M+7HsvV4XtTGAs39ogZcnzTUDxw0VbEdDdaEYdXG0jC5VXT/UouOPI2SWA3/v+trfanW8t/U2pIsqA==", - "dependencies": { - "@babel/runtime": "^7.14.8", - "@emotion/hash": "^0.8.0", - "@mui/private-theming": "^5.0.0", - "@mui/types": "^7.0.0", - "@mui/utils": "^5.0.0", - "clsx": "^1.1.1", - "csstype": "^3.0.8", - "hoist-non-react-statics": "^3.3.2", - "jss": "^10.7.1", - "jss-plugin-camel-case": "^10.7.1", - "jss-plugin-default-unit": "^10.7.1", - "jss-plugin-global": "^10.7.1", - "jss-plugin-nested": "^10.7.1", - "jss-plugin-props-sort": "^10.7.1", - "jss-plugin-rule-value-function": "^10.7.1", - "jss-plugin-vendor-prefixer": "^10.7.1", - "prop-types": "^15.7.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/material-ui" - }, - "peerDependencies": { - "@types/react": "^16.8.6 || ^17.0.0", - "react": "^17.0.2" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/system": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.0.0.tgz", - "integrity": "sha512-CT5HLbQjzPZLMl5EjqY++lVuKVQKGbRNKQtOTpM2ABta6QQSTj/vARbIPYSZnwpDGUyGyzBZp2xfI3X3UNyVOg==", - "dependencies": { - "@babel/runtime": "^7.14.8", - "@mui/private-theming": "^5.0.0", - "@mui/styled-engine": "^5.0.0", - "@mui/types": "^7.0.0", - "@mui/utils": "^5.0.0", - "clsx": "^1.1.1", - "csstype": "^3.0.8", - "prop-types": "^15.7.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/material-ui" - }, - "peerDependencies": { - "@emotion/react": "^11.4.1", - "@emotion/styled": "^11.3.0", - "@types/react": "^16.8.6 || ^17.0.0", - "react": "^17.0.2" - }, - "peerDependenciesMeta": { - "@emotion/react": { - "optional": true - }, - "@emotion/styled": { - "optional": true - }, - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/types": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.0.0.tgz", - "integrity": "sha512-M/tkF2pZ4uoPhZ8pnNhlVnOFtz6F3dnYKIsnj8MuXKT6d26IE2u0UjA8B0275ggN74dR9rlHG5xJt5jgDx/Ung==", - "peerDependencies": { - "@types/react": "*" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/utils": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.0.0.tgz", - "integrity": "sha512-WGikt+LTiGadqqKIGRwPVGtOUHchEEN6/af/T6nln8REkE2COY5nUirNc89ciPz1AznwZFzLtDmNkeV3NqUz2w==", - "dependencies": { - "@babel/runtime": "^7.14.8", - "@types/prop-types": "^15.7.4", - "@types/react-is": "^16.7.1 || ^17.0.0", - "prop-types": "^15.7.2", - "react-is": "^17.0.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "react": "^17.0.2" - } - }, - "node_modules/@napi-rs/triples": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@napi-rs/triples/-/triples-1.0.3.tgz", - "integrity": "sha512-jDJTpta+P4p1NZTFVLHJ/TLFVYVcOqv6l8xwOeBKNPMgY/zDYH/YH7SJbvrr/h1RcS9GzbPcLKGzpuK9cV56UA==" - }, - "node_modules/@next/env": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-11.1.3.tgz", - "integrity": "sha512-5+vaeooJuWmICSlmVaAC8KG3O8hwKasACVfkHj58xQuCB5SW0TKW3hWxgxkBuefMBn1nM0yEVPKokXCsYjBtng==" - }, - "node_modules/@next/polyfill-module": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/polyfill-module/-/polyfill-module-11.1.3.tgz", - "integrity": "sha512-7yr9cr4a0SrBoVE8psxXWK1wTFc8UzsY8Wc2cWGL7qA0hgtqACHaXC47M1ByJB410hFZenGrpE+KFaT1unQMyw==" - }, - "node_modules/@next/react-dev-overlay": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/react-dev-overlay/-/react-dev-overlay-11.1.3.tgz", - "integrity": "sha512-zIwtMliSUR+IKl917ToFNB+0fD7bI5kYMdjHU/UEKpfIXAZPnXRHHISCvPDsczlr+bRsbjlUFW1CsNiuFedeuQ==", - "dependencies": { - "@babel/code-frame": "7.12.11", - "anser": "1.4.9", - "chalk": "4.0.0", - "classnames": "2.2.6", - "css.escape": "1.5.1", - "data-uri-to-buffer": "3.0.1", - "platform": "1.3.6", - "shell-quote": "1.7.2", - "source-map": "0.8.0-beta.0", - "stacktrace-parser": "0.1.10", - "strip-ansi": "6.0.0" - }, - "peerDependencies": { - "react": "^17.0.2", - "react-dom": "^17.0.2" - } - }, - "node_modules/@next/react-dev-overlay/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@next/react-dev-overlay/node_modules/chalk": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", - "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@next/react-dev-overlay/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@next/react-dev-overlay/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/@next/react-dev-overlay/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@next/react-dev-overlay/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@next/react-refresh-utils": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/react-refresh-utils/-/react-refresh-utils-11.1.3.tgz", - "integrity": "sha512-144kD8q2nChw67V3AJJlPQ6NUJVFczyn10bhTynn9o2rY5DEnkzuBipcyMuQl2DqfxMkV7sn+yOCOYbrLCk9zg==", - "peerDependencies": { - "react-refresh": "0.8.3", - "webpack": "^4 || ^5" - }, - "peerDependenciesMeta": { - "webpack": { - "optional": true - } - } - }, - "node_modules/@next/swc-darwin-arm64": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-11.1.3.tgz", - "integrity": "sha512-TwP4krjhs+uU9pesDYCShEXZrLSbJr78p12e7XnLBBaNf20SgWLlVmQUT9gX9KbWan5V0sUbJfmcS8MRNHgYuA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-darwin-x64": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-11.1.3.tgz", - "integrity": "sha512-ZSWmkg/PxccHFNUSeBdrfaH8KwSkoeUtewXKvuYYt7Ph0yRsbqSyNIvhUezDua96lApiXXq6EL2d1THfeWomvw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-gnu": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-11.1.3.tgz", - "integrity": "sha512-PrTBN0iZudAuj4jSbtXcdBdmfpaDCPIneG4Oms4zcs93KwMgLhivYW082Mvlgx9QVEiRm7+RkFpIVtG/i7JitA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-x64-msvc": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-11.1.3.tgz", - "integrity": "sha512-mRwbscVjRoHk+tDY7XbkT5d9FCwujFIQJpGp0XNb1i5OHCSDO8WW/C9cLEWS4LxKRbIZlTLYg1MTXqLQkvva8w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@node-rs/helper": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@node-rs/helper/-/helper-1.2.1.tgz", - "integrity": "sha512-R5wEmm8nbuQU0YGGmYVjEc0OHtYsuXdpRG+Ut/3wZ9XAvQWyThN08bTh2cBJgoZxHQUPtvRfeQuxcAgLuiBISg==", - "dependencies": { - "@napi-rs/triples": "^1.0.3" - } - }, - "node_modules/@popperjs/core": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.10.1.tgz", - "integrity": "sha512-HnUhk1Sy9IuKrxEMdIRCxpIqPw6BFsbYSEUO9p/hNw5sMld/+3OLMWQP80F8/db9qsv3qUjs7ZR5bS/R+iinXw==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/popperjs" - } - }, - "node_modules/@types/debug": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", - "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==", - "dependencies": { - "@types/ms": "*" - } - }, - "node_modules/@types/hast": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz", - "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==", - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/@types/mdast": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.10.tgz", - "integrity": "sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA==", - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/@types/mdurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", - "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==" - }, - "node_modules/@types/ms": { - "version": "0.7.31", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", - "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" - }, - "node_modules/@types/node": { - "version": "16.9.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz", - "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpqlpgAAo6H/qnM9RjBgh0A0kmHf3XxAKLdN5mTIng9iUvVLA==" - }, - "node_modules/@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" - }, - "node_modules/@types/prop-types": { - "version": "15.7.4", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", - "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==" - }, - "node_modules/@types/react": { - "version": "17.0.22", - "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.22.tgz", - "integrity": "sha512-kq/BMeaAVLJM6Pynh8C2rnr/drCK+/5ksH0ch9asz+8FW3DscYCIEFtCeYTFeIx/ubvOsMXmRfy7qEJ76gM96A==", - "dependencies": { - "@types/prop-types": "*", - "@types/scheduler": "*", - "csstype": "^3.0.2" - } - }, - "node_modules/@types/react-is": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/@types/react-is/-/react-is-17.0.2.tgz", - "integrity": "sha512-2+L0ilcAEG8udkDnvx8B0upwXFBbNnVwOsSCTxW3SDOkmar9NyEeLG0ZLa3uOEw9zyYf/fQapcnfXAVmDKlyHw==", - "dependencies": { - "@types/react": "*" - } - }, - "node_modules/@types/react-transition-group": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.3.tgz", - "integrity": "sha512-fUx5muOWSYP8Bw2BUQ9M9RK9+W1XBK/7FLJ8PTQpnpTEkn0ccyMffyEQvan4C3h53gHdx7KE5Qrxi/LnUGQtdg==", - "dependencies": { - "@types/react": "*" - } - }, - "node_modules/@types/scheduler": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", - "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" - }, - "node_modules/@types/unist": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", - "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==" - }, - "node_modules/acorn": { - "version": "5.7.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", - "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-es7-plugin": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz", - "integrity": "sha1-8u4fMiipDurRJF+asZIusucdM2s=" - }, - "node_modules/anser": { - "version": "1.4.9", - "resolved": "https://registry.npmjs.org/anser/-/anser-1.4.9.tgz", - "integrity": "sha512-AI+BjTeGt2+WFk4eWcqbQ7snZpDBt8SaLlj0RT2h5xfdWaiy51OjYvqwMrNzJLGy8iOAL6nKDITWO+rd4MkYEA==" - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/array-filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", - "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=" - }, - "node_modules/asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", - "dependencies": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/asn1.js/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/assert": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", - "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", - "dependencies": { - "es6-object-assign": "^1.1.0", - "is-nan": "^1.2.1", - "object-is": "^1.0.1", - "util": "^0.12.0" - } - }, - "node_modules/ast-types": { - "version": "0.13.2", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.2.tgz", - "integrity": "sha512-uWMHxJxtfj/1oZClOxDEV1sQ1HCDkA4MG8Gr69KKeBjEVH0R84WlejZ0y2DcwyBlpAEMltmVYkVgqfLFb2oyiA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/babel-plugin-macros": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz", - "integrity": "sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "cosmiconfig": "^6.0.0", - "resolve": "^1.12.0" - } - }, - "node_modules/bail": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.1.tgz", - "integrity": "sha512-d5FoTAr2S5DSUPKl85WNm2yUwsINN8eidIdIwsOge2t33DaOfOdSmmsI11jMN3GmALCXaw+Y6HMVHDzePshFAA==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "engines": { - "node": "*" - } - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/bn.js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", - "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "node_modules/browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dependencies": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dependencies": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "node_modules/browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "dependencies": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/browserify-rsa": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", - "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", - "dependencies": { - "bn.js": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "node_modules/browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", - "dependencies": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - } - }, - "node_modules/browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dependencies": { - "pako": "~1.0.5" - } - }, - "node_modules/browserslist": { - "version": "4.16.6", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", - "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", - "dependencies": { - "caniuse-lite": "^1.0.30001219", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.723", - "escalade": "^3.1.1", - "node-releases": "^1.1.71" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } - }, - "node_modules/buffer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", - "dependencies": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, - "node_modules/buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" - }, - "node_modules/builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" - }, - "node_modules/bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/call-signature": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/call-signature/-/call-signature-0.0.2.tgz", - "integrity": "sha1-qEq8glpV70yysCi9dOIFpluaSZY=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001258", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001258.tgz", - "integrity": "sha512-RBByOG6xWXUp0CR2/WU2amXz3stjKpSl5J1xU49F1n2OxD//uBZO4wCKUiG+QMGf7CHGfDDcqoKriomoGVxTeA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } - }, - "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/character-entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.0.tgz", - "integrity": "sha512-oHqMj3eAuJ77/P5PaIRcqk+C3hdfNwyCD2DAUcD5gyXkegAuF2USC40CEqPscDk4I8FRGMTojGJQkXDsN5QlJA==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-entities-legacy": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-2.0.0.tgz", - "integrity": "sha512-YwaEtEvWLpFa6Wh3uVLrvirA/ahr9fki/NUd/Bd4OR6EdJ8D22hovYQEOUCBfQfcqnC4IAMGMsHXY1eXgL4ZZA==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-reference-invalid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.0.tgz", - "integrity": "sha512-pE3Z15lLRxDzWJy7bBHBopRwfI20sbrMVLQTC7xsPglCHf4Wv1e167OgYAFP78co2XlhojDyAqA+IAJse27//g==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/chokidar": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", - "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", - "dependencies": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.1" - } - }, - "node_modules/cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/classnames": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz", - "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==" - }, - "node_modules/clsx": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz", - "integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==", - "engines": { - "node": ">=6" - } - }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "node_modules/colorette": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", - "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==" - }, - "node_modules/comma-separated-tokens": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.2.tgz", - "integrity": "sha512-G5yTt3KQN4Yn7Yk4ed73hlZ1evrFKXeUW3086p3PRFNp7m2vIjI6Pg+Kgb+oyzhd9F2qdcoj67+y3SdxL5XWsg==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" - }, - "node_modules/console-browserify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", - "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" - }, - "node_modules/constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=" - }, - "node_modules/convert-source-map": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "dependencies": { - "safe-buffer": "~5.1.1" - } - }, - "node_modules/convert-source-map/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/core-js": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", - "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", - "deprecated": "core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.", - "hasInstallScript": true - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" - }, - "node_modules/cosmiconfig": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", - "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", - "dependencies": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.1.0", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.7.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/create-ecdh": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", - "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", - "dependencies": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" - } - }, - "node_modules/create-ecdh/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dependencies": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "node_modules/create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dependencies": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "node_modules/crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dependencies": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - }, - "engines": { - "node": "*" - } - }, - "node_modules/css-vendor": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz", - "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==", - "dependencies": { - "@babel/runtime": "^7.8.3", - "is-in-browser": "^1.0.2" - } - }, - "node_modules/css.escape": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", - "integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=" - }, - "node_modules/cssnano-preset-simple": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssnano-preset-simple/-/cssnano-preset-simple-3.0.0.tgz", - "integrity": "sha512-vxQPeoMRqUT3c/9f0vWeVa2nKQIHFpogtoBvFdW4GQ3IvEJ6uauCP6p3Y5zQDLFcI7/+40FTgX12o7XUL0Ko+w==", - "dependencies": { - "caniuse-lite": "^1.0.30001202" - }, - "peerDependencies": { - "postcss": "^8.2.15" - } - }, - "node_modules/cssnano-simple": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssnano-simple/-/cssnano-simple-3.0.0.tgz", - "integrity": "sha512-oU3ueli5Dtwgh0DyeohcIEE00QVfbPR3HzyXdAl89SfnQG3y0/qcpfLVW+jPIh3/rgMZGwuW96rejZGaYE9eUg==", - "dependencies": { - "cssnano-preset-simple": "^3.0.0" - }, - "peerDependencies": { - "postcss": "^8.2.15" - }, - "peerDependenciesMeta": { - "postcss": { - "optional": true - } - } - }, - "node_modules/csstype": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.9.tgz", - "integrity": "sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw==" - }, - "node_modules/data-uri-to-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", - "integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==", - "engines": { - "node": ">= 6" - } - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dependencies": { - "object-keys": "^1.0.12" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/des.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", - "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", - "dependencies": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "node_modules/diff-match-patch": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz", - "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==" - }, - "node_modules/diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dependencies": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, - "node_modules/diffie-hellman/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/dom-helpers": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", - "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", - "dependencies": { - "@babel/runtime": "^7.8.7", - "csstype": "^3.0.2" - } - }, - "node_modules/domain-browser": { - "version": "4.19.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-4.19.0.tgz", - "integrity": "sha512-fRA+BaAWOR/yr/t7T9E9GJztHPeFjj8U35ajyAjCDtAAnTn1Rc1f6W6VGPJrO1tkQv9zWu+JRof7z6oQtiYVFQ==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://bevry.me/fund" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" - }, - "node_modules/electron-to-chromium": { - "version": "1.3.844", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.844.tgz", - "integrity": "sha512-7ES6GQVsbgsUA49/apqub51I9ij8E3QwGqq/IRvO6OPCly3how/YUSg1GPslRWq+BteT2h94iAIQdJbuVVH4Pg==" - }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/emojis-list": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", - "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/empower": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/empower/-/empower-1.3.1.tgz", - "integrity": "sha512-uB6/ViBaawOO/uujFADTK3SqdYlxYNn+N4usK9MRKZ4Hbn/1QSy8k2PezxCA2/+JGbF8vd/eOfghZ90oOSDZCA==", - "dependencies": { - "core-js": "^2.0.0", - "empower-core": "^1.2.0" - } - }, - "node_modules/empower-core": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/empower-core/-/empower-core-1.2.0.tgz", - "integrity": "sha512-g6+K6Geyc1o6FdXs9HwrXleCFan7d66G5xSCfSF7x1mJDCes6t0om9lFQG3zOrzh3Bkb/45N0cZ5Gqsf7YrzGQ==", - "dependencies": { - "call-signature": "0.0.2", - "core-js": "^2.0.0" - } - }, - "node_modules/encoding": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", - "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", - "dependencies": { - "iconv-lite": "^0.6.2" - } - }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/es-abstract": { - "version": "1.18.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.6.tgz", - "integrity": "sha512-kAeIT4cku5eNLNuUKhlmtuk1/TRZvQoYccn6TO0cSVdf1kzB0T7+dYuVK9MWM7l+/53W2Q8M7N2c6MQvhXFcUQ==", - "dependencies": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.4", - "is-string": "^1.0.7", - "object-inspect": "^1.11.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es6-object-assign": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=" - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/espurify": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/espurify/-/espurify-1.8.1.tgz", - "integrity": "sha512-ZDko6eY/o+D/gHCWyHTU85mKDgYcS4FJj7S+YD6WIInm7GQ6AnOjmcL4+buFV/JOztVLELi/7MmuGU5NHta0Mg==", - "dependencies": { - "core-js": "^2.0.0" - } - }, - "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "engines": { - "node": ">=0.8.x" - } - }, - "node_modules/evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dependencies": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, - "node_modules/find-root": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", - "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==" - }, - "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "peer": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-orientation": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/get-orientation/-/get-orientation-1.1.2.tgz", - "integrity": "sha512-/pViTfifW+gBbh/RnlFYHINvELT9Znt+SYyDKAUL6uV6By019AK/s+i9XP4jSwq7lwP38Fd8HVeTxym3+hkwmQ==", - "dependencies": { - "stream-parser": "^0.3.1" - } - }, - "node_modules/get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" - }, - "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "peer": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "engines": { - "node": ">=4" - } - }, - "node_modules/has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "bin": { - "he": "bin/he" - } - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/hoist-non-react-statics": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", - "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", - "dependencies": { - "react-is": "^16.7.0" - } - }, - "node_modules/hoist-non-react-statics/node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - }, - "node_modules/http-errors": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", - "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=" - }, - "node_modules/hyphenate-style-name": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz", - "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==" - }, - "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/image-size": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-1.0.0.tgz", - "integrity": "sha512-JLJ6OwBfO1KcA+TvJT+v8gbE6iWbj24LyDNFgFEN0lzegn6cC6a/p3NIDaepMsJjQjlUWqIC7wJv8lBFxPNjcw==", - "dependencies": { - "queue": "6.0.2" - }, - "bin": { - "image-size": "bin/image-size.js" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/inline-style-parser": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz", - "integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==" - }, - "node_modules/internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "dependencies": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/is-alphabetical": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.0.tgz", - "integrity": "sha512-5OV8Toyq3oh4eq6sbWTYzlGdnMT/DPI5I0zxUBxjiigQsZycpkKF3kskkao3JyYGuYDHvhgJF+DrjMQp9SX86w==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-alphanumerical": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.0.tgz", - "integrity": "sha512-t+2GlJ+hO9yagJ+jU3+HSh80VKvz/3cG2cxbGGm4S0hjKuhWQXgPVUVOZz3tqZzMjhmphZ+1TIJTlRZRoe6GCQ==", - "dependencies": { - "is-alphabetical": "^2.0.0", - "is-decimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" - }, - "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dependencies": { - "has-bigints": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "engines": { - "node": ">=4" - } - }, - "node_modules/is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-core-module": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", - "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-decimal": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.0.tgz", - "integrity": "sha512-QfrfjQV0LjoWQ1K1XSoEZkTAzSa14RKVMa5zg3SdAfzEmQzRM4+tbSFWb78creCeA9rNBzaZal92opi1TwPWZw==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-hexadecimal": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.0.tgz", - "integrity": "sha512-vGOtYkiaxwIiR0+Ng/zNId+ZZehGfINwTzdrDqc6iubbnQWhnPuYymOzOKUDqa2cSl59yHnEh2h6MvRLQsyNug==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-in-browser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz", - "integrity": "sha1-Vv9NtoOgeMYILrldrX3GLh0E+DU=" - }, - "node_modules/is-nan": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", - "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-plain-obj": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.0.0.tgz", - "integrity": "sha512-NXRbBtUdBioI73y/HmOhogw/U5msYPC9DAtGkJXeFcFWSFZw0mCUsPxk/snTuJHzNKA8kLBK4rH97RMB1BfCXw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", - "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "node_modules/javascript-time-ago": { - "version": "2.3.10", - "resolved": "https://registry.npmjs.org/javascript-time-ago/-/javascript-time-ago-2.3.10.tgz", - "integrity": "sha512-eeZx3B8ACZpFTiaow4Xl3YTIG9UjebwVjHEDnKyzJ1NBve1ZqJIgy97yoT9Esw+Vf+XgSk4YCpOsyK5X/ByRzQ==", - "dependencies": { - "relative-time-format": "^1.0.6" - } - }, - "node_modules/jest-worker": { - "version": "27.0.0-next.5", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.0.0-next.5.tgz", - "integrity": "sha512-mk0umAQ5lT+CaOJ+Qp01N6kz48sJG2kr2n1rX0koqKf6FIygQV0qLOdN9SCYID4IVeSigDOcPeGLozdMLYfb5g==", - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "peer": true, - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" - }, - "node_modules/json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "peer": true, - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jss": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss/-/jss-10.8.0.tgz", - "integrity": "sha512-6fAMLJrVQ8epM5ghghxWqCwRR0ZamP2cKbOAtzPudcCMSNdAqtvmzQvljUZYR8OXJIeb/IpZeOXA1sDXms4R1w==", - "dependencies": { - "@babel/runtime": "^7.3.1", - "csstype": "^3.0.2", - "is-in-browser": "^1.1.3", - "tiny-warning": "^1.0.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/jss" - } - }, - "node_modules/jss-plugin-camel-case": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.8.0.tgz", - "integrity": "sha512-yxlXrXwcCdGw+H4BC187dEu/RFyW8joMcWfj8Rk9UPgWTKu2Xh7Sib4iW3xXjHe/t5phOHF1rBsHleHykWix7g==", - "dependencies": { - "@babel/runtime": "^7.3.1", - "hyphenate-style-name": "^1.0.3", - "jss": "10.8.0" - } - }, - "node_modules/jss-plugin-default-unit": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.8.0.tgz", - "integrity": "sha512-9XJV546cY9zV9OvIE/v/dOaxSi4062VfYQQfwbplRExcsU2a79Yn+qDz/4ciw6P4LV1Naq90U+OffAGRHfNq/Q==", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0" - } - }, - "node_modules/jss-plugin-global": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.8.0.tgz", - "integrity": "sha512-H/8h/bHd4e7P0MpZ9zaUG8NQSB2ie9rWo/vcCP6bHVerbKLGzj+dsY22IY3+/FNRS8zDmUyqdZx3rD8k4nmH4w==", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0" - } - }, - "node_modules/jss-plugin-nested": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.8.0.tgz", - "integrity": "sha512-MhmINZkSxyFILcFBuDoZmP1+wj9fik/b9SsjoaggkGjdvMQCES21mj4K5ZnRGVm448gIXyi9j/eZjtDzhaHUYQ==", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0", - "tiny-warning": "^1.0.2" - } - }, - "node_modules/jss-plugin-props-sort": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.8.0.tgz", - "integrity": "sha512-VY+Wt5WX5GMsXDmd+Ts8+O16fpiCM81svbox++U3LDbJSM/g9FoMx3HPhwUiDfmgHL9jWdqEuvSl/JAk+mh6mQ==", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0" - } - }, - "node_modules/jss-plugin-rule-value-function": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.8.0.tgz", - "integrity": "sha512-R8N8Ma6Oye1F9HroiUuHhVjpPsVq97uAh+rMI6XwKLqirIu2KFb5x33hPj+vNBMxSHc9jakhf5wG0BbQ7fSDOg==", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0", - "tiny-warning": "^1.0.2" - } - }, - "node_modules/jss-plugin-vendor-prefixer": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.8.0.tgz", - "integrity": "sha512-G1zD0J8dFwKZQ+GaZaay7A/Tg7lhDw0iEkJ/iFFA5UPuvZFpMprCMQttXcTBhLlhhWnyZ8YPn4yqp+amrhQekw==", - "dependencies": { - "@babel/runtime": "^7.3.1", - "css-vendor": "^2.0.8", - "jss": "10.8.0" - } - }, - "node_modules/lines-and-columns": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", - "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" - }, - "node_modules/loader-utils": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz", - "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==", - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^2.0.0", - "json5": "^1.0.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/loader-utils/node_modules/json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", - "dependencies": { - "minimist": "^1.2.0" - }, - "bin": { - "json5": "lib/cli.js" - } - }, - "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lodash-es": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" - }, - "node_modules/lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/material-colors": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz", - "integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg==" - }, - "node_modules/md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/mdast-util-definitions": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.0.tgz", - "integrity": "sha512-5hcR7FL2EuZ4q6lLMUK5w4lHT2H3vqL9quPvYZ/Ku5iifrirfMHiGdhxdXMUbUkDmz5I+TYMd7nbaxUhbQkfpQ==", - "dependencies": { - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "unist-util-visit": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-definitions/node_modules/unist-util-visit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-3.1.0.tgz", - "integrity": "sha512-Szoh+R/Ll68QWAyQyZZpQzZQm2UPbxibDvaY8Xc9SUtYgPsDzx5AWSk++UUt2hJuow8mvwR+rG+LQLw+KsuAKA==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-definitions/node_modules/unist-util-visit-parents": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-4.1.1.tgz", - "integrity": "sha512-1xAFJXAKpnnJl8G7K5KgU7FY55y3GcLIXqkzUj5QF/QVP7biUm0K0O2oqVkYsdjzJKifYeWn9+o6piAK2hGSHw==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-from-markdown": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-1.0.3.tgz", - "integrity": "sha512-8/GPJsE3h73C+PBFJ3cCdvegz07mLS8/5NfuIsP8q/cw/Ph/aximc6OYdfwerwcZqTYVu7WeXm/8+RDztxreZQ==", - "dependencies": { - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "mdast-util-to-string": "^3.1.0", - "micromark": "^3.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-decode-string": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "parse-entities": "^3.0.0", - "power-assert": "^1.0.0", - "unist-util-stringify-position": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-to-hast": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-11.3.0.tgz", - "integrity": "sha512-4o3Cli3hXPmm1LhB+6rqhfsIUBjnKFlIUZvudaermXB+4/KONdd/W4saWWkC+LBLbPMqhFSSTSRgafHsT5fVJw==", - "dependencies": { - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "@types/mdurl": "^1.0.0", - "mdast-util-definitions": "^5.0.0", - "mdurl": "^1.0.0", - "unist-builder": "^3.0.0", - "unist-util-generated": "^2.0.0", - "unist-util-position": "^4.0.0", - "unist-util-visit": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-to-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.1.0.tgz", - "integrity": "sha512-n4Vypz/DZgwo0iMHLQL49dJzlp7YtAJP+N07MZHpjPf/5XJuHUWstviF4Mn2jEiR/GNmtnRRqnwsXExk3igfFA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=" - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" - }, - "node_modules/micromark": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.0.6.tgz", - "integrity": "sha512-yzyfAHhglgEDprJnsvoQVPSXy5OnQfgyatGTxh0XVpismB5+aECnsHY2I1oxsySf6t/2FeamjOLoxun47nVhvw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "@types/debug": "^4.0.0", - "debug": "^4.0.0", - "micromark-core-commonmark": "^1.0.1", - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-chunked": "^1.0.0", - "micromark-util-combine-extensions": "^1.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-encode": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-resolve-all": "^1.0.0", - "micromark-util-sanitize-uri": "^1.0.0", - "micromark-util-subtokenize": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.1", - "parse-entities": "^3.0.0" - } - }, - "node_modules/micromark-core-commonmark": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.0.2.tgz", - "integrity": "sha512-nIxVDZnm1ra2BcnUSUWe9LC3UBTQ/sqUp4do80xXhtCWxBYj7u70Qw2CH54oZu7jblDCxDO3tmNBSprV5EWndg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-factory-destination": "^1.0.0", - "micromark-factory-label": "^1.0.0", - "micromark-factory-space": "^1.0.0", - "micromark-factory-title": "^1.0.0", - "micromark-factory-whitespace": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-chunked": "^1.0.0", - "micromark-util-classify-character": "^1.0.0", - "micromark-util-html-tag-name": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-resolve-all": "^1.0.0", - "micromark-util-subtokenize": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.1", - "parse-entities": "^3.0.0", - "power-assert": "^1.0.0" - } - }, - "node_modules/micromark-factory-destination": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.0.0.tgz", - "integrity": "sha512-eUBA7Rs1/xtTVun9TmV3gjfPz2wEwgK5R5xcbIM5ZYAtvGF6JkyaDsj0agx8urXnO31tEO6Ug83iVH3tdedLnw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/micromark-factory-label": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.0.1.tgz", - "integrity": "sha512-d/we+Gm9cqySOaPmtx109GEbG2dadb2myK9Tcm3aAx9Ug0IL4ucQtzKVoO+02HI10E76ncv9n/VEEF5ym0RzTQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "power-assert": "^1.0.0" - } - }, - "node_modules/micromark-factory-space": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-1.0.0.tgz", - "integrity": "sha512-qUmqs4kj9a5yBnk3JMLyjtWYN6Mzfcx8uJfi5XAveBniDevmZasdGBba5b4QsvRcAkmvGo5ACmSUmyGiKTLZew==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/micromark-factory-title": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.0.1.tgz", - "integrity": "sha512-nAdDygUZK7WtHFkNi01PzS33jeWPKZXA6LEABQiCVDXvNNUjdQ9o4stT8jBu3BNsE3ZulfG5IGdfWuOWS/CS+w==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "power-assert": "^1.0.0" - } - }, - "node_modules/micromark-factory-whitespace": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.0.0.tgz", - "integrity": "sha512-Qx7uEyahU1lt1RnsECBiuEbfr9INjQTGa6Err+gF3g0Tx4YEviPbqqGKNv/NrBaE7dVHdn1bVZKM/n5I/Bak7A==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/micromark-util-character": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-1.1.0.tgz", - "integrity": "sha512-agJ5B3unGNJ9rJvADMJ5ZiYjBRyDpzKAOk01Kpi1TKhlT1APx3XZk6eN7RtSz1erbWHC2L8T3xLZ81wdtGRZzg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/micromark-util-chunked": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.0.0.tgz", - "integrity": "sha512-5e8xTis5tEZKgesfbQMKRCyzvffRRUX+lK/y+DvsMFdabAicPkkZV6gO+FEWi9RfuKKoxxPwNL+dFF0SMImc1g==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/micromark-util-classify-character": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.0.0.tgz", - "integrity": "sha512-F8oW2KKrQRb3vS5ud5HIqBVkCqQi224Nm55o5wYLzY/9PwHGXC01tr3d7+TqHHz6zrKQ72Okwtvm/xQm6OVNZA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/micromark-util-combine-extensions": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.0.0.tgz", - "integrity": "sha512-J8H058vFBdo/6+AsjHp2NF7AJ02SZtWaVUjsayNFeAiydTxUwViQPxN0Hf8dp4FmCQi0UUFovFsEyRSUmFH3MA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-chunked": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/micromark-util-decode-numeric-character-reference": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.0.0.tgz", - "integrity": "sha512-OzO9AI5VUtrTD7KSdagf4MWgHMtET17Ua1fIpXTpuhclCqD8egFWo85GxSGvxgkGS74bEahvtM0WP0HjvV0e4w==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/micromark-util-decode-string": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.0.1.tgz", - "integrity": "sha512-Wf3H6jLaO3iIlHEvblESXaKAr72nK7JtBbLLICPwuZc3eJkMcp4j8rJ5Xv1VbQWMCWWDvKUbVUbE2MfQNznwTA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "parse-entities": "^3.0.0" - } - }, - "node_modules/micromark-util-encode": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.0.0.tgz", - "integrity": "sha512-cJpFVM768h6zkd8qJ1LNRrITfY4gwFt+tziPcIf71Ui8yFzY9wG3snZQqiWVq93PG4Sw6YOtcNiKJfVIs9qfGg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/micromark-util-html-tag-name": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.0.0.tgz", - "integrity": "sha512-NenEKIshW2ZI/ERv9HtFNsrn3llSPZtY337LID/24WeLqMzeZhBEE6BQ0vS2ZBjshm5n40chKtJ3qjAbVV8S0g==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/micromark-util-normalize-identifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.0.0.tgz", - "integrity": "sha512-yg+zrL14bBTFrQ7n35CmByWUTFsgst5JhA4gJYoty4Dqzj4Z4Fr/DHekSS5aLfH9bdlfnSvKAWsAgJhIbogyBg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/micromark-util-resolve-all": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.0.0.tgz", - "integrity": "sha512-CB/AGk98u50k42kvgaMM94wzBqozSzDDaonKU7P7jwQIuH2RU0TeBqGYJz2WY1UdihhjweivStrJ2JdkdEmcfw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-types": "^1.0.0" - } - }, - "node_modules/micromark-util-sanitize-uri": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.0.0.tgz", - "integrity": "sha512-cCxvBKlmac4rxCGx6ejlIviRaMKZc0fWm5HdCHEeDWRSkn44l6NdYVRyU+0nT1XC72EQJMZV8IPHF+jTr56lAg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-character": "^1.0.0", - "micromark-util-encode": "^1.0.0", - "micromark-util-symbol": "^1.0.0" - } - }, - "node_modules/micromark-util-subtokenize": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.0.1.tgz", - "integrity": "sha512-Zy7XuVepFWm8MqiqFywq4wFu4GXlksyC3e942GaQBXaaCWha3VbkZiTmOEBDCcvp1xKq/xZ2gGEIsCjU+SuEig==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "dependencies": { - "micromark-util-chunked": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "power-assert": "^1.0.0" - } - }, - "node_modules/micromark-util-symbol": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-1.0.0.tgz", - "integrity": "sha512-NZA01jHRNCt4KlOROn8/bGi6vvpEmlXld7EHcRH+aYWUfL3Wc8JLUNNlqUMKa0hhz6GrpUWsHtzPmKof57v0gQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/micromark-util-types": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-1.0.1.tgz", - "integrity": "sha512-UT0ylWEEy80RFYzK9pEaugTqaxoD/j0Y9WhHpSyitxd99zjoQz7JJ+iKuhPAgOW2MiPSUAx+c09dcqokeyaROA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ] - }, - "node_modules/micromark/node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/micromark/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dependencies": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - }, - "bin": { - "miller-rabin": "bin/miller-rabin" - } - }, - "node_modules/miller-rabin/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node_modules/nanoid": { - "version": "3.1.25", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", - "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/native-url": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/native-url/-/native-url-0.3.4.tgz", - "integrity": "sha512-6iM8R99ze45ivyH8vybJ7X0yekIcPf5GgLV5K0ENCbmRcaRIDoj37BC8iLEmaaBfqqb8enuZ5p0uhY+lVAbAcA==", - "dependencies": { - "querystring": "^0.2.0" - } - }, - "node_modules/next": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/next/-/next-11.1.3.tgz", - "integrity": "sha512-ud/gKmnKQ8wtHC+pd1ZiqPRa7DdgulPkAk94MbpsspfNliwZkYs9SIYWhlLSyg+c661LzdUI2nZshvrtggSYWA==", - "dependencies": { - "@babel/runtime": "7.15.3", - "@hapi/accept": "5.0.2", - "@next/env": "11.1.3", - "@next/polyfill-module": "11.1.3", - "@next/react-dev-overlay": "11.1.3", - "@next/react-refresh-utils": "11.1.3", - "@node-rs/helper": "1.2.1", - "assert": "2.0.0", - "ast-types": "0.13.2", - "browserify-zlib": "0.2.0", - "browserslist": "4.16.6", - "buffer": "5.6.0", - "caniuse-lite": "^1.0.30001228", - "chalk": "2.4.2", - "chokidar": "3.5.1", - "constants-browserify": "1.0.0", - "crypto-browserify": "3.12.0", - "cssnano-simple": "3.0.0", - "domain-browser": "4.19.0", - "encoding": "0.1.13", - "etag": "1.8.1", - "find-cache-dir": "3.3.1", - "get-orientation": "1.1.2", - "https-browserify": "1.0.0", - "image-size": "1.0.0", - "jest-worker": "27.0.0-next.5", - "native-url": "0.3.4", - "node-fetch": "2.6.1", - "node-html-parser": "1.4.9", - "node-libs-browser": "^2.2.1", - "os-browserify": "0.3.0", - "p-limit": "3.1.0", - "path-browserify": "1.0.1", - "pnp-webpack-plugin": "1.6.4", - "postcss": "8.2.15", - "process": "0.11.10", - "querystring-es3": "0.2.1", - "raw-body": "2.4.1", - "react-is": "17.0.2", - "react-refresh": "0.8.3", - "stream-browserify": "3.0.0", - "stream-http": "3.1.1", - "string_decoder": "1.3.0", - "styled-jsx": "4.0.1", - "timers-browserify": "2.0.12", - "tty-browserify": "0.0.1", - "use-subscription": "1.5.1", - "util": "0.12.4", - "vm-browserify": "1.1.2", - "watchpack": "2.1.1" - }, - "bin": { - "next": "dist/bin/next" - }, - "engines": { - "node": ">=12.0.0" - }, - "optionalDependencies": { - "@next/swc-darwin-arm64": "11.1.3", - "@next/swc-darwin-x64": "11.1.3", - "@next/swc-linux-x64-gnu": "11.1.3", - "@next/swc-win32-x64-msvc": "11.1.3" - }, - "peerDependencies": { - "fibers": ">= 3.1.0", - "node-sass": "^4.0.0 || ^5.0.0", - "react": "^17.0.2", - "react-dom": "^17.0.2", - "sass": "^1.3.0" - }, - "peerDependenciesMeta": { - "fibers": { - "optional": true - }, - "node-sass": { - "optional": true - }, - "sass": { - "optional": true - } - } - }, - "node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "engines": { - "node": "4.x || >=6.0.0" - } - }, - "node_modules/node-html-parser": { - "version": "1.4.9", - "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-1.4.9.tgz", - "integrity": "sha512-UVcirFD1Bn0O+TSmloHeHqZZCxHjvtIeGdVdGMhyZ8/PWlEiZaZ5iJzR189yKZr8p0FXN58BUeC7RHRkf/KYGw==", - "dependencies": { - "he": "1.2.0" - } - }, - "node_modules/node-libs-browser": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz", - "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==", - "dependencies": { - "assert": "^1.1.1", - "browserify-zlib": "^0.2.0", - "buffer": "^4.3.0", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.11.0", - "domain-browser": "^1.1.1", - "events": "^3.0.0", - "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "0.0.1", - "process": "^0.11.10", - "punycode": "^1.2.4", - "querystring-es3": "^0.2.0", - "readable-stream": "^2.3.3", - "stream-browserify": "^2.0.1", - "stream-http": "^2.7.2", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", - "tty-browserify": "0.0.0", - "url": "^0.11.0", - "util": "^0.11.0", - "vm-browserify": "^1.0.1" - } - }, - "node_modules/node-libs-browser/node_modules/assert": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", - "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", - "dependencies": { - "object-assign": "^4.1.1", - "util": "0.10.3" - } - }, - "node_modules/node-libs-browser/node_modules/assert/node_modules/inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" - }, - "node_modules/node-libs-browser/node_modules/assert/node_modules/util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dependencies": { - "inherits": "2.0.1" - } - }, - "node_modules/node-libs-browser/node_modules/buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", - "dependencies": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "node_modules/node-libs-browser/node_modules/domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "engines": { - "node": ">=0.4", - "npm": ">=1.2" - } - }, - "node_modules/node-libs-browser/node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "node_modules/node-libs-browser/node_modules/path-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", - "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==" - }, - "node_modules/node-libs-browser/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/node-libs-browser/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/node-libs-browser/node_modules/stream-browserify": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", - "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", - "dependencies": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" - } - }, - "node_modules/node-libs-browser/node_modules/stream-http": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", - "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", - "dependencies": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.6", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" - } - }, - "node_modules/node-libs-browser/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/node-libs-browser/node_modules/tty-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", - "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=" - }, - "node_modules/node-libs-browser/node_modules/util": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", - "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", - "dependencies": { - "inherits": "2.0.3" - } - }, - "node_modules/node-releases": { - "version": "1.1.76", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz", - "integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==" - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-is": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", - "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=" - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-locate/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "dependencies": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/parse-entities": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-3.0.0.tgz", - "integrity": "sha512-AJlcIFDNPEP33KyJLguv0xJc83BNvjxwpuUIcetyXUsLpVXAUCePJ5kIoYtEN2R1ac0cYaRu/vk9dVFkewHQhQ==", - "dependencies": { - "character-entities": "^2.0.0", - "character-entities-legacy": "^2.0.0", - "character-reference-invalid": "^2.0.0", - "is-alphanumerical": "^2.0.0", - "is-decimal": "^2.0.0", - "is-hexadecimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "engines": { - "node": ">=8" - } - }, - "node_modules/pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", - "dependencies": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "node_modules/picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/platform": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", - "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" - }, - "node_modules/pnp-webpack-plugin": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/pnp-webpack-plugin/-/pnp-webpack-plugin-1.6.4.tgz", - "integrity": "sha512-7Wjy+9E3WwLOEL30D+m8TSTF7qJJUJLONBnwQp0518siuMxUQUbgZwssaFX+QKlZkjHZcw/IpZCt/H0srrntSg==", - "dependencies": { - "ts-pnp": "^1.1.6" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/postcss": { - "version": "8.2.15", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.2.15.tgz", - "integrity": "sha512-2zO3b26eJD/8rb106Qu2o7Qgg52ND5HPjcyQiK2B98O388h43A448LCslC0dI2P97wCAQRJsFvwTRcXxTKds+Q==", - "dependencies": { - "colorette": "^1.2.2", - "nanoid": "^3.1.23", - "source-map": "^0.6.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - } - }, - "node_modules/postcss/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/power-assert": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/power-assert/-/power-assert-1.6.1.tgz", - "integrity": "sha512-VWkkZV6Y+W8qLX/PtJu2Ur2jDPIs0a5vbP0TpKeybNcIXmT4vcKoVkyTp5lnQvTpY/DxacAZ4RZisHRHLJcAZQ==", - "dependencies": { - "define-properties": "^1.1.2", - "empower": "^1.3.1", - "power-assert-formatter": "^1.4.1", - "universal-deep-strict-equal": "^1.2.1", - "xtend": "^4.0.0" - } - }, - "node_modules/power-assert-context-formatter": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-context-formatter/-/power-assert-context-formatter-1.2.0.tgz", - "integrity": "sha512-HLNEW8Bin+BFCpk/zbyKwkEu9W8/zThIStxGo7weYcFkKgMuGCHUJhvJeBGXDZf0Qm2xis4pbnnciGZiX0EpSg==", - "dependencies": { - "core-js": "^2.0.0", - "power-assert-context-traversal": "^1.2.0" - } - }, - "node_modules/power-assert-context-reducer-ast": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-context-reducer-ast/-/power-assert-context-reducer-ast-1.2.0.tgz", - "integrity": "sha512-EgOxmZ/Lb7tw4EwSKX7ZnfC0P/qRZFEG28dx/690qvhmOJ6hgThYFm5TUWANDLK5NiNKlPBi5WekVGd2+5wPrw==", - "dependencies": { - "acorn": "^5.0.0", - "acorn-es7-plugin": "^1.0.12", - "core-js": "^2.0.0", - "espurify": "^1.6.0", - "estraverse": "^4.2.0" - } - }, - "node_modules/power-assert-context-traversal": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-context-traversal/-/power-assert-context-traversal-1.2.0.tgz", - "integrity": "sha512-NFoHU6g2umNajiP2l4qb0BRWD773Aw9uWdWYH9EQsVwIZnog5bd2YYLFCVvaxWpwNzWeEfZIon2xtyc63026pQ==", - "dependencies": { - "core-js": "^2.0.0", - "estraverse": "^4.1.0" - } - }, - "node_modules/power-assert-formatter": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/power-assert-formatter/-/power-assert-formatter-1.4.1.tgz", - "integrity": "sha1-XcEl7VCj37HdomwZNH879Y7CiEo=", - "dependencies": { - "core-js": "^2.0.0", - "power-assert-context-formatter": "^1.0.7", - "power-assert-context-reducer-ast": "^1.0.7", - "power-assert-renderer-assertion": "^1.0.7", - "power-assert-renderer-comparison": "^1.0.7", - "power-assert-renderer-diagram": "^1.0.7", - "power-assert-renderer-file": "^1.0.7" - } - }, - "node_modules/power-assert-renderer-assertion": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-renderer-assertion/-/power-assert-renderer-assertion-1.2.0.tgz", - "integrity": "sha512-3F7Q1ZLmV2ZCQv7aV7NJLNK9G7QsostrhOU7U0RhEQS/0vhEqrRg2jEJl1jtUL4ZyL2dXUlaaqrmPv5r9kRvIg==", - "dependencies": { - "power-assert-renderer-base": "^1.1.1", - "power-assert-util-string-width": "^1.2.0" - } - }, - "node_modules/power-assert-renderer-base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/power-assert-renderer-base/-/power-assert-renderer-base-1.1.1.tgz", - "integrity": "sha1-lqZQxv0F7hvB9mtUrWFELIs/Y+s=" - }, - "node_modules/power-assert-renderer-comparison": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-renderer-comparison/-/power-assert-renderer-comparison-1.2.0.tgz", - "integrity": "sha512-7c3RKPDBKK4E3JqdPtYRE9cM8AyX4LC4yfTvvTYyx8zSqmT5kJnXwzR0yWQLOavACllZfwrAGQzFiXPc5sWa+g==", - "dependencies": { - "core-js": "^2.0.0", - "diff-match-patch": "^1.0.0", - "power-assert-renderer-base": "^1.1.1", - "stringifier": "^1.3.0", - "type-name": "^2.0.1" - } - }, - "node_modules/power-assert-renderer-diagram": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-renderer-diagram/-/power-assert-renderer-diagram-1.2.0.tgz", - "integrity": "sha512-JZ6PC+DJPQqfU6dwSmpcoD7gNnb/5U77bU5KgNwPPa+i1Pxiz6UuDeM3EUBlhZ1HvH9tMjI60anqVyi5l2oNdg==", - "dependencies": { - "core-js": "^2.0.0", - "power-assert-renderer-base": "^1.1.1", - "power-assert-util-string-width": "^1.2.0", - "stringifier": "^1.3.0" - } - }, - "node_modules/power-assert-renderer-file": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-renderer-file/-/power-assert-renderer-file-1.2.0.tgz", - "integrity": "sha512-/oaVrRbeOtGoyyd7e4IdLP/jIIUFJdqJtsYzP9/88R39CMnfF/S/rUc8ZQalENfUfQ/wQHu+XZYRMaCEZmEesg==", - "dependencies": { - "power-assert-renderer-base": "^1.1.1" - } - }, - "node_modules/power-assert-util-string-width": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-util-string-width/-/power-assert-util-string-width-1.2.0.tgz", - "integrity": "sha512-lX90G0igAW0iyORTILZ/QjZWsa1MZ6VVY3L0K86e2eKun3S4LKPH4xZIl8fdeMYLfOjkaszbNSzf1uugLeAm2A==", - "dependencies": { - "eastasianwidth": "^0.2.0" - } - }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "node_modules/prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "dependencies": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } - }, - "node_modules/prop-types/node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - }, - "node_modules/property-information": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.0.1.tgz", - "integrity": "sha512-F4WUUAF7fMeF4/JUFHNBWDaKDXi2jbvqBW/y6o5wsf3j19wTZ7S60TmtB5HoBhtgw7NKQRMWuz5vk2PR0CygUg==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "dependencies": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/public-encrypt/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "node_modules/querystring": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.1.tgz", - "integrity": "sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg==", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/queue": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz", - "integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==", - "dependencies": { - "inherits": "~2.0.3" - } - }, - "node_modules/raf": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", - "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", - "dependencies": { - "performance-now": "^2.1.0" - } - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dependencies": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "node_modules/raw-body": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz", - "integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==", - "dependencies": { - "bytes": "3.1.0", - "http-errors": "1.7.3", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/raw-body/node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", - "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-color": { - "version": "2.19.3", - "resolved": "https://registry.npmjs.org/react-color/-/react-color-2.19.3.tgz", - "integrity": "sha512-LEeGE/ZzNLIsFWa1TMe8y5VYqr7bibneWmvJwm1pCn/eNmrabWDh659JSPn9BuaMpEfU83WTOJfnCcjDZwNQTA==", - "dependencies": { - "@icons/material": "^0.2.4", - "lodash": "^4.17.15", - "lodash-es": "^4.17.15", - "material-colors": "^1.2.1", - "prop-types": "^15.5.10", - "reactcss": "^1.2.0", - "tinycolor2": "^1.4.1" - }, - "peerDependencies": { - "react": "*" - } - }, - "node_modules/react-dom": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", - "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "scheduler": "^0.20.2" - }, - "peerDependencies": { - "react": "17.0.2" - } - }, - "node_modules/react-is": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", - "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" - }, - "node_modules/react-markdown": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-7.0.1.tgz", - "integrity": "sha512-pthNPaoiwg0q7hukoE04F2ENwSzijIlWHJ4UMs/96LUe/G/P3FnbP4qHzx3FoNqae+2SqDG8vzniTLnJDeWneg==", - "dependencies": { - "@types/hast": "^2.0.0", - "@types/unist": "^2.0.0", - "comma-separated-tokens": "^2.0.0", - "prop-types": "^15.0.0", - "property-information": "^6.0.0", - "react-is": "^17.0.0", - "remark-parse": "^10.0.0", - "remark-rehype": "^9.0.0", - "space-separated-tokens": "^2.0.0", - "style-to-object": "^0.3.0", - "unified": "^10.0.0", - "unist-util-visit": "^4.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - }, - "peerDependencies": { - "@types/react": ">=16", - "react": ">=16" - } - }, - "node_modules/react-refresh": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz", - "integrity": "sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-time-ago": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/react-time-ago/-/react-time-ago-7.1.4.tgz", - "integrity": "sha512-W52GqGQRSEaITqy5YPZ6i9fy0mhwpTzY0ScoF43jlAvNY0Kb5CCllXqHky3sPgkGJS7JELCd+dbOgiQqz779FQ==", - "dependencies": { - "prop-types": "^15.7.2", - "raf": "^3.4.1" - }, - "peerDependencies": { - "javascript-time-ago": "^2.3.7", - "react": ">=0.16.8", - "react-dom": ">=0.16.8" - } - }, - "node_modules/react-transition-group": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz", - "integrity": "sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==", - "dependencies": { - "@babel/runtime": "^7.5.5", - "dom-helpers": "^5.0.1", - "loose-envify": "^1.4.0", - "prop-types": "^15.6.2" - }, - "peerDependencies": { - "react": ">=16.6.0", - "react-dom": ">=16.6.0" - } - }, - "node_modules/reactcss": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/reactcss/-/reactcss-1.2.3.tgz", - "integrity": "sha512-KiwVUcFu1RErkI97ywr8nvx8dNOpT03rbnma0SSalTYjkrPYaEajR4a/MRt6DZ46K6arDRbWMNHF+xH7G7n/8A==", - "dependencies": { - "lodash": "^4.0.1" - } - }, - "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/readdirp": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", - "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" - }, - "node_modules/relative-time-format": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/relative-time-format/-/relative-time-format-1.0.6.tgz", - "integrity": "sha512-voemOJLxlKun4P1fAo4PEg2WXNGjhqfE/G8Xen4gcy24Hyu/djn5bT5axmhx4MnjynoZ8f0HCOjk3RZpsY6X/g==" - }, - "node_modules/remark-parse": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-10.0.0.tgz", - "integrity": "sha512-07ei47p2Xl7Bqbn9H2VYQYirnAFJPwdMuypdozWsSbnmrkgA2e2sZLZdnDNrrsxR4onmIzH/J6KXqKxCuqHtPQ==", - "dependencies": { - "@types/mdast": "^3.0.0", - "mdast-util-from-markdown": "^1.0.0", - "unified": "^10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-rehype": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-9.1.0.tgz", - "integrity": "sha512-oLa6YmgAYg19zb0ZrBACh40hpBLteYROaPLhBXzLgjqyHQrN+gVP9N/FJvfzuNNuzCutktkroXEZBrxAxKhh7Q==", - "dependencies": { - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "mdast-util-to-hast": "^11.0.0", - "unified": "^10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "engines": { - "node": ">=4" - } - }, - "node_modules/ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/scheduler": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", - "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - }, - "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" - }, - "node_modules/setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - }, - "node_modules/sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - }, - "bin": { - "sha.js": "bin.js" - } - }, - "node_modules/shell-quote": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz", - "integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==" - }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/source-map": { - "version": "0.8.0-beta.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz", - "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", - "dependencies": { - "whatwg-url": "^7.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/space-separated-tokens": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.1.tgz", - "integrity": "sha512-ekwEbFp5aqSPKaqeY1PGrlGQxPNaq+Cnx4+bE2D8sciBQrHpbwoBbawqTN2+6jPs9IdWxxiUcN0K2pkczD3zmw==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/stacktrace-parser": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz", - "integrity": "sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg==", - "dependencies": { - "type-fest": "^0.7.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/stream-browserify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", - "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", - "dependencies": { - "inherits": "~2.0.4", - "readable-stream": "^3.5.0" - } - }, - "node_modules/stream-http": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.1.1.tgz", - "integrity": "sha512-S7OqaYu0EkFpgeGFb/NPOoPLxFko7TPqtEeFg5DXPB4v/KETHG0Ln6fRFrNezoelpaDKmycEmmZ81cC9DAwgYg==", - "dependencies": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "xtend": "^4.0.2" - } - }, - "node_modules/stream-parser": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/stream-parser/-/stream-parser-0.3.1.tgz", - "integrity": "sha1-FhhUhpRCACGhGC/wrxkRwSl2F3M=", - "dependencies": { - "debug": "2" - } - }, - "node_modules/strftime": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/strftime/-/strftime-0.10.0.tgz", - "integrity": "sha1-s/D6QZKVICpaKJ9ta+n0kJphcZM=", - "engines": { - "node": ">=0.2.0" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/string-hash": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz", - "integrity": "sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=" - }, - "node_modules/string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/stringifier": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/stringifier/-/stringifier-1.4.0.tgz", - "integrity": "sha512-cNsMOqqrcbLcHTXEVmkw9y0fwDwkdgtZwlfyolzpQDoAE1xdNGhQhxBUfiDvvZIKl1hnUEgMv66nHwtMz3OjPw==", - "dependencies": { - "core-js": "^2.0.0", - "traverse": "^0.6.6", - "type-name": "^2.0.1" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/style-to-object": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.3.0.tgz", - "integrity": "sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==", - "dependencies": { - "inline-style-parser": "0.1.1" - } - }, - "node_modules/styled-jsx": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-4.0.1.tgz", - "integrity": "sha512-Gcb49/dRB1k8B4hdK8vhW27Rlb2zujCk1fISrizCcToIs+55B4vmUM0N9Gi4nnVfFZWe55jRdWpAqH1ldAKWvQ==", - "dependencies": { - "@babel/plugin-syntax-jsx": "7.14.5", - "@babel/types": "7.15.0", - "convert-source-map": "1.7.0", - "loader-utils": "1.2.3", - "source-map": "0.7.3", - "string-hash": "1.1.3", - "stylis": "3.5.4", - "stylis-rule-sheet": "0.0.10" - }, - "engines": { - "node": ">= 12.0.0" - }, - "peerDependencies": { - "react": ">= 16.8.0 || 17.x.x || 18.x.x" - }, - "peerDependenciesMeta": { - "@babel/core": { - "optional": true - } - } - }, - "node_modules/styled-jsx/node_modules/source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "engines": { - "node": ">= 8" - } - }, - "node_modules/stylis": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-3.5.4.tgz", - "integrity": "sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q==" - }, - "node_modules/stylis-rule-sheet": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz", - "integrity": "sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw==", - "peerDependencies": { - "stylis": "^3.5.0" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/timers-browserify": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", - "integrity": "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==", - "dependencies": { - "setimmediate": "^1.0.4" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/tiny-warning": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", - "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" - }, - "node_modules/tinycolor2": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz", - "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==", - "engines": { - "node": "*" - } - }, - "node_modules/to-arraybuffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", - "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=" - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/tr46/node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "engines": { - "node": ">=6" - } - }, - "node_modules/traverse": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", - "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=" - }, - "node_modules/trough": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/trough/-/trough-2.0.2.tgz", - "integrity": "sha512-FnHq5sTMxC0sk957wHDzRnemFnNBvt/gSY99HzK8F7UP5WAbvP70yX5bd7CjEQkN+TjdxwI7g7lJ6podqrG2/w==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/ts-pnp": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", - "integrity": "sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==", - "engines": { - "node": ">=6" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==" - }, - "node_modules/type-fest": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", - "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/type-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/type-name/-/type-name-2.0.2.tgz", - "integrity": "sha1-7+fUEj2KxSr/9/QMfk3sUmYAj7Q=" - }, - "node_modules/typescript": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.3.tgz", - "integrity": "sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", - "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/unified": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.0.tgz", - "integrity": "sha512-4U3ru/BRXYYhKbwXV6lU6bufLikoAavTwev89H5UxY8enDFaAT2VXmIXYNm6hb5oHPng/EXr77PVyDFcptbk5g==", - "dependencies": { - "@types/unist": "^2.0.0", - "bail": "^2.0.0", - "extend": "^3.0.0", - "is-buffer": "^2.0.0", - "is-plain-obj": "^4.0.0", - "trough": "^2.0.0", - "vfile": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-builder": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-builder/-/unist-builder-3.0.0.tgz", - "integrity": "sha512-GFxmfEAa0vi9i5sd0R2kcrI9ks0r82NasRq5QHh2ysGngrc6GiqD5CDf1FjPenY4vApmFASBIIlk/jj5J5YbmQ==", - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-generated": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-2.0.0.tgz", - "integrity": "sha512-TiWE6DVtVe7Ye2QxOVW9kqybs6cZexNwTwSMVgkfjEReqy/xwGpAXb99OxktoWwmL+Z+Epb0Dn8/GNDYP1wnUw==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-stringify-position": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.0.tgz", - "integrity": "sha512-SdfAl8fsDclywZpfMDTVDxA2V7LjtRDTOFd44wUJamgl6OlVngsqWjxvermMYf60elWHbxhuRCZml7AnuXCaSA==", - "dependencies": { - "@types/unist": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.0.tgz", - "integrity": "sha512-n7lyhFKJfVZ9MnKtqbsqkQEk5P1KShj0+//V7mAcoI6bpbUjh3C/OG8HVD+pBihfh6Ovl01m8dkcv9HNqYajmQ==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit-parents": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.0.tgz", - "integrity": "sha512-y+QVLcY5eR/YVpqDsLf/xh9R3Q2Y4HxkZTp7ViLDU6WtJCEcPmRzW1gpdWDCDIqIlhuPDXOgttqPlykrHYDekg==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/universal-deep-strict-equal": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/universal-deep-strict-equal/-/universal-deep-strict-equal-1.2.2.tgz", - "integrity": "sha1-DaSsL3PP95JMgfpN4BjKViyisKc=", - "dependencies": { - "array-filter": "^1.0.0", - "indexof": "0.0.1", - "object-keys": "^1.0.0" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - }, - "node_modules/url/node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/use-subscription": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/use-subscription/-/use-subscription-1.5.1.tgz", - "integrity": "sha512-Xv2a1P/yReAjAbhylMfFplFKj9GssgTwN7RlcTxBujFQcloStWNDQdc4g4NRWH9xS4i/FDk04vQBptAXoF3VcA==", - "dependencies": { - "object-assign": "^4.1.1" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0" - } - }, - "node_modules/util": { - "version": "0.12.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", - "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", - "which-typed-array": "^1.1.2" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "node_modules/vfile": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.1.0.tgz", - "integrity": "sha512-4o7/DJjEaFPYSh0ckv5kcYkJTHQgCKdL8ozMM1jLAxO9ox95IzveDPXCZp08HamdWq8JXTkClDvfAKaeLQeKtg==", - "dependencies": { - "@types/unist": "^2.0.0", - "is-buffer": "^2.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-message": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.0.2.tgz", - "integrity": "sha512-UUjZYIOg9lDRwwiBAuezLIsu9KlXntdxwG+nXnjuQAHvBpcX3x0eN8h+I7TkY5nkCXj+cWVp4ZqebtGBvok8ww==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vm-browserify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", - "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==" - }, - "node_modules/watchpack": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.1.1.tgz", - "integrity": "sha512-Oo7LXCmc1eE1AjyuSBmtC3+Wy4HcV8PxWh2kP6fOl8yTlNS7r0K9l1ao2lrrUza7V39Y3D/BbJgY8VeSlc5JKw==", - "dependencies": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" - }, - "node_modules/whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/which-typed-array": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", - "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", - "engines": { - "node": ">= 6" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", - "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "@babel/compat-data": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.15.0.tgz", - "integrity": "sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==", - "peer": true - }, - "@babel/core": { - "version": "7.15.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.5.tgz", - "integrity": "sha512-pYgXxiwAgQpgM1bNkZsDEq85f0ggXMA5L7c+o3tskGMh2BunCI9QUwB9Z4jpvXUOuMdyGKiGKQiRe11VS6Jzvg==", - "peer": true, - "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.4", - "@babel/helpers": "^7.15.4", - "@babel/parser": "^7.15.5", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", - "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", - "peer": true, - "requires": { - "@babel/highlight": "^7.14.5" - } - }, - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - }, - "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "peer": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "peer": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "peer": true - } - } - }, - "@babel/generator": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.4.tgz", - "integrity": "sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==", - "peer": true, - "requires": { - "@babel/types": "^7.15.4", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "peer": true - } - } - }, - "@babel/helper-compilation-targets": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz", - "integrity": "sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==", - "peer": true, - "requires": { - "@babel/compat-data": "^7.15.0", - "@babel/helper-validator-option": "^7.14.5", - "browserslist": "^4.16.6", - "semver": "^6.3.0" - } - }, - "@babel/helper-function-name": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", - "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", - "peer": true, - "requires": { - "@babel/helper-get-function-arity": "^7.15.4", - "@babel/template": "^7.15.4", - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-get-function-arity": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", - "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", - "peer": true, - "requires": { - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-hoist-variables": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", - "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", - "peer": true, - "requires": { - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz", - "integrity": "sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA==", - "peer": true, - "requires": { - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-module-imports": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz", - "integrity": "sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA==", - "requires": { - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-module-transforms": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.7.tgz", - "integrity": "sha512-ZNqjjQG/AuFfekFTY+7nY4RgBSklgTu970c7Rj3m/JOhIu5KPBUuTA9AY6zaKcUvk4g6EbDXdBnhi35FAssdSw==", - "peer": true, - "requires": { - "@babel/helper-module-imports": "^7.15.4", - "@babel/helper-replace-supers": "^7.15.4", - "@babel/helper-simple-access": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/helper-validator-identifier": "^7.15.7", - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.6" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz", - "integrity": "sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw==", - "peer": true, - "requires": { - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-plugin-utils": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz", - "integrity": "sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ==" - }, - "@babel/helper-replace-supers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz", - "integrity": "sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw==", - "peer": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.15.4", - "@babel/helper-optimise-call-expression": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-simple-access": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz", - "integrity": "sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg==", - "peer": true, - "requires": { - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", - "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", - "peer": true, - "requires": { - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==" - }, - "@babel/helper-validator-option": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", - "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", - "peer": true - }, - "@babel/helpers": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.4.tgz", - "integrity": "sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ==", - "peer": true, - "requires": { - "@babel/template": "^7.15.4", - "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/highlight": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", - "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", - "requires": { - "@babel/helper-validator-identifier": "^7.14.5", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.7.tgz", - "integrity": "sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g==", - "peer": true - }, - "@babel/plugin-syntax-jsx": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.14.5.tgz", - "integrity": "sha512-ohuFIsOMXJnbOMRfX7/w7LocdR6R7whhuRD4ax8IipLcLPlZGJKkBxgHp++U4N/vKyU16/YDQr2f5seajD3jIw==", - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/runtime": { - "version": "7.15.3", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.3.tgz", - "integrity": "sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA==", - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, - "@babel/template": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", - "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", - "peer": true, - "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4" - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", - "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", - "peer": true, - "requires": { - "@babel/highlight": "^7.14.5" - } - }, - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - } - } - }, - "@babel/traverse": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", - "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", - "peer": true, - "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", - "@babel/helper-function-name": "^7.15.4", - "@babel/helper-hoist-variables": "^7.15.4", - "@babel/helper-split-export-declaration": "^7.15.4", - "@babel/parser": "^7.15.4", - "@babel/types": "^7.15.4", - "debug": "^4.1.0", - "globals": "^11.1.0" - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", - "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", - "peer": true, - "requires": { - "@babel/highlight": "^7.14.5" - } - }, - "@babel/types": { - "version": "7.15.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", - "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", - "peer": true, - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - }, - "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "peer": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "peer": true - } - } - }, - "@babel/types": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.0.tgz", - "integrity": "sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ==", - "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "to-fast-properties": "^2.0.0" - } - }, - "@emotion/babel-plugin": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.3.0.tgz", - "integrity": "sha512-UZKwBV2rADuhRp+ZOGgNWg2eYgbzKzQXfQPtJbu/PLy8onurxlNCLvxMQEvlr1/GudguPI5IU9qIY1+2z1M5bA==", - "requires": { - "@babel/helper-module-imports": "^7.12.13", - "@babel/plugin-syntax-jsx": "^7.12.13", - "@babel/runtime": "^7.13.10", - "@emotion/hash": "^0.8.0", - "@emotion/memoize": "^0.7.5", - "@emotion/serialize": "^1.0.2", - "babel-plugin-macros": "^2.6.1", - "convert-source-map": "^1.5.0", - "escape-string-regexp": "^4.0.0", - "find-root": "^1.1.0", - "source-map": "^0.5.7", - "stylis": "^4.0.3" - }, - "dependencies": { - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - }, - "stylis": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", - "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" - } - } - }, - "@emotion/cache": { - "version": "11.4.0", - "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.4.0.tgz", - "integrity": "sha512-Zx70bjE7LErRO9OaZrhf22Qye1y4F7iDl+ITjet0J+i+B88PrAOBkKvaAWhxsZf72tDLajwCgfCjJ2dvH77C3g==", - "requires": { - "@emotion/memoize": "^0.7.4", - "@emotion/sheet": "^1.0.0", - "@emotion/utils": "^1.0.0", - "@emotion/weak-memoize": "^0.2.5", - "stylis": "^4.0.3" - }, - "dependencies": { - "stylis": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", - "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" - } - } - }, - "@emotion/hash": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", - "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" - }, - "@emotion/is-prop-valid": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.1.0.tgz", - "integrity": "sha512-9RkilvXAufQHsSsjQ3PIzSns+pxuX4EW8EbGeSPjZMHuMx6z/MOzb9LpqNieQX4F3mre3NWS2+X3JNRHTQztUQ==", - "requires": { - "@emotion/memoize": "^0.7.4" - } - }, - "@emotion/memoize": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.5.tgz", - "integrity": "sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ==" - }, - "@emotion/react": { - "version": "11.4.1", - "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.4.1.tgz", - "integrity": "sha512-pRegcsuGYj4FCdZN6j5vqCALkNytdrKw3TZMekTzNXixRg4wkLsU5QEaBG5LC6l01Vppxlp7FE3aTHpIG5phLg==", - "requires": { - "@babel/runtime": "^7.13.10", - "@emotion/cache": "^11.4.0", - "@emotion/serialize": "^1.0.2", - "@emotion/sheet": "^1.0.2", - "@emotion/utils": "^1.0.0", - "@emotion/weak-memoize": "^0.2.5", - "hoist-non-react-statics": "^3.3.1" - } - }, - "@emotion/serialize": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.2.tgz", - "integrity": "sha512-95MgNJ9+/ajxU7QIAruiOAdYNjxZX7G2mhgrtDWswA21VviYIRP1R5QilZ/bDY42xiKsaktP4egJb3QdYQZi1A==", - "requires": { - "@emotion/hash": "^0.8.0", - "@emotion/memoize": "^0.7.4", - "@emotion/unitless": "^0.7.5", - "@emotion/utils": "^1.0.0", - "csstype": "^3.0.2" - } - }, - "@emotion/sheet": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.2.tgz", - "integrity": "sha512-QQPB1B70JEVUHuNtzjHftMGv6eC3Y9wqavyarj4x4lg47RACkeSfNo5pxIOKizwS9AEFLohsqoaxGQj4p0vSIw==" - }, - "@emotion/styled": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.3.0.tgz", - "integrity": "sha512-fUoLcN3BfMiLlRhJ8CuPUMEyKkLEoM+n+UyAbnqGEsCd5IzKQ7VQFLtzpJOaCD2/VR2+1hXQTnSZXVJeiTNltA==", - "requires": { - "@babel/runtime": "^7.13.10", - "@emotion/babel-plugin": "^11.3.0", - "@emotion/is-prop-valid": "^1.1.0", - "@emotion/serialize": "^1.0.2", - "@emotion/utils": "^1.0.0" - } - }, - "@emotion/unitless": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", - "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" - }, - "@emotion/utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", - "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==" - }, - "@emotion/weak-memoize": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", - "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" - }, - "@hapi/accept": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@hapi/accept/-/accept-5.0.2.tgz", - "integrity": "sha512-CmzBx/bXUR8451fnZRuZAJRlzgm0Jgu5dltTX/bszmR2lheb9BpyN47Q1RbaGTsvFzn0PXAEs+lXDKfshccYZw==", - "requires": { - "@hapi/boom": "9.x.x", - "@hapi/hoek": "9.x.x" - } - }, - "@hapi/boom": { - "version": "9.1.4", - "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", - "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", - "requires": { - "@hapi/hoek": "9.x.x" - } - }, - "@hapi/hoek": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", - "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" - }, - "@icons/material": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@icons/material/-/material-0.2.4.tgz", - "integrity": "sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw==", - "requires": {} - }, - "@mui/core": { - "version": "5.0.0-alpha.47", - "resolved": "https://registry.npmjs.org/@mui/core/-/core-5.0.0-alpha.47.tgz", - "integrity": "sha512-/GCIWOq+ydeY8HTWexrvQw7OsmRRvdzW+BB4vQ+V6alaECKSXPQrTDuQtd+lgI2il4p7uhPIKIqjcaAZ/FaNHA==", - "requires": { - "@babel/runtime": "^7.14.8", - "@emotion/is-prop-valid": "^1.1.0", - "@mui/utils": "^5.0.0", - "clsx": "^1.1.1", - "prop-types": "^15.7.2", - "react-is": "^17.0.2" - } - }, - "@mui/icons-material": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.0.0.tgz", - "integrity": "sha512-Vl5pMIdD1MC+LVBEKDQkWeoU/0mdxx/WLBuTVo5y2yzOzEp8gcwkegtiUyN1gubiXcqzNNZQNvJ6/YSdFRr84Q==", - "requires": { - "@babel/runtime": "^7.14.8" - } - }, - "@mui/material": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.0.0.tgz", - "integrity": "sha512-XZNPYQocFyS2Q8Wc7PMudazKa8VDaXADK9PxUfOF6Q0GQNXjLkOn1vRWlyF9EOZQ4QLbgJHyHDlH7ELBN0CA0w==", - "requires": { - "@babel/runtime": "^7.14.8", - "@mui/core": "5.0.0-alpha.47", - "@mui/system": "^5.0.0", - "@mui/types": "^7.0.0", - "@mui/utils": "^5.0.0", - "@popperjs/core": "^2.4.4", - "@types/react-transition-group": "^4.4.2", - "clsx": "^1.1.1", - "csstype": "^3.0.8", - "hoist-non-react-statics": "^3.3.2", - "prop-types": "^15.7.2", - "react-is": "^17.0.2", - "react-transition-group": "^4.4.2" - } - }, - "@mui/private-theming": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.0.0.tgz", - "integrity": "sha512-xCaQss6B6EyEPxyn/vv5CwidqihrF6AJlrCYDgOAqYHtCgBhzMjWhh/n4L3jlrt4SmE+STHD2FdA8DImpEgItg==", - "requires": { - "@babel/runtime": "^7.14.8", - "@mui/utils": "^5.0.0", - "prop-types": "^15.7.2" - } - }, - "@mui/styled-engine": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.0.0.tgz", - "integrity": "sha512-JoZLKLB6WoXYPbMNDzz2gC8incY6zyx0dd1jFg3faOzp2NuzEremDbY/Lmo93M22cOjd3cLInoup+Wm7O05d0A==", - "requires": { - "@babel/runtime": "^7.14.8", - "@emotion/cache": "^11.4.0", - "prop-types": "^15.7.2" - } - }, - "@mui/styles": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/styles/-/styles-5.0.0.tgz", - "integrity": "sha512-J4Cg43m1M+7HsvV4XtTGAs39ogZcnzTUDxw0VbEdDdaEYdXG0jC5VXT/UouOPI2SWA3/v+trfanW8t/U2pIsqA==", - "requires": { - "@babel/runtime": "^7.14.8", - "@emotion/hash": "^0.8.0", - "@mui/private-theming": "^5.0.0", - "@mui/types": "^7.0.0", - "@mui/utils": "^5.0.0", - "clsx": "^1.1.1", - "csstype": "^3.0.8", - "hoist-non-react-statics": "^3.3.2", - "jss": "^10.7.1", - "jss-plugin-camel-case": "^10.7.1", - "jss-plugin-default-unit": "^10.7.1", - "jss-plugin-global": "^10.7.1", - "jss-plugin-nested": "^10.7.1", - "jss-plugin-props-sort": "^10.7.1", - "jss-plugin-rule-value-function": "^10.7.1", - "jss-plugin-vendor-prefixer": "^10.7.1", - "prop-types": "^15.7.2" - } - }, - "@mui/system": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.0.0.tgz", - "integrity": "sha512-CT5HLbQjzPZLMl5EjqY++lVuKVQKGbRNKQtOTpM2ABta6QQSTj/vARbIPYSZnwpDGUyGyzBZp2xfI3X3UNyVOg==", - "requires": { - "@babel/runtime": "^7.14.8", - "@mui/private-theming": "^5.0.0", - "@mui/styled-engine": "^5.0.0", - "@mui/types": "^7.0.0", - "@mui/utils": "^5.0.0", - "clsx": "^1.1.1", - "csstype": "^3.0.8", - "prop-types": "^15.7.2" - } - }, - "@mui/types": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.0.0.tgz", - "integrity": "sha512-M/tkF2pZ4uoPhZ8pnNhlVnOFtz6F3dnYKIsnj8MuXKT6d26IE2u0UjA8B0275ggN74dR9rlHG5xJt5jgDx/Ung==", - "requires": {} - }, - "@mui/utils": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.0.0.tgz", - "integrity": "sha512-WGikt+LTiGadqqKIGRwPVGtOUHchEEN6/af/T6nln8REkE2COY5nUirNc89ciPz1AznwZFzLtDmNkeV3NqUz2w==", - "requires": { - "@babel/runtime": "^7.14.8", - "@types/prop-types": "^15.7.4", - "@types/react-is": "^16.7.1 || ^17.0.0", - "prop-types": "^15.7.2", - "react-is": "^17.0.2" - } - }, - "@napi-rs/triples": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@napi-rs/triples/-/triples-1.0.3.tgz", - "integrity": "sha512-jDJTpta+P4p1NZTFVLHJ/TLFVYVcOqv6l8xwOeBKNPMgY/zDYH/YH7SJbvrr/h1RcS9GzbPcLKGzpuK9cV56UA==" - }, - "@next/env": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-11.1.3.tgz", - "integrity": "sha512-5+vaeooJuWmICSlmVaAC8KG3O8hwKasACVfkHj58xQuCB5SW0TKW3hWxgxkBuefMBn1nM0yEVPKokXCsYjBtng==" - }, - "@next/polyfill-module": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/polyfill-module/-/polyfill-module-11.1.3.tgz", - "integrity": "sha512-7yr9cr4a0SrBoVE8psxXWK1wTFc8UzsY8Wc2cWGL7qA0hgtqACHaXC47M1ByJB410hFZenGrpE+KFaT1unQMyw==" - }, - "@next/react-dev-overlay": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/react-dev-overlay/-/react-dev-overlay-11.1.3.tgz", - "integrity": "sha512-zIwtMliSUR+IKl917ToFNB+0fD7bI5kYMdjHU/UEKpfIXAZPnXRHHISCvPDsczlr+bRsbjlUFW1CsNiuFedeuQ==", - "requires": { - "@babel/code-frame": "7.12.11", - "anser": "1.4.9", - "chalk": "4.0.0", - "classnames": "2.2.6", - "css.escape": "1.5.1", - "data-uri-to-buffer": "3.0.1", - "platform": "1.3.6", - "shell-quote": "1.7.2", - "source-map": "0.8.0-beta.0", - "stacktrace-parser": "0.1.10", - "strip-ansi": "6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", - "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@next/react-refresh-utils": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/react-refresh-utils/-/react-refresh-utils-11.1.3.tgz", - "integrity": "sha512-144kD8q2nChw67V3AJJlPQ6NUJVFczyn10bhTynn9o2rY5DEnkzuBipcyMuQl2DqfxMkV7sn+yOCOYbrLCk9zg==", - "requires": {} - }, - "@next/swc-darwin-arm64": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-11.1.3.tgz", - "integrity": "sha512-TwP4krjhs+uU9pesDYCShEXZrLSbJr78p12e7XnLBBaNf20SgWLlVmQUT9gX9KbWan5V0sUbJfmcS8MRNHgYuA==", - "optional": true - }, - "@next/swc-darwin-x64": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-11.1.3.tgz", - "integrity": "sha512-ZSWmkg/PxccHFNUSeBdrfaH8KwSkoeUtewXKvuYYt7Ph0yRsbqSyNIvhUezDua96lApiXXq6EL2d1THfeWomvw==", - "optional": true - }, - "@next/swc-linux-x64-gnu": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-11.1.3.tgz", - "integrity": "sha512-PrTBN0iZudAuj4jSbtXcdBdmfpaDCPIneG4Oms4zcs93KwMgLhivYW082Mvlgx9QVEiRm7+RkFpIVtG/i7JitA==", - "optional": true - }, - "@next/swc-win32-x64-msvc": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-11.1.3.tgz", - "integrity": "sha512-mRwbscVjRoHk+tDY7XbkT5d9FCwujFIQJpGp0XNb1i5OHCSDO8WW/C9cLEWS4LxKRbIZlTLYg1MTXqLQkvva8w==", - "optional": true - }, - "@node-rs/helper": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@node-rs/helper/-/helper-1.2.1.tgz", - "integrity": "sha512-R5wEmm8nbuQU0YGGmYVjEc0OHtYsuXdpRG+Ut/3wZ9XAvQWyThN08bTh2cBJgoZxHQUPtvRfeQuxcAgLuiBISg==", - "requires": { - "@napi-rs/triples": "^1.0.3" - } - }, - "@popperjs/core": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.10.1.tgz", - "integrity": "sha512-HnUhk1Sy9IuKrxEMdIRCxpIqPw6BFsbYSEUO9p/hNw5sMld/+3OLMWQP80F8/db9qsv3qUjs7ZR5bS/R+iinXw==" - }, - "@types/debug": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", - "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==", - "requires": { - "@types/ms": "*" - } - }, - "@types/hast": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz", - "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==", - "requires": { - "@types/unist": "*" - } - }, - "@types/mdast": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.10.tgz", - "integrity": "sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA==", - "requires": { - "@types/unist": "*" - } - }, - "@types/mdurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", - "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==" - }, - "@types/ms": { - "version": "0.7.31", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", - "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" - }, - "@types/node": { - "version": "16.9.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz", - "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpqlpgAAo6H/qnM9RjBgh0A0kmHf3XxAKLdN5mTIng9iUvVLA==" - }, - "@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" - }, - "@types/prop-types": { - "version": "15.7.4", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", - "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==" - }, - "@types/react": { - "version": "17.0.22", - "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.22.tgz", - "integrity": "sha512-kq/BMeaAVLJM6Pynh8C2rnr/drCK+/5ksH0ch9asz+8FW3DscYCIEFtCeYTFeIx/ubvOsMXmRfy7qEJ76gM96A==", - "requires": { - "@types/prop-types": "*", - "@types/scheduler": "*", - "csstype": "^3.0.2" - } - }, - "@types/react-is": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/@types/react-is/-/react-is-17.0.2.tgz", - "integrity": "sha512-2+L0ilcAEG8udkDnvx8B0upwXFBbNnVwOsSCTxW3SDOkmar9NyEeLG0ZLa3uOEw9zyYf/fQapcnfXAVmDKlyHw==", - "requires": { - "@types/react": "*" - } - }, - "@types/react-transition-group": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.3.tgz", - "integrity": "sha512-fUx5muOWSYP8Bw2BUQ9M9RK9+W1XBK/7FLJ8PTQpnpTEkn0ccyMffyEQvan4C3h53gHdx7KE5Qrxi/LnUGQtdg==", - "requires": { - "@types/react": "*" - } - }, - "@types/scheduler": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", - "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" - }, - "@types/unist": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", - "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==" - }, - "acorn": { - "version": "5.7.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", - "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==" - }, - "acorn-es7-plugin": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz", - "integrity": "sha1-8u4fMiipDurRJF+asZIusucdM2s=" - }, - "anser": { - "version": "1.4.9", - "resolved": "https://registry.npmjs.org/anser/-/anser-1.4.9.tgz", - "integrity": "sha512-AI+BjTeGt2+WFk4eWcqbQ7snZpDBt8SaLlj0RT2h5xfdWaiy51OjYvqwMrNzJLGy8iOAL6nKDITWO+rd4MkYEA==" - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "array-filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", - "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=" - }, - "asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } - } - }, - "assert": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", - "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", - "requires": { - "es6-object-assign": "^1.1.0", - "is-nan": "^1.2.1", - "object-is": "^1.0.1", - "util": "^0.12.0" - } - }, - "ast-types": { - "version": "0.13.2", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.2.tgz", - "integrity": "sha512-uWMHxJxtfj/1oZClOxDEV1sQ1HCDkA4MG8Gr69KKeBjEVH0R84WlejZ0y2DcwyBlpAEMltmVYkVgqfLFb2oyiA==" - }, - "available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" - }, - "babel-plugin-macros": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz", - "integrity": "sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==", - "requires": { - "@babel/runtime": "^7.7.2", - "cosmiconfig": "^6.0.0", - "resolve": "^1.12.0" - } - }, - "bail": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.1.tgz", - "integrity": "sha512-d5FoTAr2S5DSUPKl85WNm2yUwsINN8eidIdIwsOge2t33DaOfOdSmmsI11jMN3GmALCXaw+Y6HMVHDzePshFAA==" - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" - }, - "big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" - }, - "bn.js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", - "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "requires": { - "fill-range": "^7.0.1" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "browserify-rsa": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", - "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", - "requires": { - "bn.js": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", - "requires": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - } - }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "requires": { - "pako": "~1.0.5" - } - }, - "browserslist": { - "version": "4.16.6", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", - "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", - "requires": { - "caniuse-lite": "^1.0.30001219", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.723", - "escalade": "^3.1.1", - "node-releases": "^1.1.71" - } - }, - "buffer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" - }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" - }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "call-signature": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/call-signature/-/call-signature-0.0.2.tgz", - "integrity": "sha1-qEq8glpV70yysCi9dOIFpluaSZY=" - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" - }, - "caniuse-lite": { - "version": "1.0.30001258", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001258.tgz", - "integrity": "sha512-RBByOG6xWXUp0CR2/WU2amXz3stjKpSl5J1xU49F1n2OxD//uBZO4wCKUiG+QMGf7CHGfDDcqoKriomoGVxTeA==" - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "character-entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.0.tgz", - "integrity": "sha512-oHqMj3eAuJ77/P5PaIRcqk+C3hdfNwyCD2DAUcD5gyXkegAuF2USC40CEqPscDk4I8FRGMTojGJQkXDsN5QlJA==" - }, - "character-entities-legacy": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-2.0.0.tgz", - "integrity": "sha512-YwaEtEvWLpFa6Wh3uVLrvirA/ahr9fki/NUd/Bd4OR6EdJ8D22hovYQEOUCBfQfcqnC4IAMGMsHXY1eXgL4ZZA==" - }, - "character-reference-invalid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.0.tgz", - "integrity": "sha512-pE3Z15lLRxDzWJy7bBHBopRwfI20sbrMVLQTC7xsPglCHf4Wv1e167OgYAFP78co2XlhojDyAqA+IAJse27//g==" - }, - "chokidar": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", - "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.3.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - } - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "classnames": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz", - "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==" - }, - "clsx": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz", - "integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==" - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "colorette": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", - "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==" - }, - "comma-separated-tokens": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.2.tgz", - "integrity": "sha512-G5yTt3KQN4Yn7Yk4ed73hlZ1evrFKXeUW3086p3PRFNp7m2vIjI6Pg+Kgb+oyzhd9F2qdcoj67+y3SdxL5XWsg==" - }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" - }, - "console-browserify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", - "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" - }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=" - }, - "convert-source-map": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "requires": { - "safe-buffer": "~5.1.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, - "core-js": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", - "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==" - }, - "core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" - }, - "cosmiconfig": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", - "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", - "requires": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.1.0", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.7.2" - } - }, - "create-ecdh": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", - "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } - } - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, - "css-vendor": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz", - "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==", - "requires": { - "@babel/runtime": "^7.8.3", - "is-in-browser": "^1.0.2" - } - }, - "css.escape": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", - "integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=" - }, - "cssnano-preset-simple": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssnano-preset-simple/-/cssnano-preset-simple-3.0.0.tgz", - "integrity": "sha512-vxQPeoMRqUT3c/9f0vWeVa2nKQIHFpogtoBvFdW4GQ3IvEJ6uauCP6p3Y5zQDLFcI7/+40FTgX12o7XUL0Ko+w==", - "requires": { - "caniuse-lite": "^1.0.30001202" - } - }, - "cssnano-simple": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssnano-simple/-/cssnano-simple-3.0.0.tgz", - "integrity": "sha512-oU3ueli5Dtwgh0DyeohcIEE00QVfbPR3HzyXdAl89SfnQG3y0/qcpfLVW+jPIh3/rgMZGwuW96rejZGaYE9eUg==", - "requires": { - "cssnano-preset-simple": "^3.0.0" - } - }, - "csstype": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.9.tgz", - "integrity": "sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw==" - }, - "data-uri-to-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", - "integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "requires": { - "object-keys": "^1.0.12" - } - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "des.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", - "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "diff-match-patch": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz", - "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==" - }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } - } - }, - "dom-helpers": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", - "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", - "requires": { - "@babel/runtime": "^7.8.7", - "csstype": "^3.0.2" - } - }, - "domain-browser": { - "version": "4.19.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-4.19.0.tgz", - "integrity": "sha512-fRA+BaAWOR/yr/t7T9E9GJztHPeFjj8U35ajyAjCDtAAnTn1Rc1f6W6VGPJrO1tkQv9zWu+JRof7z6oQtiYVFQ==" - }, - "eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" - }, - "electron-to-chromium": { - "version": "1.3.844", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.844.tgz", - "integrity": "sha512-7ES6GQVsbgsUA49/apqub51I9ij8E3QwGqq/IRvO6OPCly3how/YUSg1GPslRWq+BteT2h94iAIQdJbuVVH4Pg==" - }, - "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "requires": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } - } - }, - "emojis-list": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", - "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=" - }, - "empower": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/empower/-/empower-1.3.1.tgz", - "integrity": "sha512-uB6/ViBaawOO/uujFADTK3SqdYlxYNn+N4usK9MRKZ4Hbn/1QSy8k2PezxCA2/+JGbF8vd/eOfghZ90oOSDZCA==", - "requires": { - "core-js": "^2.0.0", - "empower-core": "^1.2.0" - } - }, - "empower-core": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/empower-core/-/empower-core-1.2.0.tgz", - "integrity": "sha512-g6+K6Geyc1o6FdXs9HwrXleCFan7d66G5xSCfSF7x1mJDCes6t0om9lFQG3zOrzh3Bkb/45N0cZ5Gqsf7YrzGQ==", - "requires": { - "call-signature": "0.0.2", - "core-js": "^2.0.0" - } - }, - "encoding": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", - "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", - "requires": { - "iconv-lite": "^0.6.2" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.18.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.6.tgz", - "integrity": "sha512-kAeIT4cku5eNLNuUKhlmtuk1/TRZvQoYccn6TO0cSVdf1kzB0T7+dYuVK9MWM7l+/53W2Q8M7N2c6MQvhXFcUQ==", - "requires": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.4", - "is-string": "^1.0.7", - "object-inspect": "^1.11.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "es6-object-assign": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=" - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "espurify": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/espurify/-/espurify-1.8.1.tgz", - "integrity": "sha512-ZDko6eY/o+D/gHCWyHTU85mKDgYcS4FJj7S+YD6WIInm7GQ6AnOjmcL4+buFV/JOztVLELi/7MmuGU5NHta0Mg==", - "requires": { - "core-js": "^2.0.0" - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==" - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - } - }, - "find-root": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", - "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==" - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "peer": true - }, - "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, - "get-orientation": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/get-orientation/-/get-orientation-1.1.2.tgz", - "integrity": "sha512-/pViTfifW+gBbh/RnlFYHINvELT9Znt+SYyDKAUL6uV6By019AK/s+i9XP4jSwq7lwP38Fd8HVeTxym3+hkwmQ==", - "requires": { - "stream-parser": "^0.3.1" - } - }, - "get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "requires": { - "is-glob": "^4.0.1" - } - }, - "glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "peer": true - }, - "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==" - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" - }, - "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" - }, - "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "requires": { - "has-symbols": "^1.0.2" - } - }, - "hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - } - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "hoist-non-react-statics": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", - "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", - "requires": { - "react-is": "^16.7.0" - }, - "dependencies": { - "react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - } - } - }, - "http-errors": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", - "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=" - }, - "hyphenate-style-name": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz", - "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==" - }, - "iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, - "image-size": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-1.0.0.tgz", - "integrity": "sha512-JLJ6OwBfO1KcA+TvJT+v8gbE6iWbj24LyDNFgFEN0lzegn6cC6a/p3NIDaepMsJjQjlUWqIC7wJv8lBFxPNjcw==", - "requires": { - "queue": "6.0.2" - } - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "inline-style-parser": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz", - "integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==" - }, - "internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "requires": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - } - }, - "is-alphabetical": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.0.tgz", - "integrity": "sha512-5OV8Toyq3oh4eq6sbWTYzlGdnMT/DPI5I0zxUBxjiigQsZycpkKF3kskkao3JyYGuYDHvhgJF+DrjMQp9SX86w==" - }, - "is-alphanumerical": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.0.tgz", - "integrity": "sha512-t+2GlJ+hO9yagJ+jU3+HSh80VKvz/3cG2cxbGGm4S0hjKuhWQXgPVUVOZz3tqZzMjhmphZ+1TIJTlRZRoe6GCQ==", - "requires": { - "is-alphabetical": "^2.0.0", - "is-decimal": "^2.0.0" - } - }, - "is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" - }, - "is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "requires": { - "has-bigints": "^1.0.1" - } - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" - }, - "is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==" - }, - "is-core-module": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", - "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", - "requires": { - "has": "^1.0.3" - } - }, - "is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-decimal": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.0.tgz", - "integrity": "sha512-QfrfjQV0LjoWQ1K1XSoEZkTAzSa14RKVMa5zg3SdAfzEmQzRM4+tbSFWb78creCeA9rNBzaZal92opi1TwPWZw==" - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-hexadecimal": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.0.tgz", - "integrity": "sha512-vGOtYkiaxwIiR0+Ng/zNId+ZZehGfINwTzdrDqc6iubbnQWhnPuYymOzOKUDqa2cSl59yHnEh2h6MvRLQsyNug==" - }, - "is-in-browser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz", - "integrity": "sha1-Vv9NtoOgeMYILrldrX3GLh0E+DU=" - }, - "is-nan": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", - "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3" - } - }, - "is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==" - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" - }, - "is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-plain-obj": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.0.0.tgz", - "integrity": "sha512-NXRbBtUdBioI73y/HmOhogw/U5msYPC9DAtGkJXeFcFWSFZw0mCUsPxk/snTuJHzNKA8kLBK4rH97RMB1BfCXw==" - }, - "is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "requires": { - "has-symbols": "^1.0.2" - } - }, - "is-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", - "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", - "has-tostringtag": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "javascript-time-ago": { - "version": "2.3.10", - "resolved": "https://registry.npmjs.org/javascript-time-ago/-/javascript-time-ago-2.3.10.tgz", - "integrity": "sha512-eeZx3B8ACZpFTiaow4Xl3YTIG9UjebwVjHEDnKyzJ1NBve1ZqJIgy97yoT9Esw+Vf+XgSk4YCpOsyK5X/ByRzQ==", - "requires": { - "relative-time-format": "^1.0.6" - } - }, - "jest-worker": { - "version": "27.0.0-next.5", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.0.0-next.5.tgz", - "integrity": "sha512-mk0umAQ5lT+CaOJ+Qp01N6kz48sJG2kr2n1rX0koqKf6FIygQV0qLOdN9SCYID4IVeSigDOcPeGLozdMLYfb5g==", - "requires": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "peer": true - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" - }, - "json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "peer": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "jss": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss/-/jss-10.8.0.tgz", - "integrity": "sha512-6fAMLJrVQ8epM5ghghxWqCwRR0ZamP2cKbOAtzPudcCMSNdAqtvmzQvljUZYR8OXJIeb/IpZeOXA1sDXms4R1w==", - "requires": { - "@babel/runtime": "^7.3.1", - "csstype": "^3.0.2", - "is-in-browser": "^1.1.3", - "tiny-warning": "^1.0.2" - } - }, - "jss-plugin-camel-case": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.8.0.tgz", - "integrity": "sha512-yxlXrXwcCdGw+H4BC187dEu/RFyW8joMcWfj8Rk9UPgWTKu2Xh7Sib4iW3xXjHe/t5phOHF1rBsHleHykWix7g==", - "requires": { - "@babel/runtime": "^7.3.1", - "hyphenate-style-name": "^1.0.3", - "jss": "10.8.0" - } - }, - "jss-plugin-default-unit": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.8.0.tgz", - "integrity": "sha512-9XJV546cY9zV9OvIE/v/dOaxSi4062VfYQQfwbplRExcsU2a79Yn+qDz/4ciw6P4LV1Naq90U+OffAGRHfNq/Q==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0" - } - }, - "jss-plugin-global": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.8.0.tgz", - "integrity": "sha512-H/8h/bHd4e7P0MpZ9zaUG8NQSB2ie9rWo/vcCP6bHVerbKLGzj+dsY22IY3+/FNRS8zDmUyqdZx3rD8k4nmH4w==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0" - } - }, - "jss-plugin-nested": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.8.0.tgz", - "integrity": "sha512-MhmINZkSxyFILcFBuDoZmP1+wj9fik/b9SsjoaggkGjdvMQCES21mj4K5ZnRGVm448gIXyi9j/eZjtDzhaHUYQ==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0", - "tiny-warning": "^1.0.2" - } - }, - "jss-plugin-props-sort": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.8.0.tgz", - "integrity": "sha512-VY+Wt5WX5GMsXDmd+Ts8+O16fpiCM81svbox++U3LDbJSM/g9FoMx3HPhwUiDfmgHL9jWdqEuvSl/JAk+mh6mQ==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0" - } - }, - "jss-plugin-rule-value-function": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.8.0.tgz", - "integrity": "sha512-R8N8Ma6Oye1F9HroiUuHhVjpPsVq97uAh+rMI6XwKLqirIu2KFb5x33hPj+vNBMxSHc9jakhf5wG0BbQ7fSDOg==", - "requires": { - "@babel/runtime": "^7.3.1", - "jss": "10.8.0", - "tiny-warning": "^1.0.2" - } - }, - "jss-plugin-vendor-prefixer": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.8.0.tgz", - "integrity": "sha512-G1zD0J8dFwKZQ+GaZaay7A/Tg7lhDw0iEkJ/iFFA5UPuvZFpMprCMQttXcTBhLlhhWnyZ8YPn4yqp+amrhQekw==", - "requires": { - "@babel/runtime": "^7.3.1", - "css-vendor": "^2.0.8", - "jss": "10.8.0" - } - }, - "lines-and-columns": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", - "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" - }, - "loader-utils": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz", - "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==", - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^2.0.0", - "json5": "^1.0.1" - }, - "dependencies": { - "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", - "requires": { - "minimist": "^1.2.0" - } - } - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "lodash-es": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" - }, - "lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "requires": { - "semver": "^6.0.0" - } - }, - "material-colors": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz", - "integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg==" - }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "mdast-util-definitions": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.0.tgz", - "integrity": "sha512-5hcR7FL2EuZ4q6lLMUK5w4lHT2H3vqL9quPvYZ/Ku5iifrirfMHiGdhxdXMUbUkDmz5I+TYMd7nbaxUhbQkfpQ==", - "requires": { - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "unist-util-visit": "^3.0.0" - }, - "dependencies": { - "unist-util-visit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-3.1.0.tgz", - "integrity": "sha512-Szoh+R/Ll68QWAyQyZZpQzZQm2UPbxibDvaY8Xc9SUtYgPsDzx5AWSk++UUt2hJuow8mvwR+rG+LQLw+KsuAKA==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^4.0.0" - } - }, - "unist-util-visit-parents": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-4.1.1.tgz", - "integrity": "sha512-1xAFJXAKpnnJl8G7K5KgU7FY55y3GcLIXqkzUj5QF/QVP7biUm0K0O2oqVkYsdjzJKifYeWn9+o6piAK2hGSHw==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } - } - } - }, - "mdast-util-from-markdown": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-1.0.3.tgz", - "integrity": "sha512-8/GPJsE3h73C+PBFJ3cCdvegz07mLS8/5NfuIsP8q/cw/Ph/aximc6OYdfwerwcZqTYVu7WeXm/8+RDztxreZQ==", - "requires": { - "@types/mdast": "^3.0.0", - "@types/unist": "^2.0.0", - "mdast-util-to-string": "^3.1.0", - "micromark": "^3.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-decode-string": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "parse-entities": "^3.0.0", - "power-assert": "^1.0.0", - "unist-util-stringify-position": "^3.0.0" - } - }, - "mdast-util-to-hast": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-11.3.0.tgz", - "integrity": "sha512-4o3Cli3hXPmm1LhB+6rqhfsIUBjnKFlIUZvudaermXB+4/KONdd/W4saWWkC+LBLbPMqhFSSTSRgafHsT5fVJw==", - "requires": { - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "@types/mdurl": "^1.0.0", - "mdast-util-definitions": "^5.0.0", - "mdurl": "^1.0.0", - "unist-builder": "^3.0.0", - "unist-util-generated": "^2.0.0", - "unist-util-position": "^4.0.0", - "unist-util-visit": "^4.0.0" - } - }, - "mdast-util-to-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.1.0.tgz", - "integrity": "sha512-n4Vypz/DZgwo0iMHLQL49dJzlp7YtAJP+N07MZHpjPf/5XJuHUWstviF4Mn2jEiR/GNmtnRRqnwsXExk3igfFA==" - }, - "mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=" - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" - }, - "micromark": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.0.6.tgz", - "integrity": "sha512-yzyfAHhglgEDprJnsvoQVPSXy5OnQfgyatGTxh0XVpismB5+aECnsHY2I1oxsySf6t/2FeamjOLoxun47nVhvw==", - "requires": { - "@types/debug": "^4.0.0", - "debug": "^4.0.0", - "micromark-core-commonmark": "^1.0.1", - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-chunked": "^1.0.0", - "micromark-util-combine-extensions": "^1.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-encode": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-resolve-all": "^1.0.0", - "micromark-util-sanitize-uri": "^1.0.0", - "micromark-util-subtokenize": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.1", - "parse-entities": "^3.0.0" - }, - "dependencies": { - "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - } - } - }, - "micromark-core-commonmark": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.0.2.tgz", - "integrity": "sha512-nIxVDZnm1ra2BcnUSUWe9LC3UBTQ/sqUp4do80xXhtCWxBYj7u70Qw2CH54oZu7jblDCxDO3tmNBSprV5EWndg==", - "requires": { - "micromark-factory-destination": "^1.0.0", - "micromark-factory-label": "^1.0.0", - "micromark-factory-space": "^1.0.0", - "micromark-factory-title": "^1.0.0", - "micromark-factory-whitespace": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-chunked": "^1.0.0", - "micromark-util-classify-character": "^1.0.0", - "micromark-util-html-tag-name": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "micromark-util-resolve-all": "^1.0.0", - "micromark-util-subtokenize": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.1", - "parse-entities": "^3.0.0", - "power-assert": "^1.0.0" - } - }, - "micromark-factory-destination": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.0.0.tgz", - "integrity": "sha512-eUBA7Rs1/xtTVun9TmV3gjfPz2wEwgK5R5xcbIM5ZYAtvGF6JkyaDsj0agx8urXnO31tEO6Ug83iVH3tdedLnw==", - "requires": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "micromark-factory-label": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.0.1.tgz", - "integrity": "sha512-d/we+Gm9cqySOaPmtx109GEbG2dadb2myK9Tcm3aAx9Ug0IL4ucQtzKVoO+02HI10E76ncv9n/VEEF5ym0RzTQ==", - "requires": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "power-assert": "^1.0.0" - } - }, - "micromark-factory-space": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-1.0.0.tgz", - "integrity": "sha512-qUmqs4kj9a5yBnk3JMLyjtWYN6Mzfcx8uJfi5XAveBniDevmZasdGBba5b4QsvRcAkmvGo5ACmSUmyGiKTLZew==", - "requires": { - "micromark-util-character": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "micromark-factory-title": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.0.1.tgz", - "integrity": "sha512-nAdDygUZK7WtHFkNi01PzS33jeWPKZXA6LEABQiCVDXvNNUjdQ9o4stT8jBu3BNsE3ZulfG5IGdfWuOWS/CS+w==", - "requires": { - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "power-assert": "^1.0.0" - } - }, - "micromark-factory-whitespace": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.0.0.tgz", - "integrity": "sha512-Qx7uEyahU1lt1RnsECBiuEbfr9INjQTGa6Err+gF3g0Tx4YEviPbqqGKNv/NrBaE7dVHdn1bVZKM/n5I/Bak7A==", - "requires": { - "micromark-factory-space": "^1.0.0", - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "micromark-util-character": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-1.1.0.tgz", - "integrity": "sha512-agJ5B3unGNJ9rJvADMJ5ZiYjBRyDpzKAOk01Kpi1TKhlT1APx3XZk6eN7RtSz1erbWHC2L8T3xLZ81wdtGRZzg==", - "requires": { - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "micromark-util-chunked": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.0.0.tgz", - "integrity": "sha512-5e8xTis5tEZKgesfbQMKRCyzvffRRUX+lK/y+DvsMFdabAicPkkZV6gO+FEWi9RfuKKoxxPwNL+dFF0SMImc1g==", - "requires": { - "micromark-util-symbol": "^1.0.0" - } - }, - "micromark-util-classify-character": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.0.0.tgz", - "integrity": "sha512-F8oW2KKrQRb3vS5ud5HIqBVkCqQi224Nm55o5wYLzY/9PwHGXC01tr3d7+TqHHz6zrKQ72Okwtvm/xQm6OVNZA==", - "requires": { - "micromark-util-character": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "micromark-util-combine-extensions": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.0.0.tgz", - "integrity": "sha512-J8H058vFBdo/6+AsjHp2NF7AJ02SZtWaVUjsayNFeAiydTxUwViQPxN0Hf8dp4FmCQi0UUFovFsEyRSUmFH3MA==", - "requires": { - "micromark-util-chunked": "^1.0.0", - "micromark-util-types": "^1.0.0" - } - }, - "micromark-util-decode-numeric-character-reference": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.0.0.tgz", - "integrity": "sha512-OzO9AI5VUtrTD7KSdagf4MWgHMtET17Ua1fIpXTpuhclCqD8egFWo85GxSGvxgkGS74bEahvtM0WP0HjvV0e4w==", - "requires": { - "micromark-util-symbol": "^1.0.0" - } - }, - "micromark-util-decode-string": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.0.1.tgz", - "integrity": "sha512-Wf3H6jLaO3iIlHEvblESXaKAr72nK7JtBbLLICPwuZc3eJkMcp4j8rJ5Xv1VbQWMCWWDvKUbVUbE2MfQNznwTA==", - "requires": { - "micromark-util-character": "^1.0.0", - "micromark-util-decode-numeric-character-reference": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "parse-entities": "^3.0.0" - } - }, - "micromark-util-encode": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.0.0.tgz", - "integrity": "sha512-cJpFVM768h6zkd8qJ1LNRrITfY4gwFt+tziPcIf71Ui8yFzY9wG3snZQqiWVq93PG4Sw6YOtcNiKJfVIs9qfGg==" - }, - "micromark-util-html-tag-name": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.0.0.tgz", - "integrity": "sha512-NenEKIshW2ZI/ERv9HtFNsrn3llSPZtY337LID/24WeLqMzeZhBEE6BQ0vS2ZBjshm5n40chKtJ3qjAbVV8S0g==" - }, - "micromark-util-normalize-identifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.0.0.tgz", - "integrity": "sha512-yg+zrL14bBTFrQ7n35CmByWUTFsgst5JhA4gJYoty4Dqzj4Z4Fr/DHekSS5aLfH9bdlfnSvKAWsAgJhIbogyBg==", - "requires": { - "micromark-util-symbol": "^1.0.0" - } - }, - "micromark-util-resolve-all": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.0.0.tgz", - "integrity": "sha512-CB/AGk98u50k42kvgaMM94wzBqozSzDDaonKU7P7jwQIuH2RU0TeBqGYJz2WY1UdihhjweivStrJ2JdkdEmcfw==", - "requires": { - "micromark-util-types": "^1.0.0" - } - }, - "micromark-util-sanitize-uri": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.0.0.tgz", - "integrity": "sha512-cCxvBKlmac4rxCGx6ejlIviRaMKZc0fWm5HdCHEeDWRSkn44l6NdYVRyU+0nT1XC72EQJMZV8IPHF+jTr56lAg==", - "requires": { - "micromark-util-character": "^1.0.0", - "micromark-util-encode": "^1.0.0", - "micromark-util-symbol": "^1.0.0" - } - }, - "micromark-util-subtokenize": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.0.1.tgz", - "integrity": "sha512-Zy7XuVepFWm8MqiqFywq4wFu4GXlksyC3e942GaQBXaaCWha3VbkZiTmOEBDCcvp1xKq/xZ2gGEIsCjU+SuEig==", - "requires": { - "micromark-util-chunked": "^1.0.0", - "micromark-util-symbol": "^1.0.0", - "micromark-util-types": "^1.0.0", - "power-assert": "^1.0.0" - } - }, - "micromark-util-symbol": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-1.0.0.tgz", - "integrity": "sha512-NZA01jHRNCt4KlOROn8/bGi6vvpEmlXld7EHcRH+aYWUfL3Wc8JLUNNlqUMKa0hhz6GrpUWsHtzPmKof57v0gQ==" - }, - "micromark-util-types": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-1.0.1.tgz", - "integrity": "sha512-UT0ylWEEy80RFYzK9pEaugTqaxoD/j0Y9WhHpSyitxd99zjoQz7JJ+iKuhPAgOW2MiPSUAx+c09dcqokeyaROA==" - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } - } - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "nanoid": { - "version": "3.1.25", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", - "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==" - }, - "native-url": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/native-url/-/native-url-0.3.4.tgz", - "integrity": "sha512-6iM8R99ze45ivyH8vybJ7X0yekIcPf5GgLV5K0ENCbmRcaRIDoj37BC8iLEmaaBfqqb8enuZ5p0uhY+lVAbAcA==", - "requires": { - "querystring": "^0.2.0" - } - }, - "next": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/next/-/next-11.1.3.tgz", - "integrity": "sha512-ud/gKmnKQ8wtHC+pd1ZiqPRa7DdgulPkAk94MbpsspfNliwZkYs9SIYWhlLSyg+c661LzdUI2nZshvrtggSYWA==", - "requires": { - "@babel/runtime": "7.15.3", - "@hapi/accept": "5.0.2", - "@next/env": "11.1.3", - "@next/polyfill-module": "11.1.3", - "@next/react-dev-overlay": "11.1.3", - "@next/react-refresh-utils": "11.1.3", - "@next/swc-darwin-arm64": "11.1.3", - "@next/swc-darwin-x64": "11.1.3", - "@next/swc-linux-x64-gnu": "11.1.3", - "@next/swc-win32-x64-msvc": "11.1.3", - "@node-rs/helper": "1.2.1", - "assert": "2.0.0", - "ast-types": "0.13.2", - "browserify-zlib": "0.2.0", - "browserslist": "4.16.6", - "buffer": "5.6.0", - "caniuse-lite": "^1.0.30001228", - "chalk": "2.4.2", - "chokidar": "3.5.1", - "constants-browserify": "1.0.0", - "crypto-browserify": "3.12.0", - "cssnano-simple": "3.0.0", - "domain-browser": "4.19.0", - "encoding": "0.1.13", - "etag": "1.8.1", - "find-cache-dir": "3.3.1", - "get-orientation": "1.1.2", - "https-browserify": "1.0.0", - "image-size": "1.0.0", - "jest-worker": "27.0.0-next.5", - "native-url": "0.3.4", - "node-fetch": "2.6.1", - "node-html-parser": "1.4.9", - "node-libs-browser": "^2.2.1", - "os-browserify": "0.3.0", - "p-limit": "3.1.0", - "path-browserify": "1.0.1", - "pnp-webpack-plugin": "1.6.4", - "postcss": "8.2.15", - "process": "0.11.10", - "querystring-es3": "0.2.1", - "raw-body": "2.4.1", - "react-is": "17.0.2", - "react-refresh": "0.8.3", - "stream-browserify": "3.0.0", - "stream-http": "3.1.1", - "string_decoder": "1.3.0", - "styled-jsx": "4.0.1", - "timers-browserify": "2.0.12", - "tty-browserify": "0.0.1", - "use-subscription": "1.5.1", - "util": "0.12.4", - "vm-browserify": "1.1.2", - "watchpack": "2.1.1" - } - }, - "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" - }, - "node-html-parser": { - "version": "1.4.9", - "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-1.4.9.tgz", - "integrity": "sha512-UVcirFD1Bn0O+TSmloHeHqZZCxHjvtIeGdVdGMhyZ8/PWlEiZaZ5iJzR189yKZr8p0FXN58BUeC7RHRkf/KYGw==", - "requires": { - "he": "1.2.0" - } - }, - "node-libs-browser": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz", - "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==", - "requires": { - "assert": "^1.1.1", - "browserify-zlib": "^0.2.0", - "buffer": "^4.3.0", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.11.0", - "domain-browser": "^1.1.1", - "events": "^3.0.0", - "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "0.0.1", - "process": "^0.11.10", - "punycode": "^1.2.4", - "querystring-es3": "^0.2.0", - "readable-stream": "^2.3.3", - "stream-browserify": "^2.0.1", - "stream-http": "^2.7.2", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", - "tty-browserify": "0.0.0", - "url": "^0.11.0", - "util": "^0.11.0", - "vm-browserify": "^1.0.1" - }, - "dependencies": { - "assert": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", - "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", - "requires": { - "object-assign": "^4.1.1", - "util": "0.10.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" - }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "requires": { - "inherits": "2.0.1" - } - } - } - }, - "buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==" - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "path-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", - "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==" - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "stream-browserify": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", - "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", - "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" - } - }, - "stream-http": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", - "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.6", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "tty-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", - "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=" - }, - "util": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", - "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", - "requires": { - "inherits": "2.0.3" - } - } - } - }, - "node-releases": { - "version": "1.1.76", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz", - "integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==" - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==" - }, - "object-is": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", - "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" - }, - "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=" - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "requires": { - "p-limit": "^2.2.0" - }, - "dependencies": { - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "requires": { - "p-try": "^2.0.0" - } - } - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" - }, - "pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "requires": { - "callsites": "^3.0.0" - } - }, - "parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "requires": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, - "parse-entities": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-3.0.0.tgz", - "integrity": "sha512-AJlcIFDNPEP33KyJLguv0xJc83BNvjxwpuUIcetyXUsLpVXAUCePJ5kIoYtEN2R1ac0cYaRu/vk9dVFkewHQhQ==", - "requires": { - "character-entities": "^2.0.0", - "character-entities-legacy": "^2.0.0", - "character-reference-invalid": "^2.0.0", - "is-alphanumerical": "^2.0.0", - "is-decimal": "^2.0.0", - "is-hexadecimal": "^2.0.0" - } - }, - "parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" - }, - "pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==" - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "requires": { - "find-up": "^4.0.0" - } - }, - "platform": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", - "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" - }, - "pnp-webpack-plugin": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/pnp-webpack-plugin/-/pnp-webpack-plugin-1.6.4.tgz", - "integrity": "sha512-7Wjy+9E3WwLOEL30D+m8TSTF7qJJUJLONBnwQp0518siuMxUQUbgZwssaFX+QKlZkjHZcw/IpZCt/H0srrntSg==", - "requires": { - "ts-pnp": "^1.1.6" - } - }, - "postcss": { - "version": "8.2.15", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.2.15.tgz", - "integrity": "sha512-2zO3b26eJD/8rb106Qu2o7Qgg52ND5HPjcyQiK2B98O388h43A448LCslC0dI2P97wCAQRJsFvwTRcXxTKds+Q==", - "requires": { - "colorette": "^1.2.2", - "nanoid": "^3.1.23", - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" - } - } - }, - "power-assert": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/power-assert/-/power-assert-1.6.1.tgz", - "integrity": "sha512-VWkkZV6Y+W8qLX/PtJu2Ur2jDPIs0a5vbP0TpKeybNcIXmT4vcKoVkyTp5lnQvTpY/DxacAZ4RZisHRHLJcAZQ==", - "requires": { - "define-properties": "^1.1.2", - "empower": "^1.3.1", - "power-assert-formatter": "^1.4.1", - "universal-deep-strict-equal": "^1.2.1", - "xtend": "^4.0.0" - } - }, - "power-assert-context-formatter": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-context-formatter/-/power-assert-context-formatter-1.2.0.tgz", - "integrity": "sha512-HLNEW8Bin+BFCpk/zbyKwkEu9W8/zThIStxGo7weYcFkKgMuGCHUJhvJeBGXDZf0Qm2xis4pbnnciGZiX0EpSg==", - "requires": { - "core-js": "^2.0.0", - "power-assert-context-traversal": "^1.2.0" - } - }, - "power-assert-context-reducer-ast": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-context-reducer-ast/-/power-assert-context-reducer-ast-1.2.0.tgz", - "integrity": "sha512-EgOxmZ/Lb7tw4EwSKX7ZnfC0P/qRZFEG28dx/690qvhmOJ6hgThYFm5TUWANDLK5NiNKlPBi5WekVGd2+5wPrw==", - "requires": { - "acorn": "^5.0.0", - "acorn-es7-plugin": "^1.0.12", - "core-js": "^2.0.0", - "espurify": "^1.6.0", - "estraverse": "^4.2.0" - } - }, - "power-assert-context-traversal": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-context-traversal/-/power-assert-context-traversal-1.2.0.tgz", - "integrity": "sha512-NFoHU6g2umNajiP2l4qb0BRWD773Aw9uWdWYH9EQsVwIZnog5bd2YYLFCVvaxWpwNzWeEfZIon2xtyc63026pQ==", - "requires": { - "core-js": "^2.0.0", - "estraverse": "^4.1.0" - } - }, - "power-assert-formatter": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/power-assert-formatter/-/power-assert-formatter-1.4.1.tgz", - "integrity": "sha1-XcEl7VCj37HdomwZNH879Y7CiEo=", - "requires": { - "core-js": "^2.0.0", - "power-assert-context-formatter": "^1.0.7", - "power-assert-context-reducer-ast": "^1.0.7", - "power-assert-renderer-assertion": "^1.0.7", - "power-assert-renderer-comparison": "^1.0.7", - "power-assert-renderer-diagram": "^1.0.7", - "power-assert-renderer-file": "^1.0.7" - } - }, - "power-assert-renderer-assertion": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-renderer-assertion/-/power-assert-renderer-assertion-1.2.0.tgz", - "integrity": "sha512-3F7Q1ZLmV2ZCQv7aV7NJLNK9G7QsostrhOU7U0RhEQS/0vhEqrRg2jEJl1jtUL4ZyL2dXUlaaqrmPv5r9kRvIg==", - "requires": { - "power-assert-renderer-base": "^1.1.1", - "power-assert-util-string-width": "^1.2.0" - } - }, - "power-assert-renderer-base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/power-assert-renderer-base/-/power-assert-renderer-base-1.1.1.tgz", - "integrity": "sha1-lqZQxv0F7hvB9mtUrWFELIs/Y+s=" - }, - "power-assert-renderer-comparison": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-renderer-comparison/-/power-assert-renderer-comparison-1.2.0.tgz", - "integrity": "sha512-7c3RKPDBKK4E3JqdPtYRE9cM8AyX4LC4yfTvvTYyx8zSqmT5kJnXwzR0yWQLOavACllZfwrAGQzFiXPc5sWa+g==", - "requires": { - "core-js": "^2.0.0", - "diff-match-patch": "^1.0.0", - "power-assert-renderer-base": "^1.1.1", - "stringifier": "^1.3.0", - "type-name": "^2.0.1" - } - }, - "power-assert-renderer-diagram": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-renderer-diagram/-/power-assert-renderer-diagram-1.2.0.tgz", - "integrity": "sha512-JZ6PC+DJPQqfU6dwSmpcoD7gNnb/5U77bU5KgNwPPa+i1Pxiz6UuDeM3EUBlhZ1HvH9tMjI60anqVyi5l2oNdg==", - "requires": { - "core-js": "^2.0.0", - "power-assert-renderer-base": "^1.1.1", - "power-assert-util-string-width": "^1.2.0", - "stringifier": "^1.3.0" - } - }, - "power-assert-renderer-file": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-renderer-file/-/power-assert-renderer-file-1.2.0.tgz", - "integrity": "sha512-/oaVrRbeOtGoyyd7e4IdLP/jIIUFJdqJtsYzP9/88R39CMnfF/S/rUc8ZQalENfUfQ/wQHu+XZYRMaCEZmEesg==", - "requires": { - "power-assert-renderer-base": "^1.1.1" - } - }, - "power-assert-util-string-width": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/power-assert-util-string-width/-/power-assert-util-string-width-1.2.0.tgz", - "integrity": "sha512-lX90G0igAW0iyORTILZ/QjZWsa1MZ6VVY3L0K86e2eKun3S4LKPH4xZIl8fdeMYLfOjkaszbNSzf1uugLeAm2A==", - "requires": { - "eastasianwidth": "^0.2.0" - } - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" - }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - }, - "dependencies": { - "react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - } - } - }, - "property-information": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.0.1.tgz", - "integrity": "sha512-F4WUUAF7fMeF4/JUFHNBWDaKDXi2jbvqBW/y6o5wsf3j19wTZ7S60TmtB5HoBhtgw7NKQRMWuz5vk2PR0CygUg==" - }, - "public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "querystring": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.1.tgz", - "integrity": "sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg==" - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" - }, - "queue": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz", - "integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==", - "requires": { - "inherits": "~2.0.3" - } - }, - "raf": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", - "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", - "requires": { - "performance-now": "^2.1.0" - } - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "raw-body": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz", - "integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==", - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.3", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - } - } - }, - "react": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", - "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - }, - "react-color": { - "version": "2.19.3", - "resolved": "https://registry.npmjs.org/react-color/-/react-color-2.19.3.tgz", - "integrity": "sha512-LEeGE/ZzNLIsFWa1TMe8y5VYqr7bibneWmvJwm1pCn/eNmrabWDh659JSPn9BuaMpEfU83WTOJfnCcjDZwNQTA==", - "requires": { - "@icons/material": "^0.2.4", - "lodash": "^4.17.15", - "lodash-es": "^4.17.15", - "material-colors": "^1.2.1", - "prop-types": "^15.5.10", - "reactcss": "^1.2.0", - "tinycolor2": "^1.4.1" - } - }, - "react-dom": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", - "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "scheduler": "^0.20.2" - } - }, - "react-is": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", - "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" - }, - "react-markdown": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-7.0.1.tgz", - "integrity": "sha512-pthNPaoiwg0q7hukoE04F2ENwSzijIlWHJ4UMs/96LUe/G/P3FnbP4qHzx3FoNqae+2SqDG8vzniTLnJDeWneg==", - "requires": { - "@types/hast": "^2.0.0", - "@types/unist": "^2.0.0", - "comma-separated-tokens": "^2.0.0", - "prop-types": "^15.0.0", - "property-information": "^6.0.0", - "react-is": "^17.0.0", - "remark-parse": "^10.0.0", - "remark-rehype": "^9.0.0", - "space-separated-tokens": "^2.0.0", - "style-to-object": "^0.3.0", - "unified": "^10.0.0", - "unist-util-visit": "^4.0.0", - "vfile": "^5.0.0" - } - }, - "react-refresh": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz", - "integrity": "sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg==" - }, - "react-time-ago": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/react-time-ago/-/react-time-ago-7.1.4.tgz", - "integrity": "sha512-W52GqGQRSEaITqy5YPZ6i9fy0mhwpTzY0ScoF43jlAvNY0Kb5CCllXqHky3sPgkGJS7JELCd+dbOgiQqz779FQ==", - "requires": { - "prop-types": "^15.7.2", - "raf": "^3.4.1" - } - }, - "react-transition-group": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz", - "integrity": "sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==", - "requires": { - "@babel/runtime": "^7.5.5", - "dom-helpers": "^5.0.1", - "loose-envify": "^1.4.0", - "prop-types": "^15.6.2" - } - }, - "reactcss": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/reactcss/-/reactcss-1.2.3.tgz", - "integrity": "sha512-KiwVUcFu1RErkI97ywr8nvx8dNOpT03rbnma0SSalTYjkrPYaEajR4a/MRt6DZ46K6arDRbWMNHF+xH7G7n/8A==", - "requires": { - "lodash": "^4.0.1" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "readdirp": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", - "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "requires": { - "picomatch": "^2.2.1" - } - }, - "regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" - }, - "relative-time-format": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/relative-time-format/-/relative-time-format-1.0.6.tgz", - "integrity": "sha512-voemOJLxlKun4P1fAo4PEg2WXNGjhqfE/G8Xen4gcy24Hyu/djn5bT5axmhx4MnjynoZ8f0HCOjk3RZpsY6X/g==" - }, - "remark-parse": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-10.0.0.tgz", - "integrity": "sha512-07ei47p2Xl7Bqbn9H2VYQYirnAFJPwdMuypdozWsSbnmrkgA2e2sZLZdnDNrrsxR4onmIzH/J6KXqKxCuqHtPQ==", - "requires": { - "@types/mdast": "^3.0.0", - "mdast-util-from-markdown": "^1.0.0", - "unified": "^10.0.0" - } - }, - "remark-rehype": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-9.1.0.tgz", - "integrity": "sha512-oLa6YmgAYg19zb0ZrBACh40hpBLteYROaPLhBXzLgjqyHQrN+gVP9N/FJvfzuNNuzCutktkroXEZBrxAxKhh7Q==", - "requires": { - "@types/hast": "^2.0.0", - "@types/mdast": "^3.0.0", - "mdast-util-to-hast": "^11.0.0", - "unified": "^10.0.0" - } - }, - "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - } - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "scheduler": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", - "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shell-quote": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz", - "integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==" - }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "source-map": { - "version": "0.8.0-beta.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz", - "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", - "requires": { - "whatwg-url": "^7.0.0" - } - }, - "space-separated-tokens": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.1.tgz", - "integrity": "sha512-ekwEbFp5aqSPKaqeY1PGrlGQxPNaq+Cnx4+bE2D8sciBQrHpbwoBbawqTN2+6jPs9IdWxxiUcN0K2pkczD3zmw==" - }, - "stacktrace-parser": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz", - "integrity": "sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg==", - "requires": { - "type-fest": "^0.7.1" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "stream-browserify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", - "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", - "requires": { - "inherits": "~2.0.4", - "readable-stream": "^3.5.0" - } - }, - "stream-http": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.1.1.tgz", - "integrity": "sha512-S7OqaYu0EkFpgeGFb/NPOoPLxFko7TPqtEeFg5DXPB4v/KETHG0Ln6fRFrNezoelpaDKmycEmmZ81cC9DAwgYg==", - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "xtend": "^4.0.2" - } - }, - "stream-parser": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/stream-parser/-/stream-parser-0.3.1.tgz", - "integrity": "sha1-FhhUhpRCACGhGC/wrxkRwSl2F3M=", - "requires": { - "debug": "2" - } - }, - "strftime": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/strftime/-/strftime-0.10.0.tgz", - "integrity": "sha1-s/D6QZKVICpaKJ9ta+n0kJphcZM=" - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "string-hash": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz", - "integrity": "sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=" - }, - "string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "stringifier": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/stringifier/-/stringifier-1.4.0.tgz", - "integrity": "sha512-cNsMOqqrcbLcHTXEVmkw9y0fwDwkdgtZwlfyolzpQDoAE1xdNGhQhxBUfiDvvZIKl1hnUEgMv66nHwtMz3OjPw==", - "requires": { - "core-js": "^2.0.0", - "traverse": "^0.6.6", - "type-name": "^2.0.1" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "style-to-object": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.3.0.tgz", - "integrity": "sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==", - "requires": { - "inline-style-parser": "0.1.1" - } - }, - "styled-jsx": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-4.0.1.tgz", - "integrity": "sha512-Gcb49/dRB1k8B4hdK8vhW27Rlb2zujCk1fISrizCcToIs+55B4vmUM0N9Gi4nnVfFZWe55jRdWpAqH1ldAKWvQ==", - "requires": { - "@babel/plugin-syntax-jsx": "7.14.5", - "@babel/types": "7.15.0", - "convert-source-map": "1.7.0", - "loader-utils": "1.2.3", - "source-map": "0.7.3", - "string-hash": "1.1.3", - "stylis": "3.5.4", - "stylis-rule-sheet": "0.0.10" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==" - } - } - }, - "stylis": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-3.5.4.tgz", - "integrity": "sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q==" - }, - "stylis-rule-sheet": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz", - "integrity": "sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw==", - "requires": {} - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, - "timers-browserify": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", - "integrity": "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==", - "requires": { - "setimmediate": "^1.0.4" - } - }, - "tiny-warning": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", - "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" - }, - "tinycolor2": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz", - "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==" - }, - "to-arraybuffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", - "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=" - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "requires": { - "is-number": "^7.0.0" - } - }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" - }, - "tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", - "requires": { - "punycode": "^2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" - } - } - }, - "traverse": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", - "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=" - }, - "trough": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/trough/-/trough-2.0.2.tgz", - "integrity": "sha512-FnHq5sTMxC0sk957wHDzRnemFnNBvt/gSY99HzK8F7UP5WAbvP70yX5bd7CjEQkN+TjdxwI7g7lJ6podqrG2/w==" - }, - "ts-pnp": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", - "integrity": "sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==" - }, - "tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==" - }, - "type-fest": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", - "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==" - }, - "type-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/type-name/-/type-name-2.0.2.tgz", - "integrity": "sha1-7+fUEj2KxSr/9/QMfk3sUmYAj7Q=" - }, - "typescript": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.3.tgz", - "integrity": "sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==", - "dev": true - }, - "unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", - "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" - } - }, - "unified": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.0.tgz", - "integrity": "sha512-4U3ru/BRXYYhKbwXV6lU6bufLikoAavTwev89H5UxY8enDFaAT2VXmIXYNm6hb5oHPng/EXr77PVyDFcptbk5g==", - "requires": { - "@types/unist": "^2.0.0", - "bail": "^2.0.0", - "extend": "^3.0.0", - "is-buffer": "^2.0.0", - "is-plain-obj": "^4.0.0", - "trough": "^2.0.0", - "vfile": "^5.0.0" - } - }, - "unist-builder": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-builder/-/unist-builder-3.0.0.tgz", - "integrity": "sha512-GFxmfEAa0vi9i5sd0R2kcrI9ks0r82NasRq5QHh2ysGngrc6GiqD5CDf1FjPenY4vApmFASBIIlk/jj5J5YbmQ==", - "requires": { - "@types/unist": "^2.0.0" - } - }, - "unist-util-generated": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-2.0.0.tgz", - "integrity": "sha512-TiWE6DVtVe7Ye2QxOVW9kqybs6cZexNwTwSMVgkfjEReqy/xwGpAXb99OxktoWwmL+Z+Epb0Dn8/GNDYP1wnUw==" - }, - "unist-util-is": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-5.1.1.tgz", - "integrity": "sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ==" - }, - "unist-util-position": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.1.tgz", - "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" - }, - "unist-util-stringify-position": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.0.tgz", - "integrity": "sha512-SdfAl8fsDclywZpfMDTVDxA2V7LjtRDTOFd44wUJamgl6OlVngsqWjxvermMYf60elWHbxhuRCZml7AnuXCaSA==", - "requires": { - "@types/unist": "^2.0.0" - } - }, - "unist-util-visit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-4.1.0.tgz", - "integrity": "sha512-n7lyhFKJfVZ9MnKtqbsqkQEk5P1KShj0+//V7mAcoI6bpbUjh3C/OG8HVD+pBihfh6Ovl01m8dkcv9HNqYajmQ==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^5.0.0" - } - }, - "unist-util-visit-parents": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.0.tgz", - "integrity": "sha512-y+QVLcY5eR/YVpqDsLf/xh9R3Q2Y4HxkZTp7ViLDU6WtJCEcPmRzW1gpdWDCDIqIlhuPDXOgttqPlykrHYDekg==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } - }, - "universal-deep-strict-equal": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/universal-deep-strict-equal/-/universal-deep-strict-equal-1.2.2.tgz", - "integrity": "sha1-DaSsL3PP95JMgfpN4BjKViyisKc=", - "requires": { - "array-filter": "^1.0.0", - "indexof": "0.0.1", - "object-keys": "^1.0.0" - } - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" - } - } - }, - "use-subscription": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/use-subscription/-/use-subscription-1.5.1.tgz", - "integrity": "sha512-Xv2a1P/yReAjAbhylMfFplFKj9GssgTwN7RlcTxBujFQcloStWNDQdc4g4NRWH9xS4i/FDk04vQBptAXoF3VcA==", - "requires": { - "object-assign": "^4.1.1" - } - }, - "util": { - "version": "0.12.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", - "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", - "requires": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", - "which-typed-array": "^1.1.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "vfile": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.1.0.tgz", - "integrity": "sha512-4o7/DJjEaFPYSh0ckv5kcYkJTHQgCKdL8ozMM1jLAxO9ox95IzveDPXCZp08HamdWq8JXTkClDvfAKaeLQeKtg==", - "requires": { - "@types/unist": "^2.0.0", - "is-buffer": "^2.0.0", - "unist-util-stringify-position": "^3.0.0", - "vfile-message": "^3.0.0" - } - }, - "vfile-message": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.0.2.tgz", - "integrity": "sha512-UUjZYIOg9lDRwwiBAuezLIsu9KlXntdxwG+nXnjuQAHvBpcX3x0eN8h+I7TkY5nkCXj+cWVp4ZqebtGBvok8ww==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-stringify-position": "^3.0.0" - } - }, - "vm-browserify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", - "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==" - }, - "watchpack": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.1.1.tgz", - "integrity": "sha512-Oo7LXCmc1eE1AjyuSBmtC3+Wy4HcV8PxWh2kP6fOl8yTlNS7r0K9l1ao2lrrUza7V39Y3D/BbJgY8VeSlc5JKw==", - "requires": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - } - }, - "webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" - }, - "whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - } - }, - "which-typed-array": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", - "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.7" - } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - }, - "yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==" - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" - } - } -} diff --git a/assets/package.json b/assets/package.json deleted file mode 100644 index 45bb5c0..0000000 --- a/assets/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "assets", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "dev": "next dev", - "build": "next build", - "export": "next build && next export", - "start": "next start", - "lint": "next lint" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "@emotion/react": "^11.4.1", - "@emotion/styled": "^11.3.0", - "@mui/icons-material": "^5.0.0", - "@mui/material": "^5.0.0", - "@mui/styles": "^5.0.0", - "javascript-time-ago": "^2.3.10", - "next": "^11.1.2", - "react": "^17.0.2", - "react-color": "^2.19.3", - "react-dom": "^17.0.2", - "react-markdown": "^7.0.1", - "react-time-ago": "^7.1.4", - "strftime": "^0.10.0" - }, - "devDependencies": { - "@types/react": "^17.0.22", - "typescript": "^4.4.3" - } -} diff --git a/assets/pages/config/index.tsx b/assets/pages/config/index.tsx deleted file mode 100644 index a97dba0..0000000 --- a/assets/pages/config/index.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import React from "react"; -import Config from "@/src/pages/config"; - -export default function Page() { - return ; -} diff --git a/assets/pages/index.tsx b/assets/pages/index.tsx deleted file mode 100644 index 74e5fd1..0000000 --- a/assets/pages/index.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { Index } from "@/src/pages/index"; - -export default function Page() { - return ; -} diff --git a/assets/pages/login.tsx b/assets/pages/login.tsx deleted file mode 100644 index 0ce1df5..0000000 --- a/assets/pages/login.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { Login } from "@/src/pages/login"; - -export default function Page() { - return ; -} diff --git a/assets/pages/repository/[owner]/[repo].tsx b/assets/pages/repository/[owner]/[repo].tsx deleted file mode 100644 index 2f4ac5f..0000000 --- a/assets/pages/repository/[owner]/[repo].tsx +++ /dev/null @@ -1,13 +0,0 @@ -import Repository from "@/src/pages/repository"; -import { useRouter } from "next/router"; - -export default function Page() { - const router = useRouter(); - - return ( - - ); -} diff --git a/assets/pages/scan/[id].tsx b/assets/pages/scan/[id].tsx deleted file mode 100644 index c58a9a6..0000000 --- a/assets/pages/scan/[id].tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from "react"; - -import { Page } from "@/src/pages/scan"; - -export default function Index() { - return ; -} diff --git a/assets/pages/vulnerability/[id].tsx b/assets/pages/vulnerability/[id].tsx deleted file mode 100644 index 3f90342..0000000 --- a/assets/pages/vulnerability/[id].tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { useRouter } from "next/router"; -import { Vulnerability } from "@/src/pages/vulnerability"; - -export default function Page() { - const router = useRouter(); - - return ; -} diff --git a/assets/pages/vulnerability/index.tsx b/assets/pages/vulnerability/index.tsx deleted file mode 100644 index feb5582..0000000 --- a/assets/pages/vulnerability/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Vulnerabilities } from "@/src/pages/vulnerability"; -import { useRouter } from "next/router"; - -export default function Page() { - const router = useRouter(); - - return ( - - ); -} diff --git a/assets/src/components/app.tsx b/assets/src/components/app.tsx deleted file mode 100644 index 309cd38..0000000 --- a/assets/src/components/app.tsx +++ /dev/null @@ -1,174 +0,0 @@ -import * as React from "react"; - -import Typography from "@mui/material/Typography"; -import Box from "@mui/material/Box"; -import AppBar from "@mui/material/AppBar"; -import Toolbar from "@mui/material/Toolbar"; -import Container from "@mui/material/Container"; -import Paper from "@mui/material/Paper"; - -import Avatar from "@mui/material/Avatar"; -import LoginIcon from "@mui/icons-material/Login"; -import IconButton from "@mui/material/IconButton"; -import MenuItem from "@mui/material/MenuItem"; -import Menu from "@mui/material/Menu"; -import WarningIcon from "@mui/icons-material/Warning"; -import SettingsIcon from "@mui/icons-material/Settings"; - -import { ThemeProvider } from "@mui/material/styles"; - -import Link from "next/link"; - -import theme from "./theme"; -import Head from "./head"; -import * as model from "./model"; -import { useRouter } from "next/router"; - -type mainProp = { - children?: React.ReactNode; -}; - -export function Main(props: mainProp) { - const [user, setUser] = React.useState(); - const [anchorEl, setAnchorEl] = React.useState(null); - const router = useRouter(); - - const getUser = () => { - fetch(`/api/v1/user`).then((res) => { - if (res.status === 401 && router.pathname !== "/login") { - router.push(`/login?callback=${router.pathname}`); - return; - } - - console.log("status", res.status); - - res.json().then( - (resp) => { - console.log("get user resp:", { resp }); - setUser(resp.data); - }, - (err) => { - console.log("ignore error:", { err }); - } - ); - }); - }; - - React.useEffect(getUser, []); - - const renderAvatar = () => { - return user ? ( - { - setAnchorEl(e.currentTarget); - }}> - - - ) : ( - - - - - - ); - }; - - const menuId = "user-menu-id"; - - const handleLogout = () => { - window.location.href = "/auth/logout"; - handleMenuClose(); - }; - const handleMenuClose = () => { - setAnchorEl(null); - }; - const renderUserMenu = ( - - Logout - - ); - - return ( -
- - -
- - - - - - Octovy - - - - - - - - - - - - - - - - - - - - {renderAvatar()} - - - -
- - - {props.children} - - -
-
-
-
- {renderUserMenu} -
- ); -} diff --git a/assets/src/components/cvss.tsx b/assets/src/components/cvss.tsx deleted file mode 100644 index 92328f9..0000000 --- a/assets/src/components/cvss.tsx +++ /dev/null @@ -1,137 +0,0 @@ -export class V3 { - src: string; - params: { [key: string]: string }; - constructor(s: string) { - const parts = s.split("/"); - console.log("cvss:", parts); - this.params = {}; - parts.forEach((p) => { - const v = p.split(":"); - this.params[v[0]] = v[1]; - }); - } - - AccessVector() { - const value = this.params["AV"]; - return value - ? { - N: "Network", - A: "Adjacent", - L: "Local", - P: "Physical", - }[value] - : "N/A"; - } - - AttackComplexity() { - const value = this.params["AC"]; - return value - ? { - L: "Low", - H: "High", - }[value] - : "N/A"; - } - - PrivilegesRequired() { - const value = this.params["PR"]; - return value - ? { - N: "None", - L: "Low", - H: "High", - }[value] - : "N/A"; - } - - UserInteraction() { - const value = this.params["UI"]; - return value - ? { - N: "None", - R: "Required", - }[value] - : "N/A"; - } - - Scope() { - const value = this.params["S"]; - return value - ? { - U: "Unchanged", - C: "Changed", - }[value] - : "N/A"; - } - - Confidentiality() { - const value = this.params["C"]; - return value - ? { - N: "None", - L: "Low", - H: "High", - }[value] - : "N/A"; - } - - Integrity() { - const value = this.params["C"]; - return value - ? { - N: "None", - L: "Low", - H: "High", - }[value] - : "N/A"; - } - - Availability() { - const value = this.params["C"]; - return value - ? { - N: "None", - L: "Low", - H: "High", - }[value] - : "N/A"; - } - - ExploitCodeMaturity() { - const value = this.params["E"]; - return value - ? { - X: "Not Defined", - H: "High", - F: "Functional", - P: "Proof-of-Concept", - U: "Unproven", - }[value] - : "N/A"; - } - - RemediationLevel() { - const value = this.params["RL"]; - return value - ? { - X: "Not Defined", - U: "Unavailable", - W: "Workaround", - T: "Temporary Fix", - O: "Official Fix", - }[value] - : "N/A"; - } - - ReportConfidence() { - const value = this.params["RC"]; - return value - ? { - X: "Not Defined", - C: "Confirmed", - R: "Reasonable", - U: "Unknown", - }[value] - : "N/A"; - } -} diff --git a/assets/src/components/head.tsx b/assets/src/components/head.tsx deleted file mode 100644 index 99755a1..0000000 --- a/assets/src/components/head.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import Head from "next/head"; - -export default function CommonHead({ title = "Octovy" }) { - const description = "GitHub repository scanner"; - const bodyStyle = `body{margin: 0}`; - return ( - - {title} - - - - - - - ); -} diff --git a/assets/src/components/model.tsx b/assets/src/components/model.tsx deleted file mode 100644 index 97c7915..0000000 --- a/assets/src/components/model.tsx +++ /dev/null @@ -1,163 +0,0 @@ -export interface scan { - id: string; - branch: string; - commit_id: string; - requested_at: number; - scanned_at: number; - check_id: string; - pull_request_target: string; - - edges: { - packages: packageRecord[]; - repository: repository[]; - }; -} - -export type repository = { - id: number; - owner: string; - name: string; - url: string; - default_branch: string; - edges: { - latest: scan; - scan: scan[]; - main: scan[]; - status: vulnStatusIndex[]; - labels: repoLabel[]; - }; -}; - -export type packageRecord = { - type: string; - source: string; - name: string; - version: string; - vuln_ids: string[]; - edges: { - vulnerabilities: vulnerability[]; - }; -}; - -export type vulnStatusType = - | "none" - | "snoozed" - | "mitigated" - | "unaffected" - | "fixed"; - -type vulnStatusIndex = { - edges: { - latest?: vulnStatus; - status: vulnStatus[]; - }; -}; - -export type vulnStatus = { - comment: string; - created_at: number; - expires_at: number; - pkg_name: string; - pkg_type: string; - source: string; - status: vulnStatusType; - vuln_id: string; - edges: { - author: user; - }; -}; - -export type vulnerability = { - id: string; - first_seen_at: number; - last_modified_at: number; - title: string; - description: string; - cwe_id: string[]; - severity: string; - cvss: string[]; - references: string[]; - edges: { - custom_severity?: severity; - }; -}; - -export interface user { - id: string; - login: string; - name: string; - avatar_url: string; - url: string; -} - -export type vulnStatusAttrs = { - comment: string; - expires_at: number; - created_at: number; - status: vulnStatusType; - author_name: string; - author_url: string; - author_avatar: string; -}; - -// TODO: Migrate vulnStatusDB to backend pkg/domain/model -export class vulnStatusDB { - readonly vulnMap: { [key: string]: vulnStatusAttrs }; - static toKey(src: string, pkgName: string, vulnID: string): string { - return `${src}|${pkgName}|${vulnID}`; - } - constructor(statusIndex: vulnStatusIndex[]) { - this.vulnMap = {}; - (statusIndex || []).forEach((idx) => { - if (!idx.edges.latest) { - return; - } - - const status = idx.edges.latest; - const key = vulnStatusDB.toKey( - status.source, - status.pkg_name, - status.vuln_id - ); - const attrs: vulnStatusAttrs = { - comment: status.comment, - expires_at: status.expires_at, - created_at: status.created_at, - status: status.status, - author_name: status.edges.author.login, - author_url: status.edges.author.url, - author_avatar: status.edges.author.avatar_url, - }; - console.log("insert", { key }, { attrs }); - this.vulnMap[key] = attrs; - }); - } - - get(pkg: packageRecord, vulnID: string): vulnStatusAttrs { - const key = vulnStatusDB.toKey(pkg.source, pkg.name, vulnID); - return ( - this.vulnMap[key] || { - comment: "", - expires_at: 0, - created_at: 0, - status: "none", - author_name: "", - author_url: "", - author_avatar: "", - } - ); - } -} - -export type severity = { - id: number; - label: string; - color: string; -}; - -export type repoLabel = { - id: number; - name: string; - description: string; - color: string; -}; diff --git a/assets/src/components/theme.tsx b/assets/src/components/theme.tsx deleted file mode 100644 index 3095a4b..0000000 --- a/assets/src/components/theme.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { createTheme } from "@mui/material/styles"; - -import { pink } from "@mui/material/colors"; - -const theme = createTheme({ - palette: { - primary: { - light: "#757ce8", - main: "#3f50b5", - dark: "#002884", - contrastText: "#fff", - }, - secondary: { - light: pink[100], - main: pink[500], - dark: pink[800], - contrastText: "#fff", - }, - }, - typography: { - fontFamily: "Helvetica", - - h1: { - fontFamily: "Kanit", - fontWeight: "bold", - fontSize: 48, - letterSpacing: 0.5, - }, - h4: { - fontFamily: "Kanit", - fontWeight: "bold", - fontSize: 32, - letterSpacing: 0.1, - }, - h5: { - fontFamily: "Kanit", - fontWeight: "bold", - fontSize: 24, - letterSpacing: 0.1, - }, - h6: { - fontFamily: "Kanit", - fontWeight: "bold", - fontSize: 16, - letterSpacing: 0.1, - }, - }, - shape: { - borderRadius: 8, - }, - mixins: { - toolbar: { - minHeight: 48, - }, - }, -}); - -export default theme; diff --git a/assets/src/components/ui.tsx b/assets/src/components/ui.tsx deleted file mode 100644 index c6e30ba..0000000 --- a/assets/src/components/ui.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import Chip from "@mui/material/Chip"; -import * as model from "@/src/components/model"; - -import ReportProblemIcon from "@mui/icons-material/ReportProblem"; -import AccessAlarmIcon from "@mui/icons-material/AccessAlarm"; -import BuildIcon from "@mui/icons-material/Build"; -import BeenhereIcon from "@mui/icons-material/Beenhere"; -import Tooltip from "@mui/material/Tooltip"; - -import { makeStyles } from "@mui/styles"; - -const useStyles = makeStyles((theme) => ({ - vulnStatusIcon: { - marginTop: 4, - marginRight: 1, - marginLeft: 0, - marginBottom: 0, - }, -})); - -function labelColor(hex: string) { - var r = parseInt(hex.substr(1, 2), 16); - var g = parseInt(hex.substr(3, 2), 16); - var b = parseInt(hex.substr(5, 2), 16); - - return (r * 299 + g * 587 + b * 114) / 1000 < 128 ? "white" : "black"; -} - -export function RepoLabel(props: { - label: model.repoLabel; - size?: "small" | "medium"; -}) { - return ( - - ); -} - -export function StatusIcon(props: { - status: model.vulnStatusType; - expiresAt?: number; -}) { - const classes = useStyles(); - switch (props.status) { - case "none": - return ; - case "mitigated": - return ; - case "unaffected": - return ; - case "snoozed": - const now = new Date(); - if (props.expiresAt) { - const diff = props.expiresAt - now.getTime() / 1000; - const expiresIn = - diff > 86400 - ? Math.floor(diff / 86000) + " days left" - : Math.floor(diff / 3600) + " hours left"; - - return ( - - - - ); - } else { - return ; - } - } - return; -} diff --git a/assets/src/pages/config/index.tsx b/assets/src/pages/config/index.tsx deleted file mode 100644 index 898497a..0000000 --- a/assets/src/pages/config/index.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React from "react"; -import Grid from "@mui/material/Grid"; -import Container from "@mui/material/Container"; -import Typography from "@mui/material/Typography"; - -import * as app from "../../components/app"; -import Severities from "./severity"; -import RepoLabels from "./repoLabel"; - -export default function Config() { - return ( - - - - - Config - - - - - - Custom Severity - - - - - - - - Repository Label - - - - - - - ); -} diff --git a/assets/src/pages/config/repoLabel.tsx b/assets/src/pages/config/repoLabel.tsx deleted file mode 100644 index 888da49..0000000 --- a/assets/src/pages/config/repoLabel.tsx +++ /dev/null @@ -1,339 +0,0 @@ -import React from "react"; -import { Grid, Alert, Typography } from "@mui/material"; - -import { - Dialog, - DialogActions, - DialogContent, - DialogContentText, - DialogTitle, -} from "@mui/material"; - -import { - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableRow, -} from "@mui/material"; - -import { TwitterPicker } from "react-color"; - -import Button from "@mui/material/Button"; -import TextField from "@mui/material/TextField"; - -import * as model from "@/src/components/model"; -import * as ui from "@/src/components/ui"; - -export default function RepoLabels() { - type status = { - isLoaded: boolean; - resp?: model.repoLabel[]; - err?: any; - }; - const [status, setStatus] = React.useState({ - isLoaded: false, - }); - const [displayDialog, setDisplayDialog] = React.useState(false); - - const getList = () => { - fetch(`/api/v1/repo-label`) - .then((res) => res.json()) - .then( - (result) => { - console.log("labels:", { result }); - setStatus({ isLoaded: true, err: result.error, resp: result.data }); - }, - (error) => { - console.log("error:", { error }); - setStatus({ - isLoaded: true, - err: error, - }); - } - ); - }; - - const close = (refresh: boolean) => { - setDisplayDialog(false); - if (refresh) { - getList(); - } - }; - - React.useEffect(getList, []); - - const NewButton = () => { - return ( - - ); - }; - - if (!status.isLoaded) { - return Loading...; - } else if (status.err) { - return {status.err}; - } else if (!status.resp || status.resp.length === 0) { - return ( - <> - No label - - - - ); - } - - return ( - <> - - - - {status.resp.map((label) => { - return ( - { - getList(); - }} - /> - ); - })} - -
-
- - - - ); -} - -function RepoLabel(props: { label: model.repoLabel; refresh: () => void }) { - const [displayEditDialog, setDisplayEditDialog] = - React.useState(false); - const closeEditDialog = (refresh: boolean) => { - setDisplayEditDialog(false); - if (refresh) { - props.refresh(); - } - }; - - const [displayDeleteDialog, setDisplayDeleteDialog] = - React.useState(false); - const closeDeleteDialog = (refresh: boolean) => { - setDisplayDeleteDialog(false); - if (refresh) { - props.refresh(); - } - }; - - return ( - - - - - - - - {props.label.description} - - - - - - - - ); -} - -function EditDialog(props: { - repoLabel?: model.repoLabel; - display: boolean; - close: (refresh: boolean) => void; -}) { - type status = { err?: any }; - const [status, setStatus] = React.useState({}); - - const [name, setName] = React.useState( - props.repoLabel ? props.repoLabel.name : "" - ); - const [description, setDescription] = React.useState( - props.repoLabel ? props.repoLabel.description : "" - ); - const [color, setColor] = React.useState({ - hex: props.repoLabel ? props.repoLabel.color : "", - }); - - const sendRequest = () => { - const body = JSON.stringify({ - name: name, - description: description, - color: color.hex, - } as model.repoLabel); - const baseURL = `/api/v1/repo-label`; - - const method = props.repoLabel ? "PUT" : "POST"; - const url = props.repoLabel ? `${baseURL}/${props.repoLabel.id}` : baseURL; - console.log({ body }); - fetch(url, { method, body }) - .then((res) => res.json()) - .then( - (result) => { - console.log({ result }); - setName(""); - setDescription(""); - props.close(true); - }, - (error) => { - console.log("error:", { error }); - setStatus({ err: error }); - } - ); - }; - - return ( - { - props.close(false); - }} - aria-labelledby="alert-dialog-title" - aria-describedby="alert-dialog-description"> - {status.err ? {status.err} : <>} - Edit repository label - - { - setName(e.target.value); - }} - /> - - - { - setDescription(e.target.value); - }} - /> - - - { - console.log({ c }); - setColor(c); - }} - /> - - - - - - - ); -} - -function DeleteDialog(props: { - repoLabel: model.repoLabel; - display: boolean; - close: (refresh: boolean) => void; -}) { - type status = { err?: any }; - const [status, setStatus] = React.useState({}); - - const sendRequest = () => { - fetch(`/api/v1/repo-label/${props.repoLabel.id}`, { method: "DELETE" }) - .then((res) => res.json()) - .then( - (result) => { - console.log({ result }); - props.close(true); - }, - (error) => { - console.log("error:", { error }); - setStatus({ err: error }); - } - ); - }; - - const closeDialog = () => { - props.close(false); - }; - - return ( - { - props.close(false); - }} - aria-labelledby="alert-dialog-title" - aria-describedby="alert-dialog-description"> - {status.err ? {status.err} : <>} - - {`Are you sure to delete "${props.repoLabel.name}" ?`} - - - - {`All repository label of "${props.repoLabel.name}" will be deleted.`} - - - - - - - - ); -} diff --git a/assets/src/pages/config/severity.tsx b/assets/src/pages/config/severity.tsx deleted file mode 100644 index ad88d47..0000000 --- a/assets/src/pages/config/severity.tsx +++ /dev/null @@ -1,298 +0,0 @@ -import React from "react"; -import Grid from "@mui/material/Grid"; -import Alert from "@mui/material/Alert"; - -import List from "@mui/material/List"; -import ListItem from "@mui/material/ListItem"; -import ListItemIcon from "@mui/material/ListItemIcon"; -import ListItemText from "@mui/material/ListItemText"; -import IconButton from "@mui/material/IconButton"; -import ErrorIcon from "@mui/icons-material/Error"; -import EditIcon from "@mui/icons-material/Edit"; -import SaveAltIcon from "@mui/icons-material/SaveAlt"; -import DeleteIcon from "@mui/icons-material/Delete"; - -import Divider from "@mui/material/Divider"; - -import Dialog from "@mui/material/Dialog"; -import DialogActions from "@mui/material/DialogActions"; -import DialogContent from "@mui/material/DialogContent"; -import DialogContentText from "@mui/material/DialogContentText"; -import DialogTitle from "@mui/material/DialogTitle"; - -import Stack from "@mui/material/Stack"; -import TextField from "@mui/material/TextField"; -import Button from "@mui/material/Button"; - -import * as model from "../../components/model"; - -type severityState = { - msg?: string; - isError?: boolean; -}; - -function Severity(props: { - sev: model.severity; - refresh: React.Dispatch>; -}) { - const [label, setLabel] = React.useState(props.sev.label); - const [color, setColor] = React.useState(props.sev.color); - const [onEdit, setOnEdit] = React.useState(false); - const [showDelete, setShowDelete] = React.useState(false); - - React.useEffect(() => { - document.addEventListener( - "keydown", - (e) => { - if (e.keyCode === 27) { - setLabel(props.sev.label); - setOnEdit(false); - } - }, - false - ); - }, []); - - const update = () => { - const body = JSON.stringify({ Label: label, Color: color }); - fetch(`/api/v1/severity/${props.sev.id}`, { method: "PUT", body }) - .then((res) => res.json()) - .then( - (result) => { - setOnEdit(false); - props.refresh({ msg: "updated" }); - }, - (error) => { - console.log("error:", { error }); - setOnEdit(false); - props.refresh({ msg: error, isError: true }); - } - ); - }; - - const deleteSev = () => { - fetch(`/api/v1/severity/${props.sev.id}`, { method: "DELETE" }) - .then((res) => res.json()) - .then( - (result) => { - closeDialog(); - props.refresh({ msg: `Severity "${label}" deleted` }); - }, - (error) => { - console.log("error:", { error }); - closeDialog(); - props.refresh({ msg: error, isError: true }); - } - ); - }; - - if (onEdit) { - return ( - - - - }> - - - - - - { - setColor(e.target.value); - }} - size="small"> - { - setLabel(e.target.value); - }} - size="small"> - - - ); - } - - const closeDialog = () => { - setShowDelete(false); - }; - - return ( - <> - - - {`Are you sure to delete "${label}" ?`} - - - - {`All vulnerability statuses of "${label}" will be deleted.`} - - - - - - - - - - { - setOnEdit(true); - }}> - - - { - setShowDelete(true); - }}> - - - - }> - - - - - - - - - ); -} - -export default function Severities() { - type status = { - isLoaded: boolean; - resp?: model.severity[]; - err?: any; - }; - - const [status, setStatus] = React.useState({ - isLoaded: false, - }); - const [sevState, setSevState] = React.useState({}); - const [label, setLabel] = React.useState(""); - - const getList = () => { - fetch(`/api/v1/severity`) - .then((res) => res.json()) - .then( - (result) => { - console.log("result:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - setStatus({ - isLoaded: true, - resp: result.data, - }); - } - }, - (error) => { - console.log("error:", { error }); - setStatus({ - isLoaded: true, - err: error, - }); - } - ); - }; - - const create = () => { - const body = JSON.stringify({ Label: label }); - fetch(`/api/v1/severity`, { method: "POST", body }) - .then((res) => res.json()) - .then( - (result) => { - console.log("result:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - setLabel(""); - getList(); - } - }, - (error) => { - console.log("error:", { error }); - setStatus({ - isLoaded: true, - err: error, - }); - } - ); - }; - - React.useEffect(getList, [sevState]); - - if (!status.isLoaded) { - return Loading...; - } else if (status.err) { - return {status.err}; - } - - const renderSevStateMsg = () => { - if (!sevState.msg) { - return ""; - } - - return ( - - {sevState.msg} - - ); - }; - - return ( - <> - {renderSevStateMsg()} - - - {status.resp.map((sev, idx) => { - return ( - - ); - })} - - - - - { - setLabel(e.target.value); - }} - /> - - - - - ); -} diff --git a/assets/src/pages/index/index.tsx b/assets/src/pages/index/index.tsx deleted file mode 100644 index 45c92a9..0000000 --- a/assets/src/pages/index/index.tsx +++ /dev/null @@ -1,181 +0,0 @@ -import * as React from "react"; -import * as app from "@/src/components/app"; -import * as model from "@/src/components/model"; -import * as ui from "@/src/components/ui"; - -import Alert from "@mui/material/Alert"; -import Grid from "@mui/material/Grid"; -import Paper from "@mui/material/Paper"; -import Table from "@mui/material/Table"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableContainer from "@mui/material/TableContainer"; -import TableHead from "@mui/material/TableHead"; -import TableRow from "@mui/material/TableRow"; -import GitHubIcon from "@mui/icons-material/GitHub"; - -import Link from "next/link"; -import Stack from "@mui/material/Stack"; - -import TimeAgo from "javascript-time-ago"; -import en from "javascript-time-ago/locale/en.json"; - -import { Typography } from "@mui/material"; - -type repoStatus = { - isLoaded: boolean; - repositories?: model.repository[]; - err?: any; -}; - -export function Index() { - const [status, setStatus] = React.useState({ - isLoaded: false, - }); - - const updateRepositories = () => { - fetch(`/api/v1/repository`) - .then((res) => res.json()) - .then( - (result) => { - console.log("result:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - setStatus({ - isLoaded: true, - repositories: result.data, - }); - } - }, - (error) => { - console.log("got error:", { error }); - setStatus({ - isLoaded: true, - err: error.message, - }); - } - ); - }; - - React.useEffect(() => { - TimeAgo.addDefaultLocale(en); - updateRepositories(); - }, []); - - return ( - - - - Octovy - - - - - - - ); -} - -type bodyProps = { - status: repoStatus; -}; - -function Body(props: bodyProps) { - console.log("status=>", props.status); - if (!props.status.isLoaded) { - return Loading...; - } else if (props.status.err) { - return Error: {props.status.err}; - } - - return ( - - - - - Repository - Labels - Recent scan of default branch - - - {props.status.repositories.map(Repository)} -
-
- ); -} - -function Repository(repo: model.repository) { - return ( - - - - - - - - - - {repo.owner + "/" + repo.name} - - - - - - {repo.edges.labels ? ( - repo.edges.labels.map((label) => { - return ( - - ); - }) - ) : ( - <> - )} - - - - - - - ); -} - -function Scan(props: { repo: model.repository; scan: model.scan }) { - if (!props.scan) { - return No scan; - } - - const timeAgo = new TimeAgo("en-US"); - const scan = props.scan; - const ts = new Date(scan.scanned_at * 1000); - const vulnPkgs: model.packageRecord[] = scan.edges.packages - ? scan.edges.packages.filter((pkg) => { - return pkg.vuln_ids; - }) - : []; - return ( - - - {vulnPkgs.length > 0 - ? `⚠️ ${vulnPkgs.length} vulnerable packages` - : "✅ No vulnerabilities"} - - {" / "} - - {scan.commit_id.substr(0, 7)} - - {timeAgo.format(ts)} - - ); -} diff --git a/assets/src/pages/login/index.tsx b/assets/src/pages/login/index.tsx deleted file mode 100644 index dc3169a..0000000 --- a/assets/src/pages/login/index.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import * as React from "react"; -import * as app from "@/src/components/app"; -import Alert from "@mui/material/Alert"; -import Button from "@mui/material/Button"; -import GitHubIcon from "@mui/icons-material/GitHub"; -import Grid from "@mui/material/Grid"; - -import { useRouter } from "next/router"; - -export function Login() { - const router = useRouter(); - const { login_error } = router.query; - const callbackTo = router.query.callback; - const githubLogin = `/auth/github${ - callbackTo ? `?callback=${callbackTo}` : "" - }`; - return ( - - {login_error ? ( - - - {login_error} - - - ) : ( - "" - )} - - - - - - - - ); -} diff --git a/assets/src/pages/repository/index.tsx b/assets/src/pages/repository/index.tsx deleted file mode 100644 index 260bb69..0000000 --- a/assets/src/pages/repository/index.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import React from "react"; -import { Grid, Alert, Typography } from "@mui/material"; -import Stack from "@mui/material/Stack"; - -import * as app from "@/src/components/app"; -import * as model from "@/src/components/model"; - -import Labels from "./label"; -import Scans from "./scan"; -import VulnStatuses from "./vulnStatus"; - -export default function Repository(props: { owner: string; repo: string }) { - type repoStatus = { - isLoaded: boolean; - repository?: model.repository; - err?: any; - }; - const [status, setStatus] = React.useState({ - isLoaded: false, - }); - - const getRepo = () => { - if (props.owner === undefined || props.repo === undefined) { - return; - } - - fetch(`/api/v1/repository/${props.owner}/${props.repo}`) - .then((res) => res.json()) - .then( - (result) => { - console.log("repo:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - setStatus({ - isLoaded: true, - repository: result.data, - }); - } - }, - (error) => { - console.log("got error:", { error }); - setStatus({ - isLoaded: true, - err: error.message, - }); - } - ); - }; - React.useEffect(getRepo, [props.owner, props.repo]); - - const render = () => { - if (!status.isLoaded) { - return Loading...; - } else if (status.err) { - return {status.err}; - } - - return ( - <> - - Recent scan reports - - - - Status - - - - Labels - - - - ); - }; - - return ( - - - - - {props.owner}/{props.repo} - - - - {render()} - - ); -} diff --git a/assets/src/pages/repository/label.tsx b/assets/src/pages/repository/label.tsx deleted file mode 100644 index c5d3ae2..0000000 --- a/assets/src/pages/repository/label.tsx +++ /dev/null @@ -1,140 +0,0 @@ -import React from "react"; -import { Grid, Alert, Typography } from "@mui/material"; -import Stack from "@mui/material/Stack"; - -import List from "@mui/material/List"; -import ListItem from "@mui/material/ListItem"; -import ListItemButton from "@mui/material/ListItemButton"; -import ListItemIcon from "@mui/material/ListItemIcon"; -import ListItemText from "@mui/material/ListItemText"; -import Checkbox from "@mui/material/Checkbox"; - -import * as model from "@/src/components/model"; -import * as ui from "@/src/components/ui"; - -export default RepoLabels; - -function RepoLabels(props: { repo: model.repository }) { - type labelsStatus = { - isLoaded: boolean; - labels?: model.repoLabel[]; - err?: any; - }; - - const [status, setStatus] = React.useState({ - isLoaded: false, - }); - - const get = () => { - fetch(`/api/v1/repo-label`) - .then((res) => res.json()) - .then( - (result) => { - console.log("labels:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - setStatus({ - isLoaded: true, - labels: result.data, - }); - } - }, - (error) => { - console.log("got error:", { error }); - setStatus({ - isLoaded: true, - err: error.message, - }); - } - ); - }; - React.useEffect(get, []); - - if (!status.isLoaded) { - return Loading...; - } else if (status.err) { - return {status.err}; - } - - return ( - - {status.labels.map((label) => { - return ; - })} - - ); -} - -function RepoLabel(props: { repo: model.repository; label: model.repoLabel }) { - const initChecked = props.repo.edges.labels - ? props.repo.edges.labels.filter((label) => { - return label.id === props.label.id; - }).length > 0 - : false; - - const [status, setStatus] = React.useState<{ - done: boolean; - err?: any; - }>({ done: false }); - const [checked, setChecked] = React.useState(initChecked); - - const update = (value: boolean) => { - const method = value ? "POST" : "DELETE"; - const url = `/api/v1/repo-label/${props.label.id}/assign/${props.repo.id}`; - - fetch(url, { method }) - .then((res) => res.json()) - .then( - (result) => { - console.log({ result }); - setChecked(value); - setStatus({ done: true }); - }, - (error) => { - console.log("error:", { error }); - setStatus({ done: true, err: error }); - } - ); - }; - - return ( - {status.err} - ) : ( - Updated - ) - ) : ( - <> - ) - } - disablePadding> - { - setStatus({ done: false }); - update(!checked); - }} - dense> - - - - - - {props.label.description} - - } - /> - - - ); -} diff --git a/assets/src/pages/repository/scan.tsx b/assets/src/pages/repository/scan.tsx deleted file mode 100644 index bb0f195..0000000 --- a/assets/src/pages/repository/scan.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import React from "react"; -import { Grid, Alert, Typography } from "@mui/material"; -import Link from "next/link"; - -import PlagiarismIcon from "@mui/icons-material/Plagiarism"; -import { - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableRow, -} from "@mui/material"; - -import * as model from "@/src/components/model"; - -import ReactTimeAgo from "react-time-ago"; -import TimeAgo from "javascript-time-ago"; -import en from "javascript-time-ago/locale/en.json"; -TimeAgo.addDefaultLocale(en); - -export default Scans; - -function Scans(props: { repo: model.repository }) { - type status = { - isLoaded: boolean; - scans?: model.scan[]; - err?: any; - }; - const [status, setStatus] = React.useState({ - isLoaded: false, - }); - - const get = () => { - fetch(`/api/v1/repository/${props.repo.owner}/${props.repo.name}/scan`) - .then((res) => res.json()) - .then( - (result) => { - console.log("scans:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - setStatus({ - isLoaded: true, - scans: result.data, - }); - } - }, - (error) => { - console.log("got error:", { error }); - setStatus({ - isLoaded: true, - err: error.message, - }); - } - ); - }; - React.useEffect(get, []); - - if (!status.isLoaded) { - return Loading...; - } else if (status.err) { - return {status.err}; - } else if (!status.scans) { - return ( - - No scan results - - ); - } - - return ( - - - - - - - - Scanned at - - - Target - - - Packages - - - Vulnerables - - - - - - {status.scans.map((scan) => { - return ( - - - - - - - - - - - - - - - - - {scan.branch} - {" "} - ( - - {scan.commit_id.substr(0, 7)} - - ) - - - - - {scan.edges.packages ? scan.edges.packages.length : 0} - - - - - {scan.edges.packages - ? scan.edges.packages.filter((p) => { - return p.vuln_ids !== undefined; - }).length - : 0} - - - - ); - })} - -
-
-
- ); -} diff --git a/assets/src/pages/repository/vulnStatus.tsx b/assets/src/pages/repository/vulnStatus.tsx deleted file mode 100644 index 9c2aa0d..0000000 --- a/assets/src/pages/repository/vulnStatus.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import React from "react"; -import { Grid, Alert, Typography } from "@mui/material"; -import Link from "next/link"; -import Avatar from "@mui/material/Avatar"; -import Stack from "@mui/material/Stack"; - -import PlagiarismIcon from "@mui/icons-material/Plagiarism"; -import { - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableRow, -} from "@mui/material"; - -import * as model from "@/src/components/model"; - -import * as ui from "@/src/components/ui"; -import ReactTimeAgo from "react-time-ago"; -import TimeAgo from "javascript-time-ago"; -import en from "javascript-time-ago/locale/en.json"; -TimeAgo.addDefaultLocale(en); - -export default VulnStatuses; - -function VulnStatuses(props: { repo: model.repository }) { - const noStatus = No status; - if (!props.repo.edges.status) { - return noStatus; - } - - const statusSet = props.repo.edges.status - .map((idx) => { - return idx.edges.latest; - }) - .filter((status) => { - return status && status.status !== "none"; - }); - if (statusSet.length === 0) { - return noStatus; - } - - return ( - - - - - - - - Vulnerability - - - Status - - - Expires at - - - By - - - Comment - - - - - {statusSet.map((vulnStatus) => { - return ( - - - - - - - - {vulnStatus.vuln_id} - - - - - {vulnStatus.status} - - - {vulnStatus.expires_at ? ( - - ) : ( - <> - )} - - - - - - - {vulnStatus.edges.author.login} - - - - - - {vulnStatus.comment} - - - ); - })} - -
-
-
- ); -} diff --git a/assets/src/pages/scan/index.tsx b/assets/src/pages/scan/index.tsx deleted file mode 100644 index fd65f4d..0000000 --- a/assets/src/pages/scan/index.tsx +++ /dev/null @@ -1,204 +0,0 @@ -import React from "react"; -import { useRouter } from "next/router"; -import Link from "next/link"; - -import Grid from "@mui/material/Grid"; -import Container from "@mui/material/Container"; -import Typography from "@mui/material/Typography"; -import Alert from "@mui/material/Alert"; - -import Paper from "@mui/material/Paper"; -import Table from "@mui/material/Table"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableContainer from "@mui/material/TableContainer"; -import TableHead from "@mui/material/TableHead"; -import TableRow from "@mui/material/TableRow"; - -import * as model from "@/src/components/model"; -import * as app from "@/src/components/app"; - -import Package from "./package"; -import CopyClipboard from "./raw"; - -type scanStatus = { - isLoaded: boolean; - data?: model.scan; - db?: model.vulnStatusDB; - err?: any; -}; - -export function Page() { - const router = useRouter(); - const scanID = router.query.id; - - const [status, setStatus] = React.useState({ - isLoaded: false, - }); - - const updatePackages = () => { - if (!scanID) { - return; - } - - fetch(`/api/v1/scan/${scanID}`) - .then((res) => res.json()) - .then( - (result) => { - console.log("result:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - const scan: model.scan = result.data; - setStatus({ - isLoaded: true, - data: scan, - db: new model.vulnStatusDB(scan.edges.repository[0].edges.status), - }); - } - }, - (error) => { - console.log("error:", { error }); - setStatus({ - isLoaded: true, - err: error, - }); - } - ); - }; - - React.useEffect(updatePackages, [router.query.id]); - - if (!status.isLoaded) { - return ( - - Loading... - - ); - } else if (status.err) { - return ( - - {status.err} - - ); - } - - const scan = status.data; - const repo = scan.edges.repository[0]; - const vulnPkgMap = {}; - - if (status.data.edges.packages) { - status.data.edges.packages.forEach((pkg) => { - if (!vulnPkgMap[pkg.source]) { - vulnPkgMap[pkg.source] = new Array(); - } - if (pkg.vuln_ids !== undefined) { - vulnPkgMap[pkg.source].push(pkg); - } - }); - } - - return ( - - - - - - - - {repo.owner}/{repo.name} - - - - - - - - {status.data.commit_id.substr(0, 7)} - - - - - - {vulnPkgMap ? ( - Object.keys(vulnPkgMap).map((key) => { - const url = `${repo.url}/blob/${scan.commit_id}/${key}`; - return renderPackageSource( - repo, - key, - vulnPkgMap[key], - url, - status.db - ); - }) - ) : ( - - ✅ No vulnerable package - - )} - - - - - - - ); -} - -function renderPackageSource( - repo: model.repository, - source: string, - pkgs: model.packageRecord[], - url: string, - db: model.vulnStatusDB -) { - return ( - - - - {source} - - - - {pkgs.length > 0 ? ( - - - - - Package - Version - Vulnerability - Title - Status - Comment - - - - {pkgs.map((pkg) => { - return pkg.edges.vulnerabilities.map((vuln, idx) => { - const k = `${pkg.source}:${pkg.name}:${pkg.version}:${vuln.id}`; - return ( - - ); - }); - })} - -
-
- ) : ( - ✅ No vulnerability found - )} -
-
- ); -} diff --git a/assets/src/pages/scan/package.tsx b/assets/src/pages/scan/package.tsx deleted file mode 100644 index 9631724..0000000 --- a/assets/src/pages/scan/package.tsx +++ /dev/null @@ -1,335 +0,0 @@ -import React from "react"; -import Link from "next/link"; - -import Select from "@mui/material/Select"; -import MenuItem from "@mui/material/MenuItem"; -import TableRow from "@mui/material/TableRow"; -import TableCell from "@mui/material/TableCell"; -import Grid from "@mui/material/Grid"; - -import ReportProblemIcon from "@mui/icons-material/ReportProblem"; -import AccessAlarmIcon from "@mui/icons-material/AccessAlarm"; -import BuildIcon from "@mui/icons-material/Build"; -import BeenhereIcon from "@mui/icons-material/Beenhere"; -import Tooltip from "@mui/material/Tooltip"; -import Chip from "@mui/material/Chip"; -import Avatar from "@mui/material/Avatar"; - -import Dialog from "@mui/material/Dialog"; -import DialogTitle from "@mui/material/DialogTitle"; -import DialogActions from "@mui/material/DialogActions"; -import DialogContent from "@mui/material/DialogContent"; -import DialogContentText from "@mui/material/DialogContentText"; -import TextField from "@mui/material/TextField"; -import Button from "@mui/material/Button"; -import Slider from "@mui/material/Slider"; -import Alert from "@mui/material/Alert"; - -import { makeStyles } from "@mui/styles"; - -const useStyles = makeStyles((theme) => ({ - vulnStatusIcon: { - marginTop: 4, - marginRight: 1, - marginLeft: 0, - marginBottom: 0, - }, -})); - -import * as model from "@/src/components/model"; -import { Typography } from "@mui/material"; - -type vulnStatusRequest = { - Status: string; - Source: string; - PkgType: string; - PkgName: string; - VulnID: string; - ExpiresAt: number; - Comment: string; -}; - -type packageProps = { - idx: number; - repo: model.repository; - pkg: model.packageRecord; - vuln: model.vulnerability; - vulnDB: model.vulnStatusDB; -}; - -export default function Package(props: packageProps) { - const [inputDialog, setInputDialog] = React.useState(); - const [statusComment, setStatusComment] = React.useState(); - const [statusDuration, setStatusDuration] = React.useState(0); - const [statusError, setStatusError] = React.useState(); - const [vulnStatus, setVulnStatus] = React.useState( - props.vulnDB.get(props.pkg, props.vuln.id) - ); - - const onChangeStatus = (event) => { - const newStatus = event.target.value as model.vulnStatusType; - console.log(newStatus); - - if (newStatus === "none") { - updateVulnStatus(newStatus); - } else { - if (newStatus === "snoozed") { - setStatusDuration(7); - } - setInputDialog(newStatus); - } - }; - - const clearStatusDialog = () => { - setStatusError(undefined); - setStatusComment(undefined); - setStatusDuration(0); - setInputDialog(undefined); - }; - - const submitUpdate = () => { - console.log("comment:", statusComment); - if (!statusComment) { - setStatusError("Comment required"); - return; - } - updateVulnStatus(inputDialog as model.vulnStatusType); - }; - - const dialogMessage = { - snoozed: "Describe a reason for pending to update version", - mitigated: "Describe how did you do to mitigate risk", - unaffected: "Describe why unaffected", - }; - const renderDialog = () => ( - { - setInputDialog(undefined); - }}> - - Change status to {inputDialog} - - {statusError ? ( - setStatusError(undefined)}> - {statusError} - - ) : undefined} - - {inputDialog === "snoozed" ? ( -
- - Snooze duration: {statusDuration} days - - { - setStatusDuration(newValue); - }} - step={1} - marks - min={1} - max={30} - /> -
- ) : ( - "" - )} - - {dialogMessage[inputDialog]} - { - setStatusComment(e.target.value as string); - }} - onKeyPress={(e) => { - if (e.code === "Enter") { - submitUpdate(); - } - }} - fullWidth - /> -
- - - - -
- ); - - const updateVulnStatus = (newStatus: model.vulnStatusType) => { - const now = new Date(); - const expiresAt = - statusDuration > 0 - ? Math.floor(now.getTime() / 1000) + statusDuration * 86400 - : 0; - const req: vulnStatusRequest = { - Status: newStatus, - ExpiresAt: expiresAt, - PkgName: props.pkg.name, - PkgType: props.pkg.type, - VulnID: props.vuln.id, - Source: props.pkg.source, - Comment: statusComment, - }; - - const setErr = (errMsg) => { - if (inputDialog) { - setStatusError(errMsg); - } - }; - fetch(`/api/v1/status/${props.repo.owner}/${props.repo.name}`, { - method: "POST", - body: JSON.stringify(req), - }) - .then((res) => res.json()) - .then( - (result) => { - console.log("status:", { result }); - if (result.error) { - setErr(result.error); - } else { - const added: model.vulnStatus = result.data; - setVulnStatus({ - status: added.status, - expires_at: added.expires_at, - created_at: added.created_at, - comment: added.comment, - author_name: added.edges.author.login, - author_url: added.edges.author.url, - author_avatar: added.edges.author.avatar_url, - }); - clearStatusDialog(); - } - }, - (error) => { - console.log("error:", error); - setErr(error); - } - ); - }; - - const pkgStyle = - props.idx < props.pkg.edges.vulnerabilities.length - 1 - ? { borderBottom: "none" } - : {}; - - return ( - - {renderDialog()} - - {props.idx === 0 ? props.pkg.name : ""} - - - {props.idx === 0 ? props.pkg.version : ""} - - - - - - - {props.vuln.title} - - - - - - - - - - - {vulnStatus.author_name ? ( - - - by - - - - - - - - {vulnStatus.author_name} - - - - - ) : ( - "" - )} - - - - {vulnStatus.comment} - - - ); -} - -type StatusIconProps = { - status: model.vulnStatusAttrs; -}; - -function StatusIcon(props: StatusIconProps) { - const classes = useStyles(); - switch (props.status.status) { - case "none": - return ; - case "mitigated": - return ; - case "unaffected": - return ; - case "snoozed": - const now = new Date(); - const diff = props.status.expires_at - now.getTime() / 1000; - const expiresIn = - diff > 86400 - ? Math.floor(diff / 86000) + " days left" - : Math.floor(diff / 3600) + " hours left"; - - return ( - - - - ); - } - return; -} diff --git a/assets/src/pages/scan/raw.tsx b/assets/src/pages/scan/raw.tsx deleted file mode 100644 index 02d93c8..0000000 --- a/assets/src/pages/scan/raw.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import React from "react"; -import Button from "@mui/material/Button"; -import Alert from "@mui/material/Alert"; -import Grid from "@mui/material/Grid"; -import Fade from "@mui/material/Fade"; - -export default function RawData(props: { scanID: string }) { - const [state, setState] = React.useState<{ - err?: any; - data?: any; - isLoaded?: boolean; - }>({}); - const [copied, setCopied] = React.useState(false); - - const get = function () { - fetch(`/api/v1/scan/${props.scanID}/report`) - .then((res) => res.json()) - .then( - (result) => { - console.log("result:", { result }); - if (result.error) { - setState({ isLoaded: true, err: result.error }); - } else { - setState({ - isLoaded: true, - data: result.data, - }); - } - }, - (error) => { - console.log("error:", { error }); - setState({ - isLoaded: true, - err: error, - }); - } - ); - }; - - React.useEffect(get, []); - React.useEffect(() => { - if (!copied) { - return; - } - - const timer = setTimeout(() => { - setCopied(false); - }, 3 * 1000); - - return () => { - clearTimeout(timer); - }; - }, [copied]); - - if (!state.isLoaded) { - return Loading; - } - if (state.err) { - return {state.err}; - } - - return ( - - - - - - - Copied - - - - ); -} diff --git a/assets/src/pages/vulnerability/index.tsx b/assets/src/pages/vulnerability/index.tsx deleted file mode 100644 index d08a282..0000000 --- a/assets/src/pages/vulnerability/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export { Vulnerabilities } from "./vulnerabilities"; -export { Vulnerability } from "./vulnerability"; diff --git a/assets/src/pages/vulnerability/vulnerabilities.tsx b/assets/src/pages/vulnerability/vulnerabilities.tsx deleted file mode 100644 index 17bfd5f..0000000 --- a/assets/src/pages/vulnerability/vulnerabilities.tsx +++ /dev/null @@ -1,184 +0,0 @@ -import React from "react"; -import { useRouter } from "next/router"; -import Link from "next/link"; - -import Grid from "@mui/material/Grid"; -import Container from "@mui/material/Container"; -import Typography from "@mui/material/Typography"; -import Alert from "@mui/material/Alert"; -import Chip from "@mui/material/Chip"; -import Stack from "@mui/material/Stack"; - -import Paper from "@mui/material/Paper"; - -import strftime from "strftime"; -import ReactMarkdown from "react-markdown"; - -import * as model from "@/src/components/model"; -import * as app from "@/src/components/app"; -import { makeStyles } from "@mui/styles"; - -const queryLimitSize = 20; - -const useStyles = makeStyles((theme) => ({ - vulnTypography: { - marginTop: 8, - marginRight: 1, - marginLeft: 0, - marginBottom: 4, - fontSize: 14, - fontFamily: "Helvetica", - }, -})); - -type vulnResp = { - vulnerabilities: model.vulnerability[]; - total: number; -}; - -type pageStatus = { - isLoaded: boolean; - resp?: vulnResp; - err?: any; -}; - -function labelColor(hex: string) { - var r = parseInt(hex.substring(1, 3), 16); - var g = parseInt(hex.substring(3, 5), 16); - var b = parseInt(hex.substring(5, 7), 16); - - return (r * 299 + g * 587 + b * 114) / 1000 < 128 ? "white" : "black"; -} - -export function Vulnerabilities(props: { offset?: string; limit?: string }) { - const style = useStyles(); - - const router = useRouter(); - const [status, setStatus] = React.useState({ - isLoaded: false, - }); - - const updateVulnerabilities = () => { - const offset = props.offset || "0"; - const limit = props.limit || "20"; - console.log({ offset }, { limit }); - - fetch(`/api/v1/vulnerability?offset=${offset}&limit=${limit}`) - .then((res) => res.json()) - .then( - (result) => { - console.log("result:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - setStatus({ - isLoaded: true, - resp: result.data, - }); - } - }, - (error) => { - console.log("error:", { error }); - setStatus({ - isLoaded: true, - err: error, - }); - } - ); - }; - - React.useEffect(updateVulnerabilities, [ - router.query.offset, - router.query.limit, - ]); - - if (!status.isLoaded) { - return ( - - Loading... - - ); - } else if (status.err) { - return ( - - {status.err} - - ); - } - - const renderSeverity = (vuln: model.vulnerability) => { - if (!vuln.edges.custom_severity) { - return ""; - } - - const sev = vuln.edges.custom_severity; - return ( - - ); - }; - - const Vulnerability = (vuln: model.vulnerability) => { - return ( - - -
- - - - {vuln.id}: {vuln.title} - - - - - - First detection:{" "} - {strftime("%F %H:%M", new Date(vuln.first_seen_at * 1000))} - - {renderSeverity(vuln)} - - - {vuln.description} - - Reference: -
    - {vuln.references - ? vuln.references.map((r) => { - return ( -
  • - {r} -
  • - ); - }) - : ""} -
-
-
-
- ); - }; - - return ( - - - - - Recent Vulnerabilities - - - - - - {status.resp.vulnerabilities.map(Vulnerability)} - - - - ); -} diff --git a/assets/src/pages/vulnerability/vulnerability.tsx b/assets/src/pages/vulnerability/vulnerability.tsx deleted file mode 100644 index 5f331fe..0000000 --- a/assets/src/pages/vulnerability/vulnerability.tsx +++ /dev/null @@ -1,415 +0,0 @@ -import React from "react"; -import Link from "next/link"; - -import Grid from "@mui/material/Grid"; -import Container from "@mui/material/Container"; -import Typography from "@mui/material/Typography"; -import Alert from "@mui/material/Alert"; -import { styled } from "@mui/material/styles"; -import Paper from "@mui/material/Paper"; -import Stack from "@mui/material/Stack"; - -import Table from "@mui/material/Table"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableContainer from "@mui/material/TableContainer"; -import TableHead from "@mui/material/TableHead"; -import TableRow from "@mui/material/TableRow"; - -import strftime from "strftime"; -import ReactMarkdown from "react-markdown"; -import TimeAgo from "javascript-time-ago"; -import en from "javascript-time-ago/locale/en.json"; - -import Select from "@mui/material/Select"; -import MenuItem from "@mui/material/MenuItem"; - -import * as model from "@/src/components/model"; -import * as cvss from "@/src/components/cvss"; -import * as app from "@/src/components/app"; -import { makeStyles } from "@mui/styles"; - -TimeAgo.addDefaultLocale(en); - -const Item = styled(Paper)(({ theme }) => ({ - ...theme.typography.body2, - padding: theme.spacing(1), - textAlign: "center", - color: theme.palette.text.secondary, -})); - -const useStyles = makeStyles((theme) => ({ - vulnTypography: { - marginTop: 8, - marginRight: 1, - marginLeft: 0, - marginBottom: 4, - fontSize: 16, - fontFamily: "Helvetica", - }, -})); - -type respVuln = { - vulnerability: model.vulnerability; - affected: model.repository[]; -}; - -export function Vulnerability(props: { vulnID: string }) { - type pageStatus = { - isLoaded?: boolean; - resp?: respVuln; - err?: any; - }; - - const style = useStyles(); - const vulnID = props.vulnID; - const [status, setStatus] = React.useState({}); - - const updateVulnerabilities = () => { - if (!vulnID) { - return; - } - - fetch(`/api/v1/vulnerability/${vulnID}`) - .then((res) => res.json()) - .then( - (result) => { - console.log("result:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - setStatus({ - isLoaded: true, - resp: result.data, - }); - } - }, - (error) => { - console.log("error:", { error }); - setStatus({ - isLoaded: true, - err: error, - }); - } - ); - }; - - React.useEffect(updateVulnerabilities, [vulnID]); - - if (!status.isLoaded) { - return ( - - Loading... - - ); - } else if (status.err) { - return ( - - {status.err} - - ); - } - - const vuln = status.resp.vulnerability; - const sevID = vuln.edges.custom_severity - ? vuln.edges.custom_severity.id - : undefined; - const items: { title: string; value: string }[] = [ - { - title: "Severity", - value: vuln.severity, - }, - { - title: "First detection", - value: strftime("%F %T", new Date(vuln.first_seen_at * 1000)), - }, - { - title: "Last modified", - value: strftime("%F %T", new Date(vuln.last_modified_at * 1000)), - }, - { - title: "CWE ID", - value: vuln.cwe_id, - }, - ]; - - let v3: cvss.V3; - - if (vuln.cvss) { - vuln.cvss.forEach((s) => { - const d = s.split(","); - if (d.length !== 3 || d[1] !== "V3Vector") { - return; - } - v3 = new cvss.V3(d[2]); - }); - } - - if (v3) { - items.push({ - title: "Access Vector", - value: v3.AccessVector(), - }); - items.push({ - title: "Attack Complexity", - value: v3.AttackComplexity(), - }); - items.push({ - title: "Privileges Required", - value: v3.PrivilegesRequired(), - }); - items.push({ - title: "User Interaction", - value: v3.UserInteraction(), - }); - items.push({ - title: "Scope", - value: v3.Scope(), - }); - items.push({ - title: "Confidentiality", - value: v3.Confidentiality(), - }); - items.push({ - title: "Integrity", - value: v3.Integrity(), - }); - items.push({ - title: "Availability", - value: v3.Availability(), - }); - items.push({ - title: "Exploit Code Maturity", - value: v3.ExploitCodeMaturity(), - }); - items.push({ - title: "Remediation Level", - value: v3.RemediationLevel(), - }); - items.push({ - title: "Report Confidence", - value: v3.ReportConfidence(), - }); - } - - const repositories = (repos: model.repository[]) => { - if (!repos) { - return ✅ No affected repository; - } - - return ( - - - - - Repository - Recent scan of default branch - - - {repos.map(Repository)} -
-
- ); - }; - - return ( - - - - - - {vuln.id}: {vuln.title} - - - - - - - - {vuln.description} - - - - Severity - - - - {items.map((item, idx) => { - return ( - - - {item.title} - {item.value} - - - ); - })} - - - References - {vuln.references ? ( -
    - {vuln.references.map((url, idx) => { - return ( -
  • - {url} -
  • - ); - })} -
- ) : ( - N/A - )} -
- - Affected repositories - - {repositories(status.resp.affected)} -
-
- ); -} - -function Repository(repo: model.repository) { - return ( - - - {repo.owner + "/" + repo.name} - - - - - - ); -} - -function Scan(props: { repo: model.repository; scan: model.scan }) { - if (!props.scan) { - return No scan; - } - - const timeAgo = new TimeAgo("en-US"); - const scan = props.scan; - const ts = new Date(scan.scanned_at * 1000); - const vulnPkgs: model.packageRecord[] = scan.edges.packages - ? scan.edges.packages.filter((pkg) => { - return pkg.vuln_ids; - }) - : []; - return ( - - - {vulnPkgs.length > 0 - ? `⚠️ ${vulnPkgs.length} vulnerable packages` - : "✅ No vulnerabilities"} - - {" / "} - - {scan.commit_id.substr(0, 7)} - - {timeAgo.format(ts)} - - ); -} - -function Severity(props: { vulnID: string; sevID?: number }) { - type pageStatus = { - isLoaded?: boolean; - resp?: model.severity[]; - err?: any; - }; - type changeStatus = { - isCompleted?: boolean; - err?: any; - }; - const [status, setStatus] = React.useState({}); - const [change, setChange] = React.useState({}); - - const getSeverities = () => { - fetch(`/api/v1/severity`) - .then((res) => res.json()) - .then( - (result) => { - console.log("result:", { result }); - if (result.error) { - setStatus({ isLoaded: true, err: result.error }); - } else { - setStatus({ - isLoaded: true, - resp: result.data, - }); - } - }, - (error) => { - console.log("error:", { error }); - setStatus({ - isLoaded: true, - err: error, - }); - } - ); - }; - - const assign = (sevID: number) => { - fetch(`/api/v1/severity/${sevID}/assign/${props.vulnID}`, { - method: "POST", - }) - .then((res) => res.json()) - .then( - (result) => { - console.log("result:", { result }); - setChange({ isCompleted: true, err: result.error }); - }, - (error) => { - console.log("error:", { error }); - setChange({ isCompleted: true, err: error }); - } - ); - }; - - const assignResult = () => { - if (!change.isCompleted) { - return ""; - } - - if (change.err) { - return {change.err}; - } - - return Updated; - }; - - React.useEffect(getSeverities, []); - - if (!status.isLoaded) { - return Loading...; - } else if (status.err) { - return {status.err}; - } - - const severities = status.resp || []; - - return ( - - - {assignResult()} - - ); -} diff --git a/assets/tsconfig.json b/assets/tsconfig.json deleted file mode 100644 index 4266697..0000000 --- a/assets/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": false, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "baseUrl": "./", - "paths": { - "@/*": ["*"] - } - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} diff --git a/database/embed.go b/database/embed.go new file mode 100644 index 0000000..daf4fce --- /dev/null +++ b/database/embed.go @@ -0,0 +1,12 @@ +package database + +import ( + _ "embed" +) + +//go:embed schema.sql +var schema string + +func Schema() string { + return schema +} diff --git a/database/query.sql b/database/query.sql new file mode 100644 index 0000000..3318b9a --- /dev/null +++ b/database/query.sql @@ -0,0 +1,98 @@ +-- name: SaveScan :exec +INSERT INTO scans ( + id, + artifact_name, + artifact_type +) VALUES ( + $1, $2, $3 +); + +-- name: SaveMetaGithubRepository :exec +INSERT INTO meta_github_repository ( + id, + scan_id, + owner, + repo_name, + branch, + is_default_branch, + commit_id, + base_commit_id, + pull_request_id +) VALUES ( + $1, $2, $3, $4, $5, $6, $7, $8, $9 +); + +-- name: SaveResult :exec +INSERT INTO results ( + id, + scan_id, + target, + target_type, + class +) VALUES ( + $1, $2, $3, $4, $5 +); + +-- name: SavePackage :exec +INSERT INTO packages ( + id, + target_type, + name, + version +) VALUES ( + $1, $2, $3, $4 +); + +-- name: GetPackages :many +SELECT * FROM packages WHERE id = ANY($1::text[]); + +-- name: SaveResultPackage :exec +INSERT INTO result_packages ( + id, + result_id, + pkg_id +) VALUES ( + $1, $2, $3 +); + +-- name: SaveVulnerability :exec +INSERT INTO vulnerabilities ( + id, + title, + description, + severity, + cwe_ids, + cvss, + reference, + published_at, + last_modified_at +) VALUES ( + $1, $2, $3, $4, $5, $6, $7, $8, $9 +); + +-- name: UpdateVulnerability :exec +UPDATE vulnerabilities SET + title = $2, + description = $3, + severity = $4, + cwe_ids = $5, + cvss = $6, + reference = $7, + published_at = $8, + last_modified_at = $9 +WHERE id = $1 and last_modified_at < $9; + +-- name: GetVulnerabilities :many +SELECT * FROM vulnerabilities WHERE id = ANY($1::text[]); + +-- name: SaveResultVulnerability :exec +INSERT INTO result_vulnerabilities ( + id, + result_id, + vuln_id, + pkg_id, + fixed_version, + primary_url +) VALUES ( + $1, $2, $3, $4, $5, $6 +); diff --git a/database/schema.sql b/database/schema.sql new file mode 100644 index 0000000..4265fc7 --- /dev/null +++ b/database/schema.sql @@ -0,0 +1,75 @@ +CREATE TYPE target_class AS ENUM ('os-pkgs', 'lang-pkgs'); + +create table scans ( + id uuid primary key not null, + created_at timestamp with time zone not null default now(), + artifact_name text not null, + artifact_type text not null, + + page_seq serial +); + +create table meta_github_repository ( + id uuid primary key not null, + scan_id uuid not null references scans(id), + + owner text not null, + repo_name text not null, + commit_id text not null, + branch text, + is_default_branch boolean, + base_commit_id text, + pull_request_id int, + + page_seq serial +); + +CREATE INDEX meta_github_repository_commit ON meta_github_repository (commit_id); + +create table results ( + id uuid primary key not null, + scan_id uuid not null references scans(id), + + target text not null, + target_type text not null, + class target_class not null +); + +create table packages ( + -- id is hash of target_type, name, version + id text primary key not null, + + target_type text not null, + name text not null, + version text not null +); + +create table result_packages ( + id uuid primary key not null, + result_id uuid not null references results(id), + pkg_id text not null references packages(id) +); + +create table vulnerabilities ( + id text primary key not null, + + title text not null, + description text not null, + severity text not null, + cwe_ids text[], + cvss JSONB, + reference text[], + + published_at timestamp with time zone, + last_modified_at timestamp with time zone +); + +create table result_vulnerabilities ( + id uuid primary key not null, + result_id uuid not null references results(id), + vuln_id text not null references vulnerabilities(id), + + pkg_id text not null references packages(id), + fixed_version text, + primary_url text +); diff --git a/go.mod b/go.mod index bf577e3..2bd8d9f 100644 --- a/go.mod +++ b/go.mod @@ -1,33 +1,49 @@ module github.com/m-mizutani/octovy -go 1.16 +go 1.21 require ( - entgo.io/ent v0.9.1 - github.com/Netflix/go-env v0.0.0-20210215222557-e437a7e7f9fb - github.com/aquasecurity/fanal v0.0.0-20211130145558-2c76718ef52e - github.com/aquasecurity/trivy v0.21.2 - github.com/aquasecurity/trivy-db v0.0.0-20210930134241-bec0c6aed9e1 - github.com/bradleyfalzon/ghinstallation v1.1.1 - github.com/fatih/color v1.13.0 // indirect - github.com/getsentry/sentry-go v0.11.0 - github.com/gin-gonic/gin v1.7.4 - github.com/go-ozzo/ozzo-validation/v4 v4.3.0 - github.com/go-playground/validator/v10 v10.9.0 // indirect - github.com/google/go-github/v39 v39.0.0 - github.com/google/uuid v1.3.0 - github.com/json-iterator/go v1.1.12 // indirect - github.com/lib/pq v1.10.2 - github.com/m-mizutani/goerr v0.1.2 - github.com/m-mizutani/opa-go-client v0.0.0-20211207024209-c99365b3341c - github.com/m-mizutani/zlog v0.1.3-0.20211203002134-3946d2ec45ed - github.com/mattn/go-sqlite3 v1.14.8 - github.com/open-policy-agent/opa v0.34.2 - github.com/pkg/errors v0.9.1 - github.com/stretchr/testify v1.7.0 - github.com/ugorji/go v1.2.6 // indirect - github.com/urfave/cli/v2 v2.3.0 - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect - golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac // indirect - google.golang.org/api v0.47.0 + github.com/aquasecurity/trivy v0.45.1 + github.com/aquasecurity/trivy-db v0.0.0-20230907201540-a70e1619ce26 + github.com/bradleyfalzon/ghinstallation/v2 v2.7.0 + github.com/fatih/color v1.15.0 + github.com/go-chi/chi/v5 v5.0.10 + github.com/google/go-github/v53 v53.2.0 + github.com/google/uuid v1.3.1 + github.com/lib/pq v1.10.9 + github.com/m-mizutani/clog v0.0.4 + github.com/m-mizutani/goerr v0.1.11 + github.com/m-mizutani/gots v0.0.0-20230529013424-0639119b2cdd + github.com/m-mizutani/gt v0.0.7 + github.com/m-mizutani/masq v0.1.5 + github.com/sqlc-dev/pqtype v0.2.0 + github.com/urfave/cli/v2 v2.25.7 +) + +require ( + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect + github.com/anchore/go-struct-converter v0.0.0-20230627203149-c72ef8859ca9 // indirect + github.com/cloudflare/circl v1.3.3 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-containerregistry v0.16.1 // indirect + github.com/google/go-github/v55 v55.0.0 // indirect + github.com/google/go-querystring v1.1.0 // indirect + github.com/k0kubun/pp/v3 v3.2.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/samber/lo v1.38.1 // indirect + github.com/spdx/tools-golang v0.5.3 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect + golang.org/x/crypto v0.13.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/oauth2 v0.12.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/go.sum b/go.sum index 079ed93..04247e2 100644 --- a/go.sum +++ b/go.sum @@ -1,2185 +1,174 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -cloud.google.com/go v0.25.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.31.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.37.2/go.mod h1:H8IAquKe2L30IxoupDgqTaQvKSwF/c8prYHynGIWQbA= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.39.0/go.mod h1:rVLT6fkc8chs9sfPtFc1SBH6em7n+ZoXaG+87tDISts= -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.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= -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.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0 h1:bAMqZidYkmIsUqe6PtkEPT7Q+vfizScn+jfNA6jwK9c= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -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/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -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= -code.gitea.io/sdk/gitea v0.12.0/go.mod h1:z3uwDV/b9Ls47NGukYM9XhnHtqPh/J+t40lsUrR6JDY= -contrib.go.opencensus.io/exporter/aws v0.0.0-20181029163544-2befc13012d0/go.mod h1:uu1P0UCM/6RbsMrgPa98ll8ZcHM858i/AD06a9aLRCA= -contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0= -contrib.go.opencensus.io/exporter/stackdriver v0.12.1/go.mod h1:iwB6wGarfphGGe/e5CWqyUk/cLzKnWsOKPVW3no6OTw= -contrib.go.opencensus.io/integrations/ocsql v0.1.4/go.mod h1:8DsSdjz3F+APR+0z0WkU1aRorQCFfRxvqjUUPMbF3fE= -contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -entgo.io/ent v0.9.1 h1:IG8andyeD79GG24U8Q+1Y45hQXj6gY5evSBcva5gtBk= -entgo.io/ent v0.9.1/go.mod h1:6NUeTfUN5mp5YN+5tgoH1SlakSvYPTBOYotSOvaI4ak= -git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -github.com/AkihiroSuda/containerd-fuse-overlayfs v1.0.0/go.mod h1:0mMDvQFeLbbn1Wy8P2j3hwFhqBq+FKn8OZPno8WLmp8= -github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Azure/azure-amqp-common-go/v2 v2.1.0/go.mod h1:R8rea+gJRuJR6QxTir/XuEd+YuKoUiazDC/N96FiDEU= -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= -github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v19.1.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v29.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v30.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v38.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v42.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-service-bus-go v0.9.1/go.mod h1:yzBx6/BUGfjfeqbRZny9AQIbIe3AcV9WZbAdpkoXOa0= -github.com/Azure/azure-storage-blob-go v0.8.0/go.mod h1:lPI3aLPpuLTeUwh1sViKXFxwl2B6teiRqI0deQUvsw0= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v10.15.5+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v12.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v14.1.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest v0.9.3/go.mod h1:GsRuLYvwzLjjjRoWEIyMUaYq8GNUx2nRB378IPt/1p0= -github.com/Azure/go-autorest/autorest v0.9.6/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630= -github.com/Azure/go-autorest/autorest v0.10.2/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630= -github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/adal v0.8.1/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q= -github.com/Azure/go-autorest/autorest/adal v0.8.2/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q= -github.com/Azure/go-autorest/autorest/adal v0.8.3/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q= -github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= -github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= -github.com/Azure/go-autorest/autorest/azure/auth v0.4.2/go.mod h1:90gmfKdlmKgfjUpnCEpOJzsUEjrWDSLwHIG73tSXddM= -github.com/Azure/go-autorest/autorest/azure/cli v0.3.1/go.mod h1:ZG5p860J94/0kI9mNJVoIoLgXcirM2gF5i2kWloofxw= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= -github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= -github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc= -github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA= -github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8= -github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRYq3HT1WyXAvT7LLY3tl70hw6tQIbjI= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= -github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= -github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= -github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= -github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/Djarvur/go-err113 v0.0.0-20200410182137-af658d038157/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/Djarvur/go-err113 v0.1.0/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20191009163259-e802c2cb94ae/go.mod h1:mjwGPas4yKduTyubHvD1Atl9r1rUq8DfVy+gkVvZ+oo= -github.com/GoogleCloudPlatform/docker-credential-gcr v1.5.0/go.mod h1:BB1eHdMLYEFuFdBlRMb0N7YGVdM5s6Pt0njxgvfbGGs= -github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20190822182118-27a4ced34534/go.mod h1:iroGtC8B3tQiqtds1l+mgk/BBOrxbqjH+eUfFQYRc14= -github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/semver/v3 v3.1.0/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/go-winio v0.4.15-0.20200908182639-5b44b70ab3ab/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/go-winio v0.4.15/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= -github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= -github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= -github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8= -github.com/Microsoft/hcsshim v0.8.10/go.mod h1:g5uw8EV2mAlzqe94tfNBNdr89fnbD/n3HV0OhsddkmM= -github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= -github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= -github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= -github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= -github.com/Microsoft/hcsshim/test v0.0.0-20200826032352-301c83a30e7c/go.mod h1:30A5igQ91GEmhYJF8TaRP79pMBOYynRsyOByfVV0dU4= -github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= -github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= -github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/Netflix/go-env v0.0.0-20210215222557-e437a7e7f9fb h1:w9IDEB7P1VzNcBpOG7kMpFkZp2DkyJIUt0gDx5MBhRU= -github.com/Netflix/go-env v0.0.0-20210215222557-e437a7e7f9fb/go.mod h1:9XMFaCeRyW7fC9XJOWQ+NdAv8VLG7ys7l3x4ozEGLUQ= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= -github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= -github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= -github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= -github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= -github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= -github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= -github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= -github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis/v2 v2.16.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apex/log v1.1.4/go.mod h1:AlpoD9aScyQfJDVHmLMEcx4oU6LqzkWp4Mg9GdAcEvQ= -github.com/apex/log v1.3.0/go.mod h1:jd8Vpsr46WAe3EZSQ/IUMs2qQD/GOycT5rPWCO1yGcs= -github.com/apex/logs v0.0.4/go.mod h1:XzxuLZ5myVHDy9SAmYpamKKRNApGj54PfYLcFrXqDwo= -github.com/aphistic/golf v0.0.0-20180712155816-02c07f170c5a/go.mod h1:3NqKYiepwy8kCu4PNA+aP7WUV72eXWJeP9/r3/K9aLE= -github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3stzu0Xys= -github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= -github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= -github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= -github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= -github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986 h1:2a30xLN2sUZcMXl50hg+PJCIDdJgIvIbVcKqLJ/ZrtM= -github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986/go.mod h1:NT+jyeCzXk6vXR5MTkdn4z64TgGfE5HMLC8qfj5unl8= -github.com/aquasecurity/cfsec v0.2.2/go.mod h1:sUELRJqIPXTOZiHUx7TzyyFFzuk0W22IG6IWAoV8T6U= -github.com/aquasecurity/defsec v0.0.37/go.mod h1:csaBEcJ3AKy44expnW0dCANEZcS/c1vcJjwBCbnKWBM= -github.com/aquasecurity/fanal v0.0.0-20211130145558-2c76718ef52e h1:8cdrjNJ3aMcNglPK80y37T9B733dBoe7118hLC2XWBA= -github.com/aquasecurity/fanal v0.0.0-20211130145558-2c76718ef52e/go.mod h1:tfiYxqoK/3PDW8Ut3UnxP7rKqFaSw1X6owKjAHjM1NA= -github.com/aquasecurity/go-dep-parser v0.0.0-20211110174639-8257534ffed3/go.mod h1:Zc7Eo6tFl9l4XcqsWeabD7jHnXRBK/LdgZuu9GTSVLU= -github.com/aquasecurity/go-gem-version v0.0.0-20201115065557-8eed6fe000ce/go.mod h1:HXgVzOPvXhVGLJs4ZKO817idqr/xhwsTcj17CLYY74s= -github.com/aquasecurity/go-npm-version v0.0.0-20201110091526-0b796d180798/go.mod h1:hxbJZtKlO4P8sZ9nztizR6XLoE33O+BkPmuYQ4ACyz0= -github.com/aquasecurity/go-pep440-version v0.0.0-20210121094942-22b2f8951d46/go.mod h1:olhPNdiiAAMiSujemd1O/sc6GcyePr23f/6uGKtthNg= -github.com/aquasecurity/go-version v0.0.0-20201107203531-5e48ac5d022a/go.mod h1:9Beu8XsUNNfzml7WBf3QmyPToP1wm1Gj/Vc5UJKqTzU= -github.com/aquasecurity/go-version v0.0.0-20210121072130-637058cfe492/go.mod h1:9Beu8XsUNNfzml7WBf3QmyPToP1wm1Gj/Vc5UJKqTzU= -github.com/aquasecurity/testdocker v0.0.0-20210911155206-e1e85f5a1516/go.mod h1:gTd97VdQ0rg8Mkiic3rPgNOQdprZ7feTAhiD5mGQjgM= -github.com/aquasecurity/tfsec v0.61.4-0.20211130135821-0a1997e494fa/go.mod h1:MR3uDlWu+fBTisFndR+NwjSGt06RBhkE++JzKRJ0Ggs= -github.com/aquasecurity/trivy v0.21.2 h1:bszTNR55ynWE1DbPi6aOu0Fuvc3wAwW31Q1y+n5vnBU= -github.com/aquasecurity/trivy v0.21.2/go.mod h1:TgEKsoU3bIlUcFFJQGlwu9bN6p5VnlK/XJj9D7U0lwk= -github.com/aquasecurity/trivy-db v0.0.0-20210916043317-726b7b72a47b/go.mod h1:5h8GV7Qxp/SMJ4awWHs0KRxwVkKzcwOnRkORWOnCXRU= -github.com/aquasecurity/trivy-db v0.0.0-20210930134241-bec0c6aed9e1 h1:nlgCnzTkzja6e0S2iw75GD2NSCgl2UGfm9I3Wjoix10= -github.com/aquasecurity/trivy-db v0.0.0-20210930134241-bec0c6aed9e1/go.mod h1:5h8GV7Qxp/SMJ4awWHs0KRxwVkKzcwOnRkORWOnCXRU= -github.com/aquasecurity/vuln-list-update v0.0.0-20191016075347-3d158c2bf9a2/go.mod h1:6NhOP0CjZJL27bZZcaHECtzWdwDDm2g6yCY0QgXEGQQ= -github.com/araddon/dateparse v0.0.0-20190426192744-0d74ffceef83/go.mod h1:SLqhdZcd+dF3TEVL2RMoob5bBP5R1P1qkox+HtCBgGI= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 h1:zV3ejI06GQ59hwDQAvmK1qxOQGB3WuVTRoY0okPTAv0= -github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= -github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= -github.com/aws/aws-sdk-go v1.15.90/go.mod h1:es1KtYUFs7le0xQ3rOihkuoVD90z7D0fR2Qm4S00/gU= -github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.19.45/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.25.11/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.27.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.31.6/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= -github.com/aws/aws-sdk-go v1.42.0/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= -github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= -github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= -github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= -github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI= -github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bombsimon/wsl/v2 v2.0.0/go.mod h1:mf25kr/SqFEPhhcxW1+7pxzGlW+hIl/hYTKY95VwV8U= -github.com/bombsimon/wsl/v2 v2.2.0/go.mod h1:Azh8c3XGEJl9LyX0/sFC+CKMc7Ssgua0g+6abzXN4Pg= -github.com/bombsimon/wsl/v3 v3.0.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= -github.com/bombsimon/wsl/v3 v3.1.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= -github.com/bradleyfalzon/ghinstallation v1.1.1 h1:pmBXkxgM1WeF8QYvDLT5kuQiHMcmf+X015GI0KM/E3I= -github.com/bradleyfalzon/ghinstallation v1.1.1/go.mod h1:vyCmHTciHx/uuyN82Zc3rXN3X2KTK8nUTCrTMwAhcug= -github.com/briandowns/spinner v1.12.0 h1:72O0PzqGJb6G3KgrcIOtL/JAGGZ5ptOMCn9cUHmqsmw= -github.com/briandowns/spinner v1.12.0/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ= -github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= -github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= -github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= -github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= -github.com/bytecodealliance/wasmtime-go v0.30.0 h1:WfYpr4WdqInt8m5/HvYinf+HrSEAIhItKIcth+qb1h4= -github.com/bytecodealliance/wasmtime-go v0.30.0/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI= -github.com/caarlos0/ctrlc v1.0.0/go.mod h1:CdXpj4rmq0q/1Eb44M9zi2nKB0QraNKuRGYGrrHhcQw= -github.com/caarlos0/env/v6 v6.0.0 h1:NZt6FAoB8ieKO5lEwRdwCzYxWFx7ZYF2R7UcoyaWtyc= -github.com/caarlos0/env/v6 v6.0.0/go.mod h1:+wdyOmtjoZIW2GJOc2OYa5NoOFuWD/bIpWqm30NgtRk= -github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e/go.mod h1:9IOqJGCPMSc6E5ydlp5NIonxObaeu/Iub/X03EKPVYo= -github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -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/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= -github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= -github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/cheggaaa/pb/v3 v3.0.3/go.mod h1:Pp35CDuiEpHa/ZLGCtBbM6CBwMstv1bJlG884V+73Yc= -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/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg= -github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= -github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= -github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= -github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -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/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/codahale/hdrhistogram v0.0.0-20160425231609-f8ad88b59a58/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= -github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= -github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= -github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= -github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= -github.com/containerd/btrfs v0.0.0-20201111183144-404b9149801e/go.mod h1:jg2QkJcsabfHugurUvvPhS3E08Oxiuh5W/g1ybB4e0E= -github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= -github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= -github.com/containerd/cgroups v0.0.0-20190717030353-c4b9ac5c7601/go.mod h1:X9rLEHIqSf/wfK8NsPqxJmeZgW4pcfzdXITDrUSJ6uI= -github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= -github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM= -github.com/containerd/cgroups v0.0.0-20200710171044-318312a37340/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= -github.com/containerd/cgroups v0.0.0-20200824123100-0b889c03f102/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= -github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= -github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU= -github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= -github.com/containerd/console v1.0.0/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= -github.com/containerd/console v1.0.1/go.mod h1:XUsP6YE/mKtz6bxc+I8UiKKTP04qjQL4qcS3XoQ5xkw= -github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= -github.com/containerd/containerd v1.2.10/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.1-0.20191213020239-082f7e3aed57/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.0-beta.2.0.20200729163537-40b22ef07410/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.1-0.20201117152358-0edc412565dc/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7V960Tmcumvqn8Mc+pCYQ= -github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= -github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= -github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= -github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= -github.com/containerd/containerd v1.5.2/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= -github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= -github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= -github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= -github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= -github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= -github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= -github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= -github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= -github.com/containerd/fifo v0.0.0-20201026212402-0724c46b320c/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= -github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= -github.com/containerd/fifo v1.0.0/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= -github.com/containerd/go-cni v1.0.1/go.mod h1:+vUpYxKvAF72G9i1WoDOiPGRtQpqsNW/ZHtSlv++smU= -github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk= -github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= -github.com/containerd/go-runc v0.0.0-20190911050354-e029b79d8cda/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= -github.com/containerd/go-runc v0.0.0-20200220073739-7016d3ce2328/go.mod h1:PpyHrqVs8FTi9vpyHwPwiNEGaACDxT/N/pLcvMSRA9g= -github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= -github.com/containerd/go-runc v1.0.0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= -github.com/containerd/imgcrypt v1.0.1/go.mod h1:mdd8cEPW7TPgNG4FpuP3sGBiQ7Yi/zak9TYCG3juvb0= -github.com/containerd/imgcrypt v1.0.4-0.20210301171431-0ae5c75f59ba/go.mod h1:6TNsg0ctmizkrOgXRNQjAPFWpMYRWuiB6dSF4Pfa5SA= -github.com/containerd/imgcrypt v1.1.1-0.20210312161619-7ed62a527887/go.mod h1:5AZJNI6sLHJljKuI9IHnw1pWqo/F0nGDOuR9zgTs7ow= -github.com/containerd/imgcrypt v1.1.1/go.mod h1:xpLnwiQmEUJPvQoAapeb2SNCxz7Xr6PJrXQb0Dpc4ms= -github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c= -github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= -github.com/containerd/nri v0.1.0/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= -github.com/containerd/stargz-snapshotter v0.0.0-20201027054423-3a04e4c2c116/go.mod h1:o59b3PCKVAf9jjiKtCc/9hLAd+5p/rfhBfm6aBcTEr4= -github.com/containerd/stargz-snapshotter/estargz v0.7.0/go.mod h1:83VWDqHnurTKliEB0YvWMiCfLDwv4Cjj1X9Vk98GJZw= -github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= -github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= -github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8= -github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= -github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= -github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= -github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk= -github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg= -github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= -github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw= -github.com/containerd/zfs v0.0.0-20210301145711-11e8f1707f62/go.mod h1:A9zfAbMlQwE+/is6hi0Xw8ktpL+6glmqZYtevJgaB8Y= -github.com/containerd/zfs v0.0.0-20210315114300-dde8f0fda960/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= -github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= -github.com/containerd/zfs v1.0.0/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= -github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM= -github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8= -github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc= -github.com/containers/ocicrypt v1.1.0/go.mod h1:b8AOe0YR67uU8OqfVNcznfFpAzu3rdgUV4GP9qXPfu4= -github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= -github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= -github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -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.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -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/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= -github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= -github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= -github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= -github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= -github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA= +github.com/anchore/go-struct-converter v0.0.0-20230627203149-c72ef8859ca9 h1:6COpXWpHbhWM1wgcQN95TdsmrLTba8KQfPgImBXzkjA= +github.com/anchore/go-struct-converter v0.0.0-20230627203149-c72ef8859ca9/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA= +github.com/aquasecurity/trivy v0.45.0 h1:Pwla4x6G2U2xrcsfsrdeZmLUmnrFPlUhg23xcNTzJX8= +github.com/aquasecurity/trivy v0.45.0/go.mod h1:nqruwuHFYfEDw4UGeg0oAzgAHYAtMpUR/PNfVDTidF4= +github.com/aquasecurity/trivy v0.45.1 h1:JjkrawgNpVUV6mxtFX635I3MhzDqmGkze46SnygkYN0= +github.com/aquasecurity/trivy v0.45.1/go.mod h1:3cawI6q9o32pPGXhuGEIWWwUCSMAzRk/FhsEdA4eW1k= +github.com/aquasecurity/trivy-db v0.0.0-20230907201540-a70e1619ce26 h1:l5Uusq1ZqjV4hjPs1icjnUEKeAnmQqGcNQhjYYdD+a8= +github.com/aquasecurity/trivy-db v0.0.0-20230907201540-a70e1619ce26/go.mod h1:rrbvyI5Nhg7LxbUzm2C88BuEe2EQug4BMYZa5HPV4qo= +github.com/bradleyfalzon/ghinstallation/v2 v2.6.0 h1:IRY7Xy588KylkoycsUhFpW7cdGpy5Y5BPsz4IfuJtGk= +github.com/bradleyfalzon/ghinstallation/v2 v2.6.0/go.mod h1:oQ3etOwN3TRH4EwgW5/7MxSVMGlMlzG/O8TU7eYdoSk= +github.com/bradleyfalzon/ghinstallation/v2 v2.7.0 h1:ranXaC3Zz/F6G/f0Joj3LrFp2OzOKfJZev5Q7OaMc88= +github.com/bradleyfalzon/ghinstallation/v2 v2.7.0/go.mod h1:ymxfmloxXBFXvvF1KpeUhOQM6Dfz9NYtfvTiJyk82UE= +github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 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/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/devigned/tab v0.1.1/go.mod h1:XG9mPq0dFghrYvoBF3xdRrJzSTX1b7IQrvaL9mzjeJY= -github.com/dgraph-io/badger v1.6.0 h1:DshxFxZWXUcO0xX476VJC07Xsr6ZCBVRHKZ93Oh7Evo= -github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgraph-io/badger/v3 v3.2103.2 h1:dpyM5eCJAtQCBcMCZcT4UBZchuTJgCywerHHgmxfxM8= -github.com/dgraph-io/badger/v3 v3.2103.2/go.mod h1:RHo4/GmYcKKh5Lxu63wLEMHJ70Pac2JqZRYGhlyAo2M= -github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= -github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug= -github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= -github.com/docker/cli v0.0.0-20190925022749-754388324470/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/cli v20.10.0-beta1.0.20201029214301-1d20b15adc38+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/cli v20.10.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/cli v20.10.9+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= -github.com/docker/distribution v2.6.0-rc.1.0.20180327202408-83389a148052+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v0.0.0-20200511152416-a93e9eb0e95c/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v1.4.2-0.20180531152204-71cd53e4a197/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v17.12.0-ce-rc1.0.20200730172259-9f28837c1d93+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v20.10.0-beta1.0.20201110211921-af34b94a78a1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v20.10.10+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= -github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= -github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/libnetwork v0.8.0-dev.2.0.20200917202933-d0951081b35f/go.mod h1:93m0aTqz6z+g32wla4l4WxTrdtvBRmVzYRkYvasA5Z8= -github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= -github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= -github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= -github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= -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/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= -github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= -github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= -github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.2.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU= -github.com/getsentry/sentry-go v0.11.0 h1:qro8uttJGvNAMr5CLcFI9CHR0aDzXl0Vs3Pmw/oTPg8= -github.com/getsentry/sentry-go v0.11.0/go.mod h1:KBQIxiZAetw62Cj8Ri964vAEWVdgfaUCn30Q3bCvANo= -github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -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.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= -github.com/gin-gonic/gin v1.7.4 h1:QmUZXrvJ9qZ3GfWvQ+2wnW/1ePrTEJqPKMYEU3lD/DM= -github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-bindata/go-bindata v1.0.1-0.20190711162640-ee3c2418e368/go.mod h1:7xCgX1lzlrXPHkfvn3EhumqHkmSlzt8at9q7v0ax19c= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/go-critic/go-critic v0.4.1/go.mod h1:7/14rZGnZbY6E38VEGk2kVhoq6itzc1E68facVDK23g= -github.com/go-critic/go-critic v0.4.3/go.mod h1:j4O3D4RoIwRqlZw5jJpx0BNfXWWbpcJoKu5cYSe4YmQ= -github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= -github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= -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-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= -github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= -github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= -github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= -github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= -github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= -github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= -github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= -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.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -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.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -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.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-playground/validator/v10 v10.9.0 h1:NgTtmN58D0m8+UuxtYmGztBJB7VnPgjj221I1QHci2A= -github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= -github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w= -github.com/go-restruct/restruct v0.0.0-20191227155143-5734170a48a1/go.mod h1:KqrpKpn4M8OLznErihXTGLlsXFGeLxHUrLRRI/1YjGk= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-sql-driver/mysql v1.5.1-0.20200311113236-681ffa848bae/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -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-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= -github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= -github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= -github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= -github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086/go.mod h1:mP93XdblcopXwlyN4X4uodxXQhldPGZbcEJIimQHrkg= -github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= -github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= -github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30/go.mod h1:SV2ur98SGypH1UjcPpCatrV5hPazG6+IfNHbkDXBRrk= -github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= -github.com/go-toolsmith/pkgload v0.0.0-20181119091011-e9e65178eee8/go.mod h1:WoMrjiy4zvdS+Bg6z9jZH82QXwkcgCBX6nOfnmdaHks= -github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= -github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= -github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= -github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= -github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= -github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/goccy/go-yaml v1.8.1/go.mod h1:wS4gNoLalDSJxo/SpngzPQ2BN4uuZVLCmbM4S3vd4+Y= -github.com/goccy/go-yaml v1.8.2 h1:gDYrSN12XK/wQTFjxWIgcIqjNCV/Zb5V09M7cq+dbCs= -github.com/goccy/go-yaml v1.8.2/go.mod h1:wS4gNoLalDSJxo/SpngzPQ2BN4uuZVLCmbM4S3vd4+Y= -github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= -github.com/gofrs/flock v0.7.3/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= -github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU= -github.com/gogo/googleapis v1.3.2/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= -github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -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 h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= -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/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= 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.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -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/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= -github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= -github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= -github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= -github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3/go.mod h1:JXrF4TWy4tXYn62/9x8Wm/K/dm06p8tCKwFRDPZG/1o= -github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= -github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= -github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.23.7/go.mod h1:g/38bxfhp4rI7zeWSxcdIeHTQGS58TCak8FYcyCmavQ= -github.com/golangci/golangci-lint v1.27.0/go.mod h1:+eZALfxIuthdrHPtfM7w/R3POJLjHDfJJw8XZl9xOng= -github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= -github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= -github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= -github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= -github.com/golangci/misspell v0.3.5/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= -github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI= -github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= -github.com/golangci/revgrep v0.0.0-20180812185044-276a5c0a1039/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= -github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= -github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= -github.com/google/btree v0.0.0-20180124185431-e89373fe6b4a/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -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/google/crfs v0.0.0-20191108021818-71d77da419c9/go.mod h1:etGhoOqfwPkooV6aqoX3eBGQOJblqdoc9XvWOeuxpPw= -github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= -github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -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/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/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.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-containerregistry v0.0.0-20191010200024-a3d713f9b7f8/go.mod h1:KyKXa9ciM8+lgMXwOVsXi7UxGrsf9mM61Mzs+xKUrKE= -github.com/google/go-containerregistry v0.1.2/go.mod h1:GPivBPgdAyd2SU+vf6EpsgOtWDuPqjW0hJZt4rNdTZ4= -github.com/google/go-containerregistry v0.6.0 h1:niQ+8XD//kKgArIFwDVBXsWVWbde16LPdHMyNwSC8h4= -github.com/google/go-containerregistry v0.6.0/go.mod h1:euCCtNbZ6tKqi1E72vwDj2xZcN5ttKpZLfa/wSo5iLw= -github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM= -github.com/google/go-github/v29 v29.0.2 h1:opYN6Wc7DOz7Ku3Oh4l7prmkOMwEcQxpFtxdU8N8Pts= -github.com/google/go-github/v29 v29.0.2/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E= -github.com/google/go-github/v33 v33.0.0/go.mod h1:GMdDnVZY/2TsWgp/lkYnpSAh6TrzhANBBwm6k6TTEXg= -github.com/google/go-github/v38 v38.1.0/go.mod h1:cStvrz/7nFr0FoENgG6GLbp53WaelXucT+BBz/3VKx4= -github.com/google/go-github/v39 v39.0.0 h1:pygGA5ySwxEez1N39GnDauD0PaWWuGgayudyZAc941s= -github.com/google/go-github/v39 v39.0.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-containerregistry v0.16.1 h1:rUEt426sR6nyrL3gt+18ibRcvYpKYdpsa5ZW7MA08dQ= +github.com/google/go-containerregistry v0.16.1/go.mod h1:u0qB2l7mvtWVR5kNcbFIhFY1hLbf8eeGapA+vbFDCtQ= +github.com/google/go-github/v53 v53.2.0 h1:wvz3FyF53v4BK+AsnvCmeNhf8AkTaeh2SoYu/XUvTtI= +github.com/google/go-github/v53 v53.2.0/go.mod h1:XhFRObz+m/l+UCm9b7KSIC3lT3NWSXGt7mOsAWEloao= +github.com/google/go-github/v55 v55.0.0 h1:4pp/1tNMB9X/LuAhs5i0KQAE40NmiR/y6prLNb9x9cg= +github.com/google/go-github/v55 v55.0.0/go.mod h1:JLahOTA1DnXzhxEymmFF5PP2tSS9JVNj68mSZNDwskA= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/google/go-replayers/grpcreplay v0.1.0/go.mod h1:8Ig2Idjpr6gifRd6pNVggX6TC1Zw6Jx74AKp7QNH2QE= -github.com/google/go-replayers/httpreplay v0.1.0/go.mod h1:YKZViNhiGgqdBlUbI2MwGpq4pXxNmhJLPHQ7cv2b5no= -github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+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/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -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-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/rpmpack v0.0.0-20191226140753-aa36bfddb3a0/go.mod h1:RaTPr0KUf2K7fnZYLNDrr8rxAamWs3iNywJLtQ2AzBg= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= -github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/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/google/wire v0.3.0/go.mod h1:i1DMg/Lu8Sz5yYl25iOdmc5CT5qusaa+zmRWs16741s= -github.com/google/wire v0.4.0/go.mod h1:ngWDr9Qvq3yZA10YrxfyGELY/AFWGVpy9c1LTRi1EoU= -github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go v2.0.2+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -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/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleapis/gnostic v0.2.2/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg= -github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/goreleaser/goreleaser v0.136.0/go.mod h1:wiKrPUeSNh6Wu8nUHxZydSOVQ/OZvOaO7DTtFqie904= -github.com/goreleaser/nfpm v1.2.1/go.mod h1:TtWrABZozuLOttX2uDlYyECfQX7x5XYkVxhjYcR6G9w= -github.com/goreleaser/nfpm v1.3.0/go.mod h1:w0p7Kc9TAUgWMyrub63ex3M2Mgw88M4GZXoTq5UCb40= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/grpc-ecosystem/grpc-gateway v1.6.2/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.2/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= -github.com/hanwen/go-fuse v1.0.0/go.mod h1:unqXarDXqzAk0rt98O2tVndEPIpUgLD9+rwFisZH3Ok= -github.com/hanwen/go-fuse/v2 v2.0.3/go.mod h1:0EQM6aH2ctVpvZ6a+onrQ/vaykxh2GH7hy3e13vzTUY= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-getter v1.5.2/go.mod h1:orNH3BTYLu/fIxGIdLjLoAJHWMDQ/UKQr5O4m3iBuoo= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-hclog v0.15.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-retryablehttp v0.6.4/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -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/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/hcl/v2 v2.6.0/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY= -github.com/hashicorp/hcl/v2 v2.10.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c/go.mod h1:fHzc09UnyJyqyW+bFuq864eh+wC7dj65aXmXLRe5to0= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= -github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -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/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= -github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= -github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= -github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk= -github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= -github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= -github.com/ishidawataru/sctp v0.0.0-20191218070446-00ab2ac2db07/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg= -github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= -github.com/jaguilar/vt100 v0.0.0-20150826170717-2703a27b14ea/go.mod h1:QMdK4dGB3YhEW2BmA1wgGpPYI3HZy/5gD705PXKUVSg= -github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= -github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a/go.mod h1:xRskid8CManxVta/ALEhJha/pweKBaVG6fWgc0yH25s= -github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= -github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -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/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/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40= -github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg= -github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= -github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= -github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= -github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= -github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.13.0/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.13.5 h1:9O69jUPDcsT9fEm74W92rZL9FQY7rCdaXVneq+yyzl4= -github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f/go.mod h1:q59u9px8b7UTj0nIjEjvmTWekazka6xIt6Uogz5Dm+8= -github.com/knqyf263/go-deb-version v0.0.0-20190517075300-09fca494f03d/go.mod h1:o8sgWoz3JADecfc/cTYD92/Et1yMqMy0utV1z+VaZao= -github.com/knqyf263/go-rpm-version v0.0.0-20170716094938-74609b86c936/go.mod h1:i4sF0l1fFnY1aiw08QQSwVAFxHEm311Me3WsU/X7nL0= -github.com/knqyf263/go-rpmdb v0.0.0-20210911072402-73bd0ce46c49/go.mod h1:RDPNeIkU5NWXtt0OMEoILyxwUC/DyXeRtK295wpqSi0= -github.com/knqyf263/nested v0.0.1/go.mod h1:zwhsIhMkBg90DTOJQvxPkKIypEHPYkgWHs4gybdlUmk= -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/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -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/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -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/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -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/liamg/clinch v1.5.6/go.mod h1:IXM+nLBuZ5sOQAYYf9+G51nkaA0WY9cszxE5nPXexhE= -github.com/liamg/gifwrap v0.0.6/go.mod h1:oW1r2vIWLYyxW+U0io7YbpPSDIJ79FTlZ+hPnXFLW6E= -github.com/liamg/jfather v0.0.2/go.mod h1:xXBGiBoiZ6tmHhfy5Jzw8sugzajwYdi6VosIpB3/cPM= -github.com/liamg/tml v0.3.0/go.mod h1:0h4EAV/zBOsqI91EWONedjRpO8O0itjGJVd+wG5eC+E= -github.com/liamg/tml v0.4.0/go.mod h1:0h4EAV/zBOsqI91EWONedjRpO8O0itjGJVd+wG5eC+E= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.1.1/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/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/m-mizutani/goerr v0.1.2 h1:iYWo02qbCYpmqJAbPlbu+aXQVI/uS47hje0s6cgmKpM= -github.com/m-mizutani/goerr v0.1.2/go.mod h1:j3cf1KSIhehhIY38cCdbixepJ2LQBpJdIQ3G8pbVUiY= -github.com/m-mizutani/opa-go-client v0.0.0-20211207024209-c99365b3341c h1:408wFTJ31/3gviiUIfGlHqQGCNZ1jyrxjX+a62Puv38= -github.com/m-mizutani/opa-go-client v0.0.0-20211207024209-c99365b3341c/go.mod h1:fIItP0zth1katEOuK3JEVg/+TTq3plnW/BYSyCu3WkU= -github.com/m-mizutani/zlog v0.1.3-0.20211203002134-3946d2ec45ed h1:bKj/28Z9FaW0XBXBJGhsnU+eeNrXSFDUexEw9AGkyyM= -github.com/m-mizutani/zlog v0.1.3-0.20211203002134-3946d2ec45ed/go.mod h1:efppDLVhoHSRyq7ozaSW34gjr+gx6Ls0x2HkBqulx6k= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -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.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= -github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= -github.com/masahiro331/go-mvn-version v0.0.0-20210429150710-d3157d602a08/go.mod h1:JOkBRrE1HvgTyjk6diFtNGgr8XJMtIfiBzkL5krqzVk= -github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= -github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -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.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-jsonpointer v0.0.0-20180225143300-37667080efed/go.mod h1:SDJ4hurDYyQ9/7nc+eCYtXqdufgK4Cq9TJlwPklqEYA= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxmAOow= -github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= -github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= -github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU= -github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= -github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/copystructure v1.1.1 h1:Bp6x9R1Wn16SIz3OfeDr0b7RnCG2OB66Y7PQyC/cvq4= -github.com/mitchellh/copystructure v1.1.1/go.mod h1:EBArHfARyrSWO/+Wyr9zwEkc6XMFB9XyNgFNmRkZZU4= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= -github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE= -github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/moby/buildkit v0.8.1/go.mod h1:/kyU1hKy/aYCuP39GZA9MaKioovHku57N6cqlKZIaiQ= -github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= -github.com/moby/sys/mount v0.1.0/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74= -github.com/moby/sys/mount v0.1.1/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74= -github.com/moby/sys/mount v0.2.0/go.mod h1:aAivFE2LB3W4bACsUXChRHQ0qKWsetY4Y9V7sxOougM= -github.com/moby/sys/mountinfo v0.1.0/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o= -github.com/moby/sys/mountinfo v0.1.3/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o= -github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= -github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= -github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= -github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= -github.com/moby/term v0.0.0-20200915141129-7f0af18e79f2/go.mod h1:TjQg8pa4iejrUrjiz0MCtMV38jdMNW4doKSiBrEvCQQ= -github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= -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 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -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/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= -github.com/mozilla/tls-observatory v0.0.0-20190404164649-a3c1b6cfecfd/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= -github.com/mozilla/tls-observatory v0.0.0-20200317151703-4fa42e1c2dee/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= -github.com/mrunalp/fileutils v0.0.0-20200520151820-abd8a0e76976/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= -github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= -github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/nakabonne/nestif v0.3.0/go.mod h1:dI314BppzXjJ4HsCnbo7XzrJHPszZsjnk5wEBSYHI2c= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= -github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/open-policy-agent/opa v0.34.0/go.mod h1:buysXn+6zB/b+6JgLkP4WgKZ9+UgUtFAgtemYGrL9Ik= -github.com/open-policy-agent/opa v0.34.2 h1:asRmfDRUSd8gwPNRrpUsDxwOUkxLgc1x1FYkwjcnag4= -github.com/open-policy-agent/opa v0.34.2/go.mod h1:buysXn+6zB/b+6JgLkP4WgKZ9+UgUtFAgtemYGrL9Ik= -github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc92/go.mod h1:X1zlU4p7wOlX4+WRCz+hvlRv8phdL7UqbYD+vQwNMmE= -github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= -github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= -github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.3-0.20200728170252-4d89ac9fbff6/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= -github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= -github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= -github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= -github.com/opentracing-contrib/go-stdlib v1.0.0/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/owenrumney/go-sarif v1.0.10/go.mod h1:sgJM0ZaZ28jT8t8Iq3/mUCFBW9cX09EobIBXYOhiYBc= -github.com/owenrumney/go-sarif v1.0.12/go.mod h1:Jk5smXU9QuCqTdh4N3PehnG+azzrf0XcQ267ZwAG8Ho= -github.com/owenrumney/squealer v0.2.28/go.mod h1:wwVPzhjiUBILIdDtnzGSEcapXczIj/tONP+ZJ49IhPY= -github.com/parnurzeal/gorequest v0.2.16/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= -github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= -github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/peterh/liner v0.0.0-20170211195444-bf27d3ba8e1d/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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/profile v1.5.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= -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/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/k0kubun/pp/v3 v3.2.0 h1:h33hNTZ9nVFNP3u2Fsgz8JXiF5JINoZfFq4SvKJwNcs= +github.com/k0kubun/pp/v3 v3.2.0/go.mod h1:ODtJQbQcIRfAD3N+theGCV1m/CBxweERz2dapdz1EwA= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/m-mizutani/clog v0.0.4 h1:6hY5CzHwNS4zuJhF6puazYPtGeaEEGIbrD4Ccimyaow= +github.com/m-mizutani/clog v0.0.4/go.mod h1:a2J7BlnXOkaMQ0fNeDBG3IyyyWnCnSKYH8ltHFNDcHE= +github.com/m-mizutani/goerr v0.1.11 h1:noTEk8jNOVl/ST/Qfn0q7lMA13/ygzyl1PxaD4hHti4= +github.com/m-mizutani/goerr v0.1.11/go.mod h1:64HHjaK/ZjCy3VMaqrcZvinirVZkIBUxU21ml3WgMU4= +github.com/m-mizutani/gots v0.0.0-20230529013424-0639119b2cdd h1:mmuUG300WqGOvGNIIK3ELod2LpZZBV94fEgXK36xM0o= +github.com/m-mizutani/gots v0.0.0-20230529013424-0639119b2cdd/go.mod h1:MDYrqsaKL6z6djDZpy6admhX6GOOCvyST+c0VnLbT4w= +github.com/m-mizutani/gt v0.0.7 h1:wKESp5LWdKpKMySX4Rf05iXYUGtoQ3aI7xOO9VVHAoY= +github.com/m-mizutani/gt v0.0.7/go.mod h1:0MPYSfGBLmYjTduzADVmIqD58ELQ5IfBFiK/f0FmB3k= +github.com/m-mizutani/masq v0.1.5 h1:+ebFJ9gdIZdiNA0X3Cn8MAXgfH4Z6m0cLJE9UNcKQKk= +github.com/m-mizutani/masq v0.1.5/go.mod h1:42/bKhlCNIQjmh3KBypeuh6iOvxNfUIlrZD1i0amEoc= +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.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= -github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= -github.com/quasilyte/go-ruleguard v0.1.2-0.20200318202121-b00d7a75d3d8/go.mod h1:CGFX09Ci3pq9QZdj86B+VGIdNj4VyCo2iPOGS9esB/k= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -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/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.0.4/go.mod h1:9T/Cfuxs5StfsocWr4WzDL36HqnX0fVb9d5fSEaLhoE= -github.com/ryancurrah/gomodguard v1.1.0/go.mod h1:4O8tr7hBODaGE6VIhfJDHcwzh5GUccKSJBU0UMXJFVM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= -github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e/go.mod h1:G0Z6yVPru183i2MuRJx1DcR4dgIZtLcTdaaE/pC1BJU= -github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b/go.mod h1:am+Fp8Bt506lA3Rk3QCmSqmYmLMnPDhdDUcosQCAx+I= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= -github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= -github.com/securego/gosec v0.0.0-20200103095621-79fbf3af8d83/go.mod h1:vvbZ2Ae7AzSq3/kywjUDxSNq2SJ27RxCz2un0H3ePqE= -github.com/securego/gosec v0.0.0-20200401082031-e946c8c39989/go.mod h1:i9l/TNj+yDFh9SZXUTvspXTjbFXgZGP/UvhU1S65A4A= -github.com/securego/gosec/v2 v2.3.0/go.mod h1:UzeVyUXbxukhLeHKV3VVqo7HdoQR9MrRfFmZYotn8ME= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/serialx/hashring v0.0.0-20190422032157-8b2912629002/go.mod h1:/yeG0My1xr/u+HZrFQ1tOQQQQrOawfyMUH13ai5brBc= -github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= -github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8= -github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -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.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= -github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sosedoff/gitkit v0.3.0/go.mod h1:V3EpGZ0nvCBhXerPsbDeqtyReNb48cwP9KtkUYTKT5I= -github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34cd2MNlA9u1mE= -github.com/sourcegraph/go-diff v0.5.3/go.mod h1:v9JDtjCE4HHHCZGId75rg8gkKKa98RVjBcBGsVmMmak= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= -github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= -github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= +github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= +github.com/spdx/gordf v0.0.0-20201111095634-7098f93598fb/go.mod h1:uKWaldnbMnjsSAXRurWqqrdyZen1R7kxl8TkmWk2OyM= +github.com/spdx/tools-golang v0.5.3 h1:ialnHeEYUC4+hkm5vJm4qz2x+oEJbS0mAMFrNXdQraY= +github.com/spdx/tools-golang v0.5.3/go.mod h1:/ETOahiAo96Ob0/RAIBmFZw6XN0yTnyr/uFZm2NTMhI= +github.com/sqlc-dev/pqtype v0.2.0 h1:zfzDpAxjCU0/GO7EgZ7ELUh0w28SrMSHzO3rH5Wd3is= +github.com/sqlc-dev/pqtype v0.2.0/go.mod h1:oyUjp5981ctiL9UYvj1bVvCKi8OXkCa0u645hce7CAs= 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.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= -github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -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 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= -github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= -github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= -github.com/testcontainers/testcontainers-go v0.11.1/go.mod h1:/V0UVq+1e7NWYoqTPog179clf0Qp9TOyp4EcXaEFQz8= -github.com/tetafro/godot v0.3.7/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= -github.com/tetafro/godot v0.4.2/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= -github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0= -github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0= -github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao= -github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmccombs/hcl2json v0.3.1/go.mod h1:ljY0/prd2IFUF3cagQjV3cpPEEQKzqyGqnKI7m5DBVY= -github.com/tommy-muehle/go-mnd v1.1.1/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= -github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= -github.com/tonistiigi/fsutil v0.0.0-20201103201449-0834f99b7b85/go.mod h1:a7cilN64dG941IOXfhJhlH0qB92hxJ9A1ewrdUmJ6xo= -github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk= -github.com/twitchtv/twirp v8.1.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A= -github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.6 h1:tGiWC9HENWE2tqYycIqFTNorMmFRVhNwCpDOpWqnk8E= -github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ= -github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw= -github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= -github.com/ultraware/whitespace v0.0.4/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= -github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= -github.com/uudashr/gocognit v1.0.1/go.mod h1:j44Ayx2KW4+oB6SWMv8KsmHzZrOInQav7D3cQMJ5JUM= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s= -github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/quicktemplate v1.2.0/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= -github.com/vdemeester/k8s-pkg-credentialprovider v1.17.4/go.mod h1:inCTmtUdr5KJbreVojo06krnTgaeAz/Z7lynpPk/Q2c= -github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= -github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= -github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= -github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= -github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= -github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= -github.com/vmware/govmomi v0.20.3/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= -github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= -github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= -github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug= -github.com/xanzy/go-gitlab v0.32.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug= -github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= -github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= -github.com/yashtewari/glob-intersection v0.0.0-20180916065949-5c77d914dd0b h1:vVRagRXf67ESqAb72hG2C/ZwI8NtJF2u2V76EsuOHGY= -github.com/yashtewari/glob-intersection v0.0.0-20180916065949-5c77d914dd0b/go.mod h1:HptNXiXVDcJjXe9SqMd0v2FsL9f8dz4GnXgltU6q/co= -github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= -github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= -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/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA= -github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= -github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= -github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= -github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.6.1/go.mod h1:VDR4+I79ubFBGm1uJac1226K5yANQFHeauxPBoP54+o= -github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty v1.8.3/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty v1.9.1/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= -github.com/zclconf/go-cty-yaml v1.0.2/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= -go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= -go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go.opencensus.io v0.19.1/go.mod h1:gug0GbSHa8Pafr0d2urOSgoXHZ6x/RUlaiT0d9pqb4A= -go.opencensus.io v0.19.2/go.mod h1:NO/8qkisMZLZ1FCsKNqtJPwc8/TaclWyY0B6wcYNg9M= -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.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -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.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q= -go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -gocloud.dev v0.19.0/go.mod h1:SmKwiR8YwIMMJvQBKLsC3fHNyMwXLw3PMDO+VVteJMI= -golang.org/x/build v0.0.0-20190314133821-5284462c4bec/go.mod h1:atTaCNAy0f16Ah5aV1gMSwgiKVHwu/JncqDpuRr7lS4= -golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +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.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.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -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-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/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-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -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/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/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/lint v0.0.0-20210508222113-6edffad5e616/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.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-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180811021610-c39426892332/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-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/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-20190125091013-d26f9f9a57f3/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-20190327091125-710a502c58a2/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-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +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/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 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-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191112182307-2180aed22343/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-20200520004742-59133d7f0dd7/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-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -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-20201110031124-69a78807bb2b/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-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw= -golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/oauth2 v0.0.0-20180724155351-3d292e4d0cdc/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/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-20190402181905-9f3314589c9a/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/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c h1:pkQiBZBvdos9qq4wBAHqlzuZHEXo07pqV06ef90u1WI= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= -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/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= 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.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -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-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181218192612-074acd46bca6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-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-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-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190620070143-6f217b454f45/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190812073006-9eafafc0a87e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/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-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/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-20200217220822-9197077df867/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-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200917073148-efd3b9a0ff20/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201013081832-0aaa2718063a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/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-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/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-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= 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.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -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/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190221204921-83362c3779f5/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -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-20190311215038-5c2858a9cfe5/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-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190509153222-73554e0f7805/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/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-20190614205625-5aca471b1d59/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-20190624222133-a101b041ded4/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-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= -golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/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-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191011211836-4c025a95b26e/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-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/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-20191113232020-e2727e816f5a/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-20200102140908-9497f49d5709/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-20200204192400-7124308813f3/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-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200331202046-9d5940d49312/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200502202811-ed308ab3e770/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-20200619180055-7c47624df98f/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-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 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 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ= -google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.2.0/go.mod h1:IfRCZScioGtypHNTlz3gFk67J8uePVW7uDTBzXuIkhU= -google.golang.org/api v0.3.0/go.mod h1:IuvZyQh8jgscv8qWfQ4ABd8m7hEudgBFM/EdhA3BnXw= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.5.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.6.0/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4= -google.golang.org/api v0.6.1-0.20190607001116-5213b8090861/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4= -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.25.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/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= -google.golang.org/api v0.47.0 h1:sQLWZQvP6jPGIP4JGPkJu4zHswrv81iobiyszr3b/0I= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -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 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -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-20190508193815-b515fa19cec8/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190522204451-c2c4e71fbf69/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190620144150-6af8c5fc6601/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -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-20200117163144-32f20d992d24/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-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -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-20201110150050-8816d57aaa9a/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-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -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.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -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.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= -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.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -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/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/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-20190902080502-41f04d3bba15/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/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk= -gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.0/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= -gopkg.in/go-playground/validator.v9 v9.30.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.1/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -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.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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 v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -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= -honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.0.0-20180904230853-4e7be11eab3f/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= -k8s.io/api v0.17.4/go.mod h1:5qxx6vjmwUVG2nHQTKGlLts8Tbok8PzHl4vHtVFuZCA= -k8s.io/api v0.19.0/go.mod h1:I1K45XlvTrDjmj5LoM5LuP/KYrhWbjUKT/SoPG0qTjw= -k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= -k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= -k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= -k8s.io/apimachinery v0.0.0-20180904193909-def12e63c512/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= -k8s.io/apimachinery v0.17.4/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g= -k8s.io/apimachinery v0.19.0/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= -k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= -k8s.io/apiserver v0.17.4/go.mod h1:5ZDQ6Xr5MNBxyi3iUZXS84QOhZl+W7Oq2us/29c0j9I= -k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= -k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= -k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= -k8s.io/client-go v0.0.0-20180910083459-2cefa64ff137/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= -k8s.io/client-go v0.17.4/go.mod h1:ouF6o5pz3is8qU0/qYL2RnoxOPqgfuidYLowytyLJmc= -k8s.io/client-go v0.19.0/go.mod h1:H9E/VT95blcFQnlyShFgnFT9ZnJOAceiUHM3MlRC+mU= -k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= -k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= -k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= -k8s.io/cloud-provider v0.17.4/go.mod h1:XEjKDzfD+b9MTLXQFlDGkk6Ho8SGMpaU8Uugx/KNK9U= -k8s.io/code-generator v0.17.2/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= -k8s.io/component-base v0.17.4/go.mod h1:5BRqHMbbQPm2kKu35v3G+CpVq4K0RJKC7TRioF0I9lE= -k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= -k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= -k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= -k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= -k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= -k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= -k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= -k8s.io/csi-translation-lib v0.17.4/go.mod h1:CsxmjwxEI0tTNMzffIAcgR9lX4wOh6AKHdxQrT7L0oo= -k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/kube-openapi v0.0.0-20180731170545-e3762e86a74c/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc= -k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= -k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= -k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= -k8s.io/kubernetes v1.11.10/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= -k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= -k8s.io/legacy-cloud-providers v0.17.4/go.mod h1:FikRNoD64ECjkxO36gkDgJeiQWwyZTuBkhu+yxOc1Js= -k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= -k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= -modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= -modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= -modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= -modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= -moul.io/http2curl v1.0.0/go.mod h1:f6cULg+e4Md/oW1cYmwW4IWQOVl2lGbmCNGOHvzX2kE= -mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= -mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw= -mvdan.cc/unparam v0.0.0-20200501210554-b37ab49443f7/go.mod h1:HGC5lll35J70Y5v7vCGb9oLhHoScFwkHDJm/05RdSTc= -pack.ag/amqp v0.11.2/go.mod h1:4/cbmt4EJXSKlG6LCfWHoqmN0uFdy5i/+YFz+fTfhV4= -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= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= -sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06/go.mod h1:/ULNhyfzRopfcjskuui0cTITekDduZ7ycKN3oUT9R18= -sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= -sourcegraph.com/sqs/pbtypes v1.0.0/go.mod h1:3AciMUv4qUuRHRHhOG4TZOB+72GdPVz5k+c648qsFS4= diff --git a/main.go b/main.go index 8883a13..e3cd7ad 100644 --- a/main.go +++ b/main.go @@ -3,9 +3,11 @@ package main import ( "os" - "github.com/m-mizutani/octovy/pkg/controller" + "github.com/m-mizutani/octovy/pkg/controller/cli" ) func main() { - _ = controller.New().RunCmd(os.Args) + if err := cli.New().Run(os.Args); err != nil { + os.Exit(1) + } } diff --git a/pkg/controller/cli.go b/pkg/controller/cli.go deleted file mode 100644 index 2a67a7e..0000000 --- a/pkg/controller/cli.go +++ /dev/null @@ -1,262 +0,0 @@ -package controller - -import ( - "fmt" - "io/ioutil" - "os" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/controller/server" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra" - "github.com/m-mizutani/octovy/pkg/usecase" - "github.com/m-mizutani/octovy/pkg/utils" - "github.com/urfave/cli/v2" -) - -var logger = utils.Logger - -func (x *Controller) RunCmd(args []string) error { - app := &cli.App{ - Name: "octovy", - Version: model.Version, - Description: "Vulnerability management service for GitHub repository", - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "log-level", - Aliases: []string{"l"}, - EnvVars: []string{"OCTOVY_LOG_LEVEL"}, - Value: "info", - Usage: "LogLevel [trace|debug|info|warn|error]", - }, - &cli.StringFlag{ - Name: "log-format", - EnvVars: []string{"OCTOVY_LOG_FORMAT"}, - Value: "console", - Usage: "LogFormat [console|json]", - }, - }, - Commands: []*cli.Command{ - newServeCommand(x), - }, - Before: func(c *cli.Context) error { - if err := globalSetup(c); err != nil { - return err - } - return nil - }, - } - - if err := app.Run(os.Args); err != nil { - logger.With("config", x.Config).With("err", err).Error("Failed") - return err - } - - return nil -} - -func globalSetup(c *cli.Context) error { - // Setup logger - if err := utils.SetLogLevel(c.String("log-level")); err != nil { - return goerr.Wrap(err) - } - if err := utils.SetLogFormat(c.String("log-format")); err != nil { - return goerr.Wrap(err) - } - - return nil -} - -func newServeCommand(ctrl *Controller) *cli.Command { - var checkRuleFile string - var infraCfg infra.Config - - return &cli.Command{ - Name: "serve", - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "addr", - Usage: "server binding address", - Aliases: []string{"a"}, - EnvVars: []string{"OCTOVY_ADDR"}, - Destination: &ctrl.Config.ServerAddr, - Value: "127.0.0.1", - }, - &cli.IntFlag{ - Name: "port", - Usage: "Port number", - Aliases: []string{"p"}, - EnvVars: []string{"OCTOVY_PORT"}, - Destination: &ctrl.Config.ServerPort, - Value: 9080, - }, - - &cli.StringFlag{ - Name: "db-type", - Usage: "Database type [postgres|sqlite3]", - EnvVars: []string{"OCTOVY_DB_TYPE"}, - Destination: &infraCfg.DBType, - Value: "sqlite3", - }, - &cli.StringFlag{ - Name: "db-config", - Usage: "Database config as DSN", - EnvVars: []string{"OCTOVY_DB_CONFIG"}, - Destination: &infraCfg.DBConfig, - Value: "file:ent?mode=memory&cache=shared&_fk=1", - }, - - &cli.StringFlag{ - Name: "frontend-url", - EnvVars: []string{"OCTOVY_FRONTEND_URL"}, - Destination: &ctrl.Config.FrontendURL, - Required: true, - }, - - &cli.BoolFlag{ - Name: "disable-webhook-github", - Usage: "Disable github webhook", - Destination: &ctrl.Config.DisableWebhookGitHub, - EnvVars: []string{"OCTOVY_DISABLE_WEBHOOK_GITHUB"}, - }, - &cli.BoolFlag{ - Name: "disable-webhook-trivy", - Usage: "Disable trivy webhook", - Destination: &ctrl.Config.DisableWebhookTrivy, - EnvVars: []string{"OCTOVY_DISABLE_WEBHOOK_TRIVY"}, - }, - &cli.BoolFlag{ - Name: "disable-frontend", - Usage: "Disable frontend content/API", - Destination: &ctrl.Config.DisableFrontend, - EnvVars: []string{"OCTOVY_DISABLE_FRONTEND"}, - }, - - &cli.Int64Flag{ - Name: "github-app-id", - EnvVars: []string{"OCTOVY_GITHUB_APP_ID"}, - Destination: &infraCfg.GitHubAppID, - Required: true, - }, - &cli.PathFlag{ - Name: "github-app-private-key", - EnvVars: []string{"OCTOVY_GITHUB_APP_PRIVATE_KEY"}, - Usage: "GitHub App private key data (not file path)", - Destination: &infraCfg.GitHubAppPrivateKey, - Required: true, - }, - &cli.StringFlag{ - Name: "github-app-client-id", - EnvVars: []string{"OCTOVY_GITHUB_CLIENT_ID"}, - Destination: &infraCfg.GitHubAppClientID, - Required: true, - }, - &cli.StringFlag{ - Name: "github-app-client-secret", - EnvVars: []string{"OCTOVY_GITHUB_SECRET"}, - Destination: &infraCfg.GitHubAppSecret, - Required: true, - }, - &cli.StringFlag{ - Name: "github-webhook-secret", - EnvVars: []string{"OCTOVY_GITHUB_WEBHOOK_SECRET"}, - Destination: &ctrl.Config.GitHubWebhookSecret, - Usage: "Verify webhook request with the secret", - }, - - &cli.StringFlag{ - Name: "check-policy-data", - EnvVars: []string{"OCTOVY_CHECK_POLICY_DATA"}, - Destination: &infraCfg.CheckPolicyData, - Usage: "Check result policy in Rego (plain text)", - }, - &cli.StringFlag{ - Name: "check-policy-file", - EnvVars: []string{"OCTOVY_CHECK_POLICY_FILE"}, - Destination: &checkRuleFile, - Usage: "Check result policy in Rego (file path)", - }, - - &cli.StringFlag{ - Name: "opa-url", - EnvVars: []string{"OCTOVY_OPA_URL"}, - Destination: &infraCfg.OPA.BaseURL, - }, - &cli.StringFlag{ - Name: "opa-path", - EnvVars: []string{"OCTOVY_OPA_PATH"}, - Destination: &infraCfg.OPA.Path, - }, - &cli.BoolFlag{ - Name: "opa-use-iap", - EnvVars: []string{"OCTOVY_OPA_IAP"}, - Destination: &infraCfg.OPA.UseGoogleIAP, - }, - - &cli.StringFlag{ - Name: "trivy-path", - EnvVars: []string{"OCTOVY_TRIVY_PATH"}, - Destination: &infraCfg.TrivyPath, - }, - - &cli.StringFlag{ - Name: "sentry-dsn", - EnvVars: []string{"SENTRY_DSN"}, - Destination: &ctrl.Config.SentryDSN, - }, - &cli.StringFlag{ - Name: "sentry-env", - EnvVars: []string{"SENTRY_ENV"}, - Destination: &ctrl.Config.SentryEnv, - }, - }, - Action: func(c *cli.Context) error { - if checkRuleFile != "" { - raw, err := ioutil.ReadFile(checkRuleFile) - if err != nil { - return goerr.Wrap(err, "fail to read check rule file") - } - if infraCfg.CheckPolicyData != "" { - logger.With("existed", infraCfg.CheckPolicyData).Warn("both of --check-rule-file and --check-rule-data are specified. check-rule-data will be overwritten") - } - infraCfg.CheckPolicyData = string(raw) - } - - clients, err := infra.New(&infraCfg) - if err != nil { - return err - } - uc, err := usecase.New(ctrl.Config, clients) - if err != nil { - return err - } - defer uc.Close() - - serverAddr := fmt.Sprintf("%s:%d", ctrl.Config.ServerAddr, ctrl.Config.ServerPort) - - var options []server.Option - if ctrl.Config.DisableFrontend { - options = append(options, server.DisableFrontend()) - } - if ctrl.Config.DisableWebhookGitHub { - options = append(options, server.DisableWebhookGitHub()) - } - if ctrl.Config.DisableWebhookTrivy { - options = append(options, server.DisableWebhookTrivy()) - } - engine := server.New(uc, options...) - - gin.SetMode(gin.DebugMode) - - logger.With("config", ctrl.Config).With("infra", infraCfg).Info("Starting server...") - if err := engine.Run(serverAddr); err != nil { - return err - } - return nil - }, - After: func(c *cli.Context) error { - return nil - }, - } -} diff --git a/pkg/controller/cli/cli.go b/pkg/controller/cli/cli.go new file mode 100644 index 0000000..3537bb9 --- /dev/null +++ b/pkg/controller/cli/cli.go @@ -0,0 +1,71 @@ +package cli + +import ( + "github.com/m-mizutani/octovy/pkg/controller/cli/scan" + "github.com/m-mizutani/octovy/pkg/controller/cli/serve" + "github.com/m-mizutani/octovy/pkg/utils" + "github.com/urfave/cli/v2" +) + +type CLI struct { +} + +func New() *CLI { + return &CLI{} +} + +func (x *CLI) Run(argv []string) error { + var ( + logLevel string + logFormat string + logOutput string + ) + + app := &cli.App{ + Name: "octovy", + Usage: "Vulnerability management system with Trivy", + Flags: []cli.Flag{ + &cli.StringFlag{ + Name: "log-level", + Usage: "Log level [trace|debug|info|warn|error]", + Aliases: []string{"l"}, + EnvVars: []string{"OCTOVY_LOG_LEVEL"}, + Destination: &logLevel, + Value: "info", + }, + &cli.StringFlag{ + Name: "log-format", + Usage: "Log format [text|json]", + Aliases: []string{"f"}, + EnvVars: []string{"OCTOVY_LOG_FORMAT"}, + Destination: &logFormat, + Value: "text", + }, + &cli.StringFlag{ + Name: "log-output", + Usage: "Log output [-|stdout|stderr|]", + Aliases: []string{"o"}, + EnvVars: []string{"OCTOVY_LOG_OUTPUT"}, + Destination: &logOutput, + Value: "-", + }, + }, + Commands: []*cli.Command{ + serve.New(), + scan.New(), + }, + Before: func(ctx *cli.Context) error { + if err := utils.ReconfigureLogger(logFormat, logLevel, logOutput); err != nil { + return err + } + return nil + }, + } + + if err := app.Run(argv); err != nil { + utils.Logger().Error("fatal error", "error", err) + return err + } + + return nil +} diff --git a/pkg/controller/cli/config/db.go b/pkg/controller/cli/config/db.go new file mode 100644 index 0000000..5741a6e --- /dev/null +++ b/pkg/controller/cli/config/db.go @@ -0,0 +1,93 @@ +package config + +import ( + "fmt" + "strings" + + "github.com/urfave/cli/v2" +) + +type DB struct { + User string + Password string `masq:"secret"` + Host string + Port int + DBName string + SSLMode string +} + +func (x *DB) Flags() []cli.Flag { + return []cli.Flag{ + &cli.StringFlag{ + Name: "db-user", + Category: "Database", + Usage: "database user", + EnvVars: []string{"OCTOVY_DB_USER"}, + Required: true, + Destination: &x.User, + }, + &cli.StringFlag{ + Name: "db-password", + Category: "Database", + Usage: "database password", + EnvVars: []string{"OCTOVY_DB_PASSWORD"}, + Destination: &x.Password, + }, + &cli.StringFlag{ + Name: "db-host", + Category: "Database", + Usage: "database host", + EnvVars: []string{"OCTOVY_DB_HOST"}, + Destination: &x.Host, + Value: "localhost", + }, + &cli.IntFlag{ + Name: "db-port", + Category: "Database", + Usage: "database port", + EnvVars: []string{"OCTOVY_DB_PORT"}, + Destination: &x.Port, + Value: 5432, + }, + &cli.StringFlag{ + Name: "db-name", + Category: "Database", + Usage: "database name", + EnvVars: []string{"OCTOVY_DB_NAME"}, + Required: true, + Destination: &x.DBName, + }, + &cli.StringFlag{ + Name: "db-ssl-mode", + Category: "Database", + Usage: "database SSL mode", + EnvVars: []string{"OCTOVY_DB_SSL_MODE"}, + Destination: &x.SSLMode, + Value: "disable", + }, + } +} + +func (x *DB) DSN() string { + var options []string + if x.User != "" { + options = append(options, "user="+x.User) + } + if x.Password != "" { + options = append(options, "password="+x.Password) + } + if x.Host != "" { + options = append(options, "host="+x.Host) + } + if x.Port != 0 { + options = append(options, "port="+fmt.Sprintf("%d", x.Port)) + } + if x.DBName != "" { + options = append(options, "dbname="+x.DBName) + } + if x.SSLMode != "" { + options = append(options, "sslmode="+x.SSLMode) + } + + return strings.Join(options, " ") +} diff --git a/pkg/controller/cli/config/github_app.go b/pkg/controller/cli/config/github_app.go new file mode 100644 index 0000000..e7f3246 --- /dev/null +++ b/pkg/controller/cli/config/github_app.go @@ -0,0 +1,41 @@ +package config + +import ( + "github.com/m-mizutani/octovy/pkg/domain/types" + "github.com/urfave/cli/v2" +) + +type GitHubApp struct { + ID types.GitHubAppID + Secret types.GitHubAppSecret + PrivateKey types.GitHubAppPrivateKey +} + +func (x *GitHubApp) Flags() []cli.Flag { + return []cli.Flag{ + &cli.Int64Flag{ + Name: "github-app-id", + Usage: "GitHub App ID", + Category: "GitHub App", + Destination: (*int64)(&x.ID), + EnvVars: []string{"OCTOVY_GITHUB_APP_ID"}, + Required: true, + }, + &cli.StringFlag{ + Name: "github-app-secret", + Usage: "GitHub App Secret", + Category: "GitHub App", + Destination: (*string)(&x.Secret), + EnvVars: []string{"OCTOVY_GITHUB_APP_SECRET"}, + Required: true, + }, + &cli.StringFlag{ + Name: "github-app-private-key", + Usage: "GitHub App Private Key", + Category: "GitHub App", + Destination: (*string)(&x.PrivateKey), + EnvVars: []string{"OCTOVY_GITHUB_APP_PRIVATE_KEY"}, + Required: true, + }, + } +} diff --git a/pkg/controller/cli/migrate/migrate.go b/pkg/controller/cli/migrate/migrate.go new file mode 100644 index 0000000..fd6ae4b --- /dev/null +++ b/pkg/controller/cli/migrate/migrate.go @@ -0,0 +1,78 @@ +package migrate + +/* +import ( + "log/slog" + "os" + + "github.com/k0kubun/sqldef" + "github.com/k0kubun/sqldef/database" + "github.com/k0kubun/sqldef/database/postgres" + "github.com/k0kubun/sqldef/schema" + "github.com/m-mizutani/goerr" + "github.com/m-mizutani/gots/slice" + "github.com/urfave/cli/v2" + + db "github.com/m-mizutani/octovy/database" + "github.com/m-mizutani/octovy/pkg/controller/cli/config" + "github.com/m-mizutani/octovy/pkg/utils" +) + +func New() *cli.Command { + var ( + dryRun bool + dbConfig config.DB + ) + + baseFlags := []cli.Flag{ + &cli.BoolFlag{ + Name: "dry-run", + Usage: "Dry run mode", + Destination: &dryRun, + }, + } + + return &cli.Command{ + Name: "migrate", + Usage: "Migrate database", + Flags: slice.Flatten( + baseFlags, + dbConfig.Flags(), + ), + Action: func(c *cli.Context) error { + utils.Logger().Info("migrating database", slog.Any("config.DB", dbConfig)) + + options := &sqldef.Options{ + DesiredDDLs: db.Schema(), + DryRun: dryRun, + Export: false, + EnableDropTable: true, + // BeforeApply: opts.BeforeApply, + // Config: database.ParseGeneratorConfig(opts.Config), + } + + config := database.Config{ + DbName: dbConfig.DBName, + User: dbConfig.User, + Password: dbConfig.Password, + Host: dbConfig.Host, + Port: dbConfig.Port, + } + if err := os.Setenv("PGSSLMODE", dbConfig.SSLMode); err != nil { + return goerr.Wrap(err, "failed to set PGSSLMODE") + } + + db, err := postgres.NewDatabase(config) + if err != nil { + return goerr.Wrap(err, "failed to open database") + } + defer utils.SafeClose(db) + + sqlParser := postgres.NewParser() + sqldef.Run(schema.GeneratorModePostgres, db, sqlParser, options) + + return nil + }, + } +} +*/ diff --git a/pkg/controller/cli/scan/cli.go b/pkg/controller/cli/scan/cli.go new file mode 100644 index 0000000..1964033 --- /dev/null +++ b/pkg/controller/cli/scan/cli.go @@ -0,0 +1,26 @@ +package scan + +import ( + "github.com/urfave/cli/v2" +) + +func New() *cli.Command { + var ( + dir string + ) + return &cli.Command{ + Name: "scan", + Usage: "Local scan mode", + Flags: []cli.Flag{ + &cli.StringFlag{ + Name: "dir", + Usage: "Target directory", + Value: ".", + Destination: &dir, + }, + }, + Action: func(ctx *cli.Context) error { + return nil + }, + } +} diff --git a/pkg/controller/cli/serve/serve.go b/pkg/controller/cli/serve/serve.go new file mode 100644 index 0000000..e89e0ec --- /dev/null +++ b/pkg/controller/cli/serve/serve.go @@ -0,0 +1,126 @@ +package serve + +import ( + "context" + "database/sql" + "log/slog" + "net/http" + "os" + "os/signal" + "syscall" + "time" + + "github.com/m-mizutani/goerr" + "github.com/m-mizutani/gots/slice" + "github.com/m-mizutani/octovy/pkg/controller/cli/config" + "github.com/m-mizutani/octovy/pkg/controller/server" + "github.com/m-mizutani/octovy/pkg/infra" + "github.com/m-mizutani/octovy/pkg/infra/gh" + "github.com/m-mizutani/octovy/pkg/infra/trivy" + "github.com/m-mizutani/octovy/pkg/usecase" + "github.com/m-mizutani/octovy/pkg/utils" + + "github.com/urfave/cli/v2" + + _ "github.com/lib/pq" +) + +func New() *cli.Command { + var ( + addr string + trivyPath string + + githubApp config.GitHubApp + database config.DB + ) + serveFlags := []cli.Flag{ + &cli.StringFlag{ + Name: "addr", + Usage: "Binding address", + Value: "127.0.0.1:8000", + EnvVars: []string{"OCTOVY_ADDR"}, + Destination: &addr, + }, + &cli.StringFlag{ + Name: "trivy-path", + Usage: "Path to trivy binary", + Value: "trivy", + EnvVars: []string{"OCTOVY_TRIVY_PATH"}, + Destination: &trivyPath, + }, + } + + return &cli.Command{ + Name: "serve", + Usage: "Server mode", + Flags: slice.Flatten( + serveFlags, + githubApp.Flags(), + database.Flags(), + ), + Action: func(c *cli.Context) error { + utils.Logger().Info("starting serve", + slog.Any("addr", addr), + slog.Any("trivyPath", trivyPath), + slog.Any("githubApp", githubApp), + slog.Any("database", database), + ) + + ghApp, err := gh.New(githubApp.ID, githubApp.PrivateKey) + if err != nil { + return err + } + + dbClient, err := sql.Open("postgres", database.DSN()) + if err != nil { + return goerr.Wrap(err, "failed to open database") + } + defer utils.SafeClose(dbClient) + + clients := infra.New( + infra.WithGitHubApp(ghApp), + infra.WithTrivy(trivy.New(trivyPath)), + infra.WithDB(dbClient), + ) + uc := usecase.New(clients) + s := server.New(uc, githubApp.Secret) + + serverErr := make(chan error, 1) + httpServer := &http.Server{ + Addr: addr, + Handler: s.Mux(), + + ReadHeaderTimeout: 10 * time.Second, + ReadTimeout: 30 * time.Second, + WriteTimeout: 30 * time.Second, + } + + go func() { + utils.Logger().Info("starting http server", "addr", addr) + if err := httpServer.ListenAndServe(); err != http.ErrServerClosed { + serverErr <- goerr.Wrap(err, "failed to listen and serve") + } + }() + + quit := make(chan os.Signal, 1) + signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) + + select { + case err := <-serverErr: + return err + + case sig := <-quit: + utils.Logger().Info("shutting down server", "signal", sig) + + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + + if err := httpServer.Shutdown(ctx); err != nil { + return goerr.Wrap(err, "failed to shutdown server") + } + } + + return nil + }, + } +} diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go deleted file mode 100644 index 917cc07..0000000 --- a/pkg/controller/controller.go +++ /dev/null @@ -1,16 +0,0 @@ -package controller - -import ( - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -type Controller struct { - Config *model.Config -} - -func New() *Controller { - var cfg model.Config - return &Controller{ - Config: &cfg, - } -} diff --git a/pkg/controller/server/api.go b/pkg/controller/server/api.go deleted file mode 100644 index 3fed058..0000000 --- a/pkg/controller/server/api.go +++ /dev/null @@ -1,129 +0,0 @@ -package server - -import ( - "errors" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/goerr" - - "github.com/m-mizutani/octovy/pkg/usecase" -) - -const ( - contextUsecase = "usecase" - contextRequestIDKey = "requestID" - contextLogger = "logger" - contextSession = "session" - - cookieSessionID = "session_id" - cookieSessionSecret = "secret" - cookieReferrerName = "referrer" -) - -type baseResponse struct { - Data interface{} `json:"data"` -} - -type errorResponse struct { - Error string `json:"error"` - Values map[string]interface{} `json:"values"` -} - -func errResp(c *gin.Context, code int, err error) { - var gErr *goerr.Error - - switch { - case errors.As(err, &gErr): - c.JSON(code, &errorResponse{ - Error: gErr.Error(), - Values: gErr.Values(), - }) - default: - c.JSON(code, &errorResponse{ - Error: err.Error(), - }) - } -} - -type config struct { - DisableAuth bool - DisableWebhookGitHub bool - DisableWebhookTrivy bool - DisableFrontend bool -} - -func New(uc *usecase.Usecase, options ...Option) *gin.Engine { - engine := gin.New() - engine.Use(gin.Recovery()) - engine.RedirectTrailingSlash = false - - var cfg config - for _, opt := range options { - opt(&cfg) - } - - engine.Use(func(c *gin.Context) { - c.Set(contextUsecase, uc) - }) - engine.Use(requestLogging) - if !cfg.DisableAuth { - engine.Use(authControl) - } - if !cfg.DisableFrontend { - engine.Use(getStaticFile) - } - engine.Use(errorHandler) - - if !cfg.DisableWebhookGitHub { - engine.POST("/webhook/github", postWebhookGitHub) - } - if !cfg.DisableWebhookTrivy { - engine.POST("/webhook/trivy", postWebhookTrivy) - } - - if !cfg.DisableFrontend { - engine.GET("/auth/github", getAuthGitHub) - engine.GET("/auth/github/callback", getAuthGitHubCallback) - - r := engine.Group("/api/v1") - - r.GET("/repository", getRepositories) - r.GET("/repository/:owner/:repo", getRepository) - r.GET("/repository/:owner/:repo/scan", getRepositoryScan) - r.GET("/vulnerability", getVulnerabilities) - r.GET("/vulnerability/:vuln_id", getVulnerability) - r.POST("/vulnerability", postVulnerability) - r.GET("/scan/:scan_id", getScanReport) - r.GET("/scan/:scan_id/report", getScanPackages) - - r.POST("/status/:owner/:repo_name", postVulnStatus) - r.GET("/user", getUser) - - r.GET("/severity", getSeverities) - r.POST("/severity", createSeverity) - r.PUT("/severity/:id", updateSeverity) - r.POST("/severity/:id/assign/:vuln_id", assignSeverity) - r.DELETE("/severity/:id", deleteSeverity) - - r.GET("/repo-label", getRepoLabels) - r.POST("/repo-label", createRepoLabel) - r.PUT("/repo-label/:id", updateRepoLabel) - r.POST("/repo-label/:id/assign/:repo_id", assignRepoLabel) - r.DELETE("/repo-label/:id/assign/:repo_id", unassignRepoLabel) - r.DELETE("/repo-label/:id", deleteRepoLabel) - } - - return engine -} - -func getUsecase(c *gin.Context) *usecase.Usecase { - v, ok := c.Get(contextUsecase) - if !ok { - panic("No config in contextUsecase") - } - uc, ok := v.(*usecase.Usecase) - if !ok { - panic("Type mismatch for contextUsecase") - } - return uc -} diff --git a/pkg/controller/server/api_test.go b/pkg/controller/server/api_test.go deleted file mode 100644 index 40db0b1..0000000 --- a/pkg/controller/server/api_test.go +++ /dev/null @@ -1,148 +0,0 @@ -package server_test - -import ( - "bytes" - "encoding/json" - "io" - "net/http" - "net/http/httptest" - "testing" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/octovy/pkg/controller/server" - "github.com/m-mizutani/octovy/pkg/infra/db" - "github.com/m-mizutani/octovy/pkg/usecase" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func newServer(t *testing.T) *gin.Engine { - uc := usecase.NewTest(t) - engine := server.New(uc, server.DisableAuth()) - return engine -} - -func newServerWithDB(t *testing.T, client *db.Client, options ...server.Option) *gin.Engine { - uc := usecase.NewTest(t, usecase.OptInjectDB(client)) - options = append(options, server.DisableAuth()) - engine := server.New(uc, options...) - return engine -} - -func bind(t *testing.T, body *bytes.Buffer, v interface{}) { - var resp server.BaseResponse - require.NoError(t, json.Unmarshal(body.Bytes(), &resp)) - - raw, err := json.Marshal(resp.Data) - require.NoError(t, err) - require.NoError(t, json.Unmarshal(raw, v)) -} - -func newRequest(method, url string, data interface{}) *http.Request { - var body io.Reader - if data != nil { - raw, err := json.Marshal(data) - if err != nil { - panic(err) - } - body = bytes.NewReader(raw) - } - req, err := http.NewRequest(method, url, body) - if err != nil { - panic(err) - } - return req -} - -func TestDisableGitHub(t *testing.T) { - t.Run("test disable webhook-github", func(t *testing.T) { - mock := db.NewMock(t) - s := newServerWithDB(t, mock, server.DisableWebhookGitHub()) - - { - w := httptest.NewRecorder() - req, err := http.NewRequest("POST", "http://localhost/webhook/github", nil) - require.NoError(t, err) - s.ServeHTTP(w, req) - assert.Equal(t, http.StatusNotFound, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req, err := http.NewRequest("POST", "http://localhost/webhook/trivy", nil) - require.NoError(t, err) - s.ServeHTTP(w, req) - assert.NotEqual(t, http.StatusNotFound, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req, err := http.NewRequest("GET", "http://localhost/api/v1/repository", nil) - require.NoError(t, err) - s.ServeHTTP(w, req) - assert.NotEqual(t, http.StatusNotFound, w.Result().StatusCode) - } - }) -} - -func TestDisableTrivy(t *testing.T) { - t.Run("test disable webhook-trivy", func(t *testing.T) { - mock := db.NewMock(t) - s := newServerWithDB(t, mock, server.DisableWebhookTrivy()) - { - w := httptest.NewRecorder() - req, err := http.NewRequest("POST", "http://localhost/webhook/github", nil) - require.NoError(t, err) - s.ServeHTTP(w, req) - assert.NotEqual(t, http.StatusNotFound, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req, err := http.NewRequest("POST", "http://localhost/webhook/trivy", nil) - require.NoError(t, err) - s.ServeHTTP(w, req) - assert.Equal(t, http.StatusNotFound, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req, err := http.NewRequest("GET", "http://localhost/api/v1/repository", nil) - require.NoError(t, err) - s.ServeHTTP(w, req) - assert.NotEqual(t, http.StatusNotFound, w.Result().StatusCode) - } - - }) -} - -func TestDisableFrontend(t *testing.T) { - t.Run("test disable frontend", func(t *testing.T) { - mock := db.NewMock(t) - s := newServerWithDB(t, mock, server.DisableFrontend()) - - { - w := httptest.NewRecorder() - req, err := http.NewRequest("POST", "http://localhost/webhook/github", nil) - require.NoError(t, err) - s.ServeHTTP(w, req) - assert.NotEqual(t, http.StatusNotFound, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req, err := http.NewRequest("POST", "http://localhost/webhook/trivy", nil) - require.NoError(t, err) - s.ServeHTTP(w, req) - assert.NotEqual(t, http.StatusNotFound, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req, err := http.NewRequest("GET", "http://localhost/api/v1/repository", nil) - require.NoError(t, err) - s.ServeHTTP(w, req) - assert.Equal(t, http.StatusNotFound, w.Result().StatusCode) - } - }) -} diff --git a/pkg/controller/server/assets.go b/pkg/controller/server/assets.go deleted file mode 100644 index 3867ff2..0000000 --- a/pkg/controller/server/assets.go +++ /dev/null @@ -1,137 +0,0 @@ -package server - -import ( - "crypto/sha256" - "fmt" - "net/http" - "path/filepath" - "regexp" - "strings" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/octovy/assets" - "github.com/m-mizutani/octovy/pkg/utils" -) - -type fileCache struct { - data []byte - eTag string -} -type cacheMap map[string]*fileCache - -var assetCache = cacheMap{} - -func (x cacheMap) Read(fname string) *fileCache { - asset := assets.Assets() - c, ok := x[fname] - if !ok { - data, err := asset.ReadFile(filepath.Join("out", fname)) - if err != nil { - utils.Logger.With("path", fname).With("error", err).Debug("failed to open requested file") - return nil - } - - c = &fileCache{ - data: data, - eTag: fmt.Sprintf("%x", sha256.Sum256(data)), - } - } - - return c -} - -type extTypeMap map[string]string - -var extMap = extTypeMap{ - ".html": "text/html", - ".js": "application/javascript", -} - -func (x extTypeMap) Find(path string) string { - for ext, contentType := range x { - if strings.HasSuffix(path, ext) { - return contentType - } - } - - return "text/html" -} - -type rewriteRoute struct { - ptn *regexp.Regexp - fname string -} - -type rewriteRoutes []*rewriteRoute - -func (x rewriteRoutes) Rewrite(path string) string { - for _, route := range x { - if route.ptn.MatchString(path) { - return route.fname - } - } - return path -} - -var nextRoutes = rewriteRoutes{ - { - ptn: regexp.MustCompile("^scan/[a-z0-9-]+$"), - fname: "scan/[id].html", - }, - { - ptn: regexp.MustCompile("^vulnerability$"), - fname: "vulnerability.html", - }, - { - ptn: regexp.MustCompile("^vulnerability/[A-Za-z0-9-.]+$"), - fname: "vulnerability/[id].html", - }, - { - ptn: regexp.MustCompile("^login$"), - fname: "login.html", - }, - { - ptn: regexp.MustCompile("^config$"), - fname: "config.html", - }, - { - ptn: regexp.MustCompile("^repository/[A-Za-z0-9-.]+/[A-Za-z0-9-.]+$"), - fname: "repository/[owner]/[repo].html", - }, -} - -func getStaticFile(c *gin.Context) { - c.Next() - logger := getLog(c) - - logger.With("url", c.Request.URL).Info("fallback to static file") - - if c.Writer.Status() != http.StatusNotFound || - strings.HasPrefix(c.Request.URL.Path, "/webhook/") { - return - } - - fname := nextRoutes.Rewrite(strings.Trim(c.Request.URL.Path, "/")) - logger.With("req", c.Request.URL).With("rewrite", fname).Debug("accessing static file") - - if fname == "" { - fname = "index.html" - } - - cache := assetCache.Read(fname) - if cache == nil { - return - } - - c.Header("Cache-Control", "public, max-age=31536000") - c.Header("ETag", cache.eTag) - - if match := c.GetHeader("If-None-Match"); match != "" { - if strings.Contains(match, cache.eTag) { - c.Status(http.StatusNotModified) - return - } - } - - c.Data(http.StatusOK, extMap.Find(fname), cache.data) -} diff --git a/pkg/controller/server/auth.go b/pkg/controller/server/auth.go deleted file mode 100644 index 81be9d3..0000000 --- a/pkg/controller/server/auth.go +++ /dev/null @@ -1,75 +0,0 @@ -package server - -import ( - "fmt" - "net/http" - "net/url" - "strings" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -func getAuthGitHub(c *gin.Context) { - uc := getUsecase(c) - - state, err := uc.CreateAuthState(model.NewContextWith(c)) - if err != nil { - c.Error(err) - return - } - - clientID := uc.GetGitHubAppClientID() - - v := url.Values{} - v.Set("client_id", clientID) - v.Set("response_type", "code") - v.Set("state", state) - - redirectTo := "https://github.com/login/oauth/authorize?" + v.Encode() - - callback := c.Query("callback") - getLog(c).With("callback", callback).Info("got cookie") - - c.SetCookie(cookieReferrerName, callback, 60, "", "", true, true) - c.Redirect(http.StatusFound, redirectTo) -} - -func getAuthGitHubCallback(c *gin.Context) { - uc := getUsecase(c) - - code := c.Query("code") - state := c.Query("state") - - user, err := uc.AuthGitHubUser(model.NewContextWith(c), code, state) - if err != nil { - errMsg := "Authentication failed in GitHub OAuth procedure, requestID: " - if id, ok := c.Get(contextRequestIDKey); ok { - errMsg += fmt.Sprintf("%s", id) - } else { - errMsg += "unknown" - } - - v := url.Values{} - v.Set("login_error", errMsg) - c.Redirect(http.StatusFound, uc.FrontendURL()+"/login?"+v.Encode()) - return - } - - ssn, err := uc.CreateSession(model.NewContextWith(c), user) - if err != nil { - v := url.Values{} - v.Set("login_error", "Failed to issue session token") - c.Redirect(http.StatusFound, uc.FrontendURL()+"/login?"+v.Encode()) - } - - c.SetCookie(cookieSessionID, ssn.ID, 86400*7, "", "", true, true) - c.SetCookie(cookieSessionSecret, ssn.Token, 86400*7, "", "", true, true) - redirectTo := uc.FrontendURL() - if v, err := c.Cookie(cookieReferrerName); err == nil { - getLog(c).With("referrer", v).Info("got referrer") - redirectTo = redirectTo + "/" + strings.TrimLeft(v, "/") - } - - c.Redirect(http.StatusFound, redirectTo) -} diff --git a/pkg/controller/server/errors.go b/pkg/controller/server/errors.go deleted file mode 100644 index 28c8aa1..0000000 --- a/pkg/controller/server/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package server - -import "github.com/m-mizutani/goerr" - -var ( - // API error - errAPIInvalidParameter = goerr.New("Invalid API parameter") - - errResourceNotFound = goerr.New("Resource not found") -) diff --git a/pkg/controller/server/export_test.go b/pkg/controller/server/export_test.go deleted file mode 100644 index 43cba9f..0000000 --- a/pkg/controller/server/export_test.go +++ /dev/null @@ -1,5 +0,0 @@ -package server - -type BaseResponse baseResponse - -type RespVulnerabilities respVulnerabilities diff --git a/pkg/controller/server/github.go b/pkg/controller/server/github.go new file mode 100644 index 0000000..318aece --- /dev/null +++ b/pkg/controller/server/github.go @@ -0,0 +1,106 @@ +package server + +import ( + "fmt" + "log/slog" + "net/http" + "strings" + + "github.com/google/go-github/v53/github" + "github.com/m-mizutani/goerr" + "github.com/m-mizutani/octovy/pkg/domain/model" + "github.com/m-mizutani/octovy/pkg/domain/types" + "github.com/m-mizutani/octovy/pkg/usecase" + "github.com/m-mizutani/octovy/pkg/utils" +) + +func handleGitHubEvent(uc usecase.UseCase, r *http.Request, key types.GitHubAppSecret) error { + payload, err := github.ValidatePayload(r, []byte(key)) + if err != nil { + return goerr.Wrap(err, "validating payload") + } + + event, err := github.ParseWebHook(github.WebHookType(r), payload) + if err != nil { + return goerr.Wrap(err, "parsing webhook") + } + + ctx := r.Context() + var octovyCtx *model.Context + if v, ok := ctx.(*model.Context); !ok { + octovyCtx = model.NewContext(model.WithBase(ctx)) + } else { + octovyCtx = v + } + + scanInput := githubEventToScanInput(event) + if scanInput == nil { + return nil + } + + utils.Logger().With(slog.Any("input", scanInput)).Info("Scan GitHub repository") + if err := uc.ScanGitHubRepo(octovyCtx, scanInput); err != nil { + return err + } + + return nil +} + +func refToBranch(v string) string { + if ref := strings.SplitN(v, "/", 3); len(ref) == 3 && ref[1] == "heads" { + return ref[2] + } + return v +} + +func githubEventToScanInput(event interface{}) *usecase.ScanGitHubRepoInput { + switch ev := event.(type) { + case *github.PushEvent: + branch := refToBranch(ev.GetRef()) + isDefaultBranch := branch == ev.GetRepo().GetDefaultBranch() + + return &usecase.ScanGitHubRepoInput{ + GitHubRepoMetadata: usecase.GitHubRepoMetadata{ + Owner: ev.GetRepo().GetOwner().GetLogin(), + Repo: ev.GetRepo().GetName(), + CommitID: ev.GetHeadCommit().GetID(), + Branch: branch, + BaseCommitID: ev.GetBefore(), + PullRequestID: 0, + IsDefaultBranch: isDefaultBranch, + }, + InstallID: types.GitHubAppInstallID(ev.GetInstallation().GetID()), + } + + case *github.PullRequestEvent: + if ev.GetAction() != "opened" && ev.GetAction() != "synchronize" { + utils.Logger().Debug("ignore PR event", slog.String("action", ev.GetAction())) + return nil + } + + branch := refToBranch(ev.GetPullRequest().GetHead().GetRef()) + baseCommitID := ev.GetBefore() + if baseCommitID == "" { + baseCommitID = ev.GetPullRequest().GetBase().GetSHA() + } + + return &usecase.ScanGitHubRepoInput{ + GitHubRepoMetadata: usecase.GitHubRepoMetadata{ + Owner: ev.GetRepo().GetOwner().GetLogin(), + Repo: ev.GetRepo().GetName(), + CommitID: ev.GetPullRequest().GetHead().GetSHA(), + Branch: branch, + BaseCommitID: baseCommitID, + PullRequestID: ev.GetPullRequest().GetNumber(), + }, + InstallID: types.GitHubAppInstallID(ev.GetInstallation().GetID()), + } + + case *github.InstallationEvent, *github.InstallationRepositoriesEvent: + return nil // ignore + + default: + utils.Logger().Warn("unsupported event", slog.Any("event", fmt.Sprintf("%T", event))) + return nil + } +} diff --git a/pkg/controller/server/github_test.go b/pkg/controller/server/github_test.go new file mode 100644 index 0000000..6dfa5d9 --- /dev/null +++ b/pkg/controller/server/github_test.go @@ -0,0 +1,141 @@ +package server_test + +import ( + "bytes" + "crypto/hmac" + "crypto/sha256" + _ "embed" + "encoding/hex" + "net/http" + "net/http/httptest" + "testing" + + "github.com/google/uuid" + "github.com/m-mizutani/gt" + "github.com/m-mizutani/octovy/pkg/controller/server" + "github.com/m-mizutani/octovy/pkg/domain/model" + "github.com/m-mizutani/octovy/pkg/domain/types" + "github.com/m-mizutani/octovy/pkg/usecase" +) + +//go:embed testdata/github/pull_request.opened.json +var testGitHubPullRequestOpened []byte + +//go:embed testdata/github/pull_request.synchronize.json +var testGitHubPullRequestSynchronize []byte + +//go:embed testdata/github/push.json +var testGitHubPush []byte + +//go:embed testdata/github/push.default.json +var testGitHubPushDefault []byte + +func TestGitHubPullRequestSync(t *testing.T) { + const secret = "dummy" + + testCases := map[string]struct { + event string + body []byte + input usecase.ScanGitHubRepoInput + }{ + "pull_request.opened": { + event: "pull_request", + body: testGitHubPullRequestOpened, + input: usecase.ScanGitHubRepoInput{ + GitHubRepoMetadata: usecase.GitHubRepoMetadata{ + Owner: "m-mizutani", + Repo: "masq", + CommitID: "aa0378cad00d375c1897c1b5b5a4dd125984b511", + PullRequestID: 13, + Branch: "update/packages/20230918", + BaseCommitID: "8acdc26c9f12b9cc88e5f0b23f082f648d9e5645", + IsDefaultBranch: false, + }, + InstallID: 41633205, + }, + }, + "pull_request.synchronize": { + event: "pull_request", + body: testGitHubPullRequestSynchronize, + input: usecase.ScanGitHubRepoInput{ + GitHubRepoMetadata: usecase.GitHubRepoMetadata{ + Owner: "m-mizutani", + Repo: "octovy", + CommitID: "69454c171c2f0f2dbc9ccb0c9ef9b72fd769f046", + PullRequestID: 89, + Branch: "release/v0.2.0", + BaseCommitID: "bca5ddd2023d5c906a0420492deb2ede8d99eb79", + IsDefaultBranch: false, + }, + InstallID: 41633205, + }, + }, + + "push": { + event: "push", + body: testGitHubPush, + input: usecase.ScanGitHubRepoInput{ + GitHubRepoMetadata: usecase.GitHubRepoMetadata{ + Owner: "m-mizutani", + Repo: "masq", + CommitID: "aa0378cad00d375c1897c1b5b5a4dd125984b511", + PullRequestID: 0, + Branch: "update/packages/20230918", + BaseCommitID: "0000000000000000000000000000000000000000", + IsDefaultBranch: false, + }, + InstallID: 41633205, + }, + }, + "push: to default": { + event: "push", + body: testGitHubPushDefault, + input: usecase.ScanGitHubRepoInput{ + GitHubRepoMetadata: usecase.GitHubRepoMetadata{ + Owner: "m-mizutani", + Repo: "ops", + CommitID: "f58ae7668c3dfc193a1d2c0372cc52847613cde4", + PullRequestID: 0, + Branch: "master", + BaseCommitID: "987e1005c2e3c79631b620c4a76afd4b8111b7b1", + IsDefaultBranch: true, + }, + InstallID: 41633205, + }, + }, + } + + for name, tc := range testCases { + t.Run(name, func(t *testing.T) { + var called int + mock := &usecase.Mock{ + MockScanGitHubRepo: func(ctx *model.Context, input *usecase.ScanGitHubRepoInput) error { + called++ + gt.V(t, input).Equal(&tc.input) + return nil + }, + } + + serv := server.New(mock, secret) + req := newGitHubWebhookRequest(t, tc.event, tc.body, secret) + w := httptest.NewRecorder() + serv.Mux().ServeHTTP(w, req) + gt.V(t, w.Code).Equal(http.StatusOK) + gt.V(t, called).Equal(1) + }) + } +} + +func newGitHubWebhookRequest(t *testing.T, event string, body []byte, secret types.GitHubAppSecret) *http.Request { + req := gt.R1(http.NewRequest(http.MethodPost, "/webhook/github", bytes.NewReader(body))).NoError(t) + + h := hmac.New(sha256.New, []byte(secret)) + h.Write(body) + + req.Header.Set("X-GitHub-Event", event) + req.Header.Set("X-Hub-Signature-256", "sha256="+hex.EncodeToString(h.Sum(nil))) + req.Header.Set("X-GitHub-Delivery", uuid.NewString()) + req.Header.Set("Content-Type", "application/json") + + return req +} diff --git a/pkg/controller/server/init.go b/pkg/controller/server/init.go deleted file mode 100644 index 0da7f48..0000000 --- a/pkg/controller/server/init.go +++ /dev/null @@ -1,4 +0,0 @@ -package server - -func init() { -} diff --git a/pkg/controller/server/middleware.go b/pkg/controller/server/middleware.go index 7c4e11c..e5d4a8d 100644 --- a/pkg/controller/server/middleware.go +++ b/pkg/controller/server/middleware.go @@ -2,173 +2,48 @@ package server import ( "net/http" - "strings" + "time" + + "log/slog" - "github.com/gin-gonic/gin" "github.com/google/uuid" - "github.com/m-mizutani/goerr" "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" "github.com/m-mizutani/octovy/pkg/utils" - "github.com/m-mizutani/zlog" - "github.com/pkg/errors" ) -func setSession(c *gin.Context, ssn *ent.Session) { - c.Set(contextSession, ssn) -} +func preProcess(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + logger := utils.Logger().With(slog.String("request_id", uuid.NewString())) -func getSession(c *gin.Context) *ent.Session { - obj, ok := c.Get(contextSession) - if !ok { - return nil - } - ssn, ok := obj.(*ent.Session) - if !ok { - return nil - } - return ssn -} + ctx := model.NewContext( + model.WithLogger(logger), + model.WithBase(r.Context()), + ) -type httpLog struct { - Method string - Path string - Params gin.Params - RequestID string - Remote string -} + lw := &statusCodeLogger{ResponseWriter: w} -func setLog(c *gin.Context, key string, value interface{}) { - log := getLog(c) - if log == nil { - log = utils.Logger.Log() - } - c.Set(model.ContextKeyLogger, log.With(key, value)) -} + requestedAt := time.Now() + next.ServeHTTP(lw, r.WithContext(ctx)) -func getLog(c *gin.Context) *zlog.LogEntity { - obj, ok := c.Get(model.ContextKeyLogger) - if !ok { - return nil - } - log, ok := obj.(*zlog.LogEntity) - if !ok { - panic("not matched with zlog.LogEntity") - } - return log + logger.Info("http access", + slog.String("method", r.Method), + slog.String("path", r.URL.Path), + slog.String("remote_addr", r.RemoteAddr), + slog.Int("status_code", lw.statusCode), + slog.Int64("content_length", r.ContentLength), + slog.String("user_agent", r.UserAgent()), + slog.String("referer", r.Referer()), + slog.Duration("elapsed", time.Since(requestedAt)), + ) + }) } -func requestLogging(c *gin.Context) { - reqID := uuid.New().String() - reqLog := httpLog{ - Method: c.Request.Method, - Path: c.Request.URL.Path, - Params: c.Params, - RequestID: reqID, - Remote: c.ClientIP(), - } - utils.Logger. - With("http", reqLog). - With("user-agent", c.Request.UserAgent()). - Info("HTTP Request") - c.Set(contextRequestIDKey, reqID) - setLog(c, "http", reqLog) - c.Next() +type statusCodeLogger struct { + http.ResponseWriter + statusCode int } -func authControl(c *gin.Context) { - loginURL := "/login" - ctx := model.NewContextWith(c) - - if c.Request.URL.Path == "/auth/logout" { - if ssnID, err := c.Cookie(cookieSessionID); err == nil { - // Revoke session if session ID exists, - uc := getUsecase(c) - if err := uc.RevokeSession(ctx, ssnID); err != nil { - c.Error(err) - return - } - } - c.SetCookie(cookieSessionID, "", 0, "", "/", true, true) - c.SetCookie(cookieSessionSecret, "", 0, "", "/", true, true) - c.Redirect(http.StatusFound, loginURL) - c.Abort() - return - } - - // Pass through settings - if strings.HasPrefix(c.Request.URL.Path, "/auth/") || - strings.HasPrefix(c.Request.URL.Path, "/_next/") || - strings.HasPrefix(c.Request.URL.Path, "/webhook/") || - c.Request.URL.Path == loginURL { - c.Next() - return - } - - notAuthResp := func() { - if strings.HasPrefix(c.Request.URL.Path, "/api/") { - errResp(c, http.StatusUnauthorized, goerr.Wrap(model.ErrNotAuthenticated)) - } else { - c.Redirect(http.StatusFound, loginURL) - } - c.Abort() - } - - ssnID, err := c.Cookie(cookieSessionID) - if err != nil || ssnID == "" { - notAuthResp() - return - } - secret, err := c.Cookie(cookieSessionSecret) - if err != nil || secret == "" { - notAuthResp() - return - } - - uc := getUsecase(c) - ssn, err := uc.ValidateSession(ctx, ssnID) - if err != nil { - notAuthResp() - return - } - - // Not authenticated - if ssn == nil || ssn.Token != secret { - notAuthResp() - return - } - - ssn.Token = "" // Erase token - setSession(c, ssn) - setLog(c, "session_id", ssn.ID) - c.Next() -} - -func errorHandler(c *gin.Context) { - c.Next() - - if ginError := c.Errors.Last(); ginError != nil { - getUsecase(c).HandleError(model.NewContextWith(c), ginError) - - if err := errors.Cause(ginError); err != nil { - switch { - case errors.Is(err, model.ErrInvalidInput): - errResp(c, http.StatusNotAcceptable, err) - case errors.Is(err, errResourceNotFound): - errResp(c, http.StatusNotFound, err) - case errors.Is(err, model.ErrAuthenticationFailed): - errResp(c, http.StatusUnauthorized, err) - case errors.Is(err, model.ErrUserNotFound): - errResp(c, http.StatusNotFound, err) - case errors.Is(err, model.ErrVulnerabilityNotFound): - errResp(c, http.StatusNotFound, err) - default: - errResp(c, http.StatusInternalServerError, err) - } - } else { - getLog(c).Err(ginError).Error("ginError") - errResp(c, http.StatusInternalServerError, ginError) - } - } - +func (x *statusCodeLogger) WriteHeader(code int) { + x.statusCode = code + x.ResponseWriter.WriteHeader(code) } diff --git a/pkg/controller/server/option.go b/pkg/controller/server/option.go deleted file mode 100644 index 79767a9..0000000 --- a/pkg/controller/server/option.go +++ /dev/null @@ -1,27 +0,0 @@ -package server - -type Option func(cfg *config) - -func DisableAuth() Option { - return func(cfg *config) { - cfg.DisableAuth = true - } -} - -func DisableWebhookGitHub() Option { - return func(cfg *config) { - cfg.DisableWebhookGitHub = true - } -} - -func DisableWebhookTrivy() Option { - return func(cfg *config) { - cfg.DisableWebhookTrivy = true - } -} - -func DisableFrontend() Option { - return func(cfg *config) { - cfg.DisableFrontend = true - } -} diff --git a/pkg/controller/server/repo_label.go b/pkg/controller/server/repo_label.go deleted file mode 100644 index de20336..0000000 --- a/pkg/controller/server/repo_label.go +++ /dev/null @@ -1,123 +0,0 @@ -package server - -import ( - "net/http" - "strconv" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -func getRepoLabels(c *gin.Context) { - uc := getUsecase(c) - - resp, err := uc.GetRepoLabels(model.NewContextWith(c)) - if err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: resp}) -} - -func createRepoLabel(c *gin.Context) { - uc := getUsecase(c) - - var req model.RequestRepoLabel - if err := c.BindJSON(&req); err != nil { - _ = c.Error(err) - return - } - - resp, err := uc.CreateRepoLabel(model.NewContextWith(c), &req) - if err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusCreated, baseResponse{Data: resp}) -} - -func updateRepoLabel(c *gin.Context) { - uc := getUsecase(c) - - var req model.RequestRepoLabel - if err := c.BindJSON(&req); err != nil { - _ = c.Error(err) - return - } - - id, err := strconv.ParseInt(c.Param("id"), 10, 32) - if err != nil { - c.Error(err) - return - } - - if err := uc.UpdateRepoLabel(model.NewContextWith(c), int(id), &req); err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{}) -} - -func assignRepoLabel(c *gin.Context) { - uc := getUsecase(c) - - id, err := strconv.ParseInt(c.Param("id"), 10, 32) - if err != nil { - c.Error(err) - return - } - repoID, err := strconv.ParseInt(c.Param("repo_id"), 10, 32) - if err != nil { - c.Error(err) - return - } - - if err := uc.AssignRepoLabel(model.NewContextWith(c), int(repoID), int(id)); err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusCreated, baseResponse{}) -} - -func unassignRepoLabel(c *gin.Context) { - uc := getUsecase(c) - - id, err := strconv.ParseInt(c.Param("id"), 10, 32) - if err != nil { - c.Error(err) - return - } - repoID, err := strconv.ParseInt(c.Param("repo_id"), 10, 32) - if err != nil { - c.Error(err) - return - } - - if err := uc.UnassignRepoLabel(model.NewContextWith(c), int(repoID), int(id)); err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{}) -} - -func deleteRepoLabel(c *gin.Context) { - uc := getUsecase(c) - - id, err := strconv.ParseInt(c.Param("id"), 10, 32) - if err != nil { - c.Error(err) - return - } - - if err := uc.DeleteRepoLabel(model.NewContextWith(c), int(id)); err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{}) -} diff --git a/pkg/controller/server/repo_label_test.go b/pkg/controller/server/repo_label_test.go deleted file mode 100644 index 8b18e45..0000000 --- a/pkg/controller/server/repo_label_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package server_test - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/db" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestRepoLabel(t *testing.T) { - ctx := model.NewContext() - dbClient := db.NewMock(t) - repo, err := dbClient.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "five", - }) - require.NoError(t, err) - engine := newServerWithDB(t, dbClient) - - { - w := httptest.NewRecorder() - req := newRequest("GET", "/api/v1/repo-label", nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - var resp []*ent.RepoLabel - bind(t, w.Body, &resp) - assert.Len(t, resp, 0) - } - - { - w := httptest.NewRecorder() - req := newRequest("POST", "/api/v1/repo-label", model.RequestRepoLabel{ - Name: "magic", - }) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusCreated, w.Result().StatusCode) - } - - var label *ent.RepoLabel - { - w := httptest.NewRecorder() - req := newRequest("GET", "/api/v1/repo-label", nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - var resp []*ent.RepoLabel - bind(t, w.Body, &resp) - require.Len(t, resp, 1) - assert.Equal(t, "magic", resp[0].Name) - label = resp[0] - } - - { - w := httptest.NewRecorder() - req := newRequest("POST", fmt.Sprintf("/api/v1/repo-label/%d/assign/%d", label.ID, repo.ID), nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusCreated, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req := newRequest("GET", "/api/v1/repository", nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - var resp []*ent.Repository - bind(t, w.Body, &resp) - require.Len(t, resp, 1) - require.Len(t, resp[0].Edges.Labels, 1) - assert.Equal(t, "magic", resp[0].Edges.Labels[0].Name) - } - - { - w := httptest.NewRecorder() - req := newRequest("DELETE", fmt.Sprintf("/api/v1/repo-label/%d/assign/%d", label.ID, repo.ID), nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req := newRequest("GET", "/api/v1/repository", nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - var resp []*ent.Repository - bind(t, w.Body, &resp) - require.Len(t, resp, 1) - require.Len(t, resp[0].Edges.Labels, 0) - } -} diff --git a/pkg/controller/server/repository.go b/pkg/controller/server/repository.go deleted file mode 100644 index c684b60..0000000 --- a/pkg/controller/server/repository.go +++ /dev/null @@ -1,73 +0,0 @@ -package server - -import ( - "net/http" - "strconv" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -func getRepositories(c *gin.Context) { - uc := getUsecase(c) - - resp, err := uc.GetRepositories(model.NewContextWith(c)) - if err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: resp}) -} - -func getRepository(c *gin.Context) { - uc := getUsecase(c) - - resp, err := uc.GetRepository(model.NewContextWith(c), &model.GitHubRepo{ - Owner: c.Param("owner"), - Name: c.Param("repo"), - }) - if err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: resp}) -} - -func getRepositoryScan(c *gin.Context) { - uc := getUsecase(c) - - req := &model.GetRepoScanRequest{ - GitHubRepo: model.GitHubRepo{ - Owner: c.Param("owner"), - Name: c.Param("repo"), - }, - } - - if s := c.Query("offset"); s != "" { - n, err := strconv.ParseInt(s, 10, 32) - if err != nil { - c.Error(goerr.Wrap(err, "offset is not valid number")) - return - } - req.Offset = int(n) - } - if s := c.Query("limit"); s != "" { - n, err := strconv.ParseInt(s, 10, 32) - if err != nil { - c.Error(err) - return - } - req.Limit = int(n) - } - - resp, err := uc.GetRepositoryScan(model.NewContextWith(c), req) - if err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: resp}) -} diff --git a/pkg/controller/server/scan.go b/pkg/controller/server/scan.go deleted file mode 100644 index 4e2d6cc..0000000 --- a/pkg/controller/server/scan.go +++ /dev/null @@ -1,42 +0,0 @@ -package server - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -func getScanReport(c *gin.Context) { - uc := getUsecase(c) - scanID := c.Param("scan_id") - - report, err := uc.LookupScanReport(model.NewContextWith(c), scanID) - if err != nil { - _ = c.Error(err) - return - } - if report == nil { - _ = c.Error(goerr.Wrap(errResourceNotFound, "No such report")) - } - - c.JSON(http.StatusOK, baseResponse{Data: report}) -} - -func getScanPackages(c *gin.Context) { - uc := getUsecase(c) - scanID := c.Param("scan_id") - - inventry, err := uc.GetScanReport(model.NewContextWith(c), scanID) - if err != nil { - _ = c.Error(err) - return - } - if inventry == nil { - _ = c.Error(goerr.Wrap(errResourceNotFound, "No such report")) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: inventry}) -} diff --git a/pkg/controller/server/server.go b/pkg/controller/server/server.go new file mode 100644 index 0000000..d8db2e0 --- /dev/null +++ b/pkg/controller/server/server.go @@ -0,0 +1,50 @@ +package server + +import ( + "net/http" + + "log/slog" + + "github.com/go-chi/chi/v5" + "github.com/m-mizutani/octovy/pkg/domain/types" + "github.com/m-mizutani/octovy/pkg/usecase" + "github.com/m-mizutani/octovy/pkg/utils" +) + +type Server struct { + mux *chi.Mux +} + +func safeWrite(w http.ResponseWriter, code int, body []byte) { + w.WriteHeader(code) + if _, err := w.Write(body); err != nil { + utils.Logger().Error("fail to write response", slog.Any("error", err)) + } +} + +func New(uc usecase.UseCase, secret types.GitHubAppSecret) *Server { + r := chi.NewRouter() + r.Use(preProcess) + r.Get("/health", func(w http.ResponseWriter, r *http.Request) { + safeWrite(w, http.StatusOK, []byte("ok")) + }) + r.Route("/webhook", func(r chi.Router) { + r.Post("/github", func(w http.ResponseWriter, r *http.Request) { + if err := handleGitHubEvent(uc, r, secret); err != nil { + utils.Logger().Warn("fail to handle GitHub event", slog.Any("error", err)) + safeWrite(w, http.StatusInternalServerError, []byte(err.Error())) + return + } + + safeWrite(w, http.StatusOK, []byte("ok")) + }) + }) + + return &Server{ + mux: r, + } +} + +func (x *Server) Mux() *chi.Mux { + return x.mux +} diff --git a/pkg/controller/server/severity.go b/pkg/controller/server/severity.go deleted file mode 100644 index f2a46f7..0000000 --- a/pkg/controller/server/severity.go +++ /dev/null @@ -1,96 +0,0 @@ -package server - -import ( - "net/http" - "strconv" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -func getSeverities(c *gin.Context) { - uc := getUsecase(c) - - resp, err := uc.GetSeverities(model.NewContextWith(c)) - if err != nil { - c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: resp}) -} - -func createSeverity(c *gin.Context) { - uc := getUsecase(c) - - var req model.RequestSeverity - if err := c.BindJSON(&req); err != nil { - _ = c.Error(err) - return - } - - resp, err := uc.CreateSeverity(model.NewContextWith(c), &req) - if err != nil { - c.Error(err) - return - } - - c.JSON(http.StatusCreated, baseResponse{Data: resp}) -} - -func updateSeverity(c *gin.Context) { - uc := getUsecase(c) - - var req model.RequestSeverity - if err := c.BindJSON(&req); err != nil { - _ = c.Error(err) - return - } - - id, err := strconv.ParseInt(c.Param("id"), 10, 32) - if err != nil { - c.Error(err) - return - } - - if err := uc.UpdateSeverity(model.NewContextWith(c), int(id), &req); err != nil { - c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{}) -} - -func assignSeverity(c *gin.Context) { - uc := getUsecase(c) - - id, err := strconv.ParseInt(c.Param("id"), 10, 32) - if err != nil { - c.Error(err) - return - } - - vulnID := c.Param("vuln_id") - if err := uc.AssignSeverity(model.NewContextWith(c), vulnID, int(id)); err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{}) -} - -func deleteSeverity(c *gin.Context) { - uc := getUsecase(c) - id, err := strconv.ParseInt(c.Param("id"), 10, 32) - if err != nil { - c.Error(err) - return - } - - if err := uc.DeleteSeverity(model.NewContextWith(c), int(id)); err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{}) -} diff --git a/pkg/controller/server/severity_test.go b/pkg/controller/server/severity_test.go deleted file mode 100644 index fe55b7b..0000000 --- a/pkg/controller/server/severity_test.go +++ /dev/null @@ -1,155 +0,0 @@ -package server_test - -import ( - "bytes" - "encoding/json" - "fmt" - "net/http" - "net/http/httptest" - "testing" - - "github.com/m-mizutani/octovy/pkg/controller/server" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestNoSeverity(t *testing.T) { - engine := newServer(t) - w := httptest.NewRecorder() - req, _ := http.NewRequest("GET", "/api/v1/severity", nil) - engine.ServeHTTP(w, req) - - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - var resp []*ent.Severity - bind(t, w.Body, &resp) - assert.Len(t, resp, 0) -} - -func TestSeverityCreate(t *testing.T) { - engine := newServer(t) - - w1 := httptest.NewRecorder() - body, _ := json.Marshal(model.RequestSeverity{Label: "critical"}) - req1, _ := http.NewRequest("POST", "/api/v1/severity", bytes.NewReader(body)) - engine.ServeHTTP(w1, req1) - assert.Equal(t, http.StatusCreated, w1.Result().StatusCode) - - w2 := httptest.NewRecorder() - body2, _ := json.Marshal(model.RequestSeverity{Label: "high"}) - req2, _ := http.NewRequest("POST", "/api/v1/severity", bytes.NewReader(body2)) - engine.ServeHTTP(w2, req2) - assert.Equal(t, http.StatusCreated, w2.Result().StatusCode) - - w3 := httptest.NewRecorder() - req3, _ := http.NewRequest("GET", "/api/v1/severity", bytes.NewReader(body)) - engine.ServeHTTP(w3, req3) - - assert.Equal(t, http.StatusCreated, w1.Result().StatusCode) - var resp []*ent.Severity - bind(t, w3.Body, &resp) - assert.Len(t, resp, 2) - assert.Equal(t, "critical", resp[0].Label) - assert.Equal(t, "high", resp[1].Label) -} - -func TestSeverityUpdate(t *testing.T) { - engine := newServer(t) - - w1 := httptest.NewRecorder() - body, _ := json.Marshal(model.RequestSeverity{Label: "critical"}) - req1, _ := http.NewRequest("POST", "/api/v1/severity", bytes.NewReader(body)) - engine.ServeHTTP(w1, req1) - assert.Equal(t, http.StatusCreated, w1.Result().StatusCode) - var resp1 *ent.Severity - bind(t, w1.Body, &resp1) - - w2 := httptest.NewRecorder() - body2, _ := json.Marshal(model.RequestSeverity{Label: "high"}) - req2, _ := http.NewRequest("PUT", fmt.Sprintf("/api/v1/severity/%d", resp1.ID), bytes.NewReader(body2)) - engine.ServeHTTP(w2, req2) - assert.Equal(t, http.StatusOK, w2.Result().StatusCode) - - w3 := httptest.NewRecorder() - req3, _ := http.NewRequest("GET", "/api/v1/severity", bytes.NewReader(body)) - engine.ServeHTTP(w3, req3) - - assert.Equal(t, http.StatusOK, w3.Result().StatusCode) - var resp2 []*ent.Severity - bind(t, w3.Body, &resp2) - require.Len(t, resp2, 1) - assert.Equal(t, "high", resp2[0].Label) -} - -func TestSeverityAssign(t *testing.T) { - engine := newServer(t) - - var sev *ent.Severity - { - w1 := httptest.NewRecorder() - body, _ := json.Marshal(model.RequestSeverity{Label: "critical"}) - req1, _ := http.NewRequest("POST", "/api/v1/severity", bytes.NewReader(body)) - engine.ServeHTTP(w1, req1) - assert.Equal(t, http.StatusCreated, w1.Result().StatusCode) - bind(t, w1.Body, &sev) - } - - { - w2 := httptest.NewRecorder() - body2, _ := json.Marshal(ent.Vulnerability{ID: "CVE-2000-1000", Title: "blue"}) - req2, _ := http.NewRequest("POST", "/api/v1/vulnerability", bytes.NewReader(body2)) - engine.ServeHTTP(w2, req2) - assert.Equal(t, http.StatusCreated, w2.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req, _ := http.NewRequest("POST", fmt.Sprintf("/api/v1/severity/%d/assign/CVE-2000-1000", sev.ID), nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req, _ := http.NewRequest("GET", "/api/v1/vulnerability/CVE-2000-1000", nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - var vuln *model.RespVulnerability - bind(t, w.Body, &vuln) - assert.Equal(t, "blue", vuln.Vulnerability.Title) - require.NotNil(t, vuln.Vulnerability.Edges.CustomSeverity) - assert.Equal(t, "critical", vuln.Vulnerability.Edges.CustomSeverity.Label) - } - - { - w := httptest.NewRecorder() - req, _ := http.NewRequest("GET", "/api/v1/vulnerability", nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - var resp server.RespVulnerabilities - bind(t, w.Body, &resp) - require.Len(t, resp.Vulnerabilities, 1) - assert.Equal(t, "blue", resp.Vulnerabilities[0].Title) - require.NotNil(t, resp.Vulnerabilities[0].Edges.CustomSeverity) - assert.Equal(t, "critical", resp.Vulnerabilities[0].Edges.CustomSeverity.Label) - } - - { - w := httptest.NewRecorder() - req, _ := http.NewRequest("DELETE", fmt.Sprintf("/api/v1/severity/%d", sev.ID), nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - } - - { - w := httptest.NewRecorder() - req, _ := http.NewRequest("GET", "/api/v1/vulnerability/CVE-2000-1000", nil) - engine.ServeHTTP(w, req) - assert.Equal(t, http.StatusOK, w.Result().StatusCode) - var vuln *model.RespVulnerability - bind(t, w.Body, &vuln) - assert.Equal(t, "blue", vuln.Vulnerability.Title) - require.Nil(t, vuln.Vulnerability.Edges.CustomSeverity) - } -} diff --git a/pkg/controller/server/testdata/github/pull_request.opened.json b/pkg/controller/server/testdata/github/pull_request.opened.json new file mode 100644 index 0000000..60487dd --- /dev/null +++ b/pkg/controller/server/testdata/github/pull_request.opened.json @@ -0,0 +1,510 @@ +{ + "action": "opened", + "number": 13, + "pull_request": { + "url": "https://api.github.com/repos/m-mizutani/masq/pulls/13", + "id": 1518635674, + "node_id": "PR_kwDOIrCKK85ahIqa", + "html_url": "https://github.com/m-mizutani/masq/pull/13", + "diff_url": "https://github.com/m-mizutani/masq/pull/13.diff", + "patch_url": "https://github.com/m-mizutani/masq/pull/13.patch", + "issue_url": "https://api.github.com/repos/m-mizutani/masq/issues/13", + "number": 13, + "state": "open", + "locked": false, + "title": "Update go packages", + "user": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "body": "SSIA", + "created_at": "2023-09-17T23:43:11Z", + "updated_at": "2023-09-17T23:43:11Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": null, + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/m-mizutani/masq/pulls/13/commits", + "review_comments_url": "https://api.github.com/repos/m-mizutani/masq/pulls/13/comments", + "review_comment_url": "https://api.github.com/repos/m-mizutani/masq/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/m-mizutani/masq/issues/13/comments", + "statuses_url": "https://api.github.com/repos/m-mizutani/masq/statuses/aa0378cad00d375c1897c1b5b5a4dd125984b511", + "head": { + "label": "m-mizutani:update/packages/20230918", + "ref": "update/packages/20230918", + "sha": "aa0378cad00d375c1897c1b5b5a4dd125984b511", + "user": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 581995051, + "node_id": "R_kgDOIrCKKw", + "name": "masq", + "full_name": "m-mizutani/masq", + "private": false, + "owner": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/m-mizutani/masq", + "description": "A utility to redact sensitive data for slog in Go", + "fork": false, + "url": "https://api.github.com/repos/m-mizutani/masq", + "forks_url": "https://api.github.com/repos/m-mizutani/masq/forks", + "keys_url": "https://api.github.com/repos/m-mizutani/masq/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/m-mizutani/masq/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/m-mizutani/masq/teams", + "hooks_url": "https://api.github.com/repos/m-mizutani/masq/hooks", + "issue_events_url": "https://api.github.com/repos/m-mizutani/masq/issues/events{/number}", + "events_url": "https://api.github.com/repos/m-mizutani/masq/events", + "assignees_url": "https://api.github.com/repos/m-mizutani/masq/assignees{/user}", + "branches_url": "https://api.github.com/repos/m-mizutani/masq/branches{/branch}", + "tags_url": "https://api.github.com/repos/m-mizutani/masq/tags", + "blobs_url": "https://api.github.com/repos/m-mizutani/masq/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/m-mizutani/masq/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/m-mizutani/masq/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/m-mizutani/masq/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/m-mizutani/masq/statuses/{sha}", + "languages_url": "https://api.github.com/repos/m-mizutani/masq/languages", + "stargazers_url": "https://api.github.com/repos/m-mizutani/masq/stargazers", + "contributors_url": "https://api.github.com/repos/m-mizutani/masq/contributors", + "subscribers_url": "https://api.github.com/repos/m-mizutani/masq/subscribers", + "subscription_url": "https://api.github.com/repos/m-mizutani/masq/subscription", + "commits_url": "https://api.github.com/repos/m-mizutani/masq/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/m-mizutani/masq/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/m-mizutani/masq/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/m-mizutani/masq/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/m-mizutani/masq/contents/{+path}", + "compare_url": "https://api.github.com/repos/m-mizutani/masq/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/m-mizutani/masq/merges", + "archive_url": "https://api.github.com/repos/m-mizutani/masq/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/m-mizutani/masq/downloads", + "issues_url": "https://api.github.com/repos/m-mizutani/masq/issues{/number}", + "pulls_url": "https://api.github.com/repos/m-mizutani/masq/pulls{/number}", + "milestones_url": "https://api.github.com/repos/m-mizutani/masq/milestones{/number}", + "notifications_url": "https://api.github.com/repos/m-mizutani/masq/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/m-mizutani/masq/labels{/name}", + "releases_url": "https://api.github.com/repos/m-mizutani/masq/releases{/id}", + "deployments_url": "https://api.github.com/repos/m-mizutani/masq/deployments", + "created_at": "2022-12-25T08:05:37Z", + "updated_at": "2023-09-14T00:34:07Z", + "pushed_at": "2023-09-17T23:43:11Z", + "git_url": "git://github.com/m-mizutani/masq.git", + "ssh_url": "git@github.com:m-mizutani/masq.git", + "clone_url": "https://github.com/m-mizutani/masq.git", + "svn_url": "https://github.com/m-mizutani/masq", + "homepage": "", + "size": 36, + "stargazers_count": 48, + "watchers_count": 48, + "language": "Go", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 48, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "m-mizutani:main", + "ref": "main", + "sha": "8acdc26c9f12b9cc88e5f0b23f082f648d9e5645", + "user": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 581995051, + "node_id": "R_kgDOIrCKKw", + "name": "masq", + "full_name": "m-mizutani/masq", + "private": false, + "owner": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/m-mizutani/masq", + "description": "A utility to redact sensitive data for slog in Go", + "fork": false, + "url": "https://api.github.com/repos/m-mizutani/masq", + "forks_url": "https://api.github.com/repos/m-mizutani/masq/forks", + "keys_url": "https://api.github.com/repos/m-mizutani/masq/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/m-mizutani/masq/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/m-mizutani/masq/teams", + "hooks_url": "https://api.github.com/repos/m-mizutani/masq/hooks", + "issue_events_url": "https://api.github.com/repos/m-mizutani/masq/issues/events{/number}", + "events_url": "https://api.github.com/repos/m-mizutani/masq/events", + "assignees_url": "https://api.github.com/repos/m-mizutani/masq/assignees{/user}", + "branches_url": "https://api.github.com/repos/m-mizutani/masq/branches{/branch}", + "tags_url": "https://api.github.com/repos/m-mizutani/masq/tags", + "blobs_url": "https://api.github.com/repos/m-mizutani/masq/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/m-mizutani/masq/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/m-mizutani/masq/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/m-mizutani/masq/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/m-mizutani/masq/statuses/{sha}", + "languages_url": "https://api.github.com/repos/m-mizutani/masq/languages", + "stargazers_url": "https://api.github.com/repos/m-mizutani/masq/stargazers", + "contributors_url": "https://api.github.com/repos/m-mizutani/masq/contributors", + "subscribers_url": "https://api.github.com/repos/m-mizutani/masq/subscribers", + "subscription_url": "https://api.github.com/repos/m-mizutani/masq/subscription", + "commits_url": "https://api.github.com/repos/m-mizutani/masq/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/m-mizutani/masq/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/m-mizutani/masq/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/m-mizutani/masq/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/m-mizutani/masq/contents/{+path}", + "compare_url": "https://api.github.com/repos/m-mizutani/masq/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/m-mizutani/masq/merges", + "archive_url": "https://api.github.com/repos/m-mizutani/masq/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/m-mizutani/masq/downloads", + "issues_url": "https://api.github.com/repos/m-mizutani/masq/issues{/number}", + "pulls_url": "https://api.github.com/repos/m-mizutani/masq/pulls{/number}", + "milestones_url": "https://api.github.com/repos/m-mizutani/masq/milestones{/number}", + "notifications_url": "https://api.github.com/repos/m-mizutani/masq/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/m-mizutani/masq/labels{/name}", + "releases_url": "https://api.github.com/repos/m-mizutani/masq/releases{/id}", + "deployments_url": "https://api.github.com/repos/m-mizutani/masq/deployments", + "created_at": "2022-12-25T08:05:37Z", + "updated_at": "2023-09-14T00:34:07Z", + "pushed_at": "2023-09-17T23:43:11Z", + "git_url": "git://github.com/m-mizutani/masq.git", + "ssh_url": "git@github.com:m-mizutani/masq.git", + "clone_url": "https://github.com/m-mizutani/masq.git", + "svn_url": "https://github.com/m-mizutani/masq", + "homepage": "", + "size": 36, + "stargazers_count": 48, + "watchers_count": 48, + "language": "Go", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 48, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/m-mizutani/masq/pulls/13" + }, + "html": { + "href": "https://github.com/m-mizutani/masq/pull/13" + }, + "issue": { + "href": "https://api.github.com/repos/m-mizutani/masq/issues/13" + }, + "comments": { + "href": "https://api.github.com/repos/m-mizutani/masq/issues/13/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/m-mizutani/masq/pulls/13/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/m-mizutani/masq/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/m-mizutani/masq/pulls/13/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/m-mizutani/masq/statuses/aa0378cad00d375c1897c1b5b5a4dd125984b511" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 21, + "deletions": 22, + "changed_files": 3 + }, + "repository": { + "id": 581995051, + "node_id": "R_kgDOIrCKKw", + "name": "masq", + "full_name": "m-mizutani/masq", + "private": false, + "owner": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/m-mizutani/masq", + "description": "A utility to redact sensitive data for slog in Go", + "fork": false, + "url": "https://api.github.com/repos/m-mizutani/masq", + "forks_url": "https://api.github.com/repos/m-mizutani/masq/forks", + "keys_url": "https://api.github.com/repos/m-mizutani/masq/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/m-mizutani/masq/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/m-mizutani/masq/teams", + "hooks_url": "https://api.github.com/repos/m-mizutani/masq/hooks", + "issue_events_url": "https://api.github.com/repos/m-mizutani/masq/issues/events{/number}", + "events_url": "https://api.github.com/repos/m-mizutani/masq/events", + "assignees_url": "https://api.github.com/repos/m-mizutani/masq/assignees{/user}", + "branches_url": "https://api.github.com/repos/m-mizutani/masq/branches{/branch}", + "tags_url": "https://api.github.com/repos/m-mizutani/masq/tags", + "blobs_url": "https://api.github.com/repos/m-mizutani/masq/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/m-mizutani/masq/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/m-mizutani/masq/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/m-mizutani/masq/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/m-mizutani/masq/statuses/{sha}", + "languages_url": "https://api.github.com/repos/m-mizutani/masq/languages", + "stargazers_url": "https://api.github.com/repos/m-mizutani/masq/stargazers", + "contributors_url": "https://api.github.com/repos/m-mizutani/masq/contributors", + "subscribers_url": "https://api.github.com/repos/m-mizutani/masq/subscribers", + "subscription_url": "https://api.github.com/repos/m-mizutani/masq/subscription", + "commits_url": "https://api.github.com/repos/m-mizutani/masq/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/m-mizutani/masq/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/m-mizutani/masq/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/m-mizutani/masq/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/m-mizutani/masq/contents/{+path}", + "compare_url": "https://api.github.com/repos/m-mizutani/masq/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/m-mizutani/masq/merges", + "archive_url": "https://api.github.com/repos/m-mizutani/masq/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/m-mizutani/masq/downloads", + "issues_url": "https://api.github.com/repos/m-mizutani/masq/issues{/number}", + "pulls_url": "https://api.github.com/repos/m-mizutani/masq/pulls{/number}", + "milestones_url": "https://api.github.com/repos/m-mizutani/masq/milestones{/number}", + "notifications_url": "https://api.github.com/repos/m-mizutani/masq/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/m-mizutani/masq/labels{/name}", + "releases_url": "https://api.github.com/repos/m-mizutani/masq/releases{/id}", + "deployments_url": "https://api.github.com/repos/m-mizutani/masq/deployments", + "created_at": "2022-12-25T08:05:37Z", + "updated_at": "2023-09-14T00:34:07Z", + "pushed_at": "2023-09-17T23:43:11Z", + "git_url": "git://github.com/m-mizutani/masq.git", + "ssh_url": "git@github.com:m-mizutani/masq.git", + "clone_url": "https://github.com/m-mizutani/masq.git", + "svn_url": "https://github.com/m-mizutani/masq", + "homepage": "", + "size": 36, + "stargazers_count": 48, + "watchers_count": 48, + "language": "Go", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 48, + "default_branch": "main" + }, + "sender": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 41633205, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNDE2MzMyMDU=" + } +} diff --git a/pkg/controller/server/testdata/github/pull_request.synchronize.json b/pkg/controller/server/testdata/github/pull_request.synchronize.json new file mode 100644 index 0000000..fe7fd3f --- /dev/null +++ b/pkg/controller/server/testdata/github/pull_request.synchronize.json @@ -0,0 +1,530 @@ +{ + "action": "synchronize", + "number": 89, + "pull_request": { + "url": "https://api.github.com/repos/m-mizutani/octovy/pulls/89", + "id": 1473604329, + "node_id": "PR_kwDOFWYRkM5X1Wrp", + "html_url": "https://github.com/m-mizutani/octovy/pull/89", + "diff_url": "https://github.com/m-mizutani/octovy/pull/89.diff", + "patch_url": "https://github.com/m-mizutani/octovy/pull/89.patch", + "issue_url": "https://api.github.com/repos/m-mizutani/octovy/issues/89", + "number": 89, + "state": "open", + "locked": false, + "title": "v0.2.0", + "user": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "body": "# Overview\r\n\r\n- Octovy's v0.1.x has become overly feature-rich, making continued maintenance difficult.\r\n - There were many implementations of UI that the developers were unfamiliar with.\r\n - In order to accommodate multiple use cases, the DB schema has become excessively complex.\r\n- In response to this, we will significantly renew the features in v0.2.0. This will involve a large amount of breaking changes.", + "created_at": "2023-08-14T01:55:48Z", + "updated_at": "2023-09-17T06:37:51Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "366e61bce88a7532ec2bfa9964a8399f36469e56", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": true, + "commits_url": "https://api.github.com/repos/m-mizutani/octovy/pulls/89/commits", + "review_comments_url": "https://api.github.com/repos/m-mizutani/octovy/pulls/89/comments", + "review_comment_url": "https://api.github.com/repos/m-mizutani/octovy/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/m-mizutani/octovy/issues/89/comments", + "statuses_url": "https://api.github.com/repos/m-mizutani/octovy/statuses/69454c171c2f0f2dbc9ccb0c9ef9b72fd769f046", + "head": { + "label": "m-mizutani:release/v0.2.0", + "ref": "release/v0.2.0", + "sha": "69454c171c2f0f2dbc9ccb0c9ef9b72fd769f046", + "user": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 359010704, + "node_id": "MDEwOlJlcG9zaXRvcnkzNTkwMTA3MDQ=", + "name": "octovy", + "full_name": "m-mizutani/octovy", + "private": false, + "owner": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/m-mizutani/octovy", + "description": "Trivy based vulnerability management service", + "fork": false, + "url": "https://api.github.com/repos/m-mizutani/octovy", + "forks_url": "https://api.github.com/repos/m-mizutani/octovy/forks", + "keys_url": "https://api.github.com/repos/m-mizutani/octovy/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/m-mizutani/octovy/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/m-mizutani/octovy/teams", + "hooks_url": "https://api.github.com/repos/m-mizutani/octovy/hooks", + "issue_events_url": "https://api.github.com/repos/m-mizutani/octovy/issues/events{/number}", + "events_url": "https://api.github.com/repos/m-mizutani/octovy/events", + "assignees_url": "https://api.github.com/repos/m-mizutani/octovy/assignees{/user}", + "branches_url": "https://api.github.com/repos/m-mizutani/octovy/branches{/branch}", + "tags_url": "https://api.github.com/repos/m-mizutani/octovy/tags", + "blobs_url": "https://api.github.com/repos/m-mizutani/octovy/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/m-mizutani/octovy/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/m-mizutani/octovy/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/m-mizutani/octovy/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/m-mizutani/octovy/statuses/{sha}", + "languages_url": "https://api.github.com/repos/m-mizutani/octovy/languages", + "stargazers_url": "https://api.github.com/repos/m-mizutani/octovy/stargazers", + "contributors_url": "https://api.github.com/repos/m-mizutani/octovy/contributors", + "subscribers_url": "https://api.github.com/repos/m-mizutani/octovy/subscribers", + "subscription_url": "https://api.github.com/repos/m-mizutani/octovy/subscription", + "commits_url": "https://api.github.com/repos/m-mizutani/octovy/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/m-mizutani/octovy/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/m-mizutani/octovy/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/m-mizutani/octovy/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/m-mizutani/octovy/contents/{+path}", + "compare_url": "https://api.github.com/repos/m-mizutani/octovy/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/m-mizutani/octovy/merges", + "archive_url": "https://api.github.com/repos/m-mizutani/octovy/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/m-mizutani/octovy/downloads", + "issues_url": "https://api.github.com/repos/m-mizutani/octovy/issues{/number}", + "pulls_url": "https://api.github.com/repos/m-mizutani/octovy/pulls{/number}", + "milestones_url": "https://api.github.com/repos/m-mizutani/octovy/milestones{/number}", + "notifications_url": "https://api.github.com/repos/m-mizutani/octovy/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/m-mizutani/octovy/labels{/name}", + "releases_url": "https://api.github.com/repos/m-mizutani/octovy/releases{/id}", + "deployments_url": "https://api.github.com/repos/m-mizutani/octovy/deployments", + "created_at": "2021-04-18T00:25:50Z", + "updated_at": "2023-08-10T05:59:13Z", + "pushed_at": "2023-09-17T06:37:52Z", + "git_url": "git://github.com/m-mizutani/octovy.git", + "ssh_url": "git@github.com:m-mizutani/octovy.git", + "clone_url": "https://github.com/m-mizutani/octovy.git", + "svn_url": "https://github.com/m-mizutani/octovy", + "homepage": "", + "size": 2230, + "stargazers_count": 51, + "watchers_count": 51, + "language": "Go", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 4, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 57, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "github-app", + "golang", + "security", + "typescript", + "vulnerability-scanners" + ], + "visibility": "public", + "forks": 4, + "open_issues": 57, + "watchers": 51, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "m-mizutani:main", + "ref": "main", + "sha": "08fb7816c6d0a485239ca5f342342186f972a6e7", + "user": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 359010704, + "node_id": "MDEwOlJlcG9zaXRvcnkzNTkwMTA3MDQ=", + "name": "octovy", + "full_name": "m-mizutani/octovy", + "private": false, + "owner": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/m-mizutani/octovy", + "description": "Trivy based vulnerability management service", + "fork": false, + "url": "https://api.github.com/repos/m-mizutani/octovy", + "forks_url": "https://api.github.com/repos/m-mizutani/octovy/forks", + "keys_url": "https://api.github.com/repos/m-mizutani/octovy/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/m-mizutani/octovy/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/m-mizutani/octovy/teams", + "hooks_url": "https://api.github.com/repos/m-mizutani/octovy/hooks", + "issue_events_url": "https://api.github.com/repos/m-mizutani/octovy/issues/events{/number}", + "events_url": "https://api.github.com/repos/m-mizutani/octovy/events", + "assignees_url": "https://api.github.com/repos/m-mizutani/octovy/assignees{/user}", + "branches_url": "https://api.github.com/repos/m-mizutani/octovy/branches{/branch}", + "tags_url": "https://api.github.com/repos/m-mizutani/octovy/tags", + "blobs_url": "https://api.github.com/repos/m-mizutani/octovy/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/m-mizutani/octovy/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/m-mizutani/octovy/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/m-mizutani/octovy/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/m-mizutani/octovy/statuses/{sha}", + "languages_url": "https://api.github.com/repos/m-mizutani/octovy/languages", + "stargazers_url": "https://api.github.com/repos/m-mizutani/octovy/stargazers", + "contributors_url": "https://api.github.com/repos/m-mizutani/octovy/contributors", + "subscribers_url": "https://api.github.com/repos/m-mizutani/octovy/subscribers", + "subscription_url": "https://api.github.com/repos/m-mizutani/octovy/subscription", + "commits_url": "https://api.github.com/repos/m-mizutani/octovy/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/m-mizutani/octovy/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/m-mizutani/octovy/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/m-mizutani/octovy/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/m-mizutani/octovy/contents/{+path}", + "compare_url": "https://api.github.com/repos/m-mizutani/octovy/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/m-mizutani/octovy/merges", + "archive_url": "https://api.github.com/repos/m-mizutani/octovy/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/m-mizutani/octovy/downloads", + "issues_url": "https://api.github.com/repos/m-mizutani/octovy/issues{/number}", + "pulls_url": "https://api.github.com/repos/m-mizutani/octovy/pulls{/number}", + "milestones_url": "https://api.github.com/repos/m-mizutani/octovy/milestones{/number}", + "notifications_url": "https://api.github.com/repos/m-mizutani/octovy/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/m-mizutani/octovy/labels{/name}", + "releases_url": "https://api.github.com/repos/m-mizutani/octovy/releases{/id}", + "deployments_url": "https://api.github.com/repos/m-mizutani/octovy/deployments", + "created_at": "2021-04-18T00:25:50Z", + "updated_at": "2023-08-10T05:59:13Z", + "pushed_at": "2023-09-17T06:37:52Z", + "git_url": "git://github.com/m-mizutani/octovy.git", + "ssh_url": "git@github.com:m-mizutani/octovy.git", + "clone_url": "https://github.com/m-mizutani/octovy.git", + "svn_url": "https://github.com/m-mizutani/octovy", + "homepage": "", + "size": 2230, + "stargazers_count": 51, + "watchers_count": 51, + "language": "Go", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 4, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 57, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "github-app", + "golang", + "security", + "typescript", + "vulnerability-scanners" + ], + "visibility": "public", + "forks": 4, + "open_issues": 57, + "watchers": 51, + "default_branch": "main", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/m-mizutani/octovy/pulls/89" + }, + "html": { + "href": "https://github.com/m-mizutani/octovy/pull/89" + }, + "issue": { + "href": "https://api.github.com/repos/m-mizutani/octovy/issues/89" + }, + "comments": { + "href": "https://api.github.com/repos/m-mizutani/octovy/issues/89/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/m-mizutani/octovy/pulls/89/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/m-mizutani/octovy/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/m-mizutani/octovy/pulls/89/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/m-mizutani/octovy/statuses/69454c171c2f0f2dbc9ccb0c9ef9b72fd769f046" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 0, + "review_comments": 3, + "maintainer_can_modify": false, + "commits": 22, + "additions": 3399, + "deletions": 72648, + "changed_files": 273 + }, + "before": "bca5ddd2023d5c906a0420492deb2ede8d99eb79", + "after": "69454c171c2f0f2dbc9ccb0c9ef9b72fd769f046", + "repository": { + "id": 359010704, + "node_id": "MDEwOlJlcG9zaXRvcnkzNTkwMTA3MDQ=", + "name": "octovy", + "full_name": "m-mizutani/octovy", + "private": false, + "owner": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/m-mizutani/octovy", + "description": "Trivy based vulnerability management service", + "fork": false, + "url": "https://api.github.com/repos/m-mizutani/octovy", + "forks_url": "https://api.github.com/repos/m-mizutani/octovy/forks", + "keys_url": "https://api.github.com/repos/m-mizutani/octovy/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/m-mizutani/octovy/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/m-mizutani/octovy/teams", + "hooks_url": "https://api.github.com/repos/m-mizutani/octovy/hooks", + "issue_events_url": "https://api.github.com/repos/m-mizutani/octovy/issues/events{/number}", + "events_url": "https://api.github.com/repos/m-mizutani/octovy/events", + "assignees_url": "https://api.github.com/repos/m-mizutani/octovy/assignees{/user}", + "branches_url": "https://api.github.com/repos/m-mizutani/octovy/branches{/branch}", + "tags_url": "https://api.github.com/repos/m-mizutani/octovy/tags", + "blobs_url": "https://api.github.com/repos/m-mizutani/octovy/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/m-mizutani/octovy/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/m-mizutani/octovy/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/m-mizutani/octovy/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/m-mizutani/octovy/statuses/{sha}", + "languages_url": "https://api.github.com/repos/m-mizutani/octovy/languages", + "stargazers_url": "https://api.github.com/repos/m-mizutani/octovy/stargazers", + "contributors_url": "https://api.github.com/repos/m-mizutani/octovy/contributors", + "subscribers_url": "https://api.github.com/repos/m-mizutani/octovy/subscribers", + "subscription_url": "https://api.github.com/repos/m-mizutani/octovy/subscription", + "commits_url": "https://api.github.com/repos/m-mizutani/octovy/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/m-mizutani/octovy/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/m-mizutani/octovy/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/m-mizutani/octovy/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/m-mizutani/octovy/contents/{+path}", + "compare_url": "https://api.github.com/repos/m-mizutani/octovy/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/m-mizutani/octovy/merges", + "archive_url": "https://api.github.com/repos/m-mizutani/octovy/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/m-mizutani/octovy/downloads", + "issues_url": "https://api.github.com/repos/m-mizutani/octovy/issues{/number}", + "pulls_url": "https://api.github.com/repos/m-mizutani/octovy/pulls{/number}", + "milestones_url": "https://api.github.com/repos/m-mizutani/octovy/milestones{/number}", + "notifications_url": "https://api.github.com/repos/m-mizutani/octovy/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/m-mizutani/octovy/labels{/name}", + "releases_url": "https://api.github.com/repos/m-mizutani/octovy/releases{/id}", + "deployments_url": "https://api.github.com/repos/m-mizutani/octovy/deployments", + "created_at": "2021-04-18T00:25:50Z", + "updated_at": "2023-08-10T05:59:13Z", + "pushed_at": "2023-09-17T06:37:52Z", + "git_url": "git://github.com/m-mizutani/octovy.git", + "ssh_url": "git@github.com:m-mizutani/octovy.git", + "clone_url": "https://github.com/m-mizutani/octovy.git", + "svn_url": "https://github.com/m-mizutani/octovy", + "homepage": "", + "size": 2230, + "stargazers_count": 51, + "watchers_count": 51, + "language": "Go", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 4, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 57, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "github-app", + "golang", + "security", + "typescript", + "vulnerability-scanners" + ], + "visibility": "public", + "forks": 4, + "open_issues": 57, + "watchers": 51, + "default_branch": "main" + }, + "sender": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 41633205, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNDE2MzMyMDU=" + } +} diff --git a/pkg/controller/server/testdata/github/push.default.json b/pkg/controller/server/testdata/github/push.default.json new file mode 100644 index 0000000..52b68b9 --- /dev/null +++ b/pkg/controller/server/testdata/github/push.default.json @@ -0,0 +1,186 @@ +{ + "ref": "refs/heads/master", + "before": "987e1005c2e3c79631b620c4a76afd4b8111b7b1", + "after": "f58ae7668c3dfc193a1d2c0372cc52847613cde4", + "repository": { + "id": 281879096, + "node_id": "MDEwOlJlcG9zaXRvcnkyODE4NzkwOTY=", + "name": "ops", + "full_name": "m-mizutani/ops", + "private": true, + "owner": { + "name": "m-mizutani", + "email": "mizutani@hey.com", + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/m-mizutani/ops", + "description": null, + "fork": false, + "url": "https://github.com/m-mizutani/ops", + "forks_url": "https://api.github.com/repos/m-mizutani/ops/forks", + "keys_url": "https://api.github.com/repos/m-mizutani/ops/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/m-mizutani/ops/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/m-mizutani/ops/teams", + "hooks_url": "https://api.github.com/repos/m-mizutani/ops/hooks", + "issue_events_url": "https://api.github.com/repos/m-mizutani/ops/issues/events{/number}", + "events_url": "https://api.github.com/repos/m-mizutani/ops/events", + "assignees_url": "https://api.github.com/repos/m-mizutani/ops/assignees{/user}", + "branches_url": "https://api.github.com/repos/m-mizutani/ops/branches{/branch}", + "tags_url": "https://api.github.com/repos/m-mizutani/ops/tags", + "blobs_url": "https://api.github.com/repos/m-mizutani/ops/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/m-mizutani/ops/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/m-mizutani/ops/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/m-mizutani/ops/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/m-mizutani/ops/statuses/{sha}", + "languages_url": "https://api.github.com/repos/m-mizutani/ops/languages", + "stargazers_url": "https://api.github.com/repos/m-mizutani/ops/stargazers", + "contributors_url": "https://api.github.com/repos/m-mizutani/ops/contributors", + "subscribers_url": "https://api.github.com/repos/m-mizutani/ops/subscribers", + "subscription_url": "https://api.github.com/repos/m-mizutani/ops/subscription", + "commits_url": "https://api.github.com/repos/m-mizutani/ops/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/m-mizutani/ops/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/m-mizutani/ops/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/m-mizutani/ops/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/m-mizutani/ops/contents/{+path}", + "compare_url": "https://api.github.com/repos/m-mizutani/ops/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/m-mizutani/ops/merges", + "archive_url": "https://api.github.com/repos/m-mizutani/ops/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/m-mizutani/ops/downloads", + "issues_url": "https://api.github.com/repos/m-mizutani/ops/issues{/number}", + "pulls_url": "https://api.github.com/repos/m-mizutani/ops/pulls{/number}", + "milestones_url": "https://api.github.com/repos/m-mizutani/ops/milestones{/number}", + "notifications_url": "https://api.github.com/repos/m-mizutani/ops/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/m-mizutani/ops/labels{/name}", + "releases_url": "https://api.github.com/repos/m-mizutani/ops/releases{/id}", + "deployments_url": "https://api.github.com/repos/m-mizutani/ops/deployments", + "created_at": 1595488464, + "updated_at": "2022-10-23T01:52:43Z", + "pushed_at": 1694834911, + "git_url": "git://github.com/m-mizutani/ops.git", + "ssh_url": "git@github.com:m-mizutani/ops.git", + "clone_url": "https://github.com/m-mizutani/ops.git", + "svn_url": "https://github.com/m-mizutani/ops", + "homepage": null, + "size": 495, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "stargazers": 0, + "master_branch": "master" + }, + "pusher": { + "name": "m-mizutani", + "email": "mizutani@hey.com" + }, + "sender": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 41633205, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNDE2MzMyMDU=" + }, + "created": false, + "deleted": false, + "forced": false, + "base_ref": null, + "compare": "https://github.com/m-mizutani/ops/compare/987e1005c2e3...f58ae7668c3d", + "commits": [ + { + "id": "f58ae7668c3dfc193a1d2c0372cc52847613cde4", + "tree_id": "6101b6784aec5d25a35cea43f6c6a85affe84e68", + "distinct": true, + "message": "empty commit", + "timestamp": "2023-09-16T12:28:28+09:00", + "url": "https://github.com/m-mizutani/ops/commit/f58ae7668c3dfc193a1d2c0372cc52847613cde4", + "author": { + "name": "Masayoshi Mizutani", + "email": "mizutani@hey.com", + "username": "m-mizutani" + }, + "committer": { + "name": "Masayoshi Mizutani", + "email": "mizutani@hey.com", + "username": "m-mizutani" + }, + "added": [], + "removed": [], + "modified": ["README.md"] + } + ], + "head_commit": { + "id": "f58ae7668c3dfc193a1d2c0372cc52847613cde4", + "tree_id": "6101b6784aec5d25a35cea43f6c6a85affe84e68", + "distinct": true, + "message": "empty commit", + "timestamp": "2023-09-16T12:28:28+09:00", + "url": "https://github.com/m-mizutani/ops/commit/f58ae7668c3dfc193a1d2c0372cc52847613cde4", + "author": { + "name": "Masayoshi Mizutani", + "email": "mizutani@hey.com", + "username": "m-mizutani" + }, + "committer": { + "name": "Masayoshi Mizutani", + "email": "mizutani@hey.com", + "username": "m-mizutani" + }, + "added": [], + "removed": [], + "modified": ["README.md"] + } +} diff --git a/pkg/controller/server/testdata/github/push.json b/pkg/controller/server/testdata/github/push.json new file mode 100644 index 0000000..072b203 --- /dev/null +++ b/pkg/controller/server/testdata/github/push.json @@ -0,0 +1,192 @@ +{ + "ref": "refs/heads/update/packages/20230918", + "before": "0000000000000000000000000000000000000000", + "after": "aa0378cad00d375c1897c1b5b5a4dd125984b511", + "repository": { + "id": 581995051, + "node_id": "R_kgDOIrCKKw", + "name": "masq", + "full_name": "m-mizutani/masq", + "private": false, + "owner": { + "name": "m-mizutani", + "email": "mizutani@hey.com", + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/m-mizutani/masq", + "description": "A utility to redact sensitive data for slog in Go", + "fork": false, + "url": "https://github.com/m-mizutani/masq", + "forks_url": "https://api.github.com/repos/m-mizutani/masq/forks", + "keys_url": "https://api.github.com/repos/m-mizutani/masq/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/m-mizutani/masq/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/m-mizutani/masq/teams", + "hooks_url": "https://api.github.com/repos/m-mizutani/masq/hooks", + "issue_events_url": "https://api.github.com/repos/m-mizutani/masq/issues/events{/number}", + "events_url": "https://api.github.com/repos/m-mizutani/masq/events", + "assignees_url": "https://api.github.com/repos/m-mizutani/masq/assignees{/user}", + "branches_url": "https://api.github.com/repos/m-mizutani/masq/branches{/branch}", + "tags_url": "https://api.github.com/repos/m-mizutani/masq/tags", + "blobs_url": "https://api.github.com/repos/m-mizutani/masq/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/m-mizutani/masq/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/m-mizutani/masq/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/m-mizutani/masq/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/m-mizutani/masq/statuses/{sha}", + "languages_url": "https://api.github.com/repos/m-mizutani/masq/languages", + "stargazers_url": "https://api.github.com/repos/m-mizutani/masq/stargazers", + "contributors_url": "https://api.github.com/repos/m-mizutani/masq/contributors", + "subscribers_url": "https://api.github.com/repos/m-mizutani/masq/subscribers", + "subscription_url": "https://api.github.com/repos/m-mizutani/masq/subscription", + "commits_url": "https://api.github.com/repos/m-mizutani/masq/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/m-mizutani/masq/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/m-mizutani/masq/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/m-mizutani/masq/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/m-mizutani/masq/contents/{+path}", + "compare_url": "https://api.github.com/repos/m-mizutani/masq/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/m-mizutani/masq/merges", + "archive_url": "https://api.github.com/repos/m-mizutani/masq/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/m-mizutani/masq/downloads", + "issues_url": "https://api.github.com/repos/m-mizutani/masq/issues{/number}", + "pulls_url": "https://api.github.com/repos/m-mizutani/masq/pulls{/number}", + "milestones_url": "https://api.github.com/repos/m-mizutani/masq/milestones{/number}", + "notifications_url": "https://api.github.com/repos/m-mizutani/masq/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/m-mizutani/masq/labels{/name}", + "releases_url": "https://api.github.com/repos/m-mizutani/masq/releases{/id}", + "deployments_url": "https://api.github.com/repos/m-mizutani/masq/deployments", + "created_at": 1671955537, + "updated_at": "2023-09-14T00:34:07Z", + "pushed_at": 1694994180, + "git_url": "git://github.com/m-mizutani/masq.git", + "ssh_url": "git@github.com:m-mizutani/masq.git", + "clone_url": "https://github.com/m-mizutani/masq.git", + "svn_url": "https://github.com/m-mizutani/masq", + "homepage": "", + "size": 36, + "stargazers_count": 48, + "watchers_count": 48, + "language": "Go", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 48, + "default_branch": "main", + "stargazers": 48, + "master_branch": "main" + }, + "pusher": { + "name": "m-mizutani", + "email": "mizutani@hey.com" + }, + "sender": { + "login": "m-mizutani", + "id": 605953, + "node_id": "MDQ6VXNlcjYwNTk1Mw==", + "avatar_url": "https://avatars.githubusercontent.com/u/605953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/m-mizutani", + "html_url": "https://github.com/m-mizutani", + "followers_url": "https://api.github.com/users/m-mizutani/followers", + "following_url": "https://api.github.com/users/m-mizutani/following{/other_user}", + "gists_url": "https://api.github.com/users/m-mizutani/gists{/gist_id}", + "starred_url": "https://api.github.com/users/m-mizutani/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/m-mizutani/subscriptions", + "organizations_url": "https://api.github.com/users/m-mizutani/orgs", + "repos_url": "https://api.github.com/users/m-mizutani/repos", + "events_url": "https://api.github.com/users/m-mizutani/events{/privacy}", + "received_events_url": "https://api.github.com/users/m-mizutani/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 41633205, + "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNDE2MzMyMDU=" + }, + "created": true, + "deleted": false, + "forced": false, + "base_ref": null, + "compare": "https://github.com/m-mizutani/masq/commit/aa0378cad00d", + "commits": [ + { + "id": "aa0378cad00d375c1897c1b5b5a4dd125984b511", + "tree_id": "6bfe094e8bee7d87fca34add0b2e3713416adf3c", + "distinct": true, + "message": "Update packages", + "timestamp": "2023-09-18T08:42:57+09:00", + "url": "https://github.com/m-mizutani/masq/commit/aa0378cad00d375c1897c1b5b5a4dd125984b511", + "author": { + "name": "Masayoshi Mizutani", + "email": "mizutani@hey.com", + "username": "m-mizutani" + }, + "committer": { + "name": "Masayoshi Mizutani", + "email": "mizutani@hey.com", + "username": "m-mizutani" + }, + "added": [], + "removed": [], + "modified": ["clone_test.go", "go.mod", "go.sum"] + } + ], + "head_commit": { + "id": "aa0378cad00d375c1897c1b5b5a4dd125984b511", + "tree_id": "6bfe094e8bee7d87fca34add0b2e3713416adf3c", + "distinct": true, + "message": "Update packages", + "timestamp": "2023-09-18T08:42:57+09:00", + "url": "https://github.com/m-mizutani/masq/commit/aa0378cad00d375c1897c1b5b5a4dd125984b511", + "author": { + "name": "Masayoshi Mizutani", + "email": "mizutani@hey.com", + "username": "m-mizutani" + }, + "committer": { + "name": "Masayoshi Mizutani", + "email": "mizutani@hey.com", + "username": "m-mizutani" + }, + "added": [], + "removed": [], + "modified": ["clone_test.go", "go.mod", "go.sum"] + } +} diff --git a/pkg/controller/server/user.go b/pkg/controller/server/user.go deleted file mode 100644 index ca56cf1..0000000 --- a/pkg/controller/server/user.go +++ /dev/null @@ -1,26 +0,0 @@ -package server - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -func getUser(c *gin.Context) { - ssn := getSession(c) - if ssn == nil { - c.Error(goerr.Wrap(model.ErrAuthenticationFailed)) - return - } - - uc := getUsecase(c) - user, err := uc.LookupUser(model.NewContextWith(c), ssn.UserID) - if err != nil { - c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: user}) -} diff --git a/pkg/controller/server/validate.go b/pkg/controller/server/validate.go deleted file mode 100644 index a8f71e5..0000000 --- a/pkg/controller/server/validate.go +++ /dev/null @@ -1,13 +0,0 @@ -package server - -/* -var ptnCommitID *regexp.Regexp - -func initValidate() { - ptnCommitID = regexp.MustCompile("^[0-9a-f]{40}$") -} - -func isValidCommitID(s string) bool { - return ptnCommitID.MatchString(s) -} -*/ diff --git a/pkg/controller/server/vulnerability.go b/pkg/controller/server/vulnerability.go deleted file mode 100644 index d6f4618..0000000 --- a/pkg/controller/server/vulnerability.go +++ /dev/null @@ -1,154 +0,0 @@ -package server - -import ( - "net/http" - "strconv" - - "github.com/gin-gonic/gin" - - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/domain/types" - "github.com/m-mizutani/octovy/pkg/infra/ent" -) - -type respVulnerabilities struct { - Vulnerabilities []*ent.Vulnerability `json:"vulnerabilities"` - Total int `json:"total"` -} - -func getVulnerabilities(c *gin.Context) { - uc := getUsecase(c) - var limit, offset int64 - var err error - - if s := c.Query("limit"); s == "" { - limit = 20 - } else { - if limit, err = strconv.ParseInt(s, 10, 32); err != nil { - c.Error(model.ErrInvalidInput.Wrap(err)) - return - } - if limit <= 0 { - c.Error(goerr.Wrap(model.ErrInvalidInput, "limit must be greater than 0")) - return - } - } - - // offset default is 0 - if s := c.Query("offset"); s != "" { - if offset, err = strconv.ParseInt(s, 10, 32); err != nil { - c.Error(model.ErrInvalidInput.Wrap(err)) - return - } - if offset < 0 { - c.Error(goerr.Wrap(model.ErrInvalidInput, "offset must be equal or greater than 0")) - return - } - } - - ctx := model.NewContextWith(c) - vulns, err := uc.GetVulnerabilities(ctx, offset, limit) - if err != nil { - _ = c.Error(err) - return - } - count, err := uc.GetVulnerabilityCount(ctx) - if err != nil { - c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: respVulnerabilities{ - Vulnerabilities: vulns, - Total: count, - }}) -} - -func getVulnerability(c *gin.Context) { - uc := getUsecase(c) - - vulnID := c.Param("vuln_id") - - resp, err := uc.GetVulnerability(model.NewContextWith(c), vulnID) - if err != nil { - c.Error(err) - return - } - if resp == nil { - c.Error(goerr.Wrap(model.ErrVulnerabilityNotFound)) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: resp}) -} - -func postVulnerability(c *gin.Context) { - uc := getUsecase(c) - - var vuln *ent.Vulnerability - if err := c.BindJSON(&vuln); err != nil { - c.Error(goerr.Wrap(err)) - return - } - - if err := uc.CreateVulnerability(model.NewContextWith(c), vuln); err != nil { - c.Error(err) - return - } - - c.JSON(http.StatusCreated, baseResponse{}) -} - -type postVulnStatusRequest struct { - Status types.VulnStatusType - Source string - PkgType string - PkgName string - VulnID string - ExpiresAt int64 - Comment string -} - -func postVulnStatus(c *gin.Context) { - uc := getUsecase(c) - ssn := getSession(c) - if ssn == nil { - errResp(c, http.StatusUnauthorized, model.ErrAuthenticationFailed) - return - } - - owner := c.Param("owner") - repoName := c.Param("repo_name") - - var req postVulnStatusRequest - if err := c.BindJSON(&req); err != nil { - _ = c.Error(err) - return - } - - vulnStatus := &model.UpdateVulnStatusRequest{ - GitHubRepo: model.GitHubRepo{ - Owner: owner, - Name: repoName, - }, - VulnStatus: ent.VulnStatus{ - Status: req.Status, - Source: req.Source, - PkgType: req.PkgType, - PkgName: req.PkgName, - VulnID: req.VulnID, - ExpiresAt: req.ExpiresAt, - Comment: req.Comment, - }, - UserID: ssn.UserID, - } - - added, err := uc.UpdateVulnStatus(model.NewContextWith(c), vulnStatus) - if err != nil { - _ = c.Error(err) - return - } - - c.JSON(http.StatusOK, baseResponse{Data: added}) -} diff --git a/pkg/controller/server/webhook.go b/pkg/controller/server/webhook.go deleted file mode 100644 index a03eadd..0000000 --- a/pkg/controller/server/webhook.go +++ /dev/null @@ -1,97 +0,0 @@ -package server - -import ( - "encoding/json" - "io/ioutil" - - "github.com/gin-gonic/gin" - "github.com/google/go-github/v39/github" - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -func postWebhookGitHub(c *gin.Context) { - uc := getUsecase(c) - - githubEventType := c.Request.Header.Get("X-GitHub-Event") - if githubEventType == "" { - _ = c.Error(goerr.Wrap(errAPIInvalidParameter, "No X-GitHub-Event")) - return - } - - eventBody, err := ioutil.ReadAll(c.Request.Body) - if err != nil { - _ = c.Error(goerr.Wrap(err, "Failed to read github webhook event body")) - return - } - - if err := uc.VerifyGitHubSecret(c.GetHeader("X-Hub-Signature-256"), eventBody); err != nil { - _ = c.Error(err) - return - } - - // github.com/google/go-github/v29/github have not support integration_installation - if githubEventType == "integration_installation" { - return - } - - raw, err := github.ParseWebHook(githubEventType, eventBody) - if err != nil { - _ = c.Error(goerr.Wrap(err, "Failed to parse github webhook event body").With("body", string(eventBody))) - return - } - - ctx := model.NewContextWith(c) - switch event := raw.(type) { - case *github.PushEvent: - if err := uc.HandleGitHubPushEvent(ctx, event); err != nil { - _ = c.Error(err) - return - } - - case *github.PullRequestEvent: - if err := uc.HandleGitHubPullReqEvent(ctx, event); err != nil { - _ = c.Error(err) - return - } - - case *github.InstallationEvent: - if err := uc.HandleGitHubInstallationEvent(ctx, event); err != nil { - _ = c.Error(err) - return - } - - default: - getLog(c).With("event", event).With("type", githubEventType).Warn("Unsupported event") - } - - c.JSON(200, baseResponse{Data: "OK"}) -} - -func postWebhookTrivy(c *gin.Context) { - uc := getUsecase(c) - - // Do not use json.Encoder because body can not be viewed if failed - if c.Request.Body == nil { - _ = c.Error(goerr.Wrap(model.ErrInvalidInput, "no body")) - return - } - data, err := ioutil.ReadAll(c.Request.Body) - if err != nil { - _ = c.Error(goerr.Wrap(err, "Failed to read trivy webhook event body")) - return - } - - var req model.PushTrivyResultRequest - if err := json.Unmarshal(data, &req); err != nil { - _ = c.Error(goerr.Wrap(err, "Failed to unmarshal trivy result request").With("body", string(data))) - return - } - - if err := uc.PushTrivyResult(model.NewContextWith(c), &req); err != nil { - _ = c.Error(goerr.Wrap(err).With("req", req)) - return - } - - c.JSON(200, baseResponse{Data: "OK"}) -} diff --git a/pkg/domain/model/api.go b/pkg/domain/model/api.go deleted file mode 100644 index 13497c6..0000000 --- a/pkg/domain/model/api.go +++ /dev/null @@ -1,114 +0,0 @@ -package model - -import ( - "math/rand" - "regexp" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/go-ozzo/ozzo-validation/v4/is" - - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/infra/ent" -) - -type RespVulnerability struct { - Vulnerability *ent.Vulnerability `json:"vulnerability"` - Affected []*ent.Repository `json:"affected"` -} - -type RequestSeverity struct { - Label string - Color string -} - -var ( - colorRegex = regexp.MustCompile("^#[0-9A-Fa-f]{6}$") -) - -func randomColor() string { - s := "#" - chars := "0123456789ABCDEF" - for i := 0; i < 6; i++ { - s += string(chars[int(rand.Uint32())%len(chars)]) - } - - return s -} - -func (x *RequestSeverity) IsValid() error { - if x.Label == "" { - return goerr.Wrap(ErrInvalidInput, "empty severity name is not allowed") - } - - // Fill random color if empty - if x.Color == "" { - x.Color = randomColor() - } - - if !colorRegex.MatchString(x.Color) { - return goerr.Wrap(ErrInvalidInput, "invalid color schema") - } - - return nil -} - -type RequestRepoLabel struct { - Name string `json:"name"` - Description string `json:"description"` - Color string `json:"color"` -} - -func (x *RequestRepoLabel) IsValid() error { - if err := validation.Validate(x.Name, - validation.Required, - validation.Length(1, 64), - is.ASCII, - ); err != nil { - return ErrInvalidInput.Wrap(err).With("field", "name") - } - - if err := validation.Validate(x.Description, - validation.Length(0, 256), - ); err != nil { - return ErrInvalidInput.Wrap(err).With("field", "description") - } - - if err := validation.Validate(x.Color, - is.HexColor, - validation.Length(4, 7), - ); err != nil { - return ErrInvalidInput.Wrap(err).With("field", "color") - } - - return nil - -} - -type GetRepoScanRequest struct { - GitHubRepo - Limit int `json:"limit"` - Offset int `json:"offset"` -} - -type PushTrivyResultRequest struct { - Target ScanTarget - Report TrivyReport -} - -func (x *PushTrivyResultRequest) IsValid() error { - const ghNameRegex = `^[a-z0-9]+(?:(?:(?:[._]|__|[-]*)[a-z0-9]+)+)?$` - ghNamePtn := regexp.MustCompile(ghNameRegex) - commitPtn := regexp.MustCompile(`^[0-9a-f]{40}$`) - - if err := validation.ValidateStruct(&x.Target, - validation.Field(&x.Target.Owner, validation.Required, validation.Match(ghNamePtn)), - validation.Field(&x.Target.Name, validation.Required, validation.Match(ghNamePtn)), - validation.Field(&x.Target.Branch, validation.Required, validation.Match(ghNamePtn)), - validation.Field(&x.Target.Branch, validation.Required, validation.Match(ghNamePtn)), - validation.Field(&x.Target.CommitID, validation.Length(40, 40), validation.Required, validation.Match(commitPtn)), - ); err != nil { - return ErrInvalidInput.Wrap(err).With("req", x) - } - - return nil -} diff --git a/pkg/domain/model/api_test.go b/pkg/domain/model/api_test.go deleted file mode 100644 index 4ce91cb..0000000 --- a/pkg/domain/model/api_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package model_test - -import ( - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/stretchr/testify/assert" -) - -func TestRequestSeverity(t *testing.T) { - t.Run("empty color is valid", func(t *testing.T) { - req := model.RequestSeverity{ - Label: "a", - } - assert.NoError(t, req.IsValid()) - assert.NotEmpty(t, req.Color) - }) - - t.Run("invalid color", func(t *testing.T) { - invalid := []string{ - "abcdef", - "#ABCDEG", - " #ABCDEF", - "#ABCDEF ", - } - - for _, c := range invalid { - t.Run("test with "+c, func(t *testing.T) { - req := model.RequestSeverity{ - Label: "a", - Color: c, - } - assert.Error(t, req.IsValid()) - }) - } - }) - -} diff --git a/pkg/domain/model/config.go b/pkg/domain/model/config.go deleted file mode 100644 index 53aabc4..0000000 --- a/pkg/domain/model/config.go +++ /dev/null @@ -1,17 +0,0 @@ -package model - -type Config struct { - FrontendURL string - - DisableFrontend bool - DisableWebhookGitHub bool - DisableWebhookTrivy bool - - ServerAddr string - ServerPort int - - GitHubWebhookSecret string `zlog:"secret"` - - SentryDSN string - SentryEnv string -} diff --git a/pkg/domain/model/const.go b/pkg/domain/model/const.go deleted file mode 100644 index 7bd985b..0000000 --- a/pkg/domain/model/const.go +++ /dev/null @@ -1,5 +0,0 @@ -package model - -const ( - Version = "0.0.1" -) diff --git a/pkg/domain/model/context.go b/pkg/domain/model/context.go index 14b6405..7a475a9 100644 --- a/pkg/domain/model/context.go +++ b/pkg/domain/model/context.go @@ -2,59 +2,48 @@ package model import ( "context" - "time" + "log/slog" - "github.com/gin-gonic/gin" "github.com/m-mizutani/octovy/pkg/utils" - "github.com/m-mizutani/zlog" -) - -const ( - ContextKeyLogger = "logger" ) type Context struct { - base context.Context - log *zlog.LogEntity + logger *slog.Logger + context.Context } -func NewContext() *Context { - return NewContextWith(context.Background()) +func (x *Context) Logger() *slog.Logger { return x.logger } +func (x *Context) New(options ...Option) *Context { + newCtx := *x + for _, opt := range options { + opt(&newCtx) + } + return &newCtx } -func NewContextWith(ctx context.Context) *Context { - newCtx := &Context{ - base: ctx, +func NewContext(options ...Option) *Context { + ctx := &Context{ + logger: utils.Logger(), + Context: context.Background(), } - if ginCtx, ok := ctx.(*gin.Context); ok { - if obj, ok := ginCtx.Get(ContextKeyLogger); ok { - if log, ok := obj.(*zlog.LogEntity); ok { - newCtx.log = log - } - } + + for _, opt := range options { + opt(ctx) } - return newCtx + return ctx } -func (x *Context) Deadline() (deadline time.Time, ok bool) { - return x.base.Deadline() -} -func (x *Context) Done() <-chan struct{} { return x.base.Done() } -func (x *Context) Err() error { return x.base.Err() } -func (x *Context) Value(key interface{}) interface{} { return x.base.Value(key) } - -// Logging feature -func (x *Context) Log() *zlog.LogEntity { - if x.log == nil { - x.log = utils.Logger.Log() +type Option func(*Context) + +func WithLogger(logger *slog.Logger) Option { + return func(ctx *Context) { + ctx.logger = logger } - return x.log } -func (x *Context) With(key string, value interface{}) *zlog.LogEntity { - if x.log == nil { - x.log = utils.Logger.Log() + +func WithBase(base context.Context) Option { + return func(ctx *Context) { + ctx.Context = base } - x.log = x.log.With(key, value) - return x.log } diff --git a/pkg/domain/model/ent.go b/pkg/domain/model/ent.go deleted file mode 100644 index 4896fe6..0000000 --- a/pkg/domain/model/ent.go +++ /dev/null @@ -1,77 +0,0 @@ -package model - -import ( - "strings" - "time" - - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/utils" -) - -var logger = utils.Logger - -func TrivyReportToEnt(report *TrivyReport, now time.Time) (pkgList []*ent.PackageRecord, vulnList []*ent.Vulnerability) { - ptrKey := func(name, ver string) string { - return name + "|" + ver - } - vulnMap := map[string]*ent.Vulnerability{} - - for _, result := range report.Results { - pkgPtr := map[string]*ent.PackageRecord{} - for _, pkg := range result.Packages { - src := result.Target - if result.Class != "lang-pkgs" { - src = string(result.Class) + "@" + result.Type - } - - p := &ent.PackageRecord{ - Type: result.Type, - Source: src, - Name: pkg.Name, - Version: pkg.Version, - } - pkgList = append(pkgList, p) - pkgPtr[ptrKey(pkg.Name, pkg.Version)] = p - } - - for _, vuln := range result.Vulnerabilities { - var cvss []string - for vendor, v := range vuln.CVSS { - if v.V2Vector != "" { - cvss = append(cvss, strings.Join([]string{vendor, "V2Vector", v.V2Vector}, ",")) - } - if v.V3Vector != "" { - cvss = append(cvss, strings.Join([]string{vendor, "V3Vector", v.V3Vector}, ",")) - } - } - - v := &ent.Vulnerability{ - ID: vuln.VulnerabilityID, - FirstSeenAt: now.Unix(), - Title: vuln.Title, - Description: vuln.Description, - CweID: vuln.CweIDs, - Severity: vuln.Severity, - Cvss: cvss, - References: vuln.References, - } - if vuln.LastModifiedDate != nil { - v.LastModifiedAt = vuln.LastModifiedDate.Unix() - } - - vulnMap[v.ID] = v - - if pkg, ok := pkgPtr[ptrKey(vuln.PkgName, vuln.InstalledVersion)]; ok { - pkg.VulnIds = append(pkg.VulnIds, vuln.VulnerabilityID) - } else { - logger.With("vuln", vuln).Warn("package is not inserted") - } - } - } - - for _, v := range vulnMap { - vulnList = append(vulnList, v) - } - - return -} diff --git a/pkg/domain/model/ent_test.go b/pkg/domain/model/ent_test.go deleted file mode 100644 index b473933..0000000 --- a/pkg/domain/model/ent_test.go +++ /dev/null @@ -1,249 +0,0 @@ -package model_test - -import ( - "testing" - "time" - - ftypes "github.com/aquasecurity/fanal/types" - dtypes "github.com/aquasecurity/trivy-db/pkg/types" - "github.com/aquasecurity/trivy/pkg/report" - ttypes "github.com/aquasecurity/trivy/pkg/types" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestTrivyReportToEnt(t *testing.T) { - t.Run("empty to empty", func(t *testing.T) { - pkg, vuln := model.TrivyReportToEnt(&model.TrivyReport{}, time.Now()) - assert.Len(t, pkg, 0) - assert.Len(t, vuln, 0) - }) - - t.Run("fully check", func(t *testing.T) { - ts1 := time.Now() - ts2 := ts1.Add(-time.Hour * 30) - - pkg, vuln := model.TrivyReportToEnt(&model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Class: "lang-pkgs", - Type: "bundler", - Packages: []ftypes.Package{ - { - Name: "example", - Version: "6.1.4", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-1000", - PkgName: "example", - InstalledVersion: "6.1.4", - FixedVersion: "6.1.5", - Vulnerability: dtypes.Vulnerability{ - Title: "test vuln", - Description: "it's test", - Severity: "low", - CweIDs: []string{"CWE-000"}, - CVSS: dtypes.VendorCVSS{ - "x": dtypes.CVSS{ - V2Vector: "test2", - V3Vector: "test3", - }, - }, - References: []string{ - "https://example.com", - }, - LastModifiedDate: &ts2, - }, - }, - }, - }, - }, - }, ts1) - - require.Len(t, pkg, 1) - assert.Equal(t, &ent.PackageRecord{ - Type: "bundler", - Name: "example", - Source: "Gemfile.lock", - Version: "6.1.4", - VulnIds: []string{"CVE-1000"}, - }, pkg[0]) - - require.Len(t, vuln, 1) - assert.Equal(t, &ent.Vulnerability{ - ID: "CVE-1000", - FirstSeenAt: ts1.Unix(), - LastModifiedAt: ts2.Unix(), - Title: "test vuln", - Description: "it's test", - Severity: "low", - CweID: []string{"CWE-000"}, - Cvss: []string{ - "x,V2Vector,test2", - "x,V3Vector,test3", - }, - References: []string{ - "https://example.com", - }, - }, vuln[0]) - }) - - t.Run("no matched package (invalid data, but ignore)", func(t *testing.T) { - t.Run("version is not matched", func(t *testing.T) { - pkg, vuln := model.TrivyReportToEnt(&model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Type: "bundler", - Packages: []ftypes.Package{ - { - Name: "example", - Version: "1.1.4", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-1000", - PkgName: "example", - InstalledVersion: "6.1.4", - }, - }, - }, - }, - }, time.Now()) - - require.Len(t, pkg, 1) - require.Len(t, vuln, 1) - assert.Len(t, pkg[0].VulnIds, 0) - }) - - t.Run("name is not matched", func(t *testing.T) { - pkg, vuln := model.TrivyReportToEnt(&model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Type: "bundler", - Packages: []ftypes.Package{ - { - Name: "blue", - Version: "6.1.4", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-1000", - PkgName: "example", - InstalledVersion: "6.1.4", - }, - }, - }, - }, - }, time.Now()) - - require.Len(t, pkg, 1) - require.Len(t, vuln, 1) - assert.Len(t, pkg[0].VulnIds, 0) - }) - }) - - t.Run("vulnerability not duplicated", func(t *testing.T) { - pkg, vuln := model.TrivyReportToEnt(&model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Type: "bundler", - Packages: []ftypes.Package{ - { - Name: "example", - Version: "6.1.4", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-1000", - PkgName: "example", - InstalledVersion: "6.1.4", - }, - }, - }, - { - Target: "tmp/Gemfile.lock", - Type: "bundler", - Packages: []ftypes.Package{ - { - Name: "example", - Version: "6.1.4", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-1000", - PkgName: "example", - InstalledVersion: "6.1.4", - }, - }, - }, - }, - }, time.Now()) - - require.Len(t, pkg, 2) - require.Len(t, vuln, 1) - }) - - t.Run("import OS package", func(t *testing.T) { - ts1 := time.Now() - ts2 := ts1.Add(-time.Hour * 30) - - pkg, vuln := model.TrivyReportToEnt(&model.TrivyReport{ - Results: report.Results{ - { - Target: "gcr.io/example:xxxxxxxx", - Class: "os-pkgs", - Type: "debian", - Packages: []ftypes.Package{ - { - Name: "example", - Version: "6.1.4", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-1000", - PkgName: "example", - InstalledVersion: "6.1.4", - FixedVersion: "6.1.5", - Vulnerability: dtypes.Vulnerability{ - Title: "test vuln", - Description: "it's test", - Severity: "low", - CweIDs: []string{"CWE-000"}, - CVSS: dtypes.VendorCVSS{ - "x": dtypes.CVSS{ - V2Vector: "test2", - V3Vector: "test3", - }, - }, - References: []string{ - "https://example.com", - }, - LastModifiedDate: &ts2, - }, - }, - }, - }, - }, - }, ts1) - - require.Len(t, pkg, 1) - require.Len(t, vuln, 1) - assert.Len(t, pkg[0].VulnIds, 1) - assert.Equal(t, pkg[0].Source, "os-pkgs@debian") - assert.Contains(t, pkg[0].VulnIds, "CVE-1000") - }) -} diff --git a/pkg/domain/model/errors.go b/pkg/domain/model/errors.go deleted file mode 100644 index 1936740..0000000 --- a/pkg/domain/model/errors.go +++ /dev/null @@ -1,24 +0,0 @@ -package model - -import "github.com/m-mizutani/goerr" - -var ( - ErrDatabaseUnexpected = goerr.New("database failure") - ErrDatabaseInvalidInput = goerr.New("invalid input for database") - ErrItemNotFound = goerr.New("item not found") - ErrInvalidSystemValue = goerr.New("invalid system value") - - ErrInvalidGitHubData = goerr.New("invalid github data") - - ErrInvalidInput = goerr.New("invalid input data") - ErrAuthenticationFailed = goerr.New("authentication failed") - ErrNotAuthenticated = goerr.New("not authenticated request") - ErrNotAuthorized = goerr.New("not authorized request") - ErrUserNotFound = goerr.New("user not found") - ErrVulnerabilityNotFound = goerr.New("vulnerability not found") - ErrInvalidWebhookData = goerr.New("invalid webhook data") - ErrGitHubAPI = goerr.New("github API returns unexpected response") - - // Rule error - ErrInvalidPolicyResult = goerr.New("invalid rule result") -) diff --git a/pkg/domain/model/export_test.go b/pkg/domain/model/export_test.go deleted file mode 100644 index 5b49e51..0000000 --- a/pkg/domain/model/export_test.go +++ /dev/null @@ -1,5 +0,0 @@ -package model - -func (x *Report) Sources() map[string]*SourceChanges { - return x.sources -} diff --git a/pkg/domain/model/github.go b/pkg/domain/model/github.go deleted file mode 100644 index 6f043f7..0000000 --- a/pkg/domain/model/github.go +++ /dev/null @@ -1,26 +0,0 @@ -package model - -type GitHubRepo struct { - Owner string `json:"owner"` - Name string `json:"name"` -} - -type GitHubBranch struct { - GitHubRepo - Branch string `json:"branch"` -} - -type GitHubToken struct { - UserID string - AccessToken string `json:"access_token"` - ExpiresIn int64 `json:"expires_in"` - RefreshToken string `json:"refresh_token"` - RefreshTokenExpiresIn int64 `json:"refresh_token_expires_in"` - Scope string `json:"scope"` - TokenType string `json:"token_type"` -} - -type GitHubCheckResult struct { - Conclusion string `json:"conclusion"` - Messages []string `json:"messages"` -} diff --git a/pkg/domain/model/message.go b/pkg/domain/model/message.go deleted file mode 100644 index 01a4071..0000000 --- a/pkg/domain/model/message.go +++ /dev/null @@ -1,27 +0,0 @@ -package model - -import ( - "github.com/m-mizutani/octovy/pkg/infra/ent" -) - -type ScanTarget struct { - GitHubBranch - CommitID string - UpdatedAt int64 - RequestedAt int64 - URL string - TargetBranch string -} - -type ScanRepositoryRequest struct { - ScanTarget - InstallID int64 - PullReqNumber *int - PullReqAction string -} - -type UpdateVulnStatusRequest struct { - GitHubRepo - UserID int - ent.VulnStatus -} diff --git a/pkg/domain/model/package.go b/pkg/domain/model/package.go deleted file mode 100644 index ea22515..0000000 --- a/pkg/domain/model/package.go +++ /dev/null @@ -1,100 +0,0 @@ -package model - -import ( - "github.com/m-mizutani/octovy/pkg/infra/ent" -) - -type ScanReport struct { - Repo Repository `json:"repo"` - CommitID string `json:"commit_id"` - Sources []*PackageSource `json:"sources"` -} - -func NewScanReport(scan *ent.Scan, statuses []*ent.VulnStatus, now int64) *ScanReport { - repo := &ent.Repository{} - if len(scan.Edges.Repository) > 0 { - repo = scan.Edges.Repository[0] - } - - db := NewVulnStatusDB(statuses, now) - - srcMap := map[string]*PackageSource{} - for i := range scan.Edges.Packages { - pkg := &Package{ - PackageRecord: *scan.Edges.Packages[i], - } - - src, ok := srcMap[pkg.Source] - if !ok { - src = &PackageSource{ - Source: pkg.Source, - } - srcMap[pkg.Source] = src - } - - for _, vuln := range scan.Edges.Packages[i].Edges.Vulnerabilities { - v := &Vulnerability{ - Vulnerability: *vuln, - Status: db.Lookup(&pkg.PackageRecord, vuln.ID), - } - if vuln.Edges.CustomSeverity != nil { - v.CustomSeverity = vuln.Edges.CustomSeverity.Label - } - - pkg.Vulnerabilities = append(pkg.Vulnerabilities, v) - } - - src.Packages = append(src.Packages, pkg) - } - - labels := make([]string, len(repo.Edges.Labels)) - for i := range repo.Edges.Labels { - labels[i] = repo.Edges.Labels[i].Name - } - - inventory := &ScanReport{ - Repo: Repository{ - GitHubBranch: GitHubBranch{ - GitHubRepo: GitHubRepo{ - Owner: repo.Owner, - Name: repo.Name, - }, - Branch: scan.Branch, - }, - Labels: labels, - }, - Sources: []*PackageSource{}, - } - for _, v := range srcMap { - inventory.Sources = append(inventory.Sources, v) - } - return inventory -} - -type Repository struct { - GitHubBranch - Labels []string `json:"labels"` - DefaultBranch string `json:"default_branch"` -} - -type PackageSource struct { - Source string `json:"source"` - Packages []*Package `json:"packages"` -} - -type Package struct { - ent.PackageRecord - Vulnerabilities []*Vulnerability `json:"vulnerabilities,omitempty"` - - // To remove "edges" field in JSON - Edges *struct{} `json:"edges,omitempty"` -} - -type Vulnerability struct { - ent.Vulnerability - Status *ent.VulnStatus `json:"status,omitempty"` - CustomSeverity string `json:"custom_severity"` - - // To remove "edges" field in JSON - Edges *struct{} `json:"edges,omitempty"` -} diff --git a/pkg/domain/model/report.go b/pkg/domain/model/report.go deleted file mode 100644 index 2639bc7..0000000 --- a/pkg/domain/model/report.go +++ /dev/null @@ -1,125 +0,0 @@ -package model - -import ( - "fmt" - "strings" -) - -type SourceChanges struct { - Added VulnChanges - Deleted VulnChanges - Remained VulnChanges -} - -type Report struct { - scanID string - frontendURL string - sources map[string]*SourceChanges -} - -func MakeReport(scanID string, changes VulnChanges, db *VulnStatusDB, url string) *Report { - report := &Report{ - scanID: scanID, - sources: make(map[string]*SourceChanges), - frontendURL: strings.Trim(url, "/"), - } - for _, src := range changes.Sources() { - target := changes.FilterBySource(src) - qualified := target.Qualified(db) - - report.sources[src] = &SourceChanges{ - Added: qualified.FilterByType(VulnAdded), - Deleted: target.FilterByType(VulnDeleted), - Remained: qualified.FilterByType(VulnRemained), - } - } - - return report -} - -func (x *Report) Summary() string { - var added, fixed, remained int - for _, changes := range x.sources { - added += len(changes.Added) - fixed += len(changes.Deleted) - remained += len(changes.Remained) - } - - var parts []string - if added > 0 { - parts = append(parts, fmt.Sprintf("New %d", added)) - } - if remained > 0 { - parts = append(parts, fmt.Sprintf("Remained %d", remained)) - } - - if len(parts) == 0 { - return "✅ No vulnerability is found" - } - if fixed > 0 && added == 0 && remained == 0 { - return fmt.Sprintf("✅ Fixed %d vulnerability", fixed) - } - - return "⚠️ Found " + strings.Join(parts, ", ") + " vulnerabilities" -} - -func (x *Report) ToMarkdown() string { - var b githubCommentBody - b.Add("## Octovy scan result") - b.Break() - - for src, changes := range x.sources { - b.Add("### " + src) - b.Break() - - for _, v := range changes.Added { - b.Add("- 🚨 **New** %s (%s): %s", v.Vuln.ID, v.Pkg.Name, v.Vuln.Title) - } - for _, v := range changes.Deleted { - b.Add("- ✅ **Fixed** %s (%s): %s", v.Vuln.ID, v.Pkg.Name, v.Vuln.Title) - } - if len(changes.Remained) > 0 { - b.Add("- ⚠️ %d vulnerabilities are remained", len(changes.Remained)) - } - b.Break() - } - - b.Add("🗒️ See [report](%s/scan/%s) more detail", x.frontendURL, x.scanID) - - return b.Join() -} - -type githubCommentBody struct { - lines []string -} - -func (x *githubCommentBody) Add(f string, v ...interface{}) { - x.lines = append(x.lines, fmt.Sprintf(f, v...)) -} -func (x *githubCommentBody) Break() { - x.lines = append(x.lines, "") -} -func (x *githubCommentBody) Join() string { return strings.Join(x.lines, "\n") } - -func (x *Report) NothingToNotify(githubEvent string) bool { - switch githubEvent { - case "opened": - for _, src := range x.sources { - if len(src.Added) > 0 || len(src.Deleted) > 0 || len(src.Remained) > 0 { - return false - } - } - return true - - case "synchronize": - for _, src := range x.sources { - if len(src.Added) > 0 || len(src.Deleted) > 0 { - return false - } - } - return true - - default: - panic("unsupported github event: " + githubEvent) - } -} diff --git a/pkg/domain/model/report_test.go b/pkg/domain/model/report_test.go deleted file mode 100644 index 54c55df..0000000 --- a/pkg/domain/model/report_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package model_test - -import ( - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestReport(t *testing.T) { - t.Run("", func(t *testing.T) { - oldPkgs := []*ent.PackageRecord{ - { - Source: "x", - Name: "blue", - Edges: ent.PackageRecordEdges{ - Vulnerabilities: []*ent.Vulnerability{ - {ID: "0001"}, - {ID: "0002"}, - }, - }, - }, - { - Source: "x", - Name: "red", - Edges: ent.PackageRecordEdges{ - Vulnerabilities: []*ent.Vulnerability{ - {ID: "0001"}, - }, - }, - }, - } - newPkgs := []*ent.PackageRecord{ - { - Source: "x", - Name: "blue", - Edges: ent.PackageRecordEdges{ - Vulnerabilities: []*ent.Vulnerability{ - {ID: "0001"}, - {ID: "0002"}, - }, - }, - }, - { - Source: "x", - Name: "orange", - Edges: ent.PackageRecordEdges{ - Vulnerabilities: []*ent.Vulnerability{ - {ID: "0001"}, - }, - }, - }, - } - changes := model.DiffVulnRecords(oldPkgs, newPkgs) - db := model.NewVulnStatusDB([]*ent.VulnStatus{}, 1000) - report := model.MakeReport("scan1", changes, db, "https://example.com") - assert.NotNil(t, report) - { - require.Len(t, report.Sources()["x"].Added, 1) - r := report.Sources()["x"].Added[0] - assert.Equal(t, "orange", r.Pkg.Name) - assert.Equal(t, "x", r.Pkg.Source) - assert.Equal(t, "0001", r.Vuln.ID) - } - { - require.Len(t, report.Sources()["x"].Deleted, 1) - r := report.Sources()["x"].Deleted[0] - assert.Equal(t, "red", r.Pkg.Name) - assert.Equal(t, "x", r.Pkg.Source) - assert.Equal(t, "0001", r.Vuln.ID) - } - { - require.Len(t, report.Sources()["x"].Remained, 2) - r := report.Sources()["x"].Remained[0] - assert.Equal(t, "blue", r.Pkg.Name) - } - }) -} diff --git a/pkg/domain/model/trivy.go b/pkg/domain/model/trivy.go deleted file mode 100644 index 08b9f0d..0000000 --- a/pkg/domain/model/trivy.go +++ /dev/null @@ -1,7 +0,0 @@ -package model - -import ( - "github.com/aquasecurity/trivy/pkg/report" -) - -type TrivyReport report.Report diff --git a/pkg/domain/model/vuln_status.go b/pkg/domain/model/vuln_status.go deleted file mode 100644 index 0e29b1b..0000000 --- a/pkg/domain/model/vuln_status.go +++ /dev/null @@ -1,187 +0,0 @@ -package model - -import ( - "fmt" - - "github.com/m-mizutani/octovy/pkg/domain/types" - "github.com/m-mizutani/octovy/pkg/infra/ent" -) - -type VulnStatusDB struct { - dict map[string]*ent.VulnStatus -} - -func vulnStatusKey(src, pkgName, vulnID string) string { - return fmt.Sprintf("%s|%s|%s", src, pkgName, vulnID) -} - -func NewVulnStatusDB(statuses []*ent.VulnStatus, now int64) *VulnStatusDB { - db := &VulnStatusDB{ - dict: make(map[string]*ent.VulnStatus), - } - for _, status := range statuses { - key := vulnStatusKey(status.Source, status.PkgName, status.VulnID) - if status.Status == types.StatusNone { - continue - } - if status.Status == types.StatusSnoozed && status.ExpiresAt < now { - continue - } - db.dict[key] = status - } - return db -} - -func (x *VulnStatusDB) Lookup(pkg *ent.PackageRecord, vulnID string) *ent.VulnStatus { - if status, ok := x.dict[vulnStatusKey(pkg.Source, pkg.Name, vulnID)]; ok { - return status - } - return nil -} - -func (x *VulnStatusDB) IsQualified(v *VulnRecord) bool { - _, ok := x.dict[vulnStatusKey(v.Pkg.Source, v.Pkg.Name, v.Vuln.ID)] - return !ok -} - -type vulnChangeType int - -const ( - VulnAdded vulnChangeType = iota - VulnDeleted - VulnRemained -) - -type VulnRecord struct { - Pkg *ent.PackageRecord - Vuln *ent.Vulnerability -} - -type vulnChange struct { - VulnRecord - Type vulnChangeType -} -type VulnChanges []*vulnChange - -func (x VulnChanges) Qualified(db *VulnStatusDB) VulnChanges { - var resp VulnChanges - for i := range x { - if db.IsQualified(&x[i].VulnRecord) { - resp = append(resp, x[i]) - } - } - return resp -} - -func (x VulnChanges) FilterByType(t vulnChangeType) VulnChanges { - var resp VulnChanges - for i := range x { - if x[i].Type == t { - resp = append(resp, x[i]) - } - } - return resp -} - -func (x VulnChanges) FilterBySource(src string) VulnChanges { - var resp VulnChanges - for i := range x { - if x[i].Pkg.Source == src { - resp = append(resp, x[i]) - } - } - return resp -} -func (x VulnChanges) Sources() []string { - src := map[string]struct{}{} - for i := range x { - src[x[i].Pkg.Source] = struct{}{} - } - - var srcList []string - for s := range src { - srcList = append(srcList, s) - } - return srcList -} - -type vulnRecordMap map[string]*VulnRecord - -func (x vulnRecordMap) Put(pkg *ent.PackageRecord, vuln *ent.Vulnerability) { - key := vulnStatusKey(pkg.Source, pkg.Name, vuln.ID) - x[key] = &VulnRecord{ - Pkg: pkg, - Vuln: vuln, - } -} -func (x vulnRecordMap) Diff(y vulnRecordMap) []*vulnChange { - oldMap, newMap := x, y - var changes []*vulnChange - - for oldKey, oldVuln := range oldMap { - if _, ok := newMap[oldKey]; !ok { - changes = append(changes, &vulnChange{ - VulnRecord: *oldVuln, - Type: VulnDeleted, - }) - } - } - - for newKey, newVuln := range newMap { - if _, ok := oldMap[newKey]; !ok { - changes = append(changes, &vulnChange{ - VulnRecord: *newVuln, - Type: VulnAdded, - }) - } else { - changes = append(changes, &vulnChange{ - VulnRecord: *newVuln, - Type: VulnRemained, - }) - } - } - - return changes -} - -func pkgToVulnRecordMap(pkgs []*ent.PackageRecord) vulnRecordMap { - m := vulnRecordMap{} - for _, pkg := range pkgs { - for _, vuln := range pkg.Edges.Vulnerabilities { - m.Put(pkg, vuln) - } - } - return m -} - -func DiffVulnRecords(oldPkgs, newPkgs []*ent.PackageRecord) VulnChanges { - oldMap := pkgToVulnRecordMap(oldPkgs) - newMap := pkgToVulnRecordMap(newPkgs) - - var changes []*vulnChange - - for oldKey, oldVuln := range oldMap { - if _, ok := newMap[oldKey]; !ok { - changes = append(changes, &vulnChange{ - VulnRecord: *oldVuln, - Type: VulnDeleted, - }) - } else { - changes = append(changes, &vulnChange{ - VulnRecord: *oldVuln, - Type: VulnRemained, - }) - } - } - - for newKey, newVuln := range newMap { - if _, ok := oldMap[newKey]; !ok { - changes = append(changes, &vulnChange{ - VulnRecord: *newVuln, - Type: VulnAdded, - }) - } - } - - return changes -} diff --git a/pkg/domain/model/vuln_status_test.go b/pkg/domain/model/vuln_status_test.go deleted file mode 100644 index daa3d77..0000000 --- a/pkg/domain/model/vuln_status_test.go +++ /dev/null @@ -1,171 +0,0 @@ -package model_test - -import ( - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/domain/types" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/assert" -) - -func TestVulnStatusDB(t *testing.T) { - t.Run("snooze disabled matched entry", func(t *testing.T) { - db := model.NewVulnStatusDB([]*ent.VulnStatus{ - { - Status: types.StatusSnoozed, - Source: "x", - PkgName: "blue", - VulnID: "CVE-2000", - ExpiresAt: 2000, - }, - }, 1000) - - cases := []struct { - title string - val *model.VulnRecord - expected bool - }{ - { - title: "disable matched entry", - val: &model.VulnRecord{ - Pkg: &ent.PackageRecord{ - Source: "x", - Name: "blue", - }, - Vuln: &ent.Vulnerability{ - ID: "CVE-2000", - }, - }, - expected: false, - }, - { - title: "not affected by different source", - val: &model.VulnRecord{ - Pkg: &ent.PackageRecord{ - Source: "y", - Name: "blue", - }, - Vuln: &ent.Vulnerability{ - ID: "CVE-2000", - }, - }, - expected: true, - }, - { - title: "not affected by different package name", - val: &model.VulnRecord{ - Pkg: &ent.PackageRecord{ - Source: "x", - Name: "orange", - }, - Vuln: &ent.Vulnerability{ - ID: "CVE-2000", - }, - }, - expected: true, - }, - { - title: "not affected by different vuln", - val: &model.VulnRecord{ - Pkg: &ent.PackageRecord{ - Source: "x", - Name: "blue", - }, - Vuln: &ent.Vulnerability{ - ID: "CVE-1000", - }, - }, - expected: true, - }, - } - - for _, c := range cases { - t.Run(c.title, func(t *testing.T) { - assert.Equal(t, c.expected, db.IsQualified(c.val)) - - }) - } - }) - - t.Run("snooze does not work when expired", func(t *testing.T) { - db := model.NewVulnStatusDB([]*ent.VulnStatus{ - { - Status: types.StatusSnoozed, - Source: "x", - PkgName: "blue", - VulnID: "CVE-2000", - ExpiresAt: 2000, - }, - }, 2001) - assert.True(t, db.IsQualified(&model.VulnRecord{ - Pkg: &ent.PackageRecord{ - Source: "x", - Name: "blue", - }, - Vuln: &ent.Vulnerability{ - ID: "CVE-2000", - }, - })) - }) - - t.Run("none does not disable", func(t *testing.T) { - db := model.NewVulnStatusDB([]*ent.VulnStatus{ - { - Status: types.StatusNone, - Source: "x", - PkgName: "blue", - VulnID: "CVE-2000", - ExpiresAt: 2000, - }, - }, 1000) - assert.True(t, db.IsQualified(&model.VulnRecord{ - Pkg: &ent.PackageRecord{ - Source: "x", - Name: "blue", - }, - Vuln: &ent.Vulnerability{ - ID: "CVE-2000", - }, - })) - }) - - t.Run("mitigated/notaffected disable even if having expires", func(t *testing.T) { - rec := &model.VulnRecord{ - Pkg: &ent.PackageRecord{ - Source: "x", - Name: "blue", - }, - Vuln: &ent.Vulnerability{ - ID: "CVE-2000", - }, - } - - t.Run("mitigated", func(t *testing.T) { - db := model.NewVulnStatusDB([]*ent.VulnStatus{ - { - Status: types.StatusMitigated, - Source: "x", - PkgName: "blue", - VulnID: "CVE-2000", - ExpiresAt: 1, - }, - }, 1000) - assert.False(t, db.IsQualified(rec)) - }) - - t.Run("mitigated", func(t *testing.T) { - db := model.NewVulnStatusDB([]*ent.VulnStatus{ - { - Status: types.StatusMitigated, - Source: "x", - PkgName: "blue", - VulnID: "CVE-2000", - ExpiresAt: 1, - }, - }, 1000) - assert.False(t, db.IsQualified(rec)) - }) - - }) -} diff --git a/pkg/domain/schema/authstatecache.go b/pkg/domain/schema/authstatecache.go deleted file mode 100644 index 565f25d..0000000 --- a/pkg/domain/schema/authstatecache.go +++ /dev/null @@ -1,24 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/field" -) - -// AuthStateCache holds the schema definition for the AuthStateCache entity. -type AuthStateCache struct { - ent.Schema -} - -// Fields of the AuthStateCache. -func (AuthStateCache) Fields() []ent.Field { - return []ent.Field{ - field.String("id"), - field.Int64("expires_at"), - } -} - -// Edges of the AuthStateCache. -func (AuthStateCache) Edges() []ent.Edge { - return nil -} diff --git a/pkg/domain/schema/packagerecord.go b/pkg/domain/schema/packagerecord.go deleted file mode 100644 index e953a21..0000000 --- a/pkg/domain/schema/packagerecord.go +++ /dev/null @@ -1,31 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" -) - -// PackageRecord holds the schema definition for the PackageRecord entity. -type PackageRecord struct { - ent.Schema -} - -// Fields of the PackageRecord. -func (PackageRecord) Fields() []ent.Field { - return []ent.Field{ - field.String("type").Immutable(), - field.String("source").Immutable(), - field.String("name").Immutable(), - field.String("version").Immutable(), - field.Strings("vuln_ids"), - } -} - -// Edges of the PackageRecord. -func (PackageRecord) Edges() []ent.Edge { - return []ent.Edge{ - edge.From("scan", Scan.Type).Ref("packages"), - edge.To("vulnerabilities", Vulnerability.Type), - } -} diff --git a/pkg/domain/schema/repolabel.go b/pkg/domain/schema/repolabel.go deleted file mode 100644 index 6e609b3..0000000 --- a/pkg/domain/schema/repolabel.go +++ /dev/null @@ -1,28 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" -) - -// RepoLabel holds the schema definition for the RepoLabel entity. -type RepoLabel struct { - ent.Schema -} - -// Fields of the RepoLabel. -func (RepoLabel) Fields() []ent.Field { - return []ent.Field{ - field.String("name").Unique(), - field.String("description"), - field.String("color"), - } -} - -// Edges of the RepoLabel. -func (RepoLabel) Edges() []ent.Edge { - return []ent.Edge{ - edge.From("repos", Repository.Type).Ref("labels"), - } -} diff --git a/pkg/domain/schema/repository.go b/pkg/domain/schema/repository.go deleted file mode 100644 index 406c708..0000000 --- a/pkg/domain/schema/repository.go +++ /dev/null @@ -1,43 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" - "entgo.io/ent/schema/index" -) - -// Repository holds the schema definition for the Repository entity. -type Repository struct { - ent.Schema -} - -// Fields of the Repository. -func (Repository) Fields() []ent.Field { - return []ent.Field{ - field.String("owner"), - field.String("name"), - field.Int64("repo_id").Optional(), - field.Int64("install_id").Optional(), - field.String("url").Optional(), - field.String("avatar_url").Optional().Nillable(), - field.String("default_branch").Optional().Nillable(), - } -} - -// Edges of the Repository. -func (Repository) Edges() []ent.Edge { - return []ent.Edge{ - edge.To("scan", Scan.Type).Comment("All scan results"), - edge.To("main", Scan.Type).Comment("Scan results for default branch"), - edge.To("latest", Scan.Type).Unique().Comment("A latest Scan result for default branch"), - edge.To("status", VulnStatusIndex.Type), - edge.To("labels", RepoLabel.Type), - } -} - -func (Repository) Index() []ent.Index { - return []ent.Index{ - index.Fields("owner", "name").Unique(), - } -} diff --git a/pkg/domain/schema/scan.go b/pkg/domain/schema/scan.go deleted file mode 100644 index abccffe..0000000 --- a/pkg/domain/schema/scan.go +++ /dev/null @@ -1,33 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" -) - -// Scan holds the schema definition for the Scan entity. -type Scan struct { - ent.Schema -} - -// Fields of the Scan. -func (Scan) Fields() []ent.Field { - return []ent.Field{ - field.String("id").Immutable().Unique(), - field.String("branch").Immutable(), - field.String("commit_id").Immutable(), - field.Int64("requested_at"), - field.Int64("scanned_at"), - field.Int64("check_id").Optional(), - field.String("pull_request_target").Optional(), - } -} - -// Edges of the Scan. -func (Scan) Edges() []ent.Edge { - return []ent.Edge{ - edge.From("repository", Repository.Type).Ref("scan"), - edge.To("packages", PackageRecord.Type), - } -} diff --git a/pkg/domain/schema/session.go b/pkg/domain/schema/session.go deleted file mode 100644 index 8e61469..0000000 --- a/pkg/domain/schema/session.go +++ /dev/null @@ -1,30 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" -) - -// Session holds the schema definition for the Session entity. -type Session struct { - ent.Schema -} - -// Fields of the Session. -func (Session) Fields() []ent.Field { - return []ent.Field{ - field.String("id"), - field.Int("user_id"), - field.String("token").Sensitive().Immutable().NotEmpty(), - field.Int64("created_at").Immutable(), - field.Int64("expires_at").Immutable(), - } -} - -// Edges of the Session. -func (Session) Edges() []ent.Edge { - return []ent.Edge{ - edge.To("login", User.Type).Unique(), - } -} diff --git a/pkg/domain/schema/severity.go b/pkg/domain/schema/severity.go deleted file mode 100644 index bd66e34..0000000 --- a/pkg/domain/schema/severity.go +++ /dev/null @@ -1,27 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" -) - -// Severity holds the schema definition for the Severity entity. -type Severity struct { - ent.Schema -} - -// Fields of the Severity. -func (Severity) Fields() []ent.Field { - return []ent.Field{ - field.String("label").NotEmpty().Unique(), - field.String("color").Optional(), - } -} - -// Edges of the Severity. -func (Severity) Edges() []ent.Edge { - return []ent.Edge{ - edge.From("vulnerabilities", Vulnerability.Type).Ref("custom_severity"), - } -} diff --git a/pkg/domain/schema/user.go b/pkg/domain/schema/user.go deleted file mode 100644 index 7c1edc8..0000000 --- a/pkg/domain/schema/user.go +++ /dev/null @@ -1,30 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" -) - -// User holds the schema definition for the User entity. -type User struct { - ent.Schema -} - -// Fields of the User. -func (User) Fields() []ent.Field { - return []ent.Field{ - field.Int64("github_id").Immutable().Unique(), - field.String("login"), - field.String("name"), - field.String("avatar_url"), - field.String("url"), - } -} - -// Edges of the User. -func (User) Edges() []ent.Edge { - return []ent.Edge{ - edge.To("edited_status", VulnStatus.Type), - } -} diff --git a/pkg/domain/schema/vulnerability.go b/pkg/domain/schema/vulnerability.go deleted file mode 100644 index 9aa8938..0000000 --- a/pkg/domain/schema/vulnerability.go +++ /dev/null @@ -1,42 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" - "entgo.io/ent/schema/index" -) - -// Vulnerability holds the schema definition for the Vulnerability entity. -type Vulnerability struct { - ent.Schema -} - -// Fields of the Vulnerability. -func (Vulnerability) Fields() []ent.Field { - return []ent.Field{ - field.String("id").NotEmpty().Immutable().Unique(), - field.Int64("first_seen_at"), - field.Int64("last_modified_at"), - field.String("title").Optional(), - field.String("description").Optional(), - field.Strings("cwe_id").Optional(), - field.String("severity").Optional(), - field.Strings("cvss").Optional(), - field.Strings("references").Optional(), - } -} - -// Edges of the Vulnerability. -func (Vulnerability) Edges() []ent.Edge { - return []ent.Edge{ - edge.From("packages", PackageRecord.Type).Ref("vulnerabilities"), - edge.To("custom_severity", Severity.Type).Unique(), - } -} - -func (Vulnerability) Index() []ent.Index { - return []ent.Index{ - index.Fields("id").Unique(), - } -} diff --git a/pkg/domain/schema/vulnstatus.go b/pkg/domain/schema/vulnstatus.go deleted file mode 100644 index a4321d3..0000000 --- a/pkg/domain/schema/vulnstatus.go +++ /dev/null @@ -1,34 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/domain/types" -) - -// VulnStatus holds the schema definition for the VulnStatus entity. -type VulnStatus struct { - ent.Schema -} - -// Fields of the VulnStatus. -func (VulnStatus) Fields() []ent.Field { - return []ent.Field{ - field.Enum("status").GoType(types.VulnStatusType("")), - field.String("source"), - field.String("pkg_name"), - field.String("pkg_type"), - field.String("vuln_id"), - field.Int64("expires_at"), - field.Int64("created_at"), - field.String("comment"), - } -} - -// Edges of the VulnStatus. -func (VulnStatus) Edges() []ent.Edge { - return []ent.Edge{ - edge.To("author", User.Type).Unique(), - } -} diff --git a/pkg/domain/schema/vulnstatusindex.go b/pkg/domain/schema/vulnstatusindex.go deleted file mode 100644 index c61c145..0000000 --- a/pkg/domain/schema/vulnstatusindex.go +++ /dev/null @@ -1,27 +0,0 @@ -package schema - -import ( - "entgo.io/ent" - "entgo.io/ent/schema/edge" - "entgo.io/ent/schema/field" -) - -// VulnStatusIndex holds the schema definition for the VulnStatusIndex entity. -type VulnStatusIndex struct { - ent.Schema -} - -// Fields of the VulnStatusIndex. -func (VulnStatusIndex) Fields() []ent.Field { - return []ent.Field{ - field.String("id").NotEmpty().Immutable().Unique(), - } -} - -// Edges of the VulnStatusIndex. -func (VulnStatusIndex) Edges() []ent.Edge { - return []ent.Edge{ - edge.To("latest", VulnStatus.Type).Unique(), - edge.To("status", VulnStatus.Type), - } -} diff --git a/pkg/domain/types/error.go b/pkg/domain/types/error.go new file mode 100644 index 0000000..3ecd0a7 --- /dev/null +++ b/pkg/domain/types/error.go @@ -0,0 +1,13 @@ +package types + +import "github.com/m-mizutani/goerr" + +var ( + ErrInvalidOption = goerr.New("invalid option") + + ErrInvalidRequest = goerr.New("invalid request") + + ErrInvalidGitHubData = goerr.New("invalid GitHub data") + + ErrLogicError = goerr.New("logic error") +) diff --git a/pkg/domain/types/github.go b/pkg/domain/types/github.go new file mode 100644 index 0000000..c42063d --- /dev/null +++ b/pkg/domain/types/github.go @@ -0,0 +1,8 @@ +package types + +type ( + GitHubAppID int64 + GitHubAppInstallID int64 + GitHubAppSecret string + GitHubAppPrivateKey string +) diff --git a/pkg/domain/types/types.go b/pkg/domain/types/types.go index c010a54..43013b1 100644 --- a/pkg/domain/types/types.go +++ b/pkg/domain/types/types.go @@ -1,41 +1,7 @@ package types -import "github.com/m-mizutani/goerr" +type ( + ScanID string -type VulnStatusType string - -const ( - StatusNone VulnStatusType = "none" - StatusSnoozed VulnStatusType = "snoozed" - StatusMitigated VulnStatusType = "mitigated" - StatusUnaffected VulnStatusType = "unaffected" - StatusFixed VulnStatusType = "fixed" -) - -func (x VulnStatusType) Values() []string { - return []string{ - string(StatusNone), - string(StatusSnoozed), - string(StatusMitigated), - string(StatusUnaffected), - string(StatusFixed), - } -} - -type GitHubCheckResult string - -const ( - CheckNone GitHubCheckResult = "" - CheckFail GitHubCheckResult = "fail" - CheckNeutral GitHubCheckResult = "neutral" - CheckSuccess GitHubCheckResult = "success" + GoogleProjectID string ) - -func (x GitHubCheckResult) IsValid() error { - switch x { - case CheckFail, CheckNeutral, CheckSuccess: - return nil - default: - return goerr.New("invalid check result") - } -} diff --git a/pkg/infra/clients.go b/pkg/infra/clients.go new file mode 100644 index 0000000..860fef1 --- /dev/null +++ b/pkg/infra/clients.go @@ -0,0 +1,72 @@ +package infra + +import ( + "database/sql" + "net/http" + + gh "github.com/m-mizutani/octovy/pkg/infra/gh" + "github.com/m-mizutani/octovy/pkg/infra/trivy" +) + +type Clients struct { + githubApp gh.Client + httpClient HTTPClient + trivyClient trivy.Client + dbClient *sql.DB +} + +type HTTPClient interface { + Do(req *http.Request) (*http.Response, error) +} + +type Option func(*Clients) + +func New(options ...Option) *Clients { + client := &Clients{ + httpClient: http.DefaultClient, + trivyClient: trivy.New("trivy"), + } + + for _, opt := range options { + opt(client) + } + + return client +} + +func (x *Clients) GitHubApp() gh.Client { + return x.githubApp +} +func (x *Clients) HTTPClient() HTTPClient { + return x.httpClient +} +func (x *Clients) Trivy() trivy.Client { + return x.trivyClient +} +func (x *Clients) DB() *sql.DB { + return x.dbClient +} + +func WithGitHubApp(client gh.Client) Option { + return func(x *Clients) { + x.githubApp = client + } +} + +func WithHTTPClient(client HTTPClient) Option { + return func(x *Clients) { + x.httpClient = client + } +} + +func WithTrivy(client trivy.Client) Option { + return func(x *Clients) { + x.trivyClient = client + } +} + +func WithDB(client *sql.DB) Option { + return func(x *Clients) { + x.dbClient = client + } +} diff --git a/pkg/infra/db/auth.go b/pkg/infra/db/auth.go deleted file mode 100644 index ee08a0f..0000000 --- a/pkg/infra/db/auth.go +++ /dev/null @@ -1,92 +0,0 @@ -package db - -import ( - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" -) - -// Auth -func (x *Client) SaveAuthState(ctx *model.Context, state string, expiresAt int64) error { - _, err := x.client.AuthStateCache.Create(). - SetID(state). - SetExpiresAt(expiresAt). - Save(ctx) - if err != nil { - return goerr.Wrap(err) - } - return nil -} - -func (x *Client) HasAuthState(ctx *model.Context, state string, now int64) (bool, error) { - cache, err := x.client.AuthStateCache.Get(ctx, state) - switch { - case err == nil: - return now < cache.ExpiresAt, nil - case ent.IsNotFound(err): - return false, nil - default: - return false, goerr.Wrap(err) - } -} - -func (x *Client) GetUser(ctx *model.Context, userID int) (*ent.User, error) { - got, err := x.client.User.Get(ctx, userID) - if ent.IsNotFound(err) { - return nil, nil - } else if err != nil { - return nil, goerr.Wrap(err) - } - - return got, nil -} - -func (x *Client) PutUser(ctx *model.Context, user *ent.User) (int, error) { - userID, err := x.client.User.Create(). - SetGithubID(user.GithubID). - SetLogin(user.Login). - SetName(user.Name). - SetURL(user.URL). - SetAvatarURL(user.AvatarURL). - OnConflictColumns("github_id"). - UpdateNewValues(). - ID(ctx) - if err != nil { - return 0, goerr.Wrap(err) - } - return userID, nil -} - -func (x *Client) PutSession(ctx *model.Context, ssn *ent.Session) error { - _, err := x.client.Session.Create(). - SetID(ssn.ID). - SetUserID(ssn.UserID). - SetToken(ssn.Token). - SetCreatedAt(ssn.CreatedAt). - SetExpiresAt(ssn.ExpiresAt). - Save(ctx) - - if err != nil { - return goerr.Wrap(err) - } - return nil -} - -func (x *Client) GetSession(ctx *model.Context, ssnID string, now int64) (*ent.Session, error) { - ssn, err := x.client.Session.Query().Where(session.ID(ssnID)).WithLogin().First(ctx) - if ent.IsNotFound(err) { - return nil, nil - } else if err != nil { - return nil, goerr.Wrap(err) - } - - return ssn, nil -} - -func (x *Client) DeleteSession(ctx *model.Context, ssnID string) error { - if err := x.client.Session.DeleteOneID(ssnID).Exec(ctx); err != nil { - return goerr.Wrap(err) - } - return nil -} diff --git a/pkg/infra/db/db.go b/pkg/infra/db/db.go index 1d48603..46fda54 100644 --- a/pkg/infra/db/db.go +++ b/pkg/infra/db/db.go @@ -1,126 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.21.0 + package db import ( - "sync" - "testing" - - "github.com/google/uuid" - _ "github.com/lib/pq" - _ "github.com/mattn/go-sqlite3" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/infra/ent/enttest" - "github.com/m-mizutani/octovy/pkg/utils" + "context" + "database/sql" ) -var logger = utils.Logger - -type ScanResult struct { - Repo *ent.Repository - Scan *ent.Scan - Packages []*ent.PackageRecord - Vulnerabilities []*ent.Vulnerability +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row } -type Interface interface { - Open(dbType, dbConfig string) error - Close() error - - CreateRepo(ctx *model.Context, repo *ent.Repository) (*ent.Repository, error) - - // Vulnerability - PutVulnerabilities(ctx *model.Context, vulnerabilities []*ent.Vulnerability) error - GetVulnerability(ctx *model.Context, id string) (*ent.Vulnerability, error) - GetLatestVulnerabilities(ctx *model.Context, offset, limit int) ([]*ent.Vulnerability, error) - GetVulnerabilityCount(ctx *model.Context) (int, error) - - // Severity - CreateSeverity(ctx *model.Context, req *model.RequestSeverity) (*ent.Severity, error) - DeleteSeverity(ctx *model.Context, id int) error - GetSeverities(ctx *model.Context) ([]*ent.Severity, error) - UpdateSeverity(ctx *model.Context, id int, req *model.RequestSeverity) error - AssignSeverity(ctx *model.Context, vulnID string, id int) error - - PutPackages(ctx *model.Context, packages []*ent.PackageRecord) ([]*ent.PackageRecord, error) - PutScan(ctx *model.Context, scan *ent.Scan, repo *ent.Repository, packages []*ent.PackageRecord) (*ent.Scan, error) - PutVulnStatus(ctx *model.Context, repo *ent.Repository, status *ent.VulnStatus, userID int) (*ent.VulnStatus, error) - GetVulnStatus(ctx *model.Context, repo *model.GitHubRepo) ([]*ent.VulnStatus, error) - - GetScan(ctx *model.Context, id string) (*ent.Scan, error) - GetLatestScan(ctx *model.Context, branch model.GitHubBranch) (*ent.Scan, error) - GetLatestScans(ctx *model.Context) ([]*ent.Scan, error) - GetRepositories(ctx *model.Context) ([]*ent.Repository, error) - GetRepositoriesWithVuln(ctx *model.Context, vulnID string) ([]*ent.Repository, error) - GetRepository(ctx *model.Context, repo *model.GitHubRepo) (*ent.Repository, error) - GetRepositoryScan(ctx *model.Context, req *model.GetRepoScanRequest) ([]*ent.Scan, error) - - // Repository Label - CreateRepoLabel(ctx *model.Context, req *model.RequestRepoLabel) (*ent.RepoLabel, error) - UpdateRepoLabel(ctx *model.Context, id int, req *model.RequestRepoLabel) error - DeleteRepoLabel(ctx *model.Context, id int) error - GetRepoLabels(ctx *model.Context) ([]*ent.RepoLabel, error) - AssignRepoLabel(ctx *model.Context, repoID int, labelID int) error - UnassignRepoLabel(ctx *model.Context, repoID int, labelID int) error - - // Auth - SaveAuthState(ctx *model.Context, state string, expiresAt int64) error - HasAuthState(ctx *model.Context, state string, now int64) (bool, error) - GetUser(ctx *model.Context, userID int) (*ent.User, error) - PutUser(ctx *model.Context, user *ent.User) (int, error) - PutSession(ctx *model.Context, ssn *ent.Session) error - GetSession(ctx *model.Context, ssnID string, now int64) (*ent.Session, error) - DeleteSession(ctx *model.Context, ssnID string) error +func New(db DBTX) *Queries { + return &Queries{db: db} } -type Factory func(dbType, dbConfig string) (Interface, error) - -type Client struct { - client *ent.Client - - disableOpen bool - lock bool - mutex sync.Mutex -} - -func newClient() *Client { - return &Client{} -} - -func New() *Client { - return newClient() -} - -func NewMock(t *testing.T) *Client { - db := newClient() - dsn := "file:" + uuid.NewString() + "?mode=memory&cache=shared&_fk=1" - db.client = enttest.Open(t, "sqlite3", dsn) - db.disableOpen = true - db.lock = true - return db -} - -func (x *Client) Open(dbType, dbConfig string) error { - if x.disableOpen { - return nil - } - - client, err := ent.Open(dbType, dbConfig) - if err != nil { - return model.ErrDatabaseUnexpected.Wrap(err) - } - x.client = client - - if err := client.Schema.Create(model.NewContext()); err != nil { - return model.ErrDatabaseUnexpected.Wrap(err) - } - - return nil +type Queries struct { + db DBTX } -func (x *Client) Close() error { - if err := x.client.Close(); err != nil { - return model.ErrDatabaseUnexpected.Wrap(err) +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, } - return nil } diff --git a/pkg/infra/db/db_test.go b/pkg/infra/db/db_test.go deleted file mode 100644 index 93825f4..0000000 --- a/pkg/infra/db/db_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package db_test - -import ( - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/db" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/require" -) - -func setupDB(t *testing.T) db.Interface { - client := db.NewMock(t) - t.Cleanup(func() { - if err := client.Close(); err != nil { - t.Logf("Warning failed to close DB: %+v", err) - } - }) - - // Set default vulnerabilities, CVE-2001-0001 and CVE-2001-0002 - vulnSet := []*ent.Vulnerability{ - { - ID: "CVE-2001-0001", - FirstSeenAt: 1000, - LastModifiedAt: 1200, - Title: "blue", - Description: "5", - }, - { - ID: "CVE-2001-0002", - FirstSeenAt: 2000, - LastModifiedAt: 1345, - Title: "orange", - }, - } - ctx := model.NewContext() - require.NoError(t, client.PutVulnerabilities(ctx, vulnSet)) - - return client -} - -func setupDBWithoutDefault(t *testing.T) db.Interface { - client := db.NewMock(t) - t.Cleanup(func() { - if err := client.Close(); err != nil { - t.Logf("Warning failed to close DB: %+v", err) - } - }) - - return client -} diff --git a/pkg/infra/db/models.go b/pkg/infra/db/models.go new file mode 100644 index 0000000..f396089 --- /dev/null +++ b/pkg/infra/db/models.go @@ -0,0 +1,120 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.21.0 + +package db + +import ( + "database/sql" + "database/sql/driver" + "fmt" + "time" + + "github.com/google/uuid" + "github.com/sqlc-dev/pqtype" +) + +type TargetClass string + +const ( + TargetClassOsPkgs TargetClass = "os-pkgs" + TargetClassLangPkgs TargetClass = "lang-pkgs" +) + +func (e *TargetClass) Scan(src interface{}) error { + switch s := src.(type) { + case []byte: + *e = TargetClass(s) + case string: + *e = TargetClass(s) + default: + return fmt.Errorf("unsupported scan type for TargetClass: %T", src) + } + return nil +} + +type NullTargetClass struct { + TargetClass TargetClass + Valid bool // Valid is true if TargetClass is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullTargetClass) Scan(value interface{}) error { + if value == nil { + ns.TargetClass, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.TargetClass.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullTargetClass) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.TargetClass), nil +} + +type MetaGithubRepository struct { + ID uuid.UUID + ScanID uuid.UUID + Owner string + RepoName string + CommitID string + Branch sql.NullString + IsDefaultBranch sql.NullBool + BaseCommitID sql.NullString + PullRequestID sql.NullInt32 + PageSeq sql.NullInt32 +} + +type Package struct { + ID string + TargetType string + Name string + Version string +} + +type Result struct { + ID uuid.UUID + ScanID uuid.UUID + Target string + TargetType string + Class TargetClass +} + +type ResultPackage struct { + ID uuid.UUID + ResultID uuid.UUID + PkgID string +} + +type ResultVulnerability struct { + ID uuid.UUID + ResultID uuid.UUID + VulnID string + PkgID string + FixedVersion sql.NullString + PrimaryUrl sql.NullString +} + +type Scan struct { + ID uuid.UUID + CreatedAt time.Time + ArtifactName string + ArtifactType string + PageSeq sql.NullInt32 +} + +type Vulnerability struct { + ID string + Title string + Description string + Severity string + CweIds []string + Cvss pqtype.NullRawMessage + Reference []string + PublishedAt sql.NullTime + LastModifiedAt sql.NullTime +} diff --git a/pkg/infra/db/query.sql.go b/pkg/infra/db/query.sql.go new file mode 100644 index 0000000..b533a3d --- /dev/null +++ b/pkg/infra/db/query.sql.go @@ -0,0 +1,345 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.21.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" + + "github.com/google/uuid" + "github.com/lib/pq" + "github.com/sqlc-dev/pqtype" +) + +const getPackages = `-- name: GetPackages :many +SELECT id, target_type, name, version FROM packages WHERE id = ANY($1::text[]) +` + +func (q *Queries) GetPackages(ctx context.Context, dollar_1 []string) ([]Package, error) { + rows, err := q.db.QueryContext(ctx, getPackages, pq.Array(dollar_1)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Package + for rows.Next() { + var i Package + if err := rows.Scan( + &i.ID, + &i.TargetType, + &i.Name, + &i.Version, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getVulnerabilities = `-- name: GetVulnerabilities :many +SELECT id, title, description, severity, cwe_ids, cvss, reference, published_at, last_modified_at FROM vulnerabilities WHERE id = ANY($1::text[]) +` + +func (q *Queries) GetVulnerabilities(ctx context.Context, dollar_1 []string) ([]Vulnerability, error) { + rows, err := q.db.QueryContext(ctx, getVulnerabilities, pq.Array(dollar_1)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Vulnerability + for rows.Next() { + var i Vulnerability + if err := rows.Scan( + &i.ID, + &i.Title, + &i.Description, + &i.Severity, + pq.Array(&i.CweIds), + &i.Cvss, + pq.Array(&i.Reference), + &i.PublishedAt, + &i.LastModifiedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const saveMetaGithubRepository = `-- name: SaveMetaGithubRepository :exec +INSERT INTO meta_github_repository ( + id, + scan_id, + owner, + repo_name, + branch, + is_default_branch, + commit_id, + base_commit_id, + pull_request_id +) VALUES ( + $1, $2, $3, $4, $5, $6, $7, $8, $9 +) +` + +type SaveMetaGithubRepositoryParams struct { + ID uuid.UUID + ScanID uuid.UUID + Owner string + RepoName string + Branch sql.NullString + IsDefaultBranch sql.NullBool + CommitID string + BaseCommitID sql.NullString + PullRequestID sql.NullInt32 +} + +func (q *Queries) SaveMetaGithubRepository(ctx context.Context, arg SaveMetaGithubRepositoryParams) error { + _, err := q.db.ExecContext(ctx, saveMetaGithubRepository, + arg.ID, + arg.ScanID, + arg.Owner, + arg.RepoName, + arg.Branch, + arg.IsDefaultBranch, + arg.CommitID, + arg.BaseCommitID, + arg.PullRequestID, + ) + return err +} + +const savePackage = `-- name: SavePackage :exec +INSERT INTO packages ( + id, + target_type, + name, + version +) VALUES ( + $1, $2, $3, $4 +) +` + +type SavePackageParams struct { + ID string + TargetType string + Name string + Version string +} + +func (q *Queries) SavePackage(ctx context.Context, arg SavePackageParams) error { + _, err := q.db.ExecContext(ctx, savePackage, + arg.ID, + arg.TargetType, + arg.Name, + arg.Version, + ) + return err +} + +const saveResult = `-- name: SaveResult :exec +INSERT INTO results ( + id, + scan_id, + target, + target_type, + class +) VALUES ( + $1, $2, $3, $4, $5 +) +` + +type SaveResultParams struct { + ID uuid.UUID + ScanID uuid.UUID + Target string + TargetType string + Class TargetClass +} + +func (q *Queries) SaveResult(ctx context.Context, arg SaveResultParams) error { + _, err := q.db.ExecContext(ctx, saveResult, + arg.ID, + arg.ScanID, + arg.Target, + arg.TargetType, + arg.Class, + ) + return err +} + +const saveResultPackage = `-- name: SaveResultPackage :exec +INSERT INTO result_packages ( + id, + result_id, + pkg_id +) VALUES ( + $1, $2, $3 +) +` + +type SaveResultPackageParams struct { + ID uuid.UUID + ResultID uuid.UUID + PkgID string +} + +func (q *Queries) SaveResultPackage(ctx context.Context, arg SaveResultPackageParams) error { + _, err := q.db.ExecContext(ctx, saveResultPackage, arg.ID, arg.ResultID, arg.PkgID) + return err +} + +const saveResultVulnerability = `-- name: SaveResultVulnerability :exec +INSERT INTO result_vulnerabilities ( + id, + result_id, + vuln_id, + pkg_id, + fixed_version, + primary_url +) VALUES ( + $1, $2, $3, $4, $5, $6 +) +` + +type SaveResultVulnerabilityParams struct { + ID uuid.UUID + ResultID uuid.UUID + VulnID string + PkgID string + FixedVersion sql.NullString + PrimaryUrl sql.NullString +} + +func (q *Queries) SaveResultVulnerability(ctx context.Context, arg SaveResultVulnerabilityParams) error { + _, err := q.db.ExecContext(ctx, saveResultVulnerability, + arg.ID, + arg.ResultID, + arg.VulnID, + arg.PkgID, + arg.FixedVersion, + arg.PrimaryUrl, + ) + return err +} + +const saveScan = `-- name: SaveScan :exec +INSERT INTO scans ( + id, + artifact_name, + artifact_type +) VALUES ( + $1, $2, $3 +) +` + +type SaveScanParams struct { + ID uuid.UUID + ArtifactName string + ArtifactType string +} + +func (q *Queries) SaveScan(ctx context.Context, arg SaveScanParams) error { + _, err := q.db.ExecContext(ctx, saveScan, arg.ID, arg.ArtifactName, arg.ArtifactType) + return err +} + +const saveVulnerability = `-- name: SaveVulnerability :exec +INSERT INTO vulnerabilities ( + id, + title, + description, + severity, + cwe_ids, + cvss, + reference, + published_at, + last_modified_at +) VALUES ( + $1, $2, $3, $4, $5, $6, $7, $8, $9 +) +` + +type SaveVulnerabilityParams struct { + ID string + Title string + Description string + Severity string + CweIds []string + Cvss pqtype.NullRawMessage + Reference []string + PublishedAt sql.NullTime + LastModifiedAt sql.NullTime +} + +func (q *Queries) SaveVulnerability(ctx context.Context, arg SaveVulnerabilityParams) error { + _, err := q.db.ExecContext(ctx, saveVulnerability, + arg.ID, + arg.Title, + arg.Description, + arg.Severity, + pq.Array(arg.CweIds), + arg.Cvss, + pq.Array(arg.Reference), + arg.PublishedAt, + arg.LastModifiedAt, + ) + return err +} + +const updateVulnerability = `-- name: UpdateVulnerability :exec +UPDATE vulnerabilities SET + title = $2, + description = $3, + severity = $4, + cwe_ids = $5, + cvss = $6, + reference = $7, + published_at = $8, + last_modified_at = $9 +WHERE id = $1 and last_modified_at < $9 +` + +type UpdateVulnerabilityParams struct { + ID string + Title string + Description string + Severity string + CweIds []string + Cvss pqtype.NullRawMessage + Reference []string + PublishedAt sql.NullTime + LastModifiedAt sql.NullTime +} + +func (q *Queries) UpdateVulnerability(ctx context.Context, arg UpdateVulnerabilityParams) error { + _, err := q.db.ExecContext(ctx, updateVulnerability, + arg.ID, + arg.Title, + arg.Description, + arg.Severity, + pq.Array(arg.CweIds), + arg.Cvss, + pq.Array(arg.Reference), + arg.PublishedAt, + arg.LastModifiedAt, + ) + return err +} diff --git a/pkg/infra/db/repo_label.go b/pkg/infra/db/repo_label.go deleted file mode 100644 index 53c374c..0000000 --- a/pkg/infra/db/repo_label.go +++ /dev/null @@ -1,65 +0,0 @@ -package db - -import ( - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" -) - -// Repository Label -func (x *Client) CreateRepoLabel(ctx *model.Context, req *model.RequestRepoLabel) (*ent.RepoLabel, error) { - added, err := x.client.RepoLabel.Create(). - SetName(req.Name). - SetDescription(req.Description). - SetColor(req.Color). - Save(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - return added, nil -} - -func (x *Client) UpdateRepoLabel(ctx *model.Context, id int, req *model.RequestRepoLabel) error { - _, err := x.client.RepoLabel.UpdateOneID(id). - SetName(req.Name). - SetDescription(req.Description). - SetColor(req.Color). - Save(ctx) - - if err != nil { - return goerr.Wrap(err) - } - return nil -} - -func (x *Client) DeleteRepoLabel(ctx *model.Context, id int) error { - if err := x.client.RepoLabel.DeleteOneID(id).Exec(ctx); err != nil { - return goerr.Wrap(err) - } - return nil -} - -func (x *Client) GetRepoLabels(ctx *model.Context) ([]*ent.RepoLabel, error) { - resp, err := x.client.RepoLabel.Query().All(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - return resp, nil -} - -func (x *Client) AssignRepoLabel(ctx *model.Context, repoID int, labelID int) error { - _, err := x.client.Repository.UpdateOneID(repoID).AddLabelIDs(labelID).Save(ctx) - if err != nil { - return goerr.Wrap(err) - } - return nil -} - -func (x *Client) UnassignRepoLabel(ctx *model.Context, repoID int, labelID int) error { - _, err := x.client.Repository.UpdateOneID(repoID).RemoveLabelIDs(labelID).Save(ctx) - if err != nil { - return goerr.Wrap(err) - } - return nil -} diff --git a/pkg/infra/db/repository.go b/pkg/infra/db/repository.go deleted file mode 100644 index 6d79a0d..0000000 --- a/pkg/infra/db/repository.go +++ /dev/null @@ -1,168 +0,0 @@ -package db - -import ( - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" -) - -func (x *Client) CreateRepo(ctx *model.Context, repo *ent.Repository) (*ent.Repository, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - logger.With("repo", repo).Trace("starting CreateRepo") - - repoID, err := x.client.Repository.Query(). - Where(repository.Owner(repo.Owner)). - Where(repository.Name(repo.Name)). - FirstID(ctx) - - if err != nil { - if !ent.IsNotFound(err) { - return nil, goerr.Wrap(err) - } - - newRepo, err := x.client.Repository.Create(). - SetName(repo.Name). - SetOwner(repo.Owner). - Save(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - repoID = newRepo.ID - } - - q := x.client.Repository.UpdateOneID(repoID) - if repo.InstallID != 0 { - q = q.SetInstallID(repo.InstallID) - } - if repo.URL != "" { - q = q.SetURL(repo.URL) - } - if repo.DefaultBranch != nil { - q = q.SetDefaultBranch(*repo.DefaultBranch) - } - if repo.AvatarURL != nil { - q = q.SetAvatarURL(*repo.AvatarURL) - } - - updated, err := q.Save(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - logger.With("updated", updated).Trace("done CreateRepo") - - return updated, nil -} - -func (x *Client) GetRepositories(ctx *model.Context) ([]*ent.Repository, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - resp, err := x.client.Repository.Query(). - WithStatus(). - WithLabels(). - WithLatest(func(sq *ent.ScanQuery) { - sq.WithPackages(func(prq *ent.PackageRecordQuery) { - prq.WithVulnerabilities() - }) - }).All(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - return resp, nil -} - -func (x *Client) GetRepositoriesWithVuln(ctx *model.Context, vulnID string) ([]*ent.Repository, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - repos, err := x.client.Repository.Query(). - WithStatus(). - WithLatest(func(sq *ent.ScanQuery) { - sq.WithPackages() - }).All(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - hasVulnID := func(vulnIDs []string) bool { - for i := range vulnIDs { - if vulnIDs[i] == vulnID { - return true - } - } - return false - } - - var resp []*ent.Repository - for _, repo := range repos { - if repo.Edges.Latest == nil { - continue - } - - for _, pkg := range repo.Edges.Latest.Edges.Packages { - if hasVulnID(pkg.VulnIds) { - resp = append(resp, repo) - break - } - } - } - - return resp, nil -} - -func (x *Client) GetRepository(ctx *model.Context, repo *model.GitHubRepo) (*ent.Repository, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - resp, err := x.client.Repository.Query(). - Where(repository.Owner(repo.Owner)). - Where(repository.Name(repo.Name)). - WithLabels(). - WithStatus(func(vsiq *ent.VulnStatusIndexQuery) { - vsiq.WithLatest(func(vsq *ent.VulnStatusQuery) { - vsq.WithAuthor() - }) - }). - First(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - return resp, nil -} - -func (x *Client) GetRepositoryScan(ctx *model.Context, req *model.GetRepoScanRequest) ([]*ent.Scan, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - resp, err := x.client.Repository.Query(). - Where(repository.Owner(req.Owner)). - Where(repository.Name(req.Name)). - WithScan(func(sq *ent.ScanQuery) { - sq.Order(ent.Desc(scan.FieldScannedAt)). - Offset(req.Offset). - Limit(req.Limit). - WithPackages() - }). - WithStatus(). - All(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - return resp[0].Edges.Scan, nil -} diff --git a/pkg/infra/db/repository_test.go b/pkg/infra/db/repository_test.go deleted file mode 100644 index e53cde8..0000000 --- a/pkg/infra/db/repository_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package db_test - -import ( - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestGetRepositories(t *testing.T) { - str := func(s string) *string { return &s } - ctx := model.NewContext() - - t.Run("got inserted scan report by ID", func(t *testing.T) { - client := setupDB(t) - - pkgSet := []*ent.PackageRecord{ - { - Type: "gomod", - Source: "go.mod", - Name: "xxx", - Version: "v0.1.1", - VulnIds: []string{"CVE-2001-0001", "CVE-2001-0002"}, - }, - } - - scan := &ent.Scan{ - CommitID: "1234567", - Branch: "main", - RequestedAt: 100, - ScannedAt: 200, - CheckID: 999, - } - - addedPkg, err := client.PutPackages(ctx, pkgSet) - require.NoError(t, err) - - r1, err := client.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "five", - InstallID: 1, - DefaultBranch: str("main"), - }) - require.NoError(t, err) - r2, err := client.CreateRepo(ctx, &ent.Repository{ - Owner: "orange", - Name: "puppet", - InstallID: 1, - DefaultBranch: str("main"), - }) - require.NoError(t, err) - - _, err = client.PutScan(ctx, scan, r1, addedPkg) - require.NoError(t, err) - _, err = client.PutScan(ctx, scan, r2, addedPkg) - require.NoError(t, err) - - got, err := client.GetRepositories(ctx) - require.NoError(t, err) - require.Len(t, got, 2) - assert.NotNil(t, got[0].Edges.Latest) - assert.NotNil(t, got[1].Edges.Latest) - }) - -} diff --git a/pkg/infra/db/scan.go b/pkg/infra/db/scan.go deleted file mode 100644 index a002b68..0000000 --- a/pkg/infra/db/scan.go +++ /dev/null @@ -1,170 +0,0 @@ -package db - -import ( - "github.com/google/uuid" - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" -) - -func (x *Client) PutPackages(ctx *model.Context, packages []*ent.PackageRecord) ([]*ent.PackageRecord, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - pkgBuilder := make([]*ent.PackageRecordCreate, len(packages)) - for i, pkg := range packages { - pkgBuilder[i] = x.client.PackageRecord.Create(). - SetName(pkg.Name). - SetSource(pkg.Source). - SetType(pkg.Type). - SetVersion(pkg.Version). - SetVulnIds(pkg.VulnIds). - AddVulnerabilityIDs(pkg.VulnIds...) - } - added, err := x.client.PackageRecord.CreateBulk(pkgBuilder...).Save(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - return added, nil -} - -func txRollback(tx *ent.Tx, err error) error { - if rerr := tx.Rollback(); rerr != nil { - err = goerr.Wrap(rerr).With("original", err) - } - return err -} - -func (x *Client) PutScan(ctx *model.Context, scan *ent.Scan, repo *ent.Repository, packages []*ent.PackageRecord) (*ent.Scan, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - // logger.Debug().Interface("pkg", packages).Send() - added, err := x.client.Scan.Create(). - SetID(uuid.NewString()). - SetCommitID(scan.CommitID). - SetBranch(scan.Branch). - SetRequestedAt(scan.RequestedAt). - SetScannedAt(scan.ScannedAt). - SetCheckID(scan.CheckID). - SetPullRequestTarget(scan.PullRequestTarget). - AddRepository(repo). - AddPackages(packages...). - Save(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - if repo.DefaultBranch != nil && scan.Branch == *repo.DefaultBranch { - if err := x.client.Repository.UpdateOneID(repo.ID).AddMainIDs(added.ID).Exec(ctx); err != nil { - return nil, goerr.Wrap(err) - } - if err := x.client.Repository.UpdateOneID(repo.ID).SetLatestID(added.ID).Exec(ctx); err != nil { - return nil, goerr.Wrap(err) - } - } - - return added, nil -} - -func (x *Client) GetScan(ctx *model.Context, id string) (*ent.Scan, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - got, err := x.client.Scan.Query().Where(scan.ID(id)). - WithRepository(func(rq *ent.RepositoryQuery) { - rq.WithStatus(func(vsiq *ent.VulnStatusIndexQuery) { - vsiq.WithLatest(func(vsq *ent.VulnStatusQuery) { - vsq.WithAuthor() - }) - }) - rq.WithLabels() - }). - WithPackages(func(prq *ent.PackageRecordQuery) { - prq.WithVulnerabilities(func(vq *ent.VulnerabilityQuery) { - vq.WithCustomSeverity() - }) - }). - Only(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - return got, nil -} - -func (x *Client) GetLatestScan(ctx *model.Context, branch model.GitHubBranch) (*ent.Scan, error) { - latest, err := x.getLatestScanEntity(ctx, branch) - if err != nil { - return nil, err - } - if latest == nil { - return nil, nil - } - return x.GetScan(ctx, latest.ID) -} - -func (x *Client) GetLatestScans(ctx *model.Context) ([]*ent.Scan, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - repos, err := x.client.Repository.Query(). - WithMain(func(sq *ent.ScanQuery) { - sq.Order(ent.Desc("scanned_at")).Limit(1). - WithPackages(func(prq *ent.PackageRecordQuery) { - prq.WithVulnerabilities() - }). - WithRepository() - }). - All(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - var scans []*ent.Scan - for _, repo := range repos { - if len(repo.Edges.Main) > 0 { - scans = append(scans, repo.Edges.Main[0]) - } - } - - return scans, nil -} - -func (x *Client) getLatestScanEntity(ctx *model.Context, branch model.GitHubBranch) (*ent.Scan, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - got, err := x.client.Repository.Query(). - Where(repository.Owner(branch.Owner)). - Where(repository.Name(branch.Name)). - WithScan(func(sq *ent.ScanQuery) { - sq.Where(scan.Branch(branch.Branch)). - Order(ent.Desc("scanned_at")). - Limit(1) - }).First(ctx) - - if ent.IsNotFound(err) { - return nil, nil - } else if err != nil { - return nil, goerr.Wrap(err) - } - - if len(got.Edges.Scan) != 1 { - return nil, nil // not found - } - - return got.Edges.Scan[0], nil -} diff --git a/pkg/infra/db/scan_test.go b/pkg/infra/db/scan_test.go deleted file mode 100644 index 8b09078..0000000 --- a/pkg/infra/db/scan_test.go +++ /dev/null @@ -1,193 +0,0 @@ -package db_test - -import ( - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestScan(t *testing.T) { - ctx := model.NewContext() - - t.Run("got inserted scan report by ID", func(t *testing.T) { - client := setupDB(t) - - pkgSet := []*ent.PackageRecord{ - { - Type: "gomod", - Source: "go.mod", - Name: "xxx", - Version: "v0.1.1", - VulnIds: []string{"CVE-2001-0001", "CVE-2001-0002"}, - }, - } - - scan := &ent.Scan{ - CommitID: "1234567", - Branch: "main", - RequestedAt: 100, - ScannedAt: 200, - CheckID: 999, - } - - addedPkg, err := client.PutPackages(ctx, pkgSet) - require.NoError(t, err) - - repo, err := client.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "five", - InstallID: 1, - }) - require.NoError(t, err) - - addedscan, err := client.PutScan(ctx, scan, repo, addedPkg) - require.NoError(t, err) - - got, err := client.GetScan(ctx, addedscan.ID) - require.NoError(t, err) - assert.Equal(t, got.CheckID, scan.CheckID) - require.Len(t, got.Edges.Packages, 1) - }) - - t.Run("lookup latest scan report by branch", func(t *testing.T) { - client := setupDB(t) - - repo, err := client.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "five", - InstallID: 1, - }) - require.NoError(t, err) - repo_another, err := client.CreateRepo(ctx, &ent.Repository{ - Owner: "orange", - Name: "doll", - InstallID: 1, - }) - require.NoError(t, err) - - pkgSet1, err := client.PutPackages(ctx, []*ent.PackageRecord{ - { - Type: "gomod", - Source: "go.mod", - Name: "x", - Version: "v0.1.1", - VulnIds: []string{"CVE-2001-0001", "CVE-2001-0002"}, - }, - }) - require.NoError(t, err) - pkgSet2, err := client.PutPackages(ctx, []*ent.PackageRecord{ - { - Type: "gomod", - Source: "go.mod", - Name: "y", - Version: "v0.1.1", - VulnIds: []string{"CVE-2001-0001", "CVE-2001-0002"}, - }, - }) - require.NoError(t, err) - - scan1 := &ent.Scan{ - CommitID: "aaa", - Branch: "main", - RequestedAt: 100, - ScannedAt: 200, - CheckID: 999, - } - scan2 := &ent.Scan{ - CommitID: "bbb", - Branch: "main", - RequestedAt: 100, - ScannedAt: 199, - CheckID: 999, - } - scan3 := &ent.Scan{ - CommitID: "ccc", - Branch: "other-branch", - RequestedAt: 100, - ScannedAt: 200, - CheckID: 999, - } - scan4 := &ent.Scan{ - CommitID: "ddd", - Branch: "main", - RequestedAt: 100, - ScannedAt: 200, - CheckID: 999, - } - - // target - _, err = client.PutScan(ctx, scan1, repo, pkgSet1) - require.NoError(t, err) - // same repo/branch, but old - _, err = client.PutScan(ctx, scan2, repo, pkgSet2) - require.NoError(t, err) - // same repo, but other branch - _, err = client.PutScan(ctx, scan3, repo, pkgSet2) - require.NoError(t, err) - // same branch, but other repo - _, err = client.PutScan(ctx, scan4, repo_another, pkgSet2) - require.NoError(t, err) - - latest, err := client.GetLatestScan(ctx, model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "five", - }, - Branch: "main", - }) - require.NoError(t, err) - require.NotNil(t, latest) - assert.Equal(t, "aaa", latest.CommitID) - require.Len(t, latest.Edges.Repository, 1) - assert.Equal(t, "five", latest.Edges.Repository[0].Name) - require.Len(t, latest.Edges.Packages, 1) - assert.Equal(t, "x", latest.Edges.Packages[0].Name) - }) - - t.Run("save default branch latest", func(t *testing.T) { - client := setupDB(t) - defaultBranch := "main" - repo, err := client.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "five", - InstallID: 1, - DefaultBranch: &defaultBranch, - }) - require.NoError(t, err) - - s1, err := client.PutScan(ctx, &ent.Scan{ - Branch: defaultBranch, - CommitID: "aaa", - RequestedAt: 100, - ScannedAt: 200, - CheckID: 999, - }, repo, nil) - require.NoError(t, err) - - _, err = client.PutScan(ctx, &ent.Scan{ - Branch: defaultBranch, - CommitID: "345", - RequestedAt: 100, - ScannedAt: 100, // older than s1 - CheckID: 999, - }, repo, nil) - require.NoError(t, err) - - _, err = client.PutScan(ctx, &ent.Scan{ - Branch: "not-default-branch", - CommitID: "a12", - RequestedAt: 100, - ScannedAt: 300, // newer than s1, but not default - CheckID: 999, - }, repo, nil) - require.NoError(t, err) - - scans, err := client.GetLatestScans(ctx) - require.NoError(t, err) - require.Len(t, scans, 1) - assert.Equal(t, s1.ID, scans[0].ID) - }) -} diff --git a/pkg/infra/db/severity.go b/pkg/infra/db/severity.go deleted file mode 100644 index d9f2918..0000000 --- a/pkg/infra/db/severity.go +++ /dev/null @@ -1,50 +0,0 @@ -package db - -import ( - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" -) - -// Severity -func (x *Client) CreateSeverity(ctx *model.Context, req *model.RequestSeverity) (*ent.Severity, error) { - added, err := x.client.Severity.Create(). - SetLabel(req.Label). - SetColor(req.Color). - Save(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - return added, nil -} - -func (x *Client) DeleteSeverity(ctx *model.Context, id int) error { - if err := x.client.Severity.DeleteOneID(id).Exec(ctx); err != nil { - return goerr.Wrap(err) - } - return nil -} - -func (x *Client) GetSeverities(ctx *model.Context) ([]*ent.Severity, error) { - got, err := x.client.Severity.Query().Order(ent.Asc(severity.FieldID)).All(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - return got, nil -} - -func (x *Client) UpdateSeverity(ctx *model.Context, id int, req *model.RequestSeverity) error { - if err := x.client.Severity.UpdateOneID(id).SetLabel(req.Label).SetColor(req.Color).Exec(ctx); err != nil { - return goerr.Wrap(err) - } - return nil -} - -func (x *Client) AssignSeverity(ctx *model.Context, vulnID string, id int) error { - if err := x.client.Vulnerability.UpdateOneID(vulnID).SetCustomSeverityID(id).Exec(ctx); err != nil { - return goerr.Wrap(err) - } - return nil -} diff --git a/pkg/infra/db/vulnerability.go b/pkg/infra/db/vulnerability.go deleted file mode 100644 index 2c240e6..0000000 --- a/pkg/infra/db/vulnerability.go +++ /dev/null @@ -1,184 +0,0 @@ -package db - -import ( - "fmt" - - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -func (x *Client) PutVulnerabilities(ctx *model.Context, vulnerabilities []*ent.Vulnerability) error { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - vulnBuilder := make([]*ent.VulnerabilityCreate, len(vulnerabilities)) - for i, vuln := range vulnerabilities { - vulnBuilder[i] = x.client.Vulnerability.Create(). - SetID(vuln.ID). - SetFirstSeenAt(vuln.FirstSeenAt). - SetLastModifiedAt(vuln.LastModifiedAt). - SetTitle(vuln.Title). - SetDescription(vuln.Description). - SetCweID(vuln.CweID). - SetSeverity(vuln.Severity). - SetCvss(vuln.Cvss). - SetReferences(vuln.References) - } - - q := x.client.Vulnerability. - CreateBulk(vulnBuilder...). - OnConflictColumns(vulnerability.FieldID). - UpdateLastModifiedAt(). - UpdateTitle(). - UpdateDescription(). - UpdateCweID(). - UpdateSeverity(). - UpdateCvss(). - UpdateReferences() - - if err := q.Exec(ctx); err != nil { - return goerr.Wrap(err) - } - - return nil -} - -func (x *Client) GetVulnerability(ctx *model.Context, id string) (*ent.Vulnerability, error) { - vuln, err := x.client.Vulnerability.Query(). - Where(vulnerability.ID(id)).WithCustomSeverity().First(ctx) - if err != nil { - if ent.IsNotFound(err) { - return nil, nil - } - return nil, goerr.Wrap(err).With("id", id) - } - return vuln, nil -} - -func (x *Client) GetLatestVulnerabilities(ctx *model.Context, offset int, limit int) ([]*ent.Vulnerability, error) { - vulns, err := x.client.Vulnerability.Query(). - Order(ent.Desc(vulnerability.FieldFirstSeenAt)). - WithCustomSeverity(). - Offset(offset).Limit(limit).All(ctx) - if err != nil { - if ent.IsNotFound(err) { - return nil, nil - } - return nil, goerr.Wrap(err).With("offset", offset).With("limit", limit) - } - return vulns, nil -} - -type vulnStatusIDKey struct { - owner string - repo string - src string - pkgName string - vulnID string -} - -func vulnStatusID(key *vulnStatusIDKey) string { - return fmt.Sprintf("%s/%s|%s|%s|%s", key.owner, key.repo, key.src, key.pkgName, key.vulnID) -} - -func (x *Client) PutVulnStatus(ctx *model.Context, repo *ent.Repository, status *ent.VulnStatus, userID int) (*ent.VulnStatus, error) { - if x.lock { - x.mutex.Lock() - defer x.mutex.Unlock() - } - - id := vulnStatusID(&vulnStatusIDKey{ - owner: repo.Owner, - repo: repo.Name, - src: status.Source, - pkgName: status.PkgName, - vulnID: status.VulnID, - }) - - added, err := x.client.VulnStatus.Create(). - SetStatus(status.Status). - SetSource(status.Source). - SetPkgName(status.PkgName). - SetPkgType(status.PkgType). - SetVulnID(status.VulnID). - SetExpiresAt(status.ExpiresAt). - SetCreatedAt(status.CreatedAt). - SetComment(status.Comment). - SetAuthorID(userID). - Save(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - idxQuery := x.client.VulnStatusIndex.Create(). - SetID(id). - AddStatus(added). - SetLatest(added). - OnConflictColumns(vulnstatusindex.FieldID). - UpdateNewValues() - - if err := idxQuery.Exec(ctx); err != nil { - return nil, goerr.Wrap(err) - } - - n, err := repo.QueryStatus().Where(vulnstatusindex.ID(id)).Count(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - if n == 0 { - if _, err := repo.Update().AddStatuIDs(id).Save(ctx); err != nil { - return nil, goerr.Wrap(err) - } - } - - got, err := x.client.VulnStatus.Query(). - Where(vulnstatus.ID(added.ID)). - WithAuthor(). - First(ctx) - - if err != nil { - return nil, goerr.Wrap(err) - } - - return got, nil -} - -func (x *Client) GetVulnStatus(ctx *model.Context, repo *model.GitHubRepo) ([]*ent.VulnStatus, error) { - resp, err := x.client.Repository.Query(). - Where(repository.Owner(repo.Owner)). - Where(repository.Name(repo.Name)). - WithStatus(func(vsiq *ent.VulnStatusIndexQuery) { - vsiq.WithLatest() - }). - First(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - if len(resp.Edges.Status) == 0 { - return nil, nil - } - - logger.With("status", resp.Edges.Status).Trace("check status") - status := make([]*ent.VulnStatus, len(resp.Edges.Status)) - for i, idx := range resp.Edges.Status { - status[i] = idx.Edges.Latest - } - - return status, nil -} - -func (x *Client) GetVulnerabilityCount(ctx *model.Context) (int, error) { - resp, err := x.client.Vulnerability.Query().Count(ctx) - if err != nil { - return 0, goerr.Wrap(err) - } - return resp, nil -} diff --git a/pkg/infra/db/vulnerability_test.go b/pkg/infra/db/vulnerability_test.go deleted file mode 100644 index aefe9b3..0000000 --- a/pkg/infra/db/vulnerability_test.go +++ /dev/null @@ -1,170 +0,0 @@ -package db_test - -import ( - "testing" - "time" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/domain/types" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestVulnerability(t *testing.T) { - t.Run("bulk insert and get them", func(t *testing.T) { - db := setupDBWithoutDefault(t) - ctx := model.NewContext() - originals := []*ent.Vulnerability{ - { - ID: "CVE-1000", - Title: "blue", - FirstSeenAt: 1000, // [1] - LastModifiedAt: 2000, - }, - { - ID: "CVE-2000", - Title: "orange", - FirstSeenAt: 1200, // [0] - LastModifiedAt: 2000, - }, - { - ID: "CVE-3000", - Title: "red", - FirstSeenAt: 800, // [2] - LastModifiedAt: 2000, - }, - { - ID: "CVE-4000", - Title: "yellow", - FirstSeenAt: 200, // [3] - LastModifiedAt: 2000, - }, - } - err := db.PutVulnerabilities(ctx, originals) - require.NoError(t, err) - - v1, err := db.GetVulnerability(ctx, "CVE-1000") - require.NoError(t, err) - assert.Equal(t, "blue", v1.Title) - vulns, err := db.GetLatestVulnerabilities(ctx, 1, 2) - require.NoError(t, err) - assert.Len(t, vulns, 2) - assert.Equal(t, originals[0].ID, vulns[0].ID) - assert.Equal(t, originals[2].ID, vulns[1].ID) - }) - - t.Run("update values excluding firstSeen", func(t *testing.T) { - db := setupDBWithoutDefault(t) - ctx := model.NewContext() - before := []*ent.Vulnerability{ - { - ID: "CVE-1000", - FirstSeenAt: 101, - }, - { - ID: "CVE-2000", - Title: "orange", - FirstSeenAt: 102, - LastModifiedAt: 10000, - Description: "puppeter", - CweID: []string{"CWE-1"}, - Severity: "low", - Cvss: []string{"1"}, - References: []string{"a"}, - }, - { - ID: "CVE-3000", - FirstSeenAt: 103, - Description: "not update", - }, - } - after := []*ent.Vulnerability{ - { - ID: "CVE-1000", - Title: "blue", - FirstSeenAt: 201, // [1] - LastModifiedAt: 2000, - Description: "five", - CweID: []string{"CWE-5"}, - Severity: "none", - Cvss: []string{"9"}, - References: []string{"x"}, - }, - { - ID: "CVE-2000", - Title: "red", - FirstSeenAt: 202, - LastModifiedAt: 3000, - Description: "dolls", - CweID: []string{"CWE-2"}, - Severity: "middle", - Cvss: []string{"2"}, - References: []string{"b"}, - }, - } - - require.NoError(t, db.PutVulnerabilities(ctx, before)) - require.NoError(t, db.PutVulnerabilities(ctx, after)) - - v1, err := db.GetVulnerability(ctx, "CVE-1000") - require.NoError(t, err) - assert.Equal(t, before[0].FirstSeenAt, v1.FirstSeenAt) - assert.Equal(t, after[0].LastModifiedAt, v1.LastModifiedAt) - assert.Equal(t, after[0].Title, v1.Title) - assert.Equal(t, after[0].Description, v1.Description) - assert.Equal(t, after[0].CweID, v1.CweID) - assert.Equal(t, after[0].Severity, v1.Severity) - assert.Equal(t, after[0].Cvss, v1.Cvss) - assert.Equal(t, after[0].References, v1.References) - - v2, err := db.GetVulnerability(ctx, "CVE-2000") - require.NoError(t, err) - assert.Equal(t, before[1].FirstSeenAt, v2.FirstSeenAt) - assert.Equal(t, after[1].LastModifiedAt, v2.LastModifiedAt) - assert.Equal(t, after[1].Title, v2.Title) - assert.Equal(t, after[1].Description, v2.Description) - assert.Equal(t, after[1].CweID, v2.CweID) - assert.Equal(t, after[1].Severity, v2.Severity) - assert.Equal(t, after[1].Cvss, v2.Cvss) - assert.Equal(t, after[1].References, v2.References) - }) -} - -func TestVulnStatus(t *testing.T) { - ctx := model.NewContext() - db := setupDBWithoutDefault(t) - repo, err := db.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "five", - InstallID: 1, - }) - require.NoError(t, err) - - userID, err := db.PutUser(ctx, &ent.User{ - GithubID: 1234, - Login: "m-mizutani", - }) - require.NoError(t, err) - - status, err := db.PutVulnStatus(ctx, repo, &ent.VulnStatus{ - Status: types.StatusMitigated, - Source: "go.mod", - PkgName: "zlog", - PkgType: "go", - VulnID: "CVE-2000-0000", - ExpiresAt: time.Now().Add(time.Hour * 24).Unix(), - }, userID) - require.NoError(t, err) - require.NotNil(t, status) - - got, err := db.GetVulnStatus(ctx, &model.GitHubRepo{ - Owner: repo.Owner, - Name: repo.Name, - }) - require.NoError(t, err) - - require.Len(t, got, 1) - assert.Equal(t, "zlog", got[0].PkgName) - assert.Equal(t, types.StatusMitigated, got[0].Status) -} diff --git a/pkg/infra/ent/authstatecache.go b/pkg/infra/ent/authstatecache.go deleted file mode 100644 index d4fd2f8..0000000 --- a/pkg/infra/ent/authstatecache.go +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/authstatecache" -) - -// AuthStateCache is the model entity for the AuthStateCache schema. -type AuthStateCache struct { - config `json:"-"` - // ID of the ent. - ID string `json:"id,omitempty"` - // ExpiresAt holds the value of the "expires_at" field. - ExpiresAt int64 `json:"expires_at,omitempty"` -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*AuthStateCache) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case authstatecache.FieldExpiresAt: - values[i] = new(sql.NullInt64) - case authstatecache.FieldID: - values[i] = new(sql.NullString) - default: - return nil, fmt.Errorf("unexpected column %q for type AuthStateCache", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the AuthStateCache fields. -func (asc *AuthStateCache) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case authstatecache.FieldID: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field id", values[i]) - } else if value.Valid { - asc.ID = value.String - } - case authstatecache.FieldExpiresAt: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field expires_at", values[i]) - } else if value.Valid { - asc.ExpiresAt = value.Int64 - } - } - } - return nil -} - -// Update returns a builder for updating this AuthStateCache. -// Note that you need to call AuthStateCache.Unwrap() before calling this method if this AuthStateCache -// was returned from a transaction, and the transaction was committed or rolled back. -func (asc *AuthStateCache) Update() *AuthStateCacheUpdateOne { - return (&AuthStateCacheClient{config: asc.config}).UpdateOne(asc) -} - -// Unwrap unwraps the AuthStateCache entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (asc *AuthStateCache) Unwrap() *AuthStateCache { - tx, ok := asc.config.driver.(*txDriver) - if !ok { - panic("ent: AuthStateCache is not a transactional entity") - } - asc.config.driver = tx.drv - return asc -} - -// String implements the fmt.Stringer. -func (asc *AuthStateCache) String() string { - var builder strings.Builder - builder.WriteString("AuthStateCache(") - builder.WriteString(fmt.Sprintf("id=%v", asc.ID)) - builder.WriteString(", expires_at=") - builder.WriteString(fmt.Sprintf("%v", asc.ExpiresAt)) - builder.WriteByte(')') - return builder.String() -} - -// AuthStateCaches is a parsable slice of AuthStateCache. -type AuthStateCaches []*AuthStateCache - -func (asc AuthStateCaches) config(cfg config) { - for _i := range asc { - asc[_i].config = cfg - } -} diff --git a/pkg/infra/ent/authstatecache/authstatecache.go b/pkg/infra/ent/authstatecache/authstatecache.go deleted file mode 100644 index 61058e2..0000000 --- a/pkg/infra/ent/authstatecache/authstatecache.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package authstatecache - -const ( - // Label holds the string label denoting the authstatecache type in the database. - Label = "auth_state_cache" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldExpiresAt holds the string denoting the expires_at field in the database. - FieldExpiresAt = "expires_at" - // Table holds the table name of the authstatecache in the database. - Table = "auth_state_caches" -) - -// Columns holds all SQL columns for authstatecache fields. -var Columns = []string{ - FieldID, - FieldExpiresAt, -} - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - return false -} diff --git a/pkg/infra/ent/authstatecache/where.go b/pkg/infra/ent/authstatecache/where.go deleted file mode 100644 index e03abde..0000000 --- a/pkg/infra/ent/authstatecache/where.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package authstatecache - -import ( - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id string) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id string) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id string) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...string) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...string) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id string) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id string) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id string) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id string) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// ExpiresAt applies equality check predicate on the "expires_at" field. It's identical to ExpiresAtEQ. -func ExpiresAt(v int64) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtEQ applies the EQ predicate on the "expires_at" field. -func ExpiresAtEQ(v int64) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtNEQ applies the NEQ predicate on the "expires_at" field. -func ExpiresAtNEQ(v int64) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtIn applies the In predicate on the "expires_at" field. -func ExpiresAtIn(vs ...int64) predicate.AuthStateCache { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.AuthStateCache(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldExpiresAt), v...)) - }) -} - -// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field. -func ExpiresAtNotIn(vs ...int64) predicate.AuthStateCache { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.AuthStateCache(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldExpiresAt), v...)) - }) -} - -// ExpiresAtGT applies the GT predicate on the "expires_at" field. -func ExpiresAtGT(v int64) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtGTE applies the GTE predicate on the "expires_at" field. -func ExpiresAtGTE(v int64) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtLT applies the LT predicate on the "expires_at" field. -func ExpiresAtLT(v int64) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtLTE applies the LTE predicate on the "expires_at" field. -func ExpiresAtLTE(v int64) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldExpiresAt), v)) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.AuthStateCache) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.AuthStateCache) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.AuthStateCache) predicate.AuthStateCache { - return predicate.AuthStateCache(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/authstatecache_create.go b/pkg/infra/ent/authstatecache_create.go deleted file mode 100644 index 4f710d7..0000000 --- a/pkg/infra/ent/authstatecache_create.go +++ /dev/null @@ -1,528 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/authstatecache" -) - -// AuthStateCacheCreate is the builder for creating a AuthStateCache entity. -type AuthStateCacheCreate struct { - config - mutation *AuthStateCacheMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetExpiresAt sets the "expires_at" field. -func (ascc *AuthStateCacheCreate) SetExpiresAt(i int64) *AuthStateCacheCreate { - ascc.mutation.SetExpiresAt(i) - return ascc -} - -// SetID sets the "id" field. -func (ascc *AuthStateCacheCreate) SetID(s string) *AuthStateCacheCreate { - ascc.mutation.SetID(s) - return ascc -} - -// Mutation returns the AuthStateCacheMutation object of the builder. -func (ascc *AuthStateCacheCreate) Mutation() *AuthStateCacheMutation { - return ascc.mutation -} - -// Save creates the AuthStateCache in the database. -func (ascc *AuthStateCacheCreate) Save(ctx context.Context) (*AuthStateCache, error) { - var ( - err error - node *AuthStateCache - ) - if len(ascc.hooks) == 0 { - if err = ascc.check(); err != nil { - return nil, err - } - node, err = ascc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*AuthStateCacheMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = ascc.check(); err != nil { - return nil, err - } - ascc.mutation = mutation - if node, err = ascc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(ascc.hooks) - 1; i >= 0; i-- { - if ascc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = ascc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, ascc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (ascc *AuthStateCacheCreate) SaveX(ctx context.Context) *AuthStateCache { - v, err := ascc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (ascc *AuthStateCacheCreate) Exec(ctx context.Context) error { - _, err := ascc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (ascc *AuthStateCacheCreate) ExecX(ctx context.Context) { - if err := ascc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (ascc *AuthStateCacheCreate) check() error { - if _, ok := ascc.mutation.ExpiresAt(); !ok { - return &ValidationError{Name: "expires_at", err: errors.New(`ent: missing required field "expires_at"`)} - } - return nil -} - -func (ascc *AuthStateCacheCreate) sqlSave(ctx context.Context) (*AuthStateCache, error) { - _node, _spec := ascc.createSpec() - if err := sqlgraph.CreateNode(ctx, ascc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - if _spec.ID.Value != nil { - _node.ID = _spec.ID.Value.(string) - } - return _node, nil -} - -func (ascc *AuthStateCacheCreate) createSpec() (*AuthStateCache, *sqlgraph.CreateSpec) { - var ( - _node = &AuthStateCache{config: ascc.config} - _spec = &sqlgraph.CreateSpec{ - Table: authstatecache.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: authstatecache.FieldID, - }, - } - ) - _spec.OnConflict = ascc.conflict - if id, ok := ascc.mutation.ID(); ok { - _node.ID = id - _spec.ID.Value = id - } - if value, ok := ascc.mutation.ExpiresAt(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: authstatecache.FieldExpiresAt, - }) - _node.ExpiresAt = value - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.AuthStateCache.Create(). -// SetExpiresAt(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.AuthStateCacheUpsert) { -// SetExpiresAt(v+v). -// }). -// Exec(ctx) -// -func (ascc *AuthStateCacheCreate) OnConflict(opts ...sql.ConflictOption) *AuthStateCacheUpsertOne { - ascc.conflict = opts - return &AuthStateCacheUpsertOne{ - create: ascc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.AuthStateCache.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (ascc *AuthStateCacheCreate) OnConflictColumns(columns ...string) *AuthStateCacheUpsertOne { - ascc.conflict = append(ascc.conflict, sql.ConflictColumns(columns...)) - return &AuthStateCacheUpsertOne{ - create: ascc, - } -} - -type ( - // AuthStateCacheUpsertOne is the builder for "upsert"-ing - // one AuthStateCache node. - AuthStateCacheUpsertOne struct { - create *AuthStateCacheCreate - } - - // AuthStateCacheUpsert is the "OnConflict" setter. - AuthStateCacheUpsert struct { - *sql.UpdateSet - } -) - -// SetExpiresAt sets the "expires_at" field. -func (u *AuthStateCacheUpsert) SetExpiresAt(v int64) *AuthStateCacheUpsert { - u.Set(authstatecache.FieldExpiresAt, v) - return u -} - -// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create. -func (u *AuthStateCacheUpsert) UpdateExpiresAt() *AuthStateCacheUpsert { - u.SetExcluded(authstatecache.FieldExpiresAt) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create except the ID field. -// Using this option is equivalent to using: -// -// client.AuthStateCache.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(authstatecache.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *AuthStateCacheUpsertOne) UpdateNewValues() *AuthStateCacheUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - if _, exists := u.create.mutation.ID(); exists { - s.SetIgnore(authstatecache.FieldID) - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.AuthStateCache.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *AuthStateCacheUpsertOne) Ignore() *AuthStateCacheUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *AuthStateCacheUpsertOne) DoNothing() *AuthStateCacheUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the AuthStateCacheCreate.OnConflict -// documentation for more info. -func (u *AuthStateCacheUpsertOne) Update(set func(*AuthStateCacheUpsert)) *AuthStateCacheUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&AuthStateCacheUpsert{UpdateSet: update}) - })) - return u -} - -// SetExpiresAt sets the "expires_at" field. -func (u *AuthStateCacheUpsertOne) SetExpiresAt(v int64) *AuthStateCacheUpsertOne { - return u.Update(func(s *AuthStateCacheUpsert) { - s.SetExpiresAt(v) - }) -} - -// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create. -func (u *AuthStateCacheUpsertOne) UpdateExpiresAt() *AuthStateCacheUpsertOne { - return u.Update(func(s *AuthStateCacheUpsert) { - s.UpdateExpiresAt() - }) -} - -// Exec executes the query. -func (u *AuthStateCacheUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for AuthStateCacheCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *AuthStateCacheUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *AuthStateCacheUpsertOne) ID(ctx context.Context) (id string, err error) { - if u.create.driver.Dialect() == dialect.MySQL { - // In case of "ON CONFLICT", there is no way to get back non-numeric ID - // fields from the database since MySQL does not support the RETURNING clause. - return id, errors.New("ent: AuthStateCacheUpsertOne.ID is not supported by MySQL driver. Use AuthStateCacheUpsertOne.Exec instead") - } - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *AuthStateCacheUpsertOne) IDX(ctx context.Context) string { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// AuthStateCacheCreateBulk is the builder for creating many AuthStateCache entities in bulk. -type AuthStateCacheCreateBulk struct { - config - builders []*AuthStateCacheCreate - conflict []sql.ConflictOption -} - -// Save creates the AuthStateCache entities in the database. -func (asccb *AuthStateCacheCreateBulk) Save(ctx context.Context) ([]*AuthStateCache, error) { - specs := make([]*sqlgraph.CreateSpec, len(asccb.builders)) - nodes := make([]*AuthStateCache, len(asccb.builders)) - mutators := make([]Mutator, len(asccb.builders)) - for i := range asccb.builders { - func(i int, root context.Context) { - builder := asccb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*AuthStateCacheMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, asccb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = asccb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, asccb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, asccb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (asccb *AuthStateCacheCreateBulk) SaveX(ctx context.Context) []*AuthStateCache { - v, err := asccb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (asccb *AuthStateCacheCreateBulk) Exec(ctx context.Context) error { - _, err := asccb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (asccb *AuthStateCacheCreateBulk) ExecX(ctx context.Context) { - if err := asccb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.AuthStateCache.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.AuthStateCacheUpsert) { -// SetExpiresAt(v+v). -// }). -// Exec(ctx) -// -func (asccb *AuthStateCacheCreateBulk) OnConflict(opts ...sql.ConflictOption) *AuthStateCacheUpsertBulk { - asccb.conflict = opts - return &AuthStateCacheUpsertBulk{ - create: asccb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.AuthStateCache.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (asccb *AuthStateCacheCreateBulk) OnConflictColumns(columns ...string) *AuthStateCacheUpsertBulk { - asccb.conflict = append(asccb.conflict, sql.ConflictColumns(columns...)) - return &AuthStateCacheUpsertBulk{ - create: asccb, - } -} - -// AuthStateCacheUpsertBulk is the builder for "upsert"-ing -// a bulk of AuthStateCache nodes. -type AuthStateCacheUpsertBulk struct { - create *AuthStateCacheCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.AuthStateCache.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(authstatecache.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *AuthStateCacheUpsertBulk) UpdateNewValues() *AuthStateCacheUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - for _, b := range u.create.builders { - if _, exists := b.mutation.ID(); exists { - s.SetIgnore(authstatecache.FieldID) - return - } - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.AuthStateCache.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *AuthStateCacheUpsertBulk) Ignore() *AuthStateCacheUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *AuthStateCacheUpsertBulk) DoNothing() *AuthStateCacheUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the AuthStateCacheCreateBulk.OnConflict -// documentation for more info. -func (u *AuthStateCacheUpsertBulk) Update(set func(*AuthStateCacheUpsert)) *AuthStateCacheUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&AuthStateCacheUpsert{UpdateSet: update}) - })) - return u -} - -// SetExpiresAt sets the "expires_at" field. -func (u *AuthStateCacheUpsertBulk) SetExpiresAt(v int64) *AuthStateCacheUpsertBulk { - return u.Update(func(s *AuthStateCacheUpsert) { - s.SetExpiresAt(v) - }) -} - -// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create. -func (u *AuthStateCacheUpsertBulk) UpdateExpiresAt() *AuthStateCacheUpsertBulk { - return u.Update(func(s *AuthStateCacheUpsert) { - s.UpdateExpiresAt() - }) -} - -// Exec executes the query. -func (u *AuthStateCacheUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the AuthStateCacheCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for AuthStateCacheCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *AuthStateCacheUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/authstatecache_delete.go b/pkg/infra/ent/authstatecache_delete.go deleted file mode 100644 index 7b1cb47..0000000 --- a/pkg/infra/ent/authstatecache_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/authstatecache" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// AuthStateCacheDelete is the builder for deleting a AuthStateCache entity. -type AuthStateCacheDelete struct { - config - hooks []Hook - mutation *AuthStateCacheMutation -} - -// Where appends a list predicates to the AuthStateCacheDelete builder. -func (ascd *AuthStateCacheDelete) Where(ps ...predicate.AuthStateCache) *AuthStateCacheDelete { - ascd.mutation.Where(ps...) - return ascd -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (ascd *AuthStateCacheDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(ascd.hooks) == 0 { - affected, err = ascd.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*AuthStateCacheMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - ascd.mutation = mutation - affected, err = ascd.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(ascd.hooks) - 1; i >= 0; i-- { - if ascd.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = ascd.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, ascd.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (ascd *AuthStateCacheDelete) ExecX(ctx context.Context) int { - n, err := ascd.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (ascd *AuthStateCacheDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: authstatecache.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: authstatecache.FieldID, - }, - }, - } - if ps := ascd.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, ascd.driver, _spec) -} - -// AuthStateCacheDeleteOne is the builder for deleting a single AuthStateCache entity. -type AuthStateCacheDeleteOne struct { - ascd *AuthStateCacheDelete -} - -// Exec executes the deletion query. -func (ascdo *AuthStateCacheDeleteOne) Exec(ctx context.Context) error { - n, err := ascdo.ascd.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{authstatecache.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (ascdo *AuthStateCacheDeleteOne) ExecX(ctx context.Context) { - ascdo.ascd.ExecX(ctx) -} diff --git a/pkg/infra/ent/authstatecache_query.go b/pkg/infra/ent/authstatecache_query.go deleted file mode 100644 index 2856dcc..0000000 --- a/pkg/infra/ent/authstatecache_query.go +++ /dev/null @@ -1,915 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/authstatecache" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// AuthStateCacheQuery is the builder for querying AuthStateCache entities. -type AuthStateCacheQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.AuthStateCache - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the AuthStateCacheQuery builder. -func (ascq *AuthStateCacheQuery) Where(ps ...predicate.AuthStateCache) *AuthStateCacheQuery { - ascq.predicates = append(ascq.predicates, ps...) - return ascq -} - -// Limit adds a limit step to the query. -func (ascq *AuthStateCacheQuery) Limit(limit int) *AuthStateCacheQuery { - ascq.limit = &limit - return ascq -} - -// Offset adds an offset step to the query. -func (ascq *AuthStateCacheQuery) Offset(offset int) *AuthStateCacheQuery { - ascq.offset = &offset - return ascq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (ascq *AuthStateCacheQuery) Unique(unique bool) *AuthStateCacheQuery { - ascq.unique = &unique - return ascq -} - -// Order adds an order step to the query. -func (ascq *AuthStateCacheQuery) Order(o ...OrderFunc) *AuthStateCacheQuery { - ascq.order = append(ascq.order, o...) - return ascq -} - -// First returns the first AuthStateCache entity from the query. -// Returns a *NotFoundError when no AuthStateCache was found. -func (ascq *AuthStateCacheQuery) First(ctx context.Context) (*AuthStateCache, error) { - nodes, err := ascq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{authstatecache.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (ascq *AuthStateCacheQuery) FirstX(ctx context.Context) *AuthStateCache { - node, err := ascq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first AuthStateCache ID from the query. -// Returns a *NotFoundError when no AuthStateCache ID was found. -func (ascq *AuthStateCacheQuery) FirstID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = ascq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{authstatecache.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (ascq *AuthStateCacheQuery) FirstIDX(ctx context.Context) string { - id, err := ascq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single AuthStateCache entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one AuthStateCache entity is not found. -// Returns a *NotFoundError when no AuthStateCache entities are found. -func (ascq *AuthStateCacheQuery) Only(ctx context.Context) (*AuthStateCache, error) { - nodes, err := ascq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{authstatecache.Label} - default: - return nil, &NotSingularError{authstatecache.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (ascq *AuthStateCacheQuery) OnlyX(ctx context.Context) *AuthStateCache { - node, err := ascq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only AuthStateCache ID in the query. -// Returns a *NotSingularError when exactly one AuthStateCache ID is not found. -// Returns a *NotFoundError when no entities are found. -func (ascq *AuthStateCacheQuery) OnlyID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = ascq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{authstatecache.Label} - default: - err = &NotSingularError{authstatecache.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (ascq *AuthStateCacheQuery) OnlyIDX(ctx context.Context) string { - id, err := ascq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of AuthStateCaches. -func (ascq *AuthStateCacheQuery) All(ctx context.Context) ([]*AuthStateCache, error) { - if err := ascq.prepareQuery(ctx); err != nil { - return nil, err - } - return ascq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (ascq *AuthStateCacheQuery) AllX(ctx context.Context) []*AuthStateCache { - nodes, err := ascq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of AuthStateCache IDs. -func (ascq *AuthStateCacheQuery) IDs(ctx context.Context) ([]string, error) { - var ids []string - if err := ascq.Select(authstatecache.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (ascq *AuthStateCacheQuery) IDsX(ctx context.Context) []string { - ids, err := ascq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (ascq *AuthStateCacheQuery) Count(ctx context.Context) (int, error) { - if err := ascq.prepareQuery(ctx); err != nil { - return 0, err - } - return ascq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (ascq *AuthStateCacheQuery) CountX(ctx context.Context) int { - count, err := ascq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (ascq *AuthStateCacheQuery) Exist(ctx context.Context) (bool, error) { - if err := ascq.prepareQuery(ctx); err != nil { - return false, err - } - return ascq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (ascq *AuthStateCacheQuery) ExistX(ctx context.Context) bool { - exist, err := ascq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the AuthStateCacheQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (ascq *AuthStateCacheQuery) Clone() *AuthStateCacheQuery { - if ascq == nil { - return nil - } - return &AuthStateCacheQuery{ - config: ascq.config, - limit: ascq.limit, - offset: ascq.offset, - order: append([]OrderFunc{}, ascq.order...), - predicates: append([]predicate.AuthStateCache{}, ascq.predicates...), - // clone intermediate query. - sql: ascq.sql.Clone(), - path: ascq.path, - } -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// ExpiresAt int64 `json:"expires_at,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.AuthStateCache.Query(). -// GroupBy(authstatecache.FieldExpiresAt). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (ascq *AuthStateCacheQuery) GroupBy(field string, fields ...string) *AuthStateCacheGroupBy { - group := &AuthStateCacheGroupBy{config: ascq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := ascq.prepareQuery(ctx); err != nil { - return nil, err - } - return ascq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// ExpiresAt int64 `json:"expires_at,omitempty"` -// } -// -// client.AuthStateCache.Query(). -// Select(authstatecache.FieldExpiresAt). -// Scan(ctx, &v) -// -func (ascq *AuthStateCacheQuery) Select(fields ...string) *AuthStateCacheSelect { - ascq.fields = append(ascq.fields, fields...) - return &AuthStateCacheSelect{AuthStateCacheQuery: ascq} -} - -func (ascq *AuthStateCacheQuery) prepareQuery(ctx context.Context) error { - for _, f := range ascq.fields { - if !authstatecache.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if ascq.path != nil { - prev, err := ascq.path(ctx) - if err != nil { - return err - } - ascq.sql = prev - } - return nil -} - -func (ascq *AuthStateCacheQuery) sqlAll(ctx context.Context) ([]*AuthStateCache, error) { - var ( - nodes = []*AuthStateCache{} - _spec = ascq.querySpec() - ) - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &AuthStateCache{config: ascq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, ascq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - return nodes, nil -} - -func (ascq *AuthStateCacheQuery) sqlCount(ctx context.Context) (int, error) { - _spec := ascq.querySpec() - return sqlgraph.CountNodes(ctx, ascq.driver, _spec) -} - -func (ascq *AuthStateCacheQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := ascq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (ascq *AuthStateCacheQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: authstatecache.Table, - Columns: authstatecache.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: authstatecache.FieldID, - }, - }, - From: ascq.sql, - Unique: true, - } - if unique := ascq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := ascq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, authstatecache.FieldID) - for i := range fields { - if fields[i] != authstatecache.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := ascq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := ascq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := ascq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := ascq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (ascq *AuthStateCacheQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(ascq.driver.Dialect()) - t1 := builder.Table(authstatecache.Table) - columns := ascq.fields - if len(columns) == 0 { - columns = authstatecache.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if ascq.sql != nil { - selector = ascq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range ascq.predicates { - p(selector) - } - for _, p := range ascq.order { - p(selector) - } - if offset := ascq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := ascq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// AuthStateCacheGroupBy is the group-by builder for AuthStateCache entities. -type AuthStateCacheGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (ascgb *AuthStateCacheGroupBy) Aggregate(fns ...AggregateFunc) *AuthStateCacheGroupBy { - ascgb.fns = append(ascgb.fns, fns...) - return ascgb -} - -// Scan applies the group-by query and scans the result into the given value. -func (ascgb *AuthStateCacheGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := ascgb.path(ctx) - if err != nil { - return err - } - ascgb.sql = query - return ascgb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (ascgb *AuthStateCacheGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := ascgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (ascgb *AuthStateCacheGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(ascgb.fields) > 1 { - return nil, errors.New("ent: AuthStateCacheGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := ascgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ascgb *AuthStateCacheGroupBy) StringsX(ctx context.Context) []string { - v, err := ascgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ascgb *AuthStateCacheGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ascgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authstatecache.Label} - default: - err = fmt.Errorf("ent: AuthStateCacheGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ascgb *AuthStateCacheGroupBy) StringX(ctx context.Context) string { - v, err := ascgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (ascgb *AuthStateCacheGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(ascgb.fields) > 1 { - return nil, errors.New("ent: AuthStateCacheGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := ascgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ascgb *AuthStateCacheGroupBy) IntsX(ctx context.Context) []int { - v, err := ascgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ascgb *AuthStateCacheGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ascgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authstatecache.Label} - default: - err = fmt.Errorf("ent: AuthStateCacheGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ascgb *AuthStateCacheGroupBy) IntX(ctx context.Context) int { - v, err := ascgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (ascgb *AuthStateCacheGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(ascgb.fields) > 1 { - return nil, errors.New("ent: AuthStateCacheGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := ascgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ascgb *AuthStateCacheGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := ascgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ascgb *AuthStateCacheGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ascgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authstatecache.Label} - default: - err = fmt.Errorf("ent: AuthStateCacheGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ascgb *AuthStateCacheGroupBy) Float64X(ctx context.Context) float64 { - v, err := ascgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (ascgb *AuthStateCacheGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(ascgb.fields) > 1 { - return nil, errors.New("ent: AuthStateCacheGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := ascgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ascgb *AuthStateCacheGroupBy) BoolsX(ctx context.Context) []bool { - v, err := ascgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ascgb *AuthStateCacheGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ascgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authstatecache.Label} - default: - err = fmt.Errorf("ent: AuthStateCacheGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ascgb *AuthStateCacheGroupBy) BoolX(ctx context.Context) bool { - v, err := ascgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (ascgb *AuthStateCacheGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range ascgb.fields { - if !authstatecache.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := ascgb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := ascgb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (ascgb *AuthStateCacheGroupBy) sqlQuery() *sql.Selector { - selector := ascgb.sql.Select() - aggregation := make([]string, 0, len(ascgb.fns)) - for _, fn := range ascgb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(ascgb.fields)+len(ascgb.fns)) - for _, f := range ascgb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(ascgb.fields...)...) -} - -// AuthStateCacheSelect is the builder for selecting fields of AuthStateCache entities. -type AuthStateCacheSelect struct { - *AuthStateCacheQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (ascs *AuthStateCacheSelect) Scan(ctx context.Context, v interface{}) error { - if err := ascs.prepareQuery(ctx); err != nil { - return err - } - ascs.sql = ascs.AuthStateCacheQuery.sqlQuery(ctx) - return ascs.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (ascs *AuthStateCacheSelect) ScanX(ctx context.Context, v interface{}) { - if err := ascs.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ascs *AuthStateCacheSelect) Strings(ctx context.Context) ([]string, error) { - if len(ascs.fields) > 1 { - return nil, errors.New("ent: AuthStateCacheSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ascs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ascs *AuthStateCacheSelect) StringsX(ctx context.Context) []string { - v, err := ascs.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ascs *AuthStateCacheSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ascs.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authstatecache.Label} - default: - err = fmt.Errorf("ent: AuthStateCacheSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ascs *AuthStateCacheSelect) StringX(ctx context.Context) string { - v, err := ascs.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ascs *AuthStateCacheSelect) Ints(ctx context.Context) ([]int, error) { - if len(ascs.fields) > 1 { - return nil, errors.New("ent: AuthStateCacheSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ascs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ascs *AuthStateCacheSelect) IntsX(ctx context.Context) []int { - v, err := ascs.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ascs *AuthStateCacheSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ascs.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authstatecache.Label} - default: - err = fmt.Errorf("ent: AuthStateCacheSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ascs *AuthStateCacheSelect) IntX(ctx context.Context) int { - v, err := ascs.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ascs *AuthStateCacheSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ascs.fields) > 1 { - return nil, errors.New("ent: AuthStateCacheSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ascs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ascs *AuthStateCacheSelect) Float64sX(ctx context.Context) []float64 { - v, err := ascs.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ascs *AuthStateCacheSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ascs.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authstatecache.Label} - default: - err = fmt.Errorf("ent: AuthStateCacheSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ascs *AuthStateCacheSelect) Float64X(ctx context.Context) float64 { - v, err := ascs.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ascs *AuthStateCacheSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ascs.fields) > 1 { - return nil, errors.New("ent: AuthStateCacheSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ascs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ascs *AuthStateCacheSelect) BoolsX(ctx context.Context) []bool { - v, err := ascs.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ascs *AuthStateCacheSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ascs.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{authstatecache.Label} - default: - err = fmt.Errorf("ent: AuthStateCacheSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ascs *AuthStateCacheSelect) BoolX(ctx context.Context) bool { - v, err := ascs.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (ascs *AuthStateCacheSelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := ascs.sql.Query() - if err := ascs.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/authstatecache_update.go b/pkg/infra/ent/authstatecache_update.go deleted file mode 100644 index bd9e0ed..0000000 --- a/pkg/infra/ent/authstatecache_update.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/authstatecache" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// AuthStateCacheUpdate is the builder for updating AuthStateCache entities. -type AuthStateCacheUpdate struct { - config - hooks []Hook - mutation *AuthStateCacheMutation -} - -// Where appends a list predicates to the AuthStateCacheUpdate builder. -func (ascu *AuthStateCacheUpdate) Where(ps ...predicate.AuthStateCache) *AuthStateCacheUpdate { - ascu.mutation.Where(ps...) - return ascu -} - -// SetExpiresAt sets the "expires_at" field. -func (ascu *AuthStateCacheUpdate) SetExpiresAt(i int64) *AuthStateCacheUpdate { - ascu.mutation.ResetExpiresAt() - ascu.mutation.SetExpiresAt(i) - return ascu -} - -// AddExpiresAt adds i to the "expires_at" field. -func (ascu *AuthStateCacheUpdate) AddExpiresAt(i int64) *AuthStateCacheUpdate { - ascu.mutation.AddExpiresAt(i) - return ascu -} - -// Mutation returns the AuthStateCacheMutation object of the builder. -func (ascu *AuthStateCacheUpdate) Mutation() *AuthStateCacheMutation { - return ascu.mutation -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (ascu *AuthStateCacheUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(ascu.hooks) == 0 { - affected, err = ascu.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*AuthStateCacheMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - ascu.mutation = mutation - affected, err = ascu.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(ascu.hooks) - 1; i >= 0; i-- { - if ascu.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = ascu.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, ascu.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (ascu *AuthStateCacheUpdate) SaveX(ctx context.Context) int { - affected, err := ascu.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (ascu *AuthStateCacheUpdate) Exec(ctx context.Context) error { - _, err := ascu.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (ascu *AuthStateCacheUpdate) ExecX(ctx context.Context) { - if err := ascu.Exec(ctx); err != nil { - panic(err) - } -} - -func (ascu *AuthStateCacheUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: authstatecache.Table, - Columns: authstatecache.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: authstatecache.FieldID, - }, - }, - } - if ps := ascu.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := ascu.mutation.ExpiresAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: authstatecache.FieldExpiresAt, - }) - } - if value, ok := ascu.mutation.AddedExpiresAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: authstatecache.FieldExpiresAt, - }) - } - if n, err = sqlgraph.UpdateNodes(ctx, ascu.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{authstatecache.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// AuthStateCacheUpdateOne is the builder for updating a single AuthStateCache entity. -type AuthStateCacheUpdateOne struct { - config - fields []string - hooks []Hook - mutation *AuthStateCacheMutation -} - -// SetExpiresAt sets the "expires_at" field. -func (ascuo *AuthStateCacheUpdateOne) SetExpiresAt(i int64) *AuthStateCacheUpdateOne { - ascuo.mutation.ResetExpiresAt() - ascuo.mutation.SetExpiresAt(i) - return ascuo -} - -// AddExpiresAt adds i to the "expires_at" field. -func (ascuo *AuthStateCacheUpdateOne) AddExpiresAt(i int64) *AuthStateCacheUpdateOne { - ascuo.mutation.AddExpiresAt(i) - return ascuo -} - -// Mutation returns the AuthStateCacheMutation object of the builder. -func (ascuo *AuthStateCacheUpdateOne) Mutation() *AuthStateCacheMutation { - return ascuo.mutation -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (ascuo *AuthStateCacheUpdateOne) Select(field string, fields ...string) *AuthStateCacheUpdateOne { - ascuo.fields = append([]string{field}, fields...) - return ascuo -} - -// Save executes the query and returns the updated AuthStateCache entity. -func (ascuo *AuthStateCacheUpdateOne) Save(ctx context.Context) (*AuthStateCache, error) { - var ( - err error - node *AuthStateCache - ) - if len(ascuo.hooks) == 0 { - node, err = ascuo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*AuthStateCacheMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - ascuo.mutation = mutation - node, err = ascuo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(ascuo.hooks) - 1; i >= 0; i-- { - if ascuo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = ascuo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, ascuo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (ascuo *AuthStateCacheUpdateOne) SaveX(ctx context.Context) *AuthStateCache { - node, err := ascuo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (ascuo *AuthStateCacheUpdateOne) Exec(ctx context.Context) error { - _, err := ascuo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (ascuo *AuthStateCacheUpdateOne) ExecX(ctx context.Context) { - if err := ascuo.Exec(ctx); err != nil { - panic(err) - } -} - -func (ascuo *AuthStateCacheUpdateOne) sqlSave(ctx context.Context) (_node *AuthStateCache, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: authstatecache.Table, - Columns: authstatecache.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: authstatecache.FieldID, - }, - }, - } - id, ok := ascuo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing AuthStateCache.ID for update")} - } - _spec.Node.ID.Value = id - if fields := ascuo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, authstatecache.FieldID) - for _, f := range fields { - if !authstatecache.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != authstatecache.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := ascuo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := ascuo.mutation.ExpiresAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: authstatecache.FieldExpiresAt, - }) - } - if value, ok := ascuo.mutation.AddedExpiresAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: authstatecache.FieldExpiresAt, - }) - } - _node = &AuthStateCache{config: ascuo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, ascuo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{authstatecache.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/client.go b/pkg/infra/ent/client.go deleted file mode 100644 index bdcc673..0000000 --- a/pkg/infra/ent/client.go +++ /dev/null @@ -1,1471 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - "log" - - "github.com/m-mizutani/octovy/pkg/infra/ent/migrate" - - "github.com/m-mizutani/octovy/pkg/infra/ent/authstatecache" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" - - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" -) - -// Client is the client that holds all ent builders. -type Client struct { - config - // Schema is the client for creating, migrating and dropping schema. - Schema *migrate.Schema - // AuthStateCache is the client for interacting with the AuthStateCache builders. - AuthStateCache *AuthStateCacheClient - // PackageRecord is the client for interacting with the PackageRecord builders. - PackageRecord *PackageRecordClient - // RepoLabel is the client for interacting with the RepoLabel builders. - RepoLabel *RepoLabelClient - // Repository is the client for interacting with the Repository builders. - Repository *RepositoryClient - // Scan is the client for interacting with the Scan builders. - Scan *ScanClient - // Session is the client for interacting with the Session builders. - Session *SessionClient - // Severity is the client for interacting with the Severity builders. - Severity *SeverityClient - // User is the client for interacting with the User builders. - User *UserClient - // VulnStatus is the client for interacting with the VulnStatus builders. - VulnStatus *VulnStatusClient - // VulnStatusIndex is the client for interacting with the VulnStatusIndex builders. - VulnStatusIndex *VulnStatusIndexClient - // Vulnerability is the client for interacting with the Vulnerability builders. - Vulnerability *VulnerabilityClient -} - -// NewClient creates a new client configured with the given options. -func NewClient(opts ...Option) *Client { - cfg := config{log: log.Println, hooks: &hooks{}} - cfg.options(opts...) - client := &Client{config: cfg} - client.init() - return client -} - -func (c *Client) init() { - c.Schema = migrate.NewSchema(c.driver) - c.AuthStateCache = NewAuthStateCacheClient(c.config) - c.PackageRecord = NewPackageRecordClient(c.config) - c.RepoLabel = NewRepoLabelClient(c.config) - c.Repository = NewRepositoryClient(c.config) - c.Scan = NewScanClient(c.config) - c.Session = NewSessionClient(c.config) - c.Severity = NewSeverityClient(c.config) - c.User = NewUserClient(c.config) - c.VulnStatus = NewVulnStatusClient(c.config) - c.VulnStatusIndex = NewVulnStatusIndexClient(c.config) - c.Vulnerability = NewVulnerabilityClient(c.config) -} - -// Open opens a database/sql.DB specified by the driver name and -// the data source name, and returns a new client attached to it. -// Optional parameters can be added for configuring the client. -func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { - switch driverName { - case dialect.MySQL, dialect.Postgres, dialect.SQLite: - drv, err := sql.Open(driverName, dataSourceName) - if err != nil { - return nil, err - } - return NewClient(append(options, Driver(drv))...), nil - default: - return nil, fmt.Errorf("unsupported driver: %q", driverName) - } -} - -// Tx returns a new transactional client. The provided context -// is used until the transaction is committed or rolled back. -func (c *Client) Tx(ctx context.Context) (*Tx, error) { - if _, ok := c.driver.(*txDriver); ok { - return nil, fmt.Errorf("ent: cannot start a transaction within a transaction") - } - tx, err := newTx(ctx, c.driver) - if err != nil { - return nil, fmt.Errorf("ent: starting a transaction: %w", err) - } - cfg := c.config - cfg.driver = tx - return &Tx{ - ctx: ctx, - config: cfg, - AuthStateCache: NewAuthStateCacheClient(cfg), - PackageRecord: NewPackageRecordClient(cfg), - RepoLabel: NewRepoLabelClient(cfg), - Repository: NewRepositoryClient(cfg), - Scan: NewScanClient(cfg), - Session: NewSessionClient(cfg), - Severity: NewSeverityClient(cfg), - User: NewUserClient(cfg), - VulnStatus: NewVulnStatusClient(cfg), - VulnStatusIndex: NewVulnStatusIndexClient(cfg), - Vulnerability: NewVulnerabilityClient(cfg), - }, nil -} - -// BeginTx returns a transactional client with specified options. -func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) { - if _, ok := c.driver.(*txDriver); ok { - return nil, fmt.Errorf("ent: cannot start a transaction within a transaction") - } - tx, err := c.driver.(interface { - BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error) - }).BeginTx(ctx, opts) - if err != nil { - return nil, fmt.Errorf("ent: starting a transaction: %w", err) - } - cfg := c.config - cfg.driver = &txDriver{tx: tx, drv: c.driver} - return &Tx{ - config: cfg, - AuthStateCache: NewAuthStateCacheClient(cfg), - PackageRecord: NewPackageRecordClient(cfg), - RepoLabel: NewRepoLabelClient(cfg), - Repository: NewRepositoryClient(cfg), - Scan: NewScanClient(cfg), - Session: NewSessionClient(cfg), - Severity: NewSeverityClient(cfg), - User: NewUserClient(cfg), - VulnStatus: NewVulnStatusClient(cfg), - VulnStatusIndex: NewVulnStatusIndexClient(cfg), - Vulnerability: NewVulnerabilityClient(cfg), - }, nil -} - -// Debug returns a new debug-client. It's used to get verbose logging on specific operations. -// -// client.Debug(). -// AuthStateCache. -// Query(). -// Count(ctx) -// -func (c *Client) Debug() *Client { - if c.debug { - return c - } - cfg := c.config - cfg.driver = dialect.Debug(c.driver, c.log) - client := &Client{config: cfg} - client.init() - return client -} - -// Close closes the database connection and prevents new queries from starting. -func (c *Client) Close() error { - return c.driver.Close() -} - -// Use adds the mutation hooks to all the entity clients. -// In order to add hooks to a specific client, call: `client.Node.Use(...)`. -func (c *Client) Use(hooks ...Hook) { - c.AuthStateCache.Use(hooks...) - c.PackageRecord.Use(hooks...) - c.RepoLabel.Use(hooks...) - c.Repository.Use(hooks...) - c.Scan.Use(hooks...) - c.Session.Use(hooks...) - c.Severity.Use(hooks...) - c.User.Use(hooks...) - c.VulnStatus.Use(hooks...) - c.VulnStatusIndex.Use(hooks...) - c.Vulnerability.Use(hooks...) -} - -// AuthStateCacheClient is a client for the AuthStateCache schema. -type AuthStateCacheClient struct { - config -} - -// NewAuthStateCacheClient returns a client for the AuthStateCache from the given config. -func NewAuthStateCacheClient(c config) *AuthStateCacheClient { - return &AuthStateCacheClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `authstatecache.Hooks(f(g(h())))`. -func (c *AuthStateCacheClient) Use(hooks ...Hook) { - c.hooks.AuthStateCache = append(c.hooks.AuthStateCache, hooks...) -} - -// Create returns a create builder for AuthStateCache. -func (c *AuthStateCacheClient) Create() *AuthStateCacheCreate { - mutation := newAuthStateCacheMutation(c.config, OpCreate) - return &AuthStateCacheCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of AuthStateCache entities. -func (c *AuthStateCacheClient) CreateBulk(builders ...*AuthStateCacheCreate) *AuthStateCacheCreateBulk { - return &AuthStateCacheCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for AuthStateCache. -func (c *AuthStateCacheClient) Update() *AuthStateCacheUpdate { - mutation := newAuthStateCacheMutation(c.config, OpUpdate) - return &AuthStateCacheUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *AuthStateCacheClient) UpdateOne(asc *AuthStateCache) *AuthStateCacheUpdateOne { - mutation := newAuthStateCacheMutation(c.config, OpUpdateOne, withAuthStateCache(asc)) - return &AuthStateCacheUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *AuthStateCacheClient) UpdateOneID(id string) *AuthStateCacheUpdateOne { - mutation := newAuthStateCacheMutation(c.config, OpUpdateOne, withAuthStateCacheID(id)) - return &AuthStateCacheUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for AuthStateCache. -func (c *AuthStateCacheClient) Delete() *AuthStateCacheDelete { - mutation := newAuthStateCacheMutation(c.config, OpDelete) - return &AuthStateCacheDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *AuthStateCacheClient) DeleteOne(asc *AuthStateCache) *AuthStateCacheDeleteOne { - return c.DeleteOneID(asc.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *AuthStateCacheClient) DeleteOneID(id string) *AuthStateCacheDeleteOne { - builder := c.Delete().Where(authstatecache.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &AuthStateCacheDeleteOne{builder} -} - -// Query returns a query builder for AuthStateCache. -func (c *AuthStateCacheClient) Query() *AuthStateCacheQuery { - return &AuthStateCacheQuery{ - config: c.config, - } -} - -// Get returns a AuthStateCache entity by its id. -func (c *AuthStateCacheClient) Get(ctx context.Context, id string) (*AuthStateCache, error) { - return c.Query().Where(authstatecache.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *AuthStateCacheClient) GetX(ctx context.Context, id string) *AuthStateCache { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// Hooks returns the client hooks. -func (c *AuthStateCacheClient) Hooks() []Hook { - return c.hooks.AuthStateCache -} - -// PackageRecordClient is a client for the PackageRecord schema. -type PackageRecordClient struct { - config -} - -// NewPackageRecordClient returns a client for the PackageRecord from the given config. -func NewPackageRecordClient(c config) *PackageRecordClient { - return &PackageRecordClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `packagerecord.Hooks(f(g(h())))`. -func (c *PackageRecordClient) Use(hooks ...Hook) { - c.hooks.PackageRecord = append(c.hooks.PackageRecord, hooks...) -} - -// Create returns a create builder for PackageRecord. -func (c *PackageRecordClient) Create() *PackageRecordCreate { - mutation := newPackageRecordMutation(c.config, OpCreate) - return &PackageRecordCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of PackageRecord entities. -func (c *PackageRecordClient) CreateBulk(builders ...*PackageRecordCreate) *PackageRecordCreateBulk { - return &PackageRecordCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for PackageRecord. -func (c *PackageRecordClient) Update() *PackageRecordUpdate { - mutation := newPackageRecordMutation(c.config, OpUpdate) - return &PackageRecordUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *PackageRecordClient) UpdateOne(pr *PackageRecord) *PackageRecordUpdateOne { - mutation := newPackageRecordMutation(c.config, OpUpdateOne, withPackageRecord(pr)) - return &PackageRecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *PackageRecordClient) UpdateOneID(id int) *PackageRecordUpdateOne { - mutation := newPackageRecordMutation(c.config, OpUpdateOne, withPackageRecordID(id)) - return &PackageRecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for PackageRecord. -func (c *PackageRecordClient) Delete() *PackageRecordDelete { - mutation := newPackageRecordMutation(c.config, OpDelete) - return &PackageRecordDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *PackageRecordClient) DeleteOne(pr *PackageRecord) *PackageRecordDeleteOne { - return c.DeleteOneID(pr.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *PackageRecordClient) DeleteOneID(id int) *PackageRecordDeleteOne { - builder := c.Delete().Where(packagerecord.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &PackageRecordDeleteOne{builder} -} - -// Query returns a query builder for PackageRecord. -func (c *PackageRecordClient) Query() *PackageRecordQuery { - return &PackageRecordQuery{ - config: c.config, - } -} - -// Get returns a PackageRecord entity by its id. -func (c *PackageRecordClient) Get(ctx context.Context, id int) (*PackageRecord, error) { - return c.Query().Where(packagerecord.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *PackageRecordClient) GetX(ctx context.Context, id int) *PackageRecord { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryScan queries the scan edge of a PackageRecord. -func (c *PackageRecordClient) QueryScan(pr *PackageRecord) *ScanQuery { - query := &ScanQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := pr.ID - step := sqlgraph.NewStep( - sqlgraph.From(packagerecord.Table, packagerecord.FieldID, id), - sqlgraph.To(scan.Table, scan.FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, packagerecord.ScanTable, packagerecord.ScanPrimaryKey...), - ) - fromV = sqlgraph.Neighbors(pr.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// QueryVulnerabilities queries the vulnerabilities edge of a PackageRecord. -func (c *PackageRecordClient) QueryVulnerabilities(pr *PackageRecord) *VulnerabilityQuery { - query := &VulnerabilityQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := pr.ID - step := sqlgraph.NewStep( - sqlgraph.From(packagerecord.Table, packagerecord.FieldID, id), - sqlgraph.To(vulnerability.Table, vulnerability.FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, packagerecord.VulnerabilitiesTable, packagerecord.VulnerabilitiesPrimaryKey...), - ) - fromV = sqlgraph.Neighbors(pr.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *PackageRecordClient) Hooks() []Hook { - return c.hooks.PackageRecord -} - -// RepoLabelClient is a client for the RepoLabel schema. -type RepoLabelClient struct { - config -} - -// NewRepoLabelClient returns a client for the RepoLabel from the given config. -func NewRepoLabelClient(c config) *RepoLabelClient { - return &RepoLabelClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `repolabel.Hooks(f(g(h())))`. -func (c *RepoLabelClient) Use(hooks ...Hook) { - c.hooks.RepoLabel = append(c.hooks.RepoLabel, hooks...) -} - -// Create returns a create builder for RepoLabel. -func (c *RepoLabelClient) Create() *RepoLabelCreate { - mutation := newRepoLabelMutation(c.config, OpCreate) - return &RepoLabelCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of RepoLabel entities. -func (c *RepoLabelClient) CreateBulk(builders ...*RepoLabelCreate) *RepoLabelCreateBulk { - return &RepoLabelCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for RepoLabel. -func (c *RepoLabelClient) Update() *RepoLabelUpdate { - mutation := newRepoLabelMutation(c.config, OpUpdate) - return &RepoLabelUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *RepoLabelClient) UpdateOne(rl *RepoLabel) *RepoLabelUpdateOne { - mutation := newRepoLabelMutation(c.config, OpUpdateOne, withRepoLabel(rl)) - return &RepoLabelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *RepoLabelClient) UpdateOneID(id int) *RepoLabelUpdateOne { - mutation := newRepoLabelMutation(c.config, OpUpdateOne, withRepoLabelID(id)) - return &RepoLabelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for RepoLabel. -func (c *RepoLabelClient) Delete() *RepoLabelDelete { - mutation := newRepoLabelMutation(c.config, OpDelete) - return &RepoLabelDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *RepoLabelClient) DeleteOne(rl *RepoLabel) *RepoLabelDeleteOne { - return c.DeleteOneID(rl.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *RepoLabelClient) DeleteOneID(id int) *RepoLabelDeleteOne { - builder := c.Delete().Where(repolabel.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &RepoLabelDeleteOne{builder} -} - -// Query returns a query builder for RepoLabel. -func (c *RepoLabelClient) Query() *RepoLabelQuery { - return &RepoLabelQuery{ - config: c.config, - } -} - -// Get returns a RepoLabel entity by its id. -func (c *RepoLabelClient) Get(ctx context.Context, id int) (*RepoLabel, error) { - return c.Query().Where(repolabel.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *RepoLabelClient) GetX(ctx context.Context, id int) *RepoLabel { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryRepos queries the repos edge of a RepoLabel. -func (c *RepoLabelClient) QueryRepos(rl *RepoLabel) *RepositoryQuery { - query := &RepositoryQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := rl.ID - step := sqlgraph.NewStep( - sqlgraph.From(repolabel.Table, repolabel.FieldID, id), - sqlgraph.To(repository.Table, repository.FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, repolabel.ReposTable, repolabel.ReposPrimaryKey...), - ) - fromV = sqlgraph.Neighbors(rl.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *RepoLabelClient) Hooks() []Hook { - return c.hooks.RepoLabel -} - -// RepositoryClient is a client for the Repository schema. -type RepositoryClient struct { - config -} - -// NewRepositoryClient returns a client for the Repository from the given config. -func NewRepositoryClient(c config) *RepositoryClient { - return &RepositoryClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `repository.Hooks(f(g(h())))`. -func (c *RepositoryClient) Use(hooks ...Hook) { - c.hooks.Repository = append(c.hooks.Repository, hooks...) -} - -// Create returns a create builder for Repository. -func (c *RepositoryClient) Create() *RepositoryCreate { - mutation := newRepositoryMutation(c.config, OpCreate) - return &RepositoryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of Repository entities. -func (c *RepositoryClient) CreateBulk(builders ...*RepositoryCreate) *RepositoryCreateBulk { - return &RepositoryCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for Repository. -func (c *RepositoryClient) Update() *RepositoryUpdate { - mutation := newRepositoryMutation(c.config, OpUpdate) - return &RepositoryUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *RepositoryClient) UpdateOne(r *Repository) *RepositoryUpdateOne { - mutation := newRepositoryMutation(c.config, OpUpdateOne, withRepository(r)) - return &RepositoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *RepositoryClient) UpdateOneID(id int) *RepositoryUpdateOne { - mutation := newRepositoryMutation(c.config, OpUpdateOne, withRepositoryID(id)) - return &RepositoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for Repository. -func (c *RepositoryClient) Delete() *RepositoryDelete { - mutation := newRepositoryMutation(c.config, OpDelete) - return &RepositoryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *RepositoryClient) DeleteOne(r *Repository) *RepositoryDeleteOne { - return c.DeleteOneID(r.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *RepositoryClient) DeleteOneID(id int) *RepositoryDeleteOne { - builder := c.Delete().Where(repository.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &RepositoryDeleteOne{builder} -} - -// Query returns a query builder for Repository. -func (c *RepositoryClient) Query() *RepositoryQuery { - return &RepositoryQuery{ - config: c.config, - } -} - -// Get returns a Repository entity by its id. -func (c *RepositoryClient) Get(ctx context.Context, id int) (*Repository, error) { - return c.Query().Where(repository.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *RepositoryClient) GetX(ctx context.Context, id int) *Repository { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryScan queries the scan edge of a Repository. -func (c *RepositoryClient) QueryScan(r *Repository) *ScanQuery { - query := &ScanQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := r.ID - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, id), - sqlgraph.To(scan.Table, scan.FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, repository.ScanTable, repository.ScanPrimaryKey...), - ) - fromV = sqlgraph.Neighbors(r.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// QueryMain queries the main edge of a Repository. -func (c *RepositoryClient) QueryMain(r *Repository) *ScanQuery { - query := &ScanQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := r.ID - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, id), - sqlgraph.To(scan.Table, scan.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, repository.MainTable, repository.MainColumn), - ) - fromV = sqlgraph.Neighbors(r.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// QueryLatest queries the latest edge of a Repository. -func (c *RepositoryClient) QueryLatest(r *Repository) *ScanQuery { - query := &ScanQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := r.ID - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, id), - sqlgraph.To(scan.Table, scan.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, repository.LatestTable, repository.LatestColumn), - ) - fromV = sqlgraph.Neighbors(r.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// QueryStatus queries the status edge of a Repository. -func (c *RepositoryClient) QueryStatus(r *Repository) *VulnStatusIndexQuery { - query := &VulnStatusIndexQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := r.ID - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, id), - sqlgraph.To(vulnstatusindex.Table, vulnstatusindex.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, repository.StatusTable, repository.StatusColumn), - ) - fromV = sqlgraph.Neighbors(r.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// QueryLabels queries the labels edge of a Repository. -func (c *RepositoryClient) QueryLabels(r *Repository) *RepoLabelQuery { - query := &RepoLabelQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := r.ID - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, id), - sqlgraph.To(repolabel.Table, repolabel.FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, repository.LabelsTable, repository.LabelsPrimaryKey...), - ) - fromV = sqlgraph.Neighbors(r.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *RepositoryClient) Hooks() []Hook { - return c.hooks.Repository -} - -// ScanClient is a client for the Scan schema. -type ScanClient struct { - config -} - -// NewScanClient returns a client for the Scan from the given config. -func NewScanClient(c config) *ScanClient { - return &ScanClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `scan.Hooks(f(g(h())))`. -func (c *ScanClient) Use(hooks ...Hook) { - c.hooks.Scan = append(c.hooks.Scan, hooks...) -} - -// Create returns a create builder for Scan. -func (c *ScanClient) Create() *ScanCreate { - mutation := newScanMutation(c.config, OpCreate) - return &ScanCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of Scan entities. -func (c *ScanClient) CreateBulk(builders ...*ScanCreate) *ScanCreateBulk { - return &ScanCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for Scan. -func (c *ScanClient) Update() *ScanUpdate { - mutation := newScanMutation(c.config, OpUpdate) - return &ScanUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *ScanClient) UpdateOne(s *Scan) *ScanUpdateOne { - mutation := newScanMutation(c.config, OpUpdateOne, withScan(s)) - return &ScanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *ScanClient) UpdateOneID(id string) *ScanUpdateOne { - mutation := newScanMutation(c.config, OpUpdateOne, withScanID(id)) - return &ScanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for Scan. -func (c *ScanClient) Delete() *ScanDelete { - mutation := newScanMutation(c.config, OpDelete) - return &ScanDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *ScanClient) DeleteOne(s *Scan) *ScanDeleteOne { - return c.DeleteOneID(s.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *ScanClient) DeleteOneID(id string) *ScanDeleteOne { - builder := c.Delete().Where(scan.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &ScanDeleteOne{builder} -} - -// Query returns a query builder for Scan. -func (c *ScanClient) Query() *ScanQuery { - return &ScanQuery{ - config: c.config, - } -} - -// Get returns a Scan entity by its id. -func (c *ScanClient) Get(ctx context.Context, id string) (*Scan, error) { - return c.Query().Where(scan.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *ScanClient) GetX(ctx context.Context, id string) *Scan { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryRepository queries the repository edge of a Scan. -func (c *ScanClient) QueryRepository(s *Scan) *RepositoryQuery { - query := &RepositoryQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := s.ID - step := sqlgraph.NewStep( - sqlgraph.From(scan.Table, scan.FieldID, id), - sqlgraph.To(repository.Table, repository.FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, scan.RepositoryTable, scan.RepositoryPrimaryKey...), - ) - fromV = sqlgraph.Neighbors(s.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// QueryPackages queries the packages edge of a Scan. -func (c *ScanClient) QueryPackages(s *Scan) *PackageRecordQuery { - query := &PackageRecordQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := s.ID - step := sqlgraph.NewStep( - sqlgraph.From(scan.Table, scan.FieldID, id), - sqlgraph.To(packagerecord.Table, packagerecord.FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, scan.PackagesTable, scan.PackagesPrimaryKey...), - ) - fromV = sqlgraph.Neighbors(s.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *ScanClient) Hooks() []Hook { - return c.hooks.Scan -} - -// SessionClient is a client for the Session schema. -type SessionClient struct { - config -} - -// NewSessionClient returns a client for the Session from the given config. -func NewSessionClient(c config) *SessionClient { - return &SessionClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `session.Hooks(f(g(h())))`. -func (c *SessionClient) Use(hooks ...Hook) { - c.hooks.Session = append(c.hooks.Session, hooks...) -} - -// Create returns a create builder for Session. -func (c *SessionClient) Create() *SessionCreate { - mutation := newSessionMutation(c.config, OpCreate) - return &SessionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of Session entities. -func (c *SessionClient) CreateBulk(builders ...*SessionCreate) *SessionCreateBulk { - return &SessionCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for Session. -func (c *SessionClient) Update() *SessionUpdate { - mutation := newSessionMutation(c.config, OpUpdate) - return &SessionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *SessionClient) UpdateOne(s *Session) *SessionUpdateOne { - mutation := newSessionMutation(c.config, OpUpdateOne, withSession(s)) - return &SessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *SessionClient) UpdateOneID(id string) *SessionUpdateOne { - mutation := newSessionMutation(c.config, OpUpdateOne, withSessionID(id)) - return &SessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for Session. -func (c *SessionClient) Delete() *SessionDelete { - mutation := newSessionMutation(c.config, OpDelete) - return &SessionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *SessionClient) DeleteOne(s *Session) *SessionDeleteOne { - return c.DeleteOneID(s.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *SessionClient) DeleteOneID(id string) *SessionDeleteOne { - builder := c.Delete().Where(session.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &SessionDeleteOne{builder} -} - -// Query returns a query builder for Session. -func (c *SessionClient) Query() *SessionQuery { - return &SessionQuery{ - config: c.config, - } -} - -// Get returns a Session entity by its id. -func (c *SessionClient) Get(ctx context.Context, id string) (*Session, error) { - return c.Query().Where(session.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *SessionClient) GetX(ctx context.Context, id string) *Session { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryLogin queries the login edge of a Session. -func (c *SessionClient) QueryLogin(s *Session) *UserQuery { - query := &UserQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := s.ID - step := sqlgraph.NewStep( - sqlgraph.From(session.Table, session.FieldID, id), - sqlgraph.To(user.Table, user.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, session.LoginTable, session.LoginColumn), - ) - fromV = sqlgraph.Neighbors(s.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *SessionClient) Hooks() []Hook { - return c.hooks.Session -} - -// SeverityClient is a client for the Severity schema. -type SeverityClient struct { - config -} - -// NewSeverityClient returns a client for the Severity from the given config. -func NewSeverityClient(c config) *SeverityClient { - return &SeverityClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `severity.Hooks(f(g(h())))`. -func (c *SeverityClient) Use(hooks ...Hook) { - c.hooks.Severity = append(c.hooks.Severity, hooks...) -} - -// Create returns a create builder for Severity. -func (c *SeverityClient) Create() *SeverityCreate { - mutation := newSeverityMutation(c.config, OpCreate) - return &SeverityCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of Severity entities. -func (c *SeverityClient) CreateBulk(builders ...*SeverityCreate) *SeverityCreateBulk { - return &SeverityCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for Severity. -func (c *SeverityClient) Update() *SeverityUpdate { - mutation := newSeverityMutation(c.config, OpUpdate) - return &SeverityUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *SeverityClient) UpdateOne(s *Severity) *SeverityUpdateOne { - mutation := newSeverityMutation(c.config, OpUpdateOne, withSeverity(s)) - return &SeverityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *SeverityClient) UpdateOneID(id int) *SeverityUpdateOne { - mutation := newSeverityMutation(c.config, OpUpdateOne, withSeverityID(id)) - return &SeverityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for Severity. -func (c *SeverityClient) Delete() *SeverityDelete { - mutation := newSeverityMutation(c.config, OpDelete) - return &SeverityDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *SeverityClient) DeleteOne(s *Severity) *SeverityDeleteOne { - return c.DeleteOneID(s.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *SeverityClient) DeleteOneID(id int) *SeverityDeleteOne { - builder := c.Delete().Where(severity.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &SeverityDeleteOne{builder} -} - -// Query returns a query builder for Severity. -func (c *SeverityClient) Query() *SeverityQuery { - return &SeverityQuery{ - config: c.config, - } -} - -// Get returns a Severity entity by its id. -func (c *SeverityClient) Get(ctx context.Context, id int) (*Severity, error) { - return c.Query().Where(severity.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *SeverityClient) GetX(ctx context.Context, id int) *Severity { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryVulnerabilities queries the vulnerabilities edge of a Severity. -func (c *SeverityClient) QueryVulnerabilities(s *Severity) *VulnerabilityQuery { - query := &VulnerabilityQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := s.ID - step := sqlgraph.NewStep( - sqlgraph.From(severity.Table, severity.FieldID, id), - sqlgraph.To(vulnerability.Table, vulnerability.FieldID), - sqlgraph.Edge(sqlgraph.O2M, true, severity.VulnerabilitiesTable, severity.VulnerabilitiesColumn), - ) - fromV = sqlgraph.Neighbors(s.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *SeverityClient) Hooks() []Hook { - return c.hooks.Severity -} - -// UserClient is a client for the User schema. -type UserClient struct { - config -} - -// NewUserClient returns a client for the User from the given config. -func NewUserClient(c config) *UserClient { - return &UserClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`. -func (c *UserClient) Use(hooks ...Hook) { - c.hooks.User = append(c.hooks.User, hooks...) -} - -// Create returns a create builder for User. -func (c *UserClient) Create() *UserCreate { - mutation := newUserMutation(c.config, OpCreate) - return &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of User entities. -func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk { - return &UserCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for User. -func (c *UserClient) Update() *UserUpdate { - mutation := newUserMutation(c.config, OpUpdate) - return &UserUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *UserClient) UpdateOne(u *User) *UserUpdateOne { - mutation := newUserMutation(c.config, OpUpdateOne, withUser(u)) - return &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *UserClient) UpdateOneID(id int) *UserUpdateOne { - mutation := newUserMutation(c.config, OpUpdateOne, withUserID(id)) - return &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for User. -func (c *UserClient) Delete() *UserDelete { - mutation := newUserMutation(c.config, OpDelete) - return &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *UserClient) DeleteOne(u *User) *UserDeleteOne { - return c.DeleteOneID(u.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *UserClient) DeleteOneID(id int) *UserDeleteOne { - builder := c.Delete().Where(user.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &UserDeleteOne{builder} -} - -// Query returns a query builder for User. -func (c *UserClient) Query() *UserQuery { - return &UserQuery{ - config: c.config, - } -} - -// Get returns a User entity by its id. -func (c *UserClient) Get(ctx context.Context, id int) (*User, error) { - return c.Query().Where(user.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *UserClient) GetX(ctx context.Context, id int) *User { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryEditedStatus queries the edited_status edge of a User. -func (c *UserClient) QueryEditedStatus(u *User) *VulnStatusQuery { - query := &VulnStatusQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := u.ID - step := sqlgraph.NewStep( - sqlgraph.From(user.Table, user.FieldID, id), - sqlgraph.To(vulnstatus.Table, vulnstatus.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, user.EditedStatusTable, user.EditedStatusColumn), - ) - fromV = sqlgraph.Neighbors(u.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *UserClient) Hooks() []Hook { - return c.hooks.User -} - -// VulnStatusClient is a client for the VulnStatus schema. -type VulnStatusClient struct { - config -} - -// NewVulnStatusClient returns a client for the VulnStatus from the given config. -func NewVulnStatusClient(c config) *VulnStatusClient { - return &VulnStatusClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `vulnstatus.Hooks(f(g(h())))`. -func (c *VulnStatusClient) Use(hooks ...Hook) { - c.hooks.VulnStatus = append(c.hooks.VulnStatus, hooks...) -} - -// Create returns a create builder for VulnStatus. -func (c *VulnStatusClient) Create() *VulnStatusCreate { - mutation := newVulnStatusMutation(c.config, OpCreate) - return &VulnStatusCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of VulnStatus entities. -func (c *VulnStatusClient) CreateBulk(builders ...*VulnStatusCreate) *VulnStatusCreateBulk { - return &VulnStatusCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for VulnStatus. -func (c *VulnStatusClient) Update() *VulnStatusUpdate { - mutation := newVulnStatusMutation(c.config, OpUpdate) - return &VulnStatusUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *VulnStatusClient) UpdateOne(vs *VulnStatus) *VulnStatusUpdateOne { - mutation := newVulnStatusMutation(c.config, OpUpdateOne, withVulnStatus(vs)) - return &VulnStatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *VulnStatusClient) UpdateOneID(id int) *VulnStatusUpdateOne { - mutation := newVulnStatusMutation(c.config, OpUpdateOne, withVulnStatusID(id)) - return &VulnStatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for VulnStatus. -func (c *VulnStatusClient) Delete() *VulnStatusDelete { - mutation := newVulnStatusMutation(c.config, OpDelete) - return &VulnStatusDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *VulnStatusClient) DeleteOne(vs *VulnStatus) *VulnStatusDeleteOne { - return c.DeleteOneID(vs.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *VulnStatusClient) DeleteOneID(id int) *VulnStatusDeleteOne { - builder := c.Delete().Where(vulnstatus.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &VulnStatusDeleteOne{builder} -} - -// Query returns a query builder for VulnStatus. -func (c *VulnStatusClient) Query() *VulnStatusQuery { - return &VulnStatusQuery{ - config: c.config, - } -} - -// Get returns a VulnStatus entity by its id. -func (c *VulnStatusClient) Get(ctx context.Context, id int) (*VulnStatus, error) { - return c.Query().Where(vulnstatus.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *VulnStatusClient) GetX(ctx context.Context, id int) *VulnStatus { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryAuthor queries the author edge of a VulnStatus. -func (c *VulnStatusClient) QueryAuthor(vs *VulnStatus) *UserQuery { - query := &UserQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := vs.ID - step := sqlgraph.NewStep( - sqlgraph.From(vulnstatus.Table, vulnstatus.FieldID, id), - sqlgraph.To(user.Table, user.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, vulnstatus.AuthorTable, vulnstatus.AuthorColumn), - ) - fromV = sqlgraph.Neighbors(vs.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *VulnStatusClient) Hooks() []Hook { - return c.hooks.VulnStatus -} - -// VulnStatusIndexClient is a client for the VulnStatusIndex schema. -type VulnStatusIndexClient struct { - config -} - -// NewVulnStatusIndexClient returns a client for the VulnStatusIndex from the given config. -func NewVulnStatusIndexClient(c config) *VulnStatusIndexClient { - return &VulnStatusIndexClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `vulnstatusindex.Hooks(f(g(h())))`. -func (c *VulnStatusIndexClient) Use(hooks ...Hook) { - c.hooks.VulnStatusIndex = append(c.hooks.VulnStatusIndex, hooks...) -} - -// Create returns a create builder for VulnStatusIndex. -func (c *VulnStatusIndexClient) Create() *VulnStatusIndexCreate { - mutation := newVulnStatusIndexMutation(c.config, OpCreate) - return &VulnStatusIndexCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of VulnStatusIndex entities. -func (c *VulnStatusIndexClient) CreateBulk(builders ...*VulnStatusIndexCreate) *VulnStatusIndexCreateBulk { - return &VulnStatusIndexCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for VulnStatusIndex. -func (c *VulnStatusIndexClient) Update() *VulnStatusIndexUpdate { - mutation := newVulnStatusIndexMutation(c.config, OpUpdate) - return &VulnStatusIndexUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *VulnStatusIndexClient) UpdateOne(vsi *VulnStatusIndex) *VulnStatusIndexUpdateOne { - mutation := newVulnStatusIndexMutation(c.config, OpUpdateOne, withVulnStatusIndex(vsi)) - return &VulnStatusIndexUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *VulnStatusIndexClient) UpdateOneID(id string) *VulnStatusIndexUpdateOne { - mutation := newVulnStatusIndexMutation(c.config, OpUpdateOne, withVulnStatusIndexID(id)) - return &VulnStatusIndexUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for VulnStatusIndex. -func (c *VulnStatusIndexClient) Delete() *VulnStatusIndexDelete { - mutation := newVulnStatusIndexMutation(c.config, OpDelete) - return &VulnStatusIndexDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *VulnStatusIndexClient) DeleteOne(vsi *VulnStatusIndex) *VulnStatusIndexDeleteOne { - return c.DeleteOneID(vsi.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *VulnStatusIndexClient) DeleteOneID(id string) *VulnStatusIndexDeleteOne { - builder := c.Delete().Where(vulnstatusindex.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &VulnStatusIndexDeleteOne{builder} -} - -// Query returns a query builder for VulnStatusIndex. -func (c *VulnStatusIndexClient) Query() *VulnStatusIndexQuery { - return &VulnStatusIndexQuery{ - config: c.config, - } -} - -// Get returns a VulnStatusIndex entity by its id. -func (c *VulnStatusIndexClient) Get(ctx context.Context, id string) (*VulnStatusIndex, error) { - return c.Query().Where(vulnstatusindex.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *VulnStatusIndexClient) GetX(ctx context.Context, id string) *VulnStatusIndex { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryLatest queries the latest edge of a VulnStatusIndex. -func (c *VulnStatusIndexClient) QueryLatest(vsi *VulnStatusIndex) *VulnStatusQuery { - query := &VulnStatusQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := vsi.ID - step := sqlgraph.NewStep( - sqlgraph.From(vulnstatusindex.Table, vulnstatusindex.FieldID, id), - sqlgraph.To(vulnstatus.Table, vulnstatus.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, vulnstatusindex.LatestTable, vulnstatusindex.LatestColumn), - ) - fromV = sqlgraph.Neighbors(vsi.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// QueryStatus queries the status edge of a VulnStatusIndex. -func (c *VulnStatusIndexClient) QueryStatus(vsi *VulnStatusIndex) *VulnStatusQuery { - query := &VulnStatusQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := vsi.ID - step := sqlgraph.NewStep( - sqlgraph.From(vulnstatusindex.Table, vulnstatusindex.FieldID, id), - sqlgraph.To(vulnstatus.Table, vulnstatus.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, vulnstatusindex.StatusTable, vulnstatusindex.StatusColumn), - ) - fromV = sqlgraph.Neighbors(vsi.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *VulnStatusIndexClient) Hooks() []Hook { - return c.hooks.VulnStatusIndex -} - -// VulnerabilityClient is a client for the Vulnerability schema. -type VulnerabilityClient struct { - config -} - -// NewVulnerabilityClient returns a client for the Vulnerability from the given config. -func NewVulnerabilityClient(c config) *VulnerabilityClient { - return &VulnerabilityClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `vulnerability.Hooks(f(g(h())))`. -func (c *VulnerabilityClient) Use(hooks ...Hook) { - c.hooks.Vulnerability = append(c.hooks.Vulnerability, hooks...) -} - -// Create returns a create builder for Vulnerability. -func (c *VulnerabilityClient) Create() *VulnerabilityCreate { - mutation := newVulnerabilityMutation(c.config, OpCreate) - return &VulnerabilityCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of Vulnerability entities. -func (c *VulnerabilityClient) CreateBulk(builders ...*VulnerabilityCreate) *VulnerabilityCreateBulk { - return &VulnerabilityCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for Vulnerability. -func (c *VulnerabilityClient) Update() *VulnerabilityUpdate { - mutation := newVulnerabilityMutation(c.config, OpUpdate) - return &VulnerabilityUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *VulnerabilityClient) UpdateOne(v *Vulnerability) *VulnerabilityUpdateOne { - mutation := newVulnerabilityMutation(c.config, OpUpdateOne, withVulnerability(v)) - return &VulnerabilityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *VulnerabilityClient) UpdateOneID(id string) *VulnerabilityUpdateOne { - mutation := newVulnerabilityMutation(c.config, OpUpdateOne, withVulnerabilityID(id)) - return &VulnerabilityUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for Vulnerability. -func (c *VulnerabilityClient) Delete() *VulnerabilityDelete { - mutation := newVulnerabilityMutation(c.config, OpDelete) - return &VulnerabilityDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a delete builder for the given entity. -func (c *VulnerabilityClient) DeleteOne(v *Vulnerability) *VulnerabilityDeleteOne { - return c.DeleteOneID(v.ID) -} - -// DeleteOneID returns a delete builder for the given id. -func (c *VulnerabilityClient) DeleteOneID(id string) *VulnerabilityDeleteOne { - builder := c.Delete().Where(vulnerability.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &VulnerabilityDeleteOne{builder} -} - -// Query returns a query builder for Vulnerability. -func (c *VulnerabilityClient) Query() *VulnerabilityQuery { - return &VulnerabilityQuery{ - config: c.config, - } -} - -// Get returns a Vulnerability entity by its id. -func (c *VulnerabilityClient) Get(ctx context.Context, id string) (*Vulnerability, error) { - return c.Query().Where(vulnerability.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *VulnerabilityClient) GetX(ctx context.Context, id string) *Vulnerability { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// QueryPackages queries the packages edge of a Vulnerability. -func (c *VulnerabilityClient) QueryPackages(v *Vulnerability) *PackageRecordQuery { - query := &PackageRecordQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := v.ID - step := sqlgraph.NewStep( - sqlgraph.From(vulnerability.Table, vulnerability.FieldID, id), - sqlgraph.To(packagerecord.Table, packagerecord.FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, vulnerability.PackagesTable, vulnerability.PackagesPrimaryKey...), - ) - fromV = sqlgraph.Neighbors(v.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// QueryCustomSeverity queries the custom_severity edge of a Vulnerability. -func (c *VulnerabilityClient) QueryCustomSeverity(v *Vulnerability) *SeverityQuery { - query := &SeverityQuery{config: c.config} - query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { - id := v.ID - step := sqlgraph.NewStep( - sqlgraph.From(vulnerability.Table, vulnerability.FieldID, id), - sqlgraph.To(severity.Table, severity.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, vulnerability.CustomSeverityTable, vulnerability.CustomSeverityColumn), - ) - fromV = sqlgraph.Neighbors(v.driver.Dialect(), step) - return fromV, nil - } - return query -} - -// Hooks returns the client hooks. -func (c *VulnerabilityClient) Hooks() []Hook { - return c.hooks.Vulnerability -} diff --git a/pkg/infra/ent/config.go b/pkg/infra/ent/config.go deleted file mode 100644 index 1e853f3..0000000 --- a/pkg/infra/ent/config.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "entgo.io/ent" - "entgo.io/ent/dialect" -) - -// Option function to configure the client. -type Option func(*config) - -// Config is the configuration for the client and its builder. -type config struct { - // driver used for executing database requests. - driver dialect.Driver - // debug enable a debug logging. - debug bool - // log used for logging on debug mode. - log func(...interface{}) - // hooks to execute on mutations. - hooks *hooks -} - -// hooks per client, for fast access. -type hooks struct { - AuthStateCache []ent.Hook - PackageRecord []ent.Hook - RepoLabel []ent.Hook - Repository []ent.Hook - Scan []ent.Hook - Session []ent.Hook - Severity []ent.Hook - User []ent.Hook - VulnStatus []ent.Hook - VulnStatusIndex []ent.Hook - Vulnerability []ent.Hook -} - -// Options applies the options on the config object. -func (c *config) options(opts ...Option) { - for _, opt := range opts { - opt(c) - } - if c.debug { - c.driver = dialect.Debug(c.driver, c.log) - } -} - -// Debug enables debug logging on the ent.Driver. -func Debug() Option { - return func(c *config) { - c.debug = true - } -} - -// Log sets the logging function for debug mode. -func Log(fn func(...interface{})) Option { - return func(c *config) { - c.log = fn - } -} - -// Driver configures the client driver. -func Driver(driver dialect.Driver) Option { - return func(c *config) { - c.driver = driver - } -} diff --git a/pkg/infra/ent/context.go b/pkg/infra/ent/context.go deleted file mode 100644 index 0840726..0000000 --- a/pkg/infra/ent/context.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" -) - -type clientCtxKey struct{} - -// FromContext returns a Client stored inside a context, or nil if there isn't one. -func FromContext(ctx context.Context) *Client { - c, _ := ctx.Value(clientCtxKey{}).(*Client) - return c -} - -// NewContext returns a new context with the given Client attached. -func NewContext(parent context.Context, c *Client) context.Context { - return context.WithValue(parent, clientCtxKey{}, c) -} - -type txCtxKey struct{} - -// TxFromContext returns a Tx stored inside a context, or nil if there isn't one. -func TxFromContext(ctx context.Context) *Tx { - tx, _ := ctx.Value(txCtxKey{}).(*Tx) - return tx -} - -// NewTxContext returns a new context with the given Tx attached. -func NewTxContext(parent context.Context, tx *Tx) context.Context { - return context.WithValue(parent, txCtxKey{}, tx) -} diff --git a/pkg/infra/ent/ent.go b/pkg/infra/ent/ent.go deleted file mode 100644 index ac34995..0000000 --- a/pkg/infra/ent/ent.go +++ /dev/null @@ -1,279 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "errors" - "fmt" - - "entgo.io/ent" - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/authstatecache" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// ent aliases to avoid import conflicts in user's code. -type ( - Op = ent.Op - Hook = ent.Hook - Value = ent.Value - Query = ent.Query - Policy = ent.Policy - Mutator = ent.Mutator - Mutation = ent.Mutation - MutateFunc = ent.MutateFunc -) - -// OrderFunc applies an ordering on the sql selector. -type OrderFunc func(*sql.Selector) - -// columnChecker returns a function indicates if the column exists in the given column. -func columnChecker(table string) func(string) error { - checks := map[string]func(string) bool{ - authstatecache.Table: authstatecache.ValidColumn, - packagerecord.Table: packagerecord.ValidColumn, - repolabel.Table: repolabel.ValidColumn, - repository.Table: repository.ValidColumn, - scan.Table: scan.ValidColumn, - session.Table: session.ValidColumn, - severity.Table: severity.ValidColumn, - user.Table: user.ValidColumn, - vulnstatus.Table: vulnstatus.ValidColumn, - vulnstatusindex.Table: vulnstatusindex.ValidColumn, - vulnerability.Table: vulnerability.ValidColumn, - } - check, ok := checks[table] - if !ok { - return func(string) error { - return fmt.Errorf("unknown table %q", table) - } - } - return func(column string) error { - if !check(column) { - return fmt.Errorf("unknown column %q for table %q", column, table) - } - return nil - } -} - -// Asc applies the given fields in ASC order. -func Asc(fields ...string) OrderFunc { - return func(s *sql.Selector) { - check := columnChecker(s.TableName()) - for _, f := range fields { - if err := check(f); err != nil { - s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)}) - } - s.OrderBy(sql.Asc(s.C(f))) - } - } -} - -// Desc applies the given fields in DESC order. -func Desc(fields ...string) OrderFunc { - return func(s *sql.Selector) { - check := columnChecker(s.TableName()) - for _, f := range fields { - if err := check(f); err != nil { - s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)}) - } - s.OrderBy(sql.Desc(s.C(f))) - } - } -} - -// AggregateFunc applies an aggregation step on the group-by traversal/selector. -type AggregateFunc func(*sql.Selector) string - -// As is a pseudo aggregation function for renaming another other functions with custom names. For example: -// -// GroupBy(field1, field2). -// Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). -// Scan(ctx, &v) -// -func As(fn AggregateFunc, end string) AggregateFunc { - return func(s *sql.Selector) string { - return sql.As(fn(s), end) - } -} - -// Count applies the "count" aggregation function on each group. -func Count() AggregateFunc { - return func(s *sql.Selector) string { - return sql.Count("*") - } -} - -// Max applies the "max" aggregation function on the given field of each group. -func Max(field string) AggregateFunc { - return func(s *sql.Selector) string { - check := columnChecker(s.TableName()) - if err := check(field); err != nil { - s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)}) - return "" - } - return sql.Max(s.C(field)) - } -} - -// Mean applies the "mean" aggregation function on the given field of each group. -func Mean(field string) AggregateFunc { - return func(s *sql.Selector) string { - check := columnChecker(s.TableName()) - if err := check(field); err != nil { - s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)}) - return "" - } - return sql.Avg(s.C(field)) - } -} - -// Min applies the "min" aggregation function on the given field of each group. -func Min(field string) AggregateFunc { - return func(s *sql.Selector) string { - check := columnChecker(s.TableName()) - if err := check(field); err != nil { - s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)}) - return "" - } - return sql.Min(s.C(field)) - } -} - -// Sum applies the "sum" aggregation function on the given field of each group. -func Sum(field string) AggregateFunc { - return func(s *sql.Selector) string { - check := columnChecker(s.TableName()) - if err := check(field); err != nil { - s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)}) - return "" - } - return sql.Sum(s.C(field)) - } -} - -// ValidationError returns when validating a field fails. -type ValidationError struct { - Name string // Field or edge name. - err error -} - -// Error implements the error interface. -func (e *ValidationError) Error() string { - return e.err.Error() -} - -// Unwrap implements the errors.Wrapper interface. -func (e *ValidationError) Unwrap() error { - return e.err -} - -// IsValidationError returns a boolean indicating whether the error is a validation error. -func IsValidationError(err error) bool { - if err == nil { - return false - } - var e *ValidationError - return errors.As(err, &e) -} - -// NotFoundError returns when trying to fetch a specific entity and it was not found in the database. -type NotFoundError struct { - label string -} - -// Error implements the error interface. -func (e *NotFoundError) Error() string { - return "ent: " + e.label + " not found" -} - -// IsNotFound returns a boolean indicating whether the error is a not found error. -func IsNotFound(err error) bool { - if err == nil { - return false - } - var e *NotFoundError - return errors.As(err, &e) -} - -// MaskNotFound masks not found error. -func MaskNotFound(err error) error { - if IsNotFound(err) { - return nil - } - return err -} - -// NotSingularError returns when trying to fetch a singular entity and more then one was found in the database. -type NotSingularError struct { - label string -} - -// Error implements the error interface. -func (e *NotSingularError) Error() string { - return "ent: " + e.label + " not singular" -} - -// IsNotSingular returns a boolean indicating whether the error is a not singular error. -func IsNotSingular(err error) bool { - if err == nil { - return false - } - var e *NotSingularError - return errors.As(err, &e) -} - -// NotLoadedError returns when trying to get a node that was not loaded by the query. -type NotLoadedError struct { - edge string -} - -// Error implements the error interface. -func (e *NotLoadedError) Error() string { - return "ent: " + e.edge + " edge was not loaded" -} - -// IsNotLoaded returns a boolean indicating whether the error is a not loaded error. -func IsNotLoaded(err error) bool { - if err == nil { - return false - } - var e *NotLoadedError - return errors.As(err, &e) -} - -// ConstraintError returns when trying to create/update one or more entities and -// one or more of their constraints failed. For example, violation of edge or -// field uniqueness. -type ConstraintError struct { - msg string - wrap error -} - -// Error implements the error interface. -func (e ConstraintError) Error() string { - return "ent: constraint failed: " + e.msg -} - -// Unwrap implements the errors.Wrapper interface. -func (e *ConstraintError) Unwrap() error { - return e.wrap -} - -// IsConstraintError returns a boolean indicating whether the error is a constraint failure. -func IsConstraintError(err error) bool { - if err == nil { - return false - } - var e *ConstraintError - return errors.As(err, &e) -} diff --git a/pkg/infra/ent/enttest/enttest.go b/pkg/infra/ent/enttest/enttest.go deleted file mode 100644 index f5ea4ce..0000000 --- a/pkg/infra/ent/enttest/enttest.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package enttest - -import ( - "context" - - "github.com/m-mizutani/octovy/pkg/infra/ent" - // required by schema hooks. - _ "github.com/m-mizutani/octovy/pkg/infra/ent/runtime" - - "entgo.io/ent/dialect/sql/schema" -) - -type ( - // TestingT is the interface that is shared between - // testing.T and testing.B and used by enttest. - TestingT interface { - FailNow() - Error(...interface{}) - } - - // Option configures client creation. - Option func(*options) - - options struct { - opts []ent.Option - migrateOpts []schema.MigrateOption - } -) - -// WithOptions forwards options to client creation. -func WithOptions(opts ...ent.Option) Option { - return func(o *options) { - o.opts = append(o.opts, opts...) - } -} - -// WithMigrateOptions forwards options to auto migration. -func WithMigrateOptions(opts ...schema.MigrateOption) Option { - return func(o *options) { - o.migrateOpts = append(o.migrateOpts, opts...) - } -} - -func newOptions(opts []Option) *options { - o := &options{} - for _, opt := range opts { - opt(o) - } - return o -} - -// Open calls ent.Open and auto-run migration. -func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Client { - o := newOptions(opts) - c, err := ent.Open(driverName, dataSourceName, o.opts...) - if err != nil { - t.Error(err) - t.FailNow() - } - if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil { - t.Error(err) - t.FailNow() - } - return c -} - -// NewClient calls ent.NewClient and auto-run migration. -func NewClient(t TestingT, opts ...Option) *ent.Client { - o := newOptions(opts) - c := ent.NewClient(o.opts...) - if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil { - t.Error(err) - t.FailNow() - } - return c -} diff --git a/pkg/infra/ent/generate.go b/pkg/infra/ent/generate.go deleted file mode 100644 index 9f3a916..0000000 --- a/pkg/infra/ent/generate.go +++ /dev/null @@ -1,4 +0,0 @@ -package ent - -//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate ./schema - diff --git a/pkg/infra/ent/hook/hook.go b/pkg/infra/ent/hook/hook.go deleted file mode 100644 index 09d285b..0000000 --- a/pkg/infra/ent/hook/hook.go +++ /dev/null @@ -1,334 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package hook - -import ( - "context" - "fmt" - - "github.com/m-mizutani/octovy/pkg/infra/ent" -) - -// The AuthStateCacheFunc type is an adapter to allow the use of ordinary -// function as AuthStateCache mutator. -type AuthStateCacheFunc func(context.Context, *ent.AuthStateCacheMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f AuthStateCacheFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.AuthStateCacheMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AuthStateCacheMutation", m) - } - return f(ctx, mv) -} - -// The PackageRecordFunc type is an adapter to allow the use of ordinary -// function as PackageRecord mutator. -type PackageRecordFunc func(context.Context, *ent.PackageRecordMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f PackageRecordFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.PackageRecordMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PackageRecordMutation", m) - } - return f(ctx, mv) -} - -// The RepoLabelFunc type is an adapter to allow the use of ordinary -// function as RepoLabel mutator. -type RepoLabelFunc func(context.Context, *ent.RepoLabelMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f RepoLabelFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.RepoLabelMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.RepoLabelMutation", m) - } - return f(ctx, mv) -} - -// The RepositoryFunc type is an adapter to allow the use of ordinary -// function as Repository mutator. -type RepositoryFunc func(context.Context, *ent.RepositoryMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f RepositoryFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.RepositoryMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.RepositoryMutation", m) - } - return f(ctx, mv) -} - -// The ScanFunc type is an adapter to allow the use of ordinary -// function as Scan mutator. -type ScanFunc func(context.Context, *ent.ScanMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f ScanFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.ScanMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ScanMutation", m) - } - return f(ctx, mv) -} - -// The SessionFunc type is an adapter to allow the use of ordinary -// function as Session mutator. -type SessionFunc func(context.Context, *ent.SessionMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f SessionFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.SessionMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.SessionMutation", m) - } - return f(ctx, mv) -} - -// The SeverityFunc type is an adapter to allow the use of ordinary -// function as Severity mutator. -type SeverityFunc func(context.Context, *ent.SeverityMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f SeverityFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.SeverityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.SeverityMutation", m) - } - return f(ctx, mv) -} - -// The UserFunc type is an adapter to allow the use of ordinary -// function as User mutator. -type UserFunc func(context.Context, *ent.UserMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f UserFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.UserMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.UserMutation", m) - } - return f(ctx, mv) -} - -// The VulnStatusFunc type is an adapter to allow the use of ordinary -// function as VulnStatus mutator. -type VulnStatusFunc func(context.Context, *ent.VulnStatusMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f VulnStatusFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.VulnStatusMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.VulnStatusMutation", m) - } - return f(ctx, mv) -} - -// The VulnStatusIndexFunc type is an adapter to allow the use of ordinary -// function as VulnStatusIndex mutator. -type VulnStatusIndexFunc func(context.Context, *ent.VulnStatusIndexMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f VulnStatusIndexFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.VulnStatusIndexMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.VulnStatusIndexMutation", m) - } - return f(ctx, mv) -} - -// The VulnerabilityFunc type is an adapter to allow the use of ordinary -// function as Vulnerability mutator. -type VulnerabilityFunc func(context.Context, *ent.VulnerabilityMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f VulnerabilityFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - mv, ok := m.(*ent.VulnerabilityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.VulnerabilityMutation", m) - } - return f(ctx, mv) -} - -// Condition is a hook condition function. -type Condition func(context.Context, ent.Mutation) bool - -// And groups conditions with the AND operator. -func And(first, second Condition, rest ...Condition) Condition { - return func(ctx context.Context, m ent.Mutation) bool { - if !first(ctx, m) || !second(ctx, m) { - return false - } - for _, cond := range rest { - if !cond(ctx, m) { - return false - } - } - return true - } -} - -// Or groups conditions with the OR operator. -func Or(first, second Condition, rest ...Condition) Condition { - return func(ctx context.Context, m ent.Mutation) bool { - if first(ctx, m) || second(ctx, m) { - return true - } - for _, cond := range rest { - if cond(ctx, m) { - return true - } - } - return false - } -} - -// Not negates a given condition. -func Not(cond Condition) Condition { - return func(ctx context.Context, m ent.Mutation) bool { - return !cond(ctx, m) - } -} - -// HasOp is a condition testing mutation operation. -func HasOp(op ent.Op) Condition { - return func(_ context.Context, m ent.Mutation) bool { - return m.Op().Is(op) - } -} - -// HasAddedFields is a condition validating `.AddedField` on fields. -func HasAddedFields(field string, fields ...string) Condition { - return func(_ context.Context, m ent.Mutation) bool { - if _, exists := m.AddedField(field); !exists { - return false - } - for _, field := range fields { - if _, exists := m.AddedField(field); !exists { - return false - } - } - return true - } -} - -// HasClearedFields is a condition validating `.FieldCleared` on fields. -func HasClearedFields(field string, fields ...string) Condition { - return func(_ context.Context, m ent.Mutation) bool { - if exists := m.FieldCleared(field); !exists { - return false - } - for _, field := range fields { - if exists := m.FieldCleared(field); !exists { - return false - } - } - return true - } -} - -// HasFields is a condition validating `.Field` on fields. -func HasFields(field string, fields ...string) Condition { - return func(_ context.Context, m ent.Mutation) bool { - if _, exists := m.Field(field); !exists { - return false - } - for _, field := range fields { - if _, exists := m.Field(field); !exists { - return false - } - } - return true - } -} - -// If executes the given hook under condition. -// -// hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...))) -// -func If(hk ent.Hook, cond Condition) ent.Hook { - return func(next ent.Mutator) ent.Mutator { - return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { - if cond(ctx, m) { - return hk(next).Mutate(ctx, m) - } - return next.Mutate(ctx, m) - }) - } -} - -// On executes the given hook only for the given operation. -// -// hook.On(Log, ent.Delete|ent.Create) -// -func On(hk ent.Hook, op ent.Op) ent.Hook { - return If(hk, HasOp(op)) -} - -// Unless skips the given hook only for the given operation. -// -// hook.Unless(Log, ent.Update|ent.UpdateOne) -// -func Unless(hk ent.Hook, op ent.Op) ent.Hook { - return If(hk, Not(HasOp(op))) -} - -// FixedError is a hook returning a fixed error. -func FixedError(err error) ent.Hook { - return func(ent.Mutator) ent.Mutator { - return ent.MutateFunc(func(context.Context, ent.Mutation) (ent.Value, error) { - return nil, err - }) - } -} - -// Reject returns a hook that rejects all operations that match op. -// -// func (T) Hooks() []ent.Hook { -// return []ent.Hook{ -// Reject(ent.Delete|ent.Update), -// } -// } -// -func Reject(op ent.Op) ent.Hook { - hk := FixedError(fmt.Errorf("%s operation is not allowed", op)) - return On(hk, op) -} - -// Chain acts as a list of hooks and is effectively immutable. -// Once created, it will always hold the same set of hooks in the same order. -type Chain struct { - hooks []ent.Hook -} - -// NewChain creates a new chain of hooks. -func NewChain(hooks ...ent.Hook) Chain { - return Chain{append([]ent.Hook(nil), hooks...)} -} - -// Hook chains the list of hooks and returns the final hook. -func (c Chain) Hook() ent.Hook { - return func(mutator ent.Mutator) ent.Mutator { - for i := len(c.hooks) - 1; i >= 0; i-- { - mutator = c.hooks[i](mutator) - } - return mutator - } -} - -// Append extends a chain, adding the specified hook -// as the last ones in the mutation flow. -func (c Chain) Append(hooks ...ent.Hook) Chain { - newHooks := make([]ent.Hook, 0, len(c.hooks)+len(hooks)) - newHooks = append(newHooks, c.hooks...) - newHooks = append(newHooks, hooks...) - return Chain{newHooks} -} - -// Extend extends a chain, adding the specified chain -// as the last ones in the mutation flow. -func (c Chain) Extend(chain Chain) Chain { - return c.Append(chain.hooks...) -} diff --git a/pkg/infra/ent/migrate/migrate.go b/pkg/infra/ent/migrate/migrate.go deleted file mode 100644 index e4a9a22..0000000 --- a/pkg/infra/ent/migrate/migrate.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package migrate - -import ( - "context" - "fmt" - "io" - - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql/schema" -) - -var ( - // WithGlobalUniqueID sets the universal ids options to the migration. - // If this option is enabled, ent migration will allocate a 1<<32 range - // for the ids of each entity (table). - // Note that this option cannot be applied on tables that already exist. - WithGlobalUniqueID = schema.WithGlobalUniqueID - // WithDropColumn sets the drop column option to the migration. - // If this option is enabled, ent migration will drop old columns - // that were used for both fields and edges. This defaults to false. - WithDropColumn = schema.WithDropColumn - // WithDropIndex sets the drop index option to the migration. - // If this option is enabled, ent migration will drop old indexes - // that were defined in the schema. This defaults to false. - // Note that unique constraints are defined using `UNIQUE INDEX`, - // and therefore, it's recommended to enable this option to get more - // flexibility in the schema changes. - WithDropIndex = schema.WithDropIndex - // WithFixture sets the foreign-key renaming option to the migration when upgrading - // ent from v0.1.0 (issue-#285). Defaults to false. - WithFixture = schema.WithFixture - // WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true. - WithForeignKeys = schema.WithForeignKeys -) - -// Schema is the API for creating, migrating and dropping a schema. -type Schema struct { - drv dialect.Driver - universalID bool -} - -// NewSchema creates a new schema client. -func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} } - -// Create creates all schema resources. -func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error { - migrate, err := schema.NewMigrate(s.drv, opts...) - if err != nil { - return fmt.Errorf("ent/migrate: %w", err) - } - return migrate.Create(ctx, Tables...) -} - -// WriteTo writes the schema changes to w instead of running them against the database. -// -// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil { -// log.Fatal(err) -// } -// -func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error { - drv := &schema.WriteDriver{ - Writer: w, - Driver: s.drv, - } - migrate, err := schema.NewMigrate(drv, opts...) - if err != nil { - return fmt.Errorf("ent/migrate: %w", err) - } - return migrate.Create(ctx, Tables...) -} diff --git a/pkg/infra/ent/migrate/schema.go b/pkg/infra/ent/migrate/schema.go deleted file mode 100644 index 0ab3506..0000000 --- a/pkg/infra/ent/migrate/schema.go +++ /dev/null @@ -1,382 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package migrate - -import ( - "entgo.io/ent/dialect/sql/schema" - "entgo.io/ent/schema/field" -) - -var ( - // AuthStateCachesColumns holds the columns for the "auth_state_caches" table. - AuthStateCachesColumns = []*schema.Column{ - {Name: "id", Type: field.TypeString}, - {Name: "expires_at", Type: field.TypeInt64}, - } - // AuthStateCachesTable holds the schema information for the "auth_state_caches" table. - AuthStateCachesTable = &schema.Table{ - Name: "auth_state_caches", - Columns: AuthStateCachesColumns, - PrimaryKey: []*schema.Column{AuthStateCachesColumns[0]}, - } - // PackageRecordsColumns holds the columns for the "package_records" table. - PackageRecordsColumns = []*schema.Column{ - {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "type", Type: field.TypeString}, - {Name: "source", Type: field.TypeString}, - {Name: "name", Type: field.TypeString}, - {Name: "version", Type: field.TypeString}, - {Name: "vuln_ids", Type: field.TypeJSON}, - } - // PackageRecordsTable holds the schema information for the "package_records" table. - PackageRecordsTable = &schema.Table{ - Name: "package_records", - Columns: PackageRecordsColumns, - PrimaryKey: []*schema.Column{PackageRecordsColumns[0]}, - } - // RepoLabelsColumns holds the columns for the "repo_labels" table. - RepoLabelsColumns = []*schema.Column{ - {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "name", Type: field.TypeString, Unique: true}, - {Name: "description", Type: field.TypeString}, - {Name: "color", Type: field.TypeString}, - } - // RepoLabelsTable holds the schema information for the "repo_labels" table. - RepoLabelsTable = &schema.Table{ - Name: "repo_labels", - Columns: RepoLabelsColumns, - PrimaryKey: []*schema.Column{RepoLabelsColumns[0]}, - } - // RepositoriesColumns holds the columns for the "repositories" table. - RepositoriesColumns = []*schema.Column{ - {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "owner", Type: field.TypeString}, - {Name: "name", Type: field.TypeString}, - {Name: "install_id", Type: field.TypeInt64, Nullable: true}, - {Name: "url", Type: field.TypeString, Nullable: true}, - {Name: "avatar_url", Type: field.TypeString, Nullable: true}, - {Name: "default_branch", Type: field.TypeString, Nullable: true}, - {Name: "repository_latest", Type: field.TypeString, Nullable: true}, - } - // RepositoriesTable holds the schema information for the "repositories" table. - RepositoriesTable = &schema.Table{ - Name: "repositories", - Columns: RepositoriesColumns, - PrimaryKey: []*schema.Column{RepositoriesColumns[0]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "repositories_scans_latest", - Columns: []*schema.Column{RepositoriesColumns[7]}, - RefColumns: []*schema.Column{ScansColumns[0]}, - OnDelete: schema.SetNull, - }, - }, - } - // ScansColumns holds the columns for the "scans" table. - ScansColumns = []*schema.Column{ - {Name: "id", Type: field.TypeString, Unique: true}, - {Name: "branch", Type: field.TypeString}, - {Name: "commit_id", Type: field.TypeString}, - {Name: "requested_at", Type: field.TypeInt64}, - {Name: "scanned_at", Type: field.TypeInt64}, - {Name: "check_id", Type: field.TypeInt64, Nullable: true}, - {Name: "pull_request_target", Type: field.TypeString, Nullable: true}, - {Name: "repository_main", Type: field.TypeInt, Nullable: true}, - } - // ScansTable holds the schema information for the "scans" table. - ScansTable = &schema.Table{ - Name: "scans", - Columns: ScansColumns, - PrimaryKey: []*schema.Column{ScansColumns[0]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "scans_repositories_main", - Columns: []*schema.Column{ScansColumns[7]}, - RefColumns: []*schema.Column{RepositoriesColumns[0]}, - OnDelete: schema.SetNull, - }, - }, - } - // SessionsColumns holds the columns for the "sessions" table. - SessionsColumns = []*schema.Column{ - {Name: "id", Type: field.TypeString}, - {Name: "user_id", Type: field.TypeInt}, - {Name: "token", Type: field.TypeString}, - {Name: "created_at", Type: field.TypeInt64}, - {Name: "expires_at", Type: field.TypeInt64}, - {Name: "session_login", Type: field.TypeInt, Nullable: true}, - } - // SessionsTable holds the schema information for the "sessions" table. - SessionsTable = &schema.Table{ - Name: "sessions", - Columns: SessionsColumns, - PrimaryKey: []*schema.Column{SessionsColumns[0]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "sessions_users_login", - Columns: []*schema.Column{SessionsColumns[5]}, - RefColumns: []*schema.Column{UsersColumns[0]}, - OnDelete: schema.SetNull, - }, - }, - } - // SeveritiesColumns holds the columns for the "severities" table. - SeveritiesColumns = []*schema.Column{ - {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "label", Type: field.TypeString, Unique: true}, - {Name: "color", Type: field.TypeString, Nullable: true}, - } - // SeveritiesTable holds the schema information for the "severities" table. - SeveritiesTable = &schema.Table{ - Name: "severities", - Columns: SeveritiesColumns, - PrimaryKey: []*schema.Column{SeveritiesColumns[0]}, - } - // UsersColumns holds the columns for the "users" table. - UsersColumns = []*schema.Column{ - {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "github_id", Type: field.TypeInt64, Unique: true}, - {Name: "login", Type: field.TypeString}, - {Name: "name", Type: field.TypeString}, - {Name: "avatar_url", Type: field.TypeString}, - {Name: "url", Type: field.TypeString}, - } - // UsersTable holds the schema information for the "users" table. - UsersTable = &schema.Table{ - Name: "users", - Columns: UsersColumns, - PrimaryKey: []*schema.Column{UsersColumns[0]}, - } - // VulnStatusColumns holds the columns for the "vuln_status" table. - VulnStatusColumns = []*schema.Column{ - {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "status", Type: field.TypeEnum, Enums: []string{"none", "snoozed", "mitigated", "unaffected", "fixed"}}, - {Name: "source", Type: field.TypeString}, - {Name: "pkg_name", Type: field.TypeString}, - {Name: "pkg_type", Type: field.TypeString}, - {Name: "vuln_id", Type: field.TypeString}, - {Name: "expires_at", Type: field.TypeInt64}, - {Name: "created_at", Type: field.TypeInt64}, - {Name: "comment", Type: field.TypeString}, - {Name: "user_edited_status", Type: field.TypeInt, Nullable: true}, - {Name: "vuln_status_author", Type: field.TypeInt, Nullable: true}, - {Name: "vuln_status_index_status", Type: field.TypeString, Nullable: true}, - } - // VulnStatusTable holds the schema information for the "vuln_status" table. - VulnStatusTable = &schema.Table{ - Name: "vuln_status", - Columns: VulnStatusColumns, - PrimaryKey: []*schema.Column{VulnStatusColumns[0]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "vuln_status_users_edited_status", - Columns: []*schema.Column{VulnStatusColumns[9]}, - RefColumns: []*schema.Column{UsersColumns[0]}, - OnDelete: schema.SetNull, - }, - { - Symbol: "vuln_status_users_author", - Columns: []*schema.Column{VulnStatusColumns[10]}, - RefColumns: []*schema.Column{UsersColumns[0]}, - OnDelete: schema.SetNull, - }, - { - Symbol: "vuln_status_vuln_status_indexes_status", - Columns: []*schema.Column{VulnStatusColumns[11]}, - RefColumns: []*schema.Column{VulnStatusIndexesColumns[0]}, - OnDelete: schema.SetNull, - }, - }, - } - // VulnStatusIndexesColumns holds the columns for the "vuln_status_indexes" table. - VulnStatusIndexesColumns = []*schema.Column{ - {Name: "id", Type: field.TypeString, Unique: true}, - {Name: "repository_status", Type: field.TypeInt, Nullable: true}, - {Name: "vuln_status_index_latest", Type: field.TypeInt, Nullable: true}, - } - // VulnStatusIndexesTable holds the schema information for the "vuln_status_indexes" table. - VulnStatusIndexesTable = &schema.Table{ - Name: "vuln_status_indexes", - Columns: VulnStatusIndexesColumns, - PrimaryKey: []*schema.Column{VulnStatusIndexesColumns[0]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "vuln_status_indexes_repositories_status", - Columns: []*schema.Column{VulnStatusIndexesColumns[1]}, - RefColumns: []*schema.Column{RepositoriesColumns[0]}, - OnDelete: schema.SetNull, - }, - { - Symbol: "vuln_status_indexes_vuln_status_latest", - Columns: []*schema.Column{VulnStatusIndexesColumns[2]}, - RefColumns: []*schema.Column{VulnStatusColumns[0]}, - OnDelete: schema.SetNull, - }, - }, - } - // VulnerabilitiesColumns holds the columns for the "vulnerabilities" table. - VulnerabilitiesColumns = []*schema.Column{ - {Name: "id", Type: field.TypeString, Unique: true}, - {Name: "first_seen_at", Type: field.TypeInt64}, - {Name: "last_modified_at", Type: field.TypeInt64}, - {Name: "title", Type: field.TypeString, Nullable: true}, - {Name: "description", Type: field.TypeString, Nullable: true}, - {Name: "cwe_id", Type: field.TypeJSON, Nullable: true}, - {Name: "severity", Type: field.TypeString, Nullable: true}, - {Name: "cvss", Type: field.TypeJSON, Nullable: true}, - {Name: "references", Type: field.TypeJSON, Nullable: true}, - {Name: "vulnerability_custom_severity", Type: field.TypeInt, Nullable: true}, - } - // VulnerabilitiesTable holds the schema information for the "vulnerabilities" table. - VulnerabilitiesTable = &schema.Table{ - Name: "vulnerabilities", - Columns: VulnerabilitiesColumns, - PrimaryKey: []*schema.Column{VulnerabilitiesColumns[0]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "vulnerabilities_severities_custom_severity", - Columns: []*schema.Column{VulnerabilitiesColumns[9]}, - RefColumns: []*schema.Column{SeveritiesColumns[0]}, - OnDelete: schema.SetNull, - }, - }, - } - // PackageRecordVulnerabilitiesColumns holds the columns for the "package_record_vulnerabilities" table. - PackageRecordVulnerabilitiesColumns = []*schema.Column{ - {Name: "package_record_id", Type: field.TypeInt}, - {Name: "vulnerability_id", Type: field.TypeString}, - } - // PackageRecordVulnerabilitiesTable holds the schema information for the "package_record_vulnerabilities" table. - PackageRecordVulnerabilitiesTable = &schema.Table{ - Name: "package_record_vulnerabilities", - Columns: PackageRecordVulnerabilitiesColumns, - PrimaryKey: []*schema.Column{PackageRecordVulnerabilitiesColumns[0], PackageRecordVulnerabilitiesColumns[1]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "package_record_vulnerabilities_package_record_id", - Columns: []*schema.Column{PackageRecordVulnerabilitiesColumns[0]}, - RefColumns: []*schema.Column{PackageRecordsColumns[0]}, - OnDelete: schema.Cascade, - }, - { - Symbol: "package_record_vulnerabilities_vulnerability_id", - Columns: []*schema.Column{PackageRecordVulnerabilitiesColumns[1]}, - RefColumns: []*schema.Column{VulnerabilitiesColumns[0]}, - OnDelete: schema.Cascade, - }, - }, - } - // RepositoryScanColumns holds the columns for the "repository_scan" table. - RepositoryScanColumns = []*schema.Column{ - {Name: "repository_id", Type: field.TypeInt}, - {Name: "scan_id", Type: field.TypeString}, - } - // RepositoryScanTable holds the schema information for the "repository_scan" table. - RepositoryScanTable = &schema.Table{ - Name: "repository_scan", - Columns: RepositoryScanColumns, - PrimaryKey: []*schema.Column{RepositoryScanColumns[0], RepositoryScanColumns[1]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "repository_scan_repository_id", - Columns: []*schema.Column{RepositoryScanColumns[0]}, - RefColumns: []*schema.Column{RepositoriesColumns[0]}, - OnDelete: schema.Cascade, - }, - { - Symbol: "repository_scan_scan_id", - Columns: []*schema.Column{RepositoryScanColumns[1]}, - RefColumns: []*schema.Column{ScansColumns[0]}, - OnDelete: schema.Cascade, - }, - }, - } - // RepositoryLabelsColumns holds the columns for the "repository_labels" table. - RepositoryLabelsColumns = []*schema.Column{ - {Name: "repository_id", Type: field.TypeInt}, - {Name: "repo_label_id", Type: field.TypeInt}, - } - // RepositoryLabelsTable holds the schema information for the "repository_labels" table. - RepositoryLabelsTable = &schema.Table{ - Name: "repository_labels", - Columns: RepositoryLabelsColumns, - PrimaryKey: []*schema.Column{RepositoryLabelsColumns[0], RepositoryLabelsColumns[1]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "repository_labels_repository_id", - Columns: []*schema.Column{RepositoryLabelsColumns[0]}, - RefColumns: []*schema.Column{RepositoriesColumns[0]}, - OnDelete: schema.Cascade, - }, - { - Symbol: "repository_labels_repo_label_id", - Columns: []*schema.Column{RepositoryLabelsColumns[1]}, - RefColumns: []*schema.Column{RepoLabelsColumns[0]}, - OnDelete: schema.Cascade, - }, - }, - } - // ScanPackagesColumns holds the columns for the "scan_packages" table. - ScanPackagesColumns = []*schema.Column{ - {Name: "scan_id", Type: field.TypeString}, - {Name: "package_record_id", Type: field.TypeInt}, - } - // ScanPackagesTable holds the schema information for the "scan_packages" table. - ScanPackagesTable = &schema.Table{ - Name: "scan_packages", - Columns: ScanPackagesColumns, - PrimaryKey: []*schema.Column{ScanPackagesColumns[0], ScanPackagesColumns[1]}, - ForeignKeys: []*schema.ForeignKey{ - { - Symbol: "scan_packages_scan_id", - Columns: []*schema.Column{ScanPackagesColumns[0]}, - RefColumns: []*schema.Column{ScansColumns[0]}, - OnDelete: schema.Cascade, - }, - { - Symbol: "scan_packages_package_record_id", - Columns: []*schema.Column{ScanPackagesColumns[1]}, - RefColumns: []*schema.Column{PackageRecordsColumns[0]}, - OnDelete: schema.Cascade, - }, - }, - } - // Tables holds all the tables in the schema. - Tables = []*schema.Table{ - AuthStateCachesTable, - PackageRecordsTable, - RepoLabelsTable, - RepositoriesTable, - ScansTable, - SessionsTable, - SeveritiesTable, - UsersTable, - VulnStatusTable, - VulnStatusIndexesTable, - VulnerabilitiesTable, - PackageRecordVulnerabilitiesTable, - RepositoryScanTable, - RepositoryLabelsTable, - ScanPackagesTable, - } -) - -func init() { - RepositoriesTable.ForeignKeys[0].RefTable = ScansTable - ScansTable.ForeignKeys[0].RefTable = RepositoriesTable - SessionsTable.ForeignKeys[0].RefTable = UsersTable - VulnStatusTable.ForeignKeys[0].RefTable = UsersTable - VulnStatusTable.ForeignKeys[1].RefTable = UsersTable - VulnStatusTable.ForeignKeys[2].RefTable = VulnStatusIndexesTable - VulnStatusIndexesTable.ForeignKeys[0].RefTable = RepositoriesTable - VulnStatusIndexesTable.ForeignKeys[1].RefTable = VulnStatusTable - VulnerabilitiesTable.ForeignKeys[0].RefTable = SeveritiesTable - PackageRecordVulnerabilitiesTable.ForeignKeys[0].RefTable = PackageRecordsTable - PackageRecordVulnerabilitiesTable.ForeignKeys[1].RefTable = VulnerabilitiesTable - RepositoryScanTable.ForeignKeys[0].RefTable = RepositoriesTable - RepositoryScanTable.ForeignKeys[1].RefTable = ScansTable - RepositoryLabelsTable.ForeignKeys[0].RefTable = RepositoriesTable - RepositoryLabelsTable.ForeignKeys[1].RefTable = RepoLabelsTable - ScanPackagesTable.ForeignKeys[0].RefTable = ScansTable - ScanPackagesTable.ForeignKeys[1].RefTable = PackageRecordsTable -} diff --git a/pkg/infra/ent/mutation.go b/pkg/infra/ent/mutation.go deleted file mode 100644 index 24536b6..0000000 --- a/pkg/infra/ent/mutation.go +++ /dev/null @@ -1,7464 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - "sync" - - "github.com/m-mizutani/octovy/pkg/domain/types" - "github.com/m-mizutani/octovy/pkg/infra/ent/authstatecache" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" - - "entgo.io/ent" -) - -const ( - // Operation types. - OpCreate = ent.OpCreate - OpDelete = ent.OpDelete - OpDeleteOne = ent.OpDeleteOne - OpUpdate = ent.OpUpdate - OpUpdateOne = ent.OpUpdateOne - - // Node types. - TypeAuthStateCache = "AuthStateCache" - TypePackageRecord = "PackageRecord" - TypeRepoLabel = "RepoLabel" - TypeRepository = "Repository" - TypeScan = "Scan" - TypeSession = "Session" - TypeSeverity = "Severity" - TypeUser = "User" - TypeVulnStatus = "VulnStatus" - TypeVulnStatusIndex = "VulnStatusIndex" - TypeVulnerability = "Vulnerability" -) - -// AuthStateCacheMutation represents an operation that mutates the AuthStateCache nodes in the graph. -type AuthStateCacheMutation struct { - config - op Op - typ string - id *string - expires_at *int64 - addexpires_at *int64 - clearedFields map[string]struct{} - done bool - oldValue func(context.Context) (*AuthStateCache, error) - predicates []predicate.AuthStateCache -} - -var _ ent.Mutation = (*AuthStateCacheMutation)(nil) - -// authstatecacheOption allows management of the mutation configuration using functional options. -type authstatecacheOption func(*AuthStateCacheMutation) - -// newAuthStateCacheMutation creates new mutation for the AuthStateCache entity. -func newAuthStateCacheMutation(c config, op Op, opts ...authstatecacheOption) *AuthStateCacheMutation { - m := &AuthStateCacheMutation{ - config: c, - op: op, - typ: TypeAuthStateCache, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withAuthStateCacheID sets the ID field of the mutation. -func withAuthStateCacheID(id string) authstatecacheOption { - return func(m *AuthStateCacheMutation) { - var ( - err error - once sync.Once - value *AuthStateCache - ) - m.oldValue = func(ctx context.Context) (*AuthStateCache, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().AuthStateCache.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withAuthStateCache sets the old AuthStateCache of the mutation. -func withAuthStateCache(node *AuthStateCache) authstatecacheOption { - return func(m *AuthStateCacheMutation) { - m.oldValue = func(context.Context) (*AuthStateCache, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m AuthStateCacheMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m AuthStateCacheMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// SetID sets the value of the id field. Note that this -// operation is only accepted on creation of AuthStateCache entities. -func (m *AuthStateCacheMutation) SetID(id string) { - m.id = &id -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *AuthStateCacheMutation) ID() (id string, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetExpiresAt sets the "expires_at" field. -func (m *AuthStateCacheMutation) SetExpiresAt(i int64) { - m.expires_at = &i - m.addexpires_at = nil -} - -// ExpiresAt returns the value of the "expires_at" field in the mutation. -func (m *AuthStateCacheMutation) ExpiresAt() (r int64, exists bool) { - v := m.expires_at - if v == nil { - return - } - return *v, true -} - -// OldExpiresAt returns the old "expires_at" field's value of the AuthStateCache entity. -// If the AuthStateCache object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *AuthStateCacheMutation) OldExpiresAt(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldExpiresAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldExpiresAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldExpiresAt: %w", err) - } - return oldValue.ExpiresAt, nil -} - -// AddExpiresAt adds i to the "expires_at" field. -func (m *AuthStateCacheMutation) AddExpiresAt(i int64) { - if m.addexpires_at != nil { - *m.addexpires_at += i - } else { - m.addexpires_at = &i - } -} - -// AddedExpiresAt returns the value that was added to the "expires_at" field in this mutation. -func (m *AuthStateCacheMutation) AddedExpiresAt() (r int64, exists bool) { - v := m.addexpires_at - if v == nil { - return - } - return *v, true -} - -// ResetExpiresAt resets all changes to the "expires_at" field. -func (m *AuthStateCacheMutation) ResetExpiresAt() { - m.expires_at = nil - m.addexpires_at = nil -} - -// Where appends a list predicates to the AuthStateCacheMutation builder. -func (m *AuthStateCacheMutation) Where(ps ...predicate.AuthStateCache) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *AuthStateCacheMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (AuthStateCache). -func (m *AuthStateCacheMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *AuthStateCacheMutation) Fields() []string { - fields := make([]string, 0, 1) - if m.expires_at != nil { - fields = append(fields, authstatecache.FieldExpiresAt) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *AuthStateCacheMutation) Field(name string) (ent.Value, bool) { - switch name { - case authstatecache.FieldExpiresAt: - return m.ExpiresAt() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *AuthStateCacheMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case authstatecache.FieldExpiresAt: - return m.OldExpiresAt(ctx) - } - return nil, fmt.Errorf("unknown AuthStateCache field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *AuthStateCacheMutation) SetField(name string, value ent.Value) error { - switch name { - case authstatecache.FieldExpiresAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetExpiresAt(v) - return nil - } - return fmt.Errorf("unknown AuthStateCache field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *AuthStateCacheMutation) AddedFields() []string { - var fields []string - if m.addexpires_at != nil { - fields = append(fields, authstatecache.FieldExpiresAt) - } - return fields -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *AuthStateCacheMutation) AddedField(name string) (ent.Value, bool) { - switch name { - case authstatecache.FieldExpiresAt: - return m.AddedExpiresAt() - } - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *AuthStateCacheMutation) AddField(name string, value ent.Value) error { - switch name { - case authstatecache.FieldExpiresAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddExpiresAt(v) - return nil - } - return fmt.Errorf("unknown AuthStateCache numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *AuthStateCacheMutation) ClearedFields() []string { - return nil -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *AuthStateCacheMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *AuthStateCacheMutation) ClearField(name string) error { - return fmt.Errorf("unknown AuthStateCache nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *AuthStateCacheMutation) ResetField(name string) error { - switch name { - case authstatecache.FieldExpiresAt: - m.ResetExpiresAt() - return nil - } - return fmt.Errorf("unknown AuthStateCache field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *AuthStateCacheMutation) AddedEdges() []string { - edges := make([]string, 0, 0) - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *AuthStateCacheMutation) AddedIDs(name string) []ent.Value { - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *AuthStateCacheMutation) RemovedEdges() []string { - edges := make([]string, 0, 0) - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *AuthStateCacheMutation) RemovedIDs(name string) []ent.Value { - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *AuthStateCacheMutation) ClearedEdges() []string { - edges := make([]string, 0, 0) - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *AuthStateCacheMutation) EdgeCleared(name string) bool { - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *AuthStateCacheMutation) ClearEdge(name string) error { - return fmt.Errorf("unknown AuthStateCache unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *AuthStateCacheMutation) ResetEdge(name string) error { - return fmt.Errorf("unknown AuthStateCache edge %s", name) -} - -// PackageRecordMutation represents an operation that mutates the PackageRecord nodes in the graph. -type PackageRecordMutation struct { - config - op Op - typ string - id *int - _type *string - source *string - name *string - version *string - vuln_ids *[]string - clearedFields map[string]struct{} - scan map[string]struct{} - removedscan map[string]struct{} - clearedscan bool - vulnerabilities map[string]struct{} - removedvulnerabilities map[string]struct{} - clearedvulnerabilities bool - done bool - oldValue func(context.Context) (*PackageRecord, error) - predicates []predicate.PackageRecord -} - -var _ ent.Mutation = (*PackageRecordMutation)(nil) - -// packagerecordOption allows management of the mutation configuration using functional options. -type packagerecordOption func(*PackageRecordMutation) - -// newPackageRecordMutation creates new mutation for the PackageRecord entity. -func newPackageRecordMutation(c config, op Op, opts ...packagerecordOption) *PackageRecordMutation { - m := &PackageRecordMutation{ - config: c, - op: op, - typ: TypePackageRecord, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withPackageRecordID sets the ID field of the mutation. -func withPackageRecordID(id int) packagerecordOption { - return func(m *PackageRecordMutation) { - var ( - err error - once sync.Once - value *PackageRecord - ) - m.oldValue = func(ctx context.Context) (*PackageRecord, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().PackageRecord.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withPackageRecord sets the old PackageRecord of the mutation. -func withPackageRecord(node *PackageRecord) packagerecordOption { - return func(m *PackageRecordMutation) { - m.oldValue = func(context.Context) (*PackageRecord, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m PackageRecordMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m PackageRecordMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *PackageRecordMutation) ID() (id int, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetType sets the "type" field. -func (m *PackageRecordMutation) SetType(s string) { - m._type = &s -} - -// GetType returns the value of the "type" field in the mutation. -func (m *PackageRecordMutation) GetType() (r string, exists bool) { - v := m._type - if v == nil { - return - } - return *v, true -} - -// OldType returns the old "type" field's value of the PackageRecord entity. -// If the PackageRecord object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *PackageRecordMutation) OldType(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldType is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldType requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldType: %w", err) - } - return oldValue.Type, nil -} - -// ResetType resets all changes to the "type" field. -func (m *PackageRecordMutation) ResetType() { - m._type = nil -} - -// SetSource sets the "source" field. -func (m *PackageRecordMutation) SetSource(s string) { - m.source = &s -} - -// Source returns the value of the "source" field in the mutation. -func (m *PackageRecordMutation) Source() (r string, exists bool) { - v := m.source - if v == nil { - return - } - return *v, true -} - -// OldSource returns the old "source" field's value of the PackageRecord entity. -// If the PackageRecord object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *PackageRecordMutation) OldSource(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldSource is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldSource requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSource: %w", err) - } - return oldValue.Source, nil -} - -// ResetSource resets all changes to the "source" field. -func (m *PackageRecordMutation) ResetSource() { - m.source = nil -} - -// SetName sets the "name" field. -func (m *PackageRecordMutation) SetName(s string) { - m.name = &s -} - -// Name returns the value of the "name" field in the mutation. -func (m *PackageRecordMutation) Name() (r string, exists bool) { - v := m.name - if v == nil { - return - } - return *v, true -} - -// OldName returns the old "name" field's value of the PackageRecord entity. -// If the PackageRecord object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *PackageRecordMutation) OldName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldName: %w", err) - } - return oldValue.Name, nil -} - -// ResetName resets all changes to the "name" field. -func (m *PackageRecordMutation) ResetName() { - m.name = nil -} - -// SetVersion sets the "version" field. -func (m *PackageRecordMutation) SetVersion(s string) { - m.version = &s -} - -// Version returns the value of the "version" field in the mutation. -func (m *PackageRecordMutation) Version() (r string, exists bool) { - v := m.version - if v == nil { - return - } - return *v, true -} - -// OldVersion returns the old "version" field's value of the PackageRecord entity. -// If the PackageRecord object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *PackageRecordMutation) OldVersion(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldVersion is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldVersion requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldVersion: %w", err) - } - return oldValue.Version, nil -} - -// ResetVersion resets all changes to the "version" field. -func (m *PackageRecordMutation) ResetVersion() { - m.version = nil -} - -// SetVulnIds sets the "vuln_ids" field. -func (m *PackageRecordMutation) SetVulnIds(s []string) { - m.vuln_ids = &s -} - -// VulnIds returns the value of the "vuln_ids" field in the mutation. -func (m *PackageRecordMutation) VulnIds() (r []string, exists bool) { - v := m.vuln_ids - if v == nil { - return - } - return *v, true -} - -// OldVulnIds returns the old "vuln_ids" field's value of the PackageRecord entity. -// If the PackageRecord object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *PackageRecordMutation) OldVulnIds(ctx context.Context) (v []string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldVulnIds is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldVulnIds requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldVulnIds: %w", err) - } - return oldValue.VulnIds, nil -} - -// ResetVulnIds resets all changes to the "vuln_ids" field. -func (m *PackageRecordMutation) ResetVulnIds() { - m.vuln_ids = nil -} - -// AddScanIDs adds the "scan" edge to the Scan entity by ids. -func (m *PackageRecordMutation) AddScanIDs(ids ...string) { - if m.scan == nil { - m.scan = make(map[string]struct{}) - } - for i := range ids { - m.scan[ids[i]] = struct{}{} - } -} - -// ClearScan clears the "scan" edge to the Scan entity. -func (m *PackageRecordMutation) ClearScan() { - m.clearedscan = true -} - -// ScanCleared reports if the "scan" edge to the Scan entity was cleared. -func (m *PackageRecordMutation) ScanCleared() bool { - return m.clearedscan -} - -// RemoveScanIDs removes the "scan" edge to the Scan entity by IDs. -func (m *PackageRecordMutation) RemoveScanIDs(ids ...string) { - if m.removedscan == nil { - m.removedscan = make(map[string]struct{}) - } - for i := range ids { - delete(m.scan, ids[i]) - m.removedscan[ids[i]] = struct{}{} - } -} - -// RemovedScan returns the removed IDs of the "scan" edge to the Scan entity. -func (m *PackageRecordMutation) RemovedScanIDs() (ids []string) { - for id := range m.removedscan { - ids = append(ids, id) - } - return -} - -// ScanIDs returns the "scan" edge IDs in the mutation. -func (m *PackageRecordMutation) ScanIDs() (ids []string) { - for id := range m.scan { - ids = append(ids, id) - } - return -} - -// ResetScan resets all changes to the "scan" edge. -func (m *PackageRecordMutation) ResetScan() { - m.scan = nil - m.clearedscan = false - m.removedscan = nil -} - -// AddVulnerabilityIDs adds the "vulnerabilities" edge to the Vulnerability entity by ids. -func (m *PackageRecordMutation) AddVulnerabilityIDs(ids ...string) { - if m.vulnerabilities == nil { - m.vulnerabilities = make(map[string]struct{}) - } - for i := range ids { - m.vulnerabilities[ids[i]] = struct{}{} - } -} - -// ClearVulnerabilities clears the "vulnerabilities" edge to the Vulnerability entity. -func (m *PackageRecordMutation) ClearVulnerabilities() { - m.clearedvulnerabilities = true -} - -// VulnerabilitiesCleared reports if the "vulnerabilities" edge to the Vulnerability entity was cleared. -func (m *PackageRecordMutation) VulnerabilitiesCleared() bool { - return m.clearedvulnerabilities -} - -// RemoveVulnerabilityIDs removes the "vulnerabilities" edge to the Vulnerability entity by IDs. -func (m *PackageRecordMutation) RemoveVulnerabilityIDs(ids ...string) { - if m.removedvulnerabilities == nil { - m.removedvulnerabilities = make(map[string]struct{}) - } - for i := range ids { - delete(m.vulnerabilities, ids[i]) - m.removedvulnerabilities[ids[i]] = struct{}{} - } -} - -// RemovedVulnerabilities returns the removed IDs of the "vulnerabilities" edge to the Vulnerability entity. -func (m *PackageRecordMutation) RemovedVulnerabilitiesIDs() (ids []string) { - for id := range m.removedvulnerabilities { - ids = append(ids, id) - } - return -} - -// VulnerabilitiesIDs returns the "vulnerabilities" edge IDs in the mutation. -func (m *PackageRecordMutation) VulnerabilitiesIDs() (ids []string) { - for id := range m.vulnerabilities { - ids = append(ids, id) - } - return -} - -// ResetVulnerabilities resets all changes to the "vulnerabilities" edge. -func (m *PackageRecordMutation) ResetVulnerabilities() { - m.vulnerabilities = nil - m.clearedvulnerabilities = false - m.removedvulnerabilities = nil -} - -// Where appends a list predicates to the PackageRecordMutation builder. -func (m *PackageRecordMutation) Where(ps ...predicate.PackageRecord) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *PackageRecordMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (PackageRecord). -func (m *PackageRecordMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *PackageRecordMutation) Fields() []string { - fields := make([]string, 0, 5) - if m._type != nil { - fields = append(fields, packagerecord.FieldType) - } - if m.source != nil { - fields = append(fields, packagerecord.FieldSource) - } - if m.name != nil { - fields = append(fields, packagerecord.FieldName) - } - if m.version != nil { - fields = append(fields, packagerecord.FieldVersion) - } - if m.vuln_ids != nil { - fields = append(fields, packagerecord.FieldVulnIds) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *PackageRecordMutation) Field(name string) (ent.Value, bool) { - switch name { - case packagerecord.FieldType: - return m.GetType() - case packagerecord.FieldSource: - return m.Source() - case packagerecord.FieldName: - return m.Name() - case packagerecord.FieldVersion: - return m.Version() - case packagerecord.FieldVulnIds: - return m.VulnIds() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *PackageRecordMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case packagerecord.FieldType: - return m.OldType(ctx) - case packagerecord.FieldSource: - return m.OldSource(ctx) - case packagerecord.FieldName: - return m.OldName(ctx) - case packagerecord.FieldVersion: - return m.OldVersion(ctx) - case packagerecord.FieldVulnIds: - return m.OldVulnIds(ctx) - } - return nil, fmt.Errorf("unknown PackageRecord field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *PackageRecordMutation) SetField(name string, value ent.Value) error { - switch name { - case packagerecord.FieldType: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetType(v) - return nil - case packagerecord.FieldSource: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSource(v) - return nil - case packagerecord.FieldName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetName(v) - return nil - case packagerecord.FieldVersion: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetVersion(v) - return nil - case packagerecord.FieldVulnIds: - v, ok := value.([]string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetVulnIds(v) - return nil - } - return fmt.Errorf("unknown PackageRecord field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *PackageRecordMutation) AddedFields() []string { - return nil -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *PackageRecordMutation) AddedField(name string) (ent.Value, bool) { - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *PackageRecordMutation) AddField(name string, value ent.Value) error { - switch name { - } - return fmt.Errorf("unknown PackageRecord numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *PackageRecordMutation) ClearedFields() []string { - return nil -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *PackageRecordMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *PackageRecordMutation) ClearField(name string) error { - return fmt.Errorf("unknown PackageRecord nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *PackageRecordMutation) ResetField(name string) error { - switch name { - case packagerecord.FieldType: - m.ResetType() - return nil - case packagerecord.FieldSource: - m.ResetSource() - return nil - case packagerecord.FieldName: - m.ResetName() - return nil - case packagerecord.FieldVersion: - m.ResetVersion() - return nil - case packagerecord.FieldVulnIds: - m.ResetVulnIds() - return nil - } - return fmt.Errorf("unknown PackageRecord field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *PackageRecordMutation) AddedEdges() []string { - edges := make([]string, 0, 2) - if m.scan != nil { - edges = append(edges, packagerecord.EdgeScan) - } - if m.vulnerabilities != nil { - edges = append(edges, packagerecord.EdgeVulnerabilities) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *PackageRecordMutation) AddedIDs(name string) []ent.Value { - switch name { - case packagerecord.EdgeScan: - ids := make([]ent.Value, 0, len(m.scan)) - for id := range m.scan { - ids = append(ids, id) - } - return ids - case packagerecord.EdgeVulnerabilities: - ids := make([]ent.Value, 0, len(m.vulnerabilities)) - for id := range m.vulnerabilities { - ids = append(ids, id) - } - return ids - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *PackageRecordMutation) RemovedEdges() []string { - edges := make([]string, 0, 2) - if m.removedscan != nil { - edges = append(edges, packagerecord.EdgeScan) - } - if m.removedvulnerabilities != nil { - edges = append(edges, packagerecord.EdgeVulnerabilities) - } - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *PackageRecordMutation) RemovedIDs(name string) []ent.Value { - switch name { - case packagerecord.EdgeScan: - ids := make([]ent.Value, 0, len(m.removedscan)) - for id := range m.removedscan { - ids = append(ids, id) - } - return ids - case packagerecord.EdgeVulnerabilities: - ids := make([]ent.Value, 0, len(m.removedvulnerabilities)) - for id := range m.removedvulnerabilities { - ids = append(ids, id) - } - return ids - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *PackageRecordMutation) ClearedEdges() []string { - edges := make([]string, 0, 2) - if m.clearedscan { - edges = append(edges, packagerecord.EdgeScan) - } - if m.clearedvulnerabilities { - edges = append(edges, packagerecord.EdgeVulnerabilities) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *PackageRecordMutation) EdgeCleared(name string) bool { - switch name { - case packagerecord.EdgeScan: - return m.clearedscan - case packagerecord.EdgeVulnerabilities: - return m.clearedvulnerabilities - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *PackageRecordMutation) ClearEdge(name string) error { - switch name { - } - return fmt.Errorf("unknown PackageRecord unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *PackageRecordMutation) ResetEdge(name string) error { - switch name { - case packagerecord.EdgeScan: - m.ResetScan() - return nil - case packagerecord.EdgeVulnerabilities: - m.ResetVulnerabilities() - return nil - } - return fmt.Errorf("unknown PackageRecord edge %s", name) -} - -// RepoLabelMutation represents an operation that mutates the RepoLabel nodes in the graph. -type RepoLabelMutation struct { - config - op Op - typ string - id *int - name *string - description *string - color *string - clearedFields map[string]struct{} - repos map[int]struct{} - removedrepos map[int]struct{} - clearedrepos bool - done bool - oldValue func(context.Context) (*RepoLabel, error) - predicates []predicate.RepoLabel -} - -var _ ent.Mutation = (*RepoLabelMutation)(nil) - -// repolabelOption allows management of the mutation configuration using functional options. -type repolabelOption func(*RepoLabelMutation) - -// newRepoLabelMutation creates new mutation for the RepoLabel entity. -func newRepoLabelMutation(c config, op Op, opts ...repolabelOption) *RepoLabelMutation { - m := &RepoLabelMutation{ - config: c, - op: op, - typ: TypeRepoLabel, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withRepoLabelID sets the ID field of the mutation. -func withRepoLabelID(id int) repolabelOption { - return func(m *RepoLabelMutation) { - var ( - err error - once sync.Once - value *RepoLabel - ) - m.oldValue = func(ctx context.Context) (*RepoLabel, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().RepoLabel.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withRepoLabel sets the old RepoLabel of the mutation. -func withRepoLabel(node *RepoLabel) repolabelOption { - return func(m *RepoLabelMutation) { - m.oldValue = func(context.Context) (*RepoLabel, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m RepoLabelMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m RepoLabelMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *RepoLabelMutation) ID() (id int, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetName sets the "name" field. -func (m *RepoLabelMutation) SetName(s string) { - m.name = &s -} - -// Name returns the value of the "name" field in the mutation. -func (m *RepoLabelMutation) Name() (r string, exists bool) { - v := m.name - if v == nil { - return - } - return *v, true -} - -// OldName returns the old "name" field's value of the RepoLabel entity. -// If the RepoLabel object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *RepoLabelMutation) OldName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldName: %w", err) - } - return oldValue.Name, nil -} - -// ResetName resets all changes to the "name" field. -func (m *RepoLabelMutation) ResetName() { - m.name = nil -} - -// SetDescription sets the "description" field. -func (m *RepoLabelMutation) SetDescription(s string) { - m.description = &s -} - -// Description returns the value of the "description" field in the mutation. -func (m *RepoLabelMutation) Description() (r string, exists bool) { - v := m.description - if v == nil { - return - } - return *v, true -} - -// OldDescription returns the old "description" field's value of the RepoLabel entity. -// If the RepoLabel object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *RepoLabelMutation) OldDescription(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldDescription is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldDescription requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldDescription: %w", err) - } - return oldValue.Description, nil -} - -// ResetDescription resets all changes to the "description" field. -func (m *RepoLabelMutation) ResetDescription() { - m.description = nil -} - -// SetColor sets the "color" field. -func (m *RepoLabelMutation) SetColor(s string) { - m.color = &s -} - -// Color returns the value of the "color" field in the mutation. -func (m *RepoLabelMutation) Color() (r string, exists bool) { - v := m.color - if v == nil { - return - } - return *v, true -} - -// OldColor returns the old "color" field's value of the RepoLabel entity. -// If the RepoLabel object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *RepoLabelMutation) OldColor(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldColor is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldColor requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldColor: %w", err) - } - return oldValue.Color, nil -} - -// ResetColor resets all changes to the "color" field. -func (m *RepoLabelMutation) ResetColor() { - m.color = nil -} - -// AddRepoIDs adds the "repos" edge to the Repository entity by ids. -func (m *RepoLabelMutation) AddRepoIDs(ids ...int) { - if m.repos == nil { - m.repos = make(map[int]struct{}) - } - for i := range ids { - m.repos[ids[i]] = struct{}{} - } -} - -// ClearRepos clears the "repos" edge to the Repository entity. -func (m *RepoLabelMutation) ClearRepos() { - m.clearedrepos = true -} - -// ReposCleared reports if the "repos" edge to the Repository entity was cleared. -func (m *RepoLabelMutation) ReposCleared() bool { - return m.clearedrepos -} - -// RemoveRepoIDs removes the "repos" edge to the Repository entity by IDs. -func (m *RepoLabelMutation) RemoveRepoIDs(ids ...int) { - if m.removedrepos == nil { - m.removedrepos = make(map[int]struct{}) - } - for i := range ids { - delete(m.repos, ids[i]) - m.removedrepos[ids[i]] = struct{}{} - } -} - -// RemovedRepos returns the removed IDs of the "repos" edge to the Repository entity. -func (m *RepoLabelMutation) RemovedReposIDs() (ids []int) { - for id := range m.removedrepos { - ids = append(ids, id) - } - return -} - -// ReposIDs returns the "repos" edge IDs in the mutation. -func (m *RepoLabelMutation) ReposIDs() (ids []int) { - for id := range m.repos { - ids = append(ids, id) - } - return -} - -// ResetRepos resets all changes to the "repos" edge. -func (m *RepoLabelMutation) ResetRepos() { - m.repos = nil - m.clearedrepos = false - m.removedrepos = nil -} - -// Where appends a list predicates to the RepoLabelMutation builder. -func (m *RepoLabelMutation) Where(ps ...predicate.RepoLabel) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *RepoLabelMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (RepoLabel). -func (m *RepoLabelMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *RepoLabelMutation) Fields() []string { - fields := make([]string, 0, 3) - if m.name != nil { - fields = append(fields, repolabel.FieldName) - } - if m.description != nil { - fields = append(fields, repolabel.FieldDescription) - } - if m.color != nil { - fields = append(fields, repolabel.FieldColor) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *RepoLabelMutation) Field(name string) (ent.Value, bool) { - switch name { - case repolabel.FieldName: - return m.Name() - case repolabel.FieldDescription: - return m.Description() - case repolabel.FieldColor: - return m.Color() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *RepoLabelMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case repolabel.FieldName: - return m.OldName(ctx) - case repolabel.FieldDescription: - return m.OldDescription(ctx) - case repolabel.FieldColor: - return m.OldColor(ctx) - } - return nil, fmt.Errorf("unknown RepoLabel field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *RepoLabelMutation) SetField(name string, value ent.Value) error { - switch name { - case repolabel.FieldName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetName(v) - return nil - case repolabel.FieldDescription: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetDescription(v) - return nil - case repolabel.FieldColor: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetColor(v) - return nil - } - return fmt.Errorf("unknown RepoLabel field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *RepoLabelMutation) AddedFields() []string { - return nil -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *RepoLabelMutation) AddedField(name string) (ent.Value, bool) { - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *RepoLabelMutation) AddField(name string, value ent.Value) error { - switch name { - } - return fmt.Errorf("unknown RepoLabel numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *RepoLabelMutation) ClearedFields() []string { - return nil -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *RepoLabelMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *RepoLabelMutation) ClearField(name string) error { - return fmt.Errorf("unknown RepoLabel nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *RepoLabelMutation) ResetField(name string) error { - switch name { - case repolabel.FieldName: - m.ResetName() - return nil - case repolabel.FieldDescription: - m.ResetDescription() - return nil - case repolabel.FieldColor: - m.ResetColor() - return nil - } - return fmt.Errorf("unknown RepoLabel field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *RepoLabelMutation) AddedEdges() []string { - edges := make([]string, 0, 1) - if m.repos != nil { - edges = append(edges, repolabel.EdgeRepos) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *RepoLabelMutation) AddedIDs(name string) []ent.Value { - switch name { - case repolabel.EdgeRepos: - ids := make([]ent.Value, 0, len(m.repos)) - for id := range m.repos { - ids = append(ids, id) - } - return ids - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *RepoLabelMutation) RemovedEdges() []string { - edges := make([]string, 0, 1) - if m.removedrepos != nil { - edges = append(edges, repolabel.EdgeRepos) - } - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *RepoLabelMutation) RemovedIDs(name string) []ent.Value { - switch name { - case repolabel.EdgeRepos: - ids := make([]ent.Value, 0, len(m.removedrepos)) - for id := range m.removedrepos { - ids = append(ids, id) - } - return ids - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *RepoLabelMutation) ClearedEdges() []string { - edges := make([]string, 0, 1) - if m.clearedrepos { - edges = append(edges, repolabel.EdgeRepos) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *RepoLabelMutation) EdgeCleared(name string) bool { - switch name { - case repolabel.EdgeRepos: - return m.clearedrepos - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *RepoLabelMutation) ClearEdge(name string) error { - switch name { - } - return fmt.Errorf("unknown RepoLabel unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *RepoLabelMutation) ResetEdge(name string) error { - switch name { - case repolabel.EdgeRepos: - m.ResetRepos() - return nil - } - return fmt.Errorf("unknown RepoLabel edge %s", name) -} - -// RepositoryMutation represents an operation that mutates the Repository nodes in the graph. -type RepositoryMutation struct { - config - op Op - typ string - id *int - owner *string - name *string - install_id *int64 - addinstall_id *int64 - url *string - avatar_url *string - default_branch *string - clearedFields map[string]struct{} - scan map[string]struct{} - removedscan map[string]struct{} - clearedscan bool - main map[string]struct{} - removedmain map[string]struct{} - clearedmain bool - latest *string - clearedlatest bool - status map[string]struct{} - removedstatus map[string]struct{} - clearedstatus bool - labels map[int]struct{} - removedlabels map[int]struct{} - clearedlabels bool - done bool - oldValue func(context.Context) (*Repository, error) - predicates []predicate.Repository -} - -var _ ent.Mutation = (*RepositoryMutation)(nil) - -// repositoryOption allows management of the mutation configuration using functional options. -type repositoryOption func(*RepositoryMutation) - -// newRepositoryMutation creates new mutation for the Repository entity. -func newRepositoryMutation(c config, op Op, opts ...repositoryOption) *RepositoryMutation { - m := &RepositoryMutation{ - config: c, - op: op, - typ: TypeRepository, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withRepositoryID sets the ID field of the mutation. -func withRepositoryID(id int) repositoryOption { - return func(m *RepositoryMutation) { - var ( - err error - once sync.Once - value *Repository - ) - m.oldValue = func(ctx context.Context) (*Repository, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().Repository.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withRepository sets the old Repository of the mutation. -func withRepository(node *Repository) repositoryOption { - return func(m *RepositoryMutation) { - m.oldValue = func(context.Context) (*Repository, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m RepositoryMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m RepositoryMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *RepositoryMutation) ID() (id int, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetOwner sets the "owner" field. -func (m *RepositoryMutation) SetOwner(s string) { - m.owner = &s -} - -// Owner returns the value of the "owner" field in the mutation. -func (m *RepositoryMutation) Owner() (r string, exists bool) { - v := m.owner - if v == nil { - return - } - return *v, true -} - -// OldOwner returns the old "owner" field's value of the Repository entity. -// If the Repository object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *RepositoryMutation) OldOwner(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldOwner is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldOwner requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldOwner: %w", err) - } - return oldValue.Owner, nil -} - -// ResetOwner resets all changes to the "owner" field. -func (m *RepositoryMutation) ResetOwner() { - m.owner = nil -} - -// SetName sets the "name" field. -func (m *RepositoryMutation) SetName(s string) { - m.name = &s -} - -// Name returns the value of the "name" field in the mutation. -func (m *RepositoryMutation) Name() (r string, exists bool) { - v := m.name - if v == nil { - return - } - return *v, true -} - -// OldName returns the old "name" field's value of the Repository entity. -// If the Repository object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *RepositoryMutation) OldName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldName: %w", err) - } - return oldValue.Name, nil -} - -// ResetName resets all changes to the "name" field. -func (m *RepositoryMutation) ResetName() { - m.name = nil -} - -// SetInstallID sets the "install_id" field. -func (m *RepositoryMutation) SetInstallID(i int64) { - m.install_id = &i - m.addinstall_id = nil -} - -// InstallID returns the value of the "install_id" field in the mutation. -func (m *RepositoryMutation) InstallID() (r int64, exists bool) { - v := m.install_id - if v == nil { - return - } - return *v, true -} - -// OldInstallID returns the old "install_id" field's value of the Repository entity. -// If the Repository object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *RepositoryMutation) OldInstallID(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldInstallID is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldInstallID requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldInstallID: %w", err) - } - return oldValue.InstallID, nil -} - -// AddInstallID adds i to the "install_id" field. -func (m *RepositoryMutation) AddInstallID(i int64) { - if m.addinstall_id != nil { - *m.addinstall_id += i - } else { - m.addinstall_id = &i - } -} - -// AddedInstallID returns the value that was added to the "install_id" field in this mutation. -func (m *RepositoryMutation) AddedInstallID() (r int64, exists bool) { - v := m.addinstall_id - if v == nil { - return - } - return *v, true -} - -// ClearInstallID clears the value of the "install_id" field. -func (m *RepositoryMutation) ClearInstallID() { - m.install_id = nil - m.addinstall_id = nil - m.clearedFields[repository.FieldInstallID] = struct{}{} -} - -// InstallIDCleared returns if the "install_id" field was cleared in this mutation. -func (m *RepositoryMutation) InstallIDCleared() bool { - _, ok := m.clearedFields[repository.FieldInstallID] - return ok -} - -// ResetInstallID resets all changes to the "install_id" field. -func (m *RepositoryMutation) ResetInstallID() { - m.install_id = nil - m.addinstall_id = nil - delete(m.clearedFields, repository.FieldInstallID) -} - -// SetURL sets the "url" field. -func (m *RepositoryMutation) SetURL(s string) { - m.url = &s -} - -// URL returns the value of the "url" field in the mutation. -func (m *RepositoryMutation) URL() (r string, exists bool) { - v := m.url - if v == nil { - return - } - return *v, true -} - -// OldURL returns the old "url" field's value of the Repository entity. -// If the Repository object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *RepositoryMutation) OldURL(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldURL is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldURL requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldURL: %w", err) - } - return oldValue.URL, nil -} - -// ClearURL clears the value of the "url" field. -func (m *RepositoryMutation) ClearURL() { - m.url = nil - m.clearedFields[repository.FieldURL] = struct{}{} -} - -// URLCleared returns if the "url" field was cleared in this mutation. -func (m *RepositoryMutation) URLCleared() bool { - _, ok := m.clearedFields[repository.FieldURL] - return ok -} - -// ResetURL resets all changes to the "url" field. -func (m *RepositoryMutation) ResetURL() { - m.url = nil - delete(m.clearedFields, repository.FieldURL) -} - -// SetAvatarURL sets the "avatar_url" field. -func (m *RepositoryMutation) SetAvatarURL(s string) { - m.avatar_url = &s -} - -// AvatarURL returns the value of the "avatar_url" field in the mutation. -func (m *RepositoryMutation) AvatarURL() (r string, exists bool) { - v := m.avatar_url - if v == nil { - return - } - return *v, true -} - -// OldAvatarURL returns the old "avatar_url" field's value of the Repository entity. -// If the Repository object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *RepositoryMutation) OldAvatarURL(ctx context.Context) (v *string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldAvatarURL is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldAvatarURL requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldAvatarURL: %w", err) - } - return oldValue.AvatarURL, nil -} - -// ClearAvatarURL clears the value of the "avatar_url" field. -func (m *RepositoryMutation) ClearAvatarURL() { - m.avatar_url = nil - m.clearedFields[repository.FieldAvatarURL] = struct{}{} -} - -// AvatarURLCleared returns if the "avatar_url" field was cleared in this mutation. -func (m *RepositoryMutation) AvatarURLCleared() bool { - _, ok := m.clearedFields[repository.FieldAvatarURL] - return ok -} - -// ResetAvatarURL resets all changes to the "avatar_url" field. -func (m *RepositoryMutation) ResetAvatarURL() { - m.avatar_url = nil - delete(m.clearedFields, repository.FieldAvatarURL) -} - -// SetDefaultBranch sets the "default_branch" field. -func (m *RepositoryMutation) SetDefaultBranch(s string) { - m.default_branch = &s -} - -// DefaultBranch returns the value of the "default_branch" field in the mutation. -func (m *RepositoryMutation) DefaultBranch() (r string, exists bool) { - v := m.default_branch - if v == nil { - return - } - return *v, true -} - -// OldDefaultBranch returns the old "default_branch" field's value of the Repository entity. -// If the Repository object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *RepositoryMutation) OldDefaultBranch(ctx context.Context) (v *string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldDefaultBranch is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldDefaultBranch requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldDefaultBranch: %w", err) - } - return oldValue.DefaultBranch, nil -} - -// ClearDefaultBranch clears the value of the "default_branch" field. -func (m *RepositoryMutation) ClearDefaultBranch() { - m.default_branch = nil - m.clearedFields[repository.FieldDefaultBranch] = struct{}{} -} - -// DefaultBranchCleared returns if the "default_branch" field was cleared in this mutation. -func (m *RepositoryMutation) DefaultBranchCleared() bool { - _, ok := m.clearedFields[repository.FieldDefaultBranch] - return ok -} - -// ResetDefaultBranch resets all changes to the "default_branch" field. -func (m *RepositoryMutation) ResetDefaultBranch() { - m.default_branch = nil - delete(m.clearedFields, repository.FieldDefaultBranch) -} - -// AddScanIDs adds the "scan" edge to the Scan entity by ids. -func (m *RepositoryMutation) AddScanIDs(ids ...string) { - if m.scan == nil { - m.scan = make(map[string]struct{}) - } - for i := range ids { - m.scan[ids[i]] = struct{}{} - } -} - -// ClearScan clears the "scan" edge to the Scan entity. -func (m *RepositoryMutation) ClearScan() { - m.clearedscan = true -} - -// ScanCleared reports if the "scan" edge to the Scan entity was cleared. -func (m *RepositoryMutation) ScanCleared() bool { - return m.clearedscan -} - -// RemoveScanIDs removes the "scan" edge to the Scan entity by IDs. -func (m *RepositoryMutation) RemoveScanIDs(ids ...string) { - if m.removedscan == nil { - m.removedscan = make(map[string]struct{}) - } - for i := range ids { - delete(m.scan, ids[i]) - m.removedscan[ids[i]] = struct{}{} - } -} - -// RemovedScan returns the removed IDs of the "scan" edge to the Scan entity. -func (m *RepositoryMutation) RemovedScanIDs() (ids []string) { - for id := range m.removedscan { - ids = append(ids, id) - } - return -} - -// ScanIDs returns the "scan" edge IDs in the mutation. -func (m *RepositoryMutation) ScanIDs() (ids []string) { - for id := range m.scan { - ids = append(ids, id) - } - return -} - -// ResetScan resets all changes to the "scan" edge. -func (m *RepositoryMutation) ResetScan() { - m.scan = nil - m.clearedscan = false - m.removedscan = nil -} - -// AddMainIDs adds the "main" edge to the Scan entity by ids. -func (m *RepositoryMutation) AddMainIDs(ids ...string) { - if m.main == nil { - m.main = make(map[string]struct{}) - } - for i := range ids { - m.main[ids[i]] = struct{}{} - } -} - -// ClearMain clears the "main" edge to the Scan entity. -func (m *RepositoryMutation) ClearMain() { - m.clearedmain = true -} - -// MainCleared reports if the "main" edge to the Scan entity was cleared. -func (m *RepositoryMutation) MainCleared() bool { - return m.clearedmain -} - -// RemoveMainIDs removes the "main" edge to the Scan entity by IDs. -func (m *RepositoryMutation) RemoveMainIDs(ids ...string) { - if m.removedmain == nil { - m.removedmain = make(map[string]struct{}) - } - for i := range ids { - delete(m.main, ids[i]) - m.removedmain[ids[i]] = struct{}{} - } -} - -// RemovedMain returns the removed IDs of the "main" edge to the Scan entity. -func (m *RepositoryMutation) RemovedMainIDs() (ids []string) { - for id := range m.removedmain { - ids = append(ids, id) - } - return -} - -// MainIDs returns the "main" edge IDs in the mutation. -func (m *RepositoryMutation) MainIDs() (ids []string) { - for id := range m.main { - ids = append(ids, id) - } - return -} - -// ResetMain resets all changes to the "main" edge. -func (m *RepositoryMutation) ResetMain() { - m.main = nil - m.clearedmain = false - m.removedmain = nil -} - -// SetLatestID sets the "latest" edge to the Scan entity by id. -func (m *RepositoryMutation) SetLatestID(id string) { - m.latest = &id -} - -// ClearLatest clears the "latest" edge to the Scan entity. -func (m *RepositoryMutation) ClearLatest() { - m.clearedlatest = true -} - -// LatestCleared reports if the "latest" edge to the Scan entity was cleared. -func (m *RepositoryMutation) LatestCleared() bool { - return m.clearedlatest -} - -// LatestID returns the "latest" edge ID in the mutation. -func (m *RepositoryMutation) LatestID() (id string, exists bool) { - if m.latest != nil { - return *m.latest, true - } - return -} - -// LatestIDs returns the "latest" edge IDs in the mutation. -// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// LatestID instead. It exists only for internal usage by the builders. -func (m *RepositoryMutation) LatestIDs() (ids []string) { - if id := m.latest; id != nil { - ids = append(ids, *id) - } - return -} - -// ResetLatest resets all changes to the "latest" edge. -func (m *RepositoryMutation) ResetLatest() { - m.latest = nil - m.clearedlatest = false -} - -// AddStatuIDs adds the "status" edge to the VulnStatusIndex entity by ids. -func (m *RepositoryMutation) AddStatuIDs(ids ...string) { - if m.status == nil { - m.status = make(map[string]struct{}) - } - for i := range ids { - m.status[ids[i]] = struct{}{} - } -} - -// ClearStatus clears the "status" edge to the VulnStatusIndex entity. -func (m *RepositoryMutation) ClearStatus() { - m.clearedstatus = true -} - -// StatusCleared reports if the "status" edge to the VulnStatusIndex entity was cleared. -func (m *RepositoryMutation) StatusCleared() bool { - return m.clearedstatus -} - -// RemoveStatuIDs removes the "status" edge to the VulnStatusIndex entity by IDs. -func (m *RepositoryMutation) RemoveStatuIDs(ids ...string) { - if m.removedstatus == nil { - m.removedstatus = make(map[string]struct{}) - } - for i := range ids { - delete(m.status, ids[i]) - m.removedstatus[ids[i]] = struct{}{} - } -} - -// RemovedStatus returns the removed IDs of the "status" edge to the VulnStatusIndex entity. -func (m *RepositoryMutation) RemovedStatusIDs() (ids []string) { - for id := range m.removedstatus { - ids = append(ids, id) - } - return -} - -// StatusIDs returns the "status" edge IDs in the mutation. -func (m *RepositoryMutation) StatusIDs() (ids []string) { - for id := range m.status { - ids = append(ids, id) - } - return -} - -// ResetStatus resets all changes to the "status" edge. -func (m *RepositoryMutation) ResetStatus() { - m.status = nil - m.clearedstatus = false - m.removedstatus = nil -} - -// AddLabelIDs adds the "labels" edge to the RepoLabel entity by ids. -func (m *RepositoryMutation) AddLabelIDs(ids ...int) { - if m.labels == nil { - m.labels = make(map[int]struct{}) - } - for i := range ids { - m.labels[ids[i]] = struct{}{} - } -} - -// ClearLabels clears the "labels" edge to the RepoLabel entity. -func (m *RepositoryMutation) ClearLabels() { - m.clearedlabels = true -} - -// LabelsCleared reports if the "labels" edge to the RepoLabel entity was cleared. -func (m *RepositoryMutation) LabelsCleared() bool { - return m.clearedlabels -} - -// RemoveLabelIDs removes the "labels" edge to the RepoLabel entity by IDs. -func (m *RepositoryMutation) RemoveLabelIDs(ids ...int) { - if m.removedlabels == nil { - m.removedlabels = make(map[int]struct{}) - } - for i := range ids { - delete(m.labels, ids[i]) - m.removedlabels[ids[i]] = struct{}{} - } -} - -// RemovedLabels returns the removed IDs of the "labels" edge to the RepoLabel entity. -func (m *RepositoryMutation) RemovedLabelsIDs() (ids []int) { - for id := range m.removedlabels { - ids = append(ids, id) - } - return -} - -// LabelsIDs returns the "labels" edge IDs in the mutation. -func (m *RepositoryMutation) LabelsIDs() (ids []int) { - for id := range m.labels { - ids = append(ids, id) - } - return -} - -// ResetLabels resets all changes to the "labels" edge. -func (m *RepositoryMutation) ResetLabels() { - m.labels = nil - m.clearedlabels = false - m.removedlabels = nil -} - -// Where appends a list predicates to the RepositoryMutation builder. -func (m *RepositoryMutation) Where(ps ...predicate.Repository) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *RepositoryMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (Repository). -func (m *RepositoryMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *RepositoryMutation) Fields() []string { - fields := make([]string, 0, 6) - if m.owner != nil { - fields = append(fields, repository.FieldOwner) - } - if m.name != nil { - fields = append(fields, repository.FieldName) - } - if m.install_id != nil { - fields = append(fields, repository.FieldInstallID) - } - if m.url != nil { - fields = append(fields, repository.FieldURL) - } - if m.avatar_url != nil { - fields = append(fields, repository.FieldAvatarURL) - } - if m.default_branch != nil { - fields = append(fields, repository.FieldDefaultBranch) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *RepositoryMutation) Field(name string) (ent.Value, bool) { - switch name { - case repository.FieldOwner: - return m.Owner() - case repository.FieldName: - return m.Name() - case repository.FieldInstallID: - return m.InstallID() - case repository.FieldURL: - return m.URL() - case repository.FieldAvatarURL: - return m.AvatarURL() - case repository.FieldDefaultBranch: - return m.DefaultBranch() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *RepositoryMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case repository.FieldOwner: - return m.OldOwner(ctx) - case repository.FieldName: - return m.OldName(ctx) - case repository.FieldInstallID: - return m.OldInstallID(ctx) - case repository.FieldURL: - return m.OldURL(ctx) - case repository.FieldAvatarURL: - return m.OldAvatarURL(ctx) - case repository.FieldDefaultBranch: - return m.OldDefaultBranch(ctx) - } - return nil, fmt.Errorf("unknown Repository field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *RepositoryMutation) SetField(name string, value ent.Value) error { - switch name { - case repository.FieldOwner: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetOwner(v) - return nil - case repository.FieldName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetName(v) - return nil - case repository.FieldInstallID: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetInstallID(v) - return nil - case repository.FieldURL: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetURL(v) - return nil - case repository.FieldAvatarURL: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetAvatarURL(v) - return nil - case repository.FieldDefaultBranch: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetDefaultBranch(v) - return nil - } - return fmt.Errorf("unknown Repository field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *RepositoryMutation) AddedFields() []string { - var fields []string - if m.addinstall_id != nil { - fields = append(fields, repository.FieldInstallID) - } - return fields -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *RepositoryMutation) AddedField(name string) (ent.Value, bool) { - switch name { - case repository.FieldInstallID: - return m.AddedInstallID() - } - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *RepositoryMutation) AddField(name string, value ent.Value) error { - switch name { - case repository.FieldInstallID: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddInstallID(v) - return nil - } - return fmt.Errorf("unknown Repository numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *RepositoryMutation) ClearedFields() []string { - var fields []string - if m.FieldCleared(repository.FieldInstallID) { - fields = append(fields, repository.FieldInstallID) - } - if m.FieldCleared(repository.FieldURL) { - fields = append(fields, repository.FieldURL) - } - if m.FieldCleared(repository.FieldAvatarURL) { - fields = append(fields, repository.FieldAvatarURL) - } - if m.FieldCleared(repository.FieldDefaultBranch) { - fields = append(fields, repository.FieldDefaultBranch) - } - return fields -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *RepositoryMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *RepositoryMutation) ClearField(name string) error { - switch name { - case repository.FieldInstallID: - m.ClearInstallID() - return nil - case repository.FieldURL: - m.ClearURL() - return nil - case repository.FieldAvatarURL: - m.ClearAvatarURL() - return nil - case repository.FieldDefaultBranch: - m.ClearDefaultBranch() - return nil - } - return fmt.Errorf("unknown Repository nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *RepositoryMutation) ResetField(name string) error { - switch name { - case repository.FieldOwner: - m.ResetOwner() - return nil - case repository.FieldName: - m.ResetName() - return nil - case repository.FieldInstallID: - m.ResetInstallID() - return nil - case repository.FieldURL: - m.ResetURL() - return nil - case repository.FieldAvatarURL: - m.ResetAvatarURL() - return nil - case repository.FieldDefaultBranch: - m.ResetDefaultBranch() - return nil - } - return fmt.Errorf("unknown Repository field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *RepositoryMutation) AddedEdges() []string { - edges := make([]string, 0, 5) - if m.scan != nil { - edges = append(edges, repository.EdgeScan) - } - if m.main != nil { - edges = append(edges, repository.EdgeMain) - } - if m.latest != nil { - edges = append(edges, repository.EdgeLatest) - } - if m.status != nil { - edges = append(edges, repository.EdgeStatus) - } - if m.labels != nil { - edges = append(edges, repository.EdgeLabels) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *RepositoryMutation) AddedIDs(name string) []ent.Value { - switch name { - case repository.EdgeScan: - ids := make([]ent.Value, 0, len(m.scan)) - for id := range m.scan { - ids = append(ids, id) - } - return ids - case repository.EdgeMain: - ids := make([]ent.Value, 0, len(m.main)) - for id := range m.main { - ids = append(ids, id) - } - return ids - case repository.EdgeLatest: - if id := m.latest; id != nil { - return []ent.Value{*id} - } - case repository.EdgeStatus: - ids := make([]ent.Value, 0, len(m.status)) - for id := range m.status { - ids = append(ids, id) - } - return ids - case repository.EdgeLabels: - ids := make([]ent.Value, 0, len(m.labels)) - for id := range m.labels { - ids = append(ids, id) - } - return ids - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *RepositoryMutation) RemovedEdges() []string { - edges := make([]string, 0, 5) - if m.removedscan != nil { - edges = append(edges, repository.EdgeScan) - } - if m.removedmain != nil { - edges = append(edges, repository.EdgeMain) - } - if m.removedstatus != nil { - edges = append(edges, repository.EdgeStatus) - } - if m.removedlabels != nil { - edges = append(edges, repository.EdgeLabels) - } - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *RepositoryMutation) RemovedIDs(name string) []ent.Value { - switch name { - case repository.EdgeScan: - ids := make([]ent.Value, 0, len(m.removedscan)) - for id := range m.removedscan { - ids = append(ids, id) - } - return ids - case repository.EdgeMain: - ids := make([]ent.Value, 0, len(m.removedmain)) - for id := range m.removedmain { - ids = append(ids, id) - } - return ids - case repository.EdgeStatus: - ids := make([]ent.Value, 0, len(m.removedstatus)) - for id := range m.removedstatus { - ids = append(ids, id) - } - return ids - case repository.EdgeLabels: - ids := make([]ent.Value, 0, len(m.removedlabels)) - for id := range m.removedlabels { - ids = append(ids, id) - } - return ids - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *RepositoryMutation) ClearedEdges() []string { - edges := make([]string, 0, 5) - if m.clearedscan { - edges = append(edges, repository.EdgeScan) - } - if m.clearedmain { - edges = append(edges, repository.EdgeMain) - } - if m.clearedlatest { - edges = append(edges, repository.EdgeLatest) - } - if m.clearedstatus { - edges = append(edges, repository.EdgeStatus) - } - if m.clearedlabels { - edges = append(edges, repository.EdgeLabels) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *RepositoryMutation) EdgeCleared(name string) bool { - switch name { - case repository.EdgeScan: - return m.clearedscan - case repository.EdgeMain: - return m.clearedmain - case repository.EdgeLatest: - return m.clearedlatest - case repository.EdgeStatus: - return m.clearedstatus - case repository.EdgeLabels: - return m.clearedlabels - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *RepositoryMutation) ClearEdge(name string) error { - switch name { - case repository.EdgeLatest: - m.ClearLatest() - return nil - } - return fmt.Errorf("unknown Repository unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *RepositoryMutation) ResetEdge(name string) error { - switch name { - case repository.EdgeScan: - m.ResetScan() - return nil - case repository.EdgeMain: - m.ResetMain() - return nil - case repository.EdgeLatest: - m.ResetLatest() - return nil - case repository.EdgeStatus: - m.ResetStatus() - return nil - case repository.EdgeLabels: - m.ResetLabels() - return nil - } - return fmt.Errorf("unknown Repository edge %s", name) -} - -// ScanMutation represents an operation that mutates the Scan nodes in the graph. -type ScanMutation struct { - config - op Op - typ string - id *string - branch *string - commit_id *string - requested_at *int64 - addrequested_at *int64 - scanned_at *int64 - addscanned_at *int64 - check_id *int64 - addcheck_id *int64 - pull_request_target *string - clearedFields map[string]struct{} - repository map[int]struct{} - removedrepository map[int]struct{} - clearedrepository bool - packages map[int]struct{} - removedpackages map[int]struct{} - clearedpackages bool - done bool - oldValue func(context.Context) (*Scan, error) - predicates []predicate.Scan -} - -var _ ent.Mutation = (*ScanMutation)(nil) - -// scanOption allows management of the mutation configuration using functional options. -type scanOption func(*ScanMutation) - -// newScanMutation creates new mutation for the Scan entity. -func newScanMutation(c config, op Op, opts ...scanOption) *ScanMutation { - m := &ScanMutation{ - config: c, - op: op, - typ: TypeScan, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withScanID sets the ID field of the mutation. -func withScanID(id string) scanOption { - return func(m *ScanMutation) { - var ( - err error - once sync.Once - value *Scan - ) - m.oldValue = func(ctx context.Context) (*Scan, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().Scan.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withScan sets the old Scan of the mutation. -func withScan(node *Scan) scanOption { - return func(m *ScanMutation) { - m.oldValue = func(context.Context) (*Scan, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m ScanMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m ScanMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// SetID sets the value of the id field. Note that this -// operation is only accepted on creation of Scan entities. -func (m *ScanMutation) SetID(id string) { - m.id = &id -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *ScanMutation) ID() (id string, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetBranch sets the "branch" field. -func (m *ScanMutation) SetBranch(s string) { - m.branch = &s -} - -// Branch returns the value of the "branch" field in the mutation. -func (m *ScanMutation) Branch() (r string, exists bool) { - v := m.branch - if v == nil { - return - } - return *v, true -} - -// OldBranch returns the old "branch" field's value of the Scan entity. -// If the Scan object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *ScanMutation) OldBranch(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldBranch is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldBranch requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldBranch: %w", err) - } - return oldValue.Branch, nil -} - -// ResetBranch resets all changes to the "branch" field. -func (m *ScanMutation) ResetBranch() { - m.branch = nil -} - -// SetCommitID sets the "commit_id" field. -func (m *ScanMutation) SetCommitID(s string) { - m.commit_id = &s -} - -// CommitID returns the value of the "commit_id" field in the mutation. -func (m *ScanMutation) CommitID() (r string, exists bool) { - v := m.commit_id - if v == nil { - return - } - return *v, true -} - -// OldCommitID returns the old "commit_id" field's value of the Scan entity. -// If the Scan object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *ScanMutation) OldCommitID(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCommitID is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCommitID requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldCommitID: %w", err) - } - return oldValue.CommitID, nil -} - -// ResetCommitID resets all changes to the "commit_id" field. -func (m *ScanMutation) ResetCommitID() { - m.commit_id = nil -} - -// SetRequestedAt sets the "requested_at" field. -func (m *ScanMutation) SetRequestedAt(i int64) { - m.requested_at = &i - m.addrequested_at = nil -} - -// RequestedAt returns the value of the "requested_at" field in the mutation. -func (m *ScanMutation) RequestedAt() (r int64, exists bool) { - v := m.requested_at - if v == nil { - return - } - return *v, true -} - -// OldRequestedAt returns the old "requested_at" field's value of the Scan entity. -// If the Scan object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *ScanMutation) OldRequestedAt(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldRequestedAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldRequestedAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldRequestedAt: %w", err) - } - return oldValue.RequestedAt, nil -} - -// AddRequestedAt adds i to the "requested_at" field. -func (m *ScanMutation) AddRequestedAt(i int64) { - if m.addrequested_at != nil { - *m.addrequested_at += i - } else { - m.addrequested_at = &i - } -} - -// AddedRequestedAt returns the value that was added to the "requested_at" field in this mutation. -func (m *ScanMutation) AddedRequestedAt() (r int64, exists bool) { - v := m.addrequested_at - if v == nil { - return - } - return *v, true -} - -// ResetRequestedAt resets all changes to the "requested_at" field. -func (m *ScanMutation) ResetRequestedAt() { - m.requested_at = nil - m.addrequested_at = nil -} - -// SetScannedAt sets the "scanned_at" field. -func (m *ScanMutation) SetScannedAt(i int64) { - m.scanned_at = &i - m.addscanned_at = nil -} - -// ScannedAt returns the value of the "scanned_at" field in the mutation. -func (m *ScanMutation) ScannedAt() (r int64, exists bool) { - v := m.scanned_at - if v == nil { - return - } - return *v, true -} - -// OldScannedAt returns the old "scanned_at" field's value of the Scan entity. -// If the Scan object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *ScanMutation) OldScannedAt(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldScannedAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldScannedAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldScannedAt: %w", err) - } - return oldValue.ScannedAt, nil -} - -// AddScannedAt adds i to the "scanned_at" field. -func (m *ScanMutation) AddScannedAt(i int64) { - if m.addscanned_at != nil { - *m.addscanned_at += i - } else { - m.addscanned_at = &i - } -} - -// AddedScannedAt returns the value that was added to the "scanned_at" field in this mutation. -func (m *ScanMutation) AddedScannedAt() (r int64, exists bool) { - v := m.addscanned_at - if v == nil { - return - } - return *v, true -} - -// ResetScannedAt resets all changes to the "scanned_at" field. -func (m *ScanMutation) ResetScannedAt() { - m.scanned_at = nil - m.addscanned_at = nil -} - -// SetCheckID sets the "check_id" field. -func (m *ScanMutation) SetCheckID(i int64) { - m.check_id = &i - m.addcheck_id = nil -} - -// CheckID returns the value of the "check_id" field in the mutation. -func (m *ScanMutation) CheckID() (r int64, exists bool) { - v := m.check_id - if v == nil { - return - } - return *v, true -} - -// OldCheckID returns the old "check_id" field's value of the Scan entity. -// If the Scan object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *ScanMutation) OldCheckID(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCheckID is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCheckID requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldCheckID: %w", err) - } - return oldValue.CheckID, nil -} - -// AddCheckID adds i to the "check_id" field. -func (m *ScanMutation) AddCheckID(i int64) { - if m.addcheck_id != nil { - *m.addcheck_id += i - } else { - m.addcheck_id = &i - } -} - -// AddedCheckID returns the value that was added to the "check_id" field in this mutation. -func (m *ScanMutation) AddedCheckID() (r int64, exists bool) { - v := m.addcheck_id - if v == nil { - return - } - return *v, true -} - -// ClearCheckID clears the value of the "check_id" field. -func (m *ScanMutation) ClearCheckID() { - m.check_id = nil - m.addcheck_id = nil - m.clearedFields[scan.FieldCheckID] = struct{}{} -} - -// CheckIDCleared returns if the "check_id" field was cleared in this mutation. -func (m *ScanMutation) CheckIDCleared() bool { - _, ok := m.clearedFields[scan.FieldCheckID] - return ok -} - -// ResetCheckID resets all changes to the "check_id" field. -func (m *ScanMutation) ResetCheckID() { - m.check_id = nil - m.addcheck_id = nil - delete(m.clearedFields, scan.FieldCheckID) -} - -// SetPullRequestTarget sets the "pull_request_target" field. -func (m *ScanMutation) SetPullRequestTarget(s string) { - m.pull_request_target = &s -} - -// PullRequestTarget returns the value of the "pull_request_target" field in the mutation. -func (m *ScanMutation) PullRequestTarget() (r string, exists bool) { - v := m.pull_request_target - if v == nil { - return - } - return *v, true -} - -// OldPullRequestTarget returns the old "pull_request_target" field's value of the Scan entity. -// If the Scan object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *ScanMutation) OldPullRequestTarget(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldPullRequestTarget is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldPullRequestTarget requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldPullRequestTarget: %w", err) - } - return oldValue.PullRequestTarget, nil -} - -// ClearPullRequestTarget clears the value of the "pull_request_target" field. -func (m *ScanMutation) ClearPullRequestTarget() { - m.pull_request_target = nil - m.clearedFields[scan.FieldPullRequestTarget] = struct{}{} -} - -// PullRequestTargetCleared returns if the "pull_request_target" field was cleared in this mutation. -func (m *ScanMutation) PullRequestTargetCleared() bool { - _, ok := m.clearedFields[scan.FieldPullRequestTarget] - return ok -} - -// ResetPullRequestTarget resets all changes to the "pull_request_target" field. -func (m *ScanMutation) ResetPullRequestTarget() { - m.pull_request_target = nil - delete(m.clearedFields, scan.FieldPullRequestTarget) -} - -// AddRepositoryIDs adds the "repository" edge to the Repository entity by ids. -func (m *ScanMutation) AddRepositoryIDs(ids ...int) { - if m.repository == nil { - m.repository = make(map[int]struct{}) - } - for i := range ids { - m.repository[ids[i]] = struct{}{} - } -} - -// ClearRepository clears the "repository" edge to the Repository entity. -func (m *ScanMutation) ClearRepository() { - m.clearedrepository = true -} - -// RepositoryCleared reports if the "repository" edge to the Repository entity was cleared. -func (m *ScanMutation) RepositoryCleared() bool { - return m.clearedrepository -} - -// RemoveRepositoryIDs removes the "repository" edge to the Repository entity by IDs. -func (m *ScanMutation) RemoveRepositoryIDs(ids ...int) { - if m.removedrepository == nil { - m.removedrepository = make(map[int]struct{}) - } - for i := range ids { - delete(m.repository, ids[i]) - m.removedrepository[ids[i]] = struct{}{} - } -} - -// RemovedRepository returns the removed IDs of the "repository" edge to the Repository entity. -func (m *ScanMutation) RemovedRepositoryIDs() (ids []int) { - for id := range m.removedrepository { - ids = append(ids, id) - } - return -} - -// RepositoryIDs returns the "repository" edge IDs in the mutation. -func (m *ScanMutation) RepositoryIDs() (ids []int) { - for id := range m.repository { - ids = append(ids, id) - } - return -} - -// ResetRepository resets all changes to the "repository" edge. -func (m *ScanMutation) ResetRepository() { - m.repository = nil - m.clearedrepository = false - m.removedrepository = nil -} - -// AddPackageIDs adds the "packages" edge to the PackageRecord entity by ids. -func (m *ScanMutation) AddPackageIDs(ids ...int) { - if m.packages == nil { - m.packages = make(map[int]struct{}) - } - for i := range ids { - m.packages[ids[i]] = struct{}{} - } -} - -// ClearPackages clears the "packages" edge to the PackageRecord entity. -func (m *ScanMutation) ClearPackages() { - m.clearedpackages = true -} - -// PackagesCleared reports if the "packages" edge to the PackageRecord entity was cleared. -func (m *ScanMutation) PackagesCleared() bool { - return m.clearedpackages -} - -// RemovePackageIDs removes the "packages" edge to the PackageRecord entity by IDs. -func (m *ScanMutation) RemovePackageIDs(ids ...int) { - if m.removedpackages == nil { - m.removedpackages = make(map[int]struct{}) - } - for i := range ids { - delete(m.packages, ids[i]) - m.removedpackages[ids[i]] = struct{}{} - } -} - -// RemovedPackages returns the removed IDs of the "packages" edge to the PackageRecord entity. -func (m *ScanMutation) RemovedPackagesIDs() (ids []int) { - for id := range m.removedpackages { - ids = append(ids, id) - } - return -} - -// PackagesIDs returns the "packages" edge IDs in the mutation. -func (m *ScanMutation) PackagesIDs() (ids []int) { - for id := range m.packages { - ids = append(ids, id) - } - return -} - -// ResetPackages resets all changes to the "packages" edge. -func (m *ScanMutation) ResetPackages() { - m.packages = nil - m.clearedpackages = false - m.removedpackages = nil -} - -// Where appends a list predicates to the ScanMutation builder. -func (m *ScanMutation) Where(ps ...predicate.Scan) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *ScanMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (Scan). -func (m *ScanMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *ScanMutation) Fields() []string { - fields := make([]string, 0, 6) - if m.branch != nil { - fields = append(fields, scan.FieldBranch) - } - if m.commit_id != nil { - fields = append(fields, scan.FieldCommitID) - } - if m.requested_at != nil { - fields = append(fields, scan.FieldRequestedAt) - } - if m.scanned_at != nil { - fields = append(fields, scan.FieldScannedAt) - } - if m.check_id != nil { - fields = append(fields, scan.FieldCheckID) - } - if m.pull_request_target != nil { - fields = append(fields, scan.FieldPullRequestTarget) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *ScanMutation) Field(name string) (ent.Value, bool) { - switch name { - case scan.FieldBranch: - return m.Branch() - case scan.FieldCommitID: - return m.CommitID() - case scan.FieldRequestedAt: - return m.RequestedAt() - case scan.FieldScannedAt: - return m.ScannedAt() - case scan.FieldCheckID: - return m.CheckID() - case scan.FieldPullRequestTarget: - return m.PullRequestTarget() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *ScanMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case scan.FieldBranch: - return m.OldBranch(ctx) - case scan.FieldCommitID: - return m.OldCommitID(ctx) - case scan.FieldRequestedAt: - return m.OldRequestedAt(ctx) - case scan.FieldScannedAt: - return m.OldScannedAt(ctx) - case scan.FieldCheckID: - return m.OldCheckID(ctx) - case scan.FieldPullRequestTarget: - return m.OldPullRequestTarget(ctx) - } - return nil, fmt.Errorf("unknown Scan field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *ScanMutation) SetField(name string, value ent.Value) error { - switch name { - case scan.FieldBranch: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetBranch(v) - return nil - case scan.FieldCommitID: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCommitID(v) - return nil - case scan.FieldRequestedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetRequestedAt(v) - return nil - case scan.FieldScannedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetScannedAt(v) - return nil - case scan.FieldCheckID: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCheckID(v) - return nil - case scan.FieldPullRequestTarget: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetPullRequestTarget(v) - return nil - } - return fmt.Errorf("unknown Scan field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *ScanMutation) AddedFields() []string { - var fields []string - if m.addrequested_at != nil { - fields = append(fields, scan.FieldRequestedAt) - } - if m.addscanned_at != nil { - fields = append(fields, scan.FieldScannedAt) - } - if m.addcheck_id != nil { - fields = append(fields, scan.FieldCheckID) - } - return fields -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *ScanMutation) AddedField(name string) (ent.Value, bool) { - switch name { - case scan.FieldRequestedAt: - return m.AddedRequestedAt() - case scan.FieldScannedAt: - return m.AddedScannedAt() - case scan.FieldCheckID: - return m.AddedCheckID() - } - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *ScanMutation) AddField(name string, value ent.Value) error { - switch name { - case scan.FieldRequestedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddRequestedAt(v) - return nil - case scan.FieldScannedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddScannedAt(v) - return nil - case scan.FieldCheckID: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddCheckID(v) - return nil - } - return fmt.Errorf("unknown Scan numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *ScanMutation) ClearedFields() []string { - var fields []string - if m.FieldCleared(scan.FieldCheckID) { - fields = append(fields, scan.FieldCheckID) - } - if m.FieldCleared(scan.FieldPullRequestTarget) { - fields = append(fields, scan.FieldPullRequestTarget) - } - return fields -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *ScanMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *ScanMutation) ClearField(name string) error { - switch name { - case scan.FieldCheckID: - m.ClearCheckID() - return nil - case scan.FieldPullRequestTarget: - m.ClearPullRequestTarget() - return nil - } - return fmt.Errorf("unknown Scan nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *ScanMutation) ResetField(name string) error { - switch name { - case scan.FieldBranch: - m.ResetBranch() - return nil - case scan.FieldCommitID: - m.ResetCommitID() - return nil - case scan.FieldRequestedAt: - m.ResetRequestedAt() - return nil - case scan.FieldScannedAt: - m.ResetScannedAt() - return nil - case scan.FieldCheckID: - m.ResetCheckID() - return nil - case scan.FieldPullRequestTarget: - m.ResetPullRequestTarget() - return nil - } - return fmt.Errorf("unknown Scan field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *ScanMutation) AddedEdges() []string { - edges := make([]string, 0, 2) - if m.repository != nil { - edges = append(edges, scan.EdgeRepository) - } - if m.packages != nil { - edges = append(edges, scan.EdgePackages) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *ScanMutation) AddedIDs(name string) []ent.Value { - switch name { - case scan.EdgeRepository: - ids := make([]ent.Value, 0, len(m.repository)) - for id := range m.repository { - ids = append(ids, id) - } - return ids - case scan.EdgePackages: - ids := make([]ent.Value, 0, len(m.packages)) - for id := range m.packages { - ids = append(ids, id) - } - return ids - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *ScanMutation) RemovedEdges() []string { - edges := make([]string, 0, 2) - if m.removedrepository != nil { - edges = append(edges, scan.EdgeRepository) - } - if m.removedpackages != nil { - edges = append(edges, scan.EdgePackages) - } - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *ScanMutation) RemovedIDs(name string) []ent.Value { - switch name { - case scan.EdgeRepository: - ids := make([]ent.Value, 0, len(m.removedrepository)) - for id := range m.removedrepository { - ids = append(ids, id) - } - return ids - case scan.EdgePackages: - ids := make([]ent.Value, 0, len(m.removedpackages)) - for id := range m.removedpackages { - ids = append(ids, id) - } - return ids - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *ScanMutation) ClearedEdges() []string { - edges := make([]string, 0, 2) - if m.clearedrepository { - edges = append(edges, scan.EdgeRepository) - } - if m.clearedpackages { - edges = append(edges, scan.EdgePackages) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *ScanMutation) EdgeCleared(name string) bool { - switch name { - case scan.EdgeRepository: - return m.clearedrepository - case scan.EdgePackages: - return m.clearedpackages - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *ScanMutation) ClearEdge(name string) error { - switch name { - } - return fmt.Errorf("unknown Scan unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *ScanMutation) ResetEdge(name string) error { - switch name { - case scan.EdgeRepository: - m.ResetRepository() - return nil - case scan.EdgePackages: - m.ResetPackages() - return nil - } - return fmt.Errorf("unknown Scan edge %s", name) -} - -// SessionMutation represents an operation that mutates the Session nodes in the graph. -type SessionMutation struct { - config - op Op - typ string - id *string - user_id *int - adduser_id *int - token *string - created_at *int64 - addcreated_at *int64 - expires_at *int64 - addexpires_at *int64 - clearedFields map[string]struct{} - login *int - clearedlogin bool - done bool - oldValue func(context.Context) (*Session, error) - predicates []predicate.Session -} - -var _ ent.Mutation = (*SessionMutation)(nil) - -// sessionOption allows management of the mutation configuration using functional options. -type sessionOption func(*SessionMutation) - -// newSessionMutation creates new mutation for the Session entity. -func newSessionMutation(c config, op Op, opts ...sessionOption) *SessionMutation { - m := &SessionMutation{ - config: c, - op: op, - typ: TypeSession, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withSessionID sets the ID field of the mutation. -func withSessionID(id string) sessionOption { - return func(m *SessionMutation) { - var ( - err error - once sync.Once - value *Session - ) - m.oldValue = func(ctx context.Context) (*Session, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().Session.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withSession sets the old Session of the mutation. -func withSession(node *Session) sessionOption { - return func(m *SessionMutation) { - m.oldValue = func(context.Context) (*Session, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m SessionMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m SessionMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// SetID sets the value of the id field. Note that this -// operation is only accepted on creation of Session entities. -func (m *SessionMutation) SetID(id string) { - m.id = &id -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *SessionMutation) ID() (id string, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetUserID sets the "user_id" field. -func (m *SessionMutation) SetUserID(i int) { - m.user_id = &i - m.adduser_id = nil -} - -// UserID returns the value of the "user_id" field in the mutation. -func (m *SessionMutation) UserID() (r int, exists bool) { - v := m.user_id - if v == nil { - return - } - return *v, true -} - -// OldUserID returns the old "user_id" field's value of the Session entity. -// If the Session object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *SessionMutation) OldUserID(ctx context.Context) (v int, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldUserID is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldUserID requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldUserID: %w", err) - } - return oldValue.UserID, nil -} - -// AddUserID adds i to the "user_id" field. -func (m *SessionMutation) AddUserID(i int) { - if m.adduser_id != nil { - *m.adduser_id += i - } else { - m.adduser_id = &i - } -} - -// AddedUserID returns the value that was added to the "user_id" field in this mutation. -func (m *SessionMutation) AddedUserID() (r int, exists bool) { - v := m.adduser_id - if v == nil { - return - } - return *v, true -} - -// ResetUserID resets all changes to the "user_id" field. -func (m *SessionMutation) ResetUserID() { - m.user_id = nil - m.adduser_id = nil -} - -// SetToken sets the "token" field. -func (m *SessionMutation) SetToken(s string) { - m.token = &s -} - -// Token returns the value of the "token" field in the mutation. -func (m *SessionMutation) Token() (r string, exists bool) { - v := m.token - if v == nil { - return - } - return *v, true -} - -// OldToken returns the old "token" field's value of the Session entity. -// If the Session object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *SessionMutation) OldToken(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldToken is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldToken requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldToken: %w", err) - } - return oldValue.Token, nil -} - -// ResetToken resets all changes to the "token" field. -func (m *SessionMutation) ResetToken() { - m.token = nil -} - -// SetCreatedAt sets the "created_at" field. -func (m *SessionMutation) SetCreatedAt(i int64) { - m.created_at = &i - m.addcreated_at = nil -} - -// CreatedAt returns the value of the "created_at" field in the mutation. -func (m *SessionMutation) CreatedAt() (r int64, exists bool) { - v := m.created_at - if v == nil { - return - } - return *v, true -} - -// OldCreatedAt returns the old "created_at" field's value of the Session entity. -// If the Session object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *SessionMutation) OldCreatedAt(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCreatedAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCreatedAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) - } - return oldValue.CreatedAt, nil -} - -// AddCreatedAt adds i to the "created_at" field. -func (m *SessionMutation) AddCreatedAt(i int64) { - if m.addcreated_at != nil { - *m.addcreated_at += i - } else { - m.addcreated_at = &i - } -} - -// AddedCreatedAt returns the value that was added to the "created_at" field in this mutation. -func (m *SessionMutation) AddedCreatedAt() (r int64, exists bool) { - v := m.addcreated_at - if v == nil { - return - } - return *v, true -} - -// ResetCreatedAt resets all changes to the "created_at" field. -func (m *SessionMutation) ResetCreatedAt() { - m.created_at = nil - m.addcreated_at = nil -} - -// SetExpiresAt sets the "expires_at" field. -func (m *SessionMutation) SetExpiresAt(i int64) { - m.expires_at = &i - m.addexpires_at = nil -} - -// ExpiresAt returns the value of the "expires_at" field in the mutation. -func (m *SessionMutation) ExpiresAt() (r int64, exists bool) { - v := m.expires_at - if v == nil { - return - } - return *v, true -} - -// OldExpiresAt returns the old "expires_at" field's value of the Session entity. -// If the Session object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *SessionMutation) OldExpiresAt(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldExpiresAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldExpiresAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldExpiresAt: %w", err) - } - return oldValue.ExpiresAt, nil -} - -// AddExpiresAt adds i to the "expires_at" field. -func (m *SessionMutation) AddExpiresAt(i int64) { - if m.addexpires_at != nil { - *m.addexpires_at += i - } else { - m.addexpires_at = &i - } -} - -// AddedExpiresAt returns the value that was added to the "expires_at" field in this mutation. -func (m *SessionMutation) AddedExpiresAt() (r int64, exists bool) { - v := m.addexpires_at - if v == nil { - return - } - return *v, true -} - -// ResetExpiresAt resets all changes to the "expires_at" field. -func (m *SessionMutation) ResetExpiresAt() { - m.expires_at = nil - m.addexpires_at = nil -} - -// SetLoginID sets the "login" edge to the User entity by id. -func (m *SessionMutation) SetLoginID(id int) { - m.login = &id -} - -// ClearLogin clears the "login" edge to the User entity. -func (m *SessionMutation) ClearLogin() { - m.clearedlogin = true -} - -// LoginCleared reports if the "login" edge to the User entity was cleared. -func (m *SessionMutation) LoginCleared() bool { - return m.clearedlogin -} - -// LoginID returns the "login" edge ID in the mutation. -func (m *SessionMutation) LoginID() (id int, exists bool) { - if m.login != nil { - return *m.login, true - } - return -} - -// LoginIDs returns the "login" edge IDs in the mutation. -// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// LoginID instead. It exists only for internal usage by the builders. -func (m *SessionMutation) LoginIDs() (ids []int) { - if id := m.login; id != nil { - ids = append(ids, *id) - } - return -} - -// ResetLogin resets all changes to the "login" edge. -func (m *SessionMutation) ResetLogin() { - m.login = nil - m.clearedlogin = false -} - -// Where appends a list predicates to the SessionMutation builder. -func (m *SessionMutation) Where(ps ...predicate.Session) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *SessionMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (Session). -func (m *SessionMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *SessionMutation) Fields() []string { - fields := make([]string, 0, 4) - if m.user_id != nil { - fields = append(fields, session.FieldUserID) - } - if m.token != nil { - fields = append(fields, session.FieldToken) - } - if m.created_at != nil { - fields = append(fields, session.FieldCreatedAt) - } - if m.expires_at != nil { - fields = append(fields, session.FieldExpiresAt) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *SessionMutation) Field(name string) (ent.Value, bool) { - switch name { - case session.FieldUserID: - return m.UserID() - case session.FieldToken: - return m.Token() - case session.FieldCreatedAt: - return m.CreatedAt() - case session.FieldExpiresAt: - return m.ExpiresAt() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *SessionMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case session.FieldUserID: - return m.OldUserID(ctx) - case session.FieldToken: - return m.OldToken(ctx) - case session.FieldCreatedAt: - return m.OldCreatedAt(ctx) - case session.FieldExpiresAt: - return m.OldExpiresAt(ctx) - } - return nil, fmt.Errorf("unknown Session field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *SessionMutation) SetField(name string, value ent.Value) error { - switch name { - case session.FieldUserID: - v, ok := value.(int) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetUserID(v) - return nil - case session.FieldToken: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetToken(v) - return nil - case session.FieldCreatedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCreatedAt(v) - return nil - case session.FieldExpiresAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetExpiresAt(v) - return nil - } - return fmt.Errorf("unknown Session field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *SessionMutation) AddedFields() []string { - var fields []string - if m.adduser_id != nil { - fields = append(fields, session.FieldUserID) - } - if m.addcreated_at != nil { - fields = append(fields, session.FieldCreatedAt) - } - if m.addexpires_at != nil { - fields = append(fields, session.FieldExpiresAt) - } - return fields -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *SessionMutation) AddedField(name string) (ent.Value, bool) { - switch name { - case session.FieldUserID: - return m.AddedUserID() - case session.FieldCreatedAt: - return m.AddedCreatedAt() - case session.FieldExpiresAt: - return m.AddedExpiresAt() - } - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *SessionMutation) AddField(name string, value ent.Value) error { - switch name { - case session.FieldUserID: - v, ok := value.(int) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddUserID(v) - return nil - case session.FieldCreatedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddCreatedAt(v) - return nil - case session.FieldExpiresAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddExpiresAt(v) - return nil - } - return fmt.Errorf("unknown Session numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *SessionMutation) ClearedFields() []string { - return nil -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *SessionMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *SessionMutation) ClearField(name string) error { - return fmt.Errorf("unknown Session nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *SessionMutation) ResetField(name string) error { - switch name { - case session.FieldUserID: - m.ResetUserID() - return nil - case session.FieldToken: - m.ResetToken() - return nil - case session.FieldCreatedAt: - m.ResetCreatedAt() - return nil - case session.FieldExpiresAt: - m.ResetExpiresAt() - return nil - } - return fmt.Errorf("unknown Session field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *SessionMutation) AddedEdges() []string { - edges := make([]string, 0, 1) - if m.login != nil { - edges = append(edges, session.EdgeLogin) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *SessionMutation) AddedIDs(name string) []ent.Value { - switch name { - case session.EdgeLogin: - if id := m.login; id != nil { - return []ent.Value{*id} - } - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *SessionMutation) RemovedEdges() []string { - edges := make([]string, 0, 1) - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *SessionMutation) RemovedIDs(name string) []ent.Value { - switch name { - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *SessionMutation) ClearedEdges() []string { - edges := make([]string, 0, 1) - if m.clearedlogin { - edges = append(edges, session.EdgeLogin) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *SessionMutation) EdgeCleared(name string) bool { - switch name { - case session.EdgeLogin: - return m.clearedlogin - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *SessionMutation) ClearEdge(name string) error { - switch name { - case session.EdgeLogin: - m.ClearLogin() - return nil - } - return fmt.Errorf("unknown Session unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *SessionMutation) ResetEdge(name string) error { - switch name { - case session.EdgeLogin: - m.ResetLogin() - return nil - } - return fmt.Errorf("unknown Session edge %s", name) -} - -// SeverityMutation represents an operation that mutates the Severity nodes in the graph. -type SeverityMutation struct { - config - op Op - typ string - id *int - label *string - color *string - clearedFields map[string]struct{} - vulnerabilities map[string]struct{} - removedvulnerabilities map[string]struct{} - clearedvulnerabilities bool - done bool - oldValue func(context.Context) (*Severity, error) - predicates []predicate.Severity -} - -var _ ent.Mutation = (*SeverityMutation)(nil) - -// severityOption allows management of the mutation configuration using functional options. -type severityOption func(*SeverityMutation) - -// newSeverityMutation creates new mutation for the Severity entity. -func newSeverityMutation(c config, op Op, opts ...severityOption) *SeverityMutation { - m := &SeverityMutation{ - config: c, - op: op, - typ: TypeSeverity, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withSeverityID sets the ID field of the mutation. -func withSeverityID(id int) severityOption { - return func(m *SeverityMutation) { - var ( - err error - once sync.Once - value *Severity - ) - m.oldValue = func(ctx context.Context) (*Severity, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().Severity.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withSeverity sets the old Severity of the mutation. -func withSeverity(node *Severity) severityOption { - return func(m *SeverityMutation) { - m.oldValue = func(context.Context) (*Severity, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m SeverityMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m SeverityMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *SeverityMutation) ID() (id int, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetLabel sets the "label" field. -func (m *SeverityMutation) SetLabel(s string) { - m.label = &s -} - -// Label returns the value of the "label" field in the mutation. -func (m *SeverityMutation) Label() (r string, exists bool) { - v := m.label - if v == nil { - return - } - return *v, true -} - -// OldLabel returns the old "label" field's value of the Severity entity. -// If the Severity object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *SeverityMutation) OldLabel(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldLabel is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldLabel requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldLabel: %w", err) - } - return oldValue.Label, nil -} - -// ResetLabel resets all changes to the "label" field. -func (m *SeverityMutation) ResetLabel() { - m.label = nil -} - -// SetColor sets the "color" field. -func (m *SeverityMutation) SetColor(s string) { - m.color = &s -} - -// Color returns the value of the "color" field in the mutation. -func (m *SeverityMutation) Color() (r string, exists bool) { - v := m.color - if v == nil { - return - } - return *v, true -} - -// OldColor returns the old "color" field's value of the Severity entity. -// If the Severity object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *SeverityMutation) OldColor(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldColor is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldColor requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldColor: %w", err) - } - return oldValue.Color, nil -} - -// ClearColor clears the value of the "color" field. -func (m *SeverityMutation) ClearColor() { - m.color = nil - m.clearedFields[severity.FieldColor] = struct{}{} -} - -// ColorCleared returns if the "color" field was cleared in this mutation. -func (m *SeverityMutation) ColorCleared() bool { - _, ok := m.clearedFields[severity.FieldColor] - return ok -} - -// ResetColor resets all changes to the "color" field. -func (m *SeverityMutation) ResetColor() { - m.color = nil - delete(m.clearedFields, severity.FieldColor) -} - -// AddVulnerabilityIDs adds the "vulnerabilities" edge to the Vulnerability entity by ids. -func (m *SeverityMutation) AddVulnerabilityIDs(ids ...string) { - if m.vulnerabilities == nil { - m.vulnerabilities = make(map[string]struct{}) - } - for i := range ids { - m.vulnerabilities[ids[i]] = struct{}{} - } -} - -// ClearVulnerabilities clears the "vulnerabilities" edge to the Vulnerability entity. -func (m *SeverityMutation) ClearVulnerabilities() { - m.clearedvulnerabilities = true -} - -// VulnerabilitiesCleared reports if the "vulnerabilities" edge to the Vulnerability entity was cleared. -func (m *SeverityMutation) VulnerabilitiesCleared() bool { - return m.clearedvulnerabilities -} - -// RemoveVulnerabilityIDs removes the "vulnerabilities" edge to the Vulnerability entity by IDs. -func (m *SeverityMutation) RemoveVulnerabilityIDs(ids ...string) { - if m.removedvulnerabilities == nil { - m.removedvulnerabilities = make(map[string]struct{}) - } - for i := range ids { - delete(m.vulnerabilities, ids[i]) - m.removedvulnerabilities[ids[i]] = struct{}{} - } -} - -// RemovedVulnerabilities returns the removed IDs of the "vulnerabilities" edge to the Vulnerability entity. -func (m *SeverityMutation) RemovedVulnerabilitiesIDs() (ids []string) { - for id := range m.removedvulnerabilities { - ids = append(ids, id) - } - return -} - -// VulnerabilitiesIDs returns the "vulnerabilities" edge IDs in the mutation. -func (m *SeverityMutation) VulnerabilitiesIDs() (ids []string) { - for id := range m.vulnerabilities { - ids = append(ids, id) - } - return -} - -// ResetVulnerabilities resets all changes to the "vulnerabilities" edge. -func (m *SeverityMutation) ResetVulnerabilities() { - m.vulnerabilities = nil - m.clearedvulnerabilities = false - m.removedvulnerabilities = nil -} - -// Where appends a list predicates to the SeverityMutation builder. -func (m *SeverityMutation) Where(ps ...predicate.Severity) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *SeverityMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (Severity). -func (m *SeverityMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *SeverityMutation) Fields() []string { - fields := make([]string, 0, 2) - if m.label != nil { - fields = append(fields, severity.FieldLabel) - } - if m.color != nil { - fields = append(fields, severity.FieldColor) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *SeverityMutation) Field(name string) (ent.Value, bool) { - switch name { - case severity.FieldLabel: - return m.Label() - case severity.FieldColor: - return m.Color() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *SeverityMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case severity.FieldLabel: - return m.OldLabel(ctx) - case severity.FieldColor: - return m.OldColor(ctx) - } - return nil, fmt.Errorf("unknown Severity field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *SeverityMutation) SetField(name string, value ent.Value) error { - switch name { - case severity.FieldLabel: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetLabel(v) - return nil - case severity.FieldColor: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetColor(v) - return nil - } - return fmt.Errorf("unknown Severity field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *SeverityMutation) AddedFields() []string { - return nil -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *SeverityMutation) AddedField(name string) (ent.Value, bool) { - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *SeverityMutation) AddField(name string, value ent.Value) error { - switch name { - } - return fmt.Errorf("unknown Severity numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *SeverityMutation) ClearedFields() []string { - var fields []string - if m.FieldCleared(severity.FieldColor) { - fields = append(fields, severity.FieldColor) - } - return fields -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *SeverityMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *SeverityMutation) ClearField(name string) error { - switch name { - case severity.FieldColor: - m.ClearColor() - return nil - } - return fmt.Errorf("unknown Severity nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *SeverityMutation) ResetField(name string) error { - switch name { - case severity.FieldLabel: - m.ResetLabel() - return nil - case severity.FieldColor: - m.ResetColor() - return nil - } - return fmt.Errorf("unknown Severity field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *SeverityMutation) AddedEdges() []string { - edges := make([]string, 0, 1) - if m.vulnerabilities != nil { - edges = append(edges, severity.EdgeVulnerabilities) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *SeverityMutation) AddedIDs(name string) []ent.Value { - switch name { - case severity.EdgeVulnerabilities: - ids := make([]ent.Value, 0, len(m.vulnerabilities)) - for id := range m.vulnerabilities { - ids = append(ids, id) - } - return ids - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *SeverityMutation) RemovedEdges() []string { - edges := make([]string, 0, 1) - if m.removedvulnerabilities != nil { - edges = append(edges, severity.EdgeVulnerabilities) - } - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *SeverityMutation) RemovedIDs(name string) []ent.Value { - switch name { - case severity.EdgeVulnerabilities: - ids := make([]ent.Value, 0, len(m.removedvulnerabilities)) - for id := range m.removedvulnerabilities { - ids = append(ids, id) - } - return ids - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *SeverityMutation) ClearedEdges() []string { - edges := make([]string, 0, 1) - if m.clearedvulnerabilities { - edges = append(edges, severity.EdgeVulnerabilities) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *SeverityMutation) EdgeCleared(name string) bool { - switch name { - case severity.EdgeVulnerabilities: - return m.clearedvulnerabilities - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *SeverityMutation) ClearEdge(name string) error { - switch name { - } - return fmt.Errorf("unknown Severity unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *SeverityMutation) ResetEdge(name string) error { - switch name { - case severity.EdgeVulnerabilities: - m.ResetVulnerabilities() - return nil - } - return fmt.Errorf("unknown Severity edge %s", name) -} - -// UserMutation represents an operation that mutates the User nodes in the graph. -type UserMutation struct { - config - op Op - typ string - id *int - github_id *int64 - addgithub_id *int64 - login *string - name *string - avatar_url *string - url *string - clearedFields map[string]struct{} - edited_status map[int]struct{} - removededited_status map[int]struct{} - clearededited_status bool - done bool - oldValue func(context.Context) (*User, error) - predicates []predicate.User -} - -var _ ent.Mutation = (*UserMutation)(nil) - -// userOption allows management of the mutation configuration using functional options. -type userOption func(*UserMutation) - -// newUserMutation creates new mutation for the User entity. -func newUserMutation(c config, op Op, opts ...userOption) *UserMutation { - m := &UserMutation{ - config: c, - op: op, - typ: TypeUser, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withUserID sets the ID field of the mutation. -func withUserID(id int) userOption { - return func(m *UserMutation) { - var ( - err error - once sync.Once - value *User - ) - m.oldValue = func(ctx context.Context) (*User, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().User.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withUser sets the old User of the mutation. -func withUser(node *User) userOption { - return func(m *UserMutation) { - m.oldValue = func(context.Context) (*User, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m UserMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m UserMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *UserMutation) ID() (id int, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetGithubID sets the "github_id" field. -func (m *UserMutation) SetGithubID(i int64) { - m.github_id = &i - m.addgithub_id = nil -} - -// GithubID returns the value of the "github_id" field in the mutation. -func (m *UserMutation) GithubID() (r int64, exists bool) { - v := m.github_id - if v == nil { - return - } - return *v, true -} - -// OldGithubID returns the old "github_id" field's value of the User entity. -// If the User object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UserMutation) OldGithubID(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldGithubID is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldGithubID requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldGithubID: %w", err) - } - return oldValue.GithubID, nil -} - -// AddGithubID adds i to the "github_id" field. -func (m *UserMutation) AddGithubID(i int64) { - if m.addgithub_id != nil { - *m.addgithub_id += i - } else { - m.addgithub_id = &i - } -} - -// AddedGithubID returns the value that was added to the "github_id" field in this mutation. -func (m *UserMutation) AddedGithubID() (r int64, exists bool) { - v := m.addgithub_id - if v == nil { - return - } - return *v, true -} - -// ResetGithubID resets all changes to the "github_id" field. -func (m *UserMutation) ResetGithubID() { - m.github_id = nil - m.addgithub_id = nil -} - -// SetLogin sets the "login" field. -func (m *UserMutation) SetLogin(s string) { - m.login = &s -} - -// Login returns the value of the "login" field in the mutation. -func (m *UserMutation) Login() (r string, exists bool) { - v := m.login - if v == nil { - return - } - return *v, true -} - -// OldLogin returns the old "login" field's value of the User entity. -// If the User object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UserMutation) OldLogin(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldLogin is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldLogin requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldLogin: %w", err) - } - return oldValue.Login, nil -} - -// ResetLogin resets all changes to the "login" field. -func (m *UserMutation) ResetLogin() { - m.login = nil -} - -// SetName sets the "name" field. -func (m *UserMutation) SetName(s string) { - m.name = &s -} - -// Name returns the value of the "name" field in the mutation. -func (m *UserMutation) Name() (r string, exists bool) { - v := m.name - if v == nil { - return - } - return *v, true -} - -// OldName returns the old "name" field's value of the User entity. -// If the User object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UserMutation) OldName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldName: %w", err) - } - return oldValue.Name, nil -} - -// ResetName resets all changes to the "name" field. -func (m *UserMutation) ResetName() { - m.name = nil -} - -// SetAvatarURL sets the "avatar_url" field. -func (m *UserMutation) SetAvatarURL(s string) { - m.avatar_url = &s -} - -// AvatarURL returns the value of the "avatar_url" field in the mutation. -func (m *UserMutation) AvatarURL() (r string, exists bool) { - v := m.avatar_url - if v == nil { - return - } - return *v, true -} - -// OldAvatarURL returns the old "avatar_url" field's value of the User entity. -// If the User object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UserMutation) OldAvatarURL(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldAvatarURL is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldAvatarURL requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldAvatarURL: %w", err) - } - return oldValue.AvatarURL, nil -} - -// ResetAvatarURL resets all changes to the "avatar_url" field. -func (m *UserMutation) ResetAvatarURL() { - m.avatar_url = nil -} - -// SetURL sets the "url" field. -func (m *UserMutation) SetURL(s string) { - m.url = &s -} - -// URL returns the value of the "url" field in the mutation. -func (m *UserMutation) URL() (r string, exists bool) { - v := m.url - if v == nil { - return - } - return *v, true -} - -// OldURL returns the old "url" field's value of the User entity. -// If the User object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UserMutation) OldURL(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldURL is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldURL requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldURL: %w", err) - } - return oldValue.URL, nil -} - -// ResetURL resets all changes to the "url" field. -func (m *UserMutation) ResetURL() { - m.url = nil -} - -// AddEditedStatuIDs adds the "edited_status" edge to the VulnStatus entity by ids. -func (m *UserMutation) AddEditedStatuIDs(ids ...int) { - if m.edited_status == nil { - m.edited_status = make(map[int]struct{}) - } - for i := range ids { - m.edited_status[ids[i]] = struct{}{} - } -} - -// ClearEditedStatus clears the "edited_status" edge to the VulnStatus entity. -func (m *UserMutation) ClearEditedStatus() { - m.clearededited_status = true -} - -// EditedStatusCleared reports if the "edited_status" edge to the VulnStatus entity was cleared. -func (m *UserMutation) EditedStatusCleared() bool { - return m.clearededited_status -} - -// RemoveEditedStatuIDs removes the "edited_status" edge to the VulnStatus entity by IDs. -func (m *UserMutation) RemoveEditedStatuIDs(ids ...int) { - if m.removededited_status == nil { - m.removededited_status = make(map[int]struct{}) - } - for i := range ids { - delete(m.edited_status, ids[i]) - m.removededited_status[ids[i]] = struct{}{} - } -} - -// RemovedEditedStatus returns the removed IDs of the "edited_status" edge to the VulnStatus entity. -func (m *UserMutation) RemovedEditedStatusIDs() (ids []int) { - for id := range m.removededited_status { - ids = append(ids, id) - } - return -} - -// EditedStatusIDs returns the "edited_status" edge IDs in the mutation. -func (m *UserMutation) EditedStatusIDs() (ids []int) { - for id := range m.edited_status { - ids = append(ids, id) - } - return -} - -// ResetEditedStatus resets all changes to the "edited_status" edge. -func (m *UserMutation) ResetEditedStatus() { - m.edited_status = nil - m.clearededited_status = false - m.removededited_status = nil -} - -// Where appends a list predicates to the UserMutation builder. -func (m *UserMutation) Where(ps ...predicate.User) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *UserMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (User). -func (m *UserMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *UserMutation) Fields() []string { - fields := make([]string, 0, 5) - if m.github_id != nil { - fields = append(fields, user.FieldGithubID) - } - if m.login != nil { - fields = append(fields, user.FieldLogin) - } - if m.name != nil { - fields = append(fields, user.FieldName) - } - if m.avatar_url != nil { - fields = append(fields, user.FieldAvatarURL) - } - if m.url != nil { - fields = append(fields, user.FieldURL) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *UserMutation) Field(name string) (ent.Value, bool) { - switch name { - case user.FieldGithubID: - return m.GithubID() - case user.FieldLogin: - return m.Login() - case user.FieldName: - return m.Name() - case user.FieldAvatarURL: - return m.AvatarURL() - case user.FieldURL: - return m.URL() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case user.FieldGithubID: - return m.OldGithubID(ctx) - case user.FieldLogin: - return m.OldLogin(ctx) - case user.FieldName: - return m.OldName(ctx) - case user.FieldAvatarURL: - return m.OldAvatarURL(ctx) - case user.FieldURL: - return m.OldURL(ctx) - } - return nil, fmt.Errorf("unknown User field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *UserMutation) SetField(name string, value ent.Value) error { - switch name { - case user.FieldGithubID: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetGithubID(v) - return nil - case user.FieldLogin: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetLogin(v) - return nil - case user.FieldName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetName(v) - return nil - case user.FieldAvatarURL: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetAvatarURL(v) - return nil - case user.FieldURL: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetURL(v) - return nil - } - return fmt.Errorf("unknown User field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *UserMutation) AddedFields() []string { - var fields []string - if m.addgithub_id != nil { - fields = append(fields, user.FieldGithubID) - } - return fields -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *UserMutation) AddedField(name string) (ent.Value, bool) { - switch name { - case user.FieldGithubID: - return m.AddedGithubID() - } - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *UserMutation) AddField(name string, value ent.Value) error { - switch name { - case user.FieldGithubID: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddGithubID(v) - return nil - } - return fmt.Errorf("unknown User numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *UserMutation) ClearedFields() []string { - return nil -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *UserMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *UserMutation) ClearField(name string) error { - return fmt.Errorf("unknown User nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *UserMutation) ResetField(name string) error { - switch name { - case user.FieldGithubID: - m.ResetGithubID() - return nil - case user.FieldLogin: - m.ResetLogin() - return nil - case user.FieldName: - m.ResetName() - return nil - case user.FieldAvatarURL: - m.ResetAvatarURL() - return nil - case user.FieldURL: - m.ResetURL() - return nil - } - return fmt.Errorf("unknown User field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *UserMutation) AddedEdges() []string { - edges := make([]string, 0, 1) - if m.edited_status != nil { - edges = append(edges, user.EdgeEditedStatus) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *UserMutation) AddedIDs(name string) []ent.Value { - switch name { - case user.EdgeEditedStatus: - ids := make([]ent.Value, 0, len(m.edited_status)) - for id := range m.edited_status { - ids = append(ids, id) - } - return ids - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *UserMutation) RemovedEdges() []string { - edges := make([]string, 0, 1) - if m.removededited_status != nil { - edges = append(edges, user.EdgeEditedStatus) - } - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *UserMutation) RemovedIDs(name string) []ent.Value { - switch name { - case user.EdgeEditedStatus: - ids := make([]ent.Value, 0, len(m.removededited_status)) - for id := range m.removededited_status { - ids = append(ids, id) - } - return ids - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *UserMutation) ClearedEdges() []string { - edges := make([]string, 0, 1) - if m.clearededited_status { - edges = append(edges, user.EdgeEditedStatus) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *UserMutation) EdgeCleared(name string) bool { - switch name { - case user.EdgeEditedStatus: - return m.clearededited_status - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *UserMutation) ClearEdge(name string) error { - switch name { - } - return fmt.Errorf("unknown User unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *UserMutation) ResetEdge(name string) error { - switch name { - case user.EdgeEditedStatus: - m.ResetEditedStatus() - return nil - } - return fmt.Errorf("unknown User edge %s", name) -} - -// VulnStatusMutation represents an operation that mutates the VulnStatus nodes in the graph. -type VulnStatusMutation struct { - config - op Op - typ string - id *int - status *types.VulnStatusType - source *string - pkg_name *string - pkg_type *string - vuln_id *string - expires_at *int64 - addexpires_at *int64 - created_at *int64 - addcreated_at *int64 - comment *string - clearedFields map[string]struct{} - author *int - clearedauthor bool - done bool - oldValue func(context.Context) (*VulnStatus, error) - predicates []predicate.VulnStatus -} - -var _ ent.Mutation = (*VulnStatusMutation)(nil) - -// vulnstatusOption allows management of the mutation configuration using functional options. -type vulnstatusOption func(*VulnStatusMutation) - -// newVulnStatusMutation creates new mutation for the VulnStatus entity. -func newVulnStatusMutation(c config, op Op, opts ...vulnstatusOption) *VulnStatusMutation { - m := &VulnStatusMutation{ - config: c, - op: op, - typ: TypeVulnStatus, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withVulnStatusID sets the ID field of the mutation. -func withVulnStatusID(id int) vulnstatusOption { - return func(m *VulnStatusMutation) { - var ( - err error - once sync.Once - value *VulnStatus - ) - m.oldValue = func(ctx context.Context) (*VulnStatus, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().VulnStatus.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withVulnStatus sets the old VulnStatus of the mutation. -func withVulnStatus(node *VulnStatus) vulnstatusOption { - return func(m *VulnStatusMutation) { - m.oldValue = func(context.Context) (*VulnStatus, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m VulnStatusMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m VulnStatusMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *VulnStatusMutation) ID() (id int, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetStatus sets the "status" field. -func (m *VulnStatusMutation) SetStatus(tst types.VulnStatusType) { - m.status = &tst -} - -// Status returns the value of the "status" field in the mutation. -func (m *VulnStatusMutation) Status() (r types.VulnStatusType, exists bool) { - v := m.status - if v == nil { - return - } - return *v, true -} - -// OldStatus returns the old "status" field's value of the VulnStatus entity. -// If the VulnStatus object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnStatusMutation) OldStatus(ctx context.Context) (v types.VulnStatusType, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldStatus is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldStatus requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldStatus: %w", err) - } - return oldValue.Status, nil -} - -// ResetStatus resets all changes to the "status" field. -func (m *VulnStatusMutation) ResetStatus() { - m.status = nil -} - -// SetSource sets the "source" field. -func (m *VulnStatusMutation) SetSource(s string) { - m.source = &s -} - -// Source returns the value of the "source" field in the mutation. -func (m *VulnStatusMutation) Source() (r string, exists bool) { - v := m.source - if v == nil { - return - } - return *v, true -} - -// OldSource returns the old "source" field's value of the VulnStatus entity. -// If the VulnStatus object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnStatusMutation) OldSource(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldSource is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldSource requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSource: %w", err) - } - return oldValue.Source, nil -} - -// ResetSource resets all changes to the "source" field. -func (m *VulnStatusMutation) ResetSource() { - m.source = nil -} - -// SetPkgName sets the "pkg_name" field. -func (m *VulnStatusMutation) SetPkgName(s string) { - m.pkg_name = &s -} - -// PkgName returns the value of the "pkg_name" field in the mutation. -func (m *VulnStatusMutation) PkgName() (r string, exists bool) { - v := m.pkg_name - if v == nil { - return - } - return *v, true -} - -// OldPkgName returns the old "pkg_name" field's value of the VulnStatus entity. -// If the VulnStatus object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnStatusMutation) OldPkgName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldPkgName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldPkgName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldPkgName: %w", err) - } - return oldValue.PkgName, nil -} - -// ResetPkgName resets all changes to the "pkg_name" field. -func (m *VulnStatusMutation) ResetPkgName() { - m.pkg_name = nil -} - -// SetPkgType sets the "pkg_type" field. -func (m *VulnStatusMutation) SetPkgType(s string) { - m.pkg_type = &s -} - -// PkgType returns the value of the "pkg_type" field in the mutation. -func (m *VulnStatusMutation) PkgType() (r string, exists bool) { - v := m.pkg_type - if v == nil { - return - } - return *v, true -} - -// OldPkgType returns the old "pkg_type" field's value of the VulnStatus entity. -// If the VulnStatus object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnStatusMutation) OldPkgType(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldPkgType is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldPkgType requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldPkgType: %w", err) - } - return oldValue.PkgType, nil -} - -// ResetPkgType resets all changes to the "pkg_type" field. -func (m *VulnStatusMutation) ResetPkgType() { - m.pkg_type = nil -} - -// SetVulnID sets the "vuln_id" field. -func (m *VulnStatusMutation) SetVulnID(s string) { - m.vuln_id = &s -} - -// VulnID returns the value of the "vuln_id" field in the mutation. -func (m *VulnStatusMutation) VulnID() (r string, exists bool) { - v := m.vuln_id - if v == nil { - return - } - return *v, true -} - -// OldVulnID returns the old "vuln_id" field's value of the VulnStatus entity. -// If the VulnStatus object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnStatusMutation) OldVulnID(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldVulnID is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldVulnID requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldVulnID: %w", err) - } - return oldValue.VulnID, nil -} - -// ResetVulnID resets all changes to the "vuln_id" field. -func (m *VulnStatusMutation) ResetVulnID() { - m.vuln_id = nil -} - -// SetExpiresAt sets the "expires_at" field. -func (m *VulnStatusMutation) SetExpiresAt(i int64) { - m.expires_at = &i - m.addexpires_at = nil -} - -// ExpiresAt returns the value of the "expires_at" field in the mutation. -func (m *VulnStatusMutation) ExpiresAt() (r int64, exists bool) { - v := m.expires_at - if v == nil { - return - } - return *v, true -} - -// OldExpiresAt returns the old "expires_at" field's value of the VulnStatus entity. -// If the VulnStatus object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnStatusMutation) OldExpiresAt(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldExpiresAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldExpiresAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldExpiresAt: %w", err) - } - return oldValue.ExpiresAt, nil -} - -// AddExpiresAt adds i to the "expires_at" field. -func (m *VulnStatusMutation) AddExpiresAt(i int64) { - if m.addexpires_at != nil { - *m.addexpires_at += i - } else { - m.addexpires_at = &i - } -} - -// AddedExpiresAt returns the value that was added to the "expires_at" field in this mutation. -func (m *VulnStatusMutation) AddedExpiresAt() (r int64, exists bool) { - v := m.addexpires_at - if v == nil { - return - } - return *v, true -} - -// ResetExpiresAt resets all changes to the "expires_at" field. -func (m *VulnStatusMutation) ResetExpiresAt() { - m.expires_at = nil - m.addexpires_at = nil -} - -// SetCreatedAt sets the "created_at" field. -func (m *VulnStatusMutation) SetCreatedAt(i int64) { - m.created_at = &i - m.addcreated_at = nil -} - -// CreatedAt returns the value of the "created_at" field in the mutation. -func (m *VulnStatusMutation) CreatedAt() (r int64, exists bool) { - v := m.created_at - if v == nil { - return - } - return *v, true -} - -// OldCreatedAt returns the old "created_at" field's value of the VulnStatus entity. -// If the VulnStatus object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnStatusMutation) OldCreatedAt(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCreatedAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCreatedAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) - } - return oldValue.CreatedAt, nil -} - -// AddCreatedAt adds i to the "created_at" field. -func (m *VulnStatusMutation) AddCreatedAt(i int64) { - if m.addcreated_at != nil { - *m.addcreated_at += i - } else { - m.addcreated_at = &i - } -} - -// AddedCreatedAt returns the value that was added to the "created_at" field in this mutation. -func (m *VulnStatusMutation) AddedCreatedAt() (r int64, exists bool) { - v := m.addcreated_at - if v == nil { - return - } - return *v, true -} - -// ResetCreatedAt resets all changes to the "created_at" field. -func (m *VulnStatusMutation) ResetCreatedAt() { - m.created_at = nil - m.addcreated_at = nil -} - -// SetComment sets the "comment" field. -func (m *VulnStatusMutation) SetComment(s string) { - m.comment = &s -} - -// Comment returns the value of the "comment" field in the mutation. -func (m *VulnStatusMutation) Comment() (r string, exists bool) { - v := m.comment - if v == nil { - return - } - return *v, true -} - -// OldComment returns the old "comment" field's value of the VulnStatus entity. -// If the VulnStatus object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnStatusMutation) OldComment(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldComment is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldComment requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldComment: %w", err) - } - return oldValue.Comment, nil -} - -// ResetComment resets all changes to the "comment" field. -func (m *VulnStatusMutation) ResetComment() { - m.comment = nil -} - -// SetAuthorID sets the "author" edge to the User entity by id. -func (m *VulnStatusMutation) SetAuthorID(id int) { - m.author = &id -} - -// ClearAuthor clears the "author" edge to the User entity. -func (m *VulnStatusMutation) ClearAuthor() { - m.clearedauthor = true -} - -// AuthorCleared reports if the "author" edge to the User entity was cleared. -func (m *VulnStatusMutation) AuthorCleared() bool { - return m.clearedauthor -} - -// AuthorID returns the "author" edge ID in the mutation. -func (m *VulnStatusMutation) AuthorID() (id int, exists bool) { - if m.author != nil { - return *m.author, true - } - return -} - -// AuthorIDs returns the "author" edge IDs in the mutation. -// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// AuthorID instead. It exists only for internal usage by the builders. -func (m *VulnStatusMutation) AuthorIDs() (ids []int) { - if id := m.author; id != nil { - ids = append(ids, *id) - } - return -} - -// ResetAuthor resets all changes to the "author" edge. -func (m *VulnStatusMutation) ResetAuthor() { - m.author = nil - m.clearedauthor = false -} - -// Where appends a list predicates to the VulnStatusMutation builder. -func (m *VulnStatusMutation) Where(ps ...predicate.VulnStatus) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *VulnStatusMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (VulnStatus). -func (m *VulnStatusMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *VulnStatusMutation) Fields() []string { - fields := make([]string, 0, 8) - if m.status != nil { - fields = append(fields, vulnstatus.FieldStatus) - } - if m.source != nil { - fields = append(fields, vulnstatus.FieldSource) - } - if m.pkg_name != nil { - fields = append(fields, vulnstatus.FieldPkgName) - } - if m.pkg_type != nil { - fields = append(fields, vulnstatus.FieldPkgType) - } - if m.vuln_id != nil { - fields = append(fields, vulnstatus.FieldVulnID) - } - if m.expires_at != nil { - fields = append(fields, vulnstatus.FieldExpiresAt) - } - if m.created_at != nil { - fields = append(fields, vulnstatus.FieldCreatedAt) - } - if m.comment != nil { - fields = append(fields, vulnstatus.FieldComment) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *VulnStatusMutation) Field(name string) (ent.Value, bool) { - switch name { - case vulnstatus.FieldStatus: - return m.Status() - case vulnstatus.FieldSource: - return m.Source() - case vulnstatus.FieldPkgName: - return m.PkgName() - case vulnstatus.FieldPkgType: - return m.PkgType() - case vulnstatus.FieldVulnID: - return m.VulnID() - case vulnstatus.FieldExpiresAt: - return m.ExpiresAt() - case vulnstatus.FieldCreatedAt: - return m.CreatedAt() - case vulnstatus.FieldComment: - return m.Comment() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *VulnStatusMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case vulnstatus.FieldStatus: - return m.OldStatus(ctx) - case vulnstatus.FieldSource: - return m.OldSource(ctx) - case vulnstatus.FieldPkgName: - return m.OldPkgName(ctx) - case vulnstatus.FieldPkgType: - return m.OldPkgType(ctx) - case vulnstatus.FieldVulnID: - return m.OldVulnID(ctx) - case vulnstatus.FieldExpiresAt: - return m.OldExpiresAt(ctx) - case vulnstatus.FieldCreatedAt: - return m.OldCreatedAt(ctx) - case vulnstatus.FieldComment: - return m.OldComment(ctx) - } - return nil, fmt.Errorf("unknown VulnStatus field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *VulnStatusMutation) SetField(name string, value ent.Value) error { - switch name { - case vulnstatus.FieldStatus: - v, ok := value.(types.VulnStatusType) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetStatus(v) - return nil - case vulnstatus.FieldSource: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSource(v) - return nil - case vulnstatus.FieldPkgName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetPkgName(v) - return nil - case vulnstatus.FieldPkgType: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetPkgType(v) - return nil - case vulnstatus.FieldVulnID: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetVulnID(v) - return nil - case vulnstatus.FieldExpiresAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetExpiresAt(v) - return nil - case vulnstatus.FieldCreatedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCreatedAt(v) - return nil - case vulnstatus.FieldComment: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetComment(v) - return nil - } - return fmt.Errorf("unknown VulnStatus field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *VulnStatusMutation) AddedFields() []string { - var fields []string - if m.addexpires_at != nil { - fields = append(fields, vulnstatus.FieldExpiresAt) - } - if m.addcreated_at != nil { - fields = append(fields, vulnstatus.FieldCreatedAt) - } - return fields -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *VulnStatusMutation) AddedField(name string) (ent.Value, bool) { - switch name { - case vulnstatus.FieldExpiresAt: - return m.AddedExpiresAt() - case vulnstatus.FieldCreatedAt: - return m.AddedCreatedAt() - } - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *VulnStatusMutation) AddField(name string, value ent.Value) error { - switch name { - case vulnstatus.FieldExpiresAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddExpiresAt(v) - return nil - case vulnstatus.FieldCreatedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddCreatedAt(v) - return nil - } - return fmt.Errorf("unknown VulnStatus numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *VulnStatusMutation) ClearedFields() []string { - return nil -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *VulnStatusMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *VulnStatusMutation) ClearField(name string) error { - return fmt.Errorf("unknown VulnStatus nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *VulnStatusMutation) ResetField(name string) error { - switch name { - case vulnstatus.FieldStatus: - m.ResetStatus() - return nil - case vulnstatus.FieldSource: - m.ResetSource() - return nil - case vulnstatus.FieldPkgName: - m.ResetPkgName() - return nil - case vulnstatus.FieldPkgType: - m.ResetPkgType() - return nil - case vulnstatus.FieldVulnID: - m.ResetVulnID() - return nil - case vulnstatus.FieldExpiresAt: - m.ResetExpiresAt() - return nil - case vulnstatus.FieldCreatedAt: - m.ResetCreatedAt() - return nil - case vulnstatus.FieldComment: - m.ResetComment() - return nil - } - return fmt.Errorf("unknown VulnStatus field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *VulnStatusMutation) AddedEdges() []string { - edges := make([]string, 0, 1) - if m.author != nil { - edges = append(edges, vulnstatus.EdgeAuthor) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *VulnStatusMutation) AddedIDs(name string) []ent.Value { - switch name { - case vulnstatus.EdgeAuthor: - if id := m.author; id != nil { - return []ent.Value{*id} - } - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *VulnStatusMutation) RemovedEdges() []string { - edges := make([]string, 0, 1) - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *VulnStatusMutation) RemovedIDs(name string) []ent.Value { - switch name { - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *VulnStatusMutation) ClearedEdges() []string { - edges := make([]string, 0, 1) - if m.clearedauthor { - edges = append(edges, vulnstatus.EdgeAuthor) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *VulnStatusMutation) EdgeCleared(name string) bool { - switch name { - case vulnstatus.EdgeAuthor: - return m.clearedauthor - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *VulnStatusMutation) ClearEdge(name string) error { - switch name { - case vulnstatus.EdgeAuthor: - m.ClearAuthor() - return nil - } - return fmt.Errorf("unknown VulnStatus unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *VulnStatusMutation) ResetEdge(name string) error { - switch name { - case vulnstatus.EdgeAuthor: - m.ResetAuthor() - return nil - } - return fmt.Errorf("unknown VulnStatus edge %s", name) -} - -// VulnStatusIndexMutation represents an operation that mutates the VulnStatusIndex nodes in the graph. -type VulnStatusIndexMutation struct { - config - op Op - typ string - id *string - clearedFields map[string]struct{} - latest *int - clearedlatest bool - status map[int]struct{} - removedstatus map[int]struct{} - clearedstatus bool - done bool - oldValue func(context.Context) (*VulnStatusIndex, error) - predicates []predicate.VulnStatusIndex -} - -var _ ent.Mutation = (*VulnStatusIndexMutation)(nil) - -// vulnstatusindexOption allows management of the mutation configuration using functional options. -type vulnstatusindexOption func(*VulnStatusIndexMutation) - -// newVulnStatusIndexMutation creates new mutation for the VulnStatusIndex entity. -func newVulnStatusIndexMutation(c config, op Op, opts ...vulnstatusindexOption) *VulnStatusIndexMutation { - m := &VulnStatusIndexMutation{ - config: c, - op: op, - typ: TypeVulnStatusIndex, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withVulnStatusIndexID sets the ID field of the mutation. -func withVulnStatusIndexID(id string) vulnstatusindexOption { - return func(m *VulnStatusIndexMutation) { - var ( - err error - once sync.Once - value *VulnStatusIndex - ) - m.oldValue = func(ctx context.Context) (*VulnStatusIndex, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().VulnStatusIndex.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withVulnStatusIndex sets the old VulnStatusIndex of the mutation. -func withVulnStatusIndex(node *VulnStatusIndex) vulnstatusindexOption { - return func(m *VulnStatusIndexMutation) { - m.oldValue = func(context.Context) (*VulnStatusIndex, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m VulnStatusIndexMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m VulnStatusIndexMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// SetID sets the value of the id field. Note that this -// operation is only accepted on creation of VulnStatusIndex entities. -func (m *VulnStatusIndexMutation) SetID(id string) { - m.id = &id -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *VulnStatusIndexMutation) ID() (id string, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetLatestID sets the "latest" edge to the VulnStatus entity by id. -func (m *VulnStatusIndexMutation) SetLatestID(id int) { - m.latest = &id -} - -// ClearLatest clears the "latest" edge to the VulnStatus entity. -func (m *VulnStatusIndexMutation) ClearLatest() { - m.clearedlatest = true -} - -// LatestCleared reports if the "latest" edge to the VulnStatus entity was cleared. -func (m *VulnStatusIndexMutation) LatestCleared() bool { - return m.clearedlatest -} - -// LatestID returns the "latest" edge ID in the mutation. -func (m *VulnStatusIndexMutation) LatestID() (id int, exists bool) { - if m.latest != nil { - return *m.latest, true - } - return -} - -// LatestIDs returns the "latest" edge IDs in the mutation. -// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// LatestID instead. It exists only for internal usage by the builders. -func (m *VulnStatusIndexMutation) LatestIDs() (ids []int) { - if id := m.latest; id != nil { - ids = append(ids, *id) - } - return -} - -// ResetLatest resets all changes to the "latest" edge. -func (m *VulnStatusIndexMutation) ResetLatest() { - m.latest = nil - m.clearedlatest = false -} - -// AddStatuIDs adds the "status" edge to the VulnStatus entity by ids. -func (m *VulnStatusIndexMutation) AddStatuIDs(ids ...int) { - if m.status == nil { - m.status = make(map[int]struct{}) - } - for i := range ids { - m.status[ids[i]] = struct{}{} - } -} - -// ClearStatus clears the "status" edge to the VulnStatus entity. -func (m *VulnStatusIndexMutation) ClearStatus() { - m.clearedstatus = true -} - -// StatusCleared reports if the "status" edge to the VulnStatus entity was cleared. -func (m *VulnStatusIndexMutation) StatusCleared() bool { - return m.clearedstatus -} - -// RemoveStatuIDs removes the "status" edge to the VulnStatus entity by IDs. -func (m *VulnStatusIndexMutation) RemoveStatuIDs(ids ...int) { - if m.removedstatus == nil { - m.removedstatus = make(map[int]struct{}) - } - for i := range ids { - delete(m.status, ids[i]) - m.removedstatus[ids[i]] = struct{}{} - } -} - -// RemovedStatus returns the removed IDs of the "status" edge to the VulnStatus entity. -func (m *VulnStatusIndexMutation) RemovedStatusIDs() (ids []int) { - for id := range m.removedstatus { - ids = append(ids, id) - } - return -} - -// StatusIDs returns the "status" edge IDs in the mutation. -func (m *VulnStatusIndexMutation) StatusIDs() (ids []int) { - for id := range m.status { - ids = append(ids, id) - } - return -} - -// ResetStatus resets all changes to the "status" edge. -func (m *VulnStatusIndexMutation) ResetStatus() { - m.status = nil - m.clearedstatus = false - m.removedstatus = nil -} - -// Where appends a list predicates to the VulnStatusIndexMutation builder. -func (m *VulnStatusIndexMutation) Where(ps ...predicate.VulnStatusIndex) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *VulnStatusIndexMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (VulnStatusIndex). -func (m *VulnStatusIndexMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *VulnStatusIndexMutation) Fields() []string { - fields := make([]string, 0, 0) - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *VulnStatusIndexMutation) Field(name string) (ent.Value, bool) { - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *VulnStatusIndexMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - return nil, fmt.Errorf("unknown VulnStatusIndex field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *VulnStatusIndexMutation) SetField(name string, value ent.Value) error { - switch name { - } - return fmt.Errorf("unknown VulnStatusIndex field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *VulnStatusIndexMutation) AddedFields() []string { - return nil -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *VulnStatusIndexMutation) AddedField(name string) (ent.Value, bool) { - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *VulnStatusIndexMutation) AddField(name string, value ent.Value) error { - return fmt.Errorf("unknown VulnStatusIndex numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *VulnStatusIndexMutation) ClearedFields() []string { - return nil -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *VulnStatusIndexMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *VulnStatusIndexMutation) ClearField(name string) error { - return fmt.Errorf("unknown VulnStatusIndex nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *VulnStatusIndexMutation) ResetField(name string) error { - return fmt.Errorf("unknown VulnStatusIndex field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *VulnStatusIndexMutation) AddedEdges() []string { - edges := make([]string, 0, 2) - if m.latest != nil { - edges = append(edges, vulnstatusindex.EdgeLatest) - } - if m.status != nil { - edges = append(edges, vulnstatusindex.EdgeStatus) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *VulnStatusIndexMutation) AddedIDs(name string) []ent.Value { - switch name { - case vulnstatusindex.EdgeLatest: - if id := m.latest; id != nil { - return []ent.Value{*id} - } - case vulnstatusindex.EdgeStatus: - ids := make([]ent.Value, 0, len(m.status)) - for id := range m.status { - ids = append(ids, id) - } - return ids - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *VulnStatusIndexMutation) RemovedEdges() []string { - edges := make([]string, 0, 2) - if m.removedstatus != nil { - edges = append(edges, vulnstatusindex.EdgeStatus) - } - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *VulnStatusIndexMutation) RemovedIDs(name string) []ent.Value { - switch name { - case vulnstatusindex.EdgeStatus: - ids := make([]ent.Value, 0, len(m.removedstatus)) - for id := range m.removedstatus { - ids = append(ids, id) - } - return ids - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *VulnStatusIndexMutation) ClearedEdges() []string { - edges := make([]string, 0, 2) - if m.clearedlatest { - edges = append(edges, vulnstatusindex.EdgeLatest) - } - if m.clearedstatus { - edges = append(edges, vulnstatusindex.EdgeStatus) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *VulnStatusIndexMutation) EdgeCleared(name string) bool { - switch name { - case vulnstatusindex.EdgeLatest: - return m.clearedlatest - case vulnstatusindex.EdgeStatus: - return m.clearedstatus - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *VulnStatusIndexMutation) ClearEdge(name string) error { - switch name { - case vulnstatusindex.EdgeLatest: - m.ClearLatest() - return nil - } - return fmt.Errorf("unknown VulnStatusIndex unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *VulnStatusIndexMutation) ResetEdge(name string) error { - switch name { - case vulnstatusindex.EdgeLatest: - m.ResetLatest() - return nil - case vulnstatusindex.EdgeStatus: - m.ResetStatus() - return nil - } - return fmt.Errorf("unknown VulnStatusIndex edge %s", name) -} - -// VulnerabilityMutation represents an operation that mutates the Vulnerability nodes in the graph. -type VulnerabilityMutation struct { - config - op Op - typ string - id *string - first_seen_at *int64 - addfirst_seen_at *int64 - last_modified_at *int64 - addlast_modified_at *int64 - title *string - description *string - cwe_id *[]string - severity *string - cvss *[]string - references *[]string - clearedFields map[string]struct{} - packages map[int]struct{} - removedpackages map[int]struct{} - clearedpackages bool - custom_severity *int - clearedcustom_severity bool - done bool - oldValue func(context.Context) (*Vulnerability, error) - predicates []predicate.Vulnerability -} - -var _ ent.Mutation = (*VulnerabilityMutation)(nil) - -// vulnerabilityOption allows management of the mutation configuration using functional options. -type vulnerabilityOption func(*VulnerabilityMutation) - -// newVulnerabilityMutation creates new mutation for the Vulnerability entity. -func newVulnerabilityMutation(c config, op Op, opts ...vulnerabilityOption) *VulnerabilityMutation { - m := &VulnerabilityMutation{ - config: c, - op: op, - typ: TypeVulnerability, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withVulnerabilityID sets the ID field of the mutation. -func withVulnerabilityID(id string) vulnerabilityOption { - return func(m *VulnerabilityMutation) { - var ( - err error - once sync.Once - value *Vulnerability - ) - m.oldValue = func(ctx context.Context) (*Vulnerability, error) { - once.Do(func() { - if m.done { - err = fmt.Errorf("querying old values post mutation is not allowed") - } else { - value, err = m.Client().Vulnerability.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withVulnerability sets the old Vulnerability of the mutation. -func withVulnerability(node *Vulnerability) vulnerabilityOption { - return func(m *VulnerabilityMutation) { - m.oldValue = func(context.Context) (*Vulnerability, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m VulnerabilityMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m VulnerabilityMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, fmt.Errorf("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// SetID sets the value of the id field. Note that this -// operation is only accepted on creation of Vulnerability entities. -func (m *VulnerabilityMutation) SetID(id string) { - m.id = &id -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *VulnerabilityMutation) ID() (id string, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// SetFirstSeenAt sets the "first_seen_at" field. -func (m *VulnerabilityMutation) SetFirstSeenAt(i int64) { - m.first_seen_at = &i - m.addfirst_seen_at = nil -} - -// FirstSeenAt returns the value of the "first_seen_at" field in the mutation. -func (m *VulnerabilityMutation) FirstSeenAt() (r int64, exists bool) { - v := m.first_seen_at - if v == nil { - return - } - return *v, true -} - -// OldFirstSeenAt returns the old "first_seen_at" field's value of the Vulnerability entity. -// If the Vulnerability object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnerabilityMutation) OldFirstSeenAt(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldFirstSeenAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldFirstSeenAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldFirstSeenAt: %w", err) - } - return oldValue.FirstSeenAt, nil -} - -// AddFirstSeenAt adds i to the "first_seen_at" field. -func (m *VulnerabilityMutation) AddFirstSeenAt(i int64) { - if m.addfirst_seen_at != nil { - *m.addfirst_seen_at += i - } else { - m.addfirst_seen_at = &i - } -} - -// AddedFirstSeenAt returns the value that was added to the "first_seen_at" field in this mutation. -func (m *VulnerabilityMutation) AddedFirstSeenAt() (r int64, exists bool) { - v := m.addfirst_seen_at - if v == nil { - return - } - return *v, true -} - -// ResetFirstSeenAt resets all changes to the "first_seen_at" field. -func (m *VulnerabilityMutation) ResetFirstSeenAt() { - m.first_seen_at = nil - m.addfirst_seen_at = nil -} - -// SetLastModifiedAt sets the "last_modified_at" field. -func (m *VulnerabilityMutation) SetLastModifiedAt(i int64) { - m.last_modified_at = &i - m.addlast_modified_at = nil -} - -// LastModifiedAt returns the value of the "last_modified_at" field in the mutation. -func (m *VulnerabilityMutation) LastModifiedAt() (r int64, exists bool) { - v := m.last_modified_at - if v == nil { - return - } - return *v, true -} - -// OldLastModifiedAt returns the old "last_modified_at" field's value of the Vulnerability entity. -// If the Vulnerability object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnerabilityMutation) OldLastModifiedAt(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldLastModifiedAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldLastModifiedAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldLastModifiedAt: %w", err) - } - return oldValue.LastModifiedAt, nil -} - -// AddLastModifiedAt adds i to the "last_modified_at" field. -func (m *VulnerabilityMutation) AddLastModifiedAt(i int64) { - if m.addlast_modified_at != nil { - *m.addlast_modified_at += i - } else { - m.addlast_modified_at = &i - } -} - -// AddedLastModifiedAt returns the value that was added to the "last_modified_at" field in this mutation. -func (m *VulnerabilityMutation) AddedLastModifiedAt() (r int64, exists bool) { - v := m.addlast_modified_at - if v == nil { - return - } - return *v, true -} - -// ResetLastModifiedAt resets all changes to the "last_modified_at" field. -func (m *VulnerabilityMutation) ResetLastModifiedAt() { - m.last_modified_at = nil - m.addlast_modified_at = nil -} - -// SetTitle sets the "title" field. -func (m *VulnerabilityMutation) SetTitle(s string) { - m.title = &s -} - -// Title returns the value of the "title" field in the mutation. -func (m *VulnerabilityMutation) Title() (r string, exists bool) { - v := m.title - if v == nil { - return - } - return *v, true -} - -// OldTitle returns the old "title" field's value of the Vulnerability entity. -// If the Vulnerability object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnerabilityMutation) OldTitle(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldTitle is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldTitle requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldTitle: %w", err) - } - return oldValue.Title, nil -} - -// ClearTitle clears the value of the "title" field. -func (m *VulnerabilityMutation) ClearTitle() { - m.title = nil - m.clearedFields[vulnerability.FieldTitle] = struct{}{} -} - -// TitleCleared returns if the "title" field was cleared in this mutation. -func (m *VulnerabilityMutation) TitleCleared() bool { - _, ok := m.clearedFields[vulnerability.FieldTitle] - return ok -} - -// ResetTitle resets all changes to the "title" field. -func (m *VulnerabilityMutation) ResetTitle() { - m.title = nil - delete(m.clearedFields, vulnerability.FieldTitle) -} - -// SetDescription sets the "description" field. -func (m *VulnerabilityMutation) SetDescription(s string) { - m.description = &s -} - -// Description returns the value of the "description" field in the mutation. -func (m *VulnerabilityMutation) Description() (r string, exists bool) { - v := m.description - if v == nil { - return - } - return *v, true -} - -// OldDescription returns the old "description" field's value of the Vulnerability entity. -// If the Vulnerability object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnerabilityMutation) OldDescription(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldDescription is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldDescription requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldDescription: %w", err) - } - return oldValue.Description, nil -} - -// ClearDescription clears the value of the "description" field. -func (m *VulnerabilityMutation) ClearDescription() { - m.description = nil - m.clearedFields[vulnerability.FieldDescription] = struct{}{} -} - -// DescriptionCleared returns if the "description" field was cleared in this mutation. -func (m *VulnerabilityMutation) DescriptionCleared() bool { - _, ok := m.clearedFields[vulnerability.FieldDescription] - return ok -} - -// ResetDescription resets all changes to the "description" field. -func (m *VulnerabilityMutation) ResetDescription() { - m.description = nil - delete(m.clearedFields, vulnerability.FieldDescription) -} - -// SetCweID sets the "cwe_id" field. -func (m *VulnerabilityMutation) SetCweID(s []string) { - m.cwe_id = &s -} - -// CweID returns the value of the "cwe_id" field in the mutation. -func (m *VulnerabilityMutation) CweID() (r []string, exists bool) { - v := m.cwe_id - if v == nil { - return - } - return *v, true -} - -// OldCweID returns the old "cwe_id" field's value of the Vulnerability entity. -// If the Vulnerability object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnerabilityMutation) OldCweID(ctx context.Context) (v []string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCweID is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCweID requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldCweID: %w", err) - } - return oldValue.CweID, nil -} - -// ClearCweID clears the value of the "cwe_id" field. -func (m *VulnerabilityMutation) ClearCweID() { - m.cwe_id = nil - m.clearedFields[vulnerability.FieldCweID] = struct{}{} -} - -// CweIDCleared returns if the "cwe_id" field was cleared in this mutation. -func (m *VulnerabilityMutation) CweIDCleared() bool { - _, ok := m.clearedFields[vulnerability.FieldCweID] - return ok -} - -// ResetCweID resets all changes to the "cwe_id" field. -func (m *VulnerabilityMutation) ResetCweID() { - m.cwe_id = nil - delete(m.clearedFields, vulnerability.FieldCweID) -} - -// SetSeverity sets the "severity" field. -func (m *VulnerabilityMutation) SetSeverity(s string) { - m.severity = &s -} - -// Severity returns the value of the "severity" field in the mutation. -func (m *VulnerabilityMutation) Severity() (r string, exists bool) { - v := m.severity - if v == nil { - return - } - return *v, true -} - -// OldSeverity returns the old "severity" field's value of the Vulnerability entity. -// If the Vulnerability object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnerabilityMutation) OldSeverity(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldSeverity is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldSeverity requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSeverity: %w", err) - } - return oldValue.Severity, nil -} - -// ClearSeverity clears the value of the "severity" field. -func (m *VulnerabilityMutation) ClearSeverity() { - m.severity = nil - m.clearedFields[vulnerability.FieldSeverity] = struct{}{} -} - -// SeverityCleared returns if the "severity" field was cleared in this mutation. -func (m *VulnerabilityMutation) SeverityCleared() bool { - _, ok := m.clearedFields[vulnerability.FieldSeverity] - return ok -} - -// ResetSeverity resets all changes to the "severity" field. -func (m *VulnerabilityMutation) ResetSeverity() { - m.severity = nil - delete(m.clearedFields, vulnerability.FieldSeverity) -} - -// SetCvss sets the "cvss" field. -func (m *VulnerabilityMutation) SetCvss(s []string) { - m.cvss = &s -} - -// Cvss returns the value of the "cvss" field in the mutation. -func (m *VulnerabilityMutation) Cvss() (r []string, exists bool) { - v := m.cvss - if v == nil { - return - } - return *v, true -} - -// OldCvss returns the old "cvss" field's value of the Vulnerability entity. -// If the Vulnerability object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnerabilityMutation) OldCvss(ctx context.Context) (v []string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldCvss is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldCvss requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldCvss: %w", err) - } - return oldValue.Cvss, nil -} - -// ClearCvss clears the value of the "cvss" field. -func (m *VulnerabilityMutation) ClearCvss() { - m.cvss = nil - m.clearedFields[vulnerability.FieldCvss] = struct{}{} -} - -// CvssCleared returns if the "cvss" field was cleared in this mutation. -func (m *VulnerabilityMutation) CvssCleared() bool { - _, ok := m.clearedFields[vulnerability.FieldCvss] - return ok -} - -// ResetCvss resets all changes to the "cvss" field. -func (m *VulnerabilityMutation) ResetCvss() { - m.cvss = nil - delete(m.clearedFields, vulnerability.FieldCvss) -} - -// SetReferences sets the "references" field. -func (m *VulnerabilityMutation) SetReferences(s []string) { - m.references = &s -} - -// References returns the value of the "references" field in the mutation. -func (m *VulnerabilityMutation) References() (r []string, exists bool) { - v := m.references - if v == nil { - return - } - return *v, true -} - -// OldReferences returns the old "references" field's value of the Vulnerability entity. -// If the Vulnerability object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *VulnerabilityMutation) OldReferences(ctx context.Context) (v []string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, fmt.Errorf("OldReferences is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, fmt.Errorf("OldReferences requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldReferences: %w", err) - } - return oldValue.References, nil -} - -// ClearReferences clears the value of the "references" field. -func (m *VulnerabilityMutation) ClearReferences() { - m.references = nil - m.clearedFields[vulnerability.FieldReferences] = struct{}{} -} - -// ReferencesCleared returns if the "references" field was cleared in this mutation. -func (m *VulnerabilityMutation) ReferencesCleared() bool { - _, ok := m.clearedFields[vulnerability.FieldReferences] - return ok -} - -// ResetReferences resets all changes to the "references" field. -func (m *VulnerabilityMutation) ResetReferences() { - m.references = nil - delete(m.clearedFields, vulnerability.FieldReferences) -} - -// AddPackageIDs adds the "packages" edge to the PackageRecord entity by ids. -func (m *VulnerabilityMutation) AddPackageIDs(ids ...int) { - if m.packages == nil { - m.packages = make(map[int]struct{}) - } - for i := range ids { - m.packages[ids[i]] = struct{}{} - } -} - -// ClearPackages clears the "packages" edge to the PackageRecord entity. -func (m *VulnerabilityMutation) ClearPackages() { - m.clearedpackages = true -} - -// PackagesCleared reports if the "packages" edge to the PackageRecord entity was cleared. -func (m *VulnerabilityMutation) PackagesCleared() bool { - return m.clearedpackages -} - -// RemovePackageIDs removes the "packages" edge to the PackageRecord entity by IDs. -func (m *VulnerabilityMutation) RemovePackageIDs(ids ...int) { - if m.removedpackages == nil { - m.removedpackages = make(map[int]struct{}) - } - for i := range ids { - delete(m.packages, ids[i]) - m.removedpackages[ids[i]] = struct{}{} - } -} - -// RemovedPackages returns the removed IDs of the "packages" edge to the PackageRecord entity. -func (m *VulnerabilityMutation) RemovedPackagesIDs() (ids []int) { - for id := range m.removedpackages { - ids = append(ids, id) - } - return -} - -// PackagesIDs returns the "packages" edge IDs in the mutation. -func (m *VulnerabilityMutation) PackagesIDs() (ids []int) { - for id := range m.packages { - ids = append(ids, id) - } - return -} - -// ResetPackages resets all changes to the "packages" edge. -func (m *VulnerabilityMutation) ResetPackages() { - m.packages = nil - m.clearedpackages = false - m.removedpackages = nil -} - -// SetCustomSeverityID sets the "custom_severity" edge to the Severity entity by id. -func (m *VulnerabilityMutation) SetCustomSeverityID(id int) { - m.custom_severity = &id -} - -// ClearCustomSeverity clears the "custom_severity" edge to the Severity entity. -func (m *VulnerabilityMutation) ClearCustomSeverity() { - m.clearedcustom_severity = true -} - -// CustomSeverityCleared reports if the "custom_severity" edge to the Severity entity was cleared. -func (m *VulnerabilityMutation) CustomSeverityCleared() bool { - return m.clearedcustom_severity -} - -// CustomSeverityID returns the "custom_severity" edge ID in the mutation. -func (m *VulnerabilityMutation) CustomSeverityID() (id int, exists bool) { - if m.custom_severity != nil { - return *m.custom_severity, true - } - return -} - -// CustomSeverityIDs returns the "custom_severity" edge IDs in the mutation. -// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// CustomSeverityID instead. It exists only for internal usage by the builders. -func (m *VulnerabilityMutation) CustomSeverityIDs() (ids []int) { - if id := m.custom_severity; id != nil { - ids = append(ids, *id) - } - return -} - -// ResetCustomSeverity resets all changes to the "custom_severity" edge. -func (m *VulnerabilityMutation) ResetCustomSeverity() { - m.custom_severity = nil - m.clearedcustom_severity = false -} - -// Where appends a list predicates to the VulnerabilityMutation builder. -func (m *VulnerabilityMutation) Where(ps ...predicate.Vulnerability) { - m.predicates = append(m.predicates, ps...) -} - -// Op returns the operation name. -func (m *VulnerabilityMutation) Op() Op { - return m.op -} - -// Type returns the node type of this mutation (Vulnerability). -func (m *VulnerabilityMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *VulnerabilityMutation) Fields() []string { - fields := make([]string, 0, 8) - if m.first_seen_at != nil { - fields = append(fields, vulnerability.FieldFirstSeenAt) - } - if m.last_modified_at != nil { - fields = append(fields, vulnerability.FieldLastModifiedAt) - } - if m.title != nil { - fields = append(fields, vulnerability.FieldTitle) - } - if m.description != nil { - fields = append(fields, vulnerability.FieldDescription) - } - if m.cwe_id != nil { - fields = append(fields, vulnerability.FieldCweID) - } - if m.severity != nil { - fields = append(fields, vulnerability.FieldSeverity) - } - if m.cvss != nil { - fields = append(fields, vulnerability.FieldCvss) - } - if m.references != nil { - fields = append(fields, vulnerability.FieldReferences) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *VulnerabilityMutation) Field(name string) (ent.Value, bool) { - switch name { - case vulnerability.FieldFirstSeenAt: - return m.FirstSeenAt() - case vulnerability.FieldLastModifiedAt: - return m.LastModifiedAt() - case vulnerability.FieldTitle: - return m.Title() - case vulnerability.FieldDescription: - return m.Description() - case vulnerability.FieldCweID: - return m.CweID() - case vulnerability.FieldSeverity: - return m.Severity() - case vulnerability.FieldCvss: - return m.Cvss() - case vulnerability.FieldReferences: - return m.References() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *VulnerabilityMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case vulnerability.FieldFirstSeenAt: - return m.OldFirstSeenAt(ctx) - case vulnerability.FieldLastModifiedAt: - return m.OldLastModifiedAt(ctx) - case vulnerability.FieldTitle: - return m.OldTitle(ctx) - case vulnerability.FieldDescription: - return m.OldDescription(ctx) - case vulnerability.FieldCweID: - return m.OldCweID(ctx) - case vulnerability.FieldSeverity: - return m.OldSeverity(ctx) - case vulnerability.FieldCvss: - return m.OldCvss(ctx) - case vulnerability.FieldReferences: - return m.OldReferences(ctx) - } - return nil, fmt.Errorf("unknown Vulnerability field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *VulnerabilityMutation) SetField(name string, value ent.Value) error { - switch name { - case vulnerability.FieldFirstSeenAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetFirstSeenAt(v) - return nil - case vulnerability.FieldLastModifiedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetLastModifiedAt(v) - return nil - case vulnerability.FieldTitle: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetTitle(v) - return nil - case vulnerability.FieldDescription: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetDescription(v) - return nil - case vulnerability.FieldCweID: - v, ok := value.([]string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCweID(v) - return nil - case vulnerability.FieldSeverity: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSeverity(v) - return nil - case vulnerability.FieldCvss: - v, ok := value.([]string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCvss(v) - return nil - case vulnerability.FieldReferences: - v, ok := value.([]string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetReferences(v) - return nil - } - return fmt.Errorf("unknown Vulnerability field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *VulnerabilityMutation) AddedFields() []string { - var fields []string - if m.addfirst_seen_at != nil { - fields = append(fields, vulnerability.FieldFirstSeenAt) - } - if m.addlast_modified_at != nil { - fields = append(fields, vulnerability.FieldLastModifiedAt) - } - return fields -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *VulnerabilityMutation) AddedField(name string) (ent.Value, bool) { - switch name { - case vulnerability.FieldFirstSeenAt: - return m.AddedFirstSeenAt() - case vulnerability.FieldLastModifiedAt: - return m.AddedLastModifiedAt() - } - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *VulnerabilityMutation) AddField(name string, value ent.Value) error { - switch name { - case vulnerability.FieldFirstSeenAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddFirstSeenAt(v) - return nil - case vulnerability.FieldLastModifiedAt: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddLastModifiedAt(v) - return nil - } - return fmt.Errorf("unknown Vulnerability numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *VulnerabilityMutation) ClearedFields() []string { - var fields []string - if m.FieldCleared(vulnerability.FieldTitle) { - fields = append(fields, vulnerability.FieldTitle) - } - if m.FieldCleared(vulnerability.FieldDescription) { - fields = append(fields, vulnerability.FieldDescription) - } - if m.FieldCleared(vulnerability.FieldCweID) { - fields = append(fields, vulnerability.FieldCweID) - } - if m.FieldCleared(vulnerability.FieldSeverity) { - fields = append(fields, vulnerability.FieldSeverity) - } - if m.FieldCleared(vulnerability.FieldCvss) { - fields = append(fields, vulnerability.FieldCvss) - } - if m.FieldCleared(vulnerability.FieldReferences) { - fields = append(fields, vulnerability.FieldReferences) - } - return fields -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *VulnerabilityMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *VulnerabilityMutation) ClearField(name string) error { - switch name { - case vulnerability.FieldTitle: - m.ClearTitle() - return nil - case vulnerability.FieldDescription: - m.ClearDescription() - return nil - case vulnerability.FieldCweID: - m.ClearCweID() - return nil - case vulnerability.FieldSeverity: - m.ClearSeverity() - return nil - case vulnerability.FieldCvss: - m.ClearCvss() - return nil - case vulnerability.FieldReferences: - m.ClearReferences() - return nil - } - return fmt.Errorf("unknown Vulnerability nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *VulnerabilityMutation) ResetField(name string) error { - switch name { - case vulnerability.FieldFirstSeenAt: - m.ResetFirstSeenAt() - return nil - case vulnerability.FieldLastModifiedAt: - m.ResetLastModifiedAt() - return nil - case vulnerability.FieldTitle: - m.ResetTitle() - return nil - case vulnerability.FieldDescription: - m.ResetDescription() - return nil - case vulnerability.FieldCweID: - m.ResetCweID() - return nil - case vulnerability.FieldSeverity: - m.ResetSeverity() - return nil - case vulnerability.FieldCvss: - m.ResetCvss() - return nil - case vulnerability.FieldReferences: - m.ResetReferences() - return nil - } - return fmt.Errorf("unknown Vulnerability field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *VulnerabilityMutation) AddedEdges() []string { - edges := make([]string, 0, 2) - if m.packages != nil { - edges = append(edges, vulnerability.EdgePackages) - } - if m.custom_severity != nil { - edges = append(edges, vulnerability.EdgeCustomSeverity) - } - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *VulnerabilityMutation) AddedIDs(name string) []ent.Value { - switch name { - case vulnerability.EdgePackages: - ids := make([]ent.Value, 0, len(m.packages)) - for id := range m.packages { - ids = append(ids, id) - } - return ids - case vulnerability.EdgeCustomSeverity: - if id := m.custom_severity; id != nil { - return []ent.Value{*id} - } - } - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *VulnerabilityMutation) RemovedEdges() []string { - edges := make([]string, 0, 2) - if m.removedpackages != nil { - edges = append(edges, vulnerability.EdgePackages) - } - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *VulnerabilityMutation) RemovedIDs(name string) []ent.Value { - switch name { - case vulnerability.EdgePackages: - ids := make([]ent.Value, 0, len(m.removedpackages)) - for id := range m.removedpackages { - ids = append(ids, id) - } - return ids - } - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *VulnerabilityMutation) ClearedEdges() []string { - edges := make([]string, 0, 2) - if m.clearedpackages { - edges = append(edges, vulnerability.EdgePackages) - } - if m.clearedcustom_severity { - edges = append(edges, vulnerability.EdgeCustomSeverity) - } - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *VulnerabilityMutation) EdgeCleared(name string) bool { - switch name { - case vulnerability.EdgePackages: - return m.clearedpackages - case vulnerability.EdgeCustomSeverity: - return m.clearedcustom_severity - } - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *VulnerabilityMutation) ClearEdge(name string) error { - switch name { - case vulnerability.EdgeCustomSeverity: - m.ClearCustomSeverity() - return nil - } - return fmt.Errorf("unknown Vulnerability unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *VulnerabilityMutation) ResetEdge(name string) error { - switch name { - case vulnerability.EdgePackages: - m.ResetPackages() - return nil - case vulnerability.EdgeCustomSeverity: - m.ResetCustomSeverity() - return nil - } - return fmt.Errorf("unknown Vulnerability edge %s", name) -} diff --git a/pkg/infra/ent/packagerecord.go b/pkg/infra/ent/packagerecord.go deleted file mode 100644 index 5163284..0000000 --- a/pkg/infra/ent/packagerecord.go +++ /dev/null @@ -1,186 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "encoding/json" - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" -) - -// PackageRecord is the model entity for the PackageRecord schema. -type PackageRecord struct { - config `json:"-"` - // ID of the ent. - ID int `json:"id,omitempty"` - // Type holds the value of the "type" field. - Type string `json:"type,omitempty"` - // Source holds the value of the "source" field. - Source string `json:"source,omitempty"` - // Name holds the value of the "name" field. - Name string `json:"name,omitempty"` - // Version holds the value of the "version" field. - Version string `json:"version,omitempty"` - // VulnIds holds the value of the "vuln_ids" field. - VulnIds []string `json:"vuln_ids,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the PackageRecordQuery when eager-loading is set. - Edges PackageRecordEdges `json:"edges"` -} - -// PackageRecordEdges holds the relations/edges for other nodes in the graph. -type PackageRecordEdges struct { - // Scan holds the value of the scan edge. - Scan []*Scan `json:"scan,omitempty"` - // Vulnerabilities holds the value of the vulnerabilities edge. - Vulnerabilities []*Vulnerability `json:"vulnerabilities,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [2]bool -} - -// ScanOrErr returns the Scan value or an error if the edge -// was not loaded in eager-loading. -func (e PackageRecordEdges) ScanOrErr() ([]*Scan, error) { - if e.loadedTypes[0] { - return e.Scan, nil - } - return nil, &NotLoadedError{edge: "scan"} -} - -// VulnerabilitiesOrErr returns the Vulnerabilities value or an error if the edge -// was not loaded in eager-loading. -func (e PackageRecordEdges) VulnerabilitiesOrErr() ([]*Vulnerability, error) { - if e.loadedTypes[1] { - return e.Vulnerabilities, nil - } - return nil, &NotLoadedError{edge: "vulnerabilities"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*PackageRecord) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case packagerecord.FieldVulnIds: - values[i] = new([]byte) - case packagerecord.FieldID: - values[i] = new(sql.NullInt64) - case packagerecord.FieldType, packagerecord.FieldSource, packagerecord.FieldName, packagerecord.FieldVersion: - values[i] = new(sql.NullString) - default: - return nil, fmt.Errorf("unexpected column %q for type PackageRecord", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the PackageRecord fields. -func (pr *PackageRecord) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case packagerecord.FieldID: - value, ok := values[i].(*sql.NullInt64) - if !ok { - return fmt.Errorf("unexpected type %T for field id", value) - } - pr.ID = int(value.Int64) - case packagerecord.FieldType: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field type", values[i]) - } else if value.Valid { - pr.Type = value.String - } - case packagerecord.FieldSource: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field source", values[i]) - } else if value.Valid { - pr.Source = value.String - } - case packagerecord.FieldName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field name", values[i]) - } else if value.Valid { - pr.Name = value.String - } - case packagerecord.FieldVersion: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field version", values[i]) - } else if value.Valid { - pr.Version = value.String - } - case packagerecord.FieldVulnIds: - if value, ok := values[i].(*[]byte); !ok { - return fmt.Errorf("unexpected type %T for field vuln_ids", values[i]) - } else if value != nil && len(*value) > 0 { - if err := json.Unmarshal(*value, &pr.VulnIds); err != nil { - return fmt.Errorf("unmarshal field vuln_ids: %w", err) - } - } - } - } - return nil -} - -// QueryScan queries the "scan" edge of the PackageRecord entity. -func (pr *PackageRecord) QueryScan() *ScanQuery { - return (&PackageRecordClient{config: pr.config}).QueryScan(pr) -} - -// QueryVulnerabilities queries the "vulnerabilities" edge of the PackageRecord entity. -func (pr *PackageRecord) QueryVulnerabilities() *VulnerabilityQuery { - return (&PackageRecordClient{config: pr.config}).QueryVulnerabilities(pr) -} - -// Update returns a builder for updating this PackageRecord. -// Note that you need to call PackageRecord.Unwrap() before calling this method if this PackageRecord -// was returned from a transaction, and the transaction was committed or rolled back. -func (pr *PackageRecord) Update() *PackageRecordUpdateOne { - return (&PackageRecordClient{config: pr.config}).UpdateOne(pr) -} - -// Unwrap unwraps the PackageRecord entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (pr *PackageRecord) Unwrap() *PackageRecord { - tx, ok := pr.config.driver.(*txDriver) - if !ok { - panic("ent: PackageRecord is not a transactional entity") - } - pr.config.driver = tx.drv - return pr -} - -// String implements the fmt.Stringer. -func (pr *PackageRecord) String() string { - var builder strings.Builder - builder.WriteString("PackageRecord(") - builder.WriteString(fmt.Sprintf("id=%v", pr.ID)) - builder.WriteString(", type=") - builder.WriteString(pr.Type) - builder.WriteString(", source=") - builder.WriteString(pr.Source) - builder.WriteString(", name=") - builder.WriteString(pr.Name) - builder.WriteString(", version=") - builder.WriteString(pr.Version) - builder.WriteString(", vuln_ids=") - builder.WriteString(fmt.Sprintf("%v", pr.VulnIds)) - builder.WriteByte(')') - return builder.String() -} - -// PackageRecords is a parsable slice of PackageRecord. -type PackageRecords []*PackageRecord - -func (pr PackageRecords) config(cfg config) { - for _i := range pr { - pr[_i].config = cfg - } -} diff --git a/pkg/infra/ent/packagerecord/packagerecord.go b/pkg/infra/ent/packagerecord/packagerecord.go deleted file mode 100644 index eb2a231..0000000 --- a/pkg/infra/ent/packagerecord/packagerecord.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package packagerecord - -const ( - // Label holds the string label denoting the packagerecord type in the database. - Label = "package_record" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldType holds the string denoting the type field in the database. - FieldType = "type" - // FieldSource holds the string denoting the source field in the database. - FieldSource = "source" - // FieldName holds the string denoting the name field in the database. - FieldName = "name" - // FieldVersion holds the string denoting the version field in the database. - FieldVersion = "version" - // FieldVulnIds holds the string denoting the vuln_ids field in the database. - FieldVulnIds = "vuln_ids" - // EdgeScan holds the string denoting the scan edge name in mutations. - EdgeScan = "scan" - // EdgeVulnerabilities holds the string denoting the vulnerabilities edge name in mutations. - EdgeVulnerabilities = "vulnerabilities" - // Table holds the table name of the packagerecord in the database. - Table = "package_records" - // ScanTable is the table that holds the scan relation/edge. The primary key declared below. - ScanTable = "scan_packages" - // ScanInverseTable is the table name for the Scan entity. - // It exists in this package in order to avoid circular dependency with the "scan" package. - ScanInverseTable = "scans" - // VulnerabilitiesTable is the table that holds the vulnerabilities relation/edge. The primary key declared below. - VulnerabilitiesTable = "package_record_vulnerabilities" - // VulnerabilitiesInverseTable is the table name for the Vulnerability entity. - // It exists in this package in order to avoid circular dependency with the "vulnerability" package. - VulnerabilitiesInverseTable = "vulnerabilities" -) - -// Columns holds all SQL columns for packagerecord fields. -var Columns = []string{ - FieldID, - FieldType, - FieldSource, - FieldName, - FieldVersion, - FieldVulnIds, -} - -var ( - // ScanPrimaryKey and ScanColumn2 are the table columns denoting the - // primary key for the scan relation (M2M). - ScanPrimaryKey = []string{"scan_id", "package_record_id"} - // VulnerabilitiesPrimaryKey and VulnerabilitiesColumn2 are the table columns denoting the - // primary key for the vulnerabilities relation (M2M). - VulnerabilitiesPrimaryKey = []string{"package_record_id", "vulnerability_id"} -) - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - return false -} diff --git a/pkg/infra/ent/packagerecord/where.go b/pkg/infra/ent/packagerecord/where.go deleted file mode 100644 index 83abf98..0000000 --- a/pkg/infra/ent/packagerecord/where.go +++ /dev/null @@ -1,652 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package packagerecord - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id int) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id int) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id int) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...int) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...int) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id int) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id int) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id int) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id int) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// Type applies equality check predicate on the "type" field. It's identical to TypeEQ. -func Type(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldType), v)) - }) -} - -// Source applies equality check predicate on the "source" field. It's identical to SourceEQ. -func Source(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldSource), v)) - }) -} - -// Name applies equality check predicate on the "name" field. It's identical to NameEQ. -func Name(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldName), v)) - }) -} - -// Version applies equality check predicate on the "version" field. It's identical to VersionEQ. -func Version(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldVersion), v)) - }) -} - -// TypeEQ applies the EQ predicate on the "type" field. -func TypeEQ(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldType), v)) - }) -} - -// TypeNEQ applies the NEQ predicate on the "type" field. -func TypeNEQ(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldType), v)) - }) -} - -// TypeIn applies the In predicate on the "type" field. -func TypeIn(vs ...string) predicate.PackageRecord { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldType), v...)) - }) -} - -// TypeNotIn applies the NotIn predicate on the "type" field. -func TypeNotIn(vs ...string) predicate.PackageRecord { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldType), v...)) - }) -} - -// TypeGT applies the GT predicate on the "type" field. -func TypeGT(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldType), v)) - }) -} - -// TypeGTE applies the GTE predicate on the "type" field. -func TypeGTE(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldType), v)) - }) -} - -// TypeLT applies the LT predicate on the "type" field. -func TypeLT(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldType), v)) - }) -} - -// TypeLTE applies the LTE predicate on the "type" field. -func TypeLTE(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldType), v)) - }) -} - -// TypeContains applies the Contains predicate on the "type" field. -func TypeContains(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldType), v)) - }) -} - -// TypeHasPrefix applies the HasPrefix predicate on the "type" field. -func TypeHasPrefix(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldType), v)) - }) -} - -// TypeHasSuffix applies the HasSuffix predicate on the "type" field. -func TypeHasSuffix(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldType), v)) - }) -} - -// TypeEqualFold applies the EqualFold predicate on the "type" field. -func TypeEqualFold(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldType), v)) - }) -} - -// TypeContainsFold applies the ContainsFold predicate on the "type" field. -func TypeContainsFold(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldType), v)) - }) -} - -// SourceEQ applies the EQ predicate on the "source" field. -func SourceEQ(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldSource), v)) - }) -} - -// SourceNEQ applies the NEQ predicate on the "source" field. -func SourceNEQ(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldSource), v)) - }) -} - -// SourceIn applies the In predicate on the "source" field. -func SourceIn(vs ...string) predicate.PackageRecord { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldSource), v...)) - }) -} - -// SourceNotIn applies the NotIn predicate on the "source" field. -func SourceNotIn(vs ...string) predicate.PackageRecord { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldSource), v...)) - }) -} - -// SourceGT applies the GT predicate on the "source" field. -func SourceGT(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldSource), v)) - }) -} - -// SourceGTE applies the GTE predicate on the "source" field. -func SourceGTE(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldSource), v)) - }) -} - -// SourceLT applies the LT predicate on the "source" field. -func SourceLT(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldSource), v)) - }) -} - -// SourceLTE applies the LTE predicate on the "source" field. -func SourceLTE(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldSource), v)) - }) -} - -// SourceContains applies the Contains predicate on the "source" field. -func SourceContains(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldSource), v)) - }) -} - -// SourceHasPrefix applies the HasPrefix predicate on the "source" field. -func SourceHasPrefix(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldSource), v)) - }) -} - -// SourceHasSuffix applies the HasSuffix predicate on the "source" field. -func SourceHasSuffix(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldSource), v)) - }) -} - -// SourceEqualFold applies the EqualFold predicate on the "source" field. -func SourceEqualFold(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldSource), v)) - }) -} - -// SourceContainsFold applies the ContainsFold predicate on the "source" field. -func SourceContainsFold(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldSource), v)) - }) -} - -// NameEQ applies the EQ predicate on the "name" field. -func NameEQ(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldName), v)) - }) -} - -// NameNEQ applies the NEQ predicate on the "name" field. -func NameNEQ(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldName), v)) - }) -} - -// NameIn applies the In predicate on the "name" field. -func NameIn(vs ...string) predicate.PackageRecord { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldName), v...)) - }) -} - -// NameNotIn applies the NotIn predicate on the "name" field. -func NameNotIn(vs ...string) predicate.PackageRecord { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldName), v...)) - }) -} - -// NameGT applies the GT predicate on the "name" field. -func NameGT(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldName), v)) - }) -} - -// NameGTE applies the GTE predicate on the "name" field. -func NameGTE(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldName), v)) - }) -} - -// NameLT applies the LT predicate on the "name" field. -func NameLT(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldName), v)) - }) -} - -// NameLTE applies the LTE predicate on the "name" field. -func NameLTE(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldName), v)) - }) -} - -// NameContains applies the Contains predicate on the "name" field. -func NameContains(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldName), v)) - }) -} - -// NameHasPrefix applies the HasPrefix predicate on the "name" field. -func NameHasPrefix(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldName), v)) - }) -} - -// NameHasSuffix applies the HasSuffix predicate on the "name" field. -func NameHasSuffix(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldName), v)) - }) -} - -// NameEqualFold applies the EqualFold predicate on the "name" field. -func NameEqualFold(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldName), v)) - }) -} - -// NameContainsFold applies the ContainsFold predicate on the "name" field. -func NameContainsFold(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldName), v)) - }) -} - -// VersionEQ applies the EQ predicate on the "version" field. -func VersionEQ(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldVersion), v)) - }) -} - -// VersionNEQ applies the NEQ predicate on the "version" field. -func VersionNEQ(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldVersion), v)) - }) -} - -// VersionIn applies the In predicate on the "version" field. -func VersionIn(vs ...string) predicate.PackageRecord { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldVersion), v...)) - }) -} - -// VersionNotIn applies the NotIn predicate on the "version" field. -func VersionNotIn(vs ...string) predicate.PackageRecord { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.PackageRecord(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldVersion), v...)) - }) -} - -// VersionGT applies the GT predicate on the "version" field. -func VersionGT(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldVersion), v)) - }) -} - -// VersionGTE applies the GTE predicate on the "version" field. -func VersionGTE(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldVersion), v)) - }) -} - -// VersionLT applies the LT predicate on the "version" field. -func VersionLT(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldVersion), v)) - }) -} - -// VersionLTE applies the LTE predicate on the "version" field. -func VersionLTE(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldVersion), v)) - }) -} - -// VersionContains applies the Contains predicate on the "version" field. -func VersionContains(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldVersion), v)) - }) -} - -// VersionHasPrefix applies the HasPrefix predicate on the "version" field. -func VersionHasPrefix(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldVersion), v)) - }) -} - -// VersionHasSuffix applies the HasSuffix predicate on the "version" field. -func VersionHasSuffix(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldVersion), v)) - }) -} - -// VersionEqualFold applies the EqualFold predicate on the "version" field. -func VersionEqualFold(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldVersion), v)) - }) -} - -// VersionContainsFold applies the ContainsFold predicate on the "version" field. -func VersionContainsFold(v string) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldVersion), v)) - }) -} - -// HasScan applies the HasEdge predicate on the "scan" edge. -func HasScan() predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(ScanTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, ScanTable, ScanPrimaryKey...), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasScanWith applies the HasEdge predicate on the "scan" edge with a given conditions (other predicates). -func HasScanWith(preds ...predicate.Scan) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(ScanInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, ScanTable, ScanPrimaryKey...), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// HasVulnerabilities applies the HasEdge predicate on the "vulnerabilities" edge. -func HasVulnerabilities() predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(VulnerabilitiesTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, VulnerabilitiesTable, VulnerabilitiesPrimaryKey...), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasVulnerabilitiesWith applies the HasEdge predicate on the "vulnerabilities" edge with a given conditions (other predicates). -func HasVulnerabilitiesWith(preds ...predicate.Vulnerability) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(VulnerabilitiesInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, VulnerabilitiesTable, VulnerabilitiesPrimaryKey...), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.PackageRecord) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.PackageRecord) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.PackageRecord) predicate.PackageRecord { - return predicate.PackageRecord(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/packagerecord_create.go b/pkg/infra/ent/packagerecord_create.go deleted file mode 100644 index eda3031..0000000 --- a/pkg/infra/ent/packagerecord_create.go +++ /dev/null @@ -1,794 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// PackageRecordCreate is the builder for creating a PackageRecord entity. -type PackageRecordCreate struct { - config - mutation *PackageRecordMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetType sets the "type" field. -func (prc *PackageRecordCreate) SetType(s string) *PackageRecordCreate { - prc.mutation.SetType(s) - return prc -} - -// SetSource sets the "source" field. -func (prc *PackageRecordCreate) SetSource(s string) *PackageRecordCreate { - prc.mutation.SetSource(s) - return prc -} - -// SetName sets the "name" field. -func (prc *PackageRecordCreate) SetName(s string) *PackageRecordCreate { - prc.mutation.SetName(s) - return prc -} - -// SetVersion sets the "version" field. -func (prc *PackageRecordCreate) SetVersion(s string) *PackageRecordCreate { - prc.mutation.SetVersion(s) - return prc -} - -// SetVulnIds sets the "vuln_ids" field. -func (prc *PackageRecordCreate) SetVulnIds(s []string) *PackageRecordCreate { - prc.mutation.SetVulnIds(s) - return prc -} - -// AddScanIDs adds the "scan" edge to the Scan entity by IDs. -func (prc *PackageRecordCreate) AddScanIDs(ids ...string) *PackageRecordCreate { - prc.mutation.AddScanIDs(ids...) - return prc -} - -// AddScan adds the "scan" edges to the Scan entity. -func (prc *PackageRecordCreate) AddScan(s ...*Scan) *PackageRecordCreate { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return prc.AddScanIDs(ids...) -} - -// AddVulnerabilityIDs adds the "vulnerabilities" edge to the Vulnerability entity by IDs. -func (prc *PackageRecordCreate) AddVulnerabilityIDs(ids ...string) *PackageRecordCreate { - prc.mutation.AddVulnerabilityIDs(ids...) - return prc -} - -// AddVulnerabilities adds the "vulnerabilities" edges to the Vulnerability entity. -func (prc *PackageRecordCreate) AddVulnerabilities(v ...*Vulnerability) *PackageRecordCreate { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return prc.AddVulnerabilityIDs(ids...) -} - -// Mutation returns the PackageRecordMutation object of the builder. -func (prc *PackageRecordCreate) Mutation() *PackageRecordMutation { - return prc.mutation -} - -// Save creates the PackageRecord in the database. -func (prc *PackageRecordCreate) Save(ctx context.Context) (*PackageRecord, error) { - var ( - err error - node *PackageRecord - ) - if len(prc.hooks) == 0 { - if err = prc.check(); err != nil { - return nil, err - } - node, err = prc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*PackageRecordMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = prc.check(); err != nil { - return nil, err - } - prc.mutation = mutation - if node, err = prc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(prc.hooks) - 1; i >= 0; i-- { - if prc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = prc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, prc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (prc *PackageRecordCreate) SaveX(ctx context.Context) *PackageRecord { - v, err := prc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (prc *PackageRecordCreate) Exec(ctx context.Context) error { - _, err := prc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (prc *PackageRecordCreate) ExecX(ctx context.Context) { - if err := prc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (prc *PackageRecordCreate) check() error { - if _, ok := prc.mutation.GetType(); !ok { - return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "type"`)} - } - if _, ok := prc.mutation.Source(); !ok { - return &ValidationError{Name: "source", err: errors.New(`ent: missing required field "source"`)} - } - if _, ok := prc.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "name"`)} - } - if _, ok := prc.mutation.Version(); !ok { - return &ValidationError{Name: "version", err: errors.New(`ent: missing required field "version"`)} - } - if _, ok := prc.mutation.VulnIds(); !ok { - return &ValidationError{Name: "vuln_ids", err: errors.New(`ent: missing required field "vuln_ids"`)} - } - return nil -} - -func (prc *PackageRecordCreate) sqlSave(ctx context.Context) (*PackageRecord, error) { - _node, _spec := prc.createSpec() - if err := sqlgraph.CreateNode(ctx, prc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - id := _spec.ID.Value.(int64) - _node.ID = int(id) - return _node, nil -} - -func (prc *PackageRecordCreate) createSpec() (*PackageRecord, *sqlgraph.CreateSpec) { - var ( - _node = &PackageRecord{config: prc.config} - _spec = &sqlgraph.CreateSpec{ - Table: packagerecord.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - } - ) - _spec.OnConflict = prc.conflict - if value, ok := prc.mutation.GetType(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: packagerecord.FieldType, - }) - _node.Type = value - } - if value, ok := prc.mutation.Source(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: packagerecord.FieldSource, - }) - _node.Source = value - } - if value, ok := prc.mutation.Name(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: packagerecord.FieldName, - }) - _node.Name = value - } - if value, ok := prc.mutation.Version(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: packagerecord.FieldVersion, - }) - _node.Version = value - } - if value, ok := prc.mutation.VulnIds(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: packagerecord.FieldVulnIds, - }) - _node.VulnIds = value - } - if nodes := prc.mutation.ScanIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: packagerecord.ScanTable, - Columns: packagerecord.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - if nodes := prc.mutation.VulnerabilitiesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: packagerecord.VulnerabilitiesTable, - Columns: packagerecord.VulnerabilitiesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.PackageRecord.Create(). -// SetType(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.PackageRecordUpsert) { -// SetType(v+v). -// }). -// Exec(ctx) -// -func (prc *PackageRecordCreate) OnConflict(opts ...sql.ConflictOption) *PackageRecordUpsertOne { - prc.conflict = opts - return &PackageRecordUpsertOne{ - create: prc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.PackageRecord.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (prc *PackageRecordCreate) OnConflictColumns(columns ...string) *PackageRecordUpsertOne { - prc.conflict = append(prc.conflict, sql.ConflictColumns(columns...)) - return &PackageRecordUpsertOne{ - create: prc, - } -} - -type ( - // PackageRecordUpsertOne is the builder for "upsert"-ing - // one PackageRecord node. - PackageRecordUpsertOne struct { - create *PackageRecordCreate - } - - // PackageRecordUpsert is the "OnConflict" setter. - PackageRecordUpsert struct { - *sql.UpdateSet - } -) - -// SetType sets the "type" field. -func (u *PackageRecordUpsert) SetType(v string) *PackageRecordUpsert { - u.Set(packagerecord.FieldType, v) - return u -} - -// UpdateType sets the "type" field to the value that was provided on create. -func (u *PackageRecordUpsert) UpdateType() *PackageRecordUpsert { - u.SetExcluded(packagerecord.FieldType) - return u -} - -// SetSource sets the "source" field. -func (u *PackageRecordUpsert) SetSource(v string) *PackageRecordUpsert { - u.Set(packagerecord.FieldSource, v) - return u -} - -// UpdateSource sets the "source" field to the value that was provided on create. -func (u *PackageRecordUpsert) UpdateSource() *PackageRecordUpsert { - u.SetExcluded(packagerecord.FieldSource) - return u -} - -// SetName sets the "name" field. -func (u *PackageRecordUpsert) SetName(v string) *PackageRecordUpsert { - u.Set(packagerecord.FieldName, v) - return u -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *PackageRecordUpsert) UpdateName() *PackageRecordUpsert { - u.SetExcluded(packagerecord.FieldName) - return u -} - -// SetVersion sets the "version" field. -func (u *PackageRecordUpsert) SetVersion(v string) *PackageRecordUpsert { - u.Set(packagerecord.FieldVersion, v) - return u -} - -// UpdateVersion sets the "version" field to the value that was provided on create. -func (u *PackageRecordUpsert) UpdateVersion() *PackageRecordUpsert { - u.SetExcluded(packagerecord.FieldVersion) - return u -} - -// SetVulnIds sets the "vuln_ids" field. -func (u *PackageRecordUpsert) SetVulnIds(v []string) *PackageRecordUpsert { - u.Set(packagerecord.FieldVulnIds, v) - return u -} - -// UpdateVulnIds sets the "vuln_ids" field to the value that was provided on create. -func (u *PackageRecordUpsert) UpdateVulnIds() *PackageRecordUpsert { - u.SetExcluded(packagerecord.FieldVulnIds) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create. -// Using this option is equivalent to using: -// -// client.PackageRecord.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *PackageRecordUpsertOne) UpdateNewValues() *PackageRecordUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.PackageRecord.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *PackageRecordUpsertOne) Ignore() *PackageRecordUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *PackageRecordUpsertOne) DoNothing() *PackageRecordUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the PackageRecordCreate.OnConflict -// documentation for more info. -func (u *PackageRecordUpsertOne) Update(set func(*PackageRecordUpsert)) *PackageRecordUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&PackageRecordUpsert{UpdateSet: update}) - })) - return u -} - -// SetType sets the "type" field. -func (u *PackageRecordUpsertOne) SetType(v string) *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.SetType(v) - }) -} - -// UpdateType sets the "type" field to the value that was provided on create. -func (u *PackageRecordUpsertOne) UpdateType() *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateType() - }) -} - -// SetSource sets the "source" field. -func (u *PackageRecordUpsertOne) SetSource(v string) *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.SetSource(v) - }) -} - -// UpdateSource sets the "source" field to the value that was provided on create. -func (u *PackageRecordUpsertOne) UpdateSource() *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateSource() - }) -} - -// SetName sets the "name" field. -func (u *PackageRecordUpsertOne) SetName(v string) *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *PackageRecordUpsertOne) UpdateName() *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateName() - }) -} - -// SetVersion sets the "version" field. -func (u *PackageRecordUpsertOne) SetVersion(v string) *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.SetVersion(v) - }) -} - -// UpdateVersion sets the "version" field to the value that was provided on create. -func (u *PackageRecordUpsertOne) UpdateVersion() *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateVersion() - }) -} - -// SetVulnIds sets the "vuln_ids" field. -func (u *PackageRecordUpsertOne) SetVulnIds(v []string) *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.SetVulnIds(v) - }) -} - -// UpdateVulnIds sets the "vuln_ids" field to the value that was provided on create. -func (u *PackageRecordUpsertOne) UpdateVulnIds() *PackageRecordUpsertOne { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateVulnIds() - }) -} - -// Exec executes the query. -func (u *PackageRecordUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for PackageRecordCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *PackageRecordUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *PackageRecordUpsertOne) ID(ctx context.Context) (id int, err error) { - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *PackageRecordUpsertOne) IDX(ctx context.Context) int { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// PackageRecordCreateBulk is the builder for creating many PackageRecord entities in bulk. -type PackageRecordCreateBulk struct { - config - builders []*PackageRecordCreate - conflict []sql.ConflictOption -} - -// Save creates the PackageRecord entities in the database. -func (prcb *PackageRecordCreateBulk) Save(ctx context.Context) ([]*PackageRecord, error) { - specs := make([]*sqlgraph.CreateSpec, len(prcb.builders)) - nodes := make([]*PackageRecord, len(prcb.builders)) - mutators := make([]Mutator, len(prcb.builders)) - for i := range prcb.builders { - func(i int, root context.Context) { - builder := prcb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*PackageRecordMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, prcb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = prcb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, prcb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - if specs[i].ID.Value != nil { - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) - } - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, prcb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (prcb *PackageRecordCreateBulk) SaveX(ctx context.Context) []*PackageRecord { - v, err := prcb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (prcb *PackageRecordCreateBulk) Exec(ctx context.Context) error { - _, err := prcb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (prcb *PackageRecordCreateBulk) ExecX(ctx context.Context) { - if err := prcb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.PackageRecord.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.PackageRecordUpsert) { -// SetType(v+v). -// }). -// Exec(ctx) -// -func (prcb *PackageRecordCreateBulk) OnConflict(opts ...sql.ConflictOption) *PackageRecordUpsertBulk { - prcb.conflict = opts - return &PackageRecordUpsertBulk{ - create: prcb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.PackageRecord.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (prcb *PackageRecordCreateBulk) OnConflictColumns(columns ...string) *PackageRecordUpsertBulk { - prcb.conflict = append(prcb.conflict, sql.ConflictColumns(columns...)) - return &PackageRecordUpsertBulk{ - create: prcb, - } -} - -// PackageRecordUpsertBulk is the builder for "upsert"-ing -// a bulk of PackageRecord nodes. -type PackageRecordUpsertBulk struct { - create *PackageRecordCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.PackageRecord.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *PackageRecordUpsertBulk) UpdateNewValues() *PackageRecordUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.PackageRecord.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *PackageRecordUpsertBulk) Ignore() *PackageRecordUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *PackageRecordUpsertBulk) DoNothing() *PackageRecordUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the PackageRecordCreateBulk.OnConflict -// documentation for more info. -func (u *PackageRecordUpsertBulk) Update(set func(*PackageRecordUpsert)) *PackageRecordUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&PackageRecordUpsert{UpdateSet: update}) - })) - return u -} - -// SetType sets the "type" field. -func (u *PackageRecordUpsertBulk) SetType(v string) *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.SetType(v) - }) -} - -// UpdateType sets the "type" field to the value that was provided on create. -func (u *PackageRecordUpsertBulk) UpdateType() *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateType() - }) -} - -// SetSource sets the "source" field. -func (u *PackageRecordUpsertBulk) SetSource(v string) *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.SetSource(v) - }) -} - -// UpdateSource sets the "source" field to the value that was provided on create. -func (u *PackageRecordUpsertBulk) UpdateSource() *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateSource() - }) -} - -// SetName sets the "name" field. -func (u *PackageRecordUpsertBulk) SetName(v string) *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *PackageRecordUpsertBulk) UpdateName() *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateName() - }) -} - -// SetVersion sets the "version" field. -func (u *PackageRecordUpsertBulk) SetVersion(v string) *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.SetVersion(v) - }) -} - -// UpdateVersion sets the "version" field to the value that was provided on create. -func (u *PackageRecordUpsertBulk) UpdateVersion() *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateVersion() - }) -} - -// SetVulnIds sets the "vuln_ids" field. -func (u *PackageRecordUpsertBulk) SetVulnIds(v []string) *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.SetVulnIds(v) - }) -} - -// UpdateVulnIds sets the "vuln_ids" field to the value that was provided on create. -func (u *PackageRecordUpsertBulk) UpdateVulnIds() *PackageRecordUpsertBulk { - return u.Update(func(s *PackageRecordUpsert) { - s.UpdateVulnIds() - }) -} - -// Exec executes the query. -func (u *PackageRecordUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the PackageRecordCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for PackageRecordCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *PackageRecordUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/packagerecord_delete.go b/pkg/infra/ent/packagerecord_delete.go deleted file mode 100644 index 8d1822a..0000000 --- a/pkg/infra/ent/packagerecord_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// PackageRecordDelete is the builder for deleting a PackageRecord entity. -type PackageRecordDelete struct { - config - hooks []Hook - mutation *PackageRecordMutation -} - -// Where appends a list predicates to the PackageRecordDelete builder. -func (prd *PackageRecordDelete) Where(ps ...predicate.PackageRecord) *PackageRecordDelete { - prd.mutation.Where(ps...) - return prd -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (prd *PackageRecordDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(prd.hooks) == 0 { - affected, err = prd.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*PackageRecordMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - prd.mutation = mutation - affected, err = prd.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(prd.hooks) - 1; i >= 0; i-- { - if prd.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = prd.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, prd.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (prd *PackageRecordDelete) ExecX(ctx context.Context) int { - n, err := prd.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (prd *PackageRecordDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: packagerecord.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - if ps := prd.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, prd.driver, _spec) -} - -// PackageRecordDeleteOne is the builder for deleting a single PackageRecord entity. -type PackageRecordDeleteOne struct { - prd *PackageRecordDelete -} - -// Exec executes the deletion query. -func (prdo *PackageRecordDeleteOne) Exec(ctx context.Context) error { - n, err := prdo.prd.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{packagerecord.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (prdo *PackageRecordDeleteOne) ExecX(ctx context.Context) { - prdo.prd.ExecX(ctx) -} diff --git a/pkg/infra/ent/packagerecord_query.go b/pkg/infra/ent/packagerecord_query.go deleted file mode 100644 index 930ccfa..0000000 --- a/pkg/infra/ent/packagerecord_query.go +++ /dev/null @@ -1,1125 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "database/sql/driver" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// PackageRecordQuery is the builder for querying PackageRecord entities. -type PackageRecordQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.PackageRecord - // eager-loading edges. - withScan *ScanQuery - withVulnerabilities *VulnerabilityQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the PackageRecordQuery builder. -func (prq *PackageRecordQuery) Where(ps ...predicate.PackageRecord) *PackageRecordQuery { - prq.predicates = append(prq.predicates, ps...) - return prq -} - -// Limit adds a limit step to the query. -func (prq *PackageRecordQuery) Limit(limit int) *PackageRecordQuery { - prq.limit = &limit - return prq -} - -// Offset adds an offset step to the query. -func (prq *PackageRecordQuery) Offset(offset int) *PackageRecordQuery { - prq.offset = &offset - return prq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (prq *PackageRecordQuery) Unique(unique bool) *PackageRecordQuery { - prq.unique = &unique - return prq -} - -// Order adds an order step to the query. -func (prq *PackageRecordQuery) Order(o ...OrderFunc) *PackageRecordQuery { - prq.order = append(prq.order, o...) - return prq -} - -// QueryScan chains the current query on the "scan" edge. -func (prq *PackageRecordQuery) QueryScan() *ScanQuery { - query := &ScanQuery{config: prq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := prq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := prq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(packagerecord.Table, packagerecord.FieldID, selector), - sqlgraph.To(scan.Table, scan.FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, packagerecord.ScanTable, packagerecord.ScanPrimaryKey...), - ) - fromU = sqlgraph.SetNeighbors(prq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// QueryVulnerabilities chains the current query on the "vulnerabilities" edge. -func (prq *PackageRecordQuery) QueryVulnerabilities() *VulnerabilityQuery { - query := &VulnerabilityQuery{config: prq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := prq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := prq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(packagerecord.Table, packagerecord.FieldID, selector), - sqlgraph.To(vulnerability.Table, vulnerability.FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, packagerecord.VulnerabilitiesTable, packagerecord.VulnerabilitiesPrimaryKey...), - ) - fromU = sqlgraph.SetNeighbors(prq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first PackageRecord entity from the query. -// Returns a *NotFoundError when no PackageRecord was found. -func (prq *PackageRecordQuery) First(ctx context.Context) (*PackageRecord, error) { - nodes, err := prq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{packagerecord.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (prq *PackageRecordQuery) FirstX(ctx context.Context) *PackageRecord { - node, err := prq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first PackageRecord ID from the query. -// Returns a *NotFoundError when no PackageRecord ID was found. -func (prq *PackageRecordQuery) FirstID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = prq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{packagerecord.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (prq *PackageRecordQuery) FirstIDX(ctx context.Context) int { - id, err := prq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single PackageRecord entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one PackageRecord entity is not found. -// Returns a *NotFoundError when no PackageRecord entities are found. -func (prq *PackageRecordQuery) Only(ctx context.Context) (*PackageRecord, error) { - nodes, err := prq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{packagerecord.Label} - default: - return nil, &NotSingularError{packagerecord.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (prq *PackageRecordQuery) OnlyX(ctx context.Context) *PackageRecord { - node, err := prq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only PackageRecord ID in the query. -// Returns a *NotSingularError when exactly one PackageRecord ID is not found. -// Returns a *NotFoundError when no entities are found. -func (prq *PackageRecordQuery) OnlyID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = prq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{packagerecord.Label} - default: - err = &NotSingularError{packagerecord.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (prq *PackageRecordQuery) OnlyIDX(ctx context.Context) int { - id, err := prq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of PackageRecords. -func (prq *PackageRecordQuery) All(ctx context.Context) ([]*PackageRecord, error) { - if err := prq.prepareQuery(ctx); err != nil { - return nil, err - } - return prq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (prq *PackageRecordQuery) AllX(ctx context.Context) []*PackageRecord { - nodes, err := prq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of PackageRecord IDs. -func (prq *PackageRecordQuery) IDs(ctx context.Context) ([]int, error) { - var ids []int - if err := prq.Select(packagerecord.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (prq *PackageRecordQuery) IDsX(ctx context.Context) []int { - ids, err := prq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (prq *PackageRecordQuery) Count(ctx context.Context) (int, error) { - if err := prq.prepareQuery(ctx); err != nil { - return 0, err - } - return prq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (prq *PackageRecordQuery) CountX(ctx context.Context) int { - count, err := prq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (prq *PackageRecordQuery) Exist(ctx context.Context) (bool, error) { - if err := prq.prepareQuery(ctx); err != nil { - return false, err - } - return prq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (prq *PackageRecordQuery) ExistX(ctx context.Context) bool { - exist, err := prq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the PackageRecordQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (prq *PackageRecordQuery) Clone() *PackageRecordQuery { - if prq == nil { - return nil - } - return &PackageRecordQuery{ - config: prq.config, - limit: prq.limit, - offset: prq.offset, - order: append([]OrderFunc{}, prq.order...), - predicates: append([]predicate.PackageRecord{}, prq.predicates...), - withScan: prq.withScan.Clone(), - withVulnerabilities: prq.withVulnerabilities.Clone(), - // clone intermediate query. - sql: prq.sql.Clone(), - path: prq.path, - } -} - -// WithScan tells the query-builder to eager-load the nodes that are connected to -// the "scan" edge. The optional arguments are used to configure the query builder of the edge. -func (prq *PackageRecordQuery) WithScan(opts ...func(*ScanQuery)) *PackageRecordQuery { - query := &ScanQuery{config: prq.config} - for _, opt := range opts { - opt(query) - } - prq.withScan = query - return prq -} - -// WithVulnerabilities tells the query-builder to eager-load the nodes that are connected to -// the "vulnerabilities" edge. The optional arguments are used to configure the query builder of the edge. -func (prq *PackageRecordQuery) WithVulnerabilities(opts ...func(*VulnerabilityQuery)) *PackageRecordQuery { - query := &VulnerabilityQuery{config: prq.config} - for _, opt := range opts { - opt(query) - } - prq.withVulnerabilities = query - return prq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// Type string `json:"type,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.PackageRecord.Query(). -// GroupBy(packagerecord.FieldType). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (prq *PackageRecordQuery) GroupBy(field string, fields ...string) *PackageRecordGroupBy { - group := &PackageRecordGroupBy{config: prq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := prq.prepareQuery(ctx); err != nil { - return nil, err - } - return prq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// Type string `json:"type,omitempty"` -// } -// -// client.PackageRecord.Query(). -// Select(packagerecord.FieldType). -// Scan(ctx, &v) -// -func (prq *PackageRecordQuery) Select(fields ...string) *PackageRecordSelect { - prq.fields = append(prq.fields, fields...) - return &PackageRecordSelect{PackageRecordQuery: prq} -} - -func (prq *PackageRecordQuery) prepareQuery(ctx context.Context) error { - for _, f := range prq.fields { - if !packagerecord.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if prq.path != nil { - prev, err := prq.path(ctx) - if err != nil { - return err - } - prq.sql = prev - } - return nil -} - -func (prq *PackageRecordQuery) sqlAll(ctx context.Context) ([]*PackageRecord, error) { - var ( - nodes = []*PackageRecord{} - _spec = prq.querySpec() - loadedTypes = [2]bool{ - prq.withScan != nil, - prq.withVulnerabilities != nil, - } - ) - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &PackageRecord{config: prq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, prq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := prq.withScan; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[int]*PackageRecord, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Scan = []*Scan{} - } - var ( - edgeids []string - edges = make(map[string][]*PackageRecord) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: true, - Table: packagerecord.ScanTable, - Columns: packagerecord.ScanPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(packagerecord.ScanPrimaryKey[1], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullInt64), new(sql.NullString)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullInt64) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullString) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := int(eout.Int64) - inValue := ein.String - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, prq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "scan": %w`, err) - } - query.Where(scan.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "scan" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Scan = append(nodes[i].Edges.Scan, n) - } - } - } - - if query := prq.withVulnerabilities; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[int]*PackageRecord, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Vulnerabilities = []*Vulnerability{} - } - var ( - edgeids []string - edges = make(map[string][]*PackageRecord) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: false, - Table: packagerecord.VulnerabilitiesTable, - Columns: packagerecord.VulnerabilitiesPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(packagerecord.VulnerabilitiesPrimaryKey[0], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullInt64), new(sql.NullString)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullInt64) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullString) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := int(eout.Int64) - inValue := ein.String - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, prq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "vulnerabilities": %w`, err) - } - query.Where(vulnerability.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "vulnerabilities" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Vulnerabilities = append(nodes[i].Edges.Vulnerabilities, n) - } - } - } - - return nodes, nil -} - -func (prq *PackageRecordQuery) sqlCount(ctx context.Context) (int, error) { - _spec := prq.querySpec() - return sqlgraph.CountNodes(ctx, prq.driver, _spec) -} - -func (prq *PackageRecordQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := prq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (prq *PackageRecordQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: packagerecord.Table, - Columns: packagerecord.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - From: prq.sql, - Unique: true, - } - if unique := prq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := prq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, packagerecord.FieldID) - for i := range fields { - if fields[i] != packagerecord.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := prq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := prq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := prq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := prq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (prq *PackageRecordQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(prq.driver.Dialect()) - t1 := builder.Table(packagerecord.Table) - columns := prq.fields - if len(columns) == 0 { - columns = packagerecord.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if prq.sql != nil { - selector = prq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range prq.predicates { - p(selector) - } - for _, p := range prq.order { - p(selector) - } - if offset := prq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := prq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// PackageRecordGroupBy is the group-by builder for PackageRecord entities. -type PackageRecordGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (prgb *PackageRecordGroupBy) Aggregate(fns ...AggregateFunc) *PackageRecordGroupBy { - prgb.fns = append(prgb.fns, fns...) - return prgb -} - -// Scan applies the group-by query and scans the result into the given value. -func (prgb *PackageRecordGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := prgb.path(ctx) - if err != nil { - return err - } - prgb.sql = query - return prgb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (prgb *PackageRecordGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := prgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (prgb *PackageRecordGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(prgb.fields) > 1 { - return nil, errors.New("ent: PackageRecordGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := prgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (prgb *PackageRecordGroupBy) StringsX(ctx context.Context) []string { - v, err := prgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (prgb *PackageRecordGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = prgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{packagerecord.Label} - default: - err = fmt.Errorf("ent: PackageRecordGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (prgb *PackageRecordGroupBy) StringX(ctx context.Context) string { - v, err := prgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (prgb *PackageRecordGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(prgb.fields) > 1 { - return nil, errors.New("ent: PackageRecordGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := prgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (prgb *PackageRecordGroupBy) IntsX(ctx context.Context) []int { - v, err := prgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (prgb *PackageRecordGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = prgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{packagerecord.Label} - default: - err = fmt.Errorf("ent: PackageRecordGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (prgb *PackageRecordGroupBy) IntX(ctx context.Context) int { - v, err := prgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (prgb *PackageRecordGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(prgb.fields) > 1 { - return nil, errors.New("ent: PackageRecordGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := prgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (prgb *PackageRecordGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := prgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (prgb *PackageRecordGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = prgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{packagerecord.Label} - default: - err = fmt.Errorf("ent: PackageRecordGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (prgb *PackageRecordGroupBy) Float64X(ctx context.Context) float64 { - v, err := prgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (prgb *PackageRecordGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(prgb.fields) > 1 { - return nil, errors.New("ent: PackageRecordGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := prgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (prgb *PackageRecordGroupBy) BoolsX(ctx context.Context) []bool { - v, err := prgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (prgb *PackageRecordGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = prgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{packagerecord.Label} - default: - err = fmt.Errorf("ent: PackageRecordGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (prgb *PackageRecordGroupBy) BoolX(ctx context.Context) bool { - v, err := prgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (prgb *PackageRecordGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range prgb.fields { - if !packagerecord.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := prgb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := prgb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (prgb *PackageRecordGroupBy) sqlQuery() *sql.Selector { - selector := prgb.sql.Select() - aggregation := make([]string, 0, len(prgb.fns)) - for _, fn := range prgb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(prgb.fields)+len(prgb.fns)) - for _, f := range prgb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(prgb.fields...)...) -} - -// PackageRecordSelect is the builder for selecting fields of PackageRecord entities. -type PackageRecordSelect struct { - *PackageRecordQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (prs *PackageRecordSelect) Scan(ctx context.Context, v interface{}) error { - if err := prs.prepareQuery(ctx); err != nil { - return err - } - prs.sql = prs.PackageRecordQuery.sqlQuery(ctx) - return prs.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (prs *PackageRecordSelect) ScanX(ctx context.Context, v interface{}) { - if err := prs.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (prs *PackageRecordSelect) Strings(ctx context.Context) ([]string, error) { - if len(prs.fields) > 1 { - return nil, errors.New("ent: PackageRecordSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := prs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (prs *PackageRecordSelect) StringsX(ctx context.Context) []string { - v, err := prs.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (prs *PackageRecordSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = prs.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{packagerecord.Label} - default: - err = fmt.Errorf("ent: PackageRecordSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (prs *PackageRecordSelect) StringX(ctx context.Context) string { - v, err := prs.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (prs *PackageRecordSelect) Ints(ctx context.Context) ([]int, error) { - if len(prs.fields) > 1 { - return nil, errors.New("ent: PackageRecordSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := prs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (prs *PackageRecordSelect) IntsX(ctx context.Context) []int { - v, err := prs.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (prs *PackageRecordSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = prs.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{packagerecord.Label} - default: - err = fmt.Errorf("ent: PackageRecordSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (prs *PackageRecordSelect) IntX(ctx context.Context) int { - v, err := prs.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (prs *PackageRecordSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(prs.fields) > 1 { - return nil, errors.New("ent: PackageRecordSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := prs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (prs *PackageRecordSelect) Float64sX(ctx context.Context) []float64 { - v, err := prs.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (prs *PackageRecordSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = prs.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{packagerecord.Label} - default: - err = fmt.Errorf("ent: PackageRecordSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (prs *PackageRecordSelect) Float64X(ctx context.Context) float64 { - v, err := prs.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (prs *PackageRecordSelect) Bools(ctx context.Context) ([]bool, error) { - if len(prs.fields) > 1 { - return nil, errors.New("ent: PackageRecordSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := prs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (prs *PackageRecordSelect) BoolsX(ctx context.Context) []bool { - v, err := prs.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (prs *PackageRecordSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = prs.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{packagerecord.Label} - default: - err = fmt.Errorf("ent: PackageRecordSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (prs *PackageRecordSelect) BoolX(ctx context.Context) bool { - v, err := prs.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (prs *PackageRecordSelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := prs.sql.Query() - if err := prs.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/packagerecord_update.go b/pkg/infra/ent/packagerecord_update.go deleted file mode 100644 index c8688fa..0000000 --- a/pkg/infra/ent/packagerecord_update.go +++ /dev/null @@ -1,626 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// PackageRecordUpdate is the builder for updating PackageRecord entities. -type PackageRecordUpdate struct { - config - hooks []Hook - mutation *PackageRecordMutation -} - -// Where appends a list predicates to the PackageRecordUpdate builder. -func (pru *PackageRecordUpdate) Where(ps ...predicate.PackageRecord) *PackageRecordUpdate { - pru.mutation.Where(ps...) - return pru -} - -// SetVulnIds sets the "vuln_ids" field. -func (pru *PackageRecordUpdate) SetVulnIds(s []string) *PackageRecordUpdate { - pru.mutation.SetVulnIds(s) - return pru -} - -// AddScanIDs adds the "scan" edge to the Scan entity by IDs. -func (pru *PackageRecordUpdate) AddScanIDs(ids ...string) *PackageRecordUpdate { - pru.mutation.AddScanIDs(ids...) - return pru -} - -// AddScan adds the "scan" edges to the Scan entity. -func (pru *PackageRecordUpdate) AddScan(s ...*Scan) *PackageRecordUpdate { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return pru.AddScanIDs(ids...) -} - -// AddVulnerabilityIDs adds the "vulnerabilities" edge to the Vulnerability entity by IDs. -func (pru *PackageRecordUpdate) AddVulnerabilityIDs(ids ...string) *PackageRecordUpdate { - pru.mutation.AddVulnerabilityIDs(ids...) - return pru -} - -// AddVulnerabilities adds the "vulnerabilities" edges to the Vulnerability entity. -func (pru *PackageRecordUpdate) AddVulnerabilities(v ...*Vulnerability) *PackageRecordUpdate { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return pru.AddVulnerabilityIDs(ids...) -} - -// Mutation returns the PackageRecordMutation object of the builder. -func (pru *PackageRecordUpdate) Mutation() *PackageRecordMutation { - return pru.mutation -} - -// ClearScan clears all "scan" edges to the Scan entity. -func (pru *PackageRecordUpdate) ClearScan() *PackageRecordUpdate { - pru.mutation.ClearScan() - return pru -} - -// RemoveScanIDs removes the "scan" edge to Scan entities by IDs. -func (pru *PackageRecordUpdate) RemoveScanIDs(ids ...string) *PackageRecordUpdate { - pru.mutation.RemoveScanIDs(ids...) - return pru -} - -// RemoveScan removes "scan" edges to Scan entities. -func (pru *PackageRecordUpdate) RemoveScan(s ...*Scan) *PackageRecordUpdate { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return pru.RemoveScanIDs(ids...) -} - -// ClearVulnerabilities clears all "vulnerabilities" edges to the Vulnerability entity. -func (pru *PackageRecordUpdate) ClearVulnerabilities() *PackageRecordUpdate { - pru.mutation.ClearVulnerabilities() - return pru -} - -// RemoveVulnerabilityIDs removes the "vulnerabilities" edge to Vulnerability entities by IDs. -func (pru *PackageRecordUpdate) RemoveVulnerabilityIDs(ids ...string) *PackageRecordUpdate { - pru.mutation.RemoveVulnerabilityIDs(ids...) - return pru -} - -// RemoveVulnerabilities removes "vulnerabilities" edges to Vulnerability entities. -func (pru *PackageRecordUpdate) RemoveVulnerabilities(v ...*Vulnerability) *PackageRecordUpdate { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return pru.RemoveVulnerabilityIDs(ids...) -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (pru *PackageRecordUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(pru.hooks) == 0 { - affected, err = pru.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*PackageRecordMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - pru.mutation = mutation - affected, err = pru.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(pru.hooks) - 1; i >= 0; i-- { - if pru.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = pru.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, pru.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (pru *PackageRecordUpdate) SaveX(ctx context.Context) int { - affected, err := pru.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (pru *PackageRecordUpdate) Exec(ctx context.Context) error { - _, err := pru.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (pru *PackageRecordUpdate) ExecX(ctx context.Context) { - if err := pru.Exec(ctx); err != nil { - panic(err) - } -} - -func (pru *PackageRecordUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: packagerecord.Table, - Columns: packagerecord.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - if ps := pru.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := pru.mutation.VulnIds(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: packagerecord.FieldVulnIds, - }) - } - if pru.mutation.ScanCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: packagerecord.ScanTable, - Columns: packagerecord.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := pru.mutation.RemovedScanIDs(); len(nodes) > 0 && !pru.mutation.ScanCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: packagerecord.ScanTable, - Columns: packagerecord.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := pru.mutation.ScanIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: packagerecord.ScanTable, - Columns: packagerecord.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if pru.mutation.VulnerabilitiesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: packagerecord.VulnerabilitiesTable, - Columns: packagerecord.VulnerabilitiesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := pru.mutation.RemovedVulnerabilitiesIDs(); len(nodes) > 0 && !pru.mutation.VulnerabilitiesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: packagerecord.VulnerabilitiesTable, - Columns: packagerecord.VulnerabilitiesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := pru.mutation.VulnerabilitiesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: packagerecord.VulnerabilitiesTable, - Columns: packagerecord.VulnerabilitiesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, pru.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{packagerecord.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// PackageRecordUpdateOne is the builder for updating a single PackageRecord entity. -type PackageRecordUpdateOne struct { - config - fields []string - hooks []Hook - mutation *PackageRecordMutation -} - -// SetVulnIds sets the "vuln_ids" field. -func (pruo *PackageRecordUpdateOne) SetVulnIds(s []string) *PackageRecordUpdateOne { - pruo.mutation.SetVulnIds(s) - return pruo -} - -// AddScanIDs adds the "scan" edge to the Scan entity by IDs. -func (pruo *PackageRecordUpdateOne) AddScanIDs(ids ...string) *PackageRecordUpdateOne { - pruo.mutation.AddScanIDs(ids...) - return pruo -} - -// AddScan adds the "scan" edges to the Scan entity. -func (pruo *PackageRecordUpdateOne) AddScan(s ...*Scan) *PackageRecordUpdateOne { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return pruo.AddScanIDs(ids...) -} - -// AddVulnerabilityIDs adds the "vulnerabilities" edge to the Vulnerability entity by IDs. -func (pruo *PackageRecordUpdateOne) AddVulnerabilityIDs(ids ...string) *PackageRecordUpdateOne { - pruo.mutation.AddVulnerabilityIDs(ids...) - return pruo -} - -// AddVulnerabilities adds the "vulnerabilities" edges to the Vulnerability entity. -func (pruo *PackageRecordUpdateOne) AddVulnerabilities(v ...*Vulnerability) *PackageRecordUpdateOne { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return pruo.AddVulnerabilityIDs(ids...) -} - -// Mutation returns the PackageRecordMutation object of the builder. -func (pruo *PackageRecordUpdateOne) Mutation() *PackageRecordMutation { - return pruo.mutation -} - -// ClearScan clears all "scan" edges to the Scan entity. -func (pruo *PackageRecordUpdateOne) ClearScan() *PackageRecordUpdateOne { - pruo.mutation.ClearScan() - return pruo -} - -// RemoveScanIDs removes the "scan" edge to Scan entities by IDs. -func (pruo *PackageRecordUpdateOne) RemoveScanIDs(ids ...string) *PackageRecordUpdateOne { - pruo.mutation.RemoveScanIDs(ids...) - return pruo -} - -// RemoveScan removes "scan" edges to Scan entities. -func (pruo *PackageRecordUpdateOne) RemoveScan(s ...*Scan) *PackageRecordUpdateOne { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return pruo.RemoveScanIDs(ids...) -} - -// ClearVulnerabilities clears all "vulnerabilities" edges to the Vulnerability entity. -func (pruo *PackageRecordUpdateOne) ClearVulnerabilities() *PackageRecordUpdateOne { - pruo.mutation.ClearVulnerabilities() - return pruo -} - -// RemoveVulnerabilityIDs removes the "vulnerabilities" edge to Vulnerability entities by IDs. -func (pruo *PackageRecordUpdateOne) RemoveVulnerabilityIDs(ids ...string) *PackageRecordUpdateOne { - pruo.mutation.RemoveVulnerabilityIDs(ids...) - return pruo -} - -// RemoveVulnerabilities removes "vulnerabilities" edges to Vulnerability entities. -func (pruo *PackageRecordUpdateOne) RemoveVulnerabilities(v ...*Vulnerability) *PackageRecordUpdateOne { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return pruo.RemoveVulnerabilityIDs(ids...) -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (pruo *PackageRecordUpdateOne) Select(field string, fields ...string) *PackageRecordUpdateOne { - pruo.fields = append([]string{field}, fields...) - return pruo -} - -// Save executes the query and returns the updated PackageRecord entity. -func (pruo *PackageRecordUpdateOne) Save(ctx context.Context) (*PackageRecord, error) { - var ( - err error - node *PackageRecord - ) - if len(pruo.hooks) == 0 { - node, err = pruo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*PackageRecordMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - pruo.mutation = mutation - node, err = pruo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(pruo.hooks) - 1; i >= 0; i-- { - if pruo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = pruo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, pruo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (pruo *PackageRecordUpdateOne) SaveX(ctx context.Context) *PackageRecord { - node, err := pruo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (pruo *PackageRecordUpdateOne) Exec(ctx context.Context) error { - _, err := pruo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (pruo *PackageRecordUpdateOne) ExecX(ctx context.Context) { - if err := pruo.Exec(ctx); err != nil { - panic(err) - } -} - -func (pruo *PackageRecordUpdateOne) sqlSave(ctx context.Context) (_node *PackageRecord, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: packagerecord.Table, - Columns: packagerecord.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - id, ok := pruo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing PackageRecord.ID for update")} - } - _spec.Node.ID.Value = id - if fields := pruo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, packagerecord.FieldID) - for _, f := range fields { - if !packagerecord.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != packagerecord.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := pruo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := pruo.mutation.VulnIds(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: packagerecord.FieldVulnIds, - }) - } - if pruo.mutation.ScanCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: packagerecord.ScanTable, - Columns: packagerecord.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := pruo.mutation.RemovedScanIDs(); len(nodes) > 0 && !pruo.mutation.ScanCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: packagerecord.ScanTable, - Columns: packagerecord.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := pruo.mutation.ScanIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: packagerecord.ScanTable, - Columns: packagerecord.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if pruo.mutation.VulnerabilitiesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: packagerecord.VulnerabilitiesTable, - Columns: packagerecord.VulnerabilitiesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := pruo.mutation.RemovedVulnerabilitiesIDs(); len(nodes) > 0 && !pruo.mutation.VulnerabilitiesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: packagerecord.VulnerabilitiesTable, - Columns: packagerecord.VulnerabilitiesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := pruo.mutation.VulnerabilitiesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: packagerecord.VulnerabilitiesTable, - Columns: packagerecord.VulnerabilitiesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &PackageRecord{config: pruo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, pruo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{packagerecord.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/predicate/predicate.go b/pkg/infra/ent/predicate/predicate.go deleted file mode 100644 index e42f983..0000000 --- a/pkg/infra/ent/predicate/predicate.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package predicate - -import ( - "entgo.io/ent/dialect/sql" -) - -// AuthStateCache is the predicate function for authstatecache builders. -type AuthStateCache func(*sql.Selector) - -// PackageRecord is the predicate function for packagerecord builders. -type PackageRecord func(*sql.Selector) - -// RepoLabel is the predicate function for repolabel builders. -type RepoLabel func(*sql.Selector) - -// Repository is the predicate function for repository builders. -type Repository func(*sql.Selector) - -// Scan is the predicate function for scan builders. -type Scan func(*sql.Selector) - -// Session is the predicate function for session builders. -type Session func(*sql.Selector) - -// Severity is the predicate function for severity builders. -type Severity func(*sql.Selector) - -// User is the predicate function for user builders. -type User func(*sql.Selector) - -// VulnStatus is the predicate function for vulnstatus builders. -type VulnStatus func(*sql.Selector) - -// VulnStatusIndex is the predicate function for vulnstatusindex builders. -type VulnStatusIndex func(*sql.Selector) - -// Vulnerability is the predicate function for vulnerability builders. -type Vulnerability func(*sql.Selector) diff --git a/pkg/infra/ent/repolabel.go b/pkg/infra/ent/repolabel.go deleted file mode 100644 index 05b6af7..0000000 --- a/pkg/infra/ent/repolabel.go +++ /dev/null @@ -1,145 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" -) - -// RepoLabel is the model entity for the RepoLabel schema. -type RepoLabel struct { - config `json:"-"` - // ID of the ent. - ID int `json:"id,omitempty"` - // Name holds the value of the "name" field. - Name string `json:"name,omitempty"` - // Description holds the value of the "description" field. - Description string `json:"description,omitempty"` - // Color holds the value of the "color" field. - Color string `json:"color,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the RepoLabelQuery when eager-loading is set. - Edges RepoLabelEdges `json:"edges"` -} - -// RepoLabelEdges holds the relations/edges for other nodes in the graph. -type RepoLabelEdges struct { - // Repos holds the value of the repos edge. - Repos []*Repository `json:"repos,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [1]bool -} - -// ReposOrErr returns the Repos value or an error if the edge -// was not loaded in eager-loading. -func (e RepoLabelEdges) ReposOrErr() ([]*Repository, error) { - if e.loadedTypes[0] { - return e.Repos, nil - } - return nil, &NotLoadedError{edge: "repos"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*RepoLabel) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case repolabel.FieldID: - values[i] = new(sql.NullInt64) - case repolabel.FieldName, repolabel.FieldDescription, repolabel.FieldColor: - values[i] = new(sql.NullString) - default: - return nil, fmt.Errorf("unexpected column %q for type RepoLabel", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the RepoLabel fields. -func (rl *RepoLabel) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case repolabel.FieldID: - value, ok := values[i].(*sql.NullInt64) - if !ok { - return fmt.Errorf("unexpected type %T for field id", value) - } - rl.ID = int(value.Int64) - case repolabel.FieldName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field name", values[i]) - } else if value.Valid { - rl.Name = value.String - } - case repolabel.FieldDescription: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field description", values[i]) - } else if value.Valid { - rl.Description = value.String - } - case repolabel.FieldColor: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field color", values[i]) - } else if value.Valid { - rl.Color = value.String - } - } - } - return nil -} - -// QueryRepos queries the "repos" edge of the RepoLabel entity. -func (rl *RepoLabel) QueryRepos() *RepositoryQuery { - return (&RepoLabelClient{config: rl.config}).QueryRepos(rl) -} - -// Update returns a builder for updating this RepoLabel. -// Note that you need to call RepoLabel.Unwrap() before calling this method if this RepoLabel -// was returned from a transaction, and the transaction was committed or rolled back. -func (rl *RepoLabel) Update() *RepoLabelUpdateOne { - return (&RepoLabelClient{config: rl.config}).UpdateOne(rl) -} - -// Unwrap unwraps the RepoLabel entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (rl *RepoLabel) Unwrap() *RepoLabel { - tx, ok := rl.config.driver.(*txDriver) - if !ok { - panic("ent: RepoLabel is not a transactional entity") - } - rl.config.driver = tx.drv - return rl -} - -// String implements the fmt.Stringer. -func (rl *RepoLabel) String() string { - var builder strings.Builder - builder.WriteString("RepoLabel(") - builder.WriteString(fmt.Sprintf("id=%v", rl.ID)) - builder.WriteString(", name=") - builder.WriteString(rl.Name) - builder.WriteString(", description=") - builder.WriteString(rl.Description) - builder.WriteString(", color=") - builder.WriteString(rl.Color) - builder.WriteByte(')') - return builder.String() -} - -// RepoLabels is a parsable slice of RepoLabel. -type RepoLabels []*RepoLabel - -func (rl RepoLabels) config(cfg config) { - for _i := range rl { - rl[_i].config = cfg - } -} diff --git a/pkg/infra/ent/repolabel/repolabel.go b/pkg/infra/ent/repolabel/repolabel.go deleted file mode 100644 index 697bf33..0000000 --- a/pkg/infra/ent/repolabel/repolabel.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package repolabel - -const ( - // Label holds the string label denoting the repolabel type in the database. - Label = "repo_label" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldName holds the string denoting the name field in the database. - FieldName = "name" - // FieldDescription holds the string denoting the description field in the database. - FieldDescription = "description" - // FieldColor holds the string denoting the color field in the database. - FieldColor = "color" - // EdgeRepos holds the string denoting the repos edge name in mutations. - EdgeRepos = "repos" - // Table holds the table name of the repolabel in the database. - Table = "repo_labels" - // ReposTable is the table that holds the repos relation/edge. The primary key declared below. - ReposTable = "repository_labels" - // ReposInverseTable is the table name for the Repository entity. - // It exists in this package in order to avoid circular dependency with the "repository" package. - ReposInverseTable = "repositories" -) - -// Columns holds all SQL columns for repolabel fields. -var Columns = []string{ - FieldID, - FieldName, - FieldDescription, - FieldColor, -} - -var ( - // ReposPrimaryKey and ReposColumn2 are the table columns denoting the - // primary key for the repos relation (M2M). - ReposPrimaryKey = []string{"repository_id", "repo_label_id"} -) - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - return false -} diff --git a/pkg/infra/ent/repolabel/where.go b/pkg/infra/ent/repolabel/where.go deleted file mode 100644 index d4291d9..0000000 --- a/pkg/infra/ent/repolabel/where.go +++ /dev/null @@ -1,506 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package repolabel - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id int) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id int) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id int) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...int) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...int) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id int) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id int) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id int) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id int) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// Name applies equality check predicate on the "name" field. It's identical to NameEQ. -func Name(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldName), v)) - }) -} - -// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ. -func Description(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldDescription), v)) - }) -} - -// Color applies equality check predicate on the "color" field. It's identical to ColorEQ. -func Color(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldColor), v)) - }) -} - -// NameEQ applies the EQ predicate on the "name" field. -func NameEQ(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldName), v)) - }) -} - -// NameNEQ applies the NEQ predicate on the "name" field. -func NameNEQ(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldName), v)) - }) -} - -// NameIn applies the In predicate on the "name" field. -func NameIn(vs ...string) predicate.RepoLabel { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.RepoLabel(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldName), v...)) - }) -} - -// NameNotIn applies the NotIn predicate on the "name" field. -func NameNotIn(vs ...string) predicate.RepoLabel { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.RepoLabel(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldName), v...)) - }) -} - -// NameGT applies the GT predicate on the "name" field. -func NameGT(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldName), v)) - }) -} - -// NameGTE applies the GTE predicate on the "name" field. -func NameGTE(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldName), v)) - }) -} - -// NameLT applies the LT predicate on the "name" field. -func NameLT(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldName), v)) - }) -} - -// NameLTE applies the LTE predicate on the "name" field. -func NameLTE(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldName), v)) - }) -} - -// NameContains applies the Contains predicate on the "name" field. -func NameContains(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldName), v)) - }) -} - -// NameHasPrefix applies the HasPrefix predicate on the "name" field. -func NameHasPrefix(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldName), v)) - }) -} - -// NameHasSuffix applies the HasSuffix predicate on the "name" field. -func NameHasSuffix(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldName), v)) - }) -} - -// NameEqualFold applies the EqualFold predicate on the "name" field. -func NameEqualFold(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldName), v)) - }) -} - -// NameContainsFold applies the ContainsFold predicate on the "name" field. -func NameContainsFold(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldName), v)) - }) -} - -// DescriptionEQ applies the EQ predicate on the "description" field. -func DescriptionEQ(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldDescription), v)) - }) -} - -// DescriptionNEQ applies the NEQ predicate on the "description" field. -func DescriptionNEQ(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldDescription), v)) - }) -} - -// DescriptionIn applies the In predicate on the "description" field. -func DescriptionIn(vs ...string) predicate.RepoLabel { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.RepoLabel(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldDescription), v...)) - }) -} - -// DescriptionNotIn applies the NotIn predicate on the "description" field. -func DescriptionNotIn(vs ...string) predicate.RepoLabel { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.RepoLabel(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldDescription), v...)) - }) -} - -// DescriptionGT applies the GT predicate on the "description" field. -func DescriptionGT(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldDescription), v)) - }) -} - -// DescriptionGTE applies the GTE predicate on the "description" field. -func DescriptionGTE(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldDescription), v)) - }) -} - -// DescriptionLT applies the LT predicate on the "description" field. -func DescriptionLT(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldDescription), v)) - }) -} - -// DescriptionLTE applies the LTE predicate on the "description" field. -func DescriptionLTE(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldDescription), v)) - }) -} - -// DescriptionContains applies the Contains predicate on the "description" field. -func DescriptionContains(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldDescription), v)) - }) -} - -// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field. -func DescriptionHasPrefix(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldDescription), v)) - }) -} - -// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field. -func DescriptionHasSuffix(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldDescription), v)) - }) -} - -// DescriptionEqualFold applies the EqualFold predicate on the "description" field. -func DescriptionEqualFold(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldDescription), v)) - }) -} - -// DescriptionContainsFold applies the ContainsFold predicate on the "description" field. -func DescriptionContainsFold(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldDescription), v)) - }) -} - -// ColorEQ applies the EQ predicate on the "color" field. -func ColorEQ(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldColor), v)) - }) -} - -// ColorNEQ applies the NEQ predicate on the "color" field. -func ColorNEQ(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldColor), v)) - }) -} - -// ColorIn applies the In predicate on the "color" field. -func ColorIn(vs ...string) predicate.RepoLabel { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.RepoLabel(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldColor), v...)) - }) -} - -// ColorNotIn applies the NotIn predicate on the "color" field. -func ColorNotIn(vs ...string) predicate.RepoLabel { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.RepoLabel(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldColor), v...)) - }) -} - -// ColorGT applies the GT predicate on the "color" field. -func ColorGT(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldColor), v)) - }) -} - -// ColorGTE applies the GTE predicate on the "color" field. -func ColorGTE(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldColor), v)) - }) -} - -// ColorLT applies the LT predicate on the "color" field. -func ColorLT(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldColor), v)) - }) -} - -// ColorLTE applies the LTE predicate on the "color" field. -func ColorLTE(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldColor), v)) - }) -} - -// ColorContains applies the Contains predicate on the "color" field. -func ColorContains(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldColor), v)) - }) -} - -// ColorHasPrefix applies the HasPrefix predicate on the "color" field. -func ColorHasPrefix(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldColor), v)) - }) -} - -// ColorHasSuffix applies the HasSuffix predicate on the "color" field. -func ColorHasSuffix(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldColor), v)) - }) -} - -// ColorEqualFold applies the EqualFold predicate on the "color" field. -func ColorEqualFold(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldColor), v)) - }) -} - -// ColorContainsFold applies the ContainsFold predicate on the "color" field. -func ColorContainsFold(v string) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldColor), v)) - }) -} - -// HasRepos applies the HasEdge predicate on the "repos" edge. -func HasRepos() predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(ReposTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, ReposTable, ReposPrimaryKey...), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasReposWith applies the HasEdge predicate on the "repos" edge with a given conditions (other predicates). -func HasReposWith(preds ...predicate.Repository) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(ReposInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, ReposTable, ReposPrimaryKey...), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.RepoLabel) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.RepoLabel) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.RepoLabel) predicate.RepoLabel { - return predicate.RepoLabel(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/repolabel_create.go b/pkg/infra/ent/repolabel_create.go deleted file mode 100644 index aed0654..0000000 --- a/pkg/infra/ent/repolabel_create.go +++ /dev/null @@ -1,645 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" -) - -// RepoLabelCreate is the builder for creating a RepoLabel entity. -type RepoLabelCreate struct { - config - mutation *RepoLabelMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetName sets the "name" field. -func (rlc *RepoLabelCreate) SetName(s string) *RepoLabelCreate { - rlc.mutation.SetName(s) - return rlc -} - -// SetDescription sets the "description" field. -func (rlc *RepoLabelCreate) SetDescription(s string) *RepoLabelCreate { - rlc.mutation.SetDescription(s) - return rlc -} - -// SetColor sets the "color" field. -func (rlc *RepoLabelCreate) SetColor(s string) *RepoLabelCreate { - rlc.mutation.SetColor(s) - return rlc -} - -// AddRepoIDs adds the "repos" edge to the Repository entity by IDs. -func (rlc *RepoLabelCreate) AddRepoIDs(ids ...int) *RepoLabelCreate { - rlc.mutation.AddRepoIDs(ids...) - return rlc -} - -// AddRepos adds the "repos" edges to the Repository entity. -func (rlc *RepoLabelCreate) AddRepos(r ...*Repository) *RepoLabelCreate { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return rlc.AddRepoIDs(ids...) -} - -// Mutation returns the RepoLabelMutation object of the builder. -func (rlc *RepoLabelCreate) Mutation() *RepoLabelMutation { - return rlc.mutation -} - -// Save creates the RepoLabel in the database. -func (rlc *RepoLabelCreate) Save(ctx context.Context) (*RepoLabel, error) { - var ( - err error - node *RepoLabel - ) - if len(rlc.hooks) == 0 { - if err = rlc.check(); err != nil { - return nil, err - } - node, err = rlc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepoLabelMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = rlc.check(); err != nil { - return nil, err - } - rlc.mutation = mutation - if node, err = rlc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(rlc.hooks) - 1; i >= 0; i-- { - if rlc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = rlc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, rlc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (rlc *RepoLabelCreate) SaveX(ctx context.Context) *RepoLabel { - v, err := rlc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (rlc *RepoLabelCreate) Exec(ctx context.Context) error { - _, err := rlc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (rlc *RepoLabelCreate) ExecX(ctx context.Context) { - if err := rlc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (rlc *RepoLabelCreate) check() error { - if _, ok := rlc.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "name"`)} - } - if _, ok := rlc.mutation.Description(); !ok { - return &ValidationError{Name: "description", err: errors.New(`ent: missing required field "description"`)} - } - if _, ok := rlc.mutation.Color(); !ok { - return &ValidationError{Name: "color", err: errors.New(`ent: missing required field "color"`)} - } - return nil -} - -func (rlc *RepoLabelCreate) sqlSave(ctx context.Context) (*RepoLabel, error) { - _node, _spec := rlc.createSpec() - if err := sqlgraph.CreateNode(ctx, rlc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - id := _spec.ID.Value.(int64) - _node.ID = int(id) - return _node, nil -} - -func (rlc *RepoLabelCreate) createSpec() (*RepoLabel, *sqlgraph.CreateSpec) { - var ( - _node = &RepoLabel{config: rlc.config} - _spec = &sqlgraph.CreateSpec{ - Table: repolabel.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - } - ) - _spec.OnConflict = rlc.conflict - if value, ok := rlc.mutation.Name(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repolabel.FieldName, - }) - _node.Name = value - } - if value, ok := rlc.mutation.Description(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repolabel.FieldDescription, - }) - _node.Description = value - } - if value, ok := rlc.mutation.Color(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repolabel.FieldColor, - }) - _node.Color = value - } - if nodes := rlc.mutation.ReposIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: repolabel.ReposTable, - Columns: repolabel.ReposPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.RepoLabel.Create(). -// SetName(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.RepoLabelUpsert) { -// SetName(v+v). -// }). -// Exec(ctx) -// -func (rlc *RepoLabelCreate) OnConflict(opts ...sql.ConflictOption) *RepoLabelUpsertOne { - rlc.conflict = opts - return &RepoLabelUpsertOne{ - create: rlc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.RepoLabel.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (rlc *RepoLabelCreate) OnConflictColumns(columns ...string) *RepoLabelUpsertOne { - rlc.conflict = append(rlc.conflict, sql.ConflictColumns(columns...)) - return &RepoLabelUpsertOne{ - create: rlc, - } -} - -type ( - // RepoLabelUpsertOne is the builder for "upsert"-ing - // one RepoLabel node. - RepoLabelUpsertOne struct { - create *RepoLabelCreate - } - - // RepoLabelUpsert is the "OnConflict" setter. - RepoLabelUpsert struct { - *sql.UpdateSet - } -) - -// SetName sets the "name" field. -func (u *RepoLabelUpsert) SetName(v string) *RepoLabelUpsert { - u.Set(repolabel.FieldName, v) - return u -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *RepoLabelUpsert) UpdateName() *RepoLabelUpsert { - u.SetExcluded(repolabel.FieldName) - return u -} - -// SetDescription sets the "description" field. -func (u *RepoLabelUpsert) SetDescription(v string) *RepoLabelUpsert { - u.Set(repolabel.FieldDescription, v) - return u -} - -// UpdateDescription sets the "description" field to the value that was provided on create. -func (u *RepoLabelUpsert) UpdateDescription() *RepoLabelUpsert { - u.SetExcluded(repolabel.FieldDescription) - return u -} - -// SetColor sets the "color" field. -func (u *RepoLabelUpsert) SetColor(v string) *RepoLabelUpsert { - u.Set(repolabel.FieldColor, v) - return u -} - -// UpdateColor sets the "color" field to the value that was provided on create. -func (u *RepoLabelUpsert) UpdateColor() *RepoLabelUpsert { - u.SetExcluded(repolabel.FieldColor) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create. -// Using this option is equivalent to using: -// -// client.RepoLabel.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *RepoLabelUpsertOne) UpdateNewValues() *RepoLabelUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.RepoLabel.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *RepoLabelUpsertOne) Ignore() *RepoLabelUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *RepoLabelUpsertOne) DoNothing() *RepoLabelUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the RepoLabelCreate.OnConflict -// documentation for more info. -func (u *RepoLabelUpsertOne) Update(set func(*RepoLabelUpsert)) *RepoLabelUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&RepoLabelUpsert{UpdateSet: update}) - })) - return u -} - -// SetName sets the "name" field. -func (u *RepoLabelUpsertOne) SetName(v string) *RepoLabelUpsertOne { - return u.Update(func(s *RepoLabelUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *RepoLabelUpsertOne) UpdateName() *RepoLabelUpsertOne { - return u.Update(func(s *RepoLabelUpsert) { - s.UpdateName() - }) -} - -// SetDescription sets the "description" field. -func (u *RepoLabelUpsertOne) SetDescription(v string) *RepoLabelUpsertOne { - return u.Update(func(s *RepoLabelUpsert) { - s.SetDescription(v) - }) -} - -// UpdateDescription sets the "description" field to the value that was provided on create. -func (u *RepoLabelUpsertOne) UpdateDescription() *RepoLabelUpsertOne { - return u.Update(func(s *RepoLabelUpsert) { - s.UpdateDescription() - }) -} - -// SetColor sets the "color" field. -func (u *RepoLabelUpsertOne) SetColor(v string) *RepoLabelUpsertOne { - return u.Update(func(s *RepoLabelUpsert) { - s.SetColor(v) - }) -} - -// UpdateColor sets the "color" field to the value that was provided on create. -func (u *RepoLabelUpsertOne) UpdateColor() *RepoLabelUpsertOne { - return u.Update(func(s *RepoLabelUpsert) { - s.UpdateColor() - }) -} - -// Exec executes the query. -func (u *RepoLabelUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for RepoLabelCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *RepoLabelUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *RepoLabelUpsertOne) ID(ctx context.Context) (id int, err error) { - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *RepoLabelUpsertOne) IDX(ctx context.Context) int { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// RepoLabelCreateBulk is the builder for creating many RepoLabel entities in bulk. -type RepoLabelCreateBulk struct { - config - builders []*RepoLabelCreate - conflict []sql.ConflictOption -} - -// Save creates the RepoLabel entities in the database. -func (rlcb *RepoLabelCreateBulk) Save(ctx context.Context) ([]*RepoLabel, error) { - specs := make([]*sqlgraph.CreateSpec, len(rlcb.builders)) - nodes := make([]*RepoLabel, len(rlcb.builders)) - mutators := make([]Mutator, len(rlcb.builders)) - for i := range rlcb.builders { - func(i int, root context.Context) { - builder := rlcb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepoLabelMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, rlcb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = rlcb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, rlcb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - if specs[i].ID.Value != nil { - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) - } - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, rlcb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (rlcb *RepoLabelCreateBulk) SaveX(ctx context.Context) []*RepoLabel { - v, err := rlcb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (rlcb *RepoLabelCreateBulk) Exec(ctx context.Context) error { - _, err := rlcb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (rlcb *RepoLabelCreateBulk) ExecX(ctx context.Context) { - if err := rlcb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.RepoLabel.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.RepoLabelUpsert) { -// SetName(v+v). -// }). -// Exec(ctx) -// -func (rlcb *RepoLabelCreateBulk) OnConflict(opts ...sql.ConflictOption) *RepoLabelUpsertBulk { - rlcb.conflict = opts - return &RepoLabelUpsertBulk{ - create: rlcb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.RepoLabel.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (rlcb *RepoLabelCreateBulk) OnConflictColumns(columns ...string) *RepoLabelUpsertBulk { - rlcb.conflict = append(rlcb.conflict, sql.ConflictColumns(columns...)) - return &RepoLabelUpsertBulk{ - create: rlcb, - } -} - -// RepoLabelUpsertBulk is the builder for "upsert"-ing -// a bulk of RepoLabel nodes. -type RepoLabelUpsertBulk struct { - create *RepoLabelCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.RepoLabel.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *RepoLabelUpsertBulk) UpdateNewValues() *RepoLabelUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.RepoLabel.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *RepoLabelUpsertBulk) Ignore() *RepoLabelUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *RepoLabelUpsertBulk) DoNothing() *RepoLabelUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the RepoLabelCreateBulk.OnConflict -// documentation for more info. -func (u *RepoLabelUpsertBulk) Update(set func(*RepoLabelUpsert)) *RepoLabelUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&RepoLabelUpsert{UpdateSet: update}) - })) - return u -} - -// SetName sets the "name" field. -func (u *RepoLabelUpsertBulk) SetName(v string) *RepoLabelUpsertBulk { - return u.Update(func(s *RepoLabelUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *RepoLabelUpsertBulk) UpdateName() *RepoLabelUpsertBulk { - return u.Update(func(s *RepoLabelUpsert) { - s.UpdateName() - }) -} - -// SetDescription sets the "description" field. -func (u *RepoLabelUpsertBulk) SetDescription(v string) *RepoLabelUpsertBulk { - return u.Update(func(s *RepoLabelUpsert) { - s.SetDescription(v) - }) -} - -// UpdateDescription sets the "description" field to the value that was provided on create. -func (u *RepoLabelUpsertBulk) UpdateDescription() *RepoLabelUpsertBulk { - return u.Update(func(s *RepoLabelUpsert) { - s.UpdateDescription() - }) -} - -// SetColor sets the "color" field. -func (u *RepoLabelUpsertBulk) SetColor(v string) *RepoLabelUpsertBulk { - return u.Update(func(s *RepoLabelUpsert) { - s.SetColor(v) - }) -} - -// UpdateColor sets the "color" field to the value that was provided on create. -func (u *RepoLabelUpsertBulk) UpdateColor() *RepoLabelUpsertBulk { - return u.Update(func(s *RepoLabelUpsert) { - s.UpdateColor() - }) -} - -// Exec executes the query. -func (u *RepoLabelUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the RepoLabelCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for RepoLabelCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *RepoLabelUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/repolabel_delete.go b/pkg/infra/ent/repolabel_delete.go deleted file mode 100644 index 0ab448f..0000000 --- a/pkg/infra/ent/repolabel_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" -) - -// RepoLabelDelete is the builder for deleting a RepoLabel entity. -type RepoLabelDelete struct { - config - hooks []Hook - mutation *RepoLabelMutation -} - -// Where appends a list predicates to the RepoLabelDelete builder. -func (rld *RepoLabelDelete) Where(ps ...predicate.RepoLabel) *RepoLabelDelete { - rld.mutation.Where(ps...) - return rld -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (rld *RepoLabelDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(rld.hooks) == 0 { - affected, err = rld.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepoLabelMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - rld.mutation = mutation - affected, err = rld.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(rld.hooks) - 1; i >= 0; i-- { - if rld.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = rld.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, rld.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (rld *RepoLabelDelete) ExecX(ctx context.Context) int { - n, err := rld.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (rld *RepoLabelDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: repolabel.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - if ps := rld.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, rld.driver, _spec) -} - -// RepoLabelDeleteOne is the builder for deleting a single RepoLabel entity. -type RepoLabelDeleteOne struct { - rld *RepoLabelDelete -} - -// Exec executes the deletion query. -func (rldo *RepoLabelDeleteOne) Exec(ctx context.Context) error { - n, err := rldo.rld.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{repolabel.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (rldo *RepoLabelDeleteOne) ExecX(ctx context.Context) { - rldo.rld.ExecX(ctx) -} diff --git a/pkg/infra/ent/repolabel_query.go b/pkg/infra/ent/repolabel_query.go deleted file mode 100644 index 253e0f4..0000000 --- a/pkg/infra/ent/repolabel_query.go +++ /dev/null @@ -1,1023 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "database/sql/driver" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" -) - -// RepoLabelQuery is the builder for querying RepoLabel entities. -type RepoLabelQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.RepoLabel - // eager-loading edges. - withRepos *RepositoryQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the RepoLabelQuery builder. -func (rlq *RepoLabelQuery) Where(ps ...predicate.RepoLabel) *RepoLabelQuery { - rlq.predicates = append(rlq.predicates, ps...) - return rlq -} - -// Limit adds a limit step to the query. -func (rlq *RepoLabelQuery) Limit(limit int) *RepoLabelQuery { - rlq.limit = &limit - return rlq -} - -// Offset adds an offset step to the query. -func (rlq *RepoLabelQuery) Offset(offset int) *RepoLabelQuery { - rlq.offset = &offset - return rlq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (rlq *RepoLabelQuery) Unique(unique bool) *RepoLabelQuery { - rlq.unique = &unique - return rlq -} - -// Order adds an order step to the query. -func (rlq *RepoLabelQuery) Order(o ...OrderFunc) *RepoLabelQuery { - rlq.order = append(rlq.order, o...) - return rlq -} - -// QueryRepos chains the current query on the "repos" edge. -func (rlq *RepoLabelQuery) QueryRepos() *RepositoryQuery { - query := &RepositoryQuery{config: rlq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := rlq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := rlq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(repolabel.Table, repolabel.FieldID, selector), - sqlgraph.To(repository.Table, repository.FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, repolabel.ReposTable, repolabel.ReposPrimaryKey...), - ) - fromU = sqlgraph.SetNeighbors(rlq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first RepoLabel entity from the query. -// Returns a *NotFoundError when no RepoLabel was found. -func (rlq *RepoLabelQuery) First(ctx context.Context) (*RepoLabel, error) { - nodes, err := rlq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{repolabel.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (rlq *RepoLabelQuery) FirstX(ctx context.Context) *RepoLabel { - node, err := rlq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first RepoLabel ID from the query. -// Returns a *NotFoundError when no RepoLabel ID was found. -func (rlq *RepoLabelQuery) FirstID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = rlq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{repolabel.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (rlq *RepoLabelQuery) FirstIDX(ctx context.Context) int { - id, err := rlq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single RepoLabel entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one RepoLabel entity is not found. -// Returns a *NotFoundError when no RepoLabel entities are found. -func (rlq *RepoLabelQuery) Only(ctx context.Context) (*RepoLabel, error) { - nodes, err := rlq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{repolabel.Label} - default: - return nil, &NotSingularError{repolabel.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (rlq *RepoLabelQuery) OnlyX(ctx context.Context) *RepoLabel { - node, err := rlq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only RepoLabel ID in the query. -// Returns a *NotSingularError when exactly one RepoLabel ID is not found. -// Returns a *NotFoundError when no entities are found. -func (rlq *RepoLabelQuery) OnlyID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = rlq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{repolabel.Label} - default: - err = &NotSingularError{repolabel.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (rlq *RepoLabelQuery) OnlyIDX(ctx context.Context) int { - id, err := rlq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of RepoLabels. -func (rlq *RepoLabelQuery) All(ctx context.Context) ([]*RepoLabel, error) { - if err := rlq.prepareQuery(ctx); err != nil { - return nil, err - } - return rlq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (rlq *RepoLabelQuery) AllX(ctx context.Context) []*RepoLabel { - nodes, err := rlq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of RepoLabel IDs. -func (rlq *RepoLabelQuery) IDs(ctx context.Context) ([]int, error) { - var ids []int - if err := rlq.Select(repolabel.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (rlq *RepoLabelQuery) IDsX(ctx context.Context) []int { - ids, err := rlq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (rlq *RepoLabelQuery) Count(ctx context.Context) (int, error) { - if err := rlq.prepareQuery(ctx); err != nil { - return 0, err - } - return rlq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (rlq *RepoLabelQuery) CountX(ctx context.Context) int { - count, err := rlq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (rlq *RepoLabelQuery) Exist(ctx context.Context) (bool, error) { - if err := rlq.prepareQuery(ctx); err != nil { - return false, err - } - return rlq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (rlq *RepoLabelQuery) ExistX(ctx context.Context) bool { - exist, err := rlq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the RepoLabelQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (rlq *RepoLabelQuery) Clone() *RepoLabelQuery { - if rlq == nil { - return nil - } - return &RepoLabelQuery{ - config: rlq.config, - limit: rlq.limit, - offset: rlq.offset, - order: append([]OrderFunc{}, rlq.order...), - predicates: append([]predicate.RepoLabel{}, rlq.predicates...), - withRepos: rlq.withRepos.Clone(), - // clone intermediate query. - sql: rlq.sql.Clone(), - path: rlq.path, - } -} - -// WithRepos tells the query-builder to eager-load the nodes that are connected to -// the "repos" edge. The optional arguments are used to configure the query builder of the edge. -func (rlq *RepoLabelQuery) WithRepos(opts ...func(*RepositoryQuery)) *RepoLabelQuery { - query := &RepositoryQuery{config: rlq.config} - for _, opt := range opts { - opt(query) - } - rlq.withRepos = query - return rlq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// Name string `json:"name,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.RepoLabel.Query(). -// GroupBy(repolabel.FieldName). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (rlq *RepoLabelQuery) GroupBy(field string, fields ...string) *RepoLabelGroupBy { - group := &RepoLabelGroupBy{config: rlq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := rlq.prepareQuery(ctx); err != nil { - return nil, err - } - return rlq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// Name string `json:"name,omitempty"` -// } -// -// client.RepoLabel.Query(). -// Select(repolabel.FieldName). -// Scan(ctx, &v) -// -func (rlq *RepoLabelQuery) Select(fields ...string) *RepoLabelSelect { - rlq.fields = append(rlq.fields, fields...) - return &RepoLabelSelect{RepoLabelQuery: rlq} -} - -func (rlq *RepoLabelQuery) prepareQuery(ctx context.Context) error { - for _, f := range rlq.fields { - if !repolabel.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if rlq.path != nil { - prev, err := rlq.path(ctx) - if err != nil { - return err - } - rlq.sql = prev - } - return nil -} - -func (rlq *RepoLabelQuery) sqlAll(ctx context.Context) ([]*RepoLabel, error) { - var ( - nodes = []*RepoLabel{} - _spec = rlq.querySpec() - loadedTypes = [1]bool{ - rlq.withRepos != nil, - } - ) - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &RepoLabel{config: rlq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, rlq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := rlq.withRepos; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[int]*RepoLabel, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Repos = []*Repository{} - } - var ( - edgeids []int - edges = make(map[int][]*RepoLabel) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: true, - Table: repolabel.ReposTable, - Columns: repolabel.ReposPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(repolabel.ReposPrimaryKey[1], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullInt64) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullInt64) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := int(eout.Int64) - inValue := int(ein.Int64) - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, rlq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "repos": %w`, err) - } - query.Where(repository.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "repos" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Repos = append(nodes[i].Edges.Repos, n) - } - } - } - - return nodes, nil -} - -func (rlq *RepoLabelQuery) sqlCount(ctx context.Context) (int, error) { - _spec := rlq.querySpec() - return sqlgraph.CountNodes(ctx, rlq.driver, _spec) -} - -func (rlq *RepoLabelQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := rlq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (rlq *RepoLabelQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: repolabel.Table, - Columns: repolabel.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - From: rlq.sql, - Unique: true, - } - if unique := rlq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := rlq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, repolabel.FieldID) - for i := range fields { - if fields[i] != repolabel.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := rlq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := rlq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := rlq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := rlq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (rlq *RepoLabelQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(rlq.driver.Dialect()) - t1 := builder.Table(repolabel.Table) - columns := rlq.fields - if len(columns) == 0 { - columns = repolabel.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if rlq.sql != nil { - selector = rlq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range rlq.predicates { - p(selector) - } - for _, p := range rlq.order { - p(selector) - } - if offset := rlq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := rlq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// RepoLabelGroupBy is the group-by builder for RepoLabel entities. -type RepoLabelGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (rlgb *RepoLabelGroupBy) Aggregate(fns ...AggregateFunc) *RepoLabelGroupBy { - rlgb.fns = append(rlgb.fns, fns...) - return rlgb -} - -// Scan applies the group-by query and scans the result into the given value. -func (rlgb *RepoLabelGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := rlgb.path(ctx) - if err != nil { - return err - } - rlgb.sql = query - return rlgb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (rlgb *RepoLabelGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := rlgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (rlgb *RepoLabelGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(rlgb.fields) > 1 { - return nil, errors.New("ent: RepoLabelGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := rlgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (rlgb *RepoLabelGroupBy) StringsX(ctx context.Context) []string { - v, err := rlgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rlgb *RepoLabelGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = rlgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repolabel.Label} - default: - err = fmt.Errorf("ent: RepoLabelGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (rlgb *RepoLabelGroupBy) StringX(ctx context.Context) string { - v, err := rlgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (rlgb *RepoLabelGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(rlgb.fields) > 1 { - return nil, errors.New("ent: RepoLabelGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := rlgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (rlgb *RepoLabelGroupBy) IntsX(ctx context.Context) []int { - v, err := rlgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rlgb *RepoLabelGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = rlgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repolabel.Label} - default: - err = fmt.Errorf("ent: RepoLabelGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (rlgb *RepoLabelGroupBy) IntX(ctx context.Context) int { - v, err := rlgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (rlgb *RepoLabelGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(rlgb.fields) > 1 { - return nil, errors.New("ent: RepoLabelGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := rlgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (rlgb *RepoLabelGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := rlgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rlgb *RepoLabelGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = rlgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repolabel.Label} - default: - err = fmt.Errorf("ent: RepoLabelGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (rlgb *RepoLabelGroupBy) Float64X(ctx context.Context) float64 { - v, err := rlgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (rlgb *RepoLabelGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(rlgb.fields) > 1 { - return nil, errors.New("ent: RepoLabelGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := rlgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (rlgb *RepoLabelGroupBy) BoolsX(ctx context.Context) []bool { - v, err := rlgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rlgb *RepoLabelGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = rlgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repolabel.Label} - default: - err = fmt.Errorf("ent: RepoLabelGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (rlgb *RepoLabelGroupBy) BoolX(ctx context.Context) bool { - v, err := rlgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (rlgb *RepoLabelGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range rlgb.fields { - if !repolabel.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := rlgb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := rlgb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (rlgb *RepoLabelGroupBy) sqlQuery() *sql.Selector { - selector := rlgb.sql.Select() - aggregation := make([]string, 0, len(rlgb.fns)) - for _, fn := range rlgb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(rlgb.fields)+len(rlgb.fns)) - for _, f := range rlgb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(rlgb.fields...)...) -} - -// RepoLabelSelect is the builder for selecting fields of RepoLabel entities. -type RepoLabelSelect struct { - *RepoLabelQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (rls *RepoLabelSelect) Scan(ctx context.Context, v interface{}) error { - if err := rls.prepareQuery(ctx); err != nil { - return err - } - rls.sql = rls.RepoLabelQuery.sqlQuery(ctx) - return rls.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (rls *RepoLabelSelect) ScanX(ctx context.Context, v interface{}) { - if err := rls.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (rls *RepoLabelSelect) Strings(ctx context.Context) ([]string, error) { - if len(rls.fields) > 1 { - return nil, errors.New("ent: RepoLabelSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := rls.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (rls *RepoLabelSelect) StringsX(ctx context.Context) []string { - v, err := rls.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (rls *RepoLabelSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = rls.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repolabel.Label} - default: - err = fmt.Errorf("ent: RepoLabelSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (rls *RepoLabelSelect) StringX(ctx context.Context) string { - v, err := rls.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (rls *RepoLabelSelect) Ints(ctx context.Context) ([]int, error) { - if len(rls.fields) > 1 { - return nil, errors.New("ent: RepoLabelSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := rls.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (rls *RepoLabelSelect) IntsX(ctx context.Context) []int { - v, err := rls.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (rls *RepoLabelSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = rls.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repolabel.Label} - default: - err = fmt.Errorf("ent: RepoLabelSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (rls *RepoLabelSelect) IntX(ctx context.Context) int { - v, err := rls.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (rls *RepoLabelSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(rls.fields) > 1 { - return nil, errors.New("ent: RepoLabelSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := rls.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (rls *RepoLabelSelect) Float64sX(ctx context.Context) []float64 { - v, err := rls.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (rls *RepoLabelSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = rls.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repolabel.Label} - default: - err = fmt.Errorf("ent: RepoLabelSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (rls *RepoLabelSelect) Float64X(ctx context.Context) float64 { - v, err := rls.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (rls *RepoLabelSelect) Bools(ctx context.Context) ([]bool, error) { - if len(rls.fields) > 1 { - return nil, errors.New("ent: RepoLabelSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := rls.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (rls *RepoLabelSelect) BoolsX(ctx context.Context) []bool { - v, err := rls.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (rls *RepoLabelSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = rls.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repolabel.Label} - default: - err = fmt.Errorf("ent: RepoLabelSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (rls *RepoLabelSelect) BoolX(ctx context.Context) bool { - v, err := rls.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (rls *RepoLabelSelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := rls.sql.Query() - if err := rls.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/repolabel_update.go b/pkg/infra/ent/repolabel_update.go deleted file mode 100644 index f49d20c..0000000 --- a/pkg/infra/ent/repolabel_update.go +++ /dev/null @@ -1,497 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" -) - -// RepoLabelUpdate is the builder for updating RepoLabel entities. -type RepoLabelUpdate struct { - config - hooks []Hook - mutation *RepoLabelMutation -} - -// Where appends a list predicates to the RepoLabelUpdate builder. -func (rlu *RepoLabelUpdate) Where(ps ...predicate.RepoLabel) *RepoLabelUpdate { - rlu.mutation.Where(ps...) - return rlu -} - -// SetName sets the "name" field. -func (rlu *RepoLabelUpdate) SetName(s string) *RepoLabelUpdate { - rlu.mutation.SetName(s) - return rlu -} - -// SetDescription sets the "description" field. -func (rlu *RepoLabelUpdate) SetDescription(s string) *RepoLabelUpdate { - rlu.mutation.SetDescription(s) - return rlu -} - -// SetColor sets the "color" field. -func (rlu *RepoLabelUpdate) SetColor(s string) *RepoLabelUpdate { - rlu.mutation.SetColor(s) - return rlu -} - -// AddRepoIDs adds the "repos" edge to the Repository entity by IDs. -func (rlu *RepoLabelUpdate) AddRepoIDs(ids ...int) *RepoLabelUpdate { - rlu.mutation.AddRepoIDs(ids...) - return rlu -} - -// AddRepos adds the "repos" edges to the Repository entity. -func (rlu *RepoLabelUpdate) AddRepos(r ...*Repository) *RepoLabelUpdate { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return rlu.AddRepoIDs(ids...) -} - -// Mutation returns the RepoLabelMutation object of the builder. -func (rlu *RepoLabelUpdate) Mutation() *RepoLabelMutation { - return rlu.mutation -} - -// ClearRepos clears all "repos" edges to the Repository entity. -func (rlu *RepoLabelUpdate) ClearRepos() *RepoLabelUpdate { - rlu.mutation.ClearRepos() - return rlu -} - -// RemoveRepoIDs removes the "repos" edge to Repository entities by IDs. -func (rlu *RepoLabelUpdate) RemoveRepoIDs(ids ...int) *RepoLabelUpdate { - rlu.mutation.RemoveRepoIDs(ids...) - return rlu -} - -// RemoveRepos removes "repos" edges to Repository entities. -func (rlu *RepoLabelUpdate) RemoveRepos(r ...*Repository) *RepoLabelUpdate { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return rlu.RemoveRepoIDs(ids...) -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (rlu *RepoLabelUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(rlu.hooks) == 0 { - affected, err = rlu.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepoLabelMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - rlu.mutation = mutation - affected, err = rlu.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(rlu.hooks) - 1; i >= 0; i-- { - if rlu.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = rlu.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, rlu.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (rlu *RepoLabelUpdate) SaveX(ctx context.Context) int { - affected, err := rlu.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (rlu *RepoLabelUpdate) Exec(ctx context.Context) error { - _, err := rlu.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (rlu *RepoLabelUpdate) ExecX(ctx context.Context) { - if err := rlu.Exec(ctx); err != nil { - panic(err) - } -} - -func (rlu *RepoLabelUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: repolabel.Table, - Columns: repolabel.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - if ps := rlu.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := rlu.mutation.Name(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repolabel.FieldName, - }) - } - if value, ok := rlu.mutation.Description(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repolabel.FieldDescription, - }) - } - if value, ok := rlu.mutation.Color(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repolabel.FieldColor, - }) - } - if rlu.mutation.ReposCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: repolabel.ReposTable, - Columns: repolabel.ReposPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := rlu.mutation.RemovedReposIDs(); len(nodes) > 0 && !rlu.mutation.ReposCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: repolabel.ReposTable, - Columns: repolabel.ReposPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := rlu.mutation.ReposIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: repolabel.ReposTable, - Columns: repolabel.ReposPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, rlu.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{repolabel.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// RepoLabelUpdateOne is the builder for updating a single RepoLabel entity. -type RepoLabelUpdateOne struct { - config - fields []string - hooks []Hook - mutation *RepoLabelMutation -} - -// SetName sets the "name" field. -func (rluo *RepoLabelUpdateOne) SetName(s string) *RepoLabelUpdateOne { - rluo.mutation.SetName(s) - return rluo -} - -// SetDescription sets the "description" field. -func (rluo *RepoLabelUpdateOne) SetDescription(s string) *RepoLabelUpdateOne { - rluo.mutation.SetDescription(s) - return rluo -} - -// SetColor sets the "color" field. -func (rluo *RepoLabelUpdateOne) SetColor(s string) *RepoLabelUpdateOne { - rluo.mutation.SetColor(s) - return rluo -} - -// AddRepoIDs adds the "repos" edge to the Repository entity by IDs. -func (rluo *RepoLabelUpdateOne) AddRepoIDs(ids ...int) *RepoLabelUpdateOne { - rluo.mutation.AddRepoIDs(ids...) - return rluo -} - -// AddRepos adds the "repos" edges to the Repository entity. -func (rluo *RepoLabelUpdateOne) AddRepos(r ...*Repository) *RepoLabelUpdateOne { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return rluo.AddRepoIDs(ids...) -} - -// Mutation returns the RepoLabelMutation object of the builder. -func (rluo *RepoLabelUpdateOne) Mutation() *RepoLabelMutation { - return rluo.mutation -} - -// ClearRepos clears all "repos" edges to the Repository entity. -func (rluo *RepoLabelUpdateOne) ClearRepos() *RepoLabelUpdateOne { - rluo.mutation.ClearRepos() - return rluo -} - -// RemoveRepoIDs removes the "repos" edge to Repository entities by IDs. -func (rluo *RepoLabelUpdateOne) RemoveRepoIDs(ids ...int) *RepoLabelUpdateOne { - rluo.mutation.RemoveRepoIDs(ids...) - return rluo -} - -// RemoveRepos removes "repos" edges to Repository entities. -func (rluo *RepoLabelUpdateOne) RemoveRepos(r ...*Repository) *RepoLabelUpdateOne { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return rluo.RemoveRepoIDs(ids...) -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (rluo *RepoLabelUpdateOne) Select(field string, fields ...string) *RepoLabelUpdateOne { - rluo.fields = append([]string{field}, fields...) - return rluo -} - -// Save executes the query and returns the updated RepoLabel entity. -func (rluo *RepoLabelUpdateOne) Save(ctx context.Context) (*RepoLabel, error) { - var ( - err error - node *RepoLabel - ) - if len(rluo.hooks) == 0 { - node, err = rluo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepoLabelMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - rluo.mutation = mutation - node, err = rluo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(rluo.hooks) - 1; i >= 0; i-- { - if rluo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = rluo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, rluo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (rluo *RepoLabelUpdateOne) SaveX(ctx context.Context) *RepoLabel { - node, err := rluo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (rluo *RepoLabelUpdateOne) Exec(ctx context.Context) error { - _, err := rluo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (rluo *RepoLabelUpdateOne) ExecX(ctx context.Context) { - if err := rluo.Exec(ctx); err != nil { - panic(err) - } -} - -func (rluo *RepoLabelUpdateOne) sqlSave(ctx context.Context) (_node *RepoLabel, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: repolabel.Table, - Columns: repolabel.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - id, ok := rluo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing RepoLabel.ID for update")} - } - _spec.Node.ID.Value = id - if fields := rluo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, repolabel.FieldID) - for _, f := range fields { - if !repolabel.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != repolabel.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := rluo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := rluo.mutation.Name(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repolabel.FieldName, - }) - } - if value, ok := rluo.mutation.Description(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repolabel.FieldDescription, - }) - } - if value, ok := rluo.mutation.Color(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repolabel.FieldColor, - }) - } - if rluo.mutation.ReposCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: repolabel.ReposTable, - Columns: repolabel.ReposPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := rluo.mutation.RemovedReposIDs(); len(nodes) > 0 && !rluo.mutation.ReposCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: repolabel.ReposTable, - Columns: repolabel.ReposPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := rluo.mutation.ReposIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: repolabel.ReposTable, - Columns: repolabel.ReposPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &RepoLabel{config: rluo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, rluo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{repolabel.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/repository.go b/pkg/infra/ent/repository.go deleted file mode 100644 index 87432e1..0000000 --- a/pkg/infra/ent/repository.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" -) - -// Repository is the model entity for the Repository schema. -type Repository struct { - config `json:"-"` - // ID of the ent. - ID int `json:"id,omitempty"` - // Owner holds the value of the "owner" field. - Owner string `json:"owner,omitempty"` - // Name holds the value of the "name" field. - Name string `json:"name,omitempty"` - // InstallID holds the value of the "install_id" field. - InstallID int64 `json:"install_id,omitempty"` - // URL holds the value of the "url" field. - URL string `json:"url,omitempty"` - // AvatarURL holds the value of the "avatar_url" field. - AvatarURL *string `json:"avatar_url,omitempty"` - // DefaultBranch holds the value of the "default_branch" field. - DefaultBranch *string `json:"default_branch,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the RepositoryQuery when eager-loading is set. - Edges RepositoryEdges `json:"edges"` - repository_latest *string -} - -// RepositoryEdges holds the relations/edges for other nodes in the graph. -type RepositoryEdges struct { - // Scan holds the value of the scan edge. - Scan []*Scan `json:"scan,omitempty"` - // Main holds the value of the main edge. - Main []*Scan `json:"main,omitempty"` - // Latest holds the value of the latest edge. - Latest *Scan `json:"latest,omitempty"` - // Status holds the value of the status edge. - Status []*VulnStatusIndex `json:"status,omitempty"` - // Labels holds the value of the labels edge. - Labels []*RepoLabel `json:"labels,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [5]bool -} - -// ScanOrErr returns the Scan value or an error if the edge -// was not loaded in eager-loading. -func (e RepositoryEdges) ScanOrErr() ([]*Scan, error) { - if e.loadedTypes[0] { - return e.Scan, nil - } - return nil, &NotLoadedError{edge: "scan"} -} - -// MainOrErr returns the Main value or an error if the edge -// was not loaded in eager-loading. -func (e RepositoryEdges) MainOrErr() ([]*Scan, error) { - if e.loadedTypes[1] { - return e.Main, nil - } - return nil, &NotLoadedError{edge: "main"} -} - -// LatestOrErr returns the Latest value or an error if the edge -// was not loaded in eager-loading, or loaded but was not found. -func (e RepositoryEdges) LatestOrErr() (*Scan, error) { - if e.loadedTypes[2] { - if e.Latest == nil { - // The edge latest was loaded in eager-loading, - // but was not found. - return nil, &NotFoundError{label: scan.Label} - } - return e.Latest, nil - } - return nil, &NotLoadedError{edge: "latest"} -} - -// StatusOrErr returns the Status value or an error if the edge -// was not loaded in eager-loading. -func (e RepositoryEdges) StatusOrErr() ([]*VulnStatusIndex, error) { - if e.loadedTypes[3] { - return e.Status, nil - } - return nil, &NotLoadedError{edge: "status"} -} - -// LabelsOrErr returns the Labels value or an error if the edge -// was not loaded in eager-loading. -func (e RepositoryEdges) LabelsOrErr() ([]*RepoLabel, error) { - if e.loadedTypes[4] { - return e.Labels, nil - } - return nil, &NotLoadedError{edge: "labels"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*Repository) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case repository.FieldID, repository.FieldInstallID: - values[i] = new(sql.NullInt64) - case repository.FieldOwner, repository.FieldName, repository.FieldURL, repository.FieldAvatarURL, repository.FieldDefaultBranch: - values[i] = new(sql.NullString) - case repository.ForeignKeys[0]: // repository_latest - values[i] = new(sql.NullString) - default: - return nil, fmt.Errorf("unexpected column %q for type Repository", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the Repository fields. -func (r *Repository) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case repository.FieldID: - value, ok := values[i].(*sql.NullInt64) - if !ok { - return fmt.Errorf("unexpected type %T for field id", value) - } - r.ID = int(value.Int64) - case repository.FieldOwner: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field owner", values[i]) - } else if value.Valid { - r.Owner = value.String - } - case repository.FieldName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field name", values[i]) - } else if value.Valid { - r.Name = value.String - } - case repository.FieldInstallID: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field install_id", values[i]) - } else if value.Valid { - r.InstallID = value.Int64 - } - case repository.FieldURL: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field url", values[i]) - } else if value.Valid { - r.URL = value.String - } - case repository.FieldAvatarURL: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field avatar_url", values[i]) - } else if value.Valid { - r.AvatarURL = new(string) - *r.AvatarURL = value.String - } - case repository.FieldDefaultBranch: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field default_branch", values[i]) - } else if value.Valid { - r.DefaultBranch = new(string) - *r.DefaultBranch = value.String - } - case repository.ForeignKeys[0]: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field repository_latest", values[i]) - } else if value.Valid { - r.repository_latest = new(string) - *r.repository_latest = value.String - } - } - } - return nil -} - -// QueryScan queries the "scan" edge of the Repository entity. -func (r *Repository) QueryScan() *ScanQuery { - return (&RepositoryClient{config: r.config}).QueryScan(r) -} - -// QueryMain queries the "main" edge of the Repository entity. -func (r *Repository) QueryMain() *ScanQuery { - return (&RepositoryClient{config: r.config}).QueryMain(r) -} - -// QueryLatest queries the "latest" edge of the Repository entity. -func (r *Repository) QueryLatest() *ScanQuery { - return (&RepositoryClient{config: r.config}).QueryLatest(r) -} - -// QueryStatus queries the "status" edge of the Repository entity. -func (r *Repository) QueryStatus() *VulnStatusIndexQuery { - return (&RepositoryClient{config: r.config}).QueryStatus(r) -} - -// QueryLabels queries the "labels" edge of the Repository entity. -func (r *Repository) QueryLabels() *RepoLabelQuery { - return (&RepositoryClient{config: r.config}).QueryLabels(r) -} - -// Update returns a builder for updating this Repository. -// Note that you need to call Repository.Unwrap() before calling this method if this Repository -// was returned from a transaction, and the transaction was committed or rolled back. -func (r *Repository) Update() *RepositoryUpdateOne { - return (&RepositoryClient{config: r.config}).UpdateOne(r) -} - -// Unwrap unwraps the Repository entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (r *Repository) Unwrap() *Repository { - tx, ok := r.config.driver.(*txDriver) - if !ok { - panic("ent: Repository is not a transactional entity") - } - r.config.driver = tx.drv - return r -} - -// String implements the fmt.Stringer. -func (r *Repository) String() string { - var builder strings.Builder - builder.WriteString("Repository(") - builder.WriteString(fmt.Sprintf("id=%v", r.ID)) - builder.WriteString(", owner=") - builder.WriteString(r.Owner) - builder.WriteString(", name=") - builder.WriteString(r.Name) - builder.WriteString(", install_id=") - builder.WriteString(fmt.Sprintf("%v", r.InstallID)) - builder.WriteString(", url=") - builder.WriteString(r.URL) - if v := r.AvatarURL; v != nil { - builder.WriteString(", avatar_url=") - builder.WriteString(*v) - } - if v := r.DefaultBranch; v != nil { - builder.WriteString(", default_branch=") - builder.WriteString(*v) - } - builder.WriteByte(')') - return builder.String() -} - -// Repositories is a parsable slice of Repository. -type Repositories []*Repository - -func (r Repositories) config(cfg config) { - for _i := range r { - r[_i].config = cfg - } -} diff --git a/pkg/infra/ent/repository/repository.go b/pkg/infra/ent/repository/repository.go deleted file mode 100644 index f5752a2..0000000 --- a/pkg/infra/ent/repository/repository.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package repository - -const ( - // Label holds the string label denoting the repository type in the database. - Label = "repository" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldOwner holds the string denoting the owner field in the database. - FieldOwner = "owner" - // FieldName holds the string denoting the name field in the database. - FieldName = "name" - // FieldInstallID holds the string denoting the install_id field in the database. - FieldInstallID = "install_id" - // FieldURL holds the string denoting the url field in the database. - FieldURL = "url" - // FieldAvatarURL holds the string denoting the avatar_url field in the database. - FieldAvatarURL = "avatar_url" - // FieldDefaultBranch holds the string denoting the default_branch field in the database. - FieldDefaultBranch = "default_branch" - // EdgeScan holds the string denoting the scan edge name in mutations. - EdgeScan = "scan" - // EdgeMain holds the string denoting the main edge name in mutations. - EdgeMain = "main" - // EdgeLatest holds the string denoting the latest edge name in mutations. - EdgeLatest = "latest" - // EdgeStatus holds the string denoting the status edge name in mutations. - EdgeStatus = "status" - // EdgeLabels holds the string denoting the labels edge name in mutations. - EdgeLabels = "labels" - // Table holds the table name of the repository in the database. - Table = "repositories" - // ScanTable is the table that holds the scan relation/edge. The primary key declared below. - ScanTable = "repository_scan" - // ScanInverseTable is the table name for the Scan entity. - // It exists in this package in order to avoid circular dependency with the "scan" package. - ScanInverseTable = "scans" - // MainTable is the table that holds the main relation/edge. - MainTable = "scans" - // MainInverseTable is the table name for the Scan entity. - // It exists in this package in order to avoid circular dependency with the "scan" package. - MainInverseTable = "scans" - // MainColumn is the table column denoting the main relation/edge. - MainColumn = "repository_main" - // LatestTable is the table that holds the latest relation/edge. - LatestTable = "repositories" - // LatestInverseTable is the table name for the Scan entity. - // It exists in this package in order to avoid circular dependency with the "scan" package. - LatestInverseTable = "scans" - // LatestColumn is the table column denoting the latest relation/edge. - LatestColumn = "repository_latest" - // StatusTable is the table that holds the status relation/edge. - StatusTable = "vuln_status_indexes" - // StatusInverseTable is the table name for the VulnStatusIndex entity. - // It exists in this package in order to avoid circular dependency with the "vulnstatusindex" package. - StatusInverseTable = "vuln_status_indexes" - // StatusColumn is the table column denoting the status relation/edge. - StatusColumn = "repository_status" - // LabelsTable is the table that holds the labels relation/edge. The primary key declared below. - LabelsTable = "repository_labels" - // LabelsInverseTable is the table name for the RepoLabel entity. - // It exists in this package in order to avoid circular dependency with the "repolabel" package. - LabelsInverseTable = "repo_labels" -) - -// Columns holds all SQL columns for repository fields. -var Columns = []string{ - FieldID, - FieldOwner, - FieldName, - FieldInstallID, - FieldURL, - FieldAvatarURL, - FieldDefaultBranch, -} - -// ForeignKeys holds the SQL foreign-keys that are owned by the "repositories" -// table and are not defined as standalone fields in the schema. -var ForeignKeys = []string{ - "repository_latest", -} - -var ( - // ScanPrimaryKey and ScanColumn2 are the table columns denoting the - // primary key for the scan relation (M2M). - ScanPrimaryKey = []string{"repository_id", "scan_id"} - // LabelsPrimaryKey and LabelsColumn2 are the table columns denoting the - // primary key for the labels relation (M2M). - LabelsPrimaryKey = []string{"repository_id", "repo_label_id"} -) - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - for i := range ForeignKeys { - if column == ForeignKeys[i] { - return true - } - } - return false -} diff --git a/pkg/infra/ent/repository/where.go b/pkg/infra/ent/repository/where.go deleted file mode 100644 index 7e1862b..0000000 --- a/pkg/infra/ent/repository/where.go +++ /dev/null @@ -1,993 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package repository - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id int) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id int) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id int) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...int) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...int) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id int) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id int) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id int) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id int) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// Owner applies equality check predicate on the "owner" field. It's identical to OwnerEQ. -func Owner(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldOwner), v)) - }) -} - -// Name applies equality check predicate on the "name" field. It's identical to NameEQ. -func Name(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldName), v)) - }) -} - -// InstallID applies equality check predicate on the "install_id" field. It's identical to InstallIDEQ. -func InstallID(v int64) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldInstallID), v)) - }) -} - -// URL applies equality check predicate on the "url" field. It's identical to URLEQ. -func URL(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldURL), v)) - }) -} - -// AvatarURL applies equality check predicate on the "avatar_url" field. It's identical to AvatarURLEQ. -func AvatarURL(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldAvatarURL), v)) - }) -} - -// DefaultBranch applies equality check predicate on the "default_branch" field. It's identical to DefaultBranchEQ. -func DefaultBranch(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldDefaultBranch), v)) - }) -} - -// OwnerEQ applies the EQ predicate on the "owner" field. -func OwnerEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldOwner), v)) - }) -} - -// OwnerNEQ applies the NEQ predicate on the "owner" field. -func OwnerNEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldOwner), v)) - }) -} - -// OwnerIn applies the In predicate on the "owner" field. -func OwnerIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldOwner), v...)) - }) -} - -// OwnerNotIn applies the NotIn predicate on the "owner" field. -func OwnerNotIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldOwner), v...)) - }) -} - -// OwnerGT applies the GT predicate on the "owner" field. -func OwnerGT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldOwner), v)) - }) -} - -// OwnerGTE applies the GTE predicate on the "owner" field. -func OwnerGTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldOwner), v)) - }) -} - -// OwnerLT applies the LT predicate on the "owner" field. -func OwnerLT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldOwner), v)) - }) -} - -// OwnerLTE applies the LTE predicate on the "owner" field. -func OwnerLTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldOwner), v)) - }) -} - -// OwnerContains applies the Contains predicate on the "owner" field. -func OwnerContains(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldOwner), v)) - }) -} - -// OwnerHasPrefix applies the HasPrefix predicate on the "owner" field. -func OwnerHasPrefix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldOwner), v)) - }) -} - -// OwnerHasSuffix applies the HasSuffix predicate on the "owner" field. -func OwnerHasSuffix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldOwner), v)) - }) -} - -// OwnerEqualFold applies the EqualFold predicate on the "owner" field. -func OwnerEqualFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldOwner), v)) - }) -} - -// OwnerContainsFold applies the ContainsFold predicate on the "owner" field. -func OwnerContainsFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldOwner), v)) - }) -} - -// NameEQ applies the EQ predicate on the "name" field. -func NameEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldName), v)) - }) -} - -// NameNEQ applies the NEQ predicate on the "name" field. -func NameNEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldName), v)) - }) -} - -// NameIn applies the In predicate on the "name" field. -func NameIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldName), v...)) - }) -} - -// NameNotIn applies the NotIn predicate on the "name" field. -func NameNotIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldName), v...)) - }) -} - -// NameGT applies the GT predicate on the "name" field. -func NameGT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldName), v)) - }) -} - -// NameGTE applies the GTE predicate on the "name" field. -func NameGTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldName), v)) - }) -} - -// NameLT applies the LT predicate on the "name" field. -func NameLT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldName), v)) - }) -} - -// NameLTE applies the LTE predicate on the "name" field. -func NameLTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldName), v)) - }) -} - -// NameContains applies the Contains predicate on the "name" field. -func NameContains(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldName), v)) - }) -} - -// NameHasPrefix applies the HasPrefix predicate on the "name" field. -func NameHasPrefix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldName), v)) - }) -} - -// NameHasSuffix applies the HasSuffix predicate on the "name" field. -func NameHasSuffix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldName), v)) - }) -} - -// NameEqualFold applies the EqualFold predicate on the "name" field. -func NameEqualFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldName), v)) - }) -} - -// NameContainsFold applies the ContainsFold predicate on the "name" field. -func NameContainsFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldName), v)) - }) -} - -// InstallIDEQ applies the EQ predicate on the "install_id" field. -func InstallIDEQ(v int64) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldInstallID), v)) - }) -} - -// InstallIDNEQ applies the NEQ predicate on the "install_id" field. -func InstallIDNEQ(v int64) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldInstallID), v)) - }) -} - -// InstallIDIn applies the In predicate on the "install_id" field. -func InstallIDIn(vs ...int64) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldInstallID), v...)) - }) -} - -// InstallIDNotIn applies the NotIn predicate on the "install_id" field. -func InstallIDNotIn(vs ...int64) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldInstallID), v...)) - }) -} - -// InstallIDGT applies the GT predicate on the "install_id" field. -func InstallIDGT(v int64) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldInstallID), v)) - }) -} - -// InstallIDGTE applies the GTE predicate on the "install_id" field. -func InstallIDGTE(v int64) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldInstallID), v)) - }) -} - -// InstallIDLT applies the LT predicate on the "install_id" field. -func InstallIDLT(v int64) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldInstallID), v)) - }) -} - -// InstallIDLTE applies the LTE predicate on the "install_id" field. -func InstallIDLTE(v int64) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldInstallID), v)) - }) -} - -// InstallIDIsNil applies the IsNil predicate on the "install_id" field. -func InstallIDIsNil() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldInstallID))) - }) -} - -// InstallIDNotNil applies the NotNil predicate on the "install_id" field. -func InstallIDNotNil() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldInstallID))) - }) -} - -// URLEQ applies the EQ predicate on the "url" field. -func URLEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldURL), v)) - }) -} - -// URLNEQ applies the NEQ predicate on the "url" field. -func URLNEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldURL), v)) - }) -} - -// URLIn applies the In predicate on the "url" field. -func URLIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldURL), v...)) - }) -} - -// URLNotIn applies the NotIn predicate on the "url" field. -func URLNotIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldURL), v...)) - }) -} - -// URLGT applies the GT predicate on the "url" field. -func URLGT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldURL), v)) - }) -} - -// URLGTE applies the GTE predicate on the "url" field. -func URLGTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldURL), v)) - }) -} - -// URLLT applies the LT predicate on the "url" field. -func URLLT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldURL), v)) - }) -} - -// URLLTE applies the LTE predicate on the "url" field. -func URLLTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldURL), v)) - }) -} - -// URLContains applies the Contains predicate on the "url" field. -func URLContains(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldURL), v)) - }) -} - -// URLHasPrefix applies the HasPrefix predicate on the "url" field. -func URLHasPrefix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldURL), v)) - }) -} - -// URLHasSuffix applies the HasSuffix predicate on the "url" field. -func URLHasSuffix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldURL), v)) - }) -} - -// URLIsNil applies the IsNil predicate on the "url" field. -func URLIsNil() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldURL))) - }) -} - -// URLNotNil applies the NotNil predicate on the "url" field. -func URLNotNil() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldURL))) - }) -} - -// URLEqualFold applies the EqualFold predicate on the "url" field. -func URLEqualFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldURL), v)) - }) -} - -// URLContainsFold applies the ContainsFold predicate on the "url" field. -func URLContainsFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldURL), v)) - }) -} - -// AvatarURLEQ applies the EQ predicate on the "avatar_url" field. -func AvatarURLEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLNEQ applies the NEQ predicate on the "avatar_url" field. -func AvatarURLNEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLIn applies the In predicate on the "avatar_url" field. -func AvatarURLIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldAvatarURL), v...)) - }) -} - -// AvatarURLNotIn applies the NotIn predicate on the "avatar_url" field. -func AvatarURLNotIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldAvatarURL), v...)) - }) -} - -// AvatarURLGT applies the GT predicate on the "avatar_url" field. -func AvatarURLGT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLGTE applies the GTE predicate on the "avatar_url" field. -func AvatarURLGTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLLT applies the LT predicate on the "avatar_url" field. -func AvatarURLLT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLLTE applies the LTE predicate on the "avatar_url" field. -func AvatarURLLTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLContains applies the Contains predicate on the "avatar_url" field. -func AvatarURLContains(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLHasPrefix applies the HasPrefix predicate on the "avatar_url" field. -func AvatarURLHasPrefix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLHasSuffix applies the HasSuffix predicate on the "avatar_url" field. -func AvatarURLHasSuffix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLIsNil applies the IsNil predicate on the "avatar_url" field. -func AvatarURLIsNil() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldAvatarURL))) - }) -} - -// AvatarURLNotNil applies the NotNil predicate on the "avatar_url" field. -func AvatarURLNotNil() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldAvatarURL))) - }) -} - -// AvatarURLEqualFold applies the EqualFold predicate on the "avatar_url" field. -func AvatarURLEqualFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLContainsFold applies the ContainsFold predicate on the "avatar_url" field. -func AvatarURLContainsFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldAvatarURL), v)) - }) -} - -// DefaultBranchEQ applies the EQ predicate on the "default_branch" field. -func DefaultBranchEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchNEQ applies the NEQ predicate on the "default_branch" field. -func DefaultBranchNEQ(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchIn applies the In predicate on the "default_branch" field. -func DefaultBranchIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldDefaultBranch), v...)) - }) -} - -// DefaultBranchNotIn applies the NotIn predicate on the "default_branch" field. -func DefaultBranchNotIn(vs ...string) predicate.Repository { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Repository(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldDefaultBranch), v...)) - }) -} - -// DefaultBranchGT applies the GT predicate on the "default_branch" field. -func DefaultBranchGT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchGTE applies the GTE predicate on the "default_branch" field. -func DefaultBranchGTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchLT applies the LT predicate on the "default_branch" field. -func DefaultBranchLT(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchLTE applies the LTE predicate on the "default_branch" field. -func DefaultBranchLTE(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchContains applies the Contains predicate on the "default_branch" field. -func DefaultBranchContains(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchHasPrefix applies the HasPrefix predicate on the "default_branch" field. -func DefaultBranchHasPrefix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchHasSuffix applies the HasSuffix predicate on the "default_branch" field. -func DefaultBranchHasSuffix(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchIsNil applies the IsNil predicate on the "default_branch" field. -func DefaultBranchIsNil() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldDefaultBranch))) - }) -} - -// DefaultBranchNotNil applies the NotNil predicate on the "default_branch" field. -func DefaultBranchNotNil() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldDefaultBranch))) - }) -} - -// DefaultBranchEqualFold applies the EqualFold predicate on the "default_branch" field. -func DefaultBranchEqualFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldDefaultBranch), v)) - }) -} - -// DefaultBranchContainsFold applies the ContainsFold predicate on the "default_branch" field. -func DefaultBranchContainsFold(v string) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldDefaultBranch), v)) - }) -} - -// HasScan applies the HasEdge predicate on the "scan" edge. -func HasScan() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(ScanTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, ScanTable, ScanPrimaryKey...), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasScanWith applies the HasEdge predicate on the "scan" edge with a given conditions (other predicates). -func HasScanWith(preds ...predicate.Scan) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(ScanInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, ScanTable, ScanPrimaryKey...), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// HasMain applies the HasEdge predicate on the "main" edge. -func HasMain() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(MainTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, MainTable, MainColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasMainWith applies the HasEdge predicate on the "main" edge with a given conditions (other predicates). -func HasMainWith(preds ...predicate.Scan) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(MainInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, MainTable, MainColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// HasLatest applies the HasEdge predicate on the "latest" edge. -func HasLatest() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(LatestTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, LatestTable, LatestColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasLatestWith applies the HasEdge predicate on the "latest" edge with a given conditions (other predicates). -func HasLatestWith(preds ...predicate.Scan) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(LatestInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, LatestTable, LatestColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// HasStatus applies the HasEdge predicate on the "status" edge. -func HasStatus() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(StatusTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, StatusTable, StatusColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasStatusWith applies the HasEdge predicate on the "status" edge with a given conditions (other predicates). -func HasStatusWith(preds ...predicate.VulnStatusIndex) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(StatusInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, StatusTable, StatusColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// HasLabels applies the HasEdge predicate on the "labels" edge. -func HasLabels() predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(LabelsTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, LabelsTable, LabelsPrimaryKey...), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasLabelsWith applies the HasEdge predicate on the "labels" edge with a given conditions (other predicates). -func HasLabelsWith(preds ...predicate.RepoLabel) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(LabelsInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, LabelsTable, LabelsPrimaryKey...), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.Repository) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.Repository) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.Repository) predicate.Repository { - return predicate.Repository(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/repository_create.go b/pkg/infra/ent/repository_create.go deleted file mode 100644 index a2a2fa7..0000000 --- a/pkg/infra/ent/repository_create.go +++ /dev/null @@ -1,1059 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// RepositoryCreate is the builder for creating a Repository entity. -type RepositoryCreate struct { - config - mutation *RepositoryMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetOwner sets the "owner" field. -func (rc *RepositoryCreate) SetOwner(s string) *RepositoryCreate { - rc.mutation.SetOwner(s) - return rc -} - -// SetName sets the "name" field. -func (rc *RepositoryCreate) SetName(s string) *RepositoryCreate { - rc.mutation.SetName(s) - return rc -} - -// SetInstallID sets the "install_id" field. -func (rc *RepositoryCreate) SetInstallID(i int64) *RepositoryCreate { - rc.mutation.SetInstallID(i) - return rc -} - -// SetNillableInstallID sets the "install_id" field if the given value is not nil. -func (rc *RepositoryCreate) SetNillableInstallID(i *int64) *RepositoryCreate { - if i != nil { - rc.SetInstallID(*i) - } - return rc -} - -// SetURL sets the "url" field. -func (rc *RepositoryCreate) SetURL(s string) *RepositoryCreate { - rc.mutation.SetURL(s) - return rc -} - -// SetNillableURL sets the "url" field if the given value is not nil. -func (rc *RepositoryCreate) SetNillableURL(s *string) *RepositoryCreate { - if s != nil { - rc.SetURL(*s) - } - return rc -} - -// SetAvatarURL sets the "avatar_url" field. -func (rc *RepositoryCreate) SetAvatarURL(s string) *RepositoryCreate { - rc.mutation.SetAvatarURL(s) - return rc -} - -// SetNillableAvatarURL sets the "avatar_url" field if the given value is not nil. -func (rc *RepositoryCreate) SetNillableAvatarURL(s *string) *RepositoryCreate { - if s != nil { - rc.SetAvatarURL(*s) - } - return rc -} - -// SetDefaultBranch sets the "default_branch" field. -func (rc *RepositoryCreate) SetDefaultBranch(s string) *RepositoryCreate { - rc.mutation.SetDefaultBranch(s) - return rc -} - -// SetNillableDefaultBranch sets the "default_branch" field if the given value is not nil. -func (rc *RepositoryCreate) SetNillableDefaultBranch(s *string) *RepositoryCreate { - if s != nil { - rc.SetDefaultBranch(*s) - } - return rc -} - -// AddScanIDs adds the "scan" edge to the Scan entity by IDs. -func (rc *RepositoryCreate) AddScanIDs(ids ...string) *RepositoryCreate { - rc.mutation.AddScanIDs(ids...) - return rc -} - -// AddScan adds the "scan" edges to the Scan entity. -func (rc *RepositoryCreate) AddScan(s ...*Scan) *RepositoryCreate { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return rc.AddScanIDs(ids...) -} - -// AddMainIDs adds the "main" edge to the Scan entity by IDs. -func (rc *RepositoryCreate) AddMainIDs(ids ...string) *RepositoryCreate { - rc.mutation.AddMainIDs(ids...) - return rc -} - -// AddMain adds the "main" edges to the Scan entity. -func (rc *RepositoryCreate) AddMain(s ...*Scan) *RepositoryCreate { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return rc.AddMainIDs(ids...) -} - -// SetLatestID sets the "latest" edge to the Scan entity by ID. -func (rc *RepositoryCreate) SetLatestID(id string) *RepositoryCreate { - rc.mutation.SetLatestID(id) - return rc -} - -// SetNillableLatestID sets the "latest" edge to the Scan entity by ID if the given value is not nil. -func (rc *RepositoryCreate) SetNillableLatestID(id *string) *RepositoryCreate { - if id != nil { - rc = rc.SetLatestID(*id) - } - return rc -} - -// SetLatest sets the "latest" edge to the Scan entity. -func (rc *RepositoryCreate) SetLatest(s *Scan) *RepositoryCreate { - return rc.SetLatestID(s.ID) -} - -// AddStatuIDs adds the "status" edge to the VulnStatusIndex entity by IDs. -func (rc *RepositoryCreate) AddStatuIDs(ids ...string) *RepositoryCreate { - rc.mutation.AddStatuIDs(ids...) - return rc -} - -// AddStatus adds the "status" edges to the VulnStatusIndex entity. -func (rc *RepositoryCreate) AddStatus(v ...*VulnStatusIndex) *RepositoryCreate { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return rc.AddStatuIDs(ids...) -} - -// AddLabelIDs adds the "labels" edge to the RepoLabel entity by IDs. -func (rc *RepositoryCreate) AddLabelIDs(ids ...int) *RepositoryCreate { - rc.mutation.AddLabelIDs(ids...) - return rc -} - -// AddLabels adds the "labels" edges to the RepoLabel entity. -func (rc *RepositoryCreate) AddLabels(r ...*RepoLabel) *RepositoryCreate { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return rc.AddLabelIDs(ids...) -} - -// Mutation returns the RepositoryMutation object of the builder. -func (rc *RepositoryCreate) Mutation() *RepositoryMutation { - return rc.mutation -} - -// Save creates the Repository in the database. -func (rc *RepositoryCreate) Save(ctx context.Context) (*Repository, error) { - var ( - err error - node *Repository - ) - if len(rc.hooks) == 0 { - if err = rc.check(); err != nil { - return nil, err - } - node, err = rc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepositoryMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = rc.check(); err != nil { - return nil, err - } - rc.mutation = mutation - if node, err = rc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(rc.hooks) - 1; i >= 0; i-- { - if rc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = rc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, rc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (rc *RepositoryCreate) SaveX(ctx context.Context) *Repository { - v, err := rc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (rc *RepositoryCreate) Exec(ctx context.Context) error { - _, err := rc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (rc *RepositoryCreate) ExecX(ctx context.Context) { - if err := rc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (rc *RepositoryCreate) check() error { - if _, ok := rc.mutation.Owner(); !ok { - return &ValidationError{Name: "owner", err: errors.New(`ent: missing required field "owner"`)} - } - if _, ok := rc.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "name"`)} - } - return nil -} - -func (rc *RepositoryCreate) sqlSave(ctx context.Context) (*Repository, error) { - _node, _spec := rc.createSpec() - if err := sqlgraph.CreateNode(ctx, rc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - id := _spec.ID.Value.(int64) - _node.ID = int(id) - return _node, nil -} - -func (rc *RepositoryCreate) createSpec() (*Repository, *sqlgraph.CreateSpec) { - var ( - _node = &Repository{config: rc.config} - _spec = &sqlgraph.CreateSpec{ - Table: repository.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - } - ) - _spec.OnConflict = rc.conflict - if value, ok := rc.mutation.Owner(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldOwner, - }) - _node.Owner = value - } - if value, ok := rc.mutation.Name(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldName, - }) - _node.Name = value - } - if value, ok := rc.mutation.InstallID(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: repository.FieldInstallID, - }) - _node.InstallID = value - } - if value, ok := rc.mutation.URL(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldURL, - }) - _node.URL = value - } - if value, ok := rc.mutation.AvatarURL(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldAvatarURL, - }) - _node.AvatarURL = &value - } - if value, ok := rc.mutation.DefaultBranch(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldDefaultBranch, - }) - _node.DefaultBranch = &value - } - if nodes := rc.mutation.ScanIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.ScanTable, - Columns: repository.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - if nodes := rc.mutation.MainIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.MainTable, - Columns: []string{repository.MainColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - if nodes := rc.mutation.LatestIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: repository.LatestTable, - Columns: []string{repository.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _node.repository_latest = &nodes[0] - _spec.Edges = append(_spec.Edges, edge) - } - if nodes := rc.mutation.StatusIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.StatusTable, - Columns: []string{repository.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - if nodes := rc.mutation.LabelsIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.LabelsTable, - Columns: repository.LabelsPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Repository.Create(). -// SetOwner(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.RepositoryUpsert) { -// SetOwner(v+v). -// }). -// Exec(ctx) -// -func (rc *RepositoryCreate) OnConflict(opts ...sql.ConflictOption) *RepositoryUpsertOne { - rc.conflict = opts - return &RepositoryUpsertOne{ - create: rc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Repository.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (rc *RepositoryCreate) OnConflictColumns(columns ...string) *RepositoryUpsertOne { - rc.conflict = append(rc.conflict, sql.ConflictColumns(columns...)) - return &RepositoryUpsertOne{ - create: rc, - } -} - -type ( - // RepositoryUpsertOne is the builder for "upsert"-ing - // one Repository node. - RepositoryUpsertOne struct { - create *RepositoryCreate - } - - // RepositoryUpsert is the "OnConflict" setter. - RepositoryUpsert struct { - *sql.UpdateSet - } -) - -// SetOwner sets the "owner" field. -func (u *RepositoryUpsert) SetOwner(v string) *RepositoryUpsert { - u.Set(repository.FieldOwner, v) - return u -} - -// UpdateOwner sets the "owner" field to the value that was provided on create. -func (u *RepositoryUpsert) UpdateOwner() *RepositoryUpsert { - u.SetExcluded(repository.FieldOwner) - return u -} - -// SetName sets the "name" field. -func (u *RepositoryUpsert) SetName(v string) *RepositoryUpsert { - u.Set(repository.FieldName, v) - return u -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *RepositoryUpsert) UpdateName() *RepositoryUpsert { - u.SetExcluded(repository.FieldName) - return u -} - -// SetInstallID sets the "install_id" field. -func (u *RepositoryUpsert) SetInstallID(v int64) *RepositoryUpsert { - u.Set(repository.FieldInstallID, v) - return u -} - -// UpdateInstallID sets the "install_id" field to the value that was provided on create. -func (u *RepositoryUpsert) UpdateInstallID() *RepositoryUpsert { - u.SetExcluded(repository.FieldInstallID) - return u -} - -// ClearInstallID clears the value of the "install_id" field. -func (u *RepositoryUpsert) ClearInstallID() *RepositoryUpsert { - u.SetNull(repository.FieldInstallID) - return u -} - -// SetURL sets the "url" field. -func (u *RepositoryUpsert) SetURL(v string) *RepositoryUpsert { - u.Set(repository.FieldURL, v) - return u -} - -// UpdateURL sets the "url" field to the value that was provided on create. -func (u *RepositoryUpsert) UpdateURL() *RepositoryUpsert { - u.SetExcluded(repository.FieldURL) - return u -} - -// ClearURL clears the value of the "url" field. -func (u *RepositoryUpsert) ClearURL() *RepositoryUpsert { - u.SetNull(repository.FieldURL) - return u -} - -// SetAvatarURL sets the "avatar_url" field. -func (u *RepositoryUpsert) SetAvatarURL(v string) *RepositoryUpsert { - u.Set(repository.FieldAvatarURL, v) - return u -} - -// UpdateAvatarURL sets the "avatar_url" field to the value that was provided on create. -func (u *RepositoryUpsert) UpdateAvatarURL() *RepositoryUpsert { - u.SetExcluded(repository.FieldAvatarURL) - return u -} - -// ClearAvatarURL clears the value of the "avatar_url" field. -func (u *RepositoryUpsert) ClearAvatarURL() *RepositoryUpsert { - u.SetNull(repository.FieldAvatarURL) - return u -} - -// SetDefaultBranch sets the "default_branch" field. -func (u *RepositoryUpsert) SetDefaultBranch(v string) *RepositoryUpsert { - u.Set(repository.FieldDefaultBranch, v) - return u -} - -// UpdateDefaultBranch sets the "default_branch" field to the value that was provided on create. -func (u *RepositoryUpsert) UpdateDefaultBranch() *RepositoryUpsert { - u.SetExcluded(repository.FieldDefaultBranch) - return u -} - -// ClearDefaultBranch clears the value of the "default_branch" field. -func (u *RepositoryUpsert) ClearDefaultBranch() *RepositoryUpsert { - u.SetNull(repository.FieldDefaultBranch) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create. -// Using this option is equivalent to using: -// -// client.Repository.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *RepositoryUpsertOne) UpdateNewValues() *RepositoryUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Repository.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *RepositoryUpsertOne) Ignore() *RepositoryUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *RepositoryUpsertOne) DoNothing() *RepositoryUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the RepositoryCreate.OnConflict -// documentation for more info. -func (u *RepositoryUpsertOne) Update(set func(*RepositoryUpsert)) *RepositoryUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&RepositoryUpsert{UpdateSet: update}) - })) - return u -} - -// SetOwner sets the "owner" field. -func (u *RepositoryUpsertOne) SetOwner(v string) *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.SetOwner(v) - }) -} - -// UpdateOwner sets the "owner" field to the value that was provided on create. -func (u *RepositoryUpsertOne) UpdateOwner() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateOwner() - }) -} - -// SetName sets the "name" field. -func (u *RepositoryUpsertOne) SetName(v string) *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *RepositoryUpsertOne) UpdateName() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateName() - }) -} - -// SetInstallID sets the "install_id" field. -func (u *RepositoryUpsertOne) SetInstallID(v int64) *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.SetInstallID(v) - }) -} - -// UpdateInstallID sets the "install_id" field to the value that was provided on create. -func (u *RepositoryUpsertOne) UpdateInstallID() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateInstallID() - }) -} - -// ClearInstallID clears the value of the "install_id" field. -func (u *RepositoryUpsertOne) ClearInstallID() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.ClearInstallID() - }) -} - -// SetURL sets the "url" field. -func (u *RepositoryUpsertOne) SetURL(v string) *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.SetURL(v) - }) -} - -// UpdateURL sets the "url" field to the value that was provided on create. -func (u *RepositoryUpsertOne) UpdateURL() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateURL() - }) -} - -// ClearURL clears the value of the "url" field. -func (u *RepositoryUpsertOne) ClearURL() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.ClearURL() - }) -} - -// SetAvatarURL sets the "avatar_url" field. -func (u *RepositoryUpsertOne) SetAvatarURL(v string) *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.SetAvatarURL(v) - }) -} - -// UpdateAvatarURL sets the "avatar_url" field to the value that was provided on create. -func (u *RepositoryUpsertOne) UpdateAvatarURL() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateAvatarURL() - }) -} - -// ClearAvatarURL clears the value of the "avatar_url" field. -func (u *RepositoryUpsertOne) ClearAvatarURL() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.ClearAvatarURL() - }) -} - -// SetDefaultBranch sets the "default_branch" field. -func (u *RepositoryUpsertOne) SetDefaultBranch(v string) *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.SetDefaultBranch(v) - }) -} - -// UpdateDefaultBranch sets the "default_branch" field to the value that was provided on create. -func (u *RepositoryUpsertOne) UpdateDefaultBranch() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateDefaultBranch() - }) -} - -// ClearDefaultBranch clears the value of the "default_branch" field. -func (u *RepositoryUpsertOne) ClearDefaultBranch() *RepositoryUpsertOne { - return u.Update(func(s *RepositoryUpsert) { - s.ClearDefaultBranch() - }) -} - -// Exec executes the query. -func (u *RepositoryUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for RepositoryCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *RepositoryUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *RepositoryUpsertOne) ID(ctx context.Context) (id int, err error) { - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *RepositoryUpsertOne) IDX(ctx context.Context) int { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// RepositoryCreateBulk is the builder for creating many Repository entities in bulk. -type RepositoryCreateBulk struct { - config - builders []*RepositoryCreate - conflict []sql.ConflictOption -} - -// Save creates the Repository entities in the database. -func (rcb *RepositoryCreateBulk) Save(ctx context.Context) ([]*Repository, error) { - specs := make([]*sqlgraph.CreateSpec, len(rcb.builders)) - nodes := make([]*Repository, len(rcb.builders)) - mutators := make([]Mutator, len(rcb.builders)) - for i := range rcb.builders { - func(i int, root context.Context) { - builder := rcb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepositoryMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = rcb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, rcb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - if specs[i].ID.Value != nil { - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) - } - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (rcb *RepositoryCreateBulk) SaveX(ctx context.Context) []*Repository { - v, err := rcb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (rcb *RepositoryCreateBulk) Exec(ctx context.Context) error { - _, err := rcb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (rcb *RepositoryCreateBulk) ExecX(ctx context.Context) { - if err := rcb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Repository.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.RepositoryUpsert) { -// SetOwner(v+v). -// }). -// Exec(ctx) -// -func (rcb *RepositoryCreateBulk) OnConflict(opts ...sql.ConflictOption) *RepositoryUpsertBulk { - rcb.conflict = opts - return &RepositoryUpsertBulk{ - create: rcb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Repository.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (rcb *RepositoryCreateBulk) OnConflictColumns(columns ...string) *RepositoryUpsertBulk { - rcb.conflict = append(rcb.conflict, sql.ConflictColumns(columns...)) - return &RepositoryUpsertBulk{ - create: rcb, - } -} - -// RepositoryUpsertBulk is the builder for "upsert"-ing -// a bulk of Repository nodes. -type RepositoryUpsertBulk struct { - create *RepositoryCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.Repository.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *RepositoryUpsertBulk) UpdateNewValues() *RepositoryUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Repository.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *RepositoryUpsertBulk) Ignore() *RepositoryUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *RepositoryUpsertBulk) DoNothing() *RepositoryUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the RepositoryCreateBulk.OnConflict -// documentation for more info. -func (u *RepositoryUpsertBulk) Update(set func(*RepositoryUpsert)) *RepositoryUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&RepositoryUpsert{UpdateSet: update}) - })) - return u -} - -// SetOwner sets the "owner" field. -func (u *RepositoryUpsertBulk) SetOwner(v string) *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.SetOwner(v) - }) -} - -// UpdateOwner sets the "owner" field to the value that was provided on create. -func (u *RepositoryUpsertBulk) UpdateOwner() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateOwner() - }) -} - -// SetName sets the "name" field. -func (u *RepositoryUpsertBulk) SetName(v string) *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *RepositoryUpsertBulk) UpdateName() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateName() - }) -} - -// SetInstallID sets the "install_id" field. -func (u *RepositoryUpsertBulk) SetInstallID(v int64) *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.SetInstallID(v) - }) -} - -// UpdateInstallID sets the "install_id" field to the value that was provided on create. -func (u *RepositoryUpsertBulk) UpdateInstallID() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateInstallID() - }) -} - -// ClearInstallID clears the value of the "install_id" field. -func (u *RepositoryUpsertBulk) ClearInstallID() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.ClearInstallID() - }) -} - -// SetURL sets the "url" field. -func (u *RepositoryUpsertBulk) SetURL(v string) *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.SetURL(v) - }) -} - -// UpdateURL sets the "url" field to the value that was provided on create. -func (u *RepositoryUpsertBulk) UpdateURL() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateURL() - }) -} - -// ClearURL clears the value of the "url" field. -func (u *RepositoryUpsertBulk) ClearURL() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.ClearURL() - }) -} - -// SetAvatarURL sets the "avatar_url" field. -func (u *RepositoryUpsertBulk) SetAvatarURL(v string) *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.SetAvatarURL(v) - }) -} - -// UpdateAvatarURL sets the "avatar_url" field to the value that was provided on create. -func (u *RepositoryUpsertBulk) UpdateAvatarURL() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateAvatarURL() - }) -} - -// ClearAvatarURL clears the value of the "avatar_url" field. -func (u *RepositoryUpsertBulk) ClearAvatarURL() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.ClearAvatarURL() - }) -} - -// SetDefaultBranch sets the "default_branch" field. -func (u *RepositoryUpsertBulk) SetDefaultBranch(v string) *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.SetDefaultBranch(v) - }) -} - -// UpdateDefaultBranch sets the "default_branch" field to the value that was provided on create. -func (u *RepositoryUpsertBulk) UpdateDefaultBranch() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.UpdateDefaultBranch() - }) -} - -// ClearDefaultBranch clears the value of the "default_branch" field. -func (u *RepositoryUpsertBulk) ClearDefaultBranch() *RepositoryUpsertBulk { - return u.Update(func(s *RepositoryUpsert) { - s.ClearDefaultBranch() - }) -} - -// Exec executes the query. -func (u *RepositoryUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the RepositoryCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for RepositoryCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *RepositoryUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/repository_delete.go b/pkg/infra/ent/repository_delete.go deleted file mode 100644 index 08667a5..0000000 --- a/pkg/infra/ent/repository_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" -) - -// RepositoryDelete is the builder for deleting a Repository entity. -type RepositoryDelete struct { - config - hooks []Hook - mutation *RepositoryMutation -} - -// Where appends a list predicates to the RepositoryDelete builder. -func (rd *RepositoryDelete) Where(ps ...predicate.Repository) *RepositoryDelete { - rd.mutation.Where(ps...) - return rd -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (rd *RepositoryDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(rd.hooks) == 0 { - affected, err = rd.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepositoryMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - rd.mutation = mutation - affected, err = rd.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(rd.hooks) - 1; i >= 0; i-- { - if rd.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = rd.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, rd.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (rd *RepositoryDelete) ExecX(ctx context.Context) int { - n, err := rd.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (rd *RepositoryDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: repository.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - if ps := rd.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, rd.driver, _spec) -} - -// RepositoryDeleteOne is the builder for deleting a single Repository entity. -type RepositoryDeleteOne struct { - rd *RepositoryDelete -} - -// Exec executes the deletion query. -func (rdo *RepositoryDeleteOne) Exec(ctx context.Context) error { - n, err := rdo.rd.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{repository.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (rdo *RepositoryDeleteOne) ExecX(ctx context.Context) { - rdo.rd.ExecX(ctx) -} diff --git a/pkg/infra/ent/repository_query.go b/pkg/infra/ent/repository_query.go deleted file mode 100644 index a08aec6..0000000 --- a/pkg/infra/ent/repository_query.go +++ /dev/null @@ -1,1329 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "database/sql/driver" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// RepositoryQuery is the builder for querying Repository entities. -type RepositoryQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.Repository - // eager-loading edges. - withScan *ScanQuery - withMain *ScanQuery - withLatest *ScanQuery - withStatus *VulnStatusIndexQuery - withLabels *RepoLabelQuery - withFKs bool - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the RepositoryQuery builder. -func (rq *RepositoryQuery) Where(ps ...predicate.Repository) *RepositoryQuery { - rq.predicates = append(rq.predicates, ps...) - return rq -} - -// Limit adds a limit step to the query. -func (rq *RepositoryQuery) Limit(limit int) *RepositoryQuery { - rq.limit = &limit - return rq -} - -// Offset adds an offset step to the query. -func (rq *RepositoryQuery) Offset(offset int) *RepositoryQuery { - rq.offset = &offset - return rq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (rq *RepositoryQuery) Unique(unique bool) *RepositoryQuery { - rq.unique = &unique - return rq -} - -// Order adds an order step to the query. -func (rq *RepositoryQuery) Order(o ...OrderFunc) *RepositoryQuery { - rq.order = append(rq.order, o...) - return rq -} - -// QueryScan chains the current query on the "scan" edge. -func (rq *RepositoryQuery) QueryScan() *ScanQuery { - query := &ScanQuery{config: rq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := rq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := rq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, selector), - sqlgraph.To(scan.Table, scan.FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, repository.ScanTable, repository.ScanPrimaryKey...), - ) - fromU = sqlgraph.SetNeighbors(rq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// QueryMain chains the current query on the "main" edge. -func (rq *RepositoryQuery) QueryMain() *ScanQuery { - query := &ScanQuery{config: rq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := rq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := rq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, selector), - sqlgraph.To(scan.Table, scan.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, repository.MainTable, repository.MainColumn), - ) - fromU = sqlgraph.SetNeighbors(rq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// QueryLatest chains the current query on the "latest" edge. -func (rq *RepositoryQuery) QueryLatest() *ScanQuery { - query := &ScanQuery{config: rq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := rq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := rq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, selector), - sqlgraph.To(scan.Table, scan.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, repository.LatestTable, repository.LatestColumn), - ) - fromU = sqlgraph.SetNeighbors(rq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// QueryStatus chains the current query on the "status" edge. -func (rq *RepositoryQuery) QueryStatus() *VulnStatusIndexQuery { - query := &VulnStatusIndexQuery{config: rq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := rq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := rq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, selector), - sqlgraph.To(vulnstatusindex.Table, vulnstatusindex.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, repository.StatusTable, repository.StatusColumn), - ) - fromU = sqlgraph.SetNeighbors(rq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// QueryLabels chains the current query on the "labels" edge. -func (rq *RepositoryQuery) QueryLabels() *RepoLabelQuery { - query := &RepoLabelQuery{config: rq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := rq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := rq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(repository.Table, repository.FieldID, selector), - sqlgraph.To(repolabel.Table, repolabel.FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, repository.LabelsTable, repository.LabelsPrimaryKey...), - ) - fromU = sqlgraph.SetNeighbors(rq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first Repository entity from the query. -// Returns a *NotFoundError when no Repository was found. -func (rq *RepositoryQuery) First(ctx context.Context) (*Repository, error) { - nodes, err := rq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{repository.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (rq *RepositoryQuery) FirstX(ctx context.Context) *Repository { - node, err := rq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first Repository ID from the query. -// Returns a *NotFoundError when no Repository ID was found. -func (rq *RepositoryQuery) FirstID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = rq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{repository.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (rq *RepositoryQuery) FirstIDX(ctx context.Context) int { - id, err := rq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single Repository entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one Repository entity is not found. -// Returns a *NotFoundError when no Repository entities are found. -func (rq *RepositoryQuery) Only(ctx context.Context) (*Repository, error) { - nodes, err := rq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{repository.Label} - default: - return nil, &NotSingularError{repository.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (rq *RepositoryQuery) OnlyX(ctx context.Context) *Repository { - node, err := rq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only Repository ID in the query. -// Returns a *NotSingularError when exactly one Repository ID is not found. -// Returns a *NotFoundError when no entities are found. -func (rq *RepositoryQuery) OnlyID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = rq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{repository.Label} - default: - err = &NotSingularError{repository.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (rq *RepositoryQuery) OnlyIDX(ctx context.Context) int { - id, err := rq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of Repositories. -func (rq *RepositoryQuery) All(ctx context.Context) ([]*Repository, error) { - if err := rq.prepareQuery(ctx); err != nil { - return nil, err - } - return rq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (rq *RepositoryQuery) AllX(ctx context.Context) []*Repository { - nodes, err := rq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of Repository IDs. -func (rq *RepositoryQuery) IDs(ctx context.Context) ([]int, error) { - var ids []int - if err := rq.Select(repository.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (rq *RepositoryQuery) IDsX(ctx context.Context) []int { - ids, err := rq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (rq *RepositoryQuery) Count(ctx context.Context) (int, error) { - if err := rq.prepareQuery(ctx); err != nil { - return 0, err - } - return rq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (rq *RepositoryQuery) CountX(ctx context.Context) int { - count, err := rq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (rq *RepositoryQuery) Exist(ctx context.Context) (bool, error) { - if err := rq.prepareQuery(ctx); err != nil { - return false, err - } - return rq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (rq *RepositoryQuery) ExistX(ctx context.Context) bool { - exist, err := rq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the RepositoryQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (rq *RepositoryQuery) Clone() *RepositoryQuery { - if rq == nil { - return nil - } - return &RepositoryQuery{ - config: rq.config, - limit: rq.limit, - offset: rq.offset, - order: append([]OrderFunc{}, rq.order...), - predicates: append([]predicate.Repository{}, rq.predicates...), - withScan: rq.withScan.Clone(), - withMain: rq.withMain.Clone(), - withLatest: rq.withLatest.Clone(), - withStatus: rq.withStatus.Clone(), - withLabels: rq.withLabels.Clone(), - // clone intermediate query. - sql: rq.sql.Clone(), - path: rq.path, - } -} - -// WithScan tells the query-builder to eager-load the nodes that are connected to -// the "scan" edge. The optional arguments are used to configure the query builder of the edge. -func (rq *RepositoryQuery) WithScan(opts ...func(*ScanQuery)) *RepositoryQuery { - query := &ScanQuery{config: rq.config} - for _, opt := range opts { - opt(query) - } - rq.withScan = query - return rq -} - -// WithMain tells the query-builder to eager-load the nodes that are connected to -// the "main" edge. The optional arguments are used to configure the query builder of the edge. -func (rq *RepositoryQuery) WithMain(opts ...func(*ScanQuery)) *RepositoryQuery { - query := &ScanQuery{config: rq.config} - for _, opt := range opts { - opt(query) - } - rq.withMain = query - return rq -} - -// WithLatest tells the query-builder to eager-load the nodes that are connected to -// the "latest" edge. The optional arguments are used to configure the query builder of the edge. -func (rq *RepositoryQuery) WithLatest(opts ...func(*ScanQuery)) *RepositoryQuery { - query := &ScanQuery{config: rq.config} - for _, opt := range opts { - opt(query) - } - rq.withLatest = query - return rq -} - -// WithStatus tells the query-builder to eager-load the nodes that are connected to -// the "status" edge. The optional arguments are used to configure the query builder of the edge. -func (rq *RepositoryQuery) WithStatus(opts ...func(*VulnStatusIndexQuery)) *RepositoryQuery { - query := &VulnStatusIndexQuery{config: rq.config} - for _, opt := range opts { - opt(query) - } - rq.withStatus = query - return rq -} - -// WithLabels tells the query-builder to eager-load the nodes that are connected to -// the "labels" edge. The optional arguments are used to configure the query builder of the edge. -func (rq *RepositoryQuery) WithLabels(opts ...func(*RepoLabelQuery)) *RepositoryQuery { - query := &RepoLabelQuery{config: rq.config} - for _, opt := range opts { - opt(query) - } - rq.withLabels = query - return rq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// Owner string `json:"owner,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.Repository.Query(). -// GroupBy(repository.FieldOwner). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (rq *RepositoryQuery) GroupBy(field string, fields ...string) *RepositoryGroupBy { - group := &RepositoryGroupBy{config: rq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := rq.prepareQuery(ctx); err != nil { - return nil, err - } - return rq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// Owner string `json:"owner,omitempty"` -// } -// -// client.Repository.Query(). -// Select(repository.FieldOwner). -// Scan(ctx, &v) -// -func (rq *RepositoryQuery) Select(fields ...string) *RepositorySelect { - rq.fields = append(rq.fields, fields...) - return &RepositorySelect{RepositoryQuery: rq} -} - -func (rq *RepositoryQuery) prepareQuery(ctx context.Context) error { - for _, f := range rq.fields { - if !repository.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if rq.path != nil { - prev, err := rq.path(ctx) - if err != nil { - return err - } - rq.sql = prev - } - return nil -} - -func (rq *RepositoryQuery) sqlAll(ctx context.Context) ([]*Repository, error) { - var ( - nodes = []*Repository{} - withFKs = rq.withFKs - _spec = rq.querySpec() - loadedTypes = [5]bool{ - rq.withScan != nil, - rq.withMain != nil, - rq.withLatest != nil, - rq.withStatus != nil, - rq.withLabels != nil, - } - ) - if rq.withLatest != nil { - withFKs = true - } - if withFKs { - _spec.Node.Columns = append(_spec.Node.Columns, repository.ForeignKeys...) - } - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Repository{config: rq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, rq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := rq.withScan; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[int]*Repository, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Scan = []*Scan{} - } - var ( - edgeids []string - edges = make(map[string][]*Repository) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: false, - Table: repository.ScanTable, - Columns: repository.ScanPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(repository.ScanPrimaryKey[0], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullInt64), new(sql.NullString)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullInt64) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullString) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := int(eout.Int64) - inValue := ein.String - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, rq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "scan": %w`, err) - } - query.Where(scan.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "scan" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Scan = append(nodes[i].Edges.Scan, n) - } - } - } - - if query := rq.withMain; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[int]*Repository) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.Main = []*Scan{} - } - query.withFKs = true - query.Where(predicate.Scan(func(s *sql.Selector) { - s.Where(sql.InValues(repository.MainColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - fk := n.repository_main - if fk == nil { - return nil, fmt.Errorf(`foreign-key "repository_main" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "repository_main" returned %v for node %v`, *fk, n.ID) - } - node.Edges.Main = append(node.Edges.Main, n) - } - } - - if query := rq.withLatest; query != nil { - ids := make([]string, 0, len(nodes)) - nodeids := make(map[string][]*Repository) - for i := range nodes { - if nodes[i].repository_latest == nil { - continue - } - fk := *nodes[i].repository_latest - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(scan.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "repository_latest" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Latest = n - } - } - } - - if query := rq.withStatus; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[int]*Repository) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.Status = []*VulnStatusIndex{} - } - query.withFKs = true - query.Where(predicate.VulnStatusIndex(func(s *sql.Selector) { - s.Where(sql.InValues(repository.StatusColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - fk := n.repository_status - if fk == nil { - return nil, fmt.Errorf(`foreign-key "repository_status" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "repository_status" returned %v for node %v`, *fk, n.ID) - } - node.Edges.Status = append(node.Edges.Status, n) - } - } - - if query := rq.withLabels; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[int]*Repository, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Labels = []*RepoLabel{} - } - var ( - edgeids []int - edges = make(map[int][]*Repository) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: false, - Table: repository.LabelsTable, - Columns: repository.LabelsPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(repository.LabelsPrimaryKey[0], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullInt64) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullInt64) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := int(eout.Int64) - inValue := int(ein.Int64) - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, rq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "labels": %w`, err) - } - query.Where(repolabel.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "labels" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Labels = append(nodes[i].Edges.Labels, n) - } - } - } - - return nodes, nil -} - -func (rq *RepositoryQuery) sqlCount(ctx context.Context) (int, error) { - _spec := rq.querySpec() - return sqlgraph.CountNodes(ctx, rq.driver, _spec) -} - -func (rq *RepositoryQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := rq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (rq *RepositoryQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: repository.Table, - Columns: repository.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - From: rq.sql, - Unique: true, - } - if unique := rq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := rq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, repository.FieldID) - for i := range fields { - if fields[i] != repository.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := rq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := rq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := rq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := rq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (rq *RepositoryQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(rq.driver.Dialect()) - t1 := builder.Table(repository.Table) - columns := rq.fields - if len(columns) == 0 { - columns = repository.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if rq.sql != nil { - selector = rq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range rq.predicates { - p(selector) - } - for _, p := range rq.order { - p(selector) - } - if offset := rq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := rq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// RepositoryGroupBy is the group-by builder for Repository entities. -type RepositoryGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (rgb *RepositoryGroupBy) Aggregate(fns ...AggregateFunc) *RepositoryGroupBy { - rgb.fns = append(rgb.fns, fns...) - return rgb -} - -// Scan applies the group-by query and scans the result into the given value. -func (rgb *RepositoryGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := rgb.path(ctx) - if err != nil { - return err - } - rgb.sql = query - return rgb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (rgb *RepositoryGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := rgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (rgb *RepositoryGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(rgb.fields) > 1 { - return nil, errors.New("ent: RepositoryGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := rgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (rgb *RepositoryGroupBy) StringsX(ctx context.Context) []string { - v, err := rgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rgb *RepositoryGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = rgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repository.Label} - default: - err = fmt.Errorf("ent: RepositoryGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (rgb *RepositoryGroupBy) StringX(ctx context.Context) string { - v, err := rgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (rgb *RepositoryGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(rgb.fields) > 1 { - return nil, errors.New("ent: RepositoryGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := rgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (rgb *RepositoryGroupBy) IntsX(ctx context.Context) []int { - v, err := rgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rgb *RepositoryGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = rgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repository.Label} - default: - err = fmt.Errorf("ent: RepositoryGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (rgb *RepositoryGroupBy) IntX(ctx context.Context) int { - v, err := rgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (rgb *RepositoryGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(rgb.fields) > 1 { - return nil, errors.New("ent: RepositoryGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := rgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (rgb *RepositoryGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := rgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rgb *RepositoryGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = rgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repository.Label} - default: - err = fmt.Errorf("ent: RepositoryGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (rgb *RepositoryGroupBy) Float64X(ctx context.Context) float64 { - v, err := rgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (rgb *RepositoryGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(rgb.fields) > 1 { - return nil, errors.New("ent: RepositoryGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := rgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (rgb *RepositoryGroupBy) BoolsX(ctx context.Context) []bool { - v, err := rgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rgb *RepositoryGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = rgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repository.Label} - default: - err = fmt.Errorf("ent: RepositoryGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (rgb *RepositoryGroupBy) BoolX(ctx context.Context) bool { - v, err := rgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (rgb *RepositoryGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range rgb.fields { - if !repository.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := rgb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := rgb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (rgb *RepositoryGroupBy) sqlQuery() *sql.Selector { - selector := rgb.sql.Select() - aggregation := make([]string, 0, len(rgb.fns)) - for _, fn := range rgb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(rgb.fields)+len(rgb.fns)) - for _, f := range rgb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(rgb.fields...)...) -} - -// RepositorySelect is the builder for selecting fields of Repository entities. -type RepositorySelect struct { - *RepositoryQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (rs *RepositorySelect) Scan(ctx context.Context, v interface{}) error { - if err := rs.prepareQuery(ctx); err != nil { - return err - } - rs.sql = rs.RepositoryQuery.sqlQuery(ctx) - return rs.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (rs *RepositorySelect) ScanX(ctx context.Context, v interface{}) { - if err := rs.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (rs *RepositorySelect) Strings(ctx context.Context) ([]string, error) { - if len(rs.fields) > 1 { - return nil, errors.New("ent: RepositorySelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := rs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (rs *RepositorySelect) StringsX(ctx context.Context) []string { - v, err := rs.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (rs *RepositorySelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = rs.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repository.Label} - default: - err = fmt.Errorf("ent: RepositorySelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (rs *RepositorySelect) StringX(ctx context.Context) string { - v, err := rs.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (rs *RepositorySelect) Ints(ctx context.Context) ([]int, error) { - if len(rs.fields) > 1 { - return nil, errors.New("ent: RepositorySelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := rs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (rs *RepositorySelect) IntsX(ctx context.Context) []int { - v, err := rs.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (rs *RepositorySelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = rs.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repository.Label} - default: - err = fmt.Errorf("ent: RepositorySelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (rs *RepositorySelect) IntX(ctx context.Context) int { - v, err := rs.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (rs *RepositorySelect) Float64s(ctx context.Context) ([]float64, error) { - if len(rs.fields) > 1 { - return nil, errors.New("ent: RepositorySelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := rs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (rs *RepositorySelect) Float64sX(ctx context.Context) []float64 { - v, err := rs.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (rs *RepositorySelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = rs.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repository.Label} - default: - err = fmt.Errorf("ent: RepositorySelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (rs *RepositorySelect) Float64X(ctx context.Context) float64 { - v, err := rs.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (rs *RepositorySelect) Bools(ctx context.Context) ([]bool, error) { - if len(rs.fields) > 1 { - return nil, errors.New("ent: RepositorySelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := rs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (rs *RepositorySelect) BoolsX(ctx context.Context) []bool { - v, err := rs.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (rs *RepositorySelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = rs.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{repository.Label} - default: - err = fmt.Errorf("ent: RepositorySelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (rs *RepositorySelect) BoolX(ctx context.Context) bool { - v, err := rs.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (rs *RepositorySelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := rs.sql.Query() - if err := rs.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/repository_update.go b/pkg/infra/ent/repository_update.go deleted file mode 100644 index 2f9c09b..0000000 --- a/pkg/infra/ent/repository_update.go +++ /dev/null @@ -1,1425 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/repolabel" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// RepositoryUpdate is the builder for updating Repository entities. -type RepositoryUpdate struct { - config - hooks []Hook - mutation *RepositoryMutation -} - -// Where appends a list predicates to the RepositoryUpdate builder. -func (ru *RepositoryUpdate) Where(ps ...predicate.Repository) *RepositoryUpdate { - ru.mutation.Where(ps...) - return ru -} - -// SetOwner sets the "owner" field. -func (ru *RepositoryUpdate) SetOwner(s string) *RepositoryUpdate { - ru.mutation.SetOwner(s) - return ru -} - -// SetName sets the "name" field. -func (ru *RepositoryUpdate) SetName(s string) *RepositoryUpdate { - ru.mutation.SetName(s) - return ru -} - -// SetInstallID sets the "install_id" field. -func (ru *RepositoryUpdate) SetInstallID(i int64) *RepositoryUpdate { - ru.mutation.ResetInstallID() - ru.mutation.SetInstallID(i) - return ru -} - -// SetNillableInstallID sets the "install_id" field if the given value is not nil. -func (ru *RepositoryUpdate) SetNillableInstallID(i *int64) *RepositoryUpdate { - if i != nil { - ru.SetInstallID(*i) - } - return ru -} - -// AddInstallID adds i to the "install_id" field. -func (ru *RepositoryUpdate) AddInstallID(i int64) *RepositoryUpdate { - ru.mutation.AddInstallID(i) - return ru -} - -// ClearInstallID clears the value of the "install_id" field. -func (ru *RepositoryUpdate) ClearInstallID() *RepositoryUpdate { - ru.mutation.ClearInstallID() - return ru -} - -// SetURL sets the "url" field. -func (ru *RepositoryUpdate) SetURL(s string) *RepositoryUpdate { - ru.mutation.SetURL(s) - return ru -} - -// SetNillableURL sets the "url" field if the given value is not nil. -func (ru *RepositoryUpdate) SetNillableURL(s *string) *RepositoryUpdate { - if s != nil { - ru.SetURL(*s) - } - return ru -} - -// ClearURL clears the value of the "url" field. -func (ru *RepositoryUpdate) ClearURL() *RepositoryUpdate { - ru.mutation.ClearURL() - return ru -} - -// SetAvatarURL sets the "avatar_url" field. -func (ru *RepositoryUpdate) SetAvatarURL(s string) *RepositoryUpdate { - ru.mutation.SetAvatarURL(s) - return ru -} - -// SetNillableAvatarURL sets the "avatar_url" field if the given value is not nil. -func (ru *RepositoryUpdate) SetNillableAvatarURL(s *string) *RepositoryUpdate { - if s != nil { - ru.SetAvatarURL(*s) - } - return ru -} - -// ClearAvatarURL clears the value of the "avatar_url" field. -func (ru *RepositoryUpdate) ClearAvatarURL() *RepositoryUpdate { - ru.mutation.ClearAvatarURL() - return ru -} - -// SetDefaultBranch sets the "default_branch" field. -func (ru *RepositoryUpdate) SetDefaultBranch(s string) *RepositoryUpdate { - ru.mutation.SetDefaultBranch(s) - return ru -} - -// SetNillableDefaultBranch sets the "default_branch" field if the given value is not nil. -func (ru *RepositoryUpdate) SetNillableDefaultBranch(s *string) *RepositoryUpdate { - if s != nil { - ru.SetDefaultBranch(*s) - } - return ru -} - -// ClearDefaultBranch clears the value of the "default_branch" field. -func (ru *RepositoryUpdate) ClearDefaultBranch() *RepositoryUpdate { - ru.mutation.ClearDefaultBranch() - return ru -} - -// AddScanIDs adds the "scan" edge to the Scan entity by IDs. -func (ru *RepositoryUpdate) AddScanIDs(ids ...string) *RepositoryUpdate { - ru.mutation.AddScanIDs(ids...) - return ru -} - -// AddScan adds the "scan" edges to the Scan entity. -func (ru *RepositoryUpdate) AddScan(s ...*Scan) *RepositoryUpdate { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return ru.AddScanIDs(ids...) -} - -// AddMainIDs adds the "main" edge to the Scan entity by IDs. -func (ru *RepositoryUpdate) AddMainIDs(ids ...string) *RepositoryUpdate { - ru.mutation.AddMainIDs(ids...) - return ru -} - -// AddMain adds the "main" edges to the Scan entity. -func (ru *RepositoryUpdate) AddMain(s ...*Scan) *RepositoryUpdate { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return ru.AddMainIDs(ids...) -} - -// SetLatestID sets the "latest" edge to the Scan entity by ID. -func (ru *RepositoryUpdate) SetLatestID(id string) *RepositoryUpdate { - ru.mutation.SetLatestID(id) - return ru -} - -// SetNillableLatestID sets the "latest" edge to the Scan entity by ID if the given value is not nil. -func (ru *RepositoryUpdate) SetNillableLatestID(id *string) *RepositoryUpdate { - if id != nil { - ru = ru.SetLatestID(*id) - } - return ru -} - -// SetLatest sets the "latest" edge to the Scan entity. -func (ru *RepositoryUpdate) SetLatest(s *Scan) *RepositoryUpdate { - return ru.SetLatestID(s.ID) -} - -// AddStatuIDs adds the "status" edge to the VulnStatusIndex entity by IDs. -func (ru *RepositoryUpdate) AddStatuIDs(ids ...string) *RepositoryUpdate { - ru.mutation.AddStatuIDs(ids...) - return ru -} - -// AddStatus adds the "status" edges to the VulnStatusIndex entity. -func (ru *RepositoryUpdate) AddStatus(v ...*VulnStatusIndex) *RepositoryUpdate { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return ru.AddStatuIDs(ids...) -} - -// AddLabelIDs adds the "labels" edge to the RepoLabel entity by IDs. -func (ru *RepositoryUpdate) AddLabelIDs(ids ...int) *RepositoryUpdate { - ru.mutation.AddLabelIDs(ids...) - return ru -} - -// AddLabels adds the "labels" edges to the RepoLabel entity. -func (ru *RepositoryUpdate) AddLabels(r ...*RepoLabel) *RepositoryUpdate { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return ru.AddLabelIDs(ids...) -} - -// Mutation returns the RepositoryMutation object of the builder. -func (ru *RepositoryUpdate) Mutation() *RepositoryMutation { - return ru.mutation -} - -// ClearScan clears all "scan" edges to the Scan entity. -func (ru *RepositoryUpdate) ClearScan() *RepositoryUpdate { - ru.mutation.ClearScan() - return ru -} - -// RemoveScanIDs removes the "scan" edge to Scan entities by IDs. -func (ru *RepositoryUpdate) RemoveScanIDs(ids ...string) *RepositoryUpdate { - ru.mutation.RemoveScanIDs(ids...) - return ru -} - -// RemoveScan removes "scan" edges to Scan entities. -func (ru *RepositoryUpdate) RemoveScan(s ...*Scan) *RepositoryUpdate { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return ru.RemoveScanIDs(ids...) -} - -// ClearMain clears all "main" edges to the Scan entity. -func (ru *RepositoryUpdate) ClearMain() *RepositoryUpdate { - ru.mutation.ClearMain() - return ru -} - -// RemoveMainIDs removes the "main" edge to Scan entities by IDs. -func (ru *RepositoryUpdate) RemoveMainIDs(ids ...string) *RepositoryUpdate { - ru.mutation.RemoveMainIDs(ids...) - return ru -} - -// RemoveMain removes "main" edges to Scan entities. -func (ru *RepositoryUpdate) RemoveMain(s ...*Scan) *RepositoryUpdate { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return ru.RemoveMainIDs(ids...) -} - -// ClearLatest clears the "latest" edge to the Scan entity. -func (ru *RepositoryUpdate) ClearLatest() *RepositoryUpdate { - ru.mutation.ClearLatest() - return ru -} - -// ClearStatus clears all "status" edges to the VulnStatusIndex entity. -func (ru *RepositoryUpdate) ClearStatus() *RepositoryUpdate { - ru.mutation.ClearStatus() - return ru -} - -// RemoveStatuIDs removes the "status" edge to VulnStatusIndex entities by IDs. -func (ru *RepositoryUpdate) RemoveStatuIDs(ids ...string) *RepositoryUpdate { - ru.mutation.RemoveStatuIDs(ids...) - return ru -} - -// RemoveStatus removes "status" edges to VulnStatusIndex entities. -func (ru *RepositoryUpdate) RemoveStatus(v ...*VulnStatusIndex) *RepositoryUpdate { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return ru.RemoveStatuIDs(ids...) -} - -// ClearLabels clears all "labels" edges to the RepoLabel entity. -func (ru *RepositoryUpdate) ClearLabels() *RepositoryUpdate { - ru.mutation.ClearLabels() - return ru -} - -// RemoveLabelIDs removes the "labels" edge to RepoLabel entities by IDs. -func (ru *RepositoryUpdate) RemoveLabelIDs(ids ...int) *RepositoryUpdate { - ru.mutation.RemoveLabelIDs(ids...) - return ru -} - -// RemoveLabels removes "labels" edges to RepoLabel entities. -func (ru *RepositoryUpdate) RemoveLabels(r ...*RepoLabel) *RepositoryUpdate { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return ru.RemoveLabelIDs(ids...) -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (ru *RepositoryUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(ru.hooks) == 0 { - affected, err = ru.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepositoryMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - ru.mutation = mutation - affected, err = ru.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(ru.hooks) - 1; i >= 0; i-- { - if ru.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = ru.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, ru.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (ru *RepositoryUpdate) SaveX(ctx context.Context) int { - affected, err := ru.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (ru *RepositoryUpdate) Exec(ctx context.Context) error { - _, err := ru.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (ru *RepositoryUpdate) ExecX(ctx context.Context) { - if err := ru.Exec(ctx); err != nil { - panic(err) - } -} - -func (ru *RepositoryUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: repository.Table, - Columns: repository.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - if ps := ru.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := ru.mutation.Owner(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldOwner, - }) - } - if value, ok := ru.mutation.Name(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldName, - }) - } - if value, ok := ru.mutation.InstallID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: repository.FieldInstallID, - }) - } - if value, ok := ru.mutation.AddedInstallID(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: repository.FieldInstallID, - }) - } - if ru.mutation.InstallIDCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Column: repository.FieldInstallID, - }) - } - if value, ok := ru.mutation.URL(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldURL, - }) - } - if ru.mutation.URLCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: repository.FieldURL, - }) - } - if value, ok := ru.mutation.AvatarURL(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldAvatarURL, - }) - } - if ru.mutation.AvatarURLCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: repository.FieldAvatarURL, - }) - } - if value, ok := ru.mutation.DefaultBranch(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldDefaultBranch, - }) - } - if ru.mutation.DefaultBranchCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: repository.FieldDefaultBranch, - }) - } - if ru.mutation.ScanCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.ScanTable, - Columns: repository.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ru.mutation.RemovedScanIDs(); len(nodes) > 0 && !ru.mutation.ScanCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.ScanTable, - Columns: repository.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ru.mutation.ScanIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.ScanTable, - Columns: repository.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if ru.mutation.MainCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.MainTable, - Columns: []string{repository.MainColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ru.mutation.RemovedMainIDs(); len(nodes) > 0 && !ru.mutation.MainCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.MainTable, - Columns: []string{repository.MainColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ru.mutation.MainIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.MainTable, - Columns: []string{repository.MainColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if ru.mutation.LatestCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: repository.LatestTable, - Columns: []string{repository.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ru.mutation.LatestIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: repository.LatestTable, - Columns: []string{repository.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if ru.mutation.StatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.StatusTable, - Columns: []string{repository.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ru.mutation.RemovedStatusIDs(); len(nodes) > 0 && !ru.mutation.StatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.StatusTable, - Columns: []string{repository.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ru.mutation.StatusIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.StatusTable, - Columns: []string{repository.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if ru.mutation.LabelsCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.LabelsTable, - Columns: repository.LabelsPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ru.mutation.RemovedLabelsIDs(); len(nodes) > 0 && !ru.mutation.LabelsCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.LabelsTable, - Columns: repository.LabelsPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ru.mutation.LabelsIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.LabelsTable, - Columns: repository.LabelsPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, ru.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{repository.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// RepositoryUpdateOne is the builder for updating a single Repository entity. -type RepositoryUpdateOne struct { - config - fields []string - hooks []Hook - mutation *RepositoryMutation -} - -// SetOwner sets the "owner" field. -func (ruo *RepositoryUpdateOne) SetOwner(s string) *RepositoryUpdateOne { - ruo.mutation.SetOwner(s) - return ruo -} - -// SetName sets the "name" field. -func (ruo *RepositoryUpdateOne) SetName(s string) *RepositoryUpdateOne { - ruo.mutation.SetName(s) - return ruo -} - -// SetInstallID sets the "install_id" field. -func (ruo *RepositoryUpdateOne) SetInstallID(i int64) *RepositoryUpdateOne { - ruo.mutation.ResetInstallID() - ruo.mutation.SetInstallID(i) - return ruo -} - -// SetNillableInstallID sets the "install_id" field if the given value is not nil. -func (ruo *RepositoryUpdateOne) SetNillableInstallID(i *int64) *RepositoryUpdateOne { - if i != nil { - ruo.SetInstallID(*i) - } - return ruo -} - -// AddInstallID adds i to the "install_id" field. -func (ruo *RepositoryUpdateOne) AddInstallID(i int64) *RepositoryUpdateOne { - ruo.mutation.AddInstallID(i) - return ruo -} - -// ClearInstallID clears the value of the "install_id" field. -func (ruo *RepositoryUpdateOne) ClearInstallID() *RepositoryUpdateOne { - ruo.mutation.ClearInstallID() - return ruo -} - -// SetURL sets the "url" field. -func (ruo *RepositoryUpdateOne) SetURL(s string) *RepositoryUpdateOne { - ruo.mutation.SetURL(s) - return ruo -} - -// SetNillableURL sets the "url" field if the given value is not nil. -func (ruo *RepositoryUpdateOne) SetNillableURL(s *string) *RepositoryUpdateOne { - if s != nil { - ruo.SetURL(*s) - } - return ruo -} - -// ClearURL clears the value of the "url" field. -func (ruo *RepositoryUpdateOne) ClearURL() *RepositoryUpdateOne { - ruo.mutation.ClearURL() - return ruo -} - -// SetAvatarURL sets the "avatar_url" field. -func (ruo *RepositoryUpdateOne) SetAvatarURL(s string) *RepositoryUpdateOne { - ruo.mutation.SetAvatarURL(s) - return ruo -} - -// SetNillableAvatarURL sets the "avatar_url" field if the given value is not nil. -func (ruo *RepositoryUpdateOne) SetNillableAvatarURL(s *string) *RepositoryUpdateOne { - if s != nil { - ruo.SetAvatarURL(*s) - } - return ruo -} - -// ClearAvatarURL clears the value of the "avatar_url" field. -func (ruo *RepositoryUpdateOne) ClearAvatarURL() *RepositoryUpdateOne { - ruo.mutation.ClearAvatarURL() - return ruo -} - -// SetDefaultBranch sets the "default_branch" field. -func (ruo *RepositoryUpdateOne) SetDefaultBranch(s string) *RepositoryUpdateOne { - ruo.mutation.SetDefaultBranch(s) - return ruo -} - -// SetNillableDefaultBranch sets the "default_branch" field if the given value is not nil. -func (ruo *RepositoryUpdateOne) SetNillableDefaultBranch(s *string) *RepositoryUpdateOne { - if s != nil { - ruo.SetDefaultBranch(*s) - } - return ruo -} - -// ClearDefaultBranch clears the value of the "default_branch" field. -func (ruo *RepositoryUpdateOne) ClearDefaultBranch() *RepositoryUpdateOne { - ruo.mutation.ClearDefaultBranch() - return ruo -} - -// AddScanIDs adds the "scan" edge to the Scan entity by IDs. -func (ruo *RepositoryUpdateOne) AddScanIDs(ids ...string) *RepositoryUpdateOne { - ruo.mutation.AddScanIDs(ids...) - return ruo -} - -// AddScan adds the "scan" edges to the Scan entity. -func (ruo *RepositoryUpdateOne) AddScan(s ...*Scan) *RepositoryUpdateOne { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return ruo.AddScanIDs(ids...) -} - -// AddMainIDs adds the "main" edge to the Scan entity by IDs. -func (ruo *RepositoryUpdateOne) AddMainIDs(ids ...string) *RepositoryUpdateOne { - ruo.mutation.AddMainIDs(ids...) - return ruo -} - -// AddMain adds the "main" edges to the Scan entity. -func (ruo *RepositoryUpdateOne) AddMain(s ...*Scan) *RepositoryUpdateOne { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return ruo.AddMainIDs(ids...) -} - -// SetLatestID sets the "latest" edge to the Scan entity by ID. -func (ruo *RepositoryUpdateOne) SetLatestID(id string) *RepositoryUpdateOne { - ruo.mutation.SetLatestID(id) - return ruo -} - -// SetNillableLatestID sets the "latest" edge to the Scan entity by ID if the given value is not nil. -func (ruo *RepositoryUpdateOne) SetNillableLatestID(id *string) *RepositoryUpdateOne { - if id != nil { - ruo = ruo.SetLatestID(*id) - } - return ruo -} - -// SetLatest sets the "latest" edge to the Scan entity. -func (ruo *RepositoryUpdateOne) SetLatest(s *Scan) *RepositoryUpdateOne { - return ruo.SetLatestID(s.ID) -} - -// AddStatuIDs adds the "status" edge to the VulnStatusIndex entity by IDs. -func (ruo *RepositoryUpdateOne) AddStatuIDs(ids ...string) *RepositoryUpdateOne { - ruo.mutation.AddStatuIDs(ids...) - return ruo -} - -// AddStatus adds the "status" edges to the VulnStatusIndex entity. -func (ruo *RepositoryUpdateOne) AddStatus(v ...*VulnStatusIndex) *RepositoryUpdateOne { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return ruo.AddStatuIDs(ids...) -} - -// AddLabelIDs adds the "labels" edge to the RepoLabel entity by IDs. -func (ruo *RepositoryUpdateOne) AddLabelIDs(ids ...int) *RepositoryUpdateOne { - ruo.mutation.AddLabelIDs(ids...) - return ruo -} - -// AddLabels adds the "labels" edges to the RepoLabel entity. -func (ruo *RepositoryUpdateOne) AddLabels(r ...*RepoLabel) *RepositoryUpdateOne { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return ruo.AddLabelIDs(ids...) -} - -// Mutation returns the RepositoryMutation object of the builder. -func (ruo *RepositoryUpdateOne) Mutation() *RepositoryMutation { - return ruo.mutation -} - -// ClearScan clears all "scan" edges to the Scan entity. -func (ruo *RepositoryUpdateOne) ClearScan() *RepositoryUpdateOne { - ruo.mutation.ClearScan() - return ruo -} - -// RemoveScanIDs removes the "scan" edge to Scan entities by IDs. -func (ruo *RepositoryUpdateOne) RemoveScanIDs(ids ...string) *RepositoryUpdateOne { - ruo.mutation.RemoveScanIDs(ids...) - return ruo -} - -// RemoveScan removes "scan" edges to Scan entities. -func (ruo *RepositoryUpdateOne) RemoveScan(s ...*Scan) *RepositoryUpdateOne { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return ruo.RemoveScanIDs(ids...) -} - -// ClearMain clears all "main" edges to the Scan entity. -func (ruo *RepositoryUpdateOne) ClearMain() *RepositoryUpdateOne { - ruo.mutation.ClearMain() - return ruo -} - -// RemoveMainIDs removes the "main" edge to Scan entities by IDs. -func (ruo *RepositoryUpdateOne) RemoveMainIDs(ids ...string) *RepositoryUpdateOne { - ruo.mutation.RemoveMainIDs(ids...) - return ruo -} - -// RemoveMain removes "main" edges to Scan entities. -func (ruo *RepositoryUpdateOne) RemoveMain(s ...*Scan) *RepositoryUpdateOne { - ids := make([]string, len(s)) - for i := range s { - ids[i] = s[i].ID - } - return ruo.RemoveMainIDs(ids...) -} - -// ClearLatest clears the "latest" edge to the Scan entity. -func (ruo *RepositoryUpdateOne) ClearLatest() *RepositoryUpdateOne { - ruo.mutation.ClearLatest() - return ruo -} - -// ClearStatus clears all "status" edges to the VulnStatusIndex entity. -func (ruo *RepositoryUpdateOne) ClearStatus() *RepositoryUpdateOne { - ruo.mutation.ClearStatus() - return ruo -} - -// RemoveStatuIDs removes the "status" edge to VulnStatusIndex entities by IDs. -func (ruo *RepositoryUpdateOne) RemoveStatuIDs(ids ...string) *RepositoryUpdateOne { - ruo.mutation.RemoveStatuIDs(ids...) - return ruo -} - -// RemoveStatus removes "status" edges to VulnStatusIndex entities. -func (ruo *RepositoryUpdateOne) RemoveStatus(v ...*VulnStatusIndex) *RepositoryUpdateOne { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return ruo.RemoveStatuIDs(ids...) -} - -// ClearLabels clears all "labels" edges to the RepoLabel entity. -func (ruo *RepositoryUpdateOne) ClearLabels() *RepositoryUpdateOne { - ruo.mutation.ClearLabels() - return ruo -} - -// RemoveLabelIDs removes the "labels" edge to RepoLabel entities by IDs. -func (ruo *RepositoryUpdateOne) RemoveLabelIDs(ids ...int) *RepositoryUpdateOne { - ruo.mutation.RemoveLabelIDs(ids...) - return ruo -} - -// RemoveLabels removes "labels" edges to RepoLabel entities. -func (ruo *RepositoryUpdateOne) RemoveLabels(r ...*RepoLabel) *RepositoryUpdateOne { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return ruo.RemoveLabelIDs(ids...) -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (ruo *RepositoryUpdateOne) Select(field string, fields ...string) *RepositoryUpdateOne { - ruo.fields = append([]string{field}, fields...) - return ruo -} - -// Save executes the query and returns the updated Repository entity. -func (ruo *RepositoryUpdateOne) Save(ctx context.Context) (*Repository, error) { - var ( - err error - node *Repository - ) - if len(ruo.hooks) == 0 { - node, err = ruo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*RepositoryMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - ruo.mutation = mutation - node, err = ruo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(ruo.hooks) - 1; i >= 0; i-- { - if ruo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = ruo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, ruo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (ruo *RepositoryUpdateOne) SaveX(ctx context.Context) *Repository { - node, err := ruo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (ruo *RepositoryUpdateOne) Exec(ctx context.Context) error { - _, err := ruo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (ruo *RepositoryUpdateOne) ExecX(ctx context.Context) { - if err := ruo.Exec(ctx); err != nil { - panic(err) - } -} - -func (ruo *RepositoryUpdateOne) sqlSave(ctx context.Context) (_node *Repository, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: repository.Table, - Columns: repository.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - id, ok := ruo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Repository.ID for update")} - } - _spec.Node.ID.Value = id - if fields := ruo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, repository.FieldID) - for _, f := range fields { - if !repository.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != repository.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := ruo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := ruo.mutation.Owner(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldOwner, - }) - } - if value, ok := ruo.mutation.Name(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldName, - }) - } - if value, ok := ruo.mutation.InstallID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: repository.FieldInstallID, - }) - } - if value, ok := ruo.mutation.AddedInstallID(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: repository.FieldInstallID, - }) - } - if ruo.mutation.InstallIDCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Column: repository.FieldInstallID, - }) - } - if value, ok := ruo.mutation.URL(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldURL, - }) - } - if ruo.mutation.URLCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: repository.FieldURL, - }) - } - if value, ok := ruo.mutation.AvatarURL(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldAvatarURL, - }) - } - if ruo.mutation.AvatarURLCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: repository.FieldAvatarURL, - }) - } - if value, ok := ruo.mutation.DefaultBranch(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: repository.FieldDefaultBranch, - }) - } - if ruo.mutation.DefaultBranchCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: repository.FieldDefaultBranch, - }) - } - if ruo.mutation.ScanCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.ScanTable, - Columns: repository.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ruo.mutation.RemovedScanIDs(); len(nodes) > 0 && !ruo.mutation.ScanCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.ScanTable, - Columns: repository.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ruo.mutation.ScanIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.ScanTable, - Columns: repository.ScanPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if ruo.mutation.MainCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.MainTable, - Columns: []string{repository.MainColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ruo.mutation.RemovedMainIDs(); len(nodes) > 0 && !ruo.mutation.MainCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.MainTable, - Columns: []string{repository.MainColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ruo.mutation.MainIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.MainTable, - Columns: []string{repository.MainColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if ruo.mutation.LatestCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: repository.LatestTable, - Columns: []string{repository.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ruo.mutation.LatestIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: repository.LatestTable, - Columns: []string{repository.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if ruo.mutation.StatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.StatusTable, - Columns: []string{repository.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ruo.mutation.RemovedStatusIDs(); len(nodes) > 0 && !ruo.mutation.StatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.StatusTable, - Columns: []string{repository.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ruo.mutation.StatusIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: repository.StatusTable, - Columns: []string{repository.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if ruo.mutation.LabelsCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.LabelsTable, - Columns: repository.LabelsPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ruo.mutation.RemovedLabelsIDs(); len(nodes) > 0 && !ruo.mutation.LabelsCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.LabelsTable, - Columns: repository.LabelsPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := ruo.mutation.LabelsIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: repository.LabelsTable, - Columns: repository.LabelsPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repolabel.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &Repository{config: ruo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, ruo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{repository.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/runtime.go b/pkg/infra/ent/runtime.go deleted file mode 100644 index 4965edc..0000000 --- a/pkg/infra/ent/runtime.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "github.com/m-mizutani/octovy/pkg/domain/schema" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// The init function reads all schema descriptors with runtime code -// (default values, validators, hooks and policies) and stitches it -// to their package variables. -func init() { - sessionFields := schema.Session{}.Fields() - _ = sessionFields - // sessionDescToken is the schema descriptor for token field. - sessionDescToken := sessionFields[2].Descriptor() - // session.TokenValidator is a validator for the "token" field. It is called by the builders before save. - session.TokenValidator = sessionDescToken.Validators[0].(func(string) error) - severityFields := schema.Severity{}.Fields() - _ = severityFields - // severityDescLabel is the schema descriptor for label field. - severityDescLabel := severityFields[0].Descriptor() - // severity.LabelValidator is a validator for the "label" field. It is called by the builders before save. - severity.LabelValidator = severityDescLabel.Validators[0].(func(string) error) - vulnstatusindexFields := schema.VulnStatusIndex{}.Fields() - _ = vulnstatusindexFields - // vulnstatusindexDescID is the schema descriptor for id field. - vulnstatusindexDescID := vulnstatusindexFields[0].Descriptor() - // vulnstatusindex.IDValidator is a validator for the "id" field. It is called by the builders before save. - vulnstatusindex.IDValidator = vulnstatusindexDescID.Validators[0].(func(string) error) - vulnerabilityFields := schema.Vulnerability{}.Fields() - _ = vulnerabilityFields - // vulnerabilityDescID is the schema descriptor for id field. - vulnerabilityDescID := vulnerabilityFields[0].Descriptor() - // vulnerability.IDValidator is a validator for the "id" field. It is called by the builders before save. - vulnerability.IDValidator = vulnerabilityDescID.Validators[0].(func(string) error) -} diff --git a/pkg/infra/ent/runtime/runtime.go b/pkg/infra/ent/runtime/runtime.go deleted file mode 100644 index aca8be0..0000000 --- a/pkg/infra/ent/runtime/runtime.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package runtime - -// The schema-stitching logic is generated in github.com/m-mizutani/octovy/pkg/infra/ent/runtime.go - -const ( - Version = "v0.9.1" // Version of ent codegen. - Sum = "h1:IG8andyeD79GG24U8Q+1Y45hQXj6gY5evSBcva5gtBk=" // Sum of ent codegen. -) diff --git a/pkg/infra/ent/scan.go b/pkg/infra/ent/scan.go deleted file mode 100644 index 9d0b044..0000000 --- a/pkg/infra/ent/scan.go +++ /dev/null @@ -1,201 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" -) - -// Scan is the model entity for the Scan schema. -type Scan struct { - config `json:"-"` - // ID of the ent. - ID string `json:"id,omitempty"` - // Branch holds the value of the "branch" field. - Branch string `json:"branch,omitempty"` - // CommitID holds the value of the "commit_id" field. - CommitID string `json:"commit_id,omitempty"` - // RequestedAt holds the value of the "requested_at" field. - RequestedAt int64 `json:"requested_at,omitempty"` - // ScannedAt holds the value of the "scanned_at" field. - ScannedAt int64 `json:"scanned_at,omitempty"` - // CheckID holds the value of the "check_id" field. - CheckID int64 `json:"check_id,omitempty"` - // PullRequestTarget holds the value of the "pull_request_target" field. - PullRequestTarget string `json:"pull_request_target,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the ScanQuery when eager-loading is set. - Edges ScanEdges `json:"edges"` - repository_main *int -} - -// ScanEdges holds the relations/edges for other nodes in the graph. -type ScanEdges struct { - // Repository holds the value of the repository edge. - Repository []*Repository `json:"repository,omitempty"` - // Packages holds the value of the packages edge. - Packages []*PackageRecord `json:"packages,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [2]bool -} - -// RepositoryOrErr returns the Repository value or an error if the edge -// was not loaded in eager-loading. -func (e ScanEdges) RepositoryOrErr() ([]*Repository, error) { - if e.loadedTypes[0] { - return e.Repository, nil - } - return nil, &NotLoadedError{edge: "repository"} -} - -// PackagesOrErr returns the Packages value or an error if the edge -// was not loaded in eager-loading. -func (e ScanEdges) PackagesOrErr() ([]*PackageRecord, error) { - if e.loadedTypes[1] { - return e.Packages, nil - } - return nil, &NotLoadedError{edge: "packages"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*Scan) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case scan.FieldRequestedAt, scan.FieldScannedAt, scan.FieldCheckID: - values[i] = new(sql.NullInt64) - case scan.FieldID, scan.FieldBranch, scan.FieldCommitID, scan.FieldPullRequestTarget: - values[i] = new(sql.NullString) - case scan.ForeignKeys[0]: // repository_main - values[i] = new(sql.NullInt64) - default: - return nil, fmt.Errorf("unexpected column %q for type Scan", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the Scan fields. -func (s *Scan) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case scan.FieldID: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field id", values[i]) - } else if value.Valid { - s.ID = value.String - } - case scan.FieldBranch: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field branch", values[i]) - } else if value.Valid { - s.Branch = value.String - } - case scan.FieldCommitID: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field commit_id", values[i]) - } else if value.Valid { - s.CommitID = value.String - } - case scan.FieldRequestedAt: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field requested_at", values[i]) - } else if value.Valid { - s.RequestedAt = value.Int64 - } - case scan.FieldScannedAt: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field scanned_at", values[i]) - } else if value.Valid { - s.ScannedAt = value.Int64 - } - case scan.FieldCheckID: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field check_id", values[i]) - } else if value.Valid { - s.CheckID = value.Int64 - } - case scan.FieldPullRequestTarget: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field pull_request_target", values[i]) - } else if value.Valid { - s.PullRequestTarget = value.String - } - case scan.ForeignKeys[0]: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for edge-field repository_main", value) - } else if value.Valid { - s.repository_main = new(int) - *s.repository_main = int(value.Int64) - } - } - } - return nil -} - -// QueryRepository queries the "repository" edge of the Scan entity. -func (s *Scan) QueryRepository() *RepositoryQuery { - return (&ScanClient{config: s.config}).QueryRepository(s) -} - -// QueryPackages queries the "packages" edge of the Scan entity. -func (s *Scan) QueryPackages() *PackageRecordQuery { - return (&ScanClient{config: s.config}).QueryPackages(s) -} - -// Update returns a builder for updating this Scan. -// Note that you need to call Scan.Unwrap() before calling this method if this Scan -// was returned from a transaction, and the transaction was committed or rolled back. -func (s *Scan) Update() *ScanUpdateOne { - return (&ScanClient{config: s.config}).UpdateOne(s) -} - -// Unwrap unwraps the Scan entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (s *Scan) Unwrap() *Scan { - tx, ok := s.config.driver.(*txDriver) - if !ok { - panic("ent: Scan is not a transactional entity") - } - s.config.driver = tx.drv - return s -} - -// String implements the fmt.Stringer. -func (s *Scan) String() string { - var builder strings.Builder - builder.WriteString("Scan(") - builder.WriteString(fmt.Sprintf("id=%v", s.ID)) - builder.WriteString(", branch=") - builder.WriteString(s.Branch) - builder.WriteString(", commit_id=") - builder.WriteString(s.CommitID) - builder.WriteString(", requested_at=") - builder.WriteString(fmt.Sprintf("%v", s.RequestedAt)) - builder.WriteString(", scanned_at=") - builder.WriteString(fmt.Sprintf("%v", s.ScannedAt)) - builder.WriteString(", check_id=") - builder.WriteString(fmt.Sprintf("%v", s.CheckID)) - builder.WriteString(", pull_request_target=") - builder.WriteString(s.PullRequestTarget) - builder.WriteByte(')') - return builder.String() -} - -// Scans is a parsable slice of Scan. -type Scans []*Scan - -func (s Scans) config(cfg config) { - for _i := range s { - s[_i].config = cfg - } -} diff --git a/pkg/infra/ent/scan/scan.go b/pkg/infra/ent/scan/scan.go deleted file mode 100644 index 56fa26e..0000000 --- a/pkg/infra/ent/scan/scan.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package scan - -const ( - // Label holds the string label denoting the scan type in the database. - Label = "scan" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldBranch holds the string denoting the branch field in the database. - FieldBranch = "branch" - // FieldCommitID holds the string denoting the commit_id field in the database. - FieldCommitID = "commit_id" - // FieldRequestedAt holds the string denoting the requested_at field in the database. - FieldRequestedAt = "requested_at" - // FieldScannedAt holds the string denoting the scanned_at field in the database. - FieldScannedAt = "scanned_at" - // FieldCheckID holds the string denoting the check_id field in the database. - FieldCheckID = "check_id" - // FieldPullRequestTarget holds the string denoting the pull_request_target field in the database. - FieldPullRequestTarget = "pull_request_target" - // EdgeRepository holds the string denoting the repository edge name in mutations. - EdgeRepository = "repository" - // EdgePackages holds the string denoting the packages edge name in mutations. - EdgePackages = "packages" - // Table holds the table name of the scan in the database. - Table = "scans" - // RepositoryTable is the table that holds the repository relation/edge. The primary key declared below. - RepositoryTable = "repository_scan" - // RepositoryInverseTable is the table name for the Repository entity. - // It exists in this package in order to avoid circular dependency with the "repository" package. - RepositoryInverseTable = "repositories" - // PackagesTable is the table that holds the packages relation/edge. The primary key declared below. - PackagesTable = "scan_packages" - // PackagesInverseTable is the table name for the PackageRecord entity. - // It exists in this package in order to avoid circular dependency with the "packagerecord" package. - PackagesInverseTable = "package_records" -) - -// Columns holds all SQL columns for scan fields. -var Columns = []string{ - FieldID, - FieldBranch, - FieldCommitID, - FieldRequestedAt, - FieldScannedAt, - FieldCheckID, - FieldPullRequestTarget, -} - -// ForeignKeys holds the SQL foreign-keys that are owned by the "scans" -// table and are not defined as standalone fields in the schema. -var ForeignKeys = []string{ - "repository_main", -} - -var ( - // RepositoryPrimaryKey and RepositoryColumn2 are the table columns denoting the - // primary key for the repository relation (M2M). - RepositoryPrimaryKey = []string{"repository_id", "scan_id"} - // PackagesPrimaryKey and PackagesColumn2 are the table columns denoting the - // primary key for the packages relation (M2M). - PackagesPrimaryKey = []string{"scan_id", "package_record_id"} -) - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - for i := range ForeignKeys { - if column == ForeignKeys[i] { - return true - } - } - return false -} diff --git a/pkg/infra/ent/scan/where.go b/pkg/infra/ent/scan/where.go deleted file mode 100644 index c4cca49..0000000 --- a/pkg/infra/ent/scan/where.go +++ /dev/null @@ -1,811 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package scan - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// Branch applies equality check predicate on the "branch" field. It's identical to BranchEQ. -func Branch(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldBranch), v)) - }) -} - -// CommitID applies equality check predicate on the "commit_id" field. It's identical to CommitIDEQ. -func CommitID(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldCommitID), v)) - }) -} - -// RequestedAt applies equality check predicate on the "requested_at" field. It's identical to RequestedAtEQ. -func RequestedAt(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldRequestedAt), v)) - }) -} - -// ScannedAt applies equality check predicate on the "scanned_at" field. It's identical to ScannedAtEQ. -func ScannedAt(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldScannedAt), v)) - }) -} - -// CheckID applies equality check predicate on the "check_id" field. It's identical to CheckIDEQ. -func CheckID(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldCheckID), v)) - }) -} - -// PullRequestTarget applies equality check predicate on the "pull_request_target" field. It's identical to PullRequestTargetEQ. -func PullRequestTarget(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldPullRequestTarget), v)) - }) -} - -// BranchEQ applies the EQ predicate on the "branch" field. -func BranchEQ(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldBranch), v)) - }) -} - -// BranchNEQ applies the NEQ predicate on the "branch" field. -func BranchNEQ(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldBranch), v)) - }) -} - -// BranchIn applies the In predicate on the "branch" field. -func BranchIn(vs ...string) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldBranch), v...)) - }) -} - -// BranchNotIn applies the NotIn predicate on the "branch" field. -func BranchNotIn(vs ...string) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldBranch), v...)) - }) -} - -// BranchGT applies the GT predicate on the "branch" field. -func BranchGT(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldBranch), v)) - }) -} - -// BranchGTE applies the GTE predicate on the "branch" field. -func BranchGTE(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldBranch), v)) - }) -} - -// BranchLT applies the LT predicate on the "branch" field. -func BranchLT(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldBranch), v)) - }) -} - -// BranchLTE applies the LTE predicate on the "branch" field. -func BranchLTE(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldBranch), v)) - }) -} - -// BranchContains applies the Contains predicate on the "branch" field. -func BranchContains(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldBranch), v)) - }) -} - -// BranchHasPrefix applies the HasPrefix predicate on the "branch" field. -func BranchHasPrefix(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldBranch), v)) - }) -} - -// BranchHasSuffix applies the HasSuffix predicate on the "branch" field. -func BranchHasSuffix(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldBranch), v)) - }) -} - -// BranchEqualFold applies the EqualFold predicate on the "branch" field. -func BranchEqualFold(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldBranch), v)) - }) -} - -// BranchContainsFold applies the ContainsFold predicate on the "branch" field. -func BranchContainsFold(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldBranch), v)) - }) -} - -// CommitIDEQ applies the EQ predicate on the "commit_id" field. -func CommitIDEQ(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldCommitID), v)) - }) -} - -// CommitIDNEQ applies the NEQ predicate on the "commit_id" field. -func CommitIDNEQ(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldCommitID), v)) - }) -} - -// CommitIDIn applies the In predicate on the "commit_id" field. -func CommitIDIn(vs ...string) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldCommitID), v...)) - }) -} - -// CommitIDNotIn applies the NotIn predicate on the "commit_id" field. -func CommitIDNotIn(vs ...string) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldCommitID), v...)) - }) -} - -// CommitIDGT applies the GT predicate on the "commit_id" field. -func CommitIDGT(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldCommitID), v)) - }) -} - -// CommitIDGTE applies the GTE predicate on the "commit_id" field. -func CommitIDGTE(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldCommitID), v)) - }) -} - -// CommitIDLT applies the LT predicate on the "commit_id" field. -func CommitIDLT(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldCommitID), v)) - }) -} - -// CommitIDLTE applies the LTE predicate on the "commit_id" field. -func CommitIDLTE(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldCommitID), v)) - }) -} - -// CommitIDContains applies the Contains predicate on the "commit_id" field. -func CommitIDContains(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldCommitID), v)) - }) -} - -// CommitIDHasPrefix applies the HasPrefix predicate on the "commit_id" field. -func CommitIDHasPrefix(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldCommitID), v)) - }) -} - -// CommitIDHasSuffix applies the HasSuffix predicate on the "commit_id" field. -func CommitIDHasSuffix(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldCommitID), v)) - }) -} - -// CommitIDEqualFold applies the EqualFold predicate on the "commit_id" field. -func CommitIDEqualFold(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldCommitID), v)) - }) -} - -// CommitIDContainsFold applies the ContainsFold predicate on the "commit_id" field. -func CommitIDContainsFold(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldCommitID), v)) - }) -} - -// RequestedAtEQ applies the EQ predicate on the "requested_at" field. -func RequestedAtEQ(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldRequestedAt), v)) - }) -} - -// RequestedAtNEQ applies the NEQ predicate on the "requested_at" field. -func RequestedAtNEQ(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldRequestedAt), v)) - }) -} - -// RequestedAtIn applies the In predicate on the "requested_at" field. -func RequestedAtIn(vs ...int64) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldRequestedAt), v...)) - }) -} - -// RequestedAtNotIn applies the NotIn predicate on the "requested_at" field. -func RequestedAtNotIn(vs ...int64) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldRequestedAt), v...)) - }) -} - -// RequestedAtGT applies the GT predicate on the "requested_at" field. -func RequestedAtGT(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldRequestedAt), v)) - }) -} - -// RequestedAtGTE applies the GTE predicate on the "requested_at" field. -func RequestedAtGTE(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldRequestedAt), v)) - }) -} - -// RequestedAtLT applies the LT predicate on the "requested_at" field. -func RequestedAtLT(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldRequestedAt), v)) - }) -} - -// RequestedAtLTE applies the LTE predicate on the "requested_at" field. -func RequestedAtLTE(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldRequestedAt), v)) - }) -} - -// ScannedAtEQ applies the EQ predicate on the "scanned_at" field. -func ScannedAtEQ(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldScannedAt), v)) - }) -} - -// ScannedAtNEQ applies the NEQ predicate on the "scanned_at" field. -func ScannedAtNEQ(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldScannedAt), v)) - }) -} - -// ScannedAtIn applies the In predicate on the "scanned_at" field. -func ScannedAtIn(vs ...int64) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldScannedAt), v...)) - }) -} - -// ScannedAtNotIn applies the NotIn predicate on the "scanned_at" field. -func ScannedAtNotIn(vs ...int64) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldScannedAt), v...)) - }) -} - -// ScannedAtGT applies the GT predicate on the "scanned_at" field. -func ScannedAtGT(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldScannedAt), v)) - }) -} - -// ScannedAtGTE applies the GTE predicate on the "scanned_at" field. -func ScannedAtGTE(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldScannedAt), v)) - }) -} - -// ScannedAtLT applies the LT predicate on the "scanned_at" field. -func ScannedAtLT(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldScannedAt), v)) - }) -} - -// ScannedAtLTE applies the LTE predicate on the "scanned_at" field. -func ScannedAtLTE(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldScannedAt), v)) - }) -} - -// CheckIDEQ applies the EQ predicate on the "check_id" field. -func CheckIDEQ(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldCheckID), v)) - }) -} - -// CheckIDNEQ applies the NEQ predicate on the "check_id" field. -func CheckIDNEQ(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldCheckID), v)) - }) -} - -// CheckIDIn applies the In predicate on the "check_id" field. -func CheckIDIn(vs ...int64) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldCheckID), v...)) - }) -} - -// CheckIDNotIn applies the NotIn predicate on the "check_id" field. -func CheckIDNotIn(vs ...int64) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldCheckID), v...)) - }) -} - -// CheckIDGT applies the GT predicate on the "check_id" field. -func CheckIDGT(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldCheckID), v)) - }) -} - -// CheckIDGTE applies the GTE predicate on the "check_id" field. -func CheckIDGTE(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldCheckID), v)) - }) -} - -// CheckIDLT applies the LT predicate on the "check_id" field. -func CheckIDLT(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldCheckID), v)) - }) -} - -// CheckIDLTE applies the LTE predicate on the "check_id" field. -func CheckIDLTE(v int64) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldCheckID), v)) - }) -} - -// CheckIDIsNil applies the IsNil predicate on the "check_id" field. -func CheckIDIsNil() predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldCheckID))) - }) -} - -// CheckIDNotNil applies the NotNil predicate on the "check_id" field. -func CheckIDNotNil() predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldCheckID))) - }) -} - -// PullRequestTargetEQ applies the EQ predicate on the "pull_request_target" field. -func PullRequestTargetEQ(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetNEQ applies the NEQ predicate on the "pull_request_target" field. -func PullRequestTargetNEQ(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetIn applies the In predicate on the "pull_request_target" field. -func PullRequestTargetIn(vs ...string) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldPullRequestTarget), v...)) - }) -} - -// PullRequestTargetNotIn applies the NotIn predicate on the "pull_request_target" field. -func PullRequestTargetNotIn(vs ...string) predicate.Scan { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Scan(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldPullRequestTarget), v...)) - }) -} - -// PullRequestTargetGT applies the GT predicate on the "pull_request_target" field. -func PullRequestTargetGT(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetGTE applies the GTE predicate on the "pull_request_target" field. -func PullRequestTargetGTE(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetLT applies the LT predicate on the "pull_request_target" field. -func PullRequestTargetLT(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetLTE applies the LTE predicate on the "pull_request_target" field. -func PullRequestTargetLTE(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetContains applies the Contains predicate on the "pull_request_target" field. -func PullRequestTargetContains(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetHasPrefix applies the HasPrefix predicate on the "pull_request_target" field. -func PullRequestTargetHasPrefix(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetHasSuffix applies the HasSuffix predicate on the "pull_request_target" field. -func PullRequestTargetHasSuffix(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetIsNil applies the IsNil predicate on the "pull_request_target" field. -func PullRequestTargetIsNil() predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldPullRequestTarget))) - }) -} - -// PullRequestTargetNotNil applies the NotNil predicate on the "pull_request_target" field. -func PullRequestTargetNotNil() predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldPullRequestTarget))) - }) -} - -// PullRequestTargetEqualFold applies the EqualFold predicate on the "pull_request_target" field. -func PullRequestTargetEqualFold(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldPullRequestTarget), v)) - }) -} - -// PullRequestTargetContainsFold applies the ContainsFold predicate on the "pull_request_target" field. -func PullRequestTargetContainsFold(v string) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldPullRequestTarget), v)) - }) -} - -// HasRepository applies the HasEdge predicate on the "repository" edge. -func HasRepository() predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(RepositoryTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, RepositoryTable, RepositoryPrimaryKey...), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasRepositoryWith applies the HasEdge predicate on the "repository" edge with a given conditions (other predicates). -func HasRepositoryWith(preds ...predicate.Repository) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(RepositoryInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, RepositoryTable, RepositoryPrimaryKey...), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// HasPackages applies the HasEdge predicate on the "packages" edge. -func HasPackages() predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(PackagesTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, PackagesTable, PackagesPrimaryKey...), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasPackagesWith applies the HasEdge predicate on the "packages" edge with a given conditions (other predicates). -func HasPackagesWith(preds ...predicate.PackageRecord) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(PackagesInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, PackagesTable, PackagesPrimaryKey...), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.Scan) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.Scan) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.Scan) predicate.Scan { - return predicate.Scan(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/scan_create.go b/pkg/infra/ent/scan_create.go deleted file mode 100644 index a5c8eaf..0000000 --- a/pkg/infra/ent/scan_create.go +++ /dev/null @@ -1,933 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" -) - -// ScanCreate is the builder for creating a Scan entity. -type ScanCreate struct { - config - mutation *ScanMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetBranch sets the "branch" field. -func (sc *ScanCreate) SetBranch(s string) *ScanCreate { - sc.mutation.SetBranch(s) - return sc -} - -// SetCommitID sets the "commit_id" field. -func (sc *ScanCreate) SetCommitID(s string) *ScanCreate { - sc.mutation.SetCommitID(s) - return sc -} - -// SetRequestedAt sets the "requested_at" field. -func (sc *ScanCreate) SetRequestedAt(i int64) *ScanCreate { - sc.mutation.SetRequestedAt(i) - return sc -} - -// SetScannedAt sets the "scanned_at" field. -func (sc *ScanCreate) SetScannedAt(i int64) *ScanCreate { - sc.mutation.SetScannedAt(i) - return sc -} - -// SetCheckID sets the "check_id" field. -func (sc *ScanCreate) SetCheckID(i int64) *ScanCreate { - sc.mutation.SetCheckID(i) - return sc -} - -// SetNillableCheckID sets the "check_id" field if the given value is not nil. -func (sc *ScanCreate) SetNillableCheckID(i *int64) *ScanCreate { - if i != nil { - sc.SetCheckID(*i) - } - return sc -} - -// SetPullRequestTarget sets the "pull_request_target" field. -func (sc *ScanCreate) SetPullRequestTarget(s string) *ScanCreate { - sc.mutation.SetPullRequestTarget(s) - return sc -} - -// SetNillablePullRequestTarget sets the "pull_request_target" field if the given value is not nil. -func (sc *ScanCreate) SetNillablePullRequestTarget(s *string) *ScanCreate { - if s != nil { - sc.SetPullRequestTarget(*s) - } - return sc -} - -// SetID sets the "id" field. -func (sc *ScanCreate) SetID(s string) *ScanCreate { - sc.mutation.SetID(s) - return sc -} - -// AddRepositoryIDs adds the "repository" edge to the Repository entity by IDs. -func (sc *ScanCreate) AddRepositoryIDs(ids ...int) *ScanCreate { - sc.mutation.AddRepositoryIDs(ids...) - return sc -} - -// AddRepository adds the "repository" edges to the Repository entity. -func (sc *ScanCreate) AddRepository(r ...*Repository) *ScanCreate { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return sc.AddRepositoryIDs(ids...) -} - -// AddPackageIDs adds the "packages" edge to the PackageRecord entity by IDs. -func (sc *ScanCreate) AddPackageIDs(ids ...int) *ScanCreate { - sc.mutation.AddPackageIDs(ids...) - return sc -} - -// AddPackages adds the "packages" edges to the PackageRecord entity. -func (sc *ScanCreate) AddPackages(p ...*PackageRecord) *ScanCreate { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return sc.AddPackageIDs(ids...) -} - -// Mutation returns the ScanMutation object of the builder. -func (sc *ScanCreate) Mutation() *ScanMutation { - return sc.mutation -} - -// Save creates the Scan in the database. -func (sc *ScanCreate) Save(ctx context.Context) (*Scan, error) { - var ( - err error - node *Scan - ) - if len(sc.hooks) == 0 { - if err = sc.check(); err != nil { - return nil, err - } - node, err = sc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*ScanMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = sc.check(); err != nil { - return nil, err - } - sc.mutation = mutation - if node, err = sc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(sc.hooks) - 1; i >= 0; i-- { - if sc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = sc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, sc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (sc *ScanCreate) SaveX(ctx context.Context) *Scan { - v, err := sc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (sc *ScanCreate) Exec(ctx context.Context) error { - _, err := sc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (sc *ScanCreate) ExecX(ctx context.Context) { - if err := sc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (sc *ScanCreate) check() error { - if _, ok := sc.mutation.Branch(); !ok { - return &ValidationError{Name: "branch", err: errors.New(`ent: missing required field "branch"`)} - } - if _, ok := sc.mutation.CommitID(); !ok { - return &ValidationError{Name: "commit_id", err: errors.New(`ent: missing required field "commit_id"`)} - } - if _, ok := sc.mutation.RequestedAt(); !ok { - return &ValidationError{Name: "requested_at", err: errors.New(`ent: missing required field "requested_at"`)} - } - if _, ok := sc.mutation.ScannedAt(); !ok { - return &ValidationError{Name: "scanned_at", err: errors.New(`ent: missing required field "scanned_at"`)} - } - return nil -} - -func (sc *ScanCreate) sqlSave(ctx context.Context) (*Scan, error) { - _node, _spec := sc.createSpec() - if err := sqlgraph.CreateNode(ctx, sc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - if _spec.ID.Value != nil { - _node.ID = _spec.ID.Value.(string) - } - return _node, nil -} - -func (sc *ScanCreate) createSpec() (*Scan, *sqlgraph.CreateSpec) { - var ( - _node = &Scan{config: sc.config} - _spec = &sqlgraph.CreateSpec{ - Table: scan.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - } - ) - _spec.OnConflict = sc.conflict - if id, ok := sc.mutation.ID(); ok { - _node.ID = id - _spec.ID.Value = id - } - if value, ok := sc.mutation.Branch(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: scan.FieldBranch, - }) - _node.Branch = value - } - if value, ok := sc.mutation.CommitID(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: scan.FieldCommitID, - }) - _node.CommitID = value - } - if value, ok := sc.mutation.RequestedAt(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldRequestedAt, - }) - _node.RequestedAt = value - } - if value, ok := sc.mutation.ScannedAt(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldScannedAt, - }) - _node.ScannedAt = value - } - if value, ok := sc.mutation.CheckID(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldCheckID, - }) - _node.CheckID = value - } - if value, ok := sc.mutation.PullRequestTarget(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: scan.FieldPullRequestTarget, - }) - _node.PullRequestTarget = value - } - if nodes := sc.mutation.RepositoryIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: scan.RepositoryTable, - Columns: scan.RepositoryPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - if nodes := sc.mutation.PackagesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: scan.PackagesTable, - Columns: scan.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Scan.Create(). -// SetBranch(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.ScanUpsert) { -// SetBranch(v+v). -// }). -// Exec(ctx) -// -func (sc *ScanCreate) OnConflict(opts ...sql.ConflictOption) *ScanUpsertOne { - sc.conflict = opts - return &ScanUpsertOne{ - create: sc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Scan.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (sc *ScanCreate) OnConflictColumns(columns ...string) *ScanUpsertOne { - sc.conflict = append(sc.conflict, sql.ConflictColumns(columns...)) - return &ScanUpsertOne{ - create: sc, - } -} - -type ( - // ScanUpsertOne is the builder for "upsert"-ing - // one Scan node. - ScanUpsertOne struct { - create *ScanCreate - } - - // ScanUpsert is the "OnConflict" setter. - ScanUpsert struct { - *sql.UpdateSet - } -) - -// SetBranch sets the "branch" field. -func (u *ScanUpsert) SetBranch(v string) *ScanUpsert { - u.Set(scan.FieldBranch, v) - return u -} - -// UpdateBranch sets the "branch" field to the value that was provided on create. -func (u *ScanUpsert) UpdateBranch() *ScanUpsert { - u.SetExcluded(scan.FieldBranch) - return u -} - -// SetCommitID sets the "commit_id" field. -func (u *ScanUpsert) SetCommitID(v string) *ScanUpsert { - u.Set(scan.FieldCommitID, v) - return u -} - -// UpdateCommitID sets the "commit_id" field to the value that was provided on create. -func (u *ScanUpsert) UpdateCommitID() *ScanUpsert { - u.SetExcluded(scan.FieldCommitID) - return u -} - -// SetRequestedAt sets the "requested_at" field. -func (u *ScanUpsert) SetRequestedAt(v int64) *ScanUpsert { - u.Set(scan.FieldRequestedAt, v) - return u -} - -// UpdateRequestedAt sets the "requested_at" field to the value that was provided on create. -func (u *ScanUpsert) UpdateRequestedAt() *ScanUpsert { - u.SetExcluded(scan.FieldRequestedAt) - return u -} - -// SetScannedAt sets the "scanned_at" field. -func (u *ScanUpsert) SetScannedAt(v int64) *ScanUpsert { - u.Set(scan.FieldScannedAt, v) - return u -} - -// UpdateScannedAt sets the "scanned_at" field to the value that was provided on create. -func (u *ScanUpsert) UpdateScannedAt() *ScanUpsert { - u.SetExcluded(scan.FieldScannedAt) - return u -} - -// SetCheckID sets the "check_id" field. -func (u *ScanUpsert) SetCheckID(v int64) *ScanUpsert { - u.Set(scan.FieldCheckID, v) - return u -} - -// UpdateCheckID sets the "check_id" field to the value that was provided on create. -func (u *ScanUpsert) UpdateCheckID() *ScanUpsert { - u.SetExcluded(scan.FieldCheckID) - return u -} - -// ClearCheckID clears the value of the "check_id" field. -func (u *ScanUpsert) ClearCheckID() *ScanUpsert { - u.SetNull(scan.FieldCheckID) - return u -} - -// SetPullRequestTarget sets the "pull_request_target" field. -func (u *ScanUpsert) SetPullRequestTarget(v string) *ScanUpsert { - u.Set(scan.FieldPullRequestTarget, v) - return u -} - -// UpdatePullRequestTarget sets the "pull_request_target" field to the value that was provided on create. -func (u *ScanUpsert) UpdatePullRequestTarget() *ScanUpsert { - u.SetExcluded(scan.FieldPullRequestTarget) - return u -} - -// ClearPullRequestTarget clears the value of the "pull_request_target" field. -func (u *ScanUpsert) ClearPullRequestTarget() *ScanUpsert { - u.SetNull(scan.FieldPullRequestTarget) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create except the ID field. -// Using this option is equivalent to using: -// -// client.Scan.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(scan.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *ScanUpsertOne) UpdateNewValues() *ScanUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - if _, exists := u.create.mutation.ID(); exists { - s.SetIgnore(scan.FieldID) - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Scan.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *ScanUpsertOne) Ignore() *ScanUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *ScanUpsertOne) DoNothing() *ScanUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the ScanCreate.OnConflict -// documentation for more info. -func (u *ScanUpsertOne) Update(set func(*ScanUpsert)) *ScanUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&ScanUpsert{UpdateSet: update}) - })) - return u -} - -// SetBranch sets the "branch" field. -func (u *ScanUpsertOne) SetBranch(v string) *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.SetBranch(v) - }) -} - -// UpdateBranch sets the "branch" field to the value that was provided on create. -func (u *ScanUpsertOne) UpdateBranch() *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.UpdateBranch() - }) -} - -// SetCommitID sets the "commit_id" field. -func (u *ScanUpsertOne) SetCommitID(v string) *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.SetCommitID(v) - }) -} - -// UpdateCommitID sets the "commit_id" field to the value that was provided on create. -func (u *ScanUpsertOne) UpdateCommitID() *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.UpdateCommitID() - }) -} - -// SetRequestedAt sets the "requested_at" field. -func (u *ScanUpsertOne) SetRequestedAt(v int64) *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.SetRequestedAt(v) - }) -} - -// UpdateRequestedAt sets the "requested_at" field to the value that was provided on create. -func (u *ScanUpsertOne) UpdateRequestedAt() *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.UpdateRequestedAt() - }) -} - -// SetScannedAt sets the "scanned_at" field. -func (u *ScanUpsertOne) SetScannedAt(v int64) *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.SetScannedAt(v) - }) -} - -// UpdateScannedAt sets the "scanned_at" field to the value that was provided on create. -func (u *ScanUpsertOne) UpdateScannedAt() *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.UpdateScannedAt() - }) -} - -// SetCheckID sets the "check_id" field. -func (u *ScanUpsertOne) SetCheckID(v int64) *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.SetCheckID(v) - }) -} - -// UpdateCheckID sets the "check_id" field to the value that was provided on create. -func (u *ScanUpsertOne) UpdateCheckID() *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.UpdateCheckID() - }) -} - -// ClearCheckID clears the value of the "check_id" field. -func (u *ScanUpsertOne) ClearCheckID() *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.ClearCheckID() - }) -} - -// SetPullRequestTarget sets the "pull_request_target" field. -func (u *ScanUpsertOne) SetPullRequestTarget(v string) *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.SetPullRequestTarget(v) - }) -} - -// UpdatePullRequestTarget sets the "pull_request_target" field to the value that was provided on create. -func (u *ScanUpsertOne) UpdatePullRequestTarget() *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.UpdatePullRequestTarget() - }) -} - -// ClearPullRequestTarget clears the value of the "pull_request_target" field. -func (u *ScanUpsertOne) ClearPullRequestTarget() *ScanUpsertOne { - return u.Update(func(s *ScanUpsert) { - s.ClearPullRequestTarget() - }) -} - -// Exec executes the query. -func (u *ScanUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for ScanCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *ScanUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *ScanUpsertOne) ID(ctx context.Context) (id string, err error) { - if u.create.driver.Dialect() == dialect.MySQL { - // In case of "ON CONFLICT", there is no way to get back non-numeric ID - // fields from the database since MySQL does not support the RETURNING clause. - return id, errors.New("ent: ScanUpsertOne.ID is not supported by MySQL driver. Use ScanUpsertOne.Exec instead") - } - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *ScanUpsertOne) IDX(ctx context.Context) string { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// ScanCreateBulk is the builder for creating many Scan entities in bulk. -type ScanCreateBulk struct { - config - builders []*ScanCreate - conflict []sql.ConflictOption -} - -// Save creates the Scan entities in the database. -func (scb *ScanCreateBulk) Save(ctx context.Context) ([]*Scan, error) { - specs := make([]*sqlgraph.CreateSpec, len(scb.builders)) - nodes := make([]*Scan, len(scb.builders)) - mutators := make([]Mutator, len(scb.builders)) - for i := range scb.builders { - func(i int, root context.Context) { - builder := scb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*ScanMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, scb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = scb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, scb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, scb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (scb *ScanCreateBulk) SaveX(ctx context.Context) []*Scan { - v, err := scb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (scb *ScanCreateBulk) Exec(ctx context.Context) error { - _, err := scb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (scb *ScanCreateBulk) ExecX(ctx context.Context) { - if err := scb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Scan.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.ScanUpsert) { -// SetBranch(v+v). -// }). -// Exec(ctx) -// -func (scb *ScanCreateBulk) OnConflict(opts ...sql.ConflictOption) *ScanUpsertBulk { - scb.conflict = opts - return &ScanUpsertBulk{ - create: scb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Scan.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (scb *ScanCreateBulk) OnConflictColumns(columns ...string) *ScanUpsertBulk { - scb.conflict = append(scb.conflict, sql.ConflictColumns(columns...)) - return &ScanUpsertBulk{ - create: scb, - } -} - -// ScanUpsertBulk is the builder for "upsert"-ing -// a bulk of Scan nodes. -type ScanUpsertBulk struct { - create *ScanCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.Scan.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(scan.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *ScanUpsertBulk) UpdateNewValues() *ScanUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - for _, b := range u.create.builders { - if _, exists := b.mutation.ID(); exists { - s.SetIgnore(scan.FieldID) - return - } - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Scan.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *ScanUpsertBulk) Ignore() *ScanUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *ScanUpsertBulk) DoNothing() *ScanUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the ScanCreateBulk.OnConflict -// documentation for more info. -func (u *ScanUpsertBulk) Update(set func(*ScanUpsert)) *ScanUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&ScanUpsert{UpdateSet: update}) - })) - return u -} - -// SetBranch sets the "branch" field. -func (u *ScanUpsertBulk) SetBranch(v string) *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.SetBranch(v) - }) -} - -// UpdateBranch sets the "branch" field to the value that was provided on create. -func (u *ScanUpsertBulk) UpdateBranch() *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.UpdateBranch() - }) -} - -// SetCommitID sets the "commit_id" field. -func (u *ScanUpsertBulk) SetCommitID(v string) *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.SetCommitID(v) - }) -} - -// UpdateCommitID sets the "commit_id" field to the value that was provided on create. -func (u *ScanUpsertBulk) UpdateCommitID() *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.UpdateCommitID() - }) -} - -// SetRequestedAt sets the "requested_at" field. -func (u *ScanUpsertBulk) SetRequestedAt(v int64) *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.SetRequestedAt(v) - }) -} - -// UpdateRequestedAt sets the "requested_at" field to the value that was provided on create. -func (u *ScanUpsertBulk) UpdateRequestedAt() *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.UpdateRequestedAt() - }) -} - -// SetScannedAt sets the "scanned_at" field. -func (u *ScanUpsertBulk) SetScannedAt(v int64) *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.SetScannedAt(v) - }) -} - -// UpdateScannedAt sets the "scanned_at" field to the value that was provided on create. -func (u *ScanUpsertBulk) UpdateScannedAt() *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.UpdateScannedAt() - }) -} - -// SetCheckID sets the "check_id" field. -func (u *ScanUpsertBulk) SetCheckID(v int64) *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.SetCheckID(v) - }) -} - -// UpdateCheckID sets the "check_id" field to the value that was provided on create. -func (u *ScanUpsertBulk) UpdateCheckID() *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.UpdateCheckID() - }) -} - -// ClearCheckID clears the value of the "check_id" field. -func (u *ScanUpsertBulk) ClearCheckID() *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.ClearCheckID() - }) -} - -// SetPullRequestTarget sets the "pull_request_target" field. -func (u *ScanUpsertBulk) SetPullRequestTarget(v string) *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.SetPullRequestTarget(v) - }) -} - -// UpdatePullRequestTarget sets the "pull_request_target" field to the value that was provided on create. -func (u *ScanUpsertBulk) UpdatePullRequestTarget() *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.UpdatePullRequestTarget() - }) -} - -// ClearPullRequestTarget clears the value of the "pull_request_target" field. -func (u *ScanUpsertBulk) ClearPullRequestTarget() *ScanUpsertBulk { - return u.Update(func(s *ScanUpsert) { - s.ClearPullRequestTarget() - }) -} - -// Exec executes the query. -func (u *ScanUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the ScanCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for ScanCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *ScanUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/scan_delete.go b/pkg/infra/ent/scan_delete.go deleted file mode 100644 index 9aa0fcb..0000000 --- a/pkg/infra/ent/scan_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" -) - -// ScanDelete is the builder for deleting a Scan entity. -type ScanDelete struct { - config - hooks []Hook - mutation *ScanMutation -} - -// Where appends a list predicates to the ScanDelete builder. -func (sd *ScanDelete) Where(ps ...predicate.Scan) *ScanDelete { - sd.mutation.Where(ps...) - return sd -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (sd *ScanDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(sd.hooks) == 0 { - affected, err = sd.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*ScanMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - sd.mutation = mutation - affected, err = sd.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(sd.hooks) - 1; i >= 0; i-- { - if sd.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = sd.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, sd.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (sd *ScanDelete) ExecX(ctx context.Context) int { - n, err := sd.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (sd *ScanDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: scan.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - if ps := sd.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, sd.driver, _spec) -} - -// ScanDeleteOne is the builder for deleting a single Scan entity. -type ScanDeleteOne struct { - sd *ScanDelete -} - -// Exec executes the deletion query. -func (sdo *ScanDeleteOne) Exec(ctx context.Context) error { - n, err := sdo.sd.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{scan.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (sdo *ScanDeleteOne) ExecX(ctx context.Context) { - sdo.sd.ExecX(ctx) -} diff --git a/pkg/infra/ent/scan_query.go b/pkg/infra/ent/scan_query.go deleted file mode 100644 index 1e19bee..0000000 --- a/pkg/infra/ent/scan_query.go +++ /dev/null @@ -1,1130 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "database/sql/driver" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" -) - -// ScanQuery is the builder for querying Scan entities. -type ScanQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.Scan - // eager-loading edges. - withRepository *RepositoryQuery - withPackages *PackageRecordQuery - withFKs bool - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the ScanQuery builder. -func (sq *ScanQuery) Where(ps ...predicate.Scan) *ScanQuery { - sq.predicates = append(sq.predicates, ps...) - return sq -} - -// Limit adds a limit step to the query. -func (sq *ScanQuery) Limit(limit int) *ScanQuery { - sq.limit = &limit - return sq -} - -// Offset adds an offset step to the query. -func (sq *ScanQuery) Offset(offset int) *ScanQuery { - sq.offset = &offset - return sq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (sq *ScanQuery) Unique(unique bool) *ScanQuery { - sq.unique = &unique - return sq -} - -// Order adds an order step to the query. -func (sq *ScanQuery) Order(o ...OrderFunc) *ScanQuery { - sq.order = append(sq.order, o...) - return sq -} - -// QueryRepository chains the current query on the "repository" edge. -func (sq *ScanQuery) QueryRepository() *RepositoryQuery { - query := &RepositoryQuery{config: sq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := sq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(scan.Table, scan.FieldID, selector), - sqlgraph.To(repository.Table, repository.FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, scan.RepositoryTable, scan.RepositoryPrimaryKey...), - ) - fromU = sqlgraph.SetNeighbors(sq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// QueryPackages chains the current query on the "packages" edge. -func (sq *ScanQuery) QueryPackages() *PackageRecordQuery { - query := &PackageRecordQuery{config: sq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := sq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(scan.Table, scan.FieldID, selector), - sqlgraph.To(packagerecord.Table, packagerecord.FieldID), - sqlgraph.Edge(sqlgraph.M2M, false, scan.PackagesTable, scan.PackagesPrimaryKey...), - ) - fromU = sqlgraph.SetNeighbors(sq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first Scan entity from the query. -// Returns a *NotFoundError when no Scan was found. -func (sq *ScanQuery) First(ctx context.Context) (*Scan, error) { - nodes, err := sq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{scan.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (sq *ScanQuery) FirstX(ctx context.Context) *Scan { - node, err := sq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first Scan ID from the query. -// Returns a *NotFoundError when no Scan ID was found. -func (sq *ScanQuery) FirstID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = sq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{scan.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (sq *ScanQuery) FirstIDX(ctx context.Context) string { - id, err := sq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single Scan entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one Scan entity is not found. -// Returns a *NotFoundError when no Scan entities are found. -func (sq *ScanQuery) Only(ctx context.Context) (*Scan, error) { - nodes, err := sq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{scan.Label} - default: - return nil, &NotSingularError{scan.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (sq *ScanQuery) OnlyX(ctx context.Context) *Scan { - node, err := sq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only Scan ID in the query. -// Returns a *NotSingularError when exactly one Scan ID is not found. -// Returns a *NotFoundError when no entities are found. -func (sq *ScanQuery) OnlyID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = sq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{scan.Label} - default: - err = &NotSingularError{scan.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (sq *ScanQuery) OnlyIDX(ctx context.Context) string { - id, err := sq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of Scans. -func (sq *ScanQuery) All(ctx context.Context) ([]*Scan, error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - return sq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (sq *ScanQuery) AllX(ctx context.Context) []*Scan { - nodes, err := sq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of Scan IDs. -func (sq *ScanQuery) IDs(ctx context.Context) ([]string, error) { - var ids []string - if err := sq.Select(scan.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (sq *ScanQuery) IDsX(ctx context.Context) []string { - ids, err := sq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (sq *ScanQuery) Count(ctx context.Context) (int, error) { - if err := sq.prepareQuery(ctx); err != nil { - return 0, err - } - return sq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (sq *ScanQuery) CountX(ctx context.Context) int { - count, err := sq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (sq *ScanQuery) Exist(ctx context.Context) (bool, error) { - if err := sq.prepareQuery(ctx); err != nil { - return false, err - } - return sq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (sq *ScanQuery) ExistX(ctx context.Context) bool { - exist, err := sq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the ScanQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (sq *ScanQuery) Clone() *ScanQuery { - if sq == nil { - return nil - } - return &ScanQuery{ - config: sq.config, - limit: sq.limit, - offset: sq.offset, - order: append([]OrderFunc{}, sq.order...), - predicates: append([]predicate.Scan{}, sq.predicates...), - withRepository: sq.withRepository.Clone(), - withPackages: sq.withPackages.Clone(), - // clone intermediate query. - sql: sq.sql.Clone(), - path: sq.path, - } -} - -// WithRepository tells the query-builder to eager-load the nodes that are connected to -// the "repository" edge. The optional arguments are used to configure the query builder of the edge. -func (sq *ScanQuery) WithRepository(opts ...func(*RepositoryQuery)) *ScanQuery { - query := &RepositoryQuery{config: sq.config} - for _, opt := range opts { - opt(query) - } - sq.withRepository = query - return sq -} - -// WithPackages tells the query-builder to eager-load the nodes that are connected to -// the "packages" edge. The optional arguments are used to configure the query builder of the edge. -func (sq *ScanQuery) WithPackages(opts ...func(*PackageRecordQuery)) *ScanQuery { - query := &PackageRecordQuery{config: sq.config} - for _, opt := range opts { - opt(query) - } - sq.withPackages = query - return sq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// Branch string `json:"branch,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.Scan.Query(). -// GroupBy(scan.FieldBranch). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (sq *ScanQuery) GroupBy(field string, fields ...string) *ScanGroupBy { - group := &ScanGroupBy{config: sq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - return sq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// Branch string `json:"branch,omitempty"` -// } -// -// client.Scan.Query(). -// Select(scan.FieldBranch). -// Scan(ctx, &v) -// -func (sq *ScanQuery) Select(fields ...string) *ScanSelect { - sq.fields = append(sq.fields, fields...) - return &ScanSelect{ScanQuery: sq} -} - -func (sq *ScanQuery) prepareQuery(ctx context.Context) error { - for _, f := range sq.fields { - if !scan.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if sq.path != nil { - prev, err := sq.path(ctx) - if err != nil { - return err - } - sq.sql = prev - } - return nil -} - -func (sq *ScanQuery) sqlAll(ctx context.Context) ([]*Scan, error) { - var ( - nodes = []*Scan{} - withFKs = sq.withFKs - _spec = sq.querySpec() - loadedTypes = [2]bool{ - sq.withRepository != nil, - sq.withPackages != nil, - } - ) - if withFKs { - _spec.Node.Columns = append(_spec.Node.Columns, scan.ForeignKeys...) - } - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Scan{config: sq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, sq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := sq.withRepository; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[string]*Scan, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Repository = []*Repository{} - } - var ( - edgeids []int - edges = make(map[int][]*Scan) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: true, - Table: scan.RepositoryTable, - Columns: scan.RepositoryPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(scan.RepositoryPrimaryKey[1], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullString), new(sql.NullInt64)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullString) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullInt64) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := eout.String - inValue := int(ein.Int64) - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, sq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "repository": %w`, err) - } - query.Where(repository.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "repository" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Repository = append(nodes[i].Edges.Repository, n) - } - } - } - - if query := sq.withPackages; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[string]*Scan, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Packages = []*PackageRecord{} - } - var ( - edgeids []int - edges = make(map[int][]*Scan) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: false, - Table: scan.PackagesTable, - Columns: scan.PackagesPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(scan.PackagesPrimaryKey[0], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullString), new(sql.NullInt64)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullString) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullInt64) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := eout.String - inValue := int(ein.Int64) - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, sq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "packages": %w`, err) - } - query.Where(packagerecord.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "packages" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Packages = append(nodes[i].Edges.Packages, n) - } - } - } - - return nodes, nil -} - -func (sq *ScanQuery) sqlCount(ctx context.Context) (int, error) { - _spec := sq.querySpec() - return sqlgraph.CountNodes(ctx, sq.driver, _spec) -} - -func (sq *ScanQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := sq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (sq *ScanQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: scan.Table, - Columns: scan.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - From: sq.sql, - Unique: true, - } - if unique := sq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := sq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, scan.FieldID) - for i := range fields { - if fields[i] != scan.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := sq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := sq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := sq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := sq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (sq *ScanQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(sq.driver.Dialect()) - t1 := builder.Table(scan.Table) - columns := sq.fields - if len(columns) == 0 { - columns = scan.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if sq.sql != nil { - selector = sq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range sq.predicates { - p(selector) - } - for _, p := range sq.order { - p(selector) - } - if offset := sq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := sq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// ScanGroupBy is the group-by builder for Scan entities. -type ScanGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (sgb *ScanGroupBy) Aggregate(fns ...AggregateFunc) *ScanGroupBy { - sgb.fns = append(sgb.fns, fns...) - return sgb -} - -// Scan applies the group-by query and scans the result into the given value. -func (sgb *ScanGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := sgb.path(ctx) - if err != nil { - return err - } - sgb.sql = query - return sgb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (sgb *ScanGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := sgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *ScanGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: ScanGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (sgb *ScanGroupBy) StringsX(ctx context.Context) []string { - v, err := sgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *ScanGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = sgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{scan.Label} - default: - err = fmt.Errorf("ent: ScanGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (sgb *ScanGroupBy) StringX(ctx context.Context) string { - v, err := sgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *ScanGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: ScanGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (sgb *ScanGroupBy) IntsX(ctx context.Context) []int { - v, err := sgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *ScanGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = sgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{scan.Label} - default: - err = fmt.Errorf("ent: ScanGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (sgb *ScanGroupBy) IntX(ctx context.Context) int { - v, err := sgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *ScanGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: ScanGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (sgb *ScanGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := sgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *ScanGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = sgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{scan.Label} - default: - err = fmt.Errorf("ent: ScanGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (sgb *ScanGroupBy) Float64X(ctx context.Context) float64 { - v, err := sgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *ScanGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: ScanGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (sgb *ScanGroupBy) BoolsX(ctx context.Context) []bool { - v, err := sgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *ScanGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = sgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{scan.Label} - default: - err = fmt.Errorf("ent: ScanGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (sgb *ScanGroupBy) BoolX(ctx context.Context) bool { - v, err := sgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (sgb *ScanGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range sgb.fields { - if !scan.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := sgb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := sgb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (sgb *ScanGroupBy) sqlQuery() *sql.Selector { - selector := sgb.sql.Select() - aggregation := make([]string, 0, len(sgb.fns)) - for _, fn := range sgb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(sgb.fields)+len(sgb.fns)) - for _, f := range sgb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(sgb.fields...)...) -} - -// ScanSelect is the builder for selecting fields of Scan entities. -type ScanSelect struct { - *ScanQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (ss *ScanSelect) Scan(ctx context.Context, v interface{}) error { - if err := ss.prepareQuery(ctx); err != nil { - return err - } - ss.sql = ss.ScanQuery.sqlQuery(ctx) - return ss.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (ss *ScanSelect) ScanX(ctx context.Context, v interface{}) { - if err := ss.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ss *ScanSelect) Strings(ctx context.Context) ([]string, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: ScanSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ss *ScanSelect) StringsX(ctx context.Context) []string { - v, err := ss.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ss *ScanSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ss.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{scan.Label} - default: - err = fmt.Errorf("ent: ScanSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ss *ScanSelect) StringX(ctx context.Context) string { - v, err := ss.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ss *ScanSelect) Ints(ctx context.Context) ([]int, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: ScanSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ss *ScanSelect) IntsX(ctx context.Context) []int { - v, err := ss.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ss *ScanSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ss.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{scan.Label} - default: - err = fmt.Errorf("ent: ScanSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ss *ScanSelect) IntX(ctx context.Context) int { - v, err := ss.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ss *ScanSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: ScanSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ss *ScanSelect) Float64sX(ctx context.Context) []float64 { - v, err := ss.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ss *ScanSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ss.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{scan.Label} - default: - err = fmt.Errorf("ent: ScanSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ss *ScanSelect) Float64X(ctx context.Context) float64 { - v, err := ss.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ss *ScanSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: ScanSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ss *ScanSelect) BoolsX(ctx context.Context) []bool { - v, err := ss.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ss *ScanSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ss.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{scan.Label} - default: - err = fmt.Errorf("ent: ScanSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ss *ScanSelect) BoolX(ctx context.Context) bool { - v, err := ss.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (ss *ScanSelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := ss.sql.Query() - if err := ss.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/scan_update.go b/pkg/infra/ent/scan_update.go deleted file mode 100644 index 280b88a..0000000 --- a/pkg/infra/ent/scan_update.go +++ /dev/null @@ -1,868 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/repository" - "github.com/m-mizutani/octovy/pkg/infra/ent/scan" -) - -// ScanUpdate is the builder for updating Scan entities. -type ScanUpdate struct { - config - hooks []Hook - mutation *ScanMutation -} - -// Where appends a list predicates to the ScanUpdate builder. -func (su *ScanUpdate) Where(ps ...predicate.Scan) *ScanUpdate { - su.mutation.Where(ps...) - return su -} - -// SetRequestedAt sets the "requested_at" field. -func (su *ScanUpdate) SetRequestedAt(i int64) *ScanUpdate { - su.mutation.ResetRequestedAt() - su.mutation.SetRequestedAt(i) - return su -} - -// AddRequestedAt adds i to the "requested_at" field. -func (su *ScanUpdate) AddRequestedAt(i int64) *ScanUpdate { - su.mutation.AddRequestedAt(i) - return su -} - -// SetScannedAt sets the "scanned_at" field. -func (su *ScanUpdate) SetScannedAt(i int64) *ScanUpdate { - su.mutation.ResetScannedAt() - su.mutation.SetScannedAt(i) - return su -} - -// AddScannedAt adds i to the "scanned_at" field. -func (su *ScanUpdate) AddScannedAt(i int64) *ScanUpdate { - su.mutation.AddScannedAt(i) - return su -} - -// SetCheckID sets the "check_id" field. -func (su *ScanUpdate) SetCheckID(i int64) *ScanUpdate { - su.mutation.ResetCheckID() - su.mutation.SetCheckID(i) - return su -} - -// SetNillableCheckID sets the "check_id" field if the given value is not nil. -func (su *ScanUpdate) SetNillableCheckID(i *int64) *ScanUpdate { - if i != nil { - su.SetCheckID(*i) - } - return su -} - -// AddCheckID adds i to the "check_id" field. -func (su *ScanUpdate) AddCheckID(i int64) *ScanUpdate { - su.mutation.AddCheckID(i) - return su -} - -// ClearCheckID clears the value of the "check_id" field. -func (su *ScanUpdate) ClearCheckID() *ScanUpdate { - su.mutation.ClearCheckID() - return su -} - -// SetPullRequestTarget sets the "pull_request_target" field. -func (su *ScanUpdate) SetPullRequestTarget(s string) *ScanUpdate { - su.mutation.SetPullRequestTarget(s) - return su -} - -// SetNillablePullRequestTarget sets the "pull_request_target" field if the given value is not nil. -func (su *ScanUpdate) SetNillablePullRequestTarget(s *string) *ScanUpdate { - if s != nil { - su.SetPullRequestTarget(*s) - } - return su -} - -// ClearPullRequestTarget clears the value of the "pull_request_target" field. -func (su *ScanUpdate) ClearPullRequestTarget() *ScanUpdate { - su.mutation.ClearPullRequestTarget() - return su -} - -// AddRepositoryIDs adds the "repository" edge to the Repository entity by IDs. -func (su *ScanUpdate) AddRepositoryIDs(ids ...int) *ScanUpdate { - su.mutation.AddRepositoryIDs(ids...) - return su -} - -// AddRepository adds the "repository" edges to the Repository entity. -func (su *ScanUpdate) AddRepository(r ...*Repository) *ScanUpdate { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return su.AddRepositoryIDs(ids...) -} - -// AddPackageIDs adds the "packages" edge to the PackageRecord entity by IDs. -func (su *ScanUpdate) AddPackageIDs(ids ...int) *ScanUpdate { - su.mutation.AddPackageIDs(ids...) - return su -} - -// AddPackages adds the "packages" edges to the PackageRecord entity. -func (su *ScanUpdate) AddPackages(p ...*PackageRecord) *ScanUpdate { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return su.AddPackageIDs(ids...) -} - -// Mutation returns the ScanMutation object of the builder. -func (su *ScanUpdate) Mutation() *ScanMutation { - return su.mutation -} - -// ClearRepository clears all "repository" edges to the Repository entity. -func (su *ScanUpdate) ClearRepository() *ScanUpdate { - su.mutation.ClearRepository() - return su -} - -// RemoveRepositoryIDs removes the "repository" edge to Repository entities by IDs. -func (su *ScanUpdate) RemoveRepositoryIDs(ids ...int) *ScanUpdate { - su.mutation.RemoveRepositoryIDs(ids...) - return su -} - -// RemoveRepository removes "repository" edges to Repository entities. -func (su *ScanUpdate) RemoveRepository(r ...*Repository) *ScanUpdate { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return su.RemoveRepositoryIDs(ids...) -} - -// ClearPackages clears all "packages" edges to the PackageRecord entity. -func (su *ScanUpdate) ClearPackages() *ScanUpdate { - su.mutation.ClearPackages() - return su -} - -// RemovePackageIDs removes the "packages" edge to PackageRecord entities by IDs. -func (su *ScanUpdate) RemovePackageIDs(ids ...int) *ScanUpdate { - su.mutation.RemovePackageIDs(ids...) - return su -} - -// RemovePackages removes "packages" edges to PackageRecord entities. -func (su *ScanUpdate) RemovePackages(p ...*PackageRecord) *ScanUpdate { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return su.RemovePackageIDs(ids...) -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (su *ScanUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(su.hooks) == 0 { - affected, err = su.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*ScanMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - su.mutation = mutation - affected, err = su.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(su.hooks) - 1; i >= 0; i-- { - if su.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = su.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, su.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (su *ScanUpdate) SaveX(ctx context.Context) int { - affected, err := su.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (su *ScanUpdate) Exec(ctx context.Context) error { - _, err := su.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (su *ScanUpdate) ExecX(ctx context.Context) { - if err := su.Exec(ctx); err != nil { - panic(err) - } -} - -func (su *ScanUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: scan.Table, - Columns: scan.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - if ps := su.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := su.mutation.RequestedAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldRequestedAt, - }) - } - if value, ok := su.mutation.AddedRequestedAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldRequestedAt, - }) - } - if value, ok := su.mutation.ScannedAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldScannedAt, - }) - } - if value, ok := su.mutation.AddedScannedAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldScannedAt, - }) - } - if value, ok := su.mutation.CheckID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldCheckID, - }) - } - if value, ok := su.mutation.AddedCheckID(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldCheckID, - }) - } - if su.mutation.CheckIDCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Column: scan.FieldCheckID, - }) - } - if value, ok := su.mutation.PullRequestTarget(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: scan.FieldPullRequestTarget, - }) - } - if su.mutation.PullRequestTargetCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldPullRequestTarget, - }) - } - if su.mutation.RepositoryCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: scan.RepositoryTable, - Columns: scan.RepositoryPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := su.mutation.RemovedRepositoryIDs(); len(nodes) > 0 && !su.mutation.RepositoryCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: scan.RepositoryTable, - Columns: scan.RepositoryPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := su.mutation.RepositoryIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: scan.RepositoryTable, - Columns: scan.RepositoryPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if su.mutation.PackagesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: scan.PackagesTable, - Columns: scan.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := su.mutation.RemovedPackagesIDs(); len(nodes) > 0 && !su.mutation.PackagesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: scan.PackagesTable, - Columns: scan.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := su.mutation.PackagesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: scan.PackagesTable, - Columns: scan.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, su.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{scan.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// ScanUpdateOne is the builder for updating a single Scan entity. -type ScanUpdateOne struct { - config - fields []string - hooks []Hook - mutation *ScanMutation -} - -// SetRequestedAt sets the "requested_at" field. -func (suo *ScanUpdateOne) SetRequestedAt(i int64) *ScanUpdateOne { - suo.mutation.ResetRequestedAt() - suo.mutation.SetRequestedAt(i) - return suo -} - -// AddRequestedAt adds i to the "requested_at" field. -func (suo *ScanUpdateOne) AddRequestedAt(i int64) *ScanUpdateOne { - suo.mutation.AddRequestedAt(i) - return suo -} - -// SetScannedAt sets the "scanned_at" field. -func (suo *ScanUpdateOne) SetScannedAt(i int64) *ScanUpdateOne { - suo.mutation.ResetScannedAt() - suo.mutation.SetScannedAt(i) - return suo -} - -// AddScannedAt adds i to the "scanned_at" field. -func (suo *ScanUpdateOne) AddScannedAt(i int64) *ScanUpdateOne { - suo.mutation.AddScannedAt(i) - return suo -} - -// SetCheckID sets the "check_id" field. -func (suo *ScanUpdateOne) SetCheckID(i int64) *ScanUpdateOne { - suo.mutation.ResetCheckID() - suo.mutation.SetCheckID(i) - return suo -} - -// SetNillableCheckID sets the "check_id" field if the given value is not nil. -func (suo *ScanUpdateOne) SetNillableCheckID(i *int64) *ScanUpdateOne { - if i != nil { - suo.SetCheckID(*i) - } - return suo -} - -// AddCheckID adds i to the "check_id" field. -func (suo *ScanUpdateOne) AddCheckID(i int64) *ScanUpdateOne { - suo.mutation.AddCheckID(i) - return suo -} - -// ClearCheckID clears the value of the "check_id" field. -func (suo *ScanUpdateOne) ClearCheckID() *ScanUpdateOne { - suo.mutation.ClearCheckID() - return suo -} - -// SetPullRequestTarget sets the "pull_request_target" field. -func (suo *ScanUpdateOne) SetPullRequestTarget(s string) *ScanUpdateOne { - suo.mutation.SetPullRequestTarget(s) - return suo -} - -// SetNillablePullRequestTarget sets the "pull_request_target" field if the given value is not nil. -func (suo *ScanUpdateOne) SetNillablePullRequestTarget(s *string) *ScanUpdateOne { - if s != nil { - suo.SetPullRequestTarget(*s) - } - return suo -} - -// ClearPullRequestTarget clears the value of the "pull_request_target" field. -func (suo *ScanUpdateOne) ClearPullRequestTarget() *ScanUpdateOne { - suo.mutation.ClearPullRequestTarget() - return suo -} - -// AddRepositoryIDs adds the "repository" edge to the Repository entity by IDs. -func (suo *ScanUpdateOne) AddRepositoryIDs(ids ...int) *ScanUpdateOne { - suo.mutation.AddRepositoryIDs(ids...) - return suo -} - -// AddRepository adds the "repository" edges to the Repository entity. -func (suo *ScanUpdateOne) AddRepository(r ...*Repository) *ScanUpdateOne { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return suo.AddRepositoryIDs(ids...) -} - -// AddPackageIDs adds the "packages" edge to the PackageRecord entity by IDs. -func (suo *ScanUpdateOne) AddPackageIDs(ids ...int) *ScanUpdateOne { - suo.mutation.AddPackageIDs(ids...) - return suo -} - -// AddPackages adds the "packages" edges to the PackageRecord entity. -func (suo *ScanUpdateOne) AddPackages(p ...*PackageRecord) *ScanUpdateOne { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return suo.AddPackageIDs(ids...) -} - -// Mutation returns the ScanMutation object of the builder. -func (suo *ScanUpdateOne) Mutation() *ScanMutation { - return suo.mutation -} - -// ClearRepository clears all "repository" edges to the Repository entity. -func (suo *ScanUpdateOne) ClearRepository() *ScanUpdateOne { - suo.mutation.ClearRepository() - return suo -} - -// RemoveRepositoryIDs removes the "repository" edge to Repository entities by IDs. -func (suo *ScanUpdateOne) RemoveRepositoryIDs(ids ...int) *ScanUpdateOne { - suo.mutation.RemoveRepositoryIDs(ids...) - return suo -} - -// RemoveRepository removes "repository" edges to Repository entities. -func (suo *ScanUpdateOne) RemoveRepository(r ...*Repository) *ScanUpdateOne { - ids := make([]int, len(r)) - for i := range r { - ids[i] = r[i].ID - } - return suo.RemoveRepositoryIDs(ids...) -} - -// ClearPackages clears all "packages" edges to the PackageRecord entity. -func (suo *ScanUpdateOne) ClearPackages() *ScanUpdateOne { - suo.mutation.ClearPackages() - return suo -} - -// RemovePackageIDs removes the "packages" edge to PackageRecord entities by IDs. -func (suo *ScanUpdateOne) RemovePackageIDs(ids ...int) *ScanUpdateOne { - suo.mutation.RemovePackageIDs(ids...) - return suo -} - -// RemovePackages removes "packages" edges to PackageRecord entities. -func (suo *ScanUpdateOne) RemovePackages(p ...*PackageRecord) *ScanUpdateOne { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return suo.RemovePackageIDs(ids...) -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (suo *ScanUpdateOne) Select(field string, fields ...string) *ScanUpdateOne { - suo.fields = append([]string{field}, fields...) - return suo -} - -// Save executes the query and returns the updated Scan entity. -func (suo *ScanUpdateOne) Save(ctx context.Context) (*Scan, error) { - var ( - err error - node *Scan - ) - if len(suo.hooks) == 0 { - node, err = suo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*ScanMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - suo.mutation = mutation - node, err = suo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(suo.hooks) - 1; i >= 0; i-- { - if suo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = suo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, suo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (suo *ScanUpdateOne) SaveX(ctx context.Context) *Scan { - node, err := suo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (suo *ScanUpdateOne) Exec(ctx context.Context) error { - _, err := suo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (suo *ScanUpdateOne) ExecX(ctx context.Context) { - if err := suo.Exec(ctx); err != nil { - panic(err) - } -} - -func (suo *ScanUpdateOne) sqlSave(ctx context.Context) (_node *Scan, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: scan.Table, - Columns: scan.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldID, - }, - }, - } - id, ok := suo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Scan.ID for update")} - } - _spec.Node.ID.Value = id - if fields := suo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, scan.FieldID) - for _, f := range fields { - if !scan.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != scan.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := suo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := suo.mutation.RequestedAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldRequestedAt, - }) - } - if value, ok := suo.mutation.AddedRequestedAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldRequestedAt, - }) - } - if value, ok := suo.mutation.ScannedAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldScannedAt, - }) - } - if value, ok := suo.mutation.AddedScannedAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldScannedAt, - }) - } - if value, ok := suo.mutation.CheckID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldCheckID, - }) - } - if value, ok := suo.mutation.AddedCheckID(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: scan.FieldCheckID, - }) - } - if suo.mutation.CheckIDCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Column: scan.FieldCheckID, - }) - } - if value, ok := suo.mutation.PullRequestTarget(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: scan.FieldPullRequestTarget, - }) - } - if suo.mutation.PullRequestTargetCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: scan.FieldPullRequestTarget, - }) - } - if suo.mutation.RepositoryCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: scan.RepositoryTable, - Columns: scan.RepositoryPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := suo.mutation.RemovedRepositoryIDs(); len(nodes) > 0 && !suo.mutation.RepositoryCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: scan.RepositoryTable, - Columns: scan.RepositoryPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := suo.mutation.RepositoryIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: scan.RepositoryTable, - Columns: scan.RepositoryPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: repository.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if suo.mutation.PackagesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: scan.PackagesTable, - Columns: scan.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := suo.mutation.RemovedPackagesIDs(); len(nodes) > 0 && !suo.mutation.PackagesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: scan.PackagesTable, - Columns: scan.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := suo.mutation.PackagesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: false, - Table: scan.PackagesTable, - Columns: scan.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &Scan{config: suo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, suo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{scan.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/session.go b/pkg/infra/ent/session.go deleted file mode 100644 index 6eb1f84..0000000 --- a/pkg/infra/ent/session.go +++ /dev/null @@ -1,170 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" -) - -// Session is the model entity for the Session schema. -type Session struct { - config `json:"-"` - // ID of the ent. - ID string `json:"id,omitempty"` - // UserID holds the value of the "user_id" field. - UserID int `json:"user_id,omitempty"` - // Token holds the value of the "token" field. - Token string `json:"-"` - // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` - // ExpiresAt holds the value of the "expires_at" field. - ExpiresAt int64 `json:"expires_at,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the SessionQuery when eager-loading is set. - Edges SessionEdges `json:"edges"` - session_login *int -} - -// SessionEdges holds the relations/edges for other nodes in the graph. -type SessionEdges struct { - // Login holds the value of the login edge. - Login *User `json:"login,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [1]bool -} - -// LoginOrErr returns the Login value or an error if the edge -// was not loaded in eager-loading, or loaded but was not found. -func (e SessionEdges) LoginOrErr() (*User, error) { - if e.loadedTypes[0] { - if e.Login == nil { - // The edge login was loaded in eager-loading, - // but was not found. - return nil, &NotFoundError{label: user.Label} - } - return e.Login, nil - } - return nil, &NotLoadedError{edge: "login"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*Session) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case session.FieldUserID, session.FieldCreatedAt, session.FieldExpiresAt: - values[i] = new(sql.NullInt64) - case session.FieldID, session.FieldToken: - values[i] = new(sql.NullString) - case session.ForeignKeys[0]: // session_login - values[i] = new(sql.NullInt64) - default: - return nil, fmt.Errorf("unexpected column %q for type Session", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the Session fields. -func (s *Session) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case session.FieldID: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field id", values[i]) - } else if value.Valid { - s.ID = value.String - } - case session.FieldUserID: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field user_id", values[i]) - } else if value.Valid { - s.UserID = int(value.Int64) - } - case session.FieldToken: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field token", values[i]) - } else if value.Valid { - s.Token = value.String - } - case session.FieldCreatedAt: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field created_at", values[i]) - } else if value.Valid { - s.CreatedAt = value.Int64 - } - case session.FieldExpiresAt: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field expires_at", values[i]) - } else if value.Valid { - s.ExpiresAt = value.Int64 - } - case session.ForeignKeys[0]: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for edge-field session_login", value) - } else if value.Valid { - s.session_login = new(int) - *s.session_login = int(value.Int64) - } - } - } - return nil -} - -// QueryLogin queries the "login" edge of the Session entity. -func (s *Session) QueryLogin() *UserQuery { - return (&SessionClient{config: s.config}).QueryLogin(s) -} - -// Update returns a builder for updating this Session. -// Note that you need to call Session.Unwrap() before calling this method if this Session -// was returned from a transaction, and the transaction was committed or rolled back. -func (s *Session) Update() *SessionUpdateOne { - return (&SessionClient{config: s.config}).UpdateOne(s) -} - -// Unwrap unwraps the Session entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (s *Session) Unwrap() *Session { - tx, ok := s.config.driver.(*txDriver) - if !ok { - panic("ent: Session is not a transactional entity") - } - s.config.driver = tx.drv - return s -} - -// String implements the fmt.Stringer. -func (s *Session) String() string { - var builder strings.Builder - builder.WriteString("Session(") - builder.WriteString(fmt.Sprintf("id=%v", s.ID)) - builder.WriteString(", user_id=") - builder.WriteString(fmt.Sprintf("%v", s.UserID)) - builder.WriteString(", token=") - builder.WriteString(", created_at=") - builder.WriteString(fmt.Sprintf("%v", s.CreatedAt)) - builder.WriteString(", expires_at=") - builder.WriteString(fmt.Sprintf("%v", s.ExpiresAt)) - builder.WriteByte(')') - return builder.String() -} - -// Sessions is a parsable slice of Session. -type Sessions []*Session - -func (s Sessions) config(cfg config) { - for _i := range s { - s[_i].config = cfg - } -} diff --git a/pkg/infra/ent/session/session.go b/pkg/infra/ent/session/session.go deleted file mode 100644 index cab6df2..0000000 --- a/pkg/infra/ent/session/session.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package session - -const ( - // Label holds the string label denoting the session type in the database. - Label = "session" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldUserID holds the string denoting the user_id field in the database. - FieldUserID = "user_id" - // FieldToken holds the string denoting the token field in the database. - FieldToken = "token" - // FieldCreatedAt holds the string denoting the created_at field in the database. - FieldCreatedAt = "created_at" - // FieldExpiresAt holds the string denoting the expires_at field in the database. - FieldExpiresAt = "expires_at" - // EdgeLogin holds the string denoting the login edge name in mutations. - EdgeLogin = "login" - // Table holds the table name of the session in the database. - Table = "sessions" - // LoginTable is the table that holds the login relation/edge. - LoginTable = "sessions" - // LoginInverseTable is the table name for the User entity. - // It exists in this package in order to avoid circular dependency with the "user" package. - LoginInverseTable = "users" - // LoginColumn is the table column denoting the login relation/edge. - LoginColumn = "session_login" -) - -// Columns holds all SQL columns for session fields. -var Columns = []string{ - FieldID, - FieldUserID, - FieldToken, - FieldCreatedAt, - FieldExpiresAt, -} - -// ForeignKeys holds the SQL foreign-keys that are owned by the "sessions" -// table and are not defined as standalone fields in the schema. -var ForeignKeys = []string{ - "session_login", -} - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - for i := range ForeignKeys { - if column == ForeignKeys[i] { - return true - } - } - return false -} - -var ( - // TokenValidator is a validator for the "token" field. It is called by the builders before save. - TokenValidator func(string) error -) diff --git a/pkg/infra/ent/session/where.go b/pkg/infra/ent/session/where.go deleted file mode 100644 index ced979d..0000000 --- a/pkg/infra/ent/session/where.go +++ /dev/null @@ -1,519 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package session - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ. -func UserID(v int) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldUserID), v)) - }) -} - -// Token applies equality check predicate on the "token" field. It's identical to TokenEQ. -func Token(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldToken), v)) - }) -} - -// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. -func CreatedAt(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldCreatedAt), v)) - }) -} - -// ExpiresAt applies equality check predicate on the "expires_at" field. It's identical to ExpiresAtEQ. -func ExpiresAt(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldExpiresAt), v)) - }) -} - -// UserIDEQ applies the EQ predicate on the "user_id" field. -func UserIDEQ(v int) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldUserID), v)) - }) -} - -// UserIDNEQ applies the NEQ predicate on the "user_id" field. -func UserIDNEQ(v int) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldUserID), v)) - }) -} - -// UserIDIn applies the In predicate on the "user_id" field. -func UserIDIn(vs ...int) predicate.Session { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldUserID), v...)) - }) -} - -// UserIDNotIn applies the NotIn predicate on the "user_id" field. -func UserIDNotIn(vs ...int) predicate.Session { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldUserID), v...)) - }) -} - -// UserIDGT applies the GT predicate on the "user_id" field. -func UserIDGT(v int) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldUserID), v)) - }) -} - -// UserIDGTE applies the GTE predicate on the "user_id" field. -func UserIDGTE(v int) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldUserID), v)) - }) -} - -// UserIDLT applies the LT predicate on the "user_id" field. -func UserIDLT(v int) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldUserID), v)) - }) -} - -// UserIDLTE applies the LTE predicate on the "user_id" field. -func UserIDLTE(v int) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldUserID), v)) - }) -} - -// TokenEQ applies the EQ predicate on the "token" field. -func TokenEQ(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldToken), v)) - }) -} - -// TokenNEQ applies the NEQ predicate on the "token" field. -func TokenNEQ(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldToken), v)) - }) -} - -// TokenIn applies the In predicate on the "token" field. -func TokenIn(vs ...string) predicate.Session { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldToken), v...)) - }) -} - -// TokenNotIn applies the NotIn predicate on the "token" field. -func TokenNotIn(vs ...string) predicate.Session { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldToken), v...)) - }) -} - -// TokenGT applies the GT predicate on the "token" field. -func TokenGT(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldToken), v)) - }) -} - -// TokenGTE applies the GTE predicate on the "token" field. -func TokenGTE(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldToken), v)) - }) -} - -// TokenLT applies the LT predicate on the "token" field. -func TokenLT(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldToken), v)) - }) -} - -// TokenLTE applies the LTE predicate on the "token" field. -func TokenLTE(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldToken), v)) - }) -} - -// TokenContains applies the Contains predicate on the "token" field. -func TokenContains(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldToken), v)) - }) -} - -// TokenHasPrefix applies the HasPrefix predicate on the "token" field. -func TokenHasPrefix(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldToken), v)) - }) -} - -// TokenHasSuffix applies the HasSuffix predicate on the "token" field. -func TokenHasSuffix(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldToken), v)) - }) -} - -// TokenEqualFold applies the EqualFold predicate on the "token" field. -func TokenEqualFold(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldToken), v)) - }) -} - -// TokenContainsFold applies the ContainsFold predicate on the "token" field. -func TokenContainsFold(v string) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldToken), v)) - }) -} - -// CreatedAtEQ applies the EQ predicate on the "created_at" field. -func CreatedAtEQ(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. -func CreatedAtNEQ(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtIn applies the In predicate on the "created_at" field. -func CreatedAtIn(vs ...int64) predicate.Session { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldCreatedAt), v...)) - }) -} - -// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. -func CreatedAtNotIn(vs ...int64) predicate.Session { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldCreatedAt), v...)) - }) -} - -// CreatedAtGT applies the GT predicate on the "created_at" field. -func CreatedAtGT(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtGTE applies the GTE predicate on the "created_at" field. -func CreatedAtGTE(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtLT applies the LT predicate on the "created_at" field. -func CreatedAtLT(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtLTE applies the LTE predicate on the "created_at" field. -func CreatedAtLTE(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldCreatedAt), v)) - }) -} - -// ExpiresAtEQ applies the EQ predicate on the "expires_at" field. -func ExpiresAtEQ(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtNEQ applies the NEQ predicate on the "expires_at" field. -func ExpiresAtNEQ(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtIn applies the In predicate on the "expires_at" field. -func ExpiresAtIn(vs ...int64) predicate.Session { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldExpiresAt), v...)) - }) -} - -// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field. -func ExpiresAtNotIn(vs ...int64) predicate.Session { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Session(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldExpiresAt), v...)) - }) -} - -// ExpiresAtGT applies the GT predicate on the "expires_at" field. -func ExpiresAtGT(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtGTE applies the GTE predicate on the "expires_at" field. -func ExpiresAtGTE(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtLT applies the LT predicate on the "expires_at" field. -func ExpiresAtLT(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtLTE applies the LTE predicate on the "expires_at" field. -func ExpiresAtLTE(v int64) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldExpiresAt), v)) - }) -} - -// HasLogin applies the HasEdge predicate on the "login" edge. -func HasLogin() predicate.Session { - return predicate.Session(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(LoginTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, LoginTable, LoginColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasLoginWith applies the HasEdge predicate on the "login" edge with a given conditions (other predicates). -func HasLoginWith(preds ...predicate.User) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(LoginInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, LoginTable, LoginColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.Session) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.Session) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.Session) predicate.Session { - return predicate.Session(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/session_create.go b/pkg/infra/ent/session_create.go deleted file mode 100644 index 93a7723..0000000 --- a/pkg/infra/ent/session_create.go +++ /dev/null @@ -1,744 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" -) - -// SessionCreate is the builder for creating a Session entity. -type SessionCreate struct { - config - mutation *SessionMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetUserID sets the "user_id" field. -func (sc *SessionCreate) SetUserID(i int) *SessionCreate { - sc.mutation.SetUserID(i) - return sc -} - -// SetToken sets the "token" field. -func (sc *SessionCreate) SetToken(s string) *SessionCreate { - sc.mutation.SetToken(s) - return sc -} - -// SetCreatedAt sets the "created_at" field. -func (sc *SessionCreate) SetCreatedAt(i int64) *SessionCreate { - sc.mutation.SetCreatedAt(i) - return sc -} - -// SetExpiresAt sets the "expires_at" field. -func (sc *SessionCreate) SetExpiresAt(i int64) *SessionCreate { - sc.mutation.SetExpiresAt(i) - return sc -} - -// SetID sets the "id" field. -func (sc *SessionCreate) SetID(s string) *SessionCreate { - sc.mutation.SetID(s) - return sc -} - -// SetLoginID sets the "login" edge to the User entity by ID. -func (sc *SessionCreate) SetLoginID(id int) *SessionCreate { - sc.mutation.SetLoginID(id) - return sc -} - -// SetNillableLoginID sets the "login" edge to the User entity by ID if the given value is not nil. -func (sc *SessionCreate) SetNillableLoginID(id *int) *SessionCreate { - if id != nil { - sc = sc.SetLoginID(*id) - } - return sc -} - -// SetLogin sets the "login" edge to the User entity. -func (sc *SessionCreate) SetLogin(u *User) *SessionCreate { - return sc.SetLoginID(u.ID) -} - -// Mutation returns the SessionMutation object of the builder. -func (sc *SessionCreate) Mutation() *SessionMutation { - return sc.mutation -} - -// Save creates the Session in the database. -func (sc *SessionCreate) Save(ctx context.Context) (*Session, error) { - var ( - err error - node *Session - ) - if len(sc.hooks) == 0 { - if err = sc.check(); err != nil { - return nil, err - } - node, err = sc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SessionMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = sc.check(); err != nil { - return nil, err - } - sc.mutation = mutation - if node, err = sc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(sc.hooks) - 1; i >= 0; i-- { - if sc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = sc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, sc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (sc *SessionCreate) SaveX(ctx context.Context) *Session { - v, err := sc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (sc *SessionCreate) Exec(ctx context.Context) error { - _, err := sc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (sc *SessionCreate) ExecX(ctx context.Context) { - if err := sc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (sc *SessionCreate) check() error { - if _, ok := sc.mutation.UserID(); !ok { - return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "user_id"`)} - } - if _, ok := sc.mutation.Token(); !ok { - return &ValidationError{Name: "token", err: errors.New(`ent: missing required field "token"`)} - } - if v, ok := sc.mutation.Token(); ok { - if err := session.TokenValidator(v); err != nil { - return &ValidationError{Name: "token", err: fmt.Errorf(`ent: validator failed for field "token": %w`, err)} - } - } - if _, ok := sc.mutation.CreatedAt(); !ok { - return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "created_at"`)} - } - if _, ok := sc.mutation.ExpiresAt(); !ok { - return &ValidationError{Name: "expires_at", err: errors.New(`ent: missing required field "expires_at"`)} - } - return nil -} - -func (sc *SessionCreate) sqlSave(ctx context.Context) (*Session, error) { - _node, _spec := sc.createSpec() - if err := sqlgraph.CreateNode(ctx, sc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - if _spec.ID.Value != nil { - _node.ID = _spec.ID.Value.(string) - } - return _node, nil -} - -func (sc *SessionCreate) createSpec() (*Session, *sqlgraph.CreateSpec) { - var ( - _node = &Session{config: sc.config} - _spec = &sqlgraph.CreateSpec{ - Table: session.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: session.FieldID, - }, - } - ) - _spec.OnConflict = sc.conflict - if id, ok := sc.mutation.ID(); ok { - _node.ID = id - _spec.ID.Value = id - } - if value, ok := sc.mutation.UserID(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Value: value, - Column: session.FieldUserID, - }) - _node.UserID = value - } - if value, ok := sc.mutation.Token(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: session.FieldToken, - }) - _node.Token = value - } - if value, ok := sc.mutation.CreatedAt(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: session.FieldCreatedAt, - }) - _node.CreatedAt = value - } - if value, ok := sc.mutation.ExpiresAt(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: session.FieldExpiresAt, - }) - _node.ExpiresAt = value - } - if nodes := sc.mutation.LoginIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: session.LoginTable, - Columns: []string{session.LoginColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _node.session_login = &nodes[0] - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Session.Create(). -// SetUserID(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.SessionUpsert) { -// SetUserID(v+v). -// }). -// Exec(ctx) -// -func (sc *SessionCreate) OnConflict(opts ...sql.ConflictOption) *SessionUpsertOne { - sc.conflict = opts - return &SessionUpsertOne{ - create: sc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Session.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (sc *SessionCreate) OnConflictColumns(columns ...string) *SessionUpsertOne { - sc.conflict = append(sc.conflict, sql.ConflictColumns(columns...)) - return &SessionUpsertOne{ - create: sc, - } -} - -type ( - // SessionUpsertOne is the builder for "upsert"-ing - // one Session node. - SessionUpsertOne struct { - create *SessionCreate - } - - // SessionUpsert is the "OnConflict" setter. - SessionUpsert struct { - *sql.UpdateSet - } -) - -// SetUserID sets the "user_id" field. -func (u *SessionUpsert) SetUserID(v int) *SessionUpsert { - u.Set(session.FieldUserID, v) - return u -} - -// UpdateUserID sets the "user_id" field to the value that was provided on create. -func (u *SessionUpsert) UpdateUserID() *SessionUpsert { - u.SetExcluded(session.FieldUserID) - return u -} - -// SetToken sets the "token" field. -func (u *SessionUpsert) SetToken(v string) *SessionUpsert { - u.Set(session.FieldToken, v) - return u -} - -// UpdateToken sets the "token" field to the value that was provided on create. -func (u *SessionUpsert) UpdateToken() *SessionUpsert { - u.SetExcluded(session.FieldToken) - return u -} - -// SetCreatedAt sets the "created_at" field. -func (u *SessionUpsert) SetCreatedAt(v int64) *SessionUpsert { - u.Set(session.FieldCreatedAt, v) - return u -} - -// UpdateCreatedAt sets the "created_at" field to the value that was provided on create. -func (u *SessionUpsert) UpdateCreatedAt() *SessionUpsert { - u.SetExcluded(session.FieldCreatedAt) - return u -} - -// SetExpiresAt sets the "expires_at" field. -func (u *SessionUpsert) SetExpiresAt(v int64) *SessionUpsert { - u.Set(session.FieldExpiresAt, v) - return u -} - -// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create. -func (u *SessionUpsert) UpdateExpiresAt() *SessionUpsert { - u.SetExcluded(session.FieldExpiresAt) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create except the ID field. -// Using this option is equivalent to using: -// -// client.Session.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(session.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *SessionUpsertOne) UpdateNewValues() *SessionUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - if _, exists := u.create.mutation.ID(); exists { - s.SetIgnore(session.FieldID) - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Session.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *SessionUpsertOne) Ignore() *SessionUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *SessionUpsertOne) DoNothing() *SessionUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the SessionCreate.OnConflict -// documentation for more info. -func (u *SessionUpsertOne) Update(set func(*SessionUpsert)) *SessionUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&SessionUpsert{UpdateSet: update}) - })) - return u -} - -// SetUserID sets the "user_id" field. -func (u *SessionUpsertOne) SetUserID(v int) *SessionUpsertOne { - return u.Update(func(s *SessionUpsert) { - s.SetUserID(v) - }) -} - -// UpdateUserID sets the "user_id" field to the value that was provided on create. -func (u *SessionUpsertOne) UpdateUserID() *SessionUpsertOne { - return u.Update(func(s *SessionUpsert) { - s.UpdateUserID() - }) -} - -// SetToken sets the "token" field. -func (u *SessionUpsertOne) SetToken(v string) *SessionUpsertOne { - return u.Update(func(s *SessionUpsert) { - s.SetToken(v) - }) -} - -// UpdateToken sets the "token" field to the value that was provided on create. -func (u *SessionUpsertOne) UpdateToken() *SessionUpsertOne { - return u.Update(func(s *SessionUpsert) { - s.UpdateToken() - }) -} - -// SetCreatedAt sets the "created_at" field. -func (u *SessionUpsertOne) SetCreatedAt(v int64) *SessionUpsertOne { - return u.Update(func(s *SessionUpsert) { - s.SetCreatedAt(v) - }) -} - -// UpdateCreatedAt sets the "created_at" field to the value that was provided on create. -func (u *SessionUpsertOne) UpdateCreatedAt() *SessionUpsertOne { - return u.Update(func(s *SessionUpsert) { - s.UpdateCreatedAt() - }) -} - -// SetExpiresAt sets the "expires_at" field. -func (u *SessionUpsertOne) SetExpiresAt(v int64) *SessionUpsertOne { - return u.Update(func(s *SessionUpsert) { - s.SetExpiresAt(v) - }) -} - -// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create. -func (u *SessionUpsertOne) UpdateExpiresAt() *SessionUpsertOne { - return u.Update(func(s *SessionUpsert) { - s.UpdateExpiresAt() - }) -} - -// Exec executes the query. -func (u *SessionUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for SessionCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *SessionUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *SessionUpsertOne) ID(ctx context.Context) (id string, err error) { - if u.create.driver.Dialect() == dialect.MySQL { - // In case of "ON CONFLICT", there is no way to get back non-numeric ID - // fields from the database since MySQL does not support the RETURNING clause. - return id, errors.New("ent: SessionUpsertOne.ID is not supported by MySQL driver. Use SessionUpsertOne.Exec instead") - } - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *SessionUpsertOne) IDX(ctx context.Context) string { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// SessionCreateBulk is the builder for creating many Session entities in bulk. -type SessionCreateBulk struct { - config - builders []*SessionCreate - conflict []sql.ConflictOption -} - -// Save creates the Session entities in the database. -func (scb *SessionCreateBulk) Save(ctx context.Context) ([]*Session, error) { - specs := make([]*sqlgraph.CreateSpec, len(scb.builders)) - nodes := make([]*Session, len(scb.builders)) - mutators := make([]Mutator, len(scb.builders)) - for i := range scb.builders { - func(i int, root context.Context) { - builder := scb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SessionMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, scb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = scb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, scb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, scb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (scb *SessionCreateBulk) SaveX(ctx context.Context) []*Session { - v, err := scb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (scb *SessionCreateBulk) Exec(ctx context.Context) error { - _, err := scb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (scb *SessionCreateBulk) ExecX(ctx context.Context) { - if err := scb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Session.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.SessionUpsert) { -// SetUserID(v+v). -// }). -// Exec(ctx) -// -func (scb *SessionCreateBulk) OnConflict(opts ...sql.ConflictOption) *SessionUpsertBulk { - scb.conflict = opts - return &SessionUpsertBulk{ - create: scb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Session.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (scb *SessionCreateBulk) OnConflictColumns(columns ...string) *SessionUpsertBulk { - scb.conflict = append(scb.conflict, sql.ConflictColumns(columns...)) - return &SessionUpsertBulk{ - create: scb, - } -} - -// SessionUpsertBulk is the builder for "upsert"-ing -// a bulk of Session nodes. -type SessionUpsertBulk struct { - create *SessionCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.Session.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(session.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *SessionUpsertBulk) UpdateNewValues() *SessionUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - for _, b := range u.create.builders { - if _, exists := b.mutation.ID(); exists { - s.SetIgnore(session.FieldID) - return - } - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Session.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *SessionUpsertBulk) Ignore() *SessionUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *SessionUpsertBulk) DoNothing() *SessionUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the SessionCreateBulk.OnConflict -// documentation for more info. -func (u *SessionUpsertBulk) Update(set func(*SessionUpsert)) *SessionUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&SessionUpsert{UpdateSet: update}) - })) - return u -} - -// SetUserID sets the "user_id" field. -func (u *SessionUpsertBulk) SetUserID(v int) *SessionUpsertBulk { - return u.Update(func(s *SessionUpsert) { - s.SetUserID(v) - }) -} - -// UpdateUserID sets the "user_id" field to the value that was provided on create. -func (u *SessionUpsertBulk) UpdateUserID() *SessionUpsertBulk { - return u.Update(func(s *SessionUpsert) { - s.UpdateUserID() - }) -} - -// SetToken sets the "token" field. -func (u *SessionUpsertBulk) SetToken(v string) *SessionUpsertBulk { - return u.Update(func(s *SessionUpsert) { - s.SetToken(v) - }) -} - -// UpdateToken sets the "token" field to the value that was provided on create. -func (u *SessionUpsertBulk) UpdateToken() *SessionUpsertBulk { - return u.Update(func(s *SessionUpsert) { - s.UpdateToken() - }) -} - -// SetCreatedAt sets the "created_at" field. -func (u *SessionUpsertBulk) SetCreatedAt(v int64) *SessionUpsertBulk { - return u.Update(func(s *SessionUpsert) { - s.SetCreatedAt(v) - }) -} - -// UpdateCreatedAt sets the "created_at" field to the value that was provided on create. -func (u *SessionUpsertBulk) UpdateCreatedAt() *SessionUpsertBulk { - return u.Update(func(s *SessionUpsert) { - s.UpdateCreatedAt() - }) -} - -// SetExpiresAt sets the "expires_at" field. -func (u *SessionUpsertBulk) SetExpiresAt(v int64) *SessionUpsertBulk { - return u.Update(func(s *SessionUpsert) { - s.SetExpiresAt(v) - }) -} - -// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create. -func (u *SessionUpsertBulk) UpdateExpiresAt() *SessionUpsertBulk { - return u.Update(func(s *SessionUpsert) { - s.UpdateExpiresAt() - }) -} - -// Exec executes the query. -func (u *SessionUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the SessionCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for SessionCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *SessionUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/session_delete.go b/pkg/infra/ent/session_delete.go deleted file mode 100644 index 8591568..0000000 --- a/pkg/infra/ent/session_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" -) - -// SessionDelete is the builder for deleting a Session entity. -type SessionDelete struct { - config - hooks []Hook - mutation *SessionMutation -} - -// Where appends a list predicates to the SessionDelete builder. -func (sd *SessionDelete) Where(ps ...predicate.Session) *SessionDelete { - sd.mutation.Where(ps...) - return sd -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (sd *SessionDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(sd.hooks) == 0 { - affected, err = sd.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SessionMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - sd.mutation = mutation - affected, err = sd.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(sd.hooks) - 1; i >= 0; i-- { - if sd.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = sd.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, sd.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (sd *SessionDelete) ExecX(ctx context.Context) int { - n, err := sd.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (sd *SessionDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: session.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: session.FieldID, - }, - }, - } - if ps := sd.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, sd.driver, _spec) -} - -// SessionDeleteOne is the builder for deleting a single Session entity. -type SessionDeleteOne struct { - sd *SessionDelete -} - -// Exec executes the deletion query. -func (sdo *SessionDeleteOne) Exec(ctx context.Context) error { - n, err := sdo.sd.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{session.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (sdo *SessionDeleteOne) ExecX(ctx context.Context) { - sdo.sd.ExecX(ctx) -} diff --git a/pkg/infra/ent/session_query.go b/pkg/infra/ent/session_query.go deleted file mode 100644 index c74cded..0000000 --- a/pkg/infra/ent/session_query.go +++ /dev/null @@ -1,994 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" -) - -// SessionQuery is the builder for querying Session entities. -type SessionQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.Session - // eager-loading edges. - withLogin *UserQuery - withFKs bool - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the SessionQuery builder. -func (sq *SessionQuery) Where(ps ...predicate.Session) *SessionQuery { - sq.predicates = append(sq.predicates, ps...) - return sq -} - -// Limit adds a limit step to the query. -func (sq *SessionQuery) Limit(limit int) *SessionQuery { - sq.limit = &limit - return sq -} - -// Offset adds an offset step to the query. -func (sq *SessionQuery) Offset(offset int) *SessionQuery { - sq.offset = &offset - return sq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (sq *SessionQuery) Unique(unique bool) *SessionQuery { - sq.unique = &unique - return sq -} - -// Order adds an order step to the query. -func (sq *SessionQuery) Order(o ...OrderFunc) *SessionQuery { - sq.order = append(sq.order, o...) - return sq -} - -// QueryLogin chains the current query on the "login" edge. -func (sq *SessionQuery) QueryLogin() *UserQuery { - query := &UserQuery{config: sq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := sq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(session.Table, session.FieldID, selector), - sqlgraph.To(user.Table, user.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, session.LoginTable, session.LoginColumn), - ) - fromU = sqlgraph.SetNeighbors(sq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first Session entity from the query. -// Returns a *NotFoundError when no Session was found. -func (sq *SessionQuery) First(ctx context.Context) (*Session, error) { - nodes, err := sq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{session.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (sq *SessionQuery) FirstX(ctx context.Context) *Session { - node, err := sq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first Session ID from the query. -// Returns a *NotFoundError when no Session ID was found. -func (sq *SessionQuery) FirstID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = sq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{session.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (sq *SessionQuery) FirstIDX(ctx context.Context) string { - id, err := sq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single Session entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one Session entity is not found. -// Returns a *NotFoundError when no Session entities are found. -func (sq *SessionQuery) Only(ctx context.Context) (*Session, error) { - nodes, err := sq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{session.Label} - default: - return nil, &NotSingularError{session.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (sq *SessionQuery) OnlyX(ctx context.Context) *Session { - node, err := sq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only Session ID in the query. -// Returns a *NotSingularError when exactly one Session ID is not found. -// Returns a *NotFoundError when no entities are found. -func (sq *SessionQuery) OnlyID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = sq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{session.Label} - default: - err = &NotSingularError{session.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (sq *SessionQuery) OnlyIDX(ctx context.Context) string { - id, err := sq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of Sessions. -func (sq *SessionQuery) All(ctx context.Context) ([]*Session, error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - return sq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (sq *SessionQuery) AllX(ctx context.Context) []*Session { - nodes, err := sq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of Session IDs. -func (sq *SessionQuery) IDs(ctx context.Context) ([]string, error) { - var ids []string - if err := sq.Select(session.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (sq *SessionQuery) IDsX(ctx context.Context) []string { - ids, err := sq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (sq *SessionQuery) Count(ctx context.Context) (int, error) { - if err := sq.prepareQuery(ctx); err != nil { - return 0, err - } - return sq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (sq *SessionQuery) CountX(ctx context.Context) int { - count, err := sq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (sq *SessionQuery) Exist(ctx context.Context) (bool, error) { - if err := sq.prepareQuery(ctx); err != nil { - return false, err - } - return sq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (sq *SessionQuery) ExistX(ctx context.Context) bool { - exist, err := sq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the SessionQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (sq *SessionQuery) Clone() *SessionQuery { - if sq == nil { - return nil - } - return &SessionQuery{ - config: sq.config, - limit: sq.limit, - offset: sq.offset, - order: append([]OrderFunc{}, sq.order...), - predicates: append([]predicate.Session{}, sq.predicates...), - withLogin: sq.withLogin.Clone(), - // clone intermediate query. - sql: sq.sql.Clone(), - path: sq.path, - } -} - -// WithLogin tells the query-builder to eager-load the nodes that are connected to -// the "login" edge. The optional arguments are used to configure the query builder of the edge. -func (sq *SessionQuery) WithLogin(opts ...func(*UserQuery)) *SessionQuery { - query := &UserQuery{config: sq.config} - for _, opt := range opts { - opt(query) - } - sq.withLogin = query - return sq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// UserID int `json:"user_id,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.Session.Query(). -// GroupBy(session.FieldUserID). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (sq *SessionQuery) GroupBy(field string, fields ...string) *SessionGroupBy { - group := &SessionGroupBy{config: sq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - return sq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// UserID int `json:"user_id,omitempty"` -// } -// -// client.Session.Query(). -// Select(session.FieldUserID). -// Scan(ctx, &v) -// -func (sq *SessionQuery) Select(fields ...string) *SessionSelect { - sq.fields = append(sq.fields, fields...) - return &SessionSelect{SessionQuery: sq} -} - -func (sq *SessionQuery) prepareQuery(ctx context.Context) error { - for _, f := range sq.fields { - if !session.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if sq.path != nil { - prev, err := sq.path(ctx) - if err != nil { - return err - } - sq.sql = prev - } - return nil -} - -func (sq *SessionQuery) sqlAll(ctx context.Context) ([]*Session, error) { - var ( - nodes = []*Session{} - withFKs = sq.withFKs - _spec = sq.querySpec() - loadedTypes = [1]bool{ - sq.withLogin != nil, - } - ) - if sq.withLogin != nil { - withFKs = true - } - if withFKs { - _spec.Node.Columns = append(_spec.Node.Columns, session.ForeignKeys...) - } - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Session{config: sq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, sq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := sq.withLogin; query != nil { - ids := make([]int, 0, len(nodes)) - nodeids := make(map[int][]*Session) - for i := range nodes { - if nodes[i].session_login == nil { - continue - } - fk := *nodes[i].session_login - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(user.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "session_login" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Login = n - } - } - } - - return nodes, nil -} - -func (sq *SessionQuery) sqlCount(ctx context.Context) (int, error) { - _spec := sq.querySpec() - return sqlgraph.CountNodes(ctx, sq.driver, _spec) -} - -func (sq *SessionQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := sq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (sq *SessionQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: session.Table, - Columns: session.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: session.FieldID, - }, - }, - From: sq.sql, - Unique: true, - } - if unique := sq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := sq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, session.FieldID) - for i := range fields { - if fields[i] != session.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := sq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := sq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := sq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := sq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (sq *SessionQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(sq.driver.Dialect()) - t1 := builder.Table(session.Table) - columns := sq.fields - if len(columns) == 0 { - columns = session.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if sq.sql != nil { - selector = sq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range sq.predicates { - p(selector) - } - for _, p := range sq.order { - p(selector) - } - if offset := sq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := sq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// SessionGroupBy is the group-by builder for Session entities. -type SessionGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (sgb *SessionGroupBy) Aggregate(fns ...AggregateFunc) *SessionGroupBy { - sgb.fns = append(sgb.fns, fns...) - return sgb -} - -// Scan applies the group-by query and scans the result into the given value. -func (sgb *SessionGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := sgb.path(ctx) - if err != nil { - return err - } - sgb.sql = query - return sgb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (sgb *SessionGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := sgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SessionGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SessionGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (sgb *SessionGroupBy) StringsX(ctx context.Context) []string { - v, err := sgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SessionGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = sgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{session.Label} - default: - err = fmt.Errorf("ent: SessionGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (sgb *SessionGroupBy) StringX(ctx context.Context) string { - v, err := sgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SessionGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SessionGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (sgb *SessionGroupBy) IntsX(ctx context.Context) []int { - v, err := sgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SessionGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = sgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{session.Label} - default: - err = fmt.Errorf("ent: SessionGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (sgb *SessionGroupBy) IntX(ctx context.Context) int { - v, err := sgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SessionGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SessionGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (sgb *SessionGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := sgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SessionGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = sgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{session.Label} - default: - err = fmt.Errorf("ent: SessionGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (sgb *SessionGroupBy) Float64X(ctx context.Context) float64 { - v, err := sgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SessionGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SessionGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (sgb *SessionGroupBy) BoolsX(ctx context.Context) []bool { - v, err := sgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SessionGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = sgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{session.Label} - default: - err = fmt.Errorf("ent: SessionGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (sgb *SessionGroupBy) BoolX(ctx context.Context) bool { - v, err := sgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (sgb *SessionGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range sgb.fields { - if !session.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := sgb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := sgb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (sgb *SessionGroupBy) sqlQuery() *sql.Selector { - selector := sgb.sql.Select() - aggregation := make([]string, 0, len(sgb.fns)) - for _, fn := range sgb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(sgb.fields)+len(sgb.fns)) - for _, f := range sgb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(sgb.fields...)...) -} - -// SessionSelect is the builder for selecting fields of Session entities. -type SessionSelect struct { - *SessionQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (ss *SessionSelect) Scan(ctx context.Context, v interface{}) error { - if err := ss.prepareQuery(ctx); err != nil { - return err - } - ss.sql = ss.SessionQuery.sqlQuery(ctx) - return ss.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (ss *SessionSelect) ScanX(ctx context.Context, v interface{}) { - if err := ss.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ss *SessionSelect) Strings(ctx context.Context) ([]string, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SessionSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ss *SessionSelect) StringsX(ctx context.Context) []string { - v, err := ss.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ss *SessionSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ss.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{session.Label} - default: - err = fmt.Errorf("ent: SessionSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ss *SessionSelect) StringX(ctx context.Context) string { - v, err := ss.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ss *SessionSelect) Ints(ctx context.Context) ([]int, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SessionSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ss *SessionSelect) IntsX(ctx context.Context) []int { - v, err := ss.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ss *SessionSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ss.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{session.Label} - default: - err = fmt.Errorf("ent: SessionSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ss *SessionSelect) IntX(ctx context.Context) int { - v, err := ss.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ss *SessionSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SessionSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ss *SessionSelect) Float64sX(ctx context.Context) []float64 { - v, err := ss.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ss *SessionSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ss.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{session.Label} - default: - err = fmt.Errorf("ent: SessionSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ss *SessionSelect) Float64X(ctx context.Context) float64 { - v, err := ss.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ss *SessionSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SessionSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ss *SessionSelect) BoolsX(ctx context.Context) []bool { - v, err := ss.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ss *SessionSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ss.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{session.Label} - default: - err = fmt.Errorf("ent: SessionSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ss *SessionSelect) BoolX(ctx context.Context) bool { - v, err := ss.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (ss *SessionSelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := ss.sql.Query() - if err := ss.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/session_update.go b/pkg/infra/ent/session_update.go deleted file mode 100644 index 7944d15..0000000 --- a/pkg/infra/ent/session_update.go +++ /dev/null @@ -1,413 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/session" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" -) - -// SessionUpdate is the builder for updating Session entities. -type SessionUpdate struct { - config - hooks []Hook - mutation *SessionMutation -} - -// Where appends a list predicates to the SessionUpdate builder. -func (su *SessionUpdate) Where(ps ...predicate.Session) *SessionUpdate { - su.mutation.Where(ps...) - return su -} - -// SetUserID sets the "user_id" field. -func (su *SessionUpdate) SetUserID(i int) *SessionUpdate { - su.mutation.ResetUserID() - su.mutation.SetUserID(i) - return su -} - -// AddUserID adds i to the "user_id" field. -func (su *SessionUpdate) AddUserID(i int) *SessionUpdate { - su.mutation.AddUserID(i) - return su -} - -// SetLoginID sets the "login" edge to the User entity by ID. -func (su *SessionUpdate) SetLoginID(id int) *SessionUpdate { - su.mutation.SetLoginID(id) - return su -} - -// SetNillableLoginID sets the "login" edge to the User entity by ID if the given value is not nil. -func (su *SessionUpdate) SetNillableLoginID(id *int) *SessionUpdate { - if id != nil { - su = su.SetLoginID(*id) - } - return su -} - -// SetLogin sets the "login" edge to the User entity. -func (su *SessionUpdate) SetLogin(u *User) *SessionUpdate { - return su.SetLoginID(u.ID) -} - -// Mutation returns the SessionMutation object of the builder. -func (su *SessionUpdate) Mutation() *SessionMutation { - return su.mutation -} - -// ClearLogin clears the "login" edge to the User entity. -func (su *SessionUpdate) ClearLogin() *SessionUpdate { - su.mutation.ClearLogin() - return su -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (su *SessionUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(su.hooks) == 0 { - affected, err = su.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SessionMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - su.mutation = mutation - affected, err = su.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(su.hooks) - 1; i >= 0; i-- { - if su.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = su.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, su.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (su *SessionUpdate) SaveX(ctx context.Context) int { - affected, err := su.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (su *SessionUpdate) Exec(ctx context.Context) error { - _, err := su.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (su *SessionUpdate) ExecX(ctx context.Context) { - if err := su.Exec(ctx); err != nil { - panic(err) - } -} - -func (su *SessionUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: session.Table, - Columns: session.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: session.FieldID, - }, - }, - } - if ps := su.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := su.mutation.UserID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Value: value, - Column: session.FieldUserID, - }) - } - if value, ok := su.mutation.AddedUserID(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Value: value, - Column: session.FieldUserID, - }) - } - if su.mutation.LoginCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: session.LoginTable, - Columns: []string{session.LoginColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := su.mutation.LoginIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: session.LoginTable, - Columns: []string{session.LoginColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, su.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{session.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// SessionUpdateOne is the builder for updating a single Session entity. -type SessionUpdateOne struct { - config - fields []string - hooks []Hook - mutation *SessionMutation -} - -// SetUserID sets the "user_id" field. -func (suo *SessionUpdateOne) SetUserID(i int) *SessionUpdateOne { - suo.mutation.ResetUserID() - suo.mutation.SetUserID(i) - return suo -} - -// AddUserID adds i to the "user_id" field. -func (suo *SessionUpdateOne) AddUserID(i int) *SessionUpdateOne { - suo.mutation.AddUserID(i) - return suo -} - -// SetLoginID sets the "login" edge to the User entity by ID. -func (suo *SessionUpdateOne) SetLoginID(id int) *SessionUpdateOne { - suo.mutation.SetLoginID(id) - return suo -} - -// SetNillableLoginID sets the "login" edge to the User entity by ID if the given value is not nil. -func (suo *SessionUpdateOne) SetNillableLoginID(id *int) *SessionUpdateOne { - if id != nil { - suo = suo.SetLoginID(*id) - } - return suo -} - -// SetLogin sets the "login" edge to the User entity. -func (suo *SessionUpdateOne) SetLogin(u *User) *SessionUpdateOne { - return suo.SetLoginID(u.ID) -} - -// Mutation returns the SessionMutation object of the builder. -func (suo *SessionUpdateOne) Mutation() *SessionMutation { - return suo.mutation -} - -// ClearLogin clears the "login" edge to the User entity. -func (suo *SessionUpdateOne) ClearLogin() *SessionUpdateOne { - suo.mutation.ClearLogin() - return suo -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (suo *SessionUpdateOne) Select(field string, fields ...string) *SessionUpdateOne { - suo.fields = append([]string{field}, fields...) - return suo -} - -// Save executes the query and returns the updated Session entity. -func (suo *SessionUpdateOne) Save(ctx context.Context) (*Session, error) { - var ( - err error - node *Session - ) - if len(suo.hooks) == 0 { - node, err = suo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SessionMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - suo.mutation = mutation - node, err = suo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(suo.hooks) - 1; i >= 0; i-- { - if suo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = suo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, suo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (suo *SessionUpdateOne) SaveX(ctx context.Context) *Session { - node, err := suo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (suo *SessionUpdateOne) Exec(ctx context.Context) error { - _, err := suo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (suo *SessionUpdateOne) ExecX(ctx context.Context) { - if err := suo.Exec(ctx); err != nil { - panic(err) - } -} - -func (suo *SessionUpdateOne) sqlSave(ctx context.Context) (_node *Session, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: session.Table, - Columns: session.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: session.FieldID, - }, - }, - } - id, ok := suo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Session.ID for update")} - } - _spec.Node.ID.Value = id - if fields := suo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, session.FieldID) - for _, f := range fields { - if !session.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != session.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := suo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := suo.mutation.UserID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Value: value, - Column: session.FieldUserID, - }) - } - if value, ok := suo.mutation.AddedUserID(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Value: value, - Column: session.FieldUserID, - }) - } - if suo.mutation.LoginCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: session.LoginTable, - Columns: []string{session.LoginColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := suo.mutation.LoginIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: session.LoginTable, - Columns: []string{session.LoginColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &Session{config: suo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, suo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{session.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/severity.go b/pkg/infra/ent/severity.go deleted file mode 100644 index b5db6eb..0000000 --- a/pkg/infra/ent/severity.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" -) - -// Severity is the model entity for the Severity schema. -type Severity struct { - config `json:"-"` - // ID of the ent. - ID int `json:"id,omitempty"` - // Label holds the value of the "label" field. - Label string `json:"label,omitempty"` - // Color holds the value of the "color" field. - Color string `json:"color,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the SeverityQuery when eager-loading is set. - Edges SeverityEdges `json:"edges"` -} - -// SeverityEdges holds the relations/edges for other nodes in the graph. -type SeverityEdges struct { - // Vulnerabilities holds the value of the vulnerabilities edge. - Vulnerabilities []*Vulnerability `json:"vulnerabilities,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [1]bool -} - -// VulnerabilitiesOrErr returns the Vulnerabilities value or an error if the edge -// was not loaded in eager-loading. -func (e SeverityEdges) VulnerabilitiesOrErr() ([]*Vulnerability, error) { - if e.loadedTypes[0] { - return e.Vulnerabilities, nil - } - return nil, &NotLoadedError{edge: "vulnerabilities"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*Severity) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case severity.FieldID: - values[i] = new(sql.NullInt64) - case severity.FieldLabel, severity.FieldColor: - values[i] = new(sql.NullString) - default: - return nil, fmt.Errorf("unexpected column %q for type Severity", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the Severity fields. -func (s *Severity) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case severity.FieldID: - value, ok := values[i].(*sql.NullInt64) - if !ok { - return fmt.Errorf("unexpected type %T for field id", value) - } - s.ID = int(value.Int64) - case severity.FieldLabel: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field label", values[i]) - } else if value.Valid { - s.Label = value.String - } - case severity.FieldColor: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field color", values[i]) - } else if value.Valid { - s.Color = value.String - } - } - } - return nil -} - -// QueryVulnerabilities queries the "vulnerabilities" edge of the Severity entity. -func (s *Severity) QueryVulnerabilities() *VulnerabilityQuery { - return (&SeverityClient{config: s.config}).QueryVulnerabilities(s) -} - -// Update returns a builder for updating this Severity. -// Note that you need to call Severity.Unwrap() before calling this method if this Severity -// was returned from a transaction, and the transaction was committed or rolled back. -func (s *Severity) Update() *SeverityUpdateOne { - return (&SeverityClient{config: s.config}).UpdateOne(s) -} - -// Unwrap unwraps the Severity entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (s *Severity) Unwrap() *Severity { - tx, ok := s.config.driver.(*txDriver) - if !ok { - panic("ent: Severity is not a transactional entity") - } - s.config.driver = tx.drv - return s -} - -// String implements the fmt.Stringer. -func (s *Severity) String() string { - var builder strings.Builder - builder.WriteString("Severity(") - builder.WriteString(fmt.Sprintf("id=%v", s.ID)) - builder.WriteString(", label=") - builder.WriteString(s.Label) - builder.WriteString(", color=") - builder.WriteString(s.Color) - builder.WriteByte(')') - return builder.String() -} - -// Severities is a parsable slice of Severity. -type Severities []*Severity - -func (s Severities) config(cfg config) { - for _i := range s { - s[_i].config = cfg - } -} diff --git a/pkg/infra/ent/severity/severity.go b/pkg/infra/ent/severity/severity.go deleted file mode 100644 index 01780f4..0000000 --- a/pkg/infra/ent/severity/severity.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package severity - -const ( - // Label holds the string label denoting the severity type in the database. - Label = "severity" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldLabel holds the string denoting the label field in the database. - FieldLabel = "label" - // FieldColor holds the string denoting the color field in the database. - FieldColor = "color" - // EdgeVulnerabilities holds the string denoting the vulnerabilities edge name in mutations. - EdgeVulnerabilities = "vulnerabilities" - // Table holds the table name of the severity in the database. - Table = "severities" - // VulnerabilitiesTable is the table that holds the vulnerabilities relation/edge. - VulnerabilitiesTable = "vulnerabilities" - // VulnerabilitiesInverseTable is the table name for the Vulnerability entity. - // It exists in this package in order to avoid circular dependency with the "vulnerability" package. - VulnerabilitiesInverseTable = "vulnerabilities" - // VulnerabilitiesColumn is the table column denoting the vulnerabilities relation/edge. - VulnerabilitiesColumn = "vulnerability_custom_severity" -) - -// Columns holds all SQL columns for severity fields. -var Columns = []string{ - FieldID, - FieldLabel, - FieldColor, -} - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - return false -} - -var ( - // LabelValidator is a validator for the "label" field. It is called by the builders before save. - LabelValidator func(string) error -) diff --git a/pkg/infra/ent/severity/where.go b/pkg/infra/ent/severity/where.go deleted file mode 100644 index 236b764..0000000 --- a/pkg/infra/ent/severity/where.go +++ /dev/null @@ -1,395 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package severity - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id int) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id int) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id int) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...int) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...int) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id int) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id int) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id int) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id int) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// Color applies equality check predicate on the "color" field. It's identical to ColorEQ. -func Color(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldColor), v)) - }) -} - -// LabelEQ applies the EQ predicate on the "label" field. -func LabelEQ(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldLabel), v)) - }) -} - -// LabelNEQ applies the NEQ predicate on the "label" field. -func LabelNEQ(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldLabel), v)) - }) -} - -// LabelIn applies the In predicate on the "label" field. -func LabelIn(vs ...string) predicate.Severity { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Severity(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldLabel), v...)) - }) -} - -// LabelNotIn applies the NotIn predicate on the "label" field. -func LabelNotIn(vs ...string) predicate.Severity { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Severity(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldLabel), v...)) - }) -} - -// LabelGT applies the GT predicate on the "label" field. -func LabelGT(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldLabel), v)) - }) -} - -// LabelGTE applies the GTE predicate on the "label" field. -func LabelGTE(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldLabel), v)) - }) -} - -// LabelLT applies the LT predicate on the "label" field. -func LabelLT(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldLabel), v)) - }) -} - -// LabelLTE applies the LTE predicate on the "label" field. -func LabelLTE(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldLabel), v)) - }) -} - -// LabelContains applies the Contains predicate on the "label" field. -func LabelContains(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldLabel), v)) - }) -} - -// LabelHasPrefix applies the HasPrefix predicate on the "label" field. -func LabelHasPrefix(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldLabel), v)) - }) -} - -// LabelHasSuffix applies the HasSuffix predicate on the "label" field. -func LabelHasSuffix(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldLabel), v)) - }) -} - -// LabelEqualFold applies the EqualFold predicate on the "label" field. -func LabelEqualFold(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldLabel), v)) - }) -} - -// LabelContainsFold applies the ContainsFold predicate on the "label" field. -func LabelContainsFold(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldLabel), v)) - }) -} - -// ColorEQ applies the EQ predicate on the "color" field. -func ColorEQ(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldColor), v)) - }) -} - -// ColorNEQ applies the NEQ predicate on the "color" field. -func ColorNEQ(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldColor), v)) - }) -} - -// ColorIn applies the In predicate on the "color" field. -func ColorIn(vs ...string) predicate.Severity { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Severity(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldColor), v...)) - }) -} - -// ColorNotIn applies the NotIn predicate on the "color" field. -func ColorNotIn(vs ...string) predicate.Severity { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Severity(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldColor), v...)) - }) -} - -// ColorGT applies the GT predicate on the "color" field. -func ColorGT(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldColor), v)) - }) -} - -// ColorGTE applies the GTE predicate on the "color" field. -func ColorGTE(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldColor), v)) - }) -} - -// ColorLT applies the LT predicate on the "color" field. -func ColorLT(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldColor), v)) - }) -} - -// ColorLTE applies the LTE predicate on the "color" field. -func ColorLTE(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldColor), v)) - }) -} - -// ColorContains applies the Contains predicate on the "color" field. -func ColorContains(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldColor), v)) - }) -} - -// ColorHasPrefix applies the HasPrefix predicate on the "color" field. -func ColorHasPrefix(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldColor), v)) - }) -} - -// ColorHasSuffix applies the HasSuffix predicate on the "color" field. -func ColorHasSuffix(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldColor), v)) - }) -} - -// ColorIsNil applies the IsNil predicate on the "color" field. -func ColorIsNil() predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldColor))) - }) -} - -// ColorNotNil applies the NotNil predicate on the "color" field. -func ColorNotNil() predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldColor))) - }) -} - -// ColorEqualFold applies the EqualFold predicate on the "color" field. -func ColorEqualFold(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldColor), v)) - }) -} - -// ColorContainsFold applies the ContainsFold predicate on the "color" field. -func ColorContainsFold(v string) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldColor), v)) - }) -} - -// HasVulnerabilities applies the HasEdge predicate on the "vulnerabilities" edge. -func HasVulnerabilities() predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(VulnerabilitiesTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, true, VulnerabilitiesTable, VulnerabilitiesColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasVulnerabilitiesWith applies the HasEdge predicate on the "vulnerabilities" edge with a given conditions (other predicates). -func HasVulnerabilitiesWith(preds ...predicate.Vulnerability) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(VulnerabilitiesInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, true, VulnerabilitiesTable, VulnerabilitiesColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.Severity) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.Severity) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.Severity) predicate.Severity { - return predicate.Severity(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/severity_create.go b/pkg/infra/ent/severity_create.go deleted file mode 100644 index fbaab6f..0000000 --- a/pkg/infra/ent/severity_create.go +++ /dev/null @@ -1,618 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// SeverityCreate is the builder for creating a Severity entity. -type SeverityCreate struct { - config - mutation *SeverityMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetLabel sets the "label" field. -func (sc *SeverityCreate) SetLabel(s string) *SeverityCreate { - sc.mutation.SetLabel(s) - return sc -} - -// SetColor sets the "color" field. -func (sc *SeverityCreate) SetColor(s string) *SeverityCreate { - sc.mutation.SetColor(s) - return sc -} - -// SetNillableColor sets the "color" field if the given value is not nil. -func (sc *SeverityCreate) SetNillableColor(s *string) *SeverityCreate { - if s != nil { - sc.SetColor(*s) - } - return sc -} - -// AddVulnerabilityIDs adds the "vulnerabilities" edge to the Vulnerability entity by IDs. -func (sc *SeverityCreate) AddVulnerabilityIDs(ids ...string) *SeverityCreate { - sc.mutation.AddVulnerabilityIDs(ids...) - return sc -} - -// AddVulnerabilities adds the "vulnerabilities" edges to the Vulnerability entity. -func (sc *SeverityCreate) AddVulnerabilities(v ...*Vulnerability) *SeverityCreate { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return sc.AddVulnerabilityIDs(ids...) -} - -// Mutation returns the SeverityMutation object of the builder. -func (sc *SeverityCreate) Mutation() *SeverityMutation { - return sc.mutation -} - -// Save creates the Severity in the database. -func (sc *SeverityCreate) Save(ctx context.Context) (*Severity, error) { - var ( - err error - node *Severity - ) - if len(sc.hooks) == 0 { - if err = sc.check(); err != nil { - return nil, err - } - node, err = sc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SeverityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = sc.check(); err != nil { - return nil, err - } - sc.mutation = mutation - if node, err = sc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(sc.hooks) - 1; i >= 0; i-- { - if sc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = sc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, sc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (sc *SeverityCreate) SaveX(ctx context.Context) *Severity { - v, err := sc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (sc *SeverityCreate) Exec(ctx context.Context) error { - _, err := sc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (sc *SeverityCreate) ExecX(ctx context.Context) { - if err := sc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (sc *SeverityCreate) check() error { - if _, ok := sc.mutation.Label(); !ok { - return &ValidationError{Name: "label", err: errors.New(`ent: missing required field "label"`)} - } - if v, ok := sc.mutation.Label(); ok { - if err := severity.LabelValidator(v); err != nil { - return &ValidationError{Name: "label", err: fmt.Errorf(`ent: validator failed for field "label": %w`, err)} - } - } - return nil -} - -func (sc *SeverityCreate) sqlSave(ctx context.Context) (*Severity, error) { - _node, _spec := sc.createSpec() - if err := sqlgraph.CreateNode(ctx, sc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - id := _spec.ID.Value.(int64) - _node.ID = int(id) - return _node, nil -} - -func (sc *SeverityCreate) createSpec() (*Severity, *sqlgraph.CreateSpec) { - var ( - _node = &Severity{config: sc.config} - _spec = &sqlgraph.CreateSpec{ - Table: severity.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - } - ) - _spec.OnConflict = sc.conflict - if value, ok := sc.mutation.Label(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: severity.FieldLabel, - }) - _node.Label = value - } - if value, ok := sc.mutation.Color(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: severity.FieldColor, - }) - _node.Color = value - } - if nodes := sc.mutation.VulnerabilitiesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: true, - Table: severity.VulnerabilitiesTable, - Columns: []string{severity.VulnerabilitiesColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Severity.Create(). -// SetLabel(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.SeverityUpsert) { -// SetLabel(v+v). -// }). -// Exec(ctx) -// -func (sc *SeverityCreate) OnConflict(opts ...sql.ConflictOption) *SeverityUpsertOne { - sc.conflict = opts - return &SeverityUpsertOne{ - create: sc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Severity.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (sc *SeverityCreate) OnConflictColumns(columns ...string) *SeverityUpsertOne { - sc.conflict = append(sc.conflict, sql.ConflictColumns(columns...)) - return &SeverityUpsertOne{ - create: sc, - } -} - -type ( - // SeverityUpsertOne is the builder for "upsert"-ing - // one Severity node. - SeverityUpsertOne struct { - create *SeverityCreate - } - - // SeverityUpsert is the "OnConflict" setter. - SeverityUpsert struct { - *sql.UpdateSet - } -) - -// SetLabel sets the "label" field. -func (u *SeverityUpsert) SetLabel(v string) *SeverityUpsert { - u.Set(severity.FieldLabel, v) - return u -} - -// UpdateLabel sets the "label" field to the value that was provided on create. -func (u *SeverityUpsert) UpdateLabel() *SeverityUpsert { - u.SetExcluded(severity.FieldLabel) - return u -} - -// SetColor sets the "color" field. -func (u *SeverityUpsert) SetColor(v string) *SeverityUpsert { - u.Set(severity.FieldColor, v) - return u -} - -// UpdateColor sets the "color" field to the value that was provided on create. -func (u *SeverityUpsert) UpdateColor() *SeverityUpsert { - u.SetExcluded(severity.FieldColor) - return u -} - -// ClearColor clears the value of the "color" field. -func (u *SeverityUpsert) ClearColor() *SeverityUpsert { - u.SetNull(severity.FieldColor) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create. -// Using this option is equivalent to using: -// -// client.Severity.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *SeverityUpsertOne) UpdateNewValues() *SeverityUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Severity.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *SeverityUpsertOne) Ignore() *SeverityUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *SeverityUpsertOne) DoNothing() *SeverityUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the SeverityCreate.OnConflict -// documentation for more info. -func (u *SeverityUpsertOne) Update(set func(*SeverityUpsert)) *SeverityUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&SeverityUpsert{UpdateSet: update}) - })) - return u -} - -// SetLabel sets the "label" field. -func (u *SeverityUpsertOne) SetLabel(v string) *SeverityUpsertOne { - return u.Update(func(s *SeverityUpsert) { - s.SetLabel(v) - }) -} - -// UpdateLabel sets the "label" field to the value that was provided on create. -func (u *SeverityUpsertOne) UpdateLabel() *SeverityUpsertOne { - return u.Update(func(s *SeverityUpsert) { - s.UpdateLabel() - }) -} - -// SetColor sets the "color" field. -func (u *SeverityUpsertOne) SetColor(v string) *SeverityUpsertOne { - return u.Update(func(s *SeverityUpsert) { - s.SetColor(v) - }) -} - -// UpdateColor sets the "color" field to the value that was provided on create. -func (u *SeverityUpsertOne) UpdateColor() *SeverityUpsertOne { - return u.Update(func(s *SeverityUpsert) { - s.UpdateColor() - }) -} - -// ClearColor clears the value of the "color" field. -func (u *SeverityUpsertOne) ClearColor() *SeverityUpsertOne { - return u.Update(func(s *SeverityUpsert) { - s.ClearColor() - }) -} - -// Exec executes the query. -func (u *SeverityUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for SeverityCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *SeverityUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *SeverityUpsertOne) ID(ctx context.Context) (id int, err error) { - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *SeverityUpsertOne) IDX(ctx context.Context) int { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// SeverityCreateBulk is the builder for creating many Severity entities in bulk. -type SeverityCreateBulk struct { - config - builders []*SeverityCreate - conflict []sql.ConflictOption -} - -// Save creates the Severity entities in the database. -func (scb *SeverityCreateBulk) Save(ctx context.Context) ([]*Severity, error) { - specs := make([]*sqlgraph.CreateSpec, len(scb.builders)) - nodes := make([]*Severity, len(scb.builders)) - mutators := make([]Mutator, len(scb.builders)) - for i := range scb.builders { - func(i int, root context.Context) { - builder := scb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SeverityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, scb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = scb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, scb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - if specs[i].ID.Value != nil { - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) - } - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, scb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (scb *SeverityCreateBulk) SaveX(ctx context.Context) []*Severity { - v, err := scb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (scb *SeverityCreateBulk) Exec(ctx context.Context) error { - _, err := scb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (scb *SeverityCreateBulk) ExecX(ctx context.Context) { - if err := scb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Severity.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.SeverityUpsert) { -// SetLabel(v+v). -// }). -// Exec(ctx) -// -func (scb *SeverityCreateBulk) OnConflict(opts ...sql.ConflictOption) *SeverityUpsertBulk { - scb.conflict = opts - return &SeverityUpsertBulk{ - create: scb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Severity.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (scb *SeverityCreateBulk) OnConflictColumns(columns ...string) *SeverityUpsertBulk { - scb.conflict = append(scb.conflict, sql.ConflictColumns(columns...)) - return &SeverityUpsertBulk{ - create: scb, - } -} - -// SeverityUpsertBulk is the builder for "upsert"-ing -// a bulk of Severity nodes. -type SeverityUpsertBulk struct { - create *SeverityCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.Severity.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *SeverityUpsertBulk) UpdateNewValues() *SeverityUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Severity.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *SeverityUpsertBulk) Ignore() *SeverityUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *SeverityUpsertBulk) DoNothing() *SeverityUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the SeverityCreateBulk.OnConflict -// documentation for more info. -func (u *SeverityUpsertBulk) Update(set func(*SeverityUpsert)) *SeverityUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&SeverityUpsert{UpdateSet: update}) - })) - return u -} - -// SetLabel sets the "label" field. -func (u *SeverityUpsertBulk) SetLabel(v string) *SeverityUpsertBulk { - return u.Update(func(s *SeverityUpsert) { - s.SetLabel(v) - }) -} - -// UpdateLabel sets the "label" field to the value that was provided on create. -func (u *SeverityUpsertBulk) UpdateLabel() *SeverityUpsertBulk { - return u.Update(func(s *SeverityUpsert) { - s.UpdateLabel() - }) -} - -// SetColor sets the "color" field. -func (u *SeverityUpsertBulk) SetColor(v string) *SeverityUpsertBulk { - return u.Update(func(s *SeverityUpsert) { - s.SetColor(v) - }) -} - -// UpdateColor sets the "color" field to the value that was provided on create. -func (u *SeverityUpsertBulk) UpdateColor() *SeverityUpsertBulk { - return u.Update(func(s *SeverityUpsert) { - s.UpdateColor() - }) -} - -// ClearColor clears the value of the "color" field. -func (u *SeverityUpsertBulk) ClearColor() *SeverityUpsertBulk { - return u.Update(func(s *SeverityUpsert) { - s.ClearColor() - }) -} - -// Exec executes the query. -func (u *SeverityUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the SeverityCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for SeverityCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *SeverityUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/severity_delete.go b/pkg/infra/ent/severity_delete.go deleted file mode 100644 index ebd0daf..0000000 --- a/pkg/infra/ent/severity_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" -) - -// SeverityDelete is the builder for deleting a Severity entity. -type SeverityDelete struct { - config - hooks []Hook - mutation *SeverityMutation -} - -// Where appends a list predicates to the SeverityDelete builder. -func (sd *SeverityDelete) Where(ps ...predicate.Severity) *SeverityDelete { - sd.mutation.Where(ps...) - return sd -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (sd *SeverityDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(sd.hooks) == 0 { - affected, err = sd.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SeverityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - sd.mutation = mutation - affected, err = sd.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(sd.hooks) - 1; i >= 0; i-- { - if sd.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = sd.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, sd.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (sd *SeverityDelete) ExecX(ctx context.Context) int { - n, err := sd.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (sd *SeverityDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: severity.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - }, - } - if ps := sd.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, sd.driver, _spec) -} - -// SeverityDeleteOne is the builder for deleting a single Severity entity. -type SeverityDeleteOne struct { - sd *SeverityDelete -} - -// Exec executes the deletion query. -func (sdo *SeverityDeleteOne) Exec(ctx context.Context) error { - n, err := sdo.sd.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{severity.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (sdo *SeverityDeleteOne) ExecX(ctx context.Context) { - sdo.sd.ExecX(ctx) -} diff --git a/pkg/infra/ent/severity_query.go b/pkg/infra/ent/severity_query.go deleted file mode 100644 index deedbfe..0000000 --- a/pkg/infra/ent/severity_query.go +++ /dev/null @@ -1,987 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "database/sql/driver" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// SeverityQuery is the builder for querying Severity entities. -type SeverityQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.Severity - // eager-loading edges. - withVulnerabilities *VulnerabilityQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the SeverityQuery builder. -func (sq *SeverityQuery) Where(ps ...predicate.Severity) *SeverityQuery { - sq.predicates = append(sq.predicates, ps...) - return sq -} - -// Limit adds a limit step to the query. -func (sq *SeverityQuery) Limit(limit int) *SeverityQuery { - sq.limit = &limit - return sq -} - -// Offset adds an offset step to the query. -func (sq *SeverityQuery) Offset(offset int) *SeverityQuery { - sq.offset = &offset - return sq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (sq *SeverityQuery) Unique(unique bool) *SeverityQuery { - sq.unique = &unique - return sq -} - -// Order adds an order step to the query. -func (sq *SeverityQuery) Order(o ...OrderFunc) *SeverityQuery { - sq.order = append(sq.order, o...) - return sq -} - -// QueryVulnerabilities chains the current query on the "vulnerabilities" edge. -func (sq *SeverityQuery) QueryVulnerabilities() *VulnerabilityQuery { - query := &VulnerabilityQuery{config: sq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := sq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(severity.Table, severity.FieldID, selector), - sqlgraph.To(vulnerability.Table, vulnerability.FieldID), - sqlgraph.Edge(sqlgraph.O2M, true, severity.VulnerabilitiesTable, severity.VulnerabilitiesColumn), - ) - fromU = sqlgraph.SetNeighbors(sq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first Severity entity from the query. -// Returns a *NotFoundError when no Severity was found. -func (sq *SeverityQuery) First(ctx context.Context) (*Severity, error) { - nodes, err := sq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{severity.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (sq *SeverityQuery) FirstX(ctx context.Context) *Severity { - node, err := sq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first Severity ID from the query. -// Returns a *NotFoundError when no Severity ID was found. -func (sq *SeverityQuery) FirstID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = sq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{severity.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (sq *SeverityQuery) FirstIDX(ctx context.Context) int { - id, err := sq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single Severity entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one Severity entity is not found. -// Returns a *NotFoundError when no Severity entities are found. -func (sq *SeverityQuery) Only(ctx context.Context) (*Severity, error) { - nodes, err := sq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{severity.Label} - default: - return nil, &NotSingularError{severity.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (sq *SeverityQuery) OnlyX(ctx context.Context) *Severity { - node, err := sq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only Severity ID in the query. -// Returns a *NotSingularError when exactly one Severity ID is not found. -// Returns a *NotFoundError when no entities are found. -func (sq *SeverityQuery) OnlyID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = sq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{severity.Label} - default: - err = &NotSingularError{severity.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (sq *SeverityQuery) OnlyIDX(ctx context.Context) int { - id, err := sq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of Severities. -func (sq *SeverityQuery) All(ctx context.Context) ([]*Severity, error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - return sq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (sq *SeverityQuery) AllX(ctx context.Context) []*Severity { - nodes, err := sq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of Severity IDs. -func (sq *SeverityQuery) IDs(ctx context.Context) ([]int, error) { - var ids []int - if err := sq.Select(severity.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (sq *SeverityQuery) IDsX(ctx context.Context) []int { - ids, err := sq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (sq *SeverityQuery) Count(ctx context.Context) (int, error) { - if err := sq.prepareQuery(ctx); err != nil { - return 0, err - } - return sq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (sq *SeverityQuery) CountX(ctx context.Context) int { - count, err := sq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (sq *SeverityQuery) Exist(ctx context.Context) (bool, error) { - if err := sq.prepareQuery(ctx); err != nil { - return false, err - } - return sq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (sq *SeverityQuery) ExistX(ctx context.Context) bool { - exist, err := sq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the SeverityQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (sq *SeverityQuery) Clone() *SeverityQuery { - if sq == nil { - return nil - } - return &SeverityQuery{ - config: sq.config, - limit: sq.limit, - offset: sq.offset, - order: append([]OrderFunc{}, sq.order...), - predicates: append([]predicate.Severity{}, sq.predicates...), - withVulnerabilities: sq.withVulnerabilities.Clone(), - // clone intermediate query. - sql: sq.sql.Clone(), - path: sq.path, - } -} - -// WithVulnerabilities tells the query-builder to eager-load the nodes that are connected to -// the "vulnerabilities" edge. The optional arguments are used to configure the query builder of the edge. -func (sq *SeverityQuery) WithVulnerabilities(opts ...func(*VulnerabilityQuery)) *SeverityQuery { - query := &VulnerabilityQuery{config: sq.config} - for _, opt := range opts { - opt(query) - } - sq.withVulnerabilities = query - return sq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// Label string `json:"label,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.Severity.Query(). -// GroupBy(severity.FieldLabel). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (sq *SeverityQuery) GroupBy(field string, fields ...string) *SeverityGroupBy { - group := &SeverityGroupBy{config: sq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := sq.prepareQuery(ctx); err != nil { - return nil, err - } - return sq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// Label string `json:"label,omitempty"` -// } -// -// client.Severity.Query(). -// Select(severity.FieldLabel). -// Scan(ctx, &v) -// -func (sq *SeverityQuery) Select(fields ...string) *SeveritySelect { - sq.fields = append(sq.fields, fields...) - return &SeveritySelect{SeverityQuery: sq} -} - -func (sq *SeverityQuery) prepareQuery(ctx context.Context) error { - for _, f := range sq.fields { - if !severity.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if sq.path != nil { - prev, err := sq.path(ctx) - if err != nil { - return err - } - sq.sql = prev - } - return nil -} - -func (sq *SeverityQuery) sqlAll(ctx context.Context) ([]*Severity, error) { - var ( - nodes = []*Severity{} - _spec = sq.querySpec() - loadedTypes = [1]bool{ - sq.withVulnerabilities != nil, - } - ) - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Severity{config: sq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, sq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := sq.withVulnerabilities; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[int]*Severity) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.Vulnerabilities = []*Vulnerability{} - } - query.withFKs = true - query.Where(predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.InValues(severity.VulnerabilitiesColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - fk := n.vulnerability_custom_severity - if fk == nil { - return nil, fmt.Errorf(`foreign-key "vulnerability_custom_severity" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "vulnerability_custom_severity" returned %v for node %v`, *fk, n.ID) - } - node.Edges.Vulnerabilities = append(node.Edges.Vulnerabilities, n) - } - } - - return nodes, nil -} - -func (sq *SeverityQuery) sqlCount(ctx context.Context) (int, error) { - _spec := sq.querySpec() - return sqlgraph.CountNodes(ctx, sq.driver, _spec) -} - -func (sq *SeverityQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := sq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (sq *SeverityQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: severity.Table, - Columns: severity.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - }, - From: sq.sql, - Unique: true, - } - if unique := sq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := sq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, severity.FieldID) - for i := range fields { - if fields[i] != severity.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := sq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := sq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := sq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := sq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (sq *SeverityQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(sq.driver.Dialect()) - t1 := builder.Table(severity.Table) - columns := sq.fields - if len(columns) == 0 { - columns = severity.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if sq.sql != nil { - selector = sq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range sq.predicates { - p(selector) - } - for _, p := range sq.order { - p(selector) - } - if offset := sq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := sq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// SeverityGroupBy is the group-by builder for Severity entities. -type SeverityGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (sgb *SeverityGroupBy) Aggregate(fns ...AggregateFunc) *SeverityGroupBy { - sgb.fns = append(sgb.fns, fns...) - return sgb -} - -// Scan applies the group-by query and scans the result into the given value. -func (sgb *SeverityGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := sgb.path(ctx) - if err != nil { - return err - } - sgb.sql = query - return sgb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (sgb *SeverityGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := sgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SeverityGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SeverityGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (sgb *SeverityGroupBy) StringsX(ctx context.Context) []string { - v, err := sgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SeverityGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = sgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{severity.Label} - default: - err = fmt.Errorf("ent: SeverityGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (sgb *SeverityGroupBy) StringX(ctx context.Context) string { - v, err := sgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SeverityGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SeverityGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (sgb *SeverityGroupBy) IntsX(ctx context.Context) []int { - v, err := sgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SeverityGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = sgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{severity.Label} - default: - err = fmt.Errorf("ent: SeverityGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (sgb *SeverityGroupBy) IntX(ctx context.Context) int { - v, err := sgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SeverityGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SeverityGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (sgb *SeverityGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := sgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SeverityGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = sgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{severity.Label} - default: - err = fmt.Errorf("ent: SeverityGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (sgb *SeverityGroupBy) Float64X(ctx context.Context) float64 { - v, err := sgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SeverityGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SeverityGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (sgb *SeverityGroupBy) BoolsX(ctx context.Context) []bool { - v, err := sgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SeverityGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = sgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{severity.Label} - default: - err = fmt.Errorf("ent: SeverityGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (sgb *SeverityGroupBy) BoolX(ctx context.Context) bool { - v, err := sgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (sgb *SeverityGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range sgb.fields { - if !severity.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := sgb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := sgb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (sgb *SeverityGroupBy) sqlQuery() *sql.Selector { - selector := sgb.sql.Select() - aggregation := make([]string, 0, len(sgb.fns)) - for _, fn := range sgb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(sgb.fields)+len(sgb.fns)) - for _, f := range sgb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(sgb.fields...)...) -} - -// SeveritySelect is the builder for selecting fields of Severity entities. -type SeveritySelect struct { - *SeverityQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (ss *SeveritySelect) Scan(ctx context.Context, v interface{}) error { - if err := ss.prepareQuery(ctx); err != nil { - return err - } - ss.sql = ss.SeverityQuery.sqlQuery(ctx) - return ss.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (ss *SeveritySelect) ScanX(ctx context.Context, v interface{}) { - if err := ss.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ss *SeveritySelect) Strings(ctx context.Context) ([]string, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SeveritySelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ss *SeveritySelect) StringsX(ctx context.Context) []string { - v, err := ss.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ss *SeveritySelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ss.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{severity.Label} - default: - err = fmt.Errorf("ent: SeveritySelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ss *SeveritySelect) StringX(ctx context.Context) string { - v, err := ss.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ss *SeveritySelect) Ints(ctx context.Context) ([]int, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SeveritySelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ss *SeveritySelect) IntsX(ctx context.Context) []int { - v, err := ss.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ss *SeveritySelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ss.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{severity.Label} - default: - err = fmt.Errorf("ent: SeveritySelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ss *SeveritySelect) IntX(ctx context.Context) int { - v, err := ss.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ss *SeveritySelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SeveritySelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ss *SeveritySelect) Float64sX(ctx context.Context) []float64 { - v, err := ss.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ss *SeveritySelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ss.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{severity.Label} - default: - err = fmt.Errorf("ent: SeveritySelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ss *SeveritySelect) Float64X(ctx context.Context) float64 { - v, err := ss.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ss *SeveritySelect) Bools(ctx context.Context) ([]bool, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SeveritySelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ss *SeveritySelect) BoolsX(ctx context.Context) []bool { - v, err := ss.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ss *SeveritySelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ss.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{severity.Label} - default: - err = fmt.Errorf("ent: SeveritySelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ss *SeveritySelect) BoolX(ctx context.Context) bool { - v, err := ss.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (ss *SeveritySelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := ss.sql.Query() - if err := ss.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/severity_update.go b/pkg/infra/ent/severity_update.go deleted file mode 100644 index 4a494c3..0000000 --- a/pkg/infra/ent/severity_update.go +++ /dev/null @@ -1,543 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// SeverityUpdate is the builder for updating Severity entities. -type SeverityUpdate struct { - config - hooks []Hook - mutation *SeverityMutation -} - -// Where appends a list predicates to the SeverityUpdate builder. -func (su *SeverityUpdate) Where(ps ...predicate.Severity) *SeverityUpdate { - su.mutation.Where(ps...) - return su -} - -// SetLabel sets the "label" field. -func (su *SeverityUpdate) SetLabel(s string) *SeverityUpdate { - su.mutation.SetLabel(s) - return su -} - -// SetColor sets the "color" field. -func (su *SeverityUpdate) SetColor(s string) *SeverityUpdate { - su.mutation.SetColor(s) - return su -} - -// SetNillableColor sets the "color" field if the given value is not nil. -func (su *SeverityUpdate) SetNillableColor(s *string) *SeverityUpdate { - if s != nil { - su.SetColor(*s) - } - return su -} - -// ClearColor clears the value of the "color" field. -func (su *SeverityUpdate) ClearColor() *SeverityUpdate { - su.mutation.ClearColor() - return su -} - -// AddVulnerabilityIDs adds the "vulnerabilities" edge to the Vulnerability entity by IDs. -func (su *SeverityUpdate) AddVulnerabilityIDs(ids ...string) *SeverityUpdate { - su.mutation.AddVulnerabilityIDs(ids...) - return su -} - -// AddVulnerabilities adds the "vulnerabilities" edges to the Vulnerability entity. -func (su *SeverityUpdate) AddVulnerabilities(v ...*Vulnerability) *SeverityUpdate { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return su.AddVulnerabilityIDs(ids...) -} - -// Mutation returns the SeverityMutation object of the builder. -func (su *SeverityUpdate) Mutation() *SeverityMutation { - return su.mutation -} - -// ClearVulnerabilities clears all "vulnerabilities" edges to the Vulnerability entity. -func (su *SeverityUpdate) ClearVulnerabilities() *SeverityUpdate { - su.mutation.ClearVulnerabilities() - return su -} - -// RemoveVulnerabilityIDs removes the "vulnerabilities" edge to Vulnerability entities by IDs. -func (su *SeverityUpdate) RemoveVulnerabilityIDs(ids ...string) *SeverityUpdate { - su.mutation.RemoveVulnerabilityIDs(ids...) - return su -} - -// RemoveVulnerabilities removes "vulnerabilities" edges to Vulnerability entities. -func (su *SeverityUpdate) RemoveVulnerabilities(v ...*Vulnerability) *SeverityUpdate { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return su.RemoveVulnerabilityIDs(ids...) -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (su *SeverityUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(su.hooks) == 0 { - if err = su.check(); err != nil { - return 0, err - } - affected, err = su.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SeverityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = su.check(); err != nil { - return 0, err - } - su.mutation = mutation - affected, err = su.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(su.hooks) - 1; i >= 0; i-- { - if su.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = su.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, su.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (su *SeverityUpdate) SaveX(ctx context.Context) int { - affected, err := su.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (su *SeverityUpdate) Exec(ctx context.Context) error { - _, err := su.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (su *SeverityUpdate) ExecX(ctx context.Context) { - if err := su.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (su *SeverityUpdate) check() error { - if v, ok := su.mutation.Label(); ok { - if err := severity.LabelValidator(v); err != nil { - return &ValidationError{Name: "label", err: fmt.Errorf("ent: validator failed for field \"label\": %w", err)} - } - } - return nil -} - -func (su *SeverityUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: severity.Table, - Columns: severity.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - }, - } - if ps := su.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := su.mutation.Label(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: severity.FieldLabel, - }) - } - if value, ok := su.mutation.Color(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: severity.FieldColor, - }) - } - if su.mutation.ColorCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: severity.FieldColor, - }) - } - if su.mutation.VulnerabilitiesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: true, - Table: severity.VulnerabilitiesTable, - Columns: []string{severity.VulnerabilitiesColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := su.mutation.RemovedVulnerabilitiesIDs(); len(nodes) > 0 && !su.mutation.VulnerabilitiesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: true, - Table: severity.VulnerabilitiesTable, - Columns: []string{severity.VulnerabilitiesColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := su.mutation.VulnerabilitiesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: true, - Table: severity.VulnerabilitiesTable, - Columns: []string{severity.VulnerabilitiesColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, su.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{severity.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// SeverityUpdateOne is the builder for updating a single Severity entity. -type SeverityUpdateOne struct { - config - fields []string - hooks []Hook - mutation *SeverityMutation -} - -// SetLabel sets the "label" field. -func (suo *SeverityUpdateOne) SetLabel(s string) *SeverityUpdateOne { - suo.mutation.SetLabel(s) - return suo -} - -// SetColor sets the "color" field. -func (suo *SeverityUpdateOne) SetColor(s string) *SeverityUpdateOne { - suo.mutation.SetColor(s) - return suo -} - -// SetNillableColor sets the "color" field if the given value is not nil. -func (suo *SeverityUpdateOne) SetNillableColor(s *string) *SeverityUpdateOne { - if s != nil { - suo.SetColor(*s) - } - return suo -} - -// ClearColor clears the value of the "color" field. -func (suo *SeverityUpdateOne) ClearColor() *SeverityUpdateOne { - suo.mutation.ClearColor() - return suo -} - -// AddVulnerabilityIDs adds the "vulnerabilities" edge to the Vulnerability entity by IDs. -func (suo *SeverityUpdateOne) AddVulnerabilityIDs(ids ...string) *SeverityUpdateOne { - suo.mutation.AddVulnerabilityIDs(ids...) - return suo -} - -// AddVulnerabilities adds the "vulnerabilities" edges to the Vulnerability entity. -func (suo *SeverityUpdateOne) AddVulnerabilities(v ...*Vulnerability) *SeverityUpdateOne { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return suo.AddVulnerabilityIDs(ids...) -} - -// Mutation returns the SeverityMutation object of the builder. -func (suo *SeverityUpdateOne) Mutation() *SeverityMutation { - return suo.mutation -} - -// ClearVulnerabilities clears all "vulnerabilities" edges to the Vulnerability entity. -func (suo *SeverityUpdateOne) ClearVulnerabilities() *SeverityUpdateOne { - suo.mutation.ClearVulnerabilities() - return suo -} - -// RemoveVulnerabilityIDs removes the "vulnerabilities" edge to Vulnerability entities by IDs. -func (suo *SeverityUpdateOne) RemoveVulnerabilityIDs(ids ...string) *SeverityUpdateOne { - suo.mutation.RemoveVulnerabilityIDs(ids...) - return suo -} - -// RemoveVulnerabilities removes "vulnerabilities" edges to Vulnerability entities. -func (suo *SeverityUpdateOne) RemoveVulnerabilities(v ...*Vulnerability) *SeverityUpdateOne { - ids := make([]string, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return suo.RemoveVulnerabilityIDs(ids...) -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (suo *SeverityUpdateOne) Select(field string, fields ...string) *SeverityUpdateOne { - suo.fields = append([]string{field}, fields...) - return suo -} - -// Save executes the query and returns the updated Severity entity. -func (suo *SeverityUpdateOne) Save(ctx context.Context) (*Severity, error) { - var ( - err error - node *Severity - ) - if len(suo.hooks) == 0 { - if err = suo.check(); err != nil { - return nil, err - } - node, err = suo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*SeverityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = suo.check(); err != nil { - return nil, err - } - suo.mutation = mutation - node, err = suo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(suo.hooks) - 1; i >= 0; i-- { - if suo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = suo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, suo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (suo *SeverityUpdateOne) SaveX(ctx context.Context) *Severity { - node, err := suo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (suo *SeverityUpdateOne) Exec(ctx context.Context) error { - _, err := suo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (suo *SeverityUpdateOne) ExecX(ctx context.Context) { - if err := suo.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (suo *SeverityUpdateOne) check() error { - if v, ok := suo.mutation.Label(); ok { - if err := severity.LabelValidator(v); err != nil { - return &ValidationError{Name: "label", err: fmt.Errorf("ent: validator failed for field \"label\": %w", err)} - } - } - return nil -} - -func (suo *SeverityUpdateOne) sqlSave(ctx context.Context) (_node *Severity, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: severity.Table, - Columns: severity.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - }, - } - id, ok := suo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Severity.ID for update")} - } - _spec.Node.ID.Value = id - if fields := suo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, severity.FieldID) - for _, f := range fields { - if !severity.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != severity.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := suo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := suo.mutation.Label(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: severity.FieldLabel, - }) - } - if value, ok := suo.mutation.Color(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: severity.FieldColor, - }) - } - if suo.mutation.ColorCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: severity.FieldColor, - }) - } - if suo.mutation.VulnerabilitiesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: true, - Table: severity.VulnerabilitiesTable, - Columns: []string{severity.VulnerabilitiesColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := suo.mutation.RemovedVulnerabilitiesIDs(); len(nodes) > 0 && !suo.mutation.VulnerabilitiesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: true, - Table: severity.VulnerabilitiesTable, - Columns: []string{severity.VulnerabilitiesColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := suo.mutation.VulnerabilitiesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: true, - Table: severity.VulnerabilitiesTable, - Columns: []string{severity.VulnerabilitiesColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &Severity{config: suo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, suo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{severity.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/tx.go b/pkg/infra/ent/tx.go deleted file mode 100644 index 68302b1..0000000 --- a/pkg/infra/ent/tx.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "sync" - - "entgo.io/ent/dialect" -) - -// Tx is a transactional client that is created by calling Client.Tx(). -type Tx struct { - config - // AuthStateCache is the client for interacting with the AuthStateCache builders. - AuthStateCache *AuthStateCacheClient - // PackageRecord is the client for interacting with the PackageRecord builders. - PackageRecord *PackageRecordClient - // RepoLabel is the client for interacting with the RepoLabel builders. - RepoLabel *RepoLabelClient - // Repository is the client for interacting with the Repository builders. - Repository *RepositoryClient - // Scan is the client for interacting with the Scan builders. - Scan *ScanClient - // Session is the client for interacting with the Session builders. - Session *SessionClient - // Severity is the client for interacting with the Severity builders. - Severity *SeverityClient - // User is the client for interacting with the User builders. - User *UserClient - // VulnStatus is the client for interacting with the VulnStatus builders. - VulnStatus *VulnStatusClient - // VulnStatusIndex is the client for interacting with the VulnStatusIndex builders. - VulnStatusIndex *VulnStatusIndexClient - // Vulnerability is the client for interacting with the Vulnerability builders. - Vulnerability *VulnerabilityClient - - // lazily loaded. - client *Client - clientOnce sync.Once - - // completion callbacks. - mu sync.Mutex - onCommit []CommitHook - onRollback []RollbackHook - - // ctx lives for the life of the transaction. It is - // the same context used by the underlying connection. - ctx context.Context -} - -type ( - // Committer is the interface that wraps the Committer method. - Committer interface { - Commit(context.Context, *Tx) error - } - - // The CommitFunc type is an adapter to allow the use of ordinary - // function as a Committer. If f is a function with the appropriate - // signature, CommitFunc(f) is a Committer that calls f. - CommitFunc func(context.Context, *Tx) error - - // CommitHook defines the "commit middleware". A function that gets a Committer - // and returns a Committer. For example: - // - // hook := func(next ent.Committer) ent.Committer { - // return ent.CommitFunc(func(context.Context, tx *ent.Tx) error { - // // Do some stuff before. - // if err := next.Commit(ctx, tx); err != nil { - // return err - // } - // // Do some stuff after. - // return nil - // }) - // } - // - CommitHook func(Committer) Committer -) - -// Commit calls f(ctx, m). -func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error { - return f(ctx, tx) -} - -// Commit commits the transaction. -func (tx *Tx) Commit() error { - txDriver := tx.config.driver.(*txDriver) - var fn Committer = CommitFunc(func(context.Context, *Tx) error { - return txDriver.tx.Commit() - }) - tx.mu.Lock() - hooks := append([]CommitHook(nil), tx.onCommit...) - tx.mu.Unlock() - for i := len(hooks) - 1; i >= 0; i-- { - fn = hooks[i](fn) - } - return fn.Commit(tx.ctx, tx) -} - -// OnCommit adds a hook to call on commit. -func (tx *Tx) OnCommit(f CommitHook) { - tx.mu.Lock() - defer tx.mu.Unlock() - tx.onCommit = append(tx.onCommit, f) -} - -type ( - // Rollbacker is the interface that wraps the Rollbacker method. - Rollbacker interface { - Rollback(context.Context, *Tx) error - } - - // The RollbackFunc type is an adapter to allow the use of ordinary - // function as a Rollbacker. If f is a function with the appropriate - // signature, RollbackFunc(f) is a Rollbacker that calls f. - RollbackFunc func(context.Context, *Tx) error - - // RollbackHook defines the "rollback middleware". A function that gets a Rollbacker - // and returns a Rollbacker. For example: - // - // hook := func(next ent.Rollbacker) ent.Rollbacker { - // return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error { - // // Do some stuff before. - // if err := next.Rollback(ctx, tx); err != nil { - // return err - // } - // // Do some stuff after. - // return nil - // }) - // } - // - RollbackHook func(Rollbacker) Rollbacker -) - -// Rollback calls f(ctx, m). -func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error { - return f(ctx, tx) -} - -// Rollback rollbacks the transaction. -func (tx *Tx) Rollback() error { - txDriver := tx.config.driver.(*txDriver) - var fn Rollbacker = RollbackFunc(func(context.Context, *Tx) error { - return txDriver.tx.Rollback() - }) - tx.mu.Lock() - hooks := append([]RollbackHook(nil), tx.onRollback...) - tx.mu.Unlock() - for i := len(hooks) - 1; i >= 0; i-- { - fn = hooks[i](fn) - } - return fn.Rollback(tx.ctx, tx) -} - -// OnRollback adds a hook to call on rollback. -func (tx *Tx) OnRollback(f RollbackHook) { - tx.mu.Lock() - defer tx.mu.Unlock() - tx.onRollback = append(tx.onRollback, f) -} - -// Client returns a Client that binds to current transaction. -func (tx *Tx) Client() *Client { - tx.clientOnce.Do(func() { - tx.client = &Client{config: tx.config} - tx.client.init() - }) - return tx.client -} - -func (tx *Tx) init() { - tx.AuthStateCache = NewAuthStateCacheClient(tx.config) - tx.PackageRecord = NewPackageRecordClient(tx.config) - tx.RepoLabel = NewRepoLabelClient(tx.config) - tx.Repository = NewRepositoryClient(tx.config) - tx.Scan = NewScanClient(tx.config) - tx.Session = NewSessionClient(tx.config) - tx.Severity = NewSeverityClient(tx.config) - tx.User = NewUserClient(tx.config) - tx.VulnStatus = NewVulnStatusClient(tx.config) - tx.VulnStatusIndex = NewVulnStatusIndexClient(tx.config) - tx.Vulnerability = NewVulnerabilityClient(tx.config) -} - -// txDriver wraps the given dialect.Tx with a nop dialect.Driver implementation. -// The idea is to support transactions without adding any extra code to the builders. -// When a builder calls to driver.Tx(), it gets the same dialect.Tx instance. -// Commit and Rollback are nop for the internal builders and the user must call one -// of them in order to commit or rollback the transaction. -// -// If a closed transaction is embedded in one of the generated entities, and the entity -// applies a query, for example: AuthStateCache.QueryXXX(), the query will be executed -// through the driver which created this transaction. -// -// Note that txDriver is not goroutine safe. -type txDriver struct { - // the driver we started the transaction from. - drv dialect.Driver - // tx is the underlying transaction. - tx dialect.Tx -} - -// newTx creates a new transactional driver. -func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) { - tx, err := drv.Tx(ctx) - if err != nil { - return nil, err - } - return &txDriver{tx: tx, drv: drv}, nil -} - -// Tx returns the transaction wrapper (txDriver) to avoid Commit or Rollback calls -// from the internal builders. Should be called only by the internal builders. -func (tx *txDriver) Tx(context.Context) (dialect.Tx, error) { return tx, nil } - -// Dialect returns the dialect of the driver we started the transaction from. -func (tx *txDriver) Dialect() string { return tx.drv.Dialect() } - -// Close is a nop close. -func (*txDriver) Close() error { return nil } - -// Commit is a nop commit for the internal builders. -// User must call `Tx.Commit` in order to commit the transaction. -func (*txDriver) Commit() error { return nil } - -// Rollback is a nop rollback for the internal builders. -// User must call `Tx.Rollback` in order to rollback the transaction. -func (*txDriver) Rollback() error { return nil } - -// Exec calls tx.Exec. -func (tx *txDriver) Exec(ctx context.Context, query string, args, v interface{}) error { - return tx.tx.Exec(ctx, query, args, v) -} - -// Query calls tx.Query. -func (tx *txDriver) Query(ctx context.Context, query string, args, v interface{}) error { - return tx.tx.Query(ctx, query, args, v) -} - -var _ dialect.Driver = (*txDriver)(nil) diff --git a/pkg/infra/ent/user.go b/pkg/infra/ent/user.go deleted file mode 100644 index c19e6e6..0000000 --- a/pkg/infra/ent/user.go +++ /dev/null @@ -1,165 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" -) - -// User is the model entity for the User schema. -type User struct { - config `json:"-"` - // ID of the ent. - ID int `json:"id,omitempty"` - // GithubID holds the value of the "github_id" field. - GithubID int64 `json:"github_id,omitempty"` - // Login holds the value of the "login" field. - Login string `json:"login,omitempty"` - // Name holds the value of the "name" field. - Name string `json:"name,omitempty"` - // AvatarURL holds the value of the "avatar_url" field. - AvatarURL string `json:"avatar_url,omitempty"` - // URL holds the value of the "url" field. - URL string `json:"url,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the UserQuery when eager-loading is set. - Edges UserEdges `json:"edges"` -} - -// UserEdges holds the relations/edges for other nodes in the graph. -type UserEdges struct { - // EditedStatus holds the value of the edited_status edge. - EditedStatus []*VulnStatus `json:"edited_status,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [1]bool -} - -// EditedStatusOrErr returns the EditedStatus value or an error if the edge -// was not loaded in eager-loading. -func (e UserEdges) EditedStatusOrErr() ([]*VulnStatus, error) { - if e.loadedTypes[0] { - return e.EditedStatus, nil - } - return nil, &NotLoadedError{edge: "edited_status"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*User) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case user.FieldID, user.FieldGithubID: - values[i] = new(sql.NullInt64) - case user.FieldLogin, user.FieldName, user.FieldAvatarURL, user.FieldURL: - values[i] = new(sql.NullString) - default: - return nil, fmt.Errorf("unexpected column %q for type User", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the User fields. -func (u *User) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case user.FieldID: - value, ok := values[i].(*sql.NullInt64) - if !ok { - return fmt.Errorf("unexpected type %T for field id", value) - } - u.ID = int(value.Int64) - case user.FieldGithubID: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field github_id", values[i]) - } else if value.Valid { - u.GithubID = value.Int64 - } - case user.FieldLogin: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field login", values[i]) - } else if value.Valid { - u.Login = value.String - } - case user.FieldName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field name", values[i]) - } else if value.Valid { - u.Name = value.String - } - case user.FieldAvatarURL: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field avatar_url", values[i]) - } else if value.Valid { - u.AvatarURL = value.String - } - case user.FieldURL: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field url", values[i]) - } else if value.Valid { - u.URL = value.String - } - } - } - return nil -} - -// QueryEditedStatus queries the "edited_status" edge of the User entity. -func (u *User) QueryEditedStatus() *VulnStatusQuery { - return (&UserClient{config: u.config}).QueryEditedStatus(u) -} - -// Update returns a builder for updating this User. -// Note that you need to call User.Unwrap() before calling this method if this User -// was returned from a transaction, and the transaction was committed or rolled back. -func (u *User) Update() *UserUpdateOne { - return (&UserClient{config: u.config}).UpdateOne(u) -} - -// Unwrap unwraps the User entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (u *User) Unwrap() *User { - tx, ok := u.config.driver.(*txDriver) - if !ok { - panic("ent: User is not a transactional entity") - } - u.config.driver = tx.drv - return u -} - -// String implements the fmt.Stringer. -func (u *User) String() string { - var builder strings.Builder - builder.WriteString("User(") - builder.WriteString(fmt.Sprintf("id=%v", u.ID)) - builder.WriteString(", github_id=") - builder.WriteString(fmt.Sprintf("%v", u.GithubID)) - builder.WriteString(", login=") - builder.WriteString(u.Login) - builder.WriteString(", name=") - builder.WriteString(u.Name) - builder.WriteString(", avatar_url=") - builder.WriteString(u.AvatarURL) - builder.WriteString(", url=") - builder.WriteString(u.URL) - builder.WriteByte(')') - return builder.String() -} - -// Users is a parsable slice of User. -type Users []*User - -func (u Users) config(cfg config) { - for _i := range u { - u[_i].config = cfg - } -} diff --git a/pkg/infra/ent/user/user.go b/pkg/infra/ent/user/user.go deleted file mode 100644 index 10c7798..0000000 --- a/pkg/infra/ent/user/user.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package user - -const ( - // Label holds the string label denoting the user type in the database. - Label = "user" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldGithubID holds the string denoting the github_id field in the database. - FieldGithubID = "github_id" - // FieldLogin holds the string denoting the login field in the database. - FieldLogin = "login" - // FieldName holds the string denoting the name field in the database. - FieldName = "name" - // FieldAvatarURL holds the string denoting the avatar_url field in the database. - FieldAvatarURL = "avatar_url" - // FieldURL holds the string denoting the url field in the database. - FieldURL = "url" - // EdgeEditedStatus holds the string denoting the edited_status edge name in mutations. - EdgeEditedStatus = "edited_status" - // Table holds the table name of the user in the database. - Table = "users" - // EditedStatusTable is the table that holds the edited_status relation/edge. - EditedStatusTable = "vuln_status" - // EditedStatusInverseTable is the table name for the VulnStatus entity. - // It exists in this package in order to avoid circular dependency with the "vulnstatus" package. - EditedStatusInverseTable = "vuln_status" - // EditedStatusColumn is the table column denoting the edited_status relation/edge. - EditedStatusColumn = "user_edited_status" -) - -// Columns holds all SQL columns for user fields. -var Columns = []string{ - FieldID, - FieldGithubID, - FieldLogin, - FieldName, - FieldAvatarURL, - FieldURL, -} - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - return false -} diff --git a/pkg/infra/ent/user/where.go b/pkg/infra/ent/user/where.go deleted file mode 100644 index 50fba75..0000000 --- a/pkg/infra/ent/user/where.go +++ /dev/null @@ -1,707 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package user - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id int) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id int) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id int) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...int) predicate.User { - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...int) predicate.User { - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id int) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id int) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id int) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id int) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// GithubID applies equality check predicate on the "github_id" field. It's identical to GithubIDEQ. -func GithubID(v int64) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldGithubID), v)) - }) -} - -// Login applies equality check predicate on the "login" field. It's identical to LoginEQ. -func Login(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldLogin), v)) - }) -} - -// Name applies equality check predicate on the "name" field. It's identical to NameEQ. -func Name(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldName), v)) - }) -} - -// AvatarURL applies equality check predicate on the "avatar_url" field. It's identical to AvatarURLEQ. -func AvatarURL(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldAvatarURL), v)) - }) -} - -// URL applies equality check predicate on the "url" field. It's identical to URLEQ. -func URL(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldURL), v)) - }) -} - -// GithubIDEQ applies the EQ predicate on the "github_id" field. -func GithubIDEQ(v int64) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldGithubID), v)) - }) -} - -// GithubIDNEQ applies the NEQ predicate on the "github_id" field. -func GithubIDNEQ(v int64) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldGithubID), v)) - }) -} - -// GithubIDIn applies the In predicate on the "github_id" field. -func GithubIDIn(vs ...int64) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldGithubID), v...)) - }) -} - -// GithubIDNotIn applies the NotIn predicate on the "github_id" field. -func GithubIDNotIn(vs ...int64) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldGithubID), v...)) - }) -} - -// GithubIDGT applies the GT predicate on the "github_id" field. -func GithubIDGT(v int64) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldGithubID), v)) - }) -} - -// GithubIDGTE applies the GTE predicate on the "github_id" field. -func GithubIDGTE(v int64) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldGithubID), v)) - }) -} - -// GithubIDLT applies the LT predicate on the "github_id" field. -func GithubIDLT(v int64) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldGithubID), v)) - }) -} - -// GithubIDLTE applies the LTE predicate on the "github_id" field. -func GithubIDLTE(v int64) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldGithubID), v)) - }) -} - -// LoginEQ applies the EQ predicate on the "login" field. -func LoginEQ(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldLogin), v)) - }) -} - -// LoginNEQ applies the NEQ predicate on the "login" field. -func LoginNEQ(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldLogin), v)) - }) -} - -// LoginIn applies the In predicate on the "login" field. -func LoginIn(vs ...string) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldLogin), v...)) - }) -} - -// LoginNotIn applies the NotIn predicate on the "login" field. -func LoginNotIn(vs ...string) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldLogin), v...)) - }) -} - -// LoginGT applies the GT predicate on the "login" field. -func LoginGT(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldLogin), v)) - }) -} - -// LoginGTE applies the GTE predicate on the "login" field. -func LoginGTE(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldLogin), v)) - }) -} - -// LoginLT applies the LT predicate on the "login" field. -func LoginLT(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldLogin), v)) - }) -} - -// LoginLTE applies the LTE predicate on the "login" field. -func LoginLTE(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldLogin), v)) - }) -} - -// LoginContains applies the Contains predicate on the "login" field. -func LoginContains(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldLogin), v)) - }) -} - -// LoginHasPrefix applies the HasPrefix predicate on the "login" field. -func LoginHasPrefix(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldLogin), v)) - }) -} - -// LoginHasSuffix applies the HasSuffix predicate on the "login" field. -func LoginHasSuffix(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldLogin), v)) - }) -} - -// LoginEqualFold applies the EqualFold predicate on the "login" field. -func LoginEqualFold(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldLogin), v)) - }) -} - -// LoginContainsFold applies the ContainsFold predicate on the "login" field. -func LoginContainsFold(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldLogin), v)) - }) -} - -// NameEQ applies the EQ predicate on the "name" field. -func NameEQ(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldName), v)) - }) -} - -// NameNEQ applies the NEQ predicate on the "name" field. -func NameNEQ(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldName), v)) - }) -} - -// NameIn applies the In predicate on the "name" field. -func NameIn(vs ...string) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldName), v...)) - }) -} - -// NameNotIn applies the NotIn predicate on the "name" field. -func NameNotIn(vs ...string) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldName), v...)) - }) -} - -// NameGT applies the GT predicate on the "name" field. -func NameGT(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldName), v)) - }) -} - -// NameGTE applies the GTE predicate on the "name" field. -func NameGTE(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldName), v)) - }) -} - -// NameLT applies the LT predicate on the "name" field. -func NameLT(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldName), v)) - }) -} - -// NameLTE applies the LTE predicate on the "name" field. -func NameLTE(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldName), v)) - }) -} - -// NameContains applies the Contains predicate on the "name" field. -func NameContains(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldName), v)) - }) -} - -// NameHasPrefix applies the HasPrefix predicate on the "name" field. -func NameHasPrefix(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldName), v)) - }) -} - -// NameHasSuffix applies the HasSuffix predicate on the "name" field. -func NameHasSuffix(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldName), v)) - }) -} - -// NameEqualFold applies the EqualFold predicate on the "name" field. -func NameEqualFold(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldName), v)) - }) -} - -// NameContainsFold applies the ContainsFold predicate on the "name" field. -func NameContainsFold(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldName), v)) - }) -} - -// AvatarURLEQ applies the EQ predicate on the "avatar_url" field. -func AvatarURLEQ(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLNEQ applies the NEQ predicate on the "avatar_url" field. -func AvatarURLNEQ(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLIn applies the In predicate on the "avatar_url" field. -func AvatarURLIn(vs ...string) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldAvatarURL), v...)) - }) -} - -// AvatarURLNotIn applies the NotIn predicate on the "avatar_url" field. -func AvatarURLNotIn(vs ...string) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldAvatarURL), v...)) - }) -} - -// AvatarURLGT applies the GT predicate on the "avatar_url" field. -func AvatarURLGT(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLGTE applies the GTE predicate on the "avatar_url" field. -func AvatarURLGTE(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLLT applies the LT predicate on the "avatar_url" field. -func AvatarURLLT(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLLTE applies the LTE predicate on the "avatar_url" field. -func AvatarURLLTE(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLContains applies the Contains predicate on the "avatar_url" field. -func AvatarURLContains(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLHasPrefix applies the HasPrefix predicate on the "avatar_url" field. -func AvatarURLHasPrefix(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLHasSuffix applies the HasSuffix predicate on the "avatar_url" field. -func AvatarURLHasSuffix(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLEqualFold applies the EqualFold predicate on the "avatar_url" field. -func AvatarURLEqualFold(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldAvatarURL), v)) - }) -} - -// AvatarURLContainsFold applies the ContainsFold predicate on the "avatar_url" field. -func AvatarURLContainsFold(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldAvatarURL), v)) - }) -} - -// URLEQ applies the EQ predicate on the "url" field. -func URLEQ(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldURL), v)) - }) -} - -// URLNEQ applies the NEQ predicate on the "url" field. -func URLNEQ(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldURL), v)) - }) -} - -// URLIn applies the In predicate on the "url" field. -func URLIn(vs ...string) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldURL), v...)) - }) -} - -// URLNotIn applies the NotIn predicate on the "url" field. -func URLNotIn(vs ...string) predicate.User { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.User(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldURL), v...)) - }) -} - -// URLGT applies the GT predicate on the "url" field. -func URLGT(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldURL), v)) - }) -} - -// URLGTE applies the GTE predicate on the "url" field. -func URLGTE(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldURL), v)) - }) -} - -// URLLT applies the LT predicate on the "url" field. -func URLLT(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldURL), v)) - }) -} - -// URLLTE applies the LTE predicate on the "url" field. -func URLLTE(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldURL), v)) - }) -} - -// URLContains applies the Contains predicate on the "url" field. -func URLContains(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldURL), v)) - }) -} - -// URLHasPrefix applies the HasPrefix predicate on the "url" field. -func URLHasPrefix(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldURL), v)) - }) -} - -// URLHasSuffix applies the HasSuffix predicate on the "url" field. -func URLHasSuffix(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldURL), v)) - }) -} - -// URLEqualFold applies the EqualFold predicate on the "url" field. -func URLEqualFold(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldURL), v)) - }) -} - -// URLContainsFold applies the ContainsFold predicate on the "url" field. -func URLContainsFold(v string) predicate.User { - return predicate.User(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldURL), v)) - }) -} - -// HasEditedStatus applies the HasEdge predicate on the "edited_status" edge. -func HasEditedStatus() predicate.User { - return predicate.User(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(EditedStatusTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, EditedStatusTable, EditedStatusColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasEditedStatusWith applies the HasEdge predicate on the "edited_status" edge with a given conditions (other predicates). -func HasEditedStatusWith(preds ...predicate.VulnStatus) predicate.User { - return predicate.User(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(EditedStatusInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, EditedStatusTable, EditedStatusColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.User) predicate.User { - return predicate.User(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.User) predicate.User { - return predicate.User(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.User) predicate.User { - return predicate.User(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/user_create.go b/pkg/infra/ent/user_create.go deleted file mode 100644 index b205c82..0000000 --- a/pkg/infra/ent/user_create.go +++ /dev/null @@ -1,759 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" -) - -// UserCreate is the builder for creating a User entity. -type UserCreate struct { - config - mutation *UserMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetGithubID sets the "github_id" field. -func (uc *UserCreate) SetGithubID(i int64) *UserCreate { - uc.mutation.SetGithubID(i) - return uc -} - -// SetLogin sets the "login" field. -func (uc *UserCreate) SetLogin(s string) *UserCreate { - uc.mutation.SetLogin(s) - return uc -} - -// SetName sets the "name" field. -func (uc *UserCreate) SetName(s string) *UserCreate { - uc.mutation.SetName(s) - return uc -} - -// SetAvatarURL sets the "avatar_url" field. -func (uc *UserCreate) SetAvatarURL(s string) *UserCreate { - uc.mutation.SetAvatarURL(s) - return uc -} - -// SetURL sets the "url" field. -func (uc *UserCreate) SetURL(s string) *UserCreate { - uc.mutation.SetURL(s) - return uc -} - -// AddEditedStatuIDs adds the "edited_status" edge to the VulnStatus entity by IDs. -func (uc *UserCreate) AddEditedStatuIDs(ids ...int) *UserCreate { - uc.mutation.AddEditedStatuIDs(ids...) - return uc -} - -// AddEditedStatus adds the "edited_status" edges to the VulnStatus entity. -func (uc *UserCreate) AddEditedStatus(v ...*VulnStatus) *UserCreate { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return uc.AddEditedStatuIDs(ids...) -} - -// Mutation returns the UserMutation object of the builder. -func (uc *UserCreate) Mutation() *UserMutation { - return uc.mutation -} - -// Save creates the User in the database. -func (uc *UserCreate) Save(ctx context.Context) (*User, error) { - var ( - err error - node *User - ) - if len(uc.hooks) == 0 { - if err = uc.check(); err != nil { - return nil, err - } - node, err = uc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*UserMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = uc.check(); err != nil { - return nil, err - } - uc.mutation = mutation - if node, err = uc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(uc.hooks) - 1; i >= 0; i-- { - if uc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = uc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, uc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (uc *UserCreate) SaveX(ctx context.Context) *User { - v, err := uc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (uc *UserCreate) Exec(ctx context.Context) error { - _, err := uc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (uc *UserCreate) ExecX(ctx context.Context) { - if err := uc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (uc *UserCreate) check() error { - if _, ok := uc.mutation.GithubID(); !ok { - return &ValidationError{Name: "github_id", err: errors.New(`ent: missing required field "github_id"`)} - } - if _, ok := uc.mutation.Login(); !ok { - return &ValidationError{Name: "login", err: errors.New(`ent: missing required field "login"`)} - } - if _, ok := uc.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "name"`)} - } - if _, ok := uc.mutation.AvatarURL(); !ok { - return &ValidationError{Name: "avatar_url", err: errors.New(`ent: missing required field "avatar_url"`)} - } - if _, ok := uc.mutation.URL(); !ok { - return &ValidationError{Name: "url", err: errors.New(`ent: missing required field "url"`)} - } - return nil -} - -func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - _node, _spec := uc.createSpec() - if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - id := _spec.ID.Value.(int64) - _node.ID = int(id) - return _node, nil -} - -func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { - var ( - _node = &User{config: uc.config} - _spec = &sqlgraph.CreateSpec{ - Table: user.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - } - ) - _spec.OnConflict = uc.conflict - if value, ok := uc.mutation.GithubID(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: user.FieldGithubID, - }) - _node.GithubID = value - } - if value, ok := uc.mutation.Login(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldLogin, - }) - _node.Login = value - } - if value, ok := uc.mutation.Name(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldName, - }) - _node.Name = value - } - if value, ok := uc.mutation.AvatarURL(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldAvatarURL, - }) - _node.AvatarURL = value - } - if value, ok := uc.mutation.URL(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldURL, - }) - _node.URL = value - } - if nodes := uc.mutation.EditedStatusIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: user.EditedStatusTable, - Columns: []string{user.EditedStatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.User.Create(). -// SetGithubID(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.UserUpsert) { -// SetGithubID(v+v). -// }). -// Exec(ctx) -// -func (uc *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne { - uc.conflict = opts - return &UserUpsertOne{ - create: uc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.User.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (uc *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne { - uc.conflict = append(uc.conflict, sql.ConflictColumns(columns...)) - return &UserUpsertOne{ - create: uc, - } -} - -type ( - // UserUpsertOne is the builder for "upsert"-ing - // one User node. - UserUpsertOne struct { - create *UserCreate - } - - // UserUpsert is the "OnConflict" setter. - UserUpsert struct { - *sql.UpdateSet - } -) - -// SetGithubID sets the "github_id" field. -func (u *UserUpsert) SetGithubID(v int64) *UserUpsert { - u.Set(user.FieldGithubID, v) - return u -} - -// UpdateGithubID sets the "github_id" field to the value that was provided on create. -func (u *UserUpsert) UpdateGithubID() *UserUpsert { - u.SetExcluded(user.FieldGithubID) - return u -} - -// SetLogin sets the "login" field. -func (u *UserUpsert) SetLogin(v string) *UserUpsert { - u.Set(user.FieldLogin, v) - return u -} - -// UpdateLogin sets the "login" field to the value that was provided on create. -func (u *UserUpsert) UpdateLogin() *UserUpsert { - u.SetExcluded(user.FieldLogin) - return u -} - -// SetName sets the "name" field. -func (u *UserUpsert) SetName(v string) *UserUpsert { - u.Set(user.FieldName, v) - return u -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *UserUpsert) UpdateName() *UserUpsert { - u.SetExcluded(user.FieldName) - return u -} - -// SetAvatarURL sets the "avatar_url" field. -func (u *UserUpsert) SetAvatarURL(v string) *UserUpsert { - u.Set(user.FieldAvatarURL, v) - return u -} - -// UpdateAvatarURL sets the "avatar_url" field to the value that was provided on create. -func (u *UserUpsert) UpdateAvatarURL() *UserUpsert { - u.SetExcluded(user.FieldAvatarURL) - return u -} - -// SetURL sets the "url" field. -func (u *UserUpsert) SetURL(v string) *UserUpsert { - u.Set(user.FieldURL, v) - return u -} - -// UpdateURL sets the "url" field to the value that was provided on create. -func (u *UserUpsert) UpdateURL() *UserUpsert { - u.SetExcluded(user.FieldURL) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create. -// Using this option is equivalent to using: -// -// client.User.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.User.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *UserUpsertOne) Ignore() *UserUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *UserUpsertOne) DoNothing() *UserUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the UserCreate.OnConflict -// documentation for more info. -func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&UserUpsert{UpdateSet: update}) - })) - return u -} - -// SetGithubID sets the "github_id" field. -func (u *UserUpsertOne) SetGithubID(v int64) *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.SetGithubID(v) - }) -} - -// UpdateGithubID sets the "github_id" field to the value that was provided on create. -func (u *UserUpsertOne) UpdateGithubID() *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.UpdateGithubID() - }) -} - -// SetLogin sets the "login" field. -func (u *UserUpsertOne) SetLogin(v string) *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.SetLogin(v) - }) -} - -// UpdateLogin sets the "login" field to the value that was provided on create. -func (u *UserUpsertOne) UpdateLogin() *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.UpdateLogin() - }) -} - -// SetName sets the "name" field. -func (u *UserUpsertOne) SetName(v string) *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *UserUpsertOne) UpdateName() *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.UpdateName() - }) -} - -// SetAvatarURL sets the "avatar_url" field. -func (u *UserUpsertOne) SetAvatarURL(v string) *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.SetAvatarURL(v) - }) -} - -// UpdateAvatarURL sets the "avatar_url" field to the value that was provided on create. -func (u *UserUpsertOne) UpdateAvatarURL() *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.UpdateAvatarURL() - }) -} - -// SetURL sets the "url" field. -func (u *UserUpsertOne) SetURL(v string) *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.SetURL(v) - }) -} - -// UpdateURL sets the "url" field to the value that was provided on create. -func (u *UserUpsertOne) UpdateURL() *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.UpdateURL() - }) -} - -// Exec executes the query. -func (u *UserUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for UserCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *UserUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *UserUpsertOne) ID(ctx context.Context) (id int, err error) { - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *UserUpsertOne) IDX(ctx context.Context) int { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// UserCreateBulk is the builder for creating many User entities in bulk. -type UserCreateBulk struct { - config - builders []*UserCreate - conflict []sql.ConflictOption -} - -// Save creates the User entities in the database. -func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) { - specs := make([]*sqlgraph.CreateSpec, len(ucb.builders)) - nodes := make([]*User, len(ucb.builders)) - mutators := make([]Mutator, len(ucb.builders)) - for i := range ucb.builders { - func(i int, root context.Context) { - builder := ucb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*UserMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = ucb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, ucb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - if specs[i].ID.Value != nil { - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) - } - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User { - v, err := ucb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (ucb *UserCreateBulk) Exec(ctx context.Context) error { - _, err := ucb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (ucb *UserCreateBulk) ExecX(ctx context.Context) { - if err := ucb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.User.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.UserUpsert) { -// SetGithubID(v+v). -// }). -// Exec(ctx) -// -func (ucb *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk { - ucb.conflict = opts - return &UserUpsertBulk{ - create: ucb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.User.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (ucb *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk { - ucb.conflict = append(ucb.conflict, sql.ConflictColumns(columns...)) - return &UserUpsertBulk{ - create: ucb, - } -} - -// UserUpsertBulk is the builder for "upsert"-ing -// a bulk of User nodes. -type UserUpsertBulk struct { - create *UserCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.User.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.User.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *UserUpsertBulk) Ignore() *UserUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the UserCreateBulk.OnConflict -// documentation for more info. -func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&UserUpsert{UpdateSet: update}) - })) - return u -} - -// SetGithubID sets the "github_id" field. -func (u *UserUpsertBulk) SetGithubID(v int64) *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.SetGithubID(v) - }) -} - -// UpdateGithubID sets the "github_id" field to the value that was provided on create. -func (u *UserUpsertBulk) UpdateGithubID() *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.UpdateGithubID() - }) -} - -// SetLogin sets the "login" field. -func (u *UserUpsertBulk) SetLogin(v string) *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.SetLogin(v) - }) -} - -// UpdateLogin sets the "login" field to the value that was provided on create. -func (u *UserUpsertBulk) UpdateLogin() *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.UpdateLogin() - }) -} - -// SetName sets the "name" field. -func (u *UserUpsertBulk) SetName(v string) *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *UserUpsertBulk) UpdateName() *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.UpdateName() - }) -} - -// SetAvatarURL sets the "avatar_url" field. -func (u *UserUpsertBulk) SetAvatarURL(v string) *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.SetAvatarURL(v) - }) -} - -// UpdateAvatarURL sets the "avatar_url" field to the value that was provided on create. -func (u *UserUpsertBulk) UpdateAvatarURL() *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.UpdateAvatarURL() - }) -} - -// SetURL sets the "url" field. -func (u *UserUpsertBulk) SetURL(v string) *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.SetURL(v) - }) -} - -// UpdateURL sets the "url" field to the value that was provided on create. -func (u *UserUpsertBulk) UpdateURL() *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.UpdateURL() - }) -} - -// Exec executes the query. -func (u *UserUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the UserCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for UserCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *UserUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/user_delete.go b/pkg/infra/ent/user_delete.go deleted file mode 100644 index 1f7984c..0000000 --- a/pkg/infra/ent/user_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" -) - -// UserDelete is the builder for deleting a User entity. -type UserDelete struct { - config - hooks []Hook - mutation *UserMutation -} - -// Where appends a list predicates to the UserDelete builder. -func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete { - ud.mutation.Where(ps...) - return ud -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (ud *UserDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(ud.hooks) == 0 { - affected, err = ud.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*UserMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - ud.mutation = mutation - affected, err = ud.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(ud.hooks) - 1; i >= 0; i-- { - if ud.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = ud.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, ud.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (ud *UserDelete) ExecX(ctx context.Context) int { - n, err := ud.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (ud *UserDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: user.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - if ps := ud.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, ud.driver, _spec) -} - -// UserDeleteOne is the builder for deleting a single User entity. -type UserDeleteOne struct { - ud *UserDelete -} - -// Exec executes the deletion query. -func (udo *UserDeleteOne) Exec(ctx context.Context) error { - n, err := udo.ud.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{user.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) -} diff --git a/pkg/infra/ent/user_query.go b/pkg/infra/ent/user_query.go deleted file mode 100644 index 8e24f16..0000000 --- a/pkg/infra/ent/user_query.go +++ /dev/null @@ -1,987 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "database/sql/driver" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" -) - -// UserQuery is the builder for querying User entities. -type UserQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.User - // eager-loading edges. - withEditedStatus *VulnStatusQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the UserQuery builder. -func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery { - uq.predicates = append(uq.predicates, ps...) - return uq -} - -// Limit adds a limit step to the query. -func (uq *UserQuery) Limit(limit int) *UserQuery { - uq.limit = &limit - return uq -} - -// Offset adds an offset step to the query. -func (uq *UserQuery) Offset(offset int) *UserQuery { - uq.offset = &offset - return uq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (uq *UserQuery) Unique(unique bool) *UserQuery { - uq.unique = &unique - return uq -} - -// Order adds an order step to the query. -func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery { - uq.order = append(uq.order, o...) - return uq -} - -// QueryEditedStatus chains the current query on the "edited_status" edge. -func (uq *UserQuery) QueryEditedStatus() *VulnStatusQuery { - query := &VulnStatusQuery{config: uq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := uq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := uq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(user.Table, user.FieldID, selector), - sqlgraph.To(vulnstatus.Table, vulnstatus.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, user.EditedStatusTable, user.EditedStatusColumn), - ) - fromU = sqlgraph.SetNeighbors(uq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first User entity from the query. -// Returns a *NotFoundError when no User was found. -func (uq *UserQuery) First(ctx context.Context) (*User, error) { - nodes, err := uq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{user.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (uq *UserQuery) FirstX(ctx context.Context) *User { - node, err := uq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first User ID from the query. -// Returns a *NotFoundError when no User ID was found. -func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = uq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{user.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (uq *UserQuery) FirstIDX(ctx context.Context) int { - id, err := uq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single User entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one User entity is not found. -// Returns a *NotFoundError when no User entities are found. -func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - nodes, err := uq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{user.Label} - default: - return nil, &NotSingularError{user.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (uq *UserQuery) OnlyX(ctx context.Context) *User { - node, err := uq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only User ID in the query. -// Returns a *NotSingularError when exactly one User ID is not found. -// Returns a *NotFoundError when no entities are found. -func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = uq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{user.Label} - default: - err = &NotSingularError{user.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (uq *UserQuery) OnlyIDX(ctx context.Context) int { - id, err := uq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of Users. -func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { - if err := uq.prepareQuery(ctx); err != nil { - return nil, err - } - return uq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (uq *UserQuery) AllX(ctx context.Context) []*User { - nodes, err := uq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of User IDs. -func (uq *UserQuery) IDs(ctx context.Context) ([]int, error) { - var ids []int - if err := uq.Select(user.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (uq *UserQuery) IDsX(ctx context.Context) []int { - ids, err := uq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (uq *UserQuery) Count(ctx context.Context) (int, error) { - if err := uq.prepareQuery(ctx); err != nil { - return 0, err - } - return uq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (uq *UserQuery) CountX(ctx context.Context) int { - count, err := uq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (uq *UserQuery) Exist(ctx context.Context) (bool, error) { - if err := uq.prepareQuery(ctx); err != nil { - return false, err - } - return uq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (uq *UserQuery) ExistX(ctx context.Context) bool { - exist, err := uq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (uq *UserQuery) Clone() *UserQuery { - if uq == nil { - return nil - } - return &UserQuery{ - config: uq.config, - limit: uq.limit, - offset: uq.offset, - order: append([]OrderFunc{}, uq.order...), - predicates: append([]predicate.User{}, uq.predicates...), - withEditedStatus: uq.withEditedStatus.Clone(), - // clone intermediate query. - sql: uq.sql.Clone(), - path: uq.path, - } -} - -// WithEditedStatus tells the query-builder to eager-load the nodes that are connected to -// the "edited_status" edge. The optional arguments are used to configure the query builder of the edge. -func (uq *UserQuery) WithEditedStatus(opts ...func(*VulnStatusQuery)) *UserQuery { - query := &VulnStatusQuery{config: uq.config} - for _, opt := range opts { - opt(query) - } - uq.withEditedStatus = query - return uq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// GithubID int64 `json:"github_id,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.User.Query(). -// GroupBy(user.FieldGithubID). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy { - group := &UserGroupBy{config: uq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := uq.prepareQuery(ctx); err != nil { - return nil, err - } - return uq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// GithubID int64 `json:"github_id,omitempty"` -// } -// -// client.User.Query(). -// Select(user.FieldGithubID). -// Scan(ctx, &v) -// -func (uq *UserQuery) Select(fields ...string) *UserSelect { - uq.fields = append(uq.fields, fields...) - return &UserSelect{UserQuery: uq} -} - -func (uq *UserQuery) prepareQuery(ctx context.Context) error { - for _, f := range uq.fields { - if !user.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if uq.path != nil { - prev, err := uq.path(ctx) - if err != nil { - return err - } - uq.sql = prev - } - return nil -} - -func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { - var ( - nodes = []*User{} - _spec = uq.querySpec() - loadedTypes = [1]bool{ - uq.withEditedStatus != nil, - } - ) - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &User{config: uq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, uq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := uq.withEditedStatus; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[int]*User) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.EditedStatus = []*VulnStatus{} - } - query.withFKs = true - query.Where(predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.InValues(user.EditedStatusColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - fk := n.user_edited_status - if fk == nil { - return nil, fmt.Errorf(`foreign-key "user_edited_status" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "user_edited_status" returned %v for node %v`, *fk, n.ID) - } - node.Edges.EditedStatus = append(node.Edges.EditedStatus, n) - } - } - - return nodes, nil -} - -func (uq *UserQuery) sqlCount(ctx context.Context) (int, error) { - _spec := uq.querySpec() - return sqlgraph.CountNodes(ctx, uq.driver, _spec) -} - -func (uq *UserQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := uq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (uq *UserQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: user.Table, - Columns: user.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - From: uq.sql, - Unique: true, - } - if unique := uq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := uq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) - for i := range fields { - if fields[i] != user.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := uq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := uq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := uq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := uq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (uq *UserQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(uq.driver.Dialect()) - t1 := builder.Table(user.Table) - columns := uq.fields - if len(columns) == 0 { - columns = user.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if uq.sql != nil { - selector = uq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range uq.predicates { - p(selector) - } - for _, p := range uq.order { - p(selector) - } - if offset := uq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := uq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// UserGroupBy is the group-by builder for User entities. -type UserGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb -} - -// Scan applies the group-by query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := ugb.path(ctx) - if err != nil { - return err - } - ugb.sql = query - return ugb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := ugb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(ugb.fields) > 1 { - return nil, errors.New("ent: UserGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := ugb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ugb *UserGroupBy) StringsX(ctx context.Context) []string { - v, err := ugb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ugb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{user.Label} - default: - err = fmt.Errorf("ent: UserGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ugb *UserGroupBy) StringX(ctx context.Context) string { - v, err := ugb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(ugb.fields) > 1 { - return nil, errors.New("ent: UserGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := ugb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ugb *UserGroupBy) IntsX(ctx context.Context) []int { - v, err := ugb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ugb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{user.Label} - default: - err = fmt.Errorf("ent: UserGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ugb *UserGroupBy) IntX(ctx context.Context) int { - v, err := ugb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(ugb.fields) > 1 { - return nil, errors.New("ent: UserGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := ugb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := ugb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ugb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{user.Label} - default: - err = fmt.Errorf("ent: UserGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ugb *UserGroupBy) Float64X(ctx context.Context) float64 { - v, err := ugb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(ugb.fields) > 1 { - return nil, errors.New("ent: UserGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := ugb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool { - v, err := ugb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ugb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{user.Label} - default: - err = fmt.Errorf("ent: UserGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ugb *UserGroupBy) BoolX(ctx context.Context) bool { - v, err := ugb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (ugb *UserGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range ugb.fields { - if !user.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := ugb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := ugb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (ugb *UserGroupBy) sqlQuery() *sql.Selector { - selector := ugb.sql.Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(ugb.fields)+len(ugb.fns)) - for _, f := range ugb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(ugb.fields...)...) -} - -// UserSelect is the builder for selecting fields of User entities. -type UserSelect struct { - *UserQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v interface{}) error { - if err := us.prepareQuery(ctx); err != nil { - return err - } - us.sql = us.UserQuery.sqlQuery(ctx) - return us.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (us *UserSelect) ScanX(ctx context.Context, v interface{}) { - if err := us.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (us *UserSelect) Strings(ctx context.Context) ([]string, error) { - if len(us.fields) > 1 { - return nil, errors.New("ent: UserSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := us.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (us *UserSelect) StringsX(ctx context.Context) []string { - v, err := us.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (us *UserSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = us.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{user.Label} - default: - err = fmt.Errorf("ent: UserSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (us *UserSelect) StringX(ctx context.Context) string { - v, err := us.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (us *UserSelect) Ints(ctx context.Context) ([]int, error) { - if len(us.fields) > 1 { - return nil, errors.New("ent: UserSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := us.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (us *UserSelect) IntsX(ctx context.Context) []int { - v, err := us.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (us *UserSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = us.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{user.Label} - default: - err = fmt.Errorf("ent: UserSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (us *UserSelect) IntX(ctx context.Context) int { - v, err := us.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(us.fields) > 1 { - return nil, errors.New("ent: UserSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := us.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (us *UserSelect) Float64sX(ctx context.Context) []float64 { - v, err := us.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = us.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{user.Label} - default: - err = fmt.Errorf("ent: UserSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (us *UserSelect) Float64X(ctx context.Context) float64 { - v, err := us.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (us *UserSelect) Bools(ctx context.Context) ([]bool, error) { - if len(us.fields) > 1 { - return nil, errors.New("ent: UserSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := us.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (us *UserSelect) BoolsX(ctx context.Context) []bool { - v, err := us.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = us.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{user.Label} - default: - err = fmt.Errorf("ent: UserSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (us *UserSelect) BoolX(ctx context.Context) bool { - v, err := us.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (us *UserSelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := us.sql.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/user_update.go b/pkg/infra/ent/user_update.go deleted file mode 100644 index 14759d2..0000000 --- a/pkg/infra/ent/user_update.go +++ /dev/null @@ -1,523 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" -) - -// UserUpdate is the builder for updating User entities. -type UserUpdate struct { - config - hooks []Hook - mutation *UserMutation -} - -// Where appends a list predicates to the UserUpdate builder. -func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate { - uu.mutation.Where(ps...) - return uu -} - -// SetLogin sets the "login" field. -func (uu *UserUpdate) SetLogin(s string) *UserUpdate { - uu.mutation.SetLogin(s) - return uu -} - -// SetName sets the "name" field. -func (uu *UserUpdate) SetName(s string) *UserUpdate { - uu.mutation.SetName(s) - return uu -} - -// SetAvatarURL sets the "avatar_url" field. -func (uu *UserUpdate) SetAvatarURL(s string) *UserUpdate { - uu.mutation.SetAvatarURL(s) - return uu -} - -// SetURL sets the "url" field. -func (uu *UserUpdate) SetURL(s string) *UserUpdate { - uu.mutation.SetURL(s) - return uu -} - -// AddEditedStatuIDs adds the "edited_status" edge to the VulnStatus entity by IDs. -func (uu *UserUpdate) AddEditedStatuIDs(ids ...int) *UserUpdate { - uu.mutation.AddEditedStatuIDs(ids...) - return uu -} - -// AddEditedStatus adds the "edited_status" edges to the VulnStatus entity. -func (uu *UserUpdate) AddEditedStatus(v ...*VulnStatus) *UserUpdate { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return uu.AddEditedStatuIDs(ids...) -} - -// Mutation returns the UserMutation object of the builder. -func (uu *UserUpdate) Mutation() *UserMutation { - return uu.mutation -} - -// ClearEditedStatus clears all "edited_status" edges to the VulnStatus entity. -func (uu *UserUpdate) ClearEditedStatus() *UserUpdate { - uu.mutation.ClearEditedStatus() - return uu -} - -// RemoveEditedStatuIDs removes the "edited_status" edge to VulnStatus entities by IDs. -func (uu *UserUpdate) RemoveEditedStatuIDs(ids ...int) *UserUpdate { - uu.mutation.RemoveEditedStatuIDs(ids...) - return uu -} - -// RemoveEditedStatus removes "edited_status" edges to VulnStatus entities. -func (uu *UserUpdate) RemoveEditedStatus(v ...*VulnStatus) *UserUpdate { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return uu.RemoveEditedStatuIDs(ids...) -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (uu *UserUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(uu.hooks) == 0 { - affected, err = uu.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*UserMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - uu.mutation = mutation - affected, err = uu.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(uu.hooks) - 1; i >= 0; i-- { - if uu.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = uu.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, uu.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (uu *UserUpdate) SaveX(ctx context.Context) int { - affected, err := uu.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (uu *UserUpdate) Exec(ctx context.Context) error { - _, err := uu.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (uu *UserUpdate) ExecX(ctx context.Context) { - if err := uu.Exec(ctx); err != nil { - panic(err) - } -} - -func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: user.Table, - Columns: user.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - if ps := uu.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := uu.mutation.Login(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldLogin, - }) - } - if value, ok := uu.mutation.Name(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldName, - }) - } - if value, ok := uu.mutation.AvatarURL(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldAvatarURL, - }) - } - if value, ok := uu.mutation.URL(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldURL, - }) - } - if uu.mutation.EditedStatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: user.EditedStatusTable, - Columns: []string{user.EditedStatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := uu.mutation.RemovedEditedStatusIDs(); len(nodes) > 0 && !uu.mutation.EditedStatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: user.EditedStatusTable, - Columns: []string{user.EditedStatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := uu.mutation.EditedStatusIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: user.EditedStatusTable, - Columns: []string{user.EditedStatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, uu.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{user.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// UserUpdateOne is the builder for updating a single User entity. -type UserUpdateOne struct { - config - fields []string - hooks []Hook - mutation *UserMutation -} - -// SetLogin sets the "login" field. -func (uuo *UserUpdateOne) SetLogin(s string) *UserUpdateOne { - uuo.mutation.SetLogin(s) - return uuo -} - -// SetName sets the "name" field. -func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne { - uuo.mutation.SetName(s) - return uuo -} - -// SetAvatarURL sets the "avatar_url" field. -func (uuo *UserUpdateOne) SetAvatarURL(s string) *UserUpdateOne { - uuo.mutation.SetAvatarURL(s) - return uuo -} - -// SetURL sets the "url" field. -func (uuo *UserUpdateOne) SetURL(s string) *UserUpdateOne { - uuo.mutation.SetURL(s) - return uuo -} - -// AddEditedStatuIDs adds the "edited_status" edge to the VulnStatus entity by IDs. -func (uuo *UserUpdateOne) AddEditedStatuIDs(ids ...int) *UserUpdateOne { - uuo.mutation.AddEditedStatuIDs(ids...) - return uuo -} - -// AddEditedStatus adds the "edited_status" edges to the VulnStatus entity. -func (uuo *UserUpdateOne) AddEditedStatus(v ...*VulnStatus) *UserUpdateOne { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return uuo.AddEditedStatuIDs(ids...) -} - -// Mutation returns the UserMutation object of the builder. -func (uuo *UserUpdateOne) Mutation() *UserMutation { - return uuo.mutation -} - -// ClearEditedStatus clears all "edited_status" edges to the VulnStatus entity. -func (uuo *UserUpdateOne) ClearEditedStatus() *UserUpdateOne { - uuo.mutation.ClearEditedStatus() - return uuo -} - -// RemoveEditedStatuIDs removes the "edited_status" edge to VulnStatus entities by IDs. -func (uuo *UserUpdateOne) RemoveEditedStatuIDs(ids ...int) *UserUpdateOne { - uuo.mutation.RemoveEditedStatuIDs(ids...) - return uuo -} - -// RemoveEditedStatus removes "edited_status" edges to VulnStatus entities. -func (uuo *UserUpdateOne) RemoveEditedStatus(v ...*VulnStatus) *UserUpdateOne { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return uuo.RemoveEditedStatuIDs(ids...) -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { - uuo.fields = append([]string{field}, fields...) - return uuo -} - -// Save executes the query and returns the updated User entity. -func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { - var ( - err error - node *User - ) - if len(uuo.hooks) == 0 { - node, err = uuo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*UserMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - uuo.mutation = mutation - node, err = uuo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(uuo.hooks) - 1; i >= 0; i-- { - if uuo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = uuo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, uuo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - node, err := uuo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (uuo *UserUpdateOne) Exec(ctx context.Context) error { - _, err := uuo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (uuo *UserUpdateOne) ExecX(ctx context.Context) { - if err := uuo.Exec(ctx); err != nil { - panic(err) - } -} - -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: user.Table, - Columns: user.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - id, ok := uuo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} - } - _spec.Node.ID.Value = id - if fields := uuo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) - for _, f := range fields { - if !user.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != user.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := uuo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := uuo.mutation.Login(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldLogin, - }) - } - if value, ok := uuo.mutation.Name(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldName, - }) - } - if value, ok := uuo.mutation.AvatarURL(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldAvatarURL, - }) - } - if value, ok := uuo.mutation.URL(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: user.FieldURL, - }) - } - if uuo.mutation.EditedStatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: user.EditedStatusTable, - Columns: []string{user.EditedStatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := uuo.mutation.RemovedEditedStatusIDs(); len(nodes) > 0 && !uuo.mutation.EditedStatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: user.EditedStatusTable, - Columns: []string{user.EditedStatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := uuo.mutation.EditedStatusIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: user.EditedStatusTable, - Columns: []string{user.EditedStatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &User{config: uuo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{user.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/vulnerability.go b/pkg/infra/ent/vulnerability.go deleted file mode 100644 index 4e1d6d0..0000000 --- a/pkg/infra/ent/vulnerability.go +++ /dev/null @@ -1,236 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "encoding/json" - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// Vulnerability is the model entity for the Vulnerability schema. -type Vulnerability struct { - config `json:"-"` - // ID of the ent. - ID string `json:"id,omitempty"` - // FirstSeenAt holds the value of the "first_seen_at" field. - FirstSeenAt int64 `json:"first_seen_at,omitempty"` - // LastModifiedAt holds the value of the "last_modified_at" field. - LastModifiedAt int64 `json:"last_modified_at,omitempty"` - // Title holds the value of the "title" field. - Title string `json:"title,omitempty"` - // Description holds the value of the "description" field. - Description string `json:"description,omitempty"` - // CweID holds the value of the "cwe_id" field. - CweID []string `json:"cwe_id,omitempty"` - // Severity holds the value of the "severity" field. - Severity string `json:"severity,omitempty"` - // Cvss holds the value of the "cvss" field. - Cvss []string `json:"cvss,omitempty"` - // References holds the value of the "references" field. - References []string `json:"references,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the VulnerabilityQuery when eager-loading is set. - Edges VulnerabilityEdges `json:"edges"` - vulnerability_custom_severity *int -} - -// VulnerabilityEdges holds the relations/edges for other nodes in the graph. -type VulnerabilityEdges struct { - // Packages holds the value of the packages edge. - Packages []*PackageRecord `json:"packages,omitempty"` - // CustomSeverity holds the value of the custom_severity edge. - CustomSeverity *Severity `json:"custom_severity,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [2]bool -} - -// PackagesOrErr returns the Packages value or an error if the edge -// was not loaded in eager-loading. -func (e VulnerabilityEdges) PackagesOrErr() ([]*PackageRecord, error) { - if e.loadedTypes[0] { - return e.Packages, nil - } - return nil, &NotLoadedError{edge: "packages"} -} - -// CustomSeverityOrErr returns the CustomSeverity value or an error if the edge -// was not loaded in eager-loading, or loaded but was not found. -func (e VulnerabilityEdges) CustomSeverityOrErr() (*Severity, error) { - if e.loadedTypes[1] { - if e.CustomSeverity == nil { - // The edge custom_severity was loaded in eager-loading, - // but was not found. - return nil, &NotFoundError{label: severity.Label} - } - return e.CustomSeverity, nil - } - return nil, &NotLoadedError{edge: "custom_severity"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*Vulnerability) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case vulnerability.FieldCweID, vulnerability.FieldCvss, vulnerability.FieldReferences: - values[i] = new([]byte) - case vulnerability.FieldFirstSeenAt, vulnerability.FieldLastModifiedAt: - values[i] = new(sql.NullInt64) - case vulnerability.FieldID, vulnerability.FieldTitle, vulnerability.FieldDescription, vulnerability.FieldSeverity: - values[i] = new(sql.NullString) - case vulnerability.ForeignKeys[0]: // vulnerability_custom_severity - values[i] = new(sql.NullInt64) - default: - return nil, fmt.Errorf("unexpected column %q for type Vulnerability", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the Vulnerability fields. -func (v *Vulnerability) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case vulnerability.FieldID: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field id", values[i]) - } else if value.Valid { - v.ID = value.String - } - case vulnerability.FieldFirstSeenAt: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field first_seen_at", values[i]) - } else if value.Valid { - v.FirstSeenAt = value.Int64 - } - case vulnerability.FieldLastModifiedAt: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field last_modified_at", values[i]) - } else if value.Valid { - v.LastModifiedAt = value.Int64 - } - case vulnerability.FieldTitle: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field title", values[i]) - } else if value.Valid { - v.Title = value.String - } - case vulnerability.FieldDescription: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field description", values[i]) - } else if value.Valid { - v.Description = value.String - } - case vulnerability.FieldCweID: - if value, ok := values[i].(*[]byte); !ok { - return fmt.Errorf("unexpected type %T for field cwe_id", values[i]) - } else if value != nil && len(*value) > 0 { - if err := json.Unmarshal(*value, &v.CweID); err != nil { - return fmt.Errorf("unmarshal field cwe_id: %w", err) - } - } - case vulnerability.FieldSeverity: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field severity", values[i]) - } else if value.Valid { - v.Severity = value.String - } - case vulnerability.FieldCvss: - if value, ok := values[i].(*[]byte); !ok { - return fmt.Errorf("unexpected type %T for field cvss", values[i]) - } else if value != nil && len(*value) > 0 { - if err := json.Unmarshal(*value, &v.Cvss); err != nil { - return fmt.Errorf("unmarshal field cvss: %w", err) - } - } - case vulnerability.FieldReferences: - if value, ok := values[i].(*[]byte); !ok { - return fmt.Errorf("unexpected type %T for field references", values[i]) - } else if value != nil && len(*value) > 0 { - if err := json.Unmarshal(*value, &v.References); err != nil { - return fmt.Errorf("unmarshal field references: %w", err) - } - } - case vulnerability.ForeignKeys[0]: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for edge-field vulnerability_custom_severity", value) - } else if value.Valid { - v.vulnerability_custom_severity = new(int) - *v.vulnerability_custom_severity = int(value.Int64) - } - } - } - return nil -} - -// QueryPackages queries the "packages" edge of the Vulnerability entity. -func (v *Vulnerability) QueryPackages() *PackageRecordQuery { - return (&VulnerabilityClient{config: v.config}).QueryPackages(v) -} - -// QueryCustomSeverity queries the "custom_severity" edge of the Vulnerability entity. -func (v *Vulnerability) QueryCustomSeverity() *SeverityQuery { - return (&VulnerabilityClient{config: v.config}).QueryCustomSeverity(v) -} - -// Update returns a builder for updating this Vulnerability. -// Note that you need to call Vulnerability.Unwrap() before calling this method if this Vulnerability -// was returned from a transaction, and the transaction was committed or rolled back. -func (v *Vulnerability) Update() *VulnerabilityUpdateOne { - return (&VulnerabilityClient{config: v.config}).UpdateOne(v) -} - -// Unwrap unwraps the Vulnerability entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (v *Vulnerability) Unwrap() *Vulnerability { - tx, ok := v.config.driver.(*txDriver) - if !ok { - panic("ent: Vulnerability is not a transactional entity") - } - v.config.driver = tx.drv - return v -} - -// String implements the fmt.Stringer. -func (v *Vulnerability) String() string { - var builder strings.Builder - builder.WriteString("Vulnerability(") - builder.WriteString(fmt.Sprintf("id=%v", v.ID)) - builder.WriteString(", first_seen_at=") - builder.WriteString(fmt.Sprintf("%v", v.FirstSeenAt)) - builder.WriteString(", last_modified_at=") - builder.WriteString(fmt.Sprintf("%v", v.LastModifiedAt)) - builder.WriteString(", title=") - builder.WriteString(v.Title) - builder.WriteString(", description=") - builder.WriteString(v.Description) - builder.WriteString(", cwe_id=") - builder.WriteString(fmt.Sprintf("%v", v.CweID)) - builder.WriteString(", severity=") - builder.WriteString(v.Severity) - builder.WriteString(", cvss=") - builder.WriteString(fmt.Sprintf("%v", v.Cvss)) - builder.WriteString(", references=") - builder.WriteString(fmt.Sprintf("%v", v.References)) - builder.WriteByte(')') - return builder.String() -} - -// Vulnerabilities is a parsable slice of Vulnerability. -type Vulnerabilities []*Vulnerability - -func (v Vulnerabilities) config(cfg config) { - for _i := range v { - v[_i].config = cfg - } -} diff --git a/pkg/infra/ent/vulnerability/vulnerability.go b/pkg/infra/ent/vulnerability/vulnerability.go deleted file mode 100644 index ac995c8..0000000 --- a/pkg/infra/ent/vulnerability/vulnerability.go +++ /dev/null @@ -1,89 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package vulnerability - -const ( - // Label holds the string label denoting the vulnerability type in the database. - Label = "vulnerability" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldFirstSeenAt holds the string denoting the first_seen_at field in the database. - FieldFirstSeenAt = "first_seen_at" - // FieldLastModifiedAt holds the string denoting the last_modified_at field in the database. - FieldLastModifiedAt = "last_modified_at" - // FieldTitle holds the string denoting the title field in the database. - FieldTitle = "title" - // FieldDescription holds the string denoting the description field in the database. - FieldDescription = "description" - // FieldCweID holds the string denoting the cwe_id field in the database. - FieldCweID = "cwe_id" - // FieldSeverity holds the string denoting the severity field in the database. - FieldSeverity = "severity" - // FieldCvss holds the string denoting the cvss field in the database. - FieldCvss = "cvss" - // FieldReferences holds the string denoting the references field in the database. - FieldReferences = "references" - // EdgePackages holds the string denoting the packages edge name in mutations. - EdgePackages = "packages" - // EdgeCustomSeverity holds the string denoting the custom_severity edge name in mutations. - EdgeCustomSeverity = "custom_severity" - // Table holds the table name of the vulnerability in the database. - Table = "vulnerabilities" - // PackagesTable is the table that holds the packages relation/edge. The primary key declared below. - PackagesTable = "package_record_vulnerabilities" - // PackagesInverseTable is the table name for the PackageRecord entity. - // It exists in this package in order to avoid circular dependency with the "packagerecord" package. - PackagesInverseTable = "package_records" - // CustomSeverityTable is the table that holds the custom_severity relation/edge. - CustomSeverityTable = "vulnerabilities" - // CustomSeverityInverseTable is the table name for the Severity entity. - // It exists in this package in order to avoid circular dependency with the "severity" package. - CustomSeverityInverseTable = "severities" - // CustomSeverityColumn is the table column denoting the custom_severity relation/edge. - CustomSeverityColumn = "vulnerability_custom_severity" -) - -// Columns holds all SQL columns for vulnerability fields. -var Columns = []string{ - FieldID, - FieldFirstSeenAt, - FieldLastModifiedAt, - FieldTitle, - FieldDescription, - FieldCweID, - FieldSeverity, - FieldCvss, - FieldReferences, -} - -// ForeignKeys holds the SQL foreign-keys that are owned by the "vulnerabilities" -// table and are not defined as standalone fields in the schema. -var ForeignKeys = []string{ - "vulnerability_custom_severity", -} - -var ( - // PackagesPrimaryKey and PackagesColumn2 are the table columns denoting the - // primary key for the packages relation (M2M). - PackagesPrimaryKey = []string{"package_record_id", "vulnerability_id"} -) - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - for i := range ForeignKeys { - if column == ForeignKeys[i] { - return true - } - } - return false -} - -var ( - // IDValidator is a validator for the "id" field. It is called by the builders before save. - IDValidator func(string) error -) diff --git a/pkg/infra/ent/vulnerability/where.go b/pkg/infra/ent/vulnerability/where.go deleted file mode 100644 index 9516418..0000000 --- a/pkg/infra/ent/vulnerability/where.go +++ /dev/null @@ -1,784 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package vulnerability - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// FirstSeenAt applies equality check predicate on the "first_seen_at" field. It's identical to FirstSeenAtEQ. -func FirstSeenAt(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldFirstSeenAt), v)) - }) -} - -// LastModifiedAt applies equality check predicate on the "last_modified_at" field. It's identical to LastModifiedAtEQ. -func LastModifiedAt(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldLastModifiedAt), v)) - }) -} - -// Title applies equality check predicate on the "title" field. It's identical to TitleEQ. -func Title(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldTitle), v)) - }) -} - -// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ. -func Description(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldDescription), v)) - }) -} - -// Severity applies equality check predicate on the "severity" field. It's identical to SeverityEQ. -func Severity(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldSeverity), v)) - }) -} - -// FirstSeenAtEQ applies the EQ predicate on the "first_seen_at" field. -func FirstSeenAtEQ(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldFirstSeenAt), v)) - }) -} - -// FirstSeenAtNEQ applies the NEQ predicate on the "first_seen_at" field. -func FirstSeenAtNEQ(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldFirstSeenAt), v)) - }) -} - -// FirstSeenAtIn applies the In predicate on the "first_seen_at" field. -func FirstSeenAtIn(vs ...int64) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldFirstSeenAt), v...)) - }) -} - -// FirstSeenAtNotIn applies the NotIn predicate on the "first_seen_at" field. -func FirstSeenAtNotIn(vs ...int64) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldFirstSeenAt), v...)) - }) -} - -// FirstSeenAtGT applies the GT predicate on the "first_seen_at" field. -func FirstSeenAtGT(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldFirstSeenAt), v)) - }) -} - -// FirstSeenAtGTE applies the GTE predicate on the "first_seen_at" field. -func FirstSeenAtGTE(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldFirstSeenAt), v)) - }) -} - -// FirstSeenAtLT applies the LT predicate on the "first_seen_at" field. -func FirstSeenAtLT(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldFirstSeenAt), v)) - }) -} - -// FirstSeenAtLTE applies the LTE predicate on the "first_seen_at" field. -func FirstSeenAtLTE(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldFirstSeenAt), v)) - }) -} - -// LastModifiedAtEQ applies the EQ predicate on the "last_modified_at" field. -func LastModifiedAtEQ(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldLastModifiedAt), v)) - }) -} - -// LastModifiedAtNEQ applies the NEQ predicate on the "last_modified_at" field. -func LastModifiedAtNEQ(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldLastModifiedAt), v)) - }) -} - -// LastModifiedAtIn applies the In predicate on the "last_modified_at" field. -func LastModifiedAtIn(vs ...int64) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldLastModifiedAt), v...)) - }) -} - -// LastModifiedAtNotIn applies the NotIn predicate on the "last_modified_at" field. -func LastModifiedAtNotIn(vs ...int64) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldLastModifiedAt), v...)) - }) -} - -// LastModifiedAtGT applies the GT predicate on the "last_modified_at" field. -func LastModifiedAtGT(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldLastModifiedAt), v)) - }) -} - -// LastModifiedAtGTE applies the GTE predicate on the "last_modified_at" field. -func LastModifiedAtGTE(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldLastModifiedAt), v)) - }) -} - -// LastModifiedAtLT applies the LT predicate on the "last_modified_at" field. -func LastModifiedAtLT(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldLastModifiedAt), v)) - }) -} - -// LastModifiedAtLTE applies the LTE predicate on the "last_modified_at" field. -func LastModifiedAtLTE(v int64) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldLastModifiedAt), v)) - }) -} - -// TitleEQ applies the EQ predicate on the "title" field. -func TitleEQ(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldTitle), v)) - }) -} - -// TitleNEQ applies the NEQ predicate on the "title" field. -func TitleNEQ(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldTitle), v)) - }) -} - -// TitleIn applies the In predicate on the "title" field. -func TitleIn(vs ...string) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldTitle), v...)) - }) -} - -// TitleNotIn applies the NotIn predicate on the "title" field. -func TitleNotIn(vs ...string) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldTitle), v...)) - }) -} - -// TitleGT applies the GT predicate on the "title" field. -func TitleGT(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldTitle), v)) - }) -} - -// TitleGTE applies the GTE predicate on the "title" field. -func TitleGTE(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldTitle), v)) - }) -} - -// TitleLT applies the LT predicate on the "title" field. -func TitleLT(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldTitle), v)) - }) -} - -// TitleLTE applies the LTE predicate on the "title" field. -func TitleLTE(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldTitle), v)) - }) -} - -// TitleContains applies the Contains predicate on the "title" field. -func TitleContains(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldTitle), v)) - }) -} - -// TitleHasPrefix applies the HasPrefix predicate on the "title" field. -func TitleHasPrefix(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldTitle), v)) - }) -} - -// TitleHasSuffix applies the HasSuffix predicate on the "title" field. -func TitleHasSuffix(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldTitle), v)) - }) -} - -// TitleIsNil applies the IsNil predicate on the "title" field. -func TitleIsNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldTitle))) - }) -} - -// TitleNotNil applies the NotNil predicate on the "title" field. -func TitleNotNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldTitle))) - }) -} - -// TitleEqualFold applies the EqualFold predicate on the "title" field. -func TitleEqualFold(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldTitle), v)) - }) -} - -// TitleContainsFold applies the ContainsFold predicate on the "title" field. -func TitleContainsFold(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldTitle), v)) - }) -} - -// DescriptionEQ applies the EQ predicate on the "description" field. -func DescriptionEQ(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldDescription), v)) - }) -} - -// DescriptionNEQ applies the NEQ predicate on the "description" field. -func DescriptionNEQ(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldDescription), v)) - }) -} - -// DescriptionIn applies the In predicate on the "description" field. -func DescriptionIn(vs ...string) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldDescription), v...)) - }) -} - -// DescriptionNotIn applies the NotIn predicate on the "description" field. -func DescriptionNotIn(vs ...string) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldDescription), v...)) - }) -} - -// DescriptionGT applies the GT predicate on the "description" field. -func DescriptionGT(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldDescription), v)) - }) -} - -// DescriptionGTE applies the GTE predicate on the "description" field. -func DescriptionGTE(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldDescription), v)) - }) -} - -// DescriptionLT applies the LT predicate on the "description" field. -func DescriptionLT(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldDescription), v)) - }) -} - -// DescriptionLTE applies the LTE predicate on the "description" field. -func DescriptionLTE(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldDescription), v)) - }) -} - -// DescriptionContains applies the Contains predicate on the "description" field. -func DescriptionContains(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldDescription), v)) - }) -} - -// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field. -func DescriptionHasPrefix(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldDescription), v)) - }) -} - -// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field. -func DescriptionHasSuffix(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldDescription), v)) - }) -} - -// DescriptionIsNil applies the IsNil predicate on the "description" field. -func DescriptionIsNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldDescription))) - }) -} - -// DescriptionNotNil applies the NotNil predicate on the "description" field. -func DescriptionNotNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldDescription))) - }) -} - -// DescriptionEqualFold applies the EqualFold predicate on the "description" field. -func DescriptionEqualFold(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldDescription), v)) - }) -} - -// DescriptionContainsFold applies the ContainsFold predicate on the "description" field. -func DescriptionContainsFold(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldDescription), v)) - }) -} - -// CweIDIsNil applies the IsNil predicate on the "cwe_id" field. -func CweIDIsNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldCweID))) - }) -} - -// CweIDNotNil applies the NotNil predicate on the "cwe_id" field. -func CweIDNotNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldCweID))) - }) -} - -// SeverityEQ applies the EQ predicate on the "severity" field. -func SeverityEQ(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldSeverity), v)) - }) -} - -// SeverityNEQ applies the NEQ predicate on the "severity" field. -func SeverityNEQ(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldSeverity), v)) - }) -} - -// SeverityIn applies the In predicate on the "severity" field. -func SeverityIn(vs ...string) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldSeverity), v...)) - }) -} - -// SeverityNotIn applies the NotIn predicate on the "severity" field. -func SeverityNotIn(vs ...string) predicate.Vulnerability { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.Vulnerability(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldSeverity), v...)) - }) -} - -// SeverityGT applies the GT predicate on the "severity" field. -func SeverityGT(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldSeverity), v)) - }) -} - -// SeverityGTE applies the GTE predicate on the "severity" field. -func SeverityGTE(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldSeverity), v)) - }) -} - -// SeverityLT applies the LT predicate on the "severity" field. -func SeverityLT(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldSeverity), v)) - }) -} - -// SeverityLTE applies the LTE predicate on the "severity" field. -func SeverityLTE(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldSeverity), v)) - }) -} - -// SeverityContains applies the Contains predicate on the "severity" field. -func SeverityContains(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldSeverity), v)) - }) -} - -// SeverityHasPrefix applies the HasPrefix predicate on the "severity" field. -func SeverityHasPrefix(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldSeverity), v)) - }) -} - -// SeverityHasSuffix applies the HasSuffix predicate on the "severity" field. -func SeverityHasSuffix(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldSeverity), v)) - }) -} - -// SeverityIsNil applies the IsNil predicate on the "severity" field. -func SeverityIsNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldSeverity))) - }) -} - -// SeverityNotNil applies the NotNil predicate on the "severity" field. -func SeverityNotNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldSeverity))) - }) -} - -// SeverityEqualFold applies the EqualFold predicate on the "severity" field. -func SeverityEqualFold(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldSeverity), v)) - }) -} - -// SeverityContainsFold applies the ContainsFold predicate on the "severity" field. -func SeverityContainsFold(v string) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldSeverity), v)) - }) -} - -// CvssIsNil applies the IsNil predicate on the "cvss" field. -func CvssIsNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldCvss))) - }) -} - -// CvssNotNil applies the NotNil predicate on the "cvss" field. -func CvssNotNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldCvss))) - }) -} - -// ReferencesIsNil applies the IsNil predicate on the "references" field. -func ReferencesIsNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.IsNull(s.C(FieldReferences))) - }) -} - -// ReferencesNotNil applies the NotNil predicate on the "references" field. -func ReferencesNotNil() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s.Where(sql.NotNull(s.C(FieldReferences))) - }) -} - -// HasPackages applies the HasEdge predicate on the "packages" edge. -func HasPackages() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(PackagesTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, PackagesTable, PackagesPrimaryKey...), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasPackagesWith applies the HasEdge predicate on the "packages" edge with a given conditions (other predicates). -func HasPackagesWith(preds ...predicate.PackageRecord) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(PackagesInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, PackagesTable, PackagesPrimaryKey...), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// HasCustomSeverity applies the HasEdge predicate on the "custom_severity" edge. -func HasCustomSeverity() predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(CustomSeverityTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, CustomSeverityTable, CustomSeverityColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasCustomSeverityWith applies the HasEdge predicate on the "custom_severity" edge with a given conditions (other predicates). -func HasCustomSeverityWith(preds ...predicate.Severity) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(CustomSeverityInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, CustomSeverityTable, CustomSeverityColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.Vulnerability) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.Vulnerability) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.Vulnerability) predicate.Vulnerability { - return predicate.Vulnerability(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/vulnerability_create.go b/pkg/infra/ent/vulnerability_create.go deleted file mode 100644 index e0fafcf..0000000 --- a/pkg/infra/ent/vulnerability_create.go +++ /dev/null @@ -1,1133 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// VulnerabilityCreate is the builder for creating a Vulnerability entity. -type VulnerabilityCreate struct { - config - mutation *VulnerabilityMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetFirstSeenAt sets the "first_seen_at" field. -func (vc *VulnerabilityCreate) SetFirstSeenAt(i int64) *VulnerabilityCreate { - vc.mutation.SetFirstSeenAt(i) - return vc -} - -// SetLastModifiedAt sets the "last_modified_at" field. -func (vc *VulnerabilityCreate) SetLastModifiedAt(i int64) *VulnerabilityCreate { - vc.mutation.SetLastModifiedAt(i) - return vc -} - -// SetTitle sets the "title" field. -func (vc *VulnerabilityCreate) SetTitle(s string) *VulnerabilityCreate { - vc.mutation.SetTitle(s) - return vc -} - -// SetNillableTitle sets the "title" field if the given value is not nil. -func (vc *VulnerabilityCreate) SetNillableTitle(s *string) *VulnerabilityCreate { - if s != nil { - vc.SetTitle(*s) - } - return vc -} - -// SetDescription sets the "description" field. -func (vc *VulnerabilityCreate) SetDescription(s string) *VulnerabilityCreate { - vc.mutation.SetDescription(s) - return vc -} - -// SetNillableDescription sets the "description" field if the given value is not nil. -func (vc *VulnerabilityCreate) SetNillableDescription(s *string) *VulnerabilityCreate { - if s != nil { - vc.SetDescription(*s) - } - return vc -} - -// SetCweID sets the "cwe_id" field. -func (vc *VulnerabilityCreate) SetCweID(s []string) *VulnerabilityCreate { - vc.mutation.SetCweID(s) - return vc -} - -// SetSeverity sets the "severity" field. -func (vc *VulnerabilityCreate) SetSeverity(s string) *VulnerabilityCreate { - vc.mutation.SetSeverity(s) - return vc -} - -// SetNillableSeverity sets the "severity" field if the given value is not nil. -func (vc *VulnerabilityCreate) SetNillableSeverity(s *string) *VulnerabilityCreate { - if s != nil { - vc.SetSeverity(*s) - } - return vc -} - -// SetCvss sets the "cvss" field. -func (vc *VulnerabilityCreate) SetCvss(s []string) *VulnerabilityCreate { - vc.mutation.SetCvss(s) - return vc -} - -// SetReferences sets the "references" field. -func (vc *VulnerabilityCreate) SetReferences(s []string) *VulnerabilityCreate { - vc.mutation.SetReferences(s) - return vc -} - -// SetID sets the "id" field. -func (vc *VulnerabilityCreate) SetID(s string) *VulnerabilityCreate { - vc.mutation.SetID(s) - return vc -} - -// AddPackageIDs adds the "packages" edge to the PackageRecord entity by IDs. -func (vc *VulnerabilityCreate) AddPackageIDs(ids ...int) *VulnerabilityCreate { - vc.mutation.AddPackageIDs(ids...) - return vc -} - -// AddPackages adds the "packages" edges to the PackageRecord entity. -func (vc *VulnerabilityCreate) AddPackages(p ...*PackageRecord) *VulnerabilityCreate { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return vc.AddPackageIDs(ids...) -} - -// SetCustomSeverityID sets the "custom_severity" edge to the Severity entity by ID. -func (vc *VulnerabilityCreate) SetCustomSeverityID(id int) *VulnerabilityCreate { - vc.mutation.SetCustomSeverityID(id) - return vc -} - -// SetNillableCustomSeverityID sets the "custom_severity" edge to the Severity entity by ID if the given value is not nil. -func (vc *VulnerabilityCreate) SetNillableCustomSeverityID(id *int) *VulnerabilityCreate { - if id != nil { - vc = vc.SetCustomSeverityID(*id) - } - return vc -} - -// SetCustomSeverity sets the "custom_severity" edge to the Severity entity. -func (vc *VulnerabilityCreate) SetCustomSeverity(s *Severity) *VulnerabilityCreate { - return vc.SetCustomSeverityID(s.ID) -} - -// Mutation returns the VulnerabilityMutation object of the builder. -func (vc *VulnerabilityCreate) Mutation() *VulnerabilityMutation { - return vc.mutation -} - -// Save creates the Vulnerability in the database. -func (vc *VulnerabilityCreate) Save(ctx context.Context) (*Vulnerability, error) { - var ( - err error - node *Vulnerability - ) - if len(vc.hooks) == 0 { - if err = vc.check(); err != nil { - return nil, err - } - node, err = vc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnerabilityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = vc.check(); err != nil { - return nil, err - } - vc.mutation = mutation - if node, err = vc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(vc.hooks) - 1; i >= 0; i-- { - if vc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (vc *VulnerabilityCreate) SaveX(ctx context.Context) *Vulnerability { - v, err := vc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (vc *VulnerabilityCreate) Exec(ctx context.Context) error { - _, err := vc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vc *VulnerabilityCreate) ExecX(ctx context.Context) { - if err := vc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (vc *VulnerabilityCreate) check() error { - if _, ok := vc.mutation.FirstSeenAt(); !ok { - return &ValidationError{Name: "first_seen_at", err: errors.New(`ent: missing required field "first_seen_at"`)} - } - if _, ok := vc.mutation.LastModifiedAt(); !ok { - return &ValidationError{Name: "last_modified_at", err: errors.New(`ent: missing required field "last_modified_at"`)} - } - if v, ok := vc.mutation.ID(); ok { - if err := vulnerability.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`ent: validator failed for field "id": %w`, err)} - } - } - return nil -} - -func (vc *VulnerabilityCreate) sqlSave(ctx context.Context) (*Vulnerability, error) { - _node, _spec := vc.createSpec() - if err := sqlgraph.CreateNode(ctx, vc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - if _spec.ID.Value != nil { - _node.ID = _spec.ID.Value.(string) - } - return _node, nil -} - -func (vc *VulnerabilityCreate) createSpec() (*Vulnerability, *sqlgraph.CreateSpec) { - var ( - _node = &Vulnerability{config: vc.config} - _spec = &sqlgraph.CreateSpec{ - Table: vulnerability.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - } - ) - _spec.OnConflict = vc.conflict - if id, ok := vc.mutation.ID(); ok { - _node.ID = id - _spec.ID.Value = id - } - if value, ok := vc.mutation.FirstSeenAt(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldFirstSeenAt, - }) - _node.FirstSeenAt = value - } - if value, ok := vc.mutation.LastModifiedAt(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldLastModifiedAt, - }) - _node.LastModifiedAt = value - } - if value, ok := vc.mutation.Title(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnerability.FieldTitle, - }) - _node.Title = value - } - if value, ok := vc.mutation.Description(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnerability.FieldDescription, - }) - _node.Description = value - } - if value, ok := vc.mutation.CweID(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: vulnerability.FieldCweID, - }) - _node.CweID = value - } - if value, ok := vc.mutation.Severity(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnerability.FieldSeverity, - }) - _node.Severity = value - } - if value, ok := vc.mutation.Cvss(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: vulnerability.FieldCvss, - }) - _node.Cvss = value - } - if value, ok := vc.mutation.References(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: vulnerability.FieldReferences, - }) - _node.References = value - } - if nodes := vc.mutation.PackagesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: vulnerability.PackagesTable, - Columns: vulnerability.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - if nodes := vc.mutation.CustomSeverityIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnerability.CustomSeverityTable, - Columns: []string{vulnerability.CustomSeverityColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _node.vulnerability_custom_severity = &nodes[0] - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Vulnerability.Create(). -// SetFirstSeenAt(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.VulnerabilityUpsert) { -// SetFirstSeenAt(v+v). -// }). -// Exec(ctx) -// -func (vc *VulnerabilityCreate) OnConflict(opts ...sql.ConflictOption) *VulnerabilityUpsertOne { - vc.conflict = opts - return &VulnerabilityUpsertOne{ - create: vc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Vulnerability.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (vc *VulnerabilityCreate) OnConflictColumns(columns ...string) *VulnerabilityUpsertOne { - vc.conflict = append(vc.conflict, sql.ConflictColumns(columns...)) - return &VulnerabilityUpsertOne{ - create: vc, - } -} - -type ( - // VulnerabilityUpsertOne is the builder for "upsert"-ing - // one Vulnerability node. - VulnerabilityUpsertOne struct { - create *VulnerabilityCreate - } - - // VulnerabilityUpsert is the "OnConflict" setter. - VulnerabilityUpsert struct { - *sql.UpdateSet - } -) - -// SetFirstSeenAt sets the "first_seen_at" field. -func (u *VulnerabilityUpsert) SetFirstSeenAt(v int64) *VulnerabilityUpsert { - u.Set(vulnerability.FieldFirstSeenAt, v) - return u -} - -// UpdateFirstSeenAt sets the "first_seen_at" field to the value that was provided on create. -func (u *VulnerabilityUpsert) UpdateFirstSeenAt() *VulnerabilityUpsert { - u.SetExcluded(vulnerability.FieldFirstSeenAt) - return u -} - -// SetLastModifiedAt sets the "last_modified_at" field. -func (u *VulnerabilityUpsert) SetLastModifiedAt(v int64) *VulnerabilityUpsert { - u.Set(vulnerability.FieldLastModifiedAt, v) - return u -} - -// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. -func (u *VulnerabilityUpsert) UpdateLastModifiedAt() *VulnerabilityUpsert { - u.SetExcluded(vulnerability.FieldLastModifiedAt) - return u -} - -// SetTitle sets the "title" field. -func (u *VulnerabilityUpsert) SetTitle(v string) *VulnerabilityUpsert { - u.Set(vulnerability.FieldTitle, v) - return u -} - -// UpdateTitle sets the "title" field to the value that was provided on create. -func (u *VulnerabilityUpsert) UpdateTitle() *VulnerabilityUpsert { - u.SetExcluded(vulnerability.FieldTitle) - return u -} - -// ClearTitle clears the value of the "title" field. -func (u *VulnerabilityUpsert) ClearTitle() *VulnerabilityUpsert { - u.SetNull(vulnerability.FieldTitle) - return u -} - -// SetDescription sets the "description" field. -func (u *VulnerabilityUpsert) SetDescription(v string) *VulnerabilityUpsert { - u.Set(vulnerability.FieldDescription, v) - return u -} - -// UpdateDescription sets the "description" field to the value that was provided on create. -func (u *VulnerabilityUpsert) UpdateDescription() *VulnerabilityUpsert { - u.SetExcluded(vulnerability.FieldDescription) - return u -} - -// ClearDescription clears the value of the "description" field. -func (u *VulnerabilityUpsert) ClearDescription() *VulnerabilityUpsert { - u.SetNull(vulnerability.FieldDescription) - return u -} - -// SetCweID sets the "cwe_id" field. -func (u *VulnerabilityUpsert) SetCweID(v []string) *VulnerabilityUpsert { - u.Set(vulnerability.FieldCweID, v) - return u -} - -// UpdateCweID sets the "cwe_id" field to the value that was provided on create. -func (u *VulnerabilityUpsert) UpdateCweID() *VulnerabilityUpsert { - u.SetExcluded(vulnerability.FieldCweID) - return u -} - -// ClearCweID clears the value of the "cwe_id" field. -func (u *VulnerabilityUpsert) ClearCweID() *VulnerabilityUpsert { - u.SetNull(vulnerability.FieldCweID) - return u -} - -// SetSeverity sets the "severity" field. -func (u *VulnerabilityUpsert) SetSeverity(v string) *VulnerabilityUpsert { - u.Set(vulnerability.FieldSeverity, v) - return u -} - -// UpdateSeverity sets the "severity" field to the value that was provided on create. -func (u *VulnerabilityUpsert) UpdateSeverity() *VulnerabilityUpsert { - u.SetExcluded(vulnerability.FieldSeverity) - return u -} - -// ClearSeverity clears the value of the "severity" field. -func (u *VulnerabilityUpsert) ClearSeverity() *VulnerabilityUpsert { - u.SetNull(vulnerability.FieldSeverity) - return u -} - -// SetCvss sets the "cvss" field. -func (u *VulnerabilityUpsert) SetCvss(v []string) *VulnerabilityUpsert { - u.Set(vulnerability.FieldCvss, v) - return u -} - -// UpdateCvss sets the "cvss" field to the value that was provided on create. -func (u *VulnerabilityUpsert) UpdateCvss() *VulnerabilityUpsert { - u.SetExcluded(vulnerability.FieldCvss) - return u -} - -// ClearCvss clears the value of the "cvss" field. -func (u *VulnerabilityUpsert) ClearCvss() *VulnerabilityUpsert { - u.SetNull(vulnerability.FieldCvss) - return u -} - -// SetReferences sets the "references" field. -func (u *VulnerabilityUpsert) SetReferences(v []string) *VulnerabilityUpsert { - u.Set(vulnerability.FieldReferences, v) - return u -} - -// UpdateReferences sets the "references" field to the value that was provided on create. -func (u *VulnerabilityUpsert) UpdateReferences() *VulnerabilityUpsert { - u.SetExcluded(vulnerability.FieldReferences) - return u -} - -// ClearReferences clears the value of the "references" field. -func (u *VulnerabilityUpsert) ClearReferences() *VulnerabilityUpsert { - u.SetNull(vulnerability.FieldReferences) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create except the ID field. -// Using this option is equivalent to using: -// -// client.Vulnerability.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(vulnerability.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *VulnerabilityUpsertOne) UpdateNewValues() *VulnerabilityUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - if _, exists := u.create.mutation.ID(); exists { - s.SetIgnore(vulnerability.FieldID) - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Vulnerability.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *VulnerabilityUpsertOne) Ignore() *VulnerabilityUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *VulnerabilityUpsertOne) DoNothing() *VulnerabilityUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the VulnerabilityCreate.OnConflict -// documentation for more info. -func (u *VulnerabilityUpsertOne) Update(set func(*VulnerabilityUpsert)) *VulnerabilityUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&VulnerabilityUpsert{UpdateSet: update}) - })) - return u -} - -// SetFirstSeenAt sets the "first_seen_at" field. -func (u *VulnerabilityUpsertOne) SetFirstSeenAt(v int64) *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetFirstSeenAt(v) - }) -} - -// UpdateFirstSeenAt sets the "first_seen_at" field to the value that was provided on create. -func (u *VulnerabilityUpsertOne) UpdateFirstSeenAt() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateFirstSeenAt() - }) -} - -// SetLastModifiedAt sets the "last_modified_at" field. -func (u *VulnerabilityUpsertOne) SetLastModifiedAt(v int64) *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetLastModifiedAt(v) - }) -} - -// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. -func (u *VulnerabilityUpsertOne) UpdateLastModifiedAt() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateLastModifiedAt() - }) -} - -// SetTitle sets the "title" field. -func (u *VulnerabilityUpsertOne) SetTitle(v string) *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetTitle(v) - }) -} - -// UpdateTitle sets the "title" field to the value that was provided on create. -func (u *VulnerabilityUpsertOne) UpdateTitle() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateTitle() - }) -} - -// ClearTitle clears the value of the "title" field. -func (u *VulnerabilityUpsertOne) ClearTitle() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearTitle() - }) -} - -// SetDescription sets the "description" field. -func (u *VulnerabilityUpsertOne) SetDescription(v string) *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetDescription(v) - }) -} - -// UpdateDescription sets the "description" field to the value that was provided on create. -func (u *VulnerabilityUpsertOne) UpdateDescription() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateDescription() - }) -} - -// ClearDescription clears the value of the "description" field. -func (u *VulnerabilityUpsertOne) ClearDescription() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearDescription() - }) -} - -// SetCweID sets the "cwe_id" field. -func (u *VulnerabilityUpsertOne) SetCweID(v []string) *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetCweID(v) - }) -} - -// UpdateCweID sets the "cwe_id" field to the value that was provided on create. -func (u *VulnerabilityUpsertOne) UpdateCweID() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateCweID() - }) -} - -// ClearCweID clears the value of the "cwe_id" field. -func (u *VulnerabilityUpsertOne) ClearCweID() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearCweID() - }) -} - -// SetSeverity sets the "severity" field. -func (u *VulnerabilityUpsertOne) SetSeverity(v string) *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetSeverity(v) - }) -} - -// UpdateSeverity sets the "severity" field to the value that was provided on create. -func (u *VulnerabilityUpsertOne) UpdateSeverity() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateSeverity() - }) -} - -// ClearSeverity clears the value of the "severity" field. -func (u *VulnerabilityUpsertOne) ClearSeverity() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearSeverity() - }) -} - -// SetCvss sets the "cvss" field. -func (u *VulnerabilityUpsertOne) SetCvss(v []string) *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetCvss(v) - }) -} - -// UpdateCvss sets the "cvss" field to the value that was provided on create. -func (u *VulnerabilityUpsertOne) UpdateCvss() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateCvss() - }) -} - -// ClearCvss clears the value of the "cvss" field. -func (u *VulnerabilityUpsertOne) ClearCvss() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearCvss() - }) -} - -// SetReferences sets the "references" field. -func (u *VulnerabilityUpsertOne) SetReferences(v []string) *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetReferences(v) - }) -} - -// UpdateReferences sets the "references" field to the value that was provided on create. -func (u *VulnerabilityUpsertOne) UpdateReferences() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateReferences() - }) -} - -// ClearReferences clears the value of the "references" field. -func (u *VulnerabilityUpsertOne) ClearReferences() *VulnerabilityUpsertOne { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearReferences() - }) -} - -// Exec executes the query. -func (u *VulnerabilityUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for VulnerabilityCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *VulnerabilityUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *VulnerabilityUpsertOne) ID(ctx context.Context) (id string, err error) { - if u.create.driver.Dialect() == dialect.MySQL { - // In case of "ON CONFLICT", there is no way to get back non-numeric ID - // fields from the database since MySQL does not support the RETURNING clause. - return id, errors.New("ent: VulnerabilityUpsertOne.ID is not supported by MySQL driver. Use VulnerabilityUpsertOne.Exec instead") - } - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *VulnerabilityUpsertOne) IDX(ctx context.Context) string { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// VulnerabilityCreateBulk is the builder for creating many Vulnerability entities in bulk. -type VulnerabilityCreateBulk struct { - config - builders []*VulnerabilityCreate - conflict []sql.ConflictOption -} - -// Save creates the Vulnerability entities in the database. -func (vcb *VulnerabilityCreateBulk) Save(ctx context.Context) ([]*Vulnerability, error) { - specs := make([]*sqlgraph.CreateSpec, len(vcb.builders)) - nodes := make([]*Vulnerability, len(vcb.builders)) - mutators := make([]Mutator, len(vcb.builders)) - for i := range vcb.builders { - func(i int, root context.Context) { - builder := vcb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnerabilityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, vcb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = vcb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, vcb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, vcb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (vcb *VulnerabilityCreateBulk) SaveX(ctx context.Context) []*Vulnerability { - v, err := vcb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (vcb *VulnerabilityCreateBulk) Exec(ctx context.Context) error { - _, err := vcb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vcb *VulnerabilityCreateBulk) ExecX(ctx context.Context) { - if err := vcb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.Vulnerability.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.VulnerabilityUpsert) { -// SetFirstSeenAt(v+v). -// }). -// Exec(ctx) -// -func (vcb *VulnerabilityCreateBulk) OnConflict(opts ...sql.ConflictOption) *VulnerabilityUpsertBulk { - vcb.conflict = opts - return &VulnerabilityUpsertBulk{ - create: vcb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.Vulnerability.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (vcb *VulnerabilityCreateBulk) OnConflictColumns(columns ...string) *VulnerabilityUpsertBulk { - vcb.conflict = append(vcb.conflict, sql.ConflictColumns(columns...)) - return &VulnerabilityUpsertBulk{ - create: vcb, - } -} - -// VulnerabilityUpsertBulk is the builder for "upsert"-ing -// a bulk of Vulnerability nodes. -type VulnerabilityUpsertBulk struct { - create *VulnerabilityCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.Vulnerability.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(vulnerability.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *VulnerabilityUpsertBulk) UpdateNewValues() *VulnerabilityUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - for _, b := range u.create.builders { - if _, exists := b.mutation.ID(); exists { - s.SetIgnore(vulnerability.FieldID) - return - } - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.Vulnerability.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *VulnerabilityUpsertBulk) Ignore() *VulnerabilityUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *VulnerabilityUpsertBulk) DoNothing() *VulnerabilityUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the VulnerabilityCreateBulk.OnConflict -// documentation for more info. -func (u *VulnerabilityUpsertBulk) Update(set func(*VulnerabilityUpsert)) *VulnerabilityUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&VulnerabilityUpsert{UpdateSet: update}) - })) - return u -} - -// SetFirstSeenAt sets the "first_seen_at" field. -func (u *VulnerabilityUpsertBulk) SetFirstSeenAt(v int64) *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetFirstSeenAt(v) - }) -} - -// UpdateFirstSeenAt sets the "first_seen_at" field to the value that was provided on create. -func (u *VulnerabilityUpsertBulk) UpdateFirstSeenAt() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateFirstSeenAt() - }) -} - -// SetLastModifiedAt sets the "last_modified_at" field. -func (u *VulnerabilityUpsertBulk) SetLastModifiedAt(v int64) *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetLastModifiedAt(v) - }) -} - -// UpdateLastModifiedAt sets the "last_modified_at" field to the value that was provided on create. -func (u *VulnerabilityUpsertBulk) UpdateLastModifiedAt() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateLastModifiedAt() - }) -} - -// SetTitle sets the "title" field. -func (u *VulnerabilityUpsertBulk) SetTitle(v string) *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetTitle(v) - }) -} - -// UpdateTitle sets the "title" field to the value that was provided on create. -func (u *VulnerabilityUpsertBulk) UpdateTitle() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateTitle() - }) -} - -// ClearTitle clears the value of the "title" field. -func (u *VulnerabilityUpsertBulk) ClearTitle() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearTitle() - }) -} - -// SetDescription sets the "description" field. -func (u *VulnerabilityUpsertBulk) SetDescription(v string) *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetDescription(v) - }) -} - -// UpdateDescription sets the "description" field to the value that was provided on create. -func (u *VulnerabilityUpsertBulk) UpdateDescription() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateDescription() - }) -} - -// ClearDescription clears the value of the "description" field. -func (u *VulnerabilityUpsertBulk) ClearDescription() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearDescription() - }) -} - -// SetCweID sets the "cwe_id" field. -func (u *VulnerabilityUpsertBulk) SetCweID(v []string) *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetCweID(v) - }) -} - -// UpdateCweID sets the "cwe_id" field to the value that was provided on create. -func (u *VulnerabilityUpsertBulk) UpdateCweID() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateCweID() - }) -} - -// ClearCweID clears the value of the "cwe_id" field. -func (u *VulnerabilityUpsertBulk) ClearCweID() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearCweID() - }) -} - -// SetSeverity sets the "severity" field. -func (u *VulnerabilityUpsertBulk) SetSeverity(v string) *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetSeverity(v) - }) -} - -// UpdateSeverity sets the "severity" field to the value that was provided on create. -func (u *VulnerabilityUpsertBulk) UpdateSeverity() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateSeverity() - }) -} - -// ClearSeverity clears the value of the "severity" field. -func (u *VulnerabilityUpsertBulk) ClearSeverity() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearSeverity() - }) -} - -// SetCvss sets the "cvss" field. -func (u *VulnerabilityUpsertBulk) SetCvss(v []string) *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetCvss(v) - }) -} - -// UpdateCvss sets the "cvss" field to the value that was provided on create. -func (u *VulnerabilityUpsertBulk) UpdateCvss() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateCvss() - }) -} - -// ClearCvss clears the value of the "cvss" field. -func (u *VulnerabilityUpsertBulk) ClearCvss() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearCvss() - }) -} - -// SetReferences sets the "references" field. -func (u *VulnerabilityUpsertBulk) SetReferences(v []string) *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.SetReferences(v) - }) -} - -// UpdateReferences sets the "references" field to the value that was provided on create. -func (u *VulnerabilityUpsertBulk) UpdateReferences() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.UpdateReferences() - }) -} - -// ClearReferences clears the value of the "references" field. -func (u *VulnerabilityUpsertBulk) ClearReferences() *VulnerabilityUpsertBulk { - return u.Update(func(s *VulnerabilityUpsert) { - s.ClearReferences() - }) -} - -// Exec executes the query. -func (u *VulnerabilityUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the VulnerabilityCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for VulnerabilityCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *VulnerabilityUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/vulnerability_delete.go b/pkg/infra/ent/vulnerability_delete.go deleted file mode 100644 index abbb85b..0000000 --- a/pkg/infra/ent/vulnerability_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// VulnerabilityDelete is the builder for deleting a Vulnerability entity. -type VulnerabilityDelete struct { - config - hooks []Hook - mutation *VulnerabilityMutation -} - -// Where appends a list predicates to the VulnerabilityDelete builder. -func (vd *VulnerabilityDelete) Where(ps ...predicate.Vulnerability) *VulnerabilityDelete { - vd.mutation.Where(ps...) - return vd -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (vd *VulnerabilityDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(vd.hooks) == 0 { - affected, err = vd.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnerabilityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - vd.mutation = mutation - affected, err = vd.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(vd.hooks) - 1; i >= 0; i-- { - if vd.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vd.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vd.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vd *VulnerabilityDelete) ExecX(ctx context.Context) int { - n, err := vd.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (vd *VulnerabilityDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnerability.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - if ps := vd.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, vd.driver, _spec) -} - -// VulnerabilityDeleteOne is the builder for deleting a single Vulnerability entity. -type VulnerabilityDeleteOne struct { - vd *VulnerabilityDelete -} - -// Exec executes the deletion query. -func (vdo *VulnerabilityDeleteOne) Exec(ctx context.Context) error { - n, err := vdo.vd.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{vulnerability.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (vdo *VulnerabilityDeleteOne) ExecX(ctx context.Context) { - vdo.vd.ExecX(ctx) -} diff --git a/pkg/infra/ent/vulnerability_query.go b/pkg/infra/ent/vulnerability_query.go deleted file mode 100644 index a29f0f3..0000000 --- a/pkg/infra/ent/vulnerability_query.go +++ /dev/null @@ -1,1097 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "database/sql/driver" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// VulnerabilityQuery is the builder for querying Vulnerability entities. -type VulnerabilityQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.Vulnerability - // eager-loading edges. - withPackages *PackageRecordQuery - withCustomSeverity *SeverityQuery - withFKs bool - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the VulnerabilityQuery builder. -func (vq *VulnerabilityQuery) Where(ps ...predicate.Vulnerability) *VulnerabilityQuery { - vq.predicates = append(vq.predicates, ps...) - return vq -} - -// Limit adds a limit step to the query. -func (vq *VulnerabilityQuery) Limit(limit int) *VulnerabilityQuery { - vq.limit = &limit - return vq -} - -// Offset adds an offset step to the query. -func (vq *VulnerabilityQuery) Offset(offset int) *VulnerabilityQuery { - vq.offset = &offset - return vq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (vq *VulnerabilityQuery) Unique(unique bool) *VulnerabilityQuery { - vq.unique = &unique - return vq -} - -// Order adds an order step to the query. -func (vq *VulnerabilityQuery) Order(o ...OrderFunc) *VulnerabilityQuery { - vq.order = append(vq.order, o...) - return vq -} - -// QueryPackages chains the current query on the "packages" edge. -func (vq *VulnerabilityQuery) QueryPackages() *PackageRecordQuery { - query := &PackageRecordQuery{config: vq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := vq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := vq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(vulnerability.Table, vulnerability.FieldID, selector), - sqlgraph.To(packagerecord.Table, packagerecord.FieldID), - sqlgraph.Edge(sqlgraph.M2M, true, vulnerability.PackagesTable, vulnerability.PackagesPrimaryKey...), - ) - fromU = sqlgraph.SetNeighbors(vq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// QueryCustomSeverity chains the current query on the "custom_severity" edge. -func (vq *VulnerabilityQuery) QueryCustomSeverity() *SeverityQuery { - query := &SeverityQuery{config: vq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := vq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := vq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(vulnerability.Table, vulnerability.FieldID, selector), - sqlgraph.To(severity.Table, severity.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, vulnerability.CustomSeverityTable, vulnerability.CustomSeverityColumn), - ) - fromU = sqlgraph.SetNeighbors(vq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first Vulnerability entity from the query. -// Returns a *NotFoundError when no Vulnerability was found. -func (vq *VulnerabilityQuery) First(ctx context.Context) (*Vulnerability, error) { - nodes, err := vq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{vulnerability.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (vq *VulnerabilityQuery) FirstX(ctx context.Context) *Vulnerability { - node, err := vq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first Vulnerability ID from the query. -// Returns a *NotFoundError when no Vulnerability ID was found. -func (vq *VulnerabilityQuery) FirstID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = vq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{vulnerability.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (vq *VulnerabilityQuery) FirstIDX(ctx context.Context) string { - id, err := vq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single Vulnerability entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one Vulnerability entity is not found. -// Returns a *NotFoundError when no Vulnerability entities are found. -func (vq *VulnerabilityQuery) Only(ctx context.Context) (*Vulnerability, error) { - nodes, err := vq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{vulnerability.Label} - default: - return nil, &NotSingularError{vulnerability.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (vq *VulnerabilityQuery) OnlyX(ctx context.Context) *Vulnerability { - node, err := vq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only Vulnerability ID in the query. -// Returns a *NotSingularError when exactly one Vulnerability ID is not found. -// Returns a *NotFoundError when no entities are found. -func (vq *VulnerabilityQuery) OnlyID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = vq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{vulnerability.Label} - default: - err = &NotSingularError{vulnerability.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (vq *VulnerabilityQuery) OnlyIDX(ctx context.Context) string { - id, err := vq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of Vulnerabilities. -func (vq *VulnerabilityQuery) All(ctx context.Context) ([]*Vulnerability, error) { - if err := vq.prepareQuery(ctx); err != nil { - return nil, err - } - return vq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (vq *VulnerabilityQuery) AllX(ctx context.Context) []*Vulnerability { - nodes, err := vq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of Vulnerability IDs. -func (vq *VulnerabilityQuery) IDs(ctx context.Context) ([]string, error) { - var ids []string - if err := vq.Select(vulnerability.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (vq *VulnerabilityQuery) IDsX(ctx context.Context) []string { - ids, err := vq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (vq *VulnerabilityQuery) Count(ctx context.Context) (int, error) { - if err := vq.prepareQuery(ctx); err != nil { - return 0, err - } - return vq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (vq *VulnerabilityQuery) CountX(ctx context.Context) int { - count, err := vq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (vq *VulnerabilityQuery) Exist(ctx context.Context) (bool, error) { - if err := vq.prepareQuery(ctx); err != nil { - return false, err - } - return vq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (vq *VulnerabilityQuery) ExistX(ctx context.Context) bool { - exist, err := vq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the VulnerabilityQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (vq *VulnerabilityQuery) Clone() *VulnerabilityQuery { - if vq == nil { - return nil - } - return &VulnerabilityQuery{ - config: vq.config, - limit: vq.limit, - offset: vq.offset, - order: append([]OrderFunc{}, vq.order...), - predicates: append([]predicate.Vulnerability{}, vq.predicates...), - withPackages: vq.withPackages.Clone(), - withCustomSeverity: vq.withCustomSeverity.Clone(), - // clone intermediate query. - sql: vq.sql.Clone(), - path: vq.path, - } -} - -// WithPackages tells the query-builder to eager-load the nodes that are connected to -// the "packages" edge. The optional arguments are used to configure the query builder of the edge. -func (vq *VulnerabilityQuery) WithPackages(opts ...func(*PackageRecordQuery)) *VulnerabilityQuery { - query := &PackageRecordQuery{config: vq.config} - for _, opt := range opts { - opt(query) - } - vq.withPackages = query - return vq -} - -// WithCustomSeverity tells the query-builder to eager-load the nodes that are connected to -// the "custom_severity" edge. The optional arguments are used to configure the query builder of the edge. -func (vq *VulnerabilityQuery) WithCustomSeverity(opts ...func(*SeverityQuery)) *VulnerabilityQuery { - query := &SeverityQuery{config: vq.config} - for _, opt := range opts { - opt(query) - } - vq.withCustomSeverity = query - return vq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// FirstSeenAt int64 `json:"first_seen_at,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.Vulnerability.Query(). -// GroupBy(vulnerability.FieldFirstSeenAt). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (vq *VulnerabilityQuery) GroupBy(field string, fields ...string) *VulnerabilityGroupBy { - group := &VulnerabilityGroupBy{config: vq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := vq.prepareQuery(ctx); err != nil { - return nil, err - } - return vq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// FirstSeenAt int64 `json:"first_seen_at,omitempty"` -// } -// -// client.Vulnerability.Query(). -// Select(vulnerability.FieldFirstSeenAt). -// Scan(ctx, &v) -// -func (vq *VulnerabilityQuery) Select(fields ...string) *VulnerabilitySelect { - vq.fields = append(vq.fields, fields...) - return &VulnerabilitySelect{VulnerabilityQuery: vq} -} - -func (vq *VulnerabilityQuery) prepareQuery(ctx context.Context) error { - for _, f := range vq.fields { - if !vulnerability.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if vq.path != nil { - prev, err := vq.path(ctx) - if err != nil { - return err - } - vq.sql = prev - } - return nil -} - -func (vq *VulnerabilityQuery) sqlAll(ctx context.Context) ([]*Vulnerability, error) { - var ( - nodes = []*Vulnerability{} - withFKs = vq.withFKs - _spec = vq.querySpec() - loadedTypes = [2]bool{ - vq.withPackages != nil, - vq.withCustomSeverity != nil, - } - ) - if vq.withCustomSeverity != nil { - withFKs = true - } - if withFKs { - _spec.Node.Columns = append(_spec.Node.Columns, vulnerability.ForeignKeys...) - } - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Vulnerability{config: vq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, vq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := vq.withPackages; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[string]*Vulnerability, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Packages = []*PackageRecord{} - } - var ( - edgeids []int - edges = make(map[int][]*Vulnerability) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: true, - Table: vulnerability.PackagesTable, - Columns: vulnerability.PackagesPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(vulnerability.PackagesPrimaryKey[1], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullString), new(sql.NullInt64)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullString) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullInt64) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := eout.String - inValue := int(ein.Int64) - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, vq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "packages": %w`, err) - } - query.Where(packagerecord.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "packages" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Packages = append(nodes[i].Edges.Packages, n) - } - } - } - - if query := vq.withCustomSeverity; query != nil { - ids := make([]int, 0, len(nodes)) - nodeids := make(map[int][]*Vulnerability) - for i := range nodes { - if nodes[i].vulnerability_custom_severity == nil { - continue - } - fk := *nodes[i].vulnerability_custom_severity - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(severity.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "vulnerability_custom_severity" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.CustomSeverity = n - } - } - } - - return nodes, nil -} - -func (vq *VulnerabilityQuery) sqlCount(ctx context.Context) (int, error) { - _spec := vq.querySpec() - return sqlgraph.CountNodes(ctx, vq.driver, _spec) -} - -func (vq *VulnerabilityQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := vq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (vq *VulnerabilityQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnerability.Table, - Columns: vulnerability.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - From: vq.sql, - Unique: true, - } - if unique := vq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := vq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, vulnerability.FieldID) - for i := range fields { - if fields[i] != vulnerability.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := vq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := vq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := vq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := vq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (vq *VulnerabilityQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(vq.driver.Dialect()) - t1 := builder.Table(vulnerability.Table) - columns := vq.fields - if len(columns) == 0 { - columns = vulnerability.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if vq.sql != nil { - selector = vq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range vq.predicates { - p(selector) - } - for _, p := range vq.order { - p(selector) - } - if offset := vq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := vq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// VulnerabilityGroupBy is the group-by builder for Vulnerability entities. -type VulnerabilityGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (vgb *VulnerabilityGroupBy) Aggregate(fns ...AggregateFunc) *VulnerabilityGroupBy { - vgb.fns = append(vgb.fns, fns...) - return vgb -} - -// Scan applies the group-by query and scans the result into the given value. -func (vgb *VulnerabilityGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := vgb.path(ctx) - if err != nil { - return err - } - vgb.sql = query - return vgb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (vgb *VulnerabilityGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := vgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (vgb *VulnerabilityGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(vgb.fields) > 1 { - return nil, errors.New("ent: VulnerabilityGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := vgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (vgb *VulnerabilityGroupBy) StringsX(ctx context.Context) []string { - v, err := vgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vgb *VulnerabilityGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = vgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnerability.Label} - default: - err = fmt.Errorf("ent: VulnerabilityGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (vgb *VulnerabilityGroupBy) StringX(ctx context.Context) string { - v, err := vgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (vgb *VulnerabilityGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(vgb.fields) > 1 { - return nil, errors.New("ent: VulnerabilityGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := vgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (vgb *VulnerabilityGroupBy) IntsX(ctx context.Context) []int { - v, err := vgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vgb *VulnerabilityGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = vgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnerability.Label} - default: - err = fmt.Errorf("ent: VulnerabilityGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (vgb *VulnerabilityGroupBy) IntX(ctx context.Context) int { - v, err := vgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (vgb *VulnerabilityGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(vgb.fields) > 1 { - return nil, errors.New("ent: VulnerabilityGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := vgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (vgb *VulnerabilityGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := vgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vgb *VulnerabilityGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = vgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnerability.Label} - default: - err = fmt.Errorf("ent: VulnerabilityGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (vgb *VulnerabilityGroupBy) Float64X(ctx context.Context) float64 { - v, err := vgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (vgb *VulnerabilityGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(vgb.fields) > 1 { - return nil, errors.New("ent: VulnerabilityGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := vgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (vgb *VulnerabilityGroupBy) BoolsX(ctx context.Context) []bool { - v, err := vgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vgb *VulnerabilityGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = vgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnerability.Label} - default: - err = fmt.Errorf("ent: VulnerabilityGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (vgb *VulnerabilityGroupBy) BoolX(ctx context.Context) bool { - v, err := vgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (vgb *VulnerabilityGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range vgb.fields { - if !vulnerability.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := vgb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := vgb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (vgb *VulnerabilityGroupBy) sqlQuery() *sql.Selector { - selector := vgb.sql.Select() - aggregation := make([]string, 0, len(vgb.fns)) - for _, fn := range vgb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(vgb.fields)+len(vgb.fns)) - for _, f := range vgb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(vgb.fields...)...) -} - -// VulnerabilitySelect is the builder for selecting fields of Vulnerability entities. -type VulnerabilitySelect struct { - *VulnerabilityQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (vs *VulnerabilitySelect) Scan(ctx context.Context, v interface{}) error { - if err := vs.prepareQuery(ctx); err != nil { - return err - } - vs.sql = vs.VulnerabilityQuery.sqlQuery(ctx) - return vs.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (vs *VulnerabilitySelect) ScanX(ctx context.Context, v interface{}) { - if err := vs.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (vs *VulnerabilitySelect) Strings(ctx context.Context) ([]string, error) { - if len(vs.fields) > 1 { - return nil, errors.New("ent: VulnerabilitySelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := vs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (vs *VulnerabilitySelect) StringsX(ctx context.Context) []string { - v, err := vs.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (vs *VulnerabilitySelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = vs.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnerability.Label} - default: - err = fmt.Errorf("ent: VulnerabilitySelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (vs *VulnerabilitySelect) StringX(ctx context.Context) string { - v, err := vs.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (vs *VulnerabilitySelect) Ints(ctx context.Context) ([]int, error) { - if len(vs.fields) > 1 { - return nil, errors.New("ent: VulnerabilitySelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := vs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (vs *VulnerabilitySelect) IntsX(ctx context.Context) []int { - v, err := vs.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (vs *VulnerabilitySelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = vs.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnerability.Label} - default: - err = fmt.Errorf("ent: VulnerabilitySelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (vs *VulnerabilitySelect) IntX(ctx context.Context) int { - v, err := vs.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (vs *VulnerabilitySelect) Float64s(ctx context.Context) ([]float64, error) { - if len(vs.fields) > 1 { - return nil, errors.New("ent: VulnerabilitySelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := vs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (vs *VulnerabilitySelect) Float64sX(ctx context.Context) []float64 { - v, err := vs.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (vs *VulnerabilitySelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = vs.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnerability.Label} - default: - err = fmt.Errorf("ent: VulnerabilitySelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (vs *VulnerabilitySelect) Float64X(ctx context.Context) float64 { - v, err := vs.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (vs *VulnerabilitySelect) Bools(ctx context.Context) ([]bool, error) { - if len(vs.fields) > 1 { - return nil, errors.New("ent: VulnerabilitySelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := vs.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (vs *VulnerabilitySelect) BoolsX(ctx context.Context) []bool { - v, err := vs.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (vs *VulnerabilitySelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = vs.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnerability.Label} - default: - err = fmt.Errorf("ent: VulnerabilitySelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (vs *VulnerabilitySelect) BoolX(ctx context.Context) bool { - v, err := vs.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (vs *VulnerabilitySelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := vs.sql.Query() - if err := vs.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/vulnerability_update.go b/pkg/infra/ent/vulnerability_update.go deleted file mode 100644 index ca35d6c..0000000 --- a/pkg/infra/ent/vulnerability_update.go +++ /dev/null @@ -1,996 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/packagerecord" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/severity" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnerability" -) - -// VulnerabilityUpdate is the builder for updating Vulnerability entities. -type VulnerabilityUpdate struct { - config - hooks []Hook - mutation *VulnerabilityMutation -} - -// Where appends a list predicates to the VulnerabilityUpdate builder. -func (vu *VulnerabilityUpdate) Where(ps ...predicate.Vulnerability) *VulnerabilityUpdate { - vu.mutation.Where(ps...) - return vu -} - -// SetFirstSeenAt sets the "first_seen_at" field. -func (vu *VulnerabilityUpdate) SetFirstSeenAt(i int64) *VulnerabilityUpdate { - vu.mutation.ResetFirstSeenAt() - vu.mutation.SetFirstSeenAt(i) - return vu -} - -// AddFirstSeenAt adds i to the "first_seen_at" field. -func (vu *VulnerabilityUpdate) AddFirstSeenAt(i int64) *VulnerabilityUpdate { - vu.mutation.AddFirstSeenAt(i) - return vu -} - -// SetLastModifiedAt sets the "last_modified_at" field. -func (vu *VulnerabilityUpdate) SetLastModifiedAt(i int64) *VulnerabilityUpdate { - vu.mutation.ResetLastModifiedAt() - vu.mutation.SetLastModifiedAt(i) - return vu -} - -// AddLastModifiedAt adds i to the "last_modified_at" field. -func (vu *VulnerabilityUpdate) AddLastModifiedAt(i int64) *VulnerabilityUpdate { - vu.mutation.AddLastModifiedAt(i) - return vu -} - -// SetTitle sets the "title" field. -func (vu *VulnerabilityUpdate) SetTitle(s string) *VulnerabilityUpdate { - vu.mutation.SetTitle(s) - return vu -} - -// SetNillableTitle sets the "title" field if the given value is not nil. -func (vu *VulnerabilityUpdate) SetNillableTitle(s *string) *VulnerabilityUpdate { - if s != nil { - vu.SetTitle(*s) - } - return vu -} - -// ClearTitle clears the value of the "title" field. -func (vu *VulnerabilityUpdate) ClearTitle() *VulnerabilityUpdate { - vu.mutation.ClearTitle() - return vu -} - -// SetDescription sets the "description" field. -func (vu *VulnerabilityUpdate) SetDescription(s string) *VulnerabilityUpdate { - vu.mutation.SetDescription(s) - return vu -} - -// SetNillableDescription sets the "description" field if the given value is not nil. -func (vu *VulnerabilityUpdate) SetNillableDescription(s *string) *VulnerabilityUpdate { - if s != nil { - vu.SetDescription(*s) - } - return vu -} - -// ClearDescription clears the value of the "description" field. -func (vu *VulnerabilityUpdate) ClearDescription() *VulnerabilityUpdate { - vu.mutation.ClearDescription() - return vu -} - -// SetCweID sets the "cwe_id" field. -func (vu *VulnerabilityUpdate) SetCweID(s []string) *VulnerabilityUpdate { - vu.mutation.SetCweID(s) - return vu -} - -// ClearCweID clears the value of the "cwe_id" field. -func (vu *VulnerabilityUpdate) ClearCweID() *VulnerabilityUpdate { - vu.mutation.ClearCweID() - return vu -} - -// SetSeverity sets the "severity" field. -func (vu *VulnerabilityUpdate) SetSeverity(s string) *VulnerabilityUpdate { - vu.mutation.SetSeverity(s) - return vu -} - -// SetNillableSeverity sets the "severity" field if the given value is not nil. -func (vu *VulnerabilityUpdate) SetNillableSeverity(s *string) *VulnerabilityUpdate { - if s != nil { - vu.SetSeverity(*s) - } - return vu -} - -// ClearSeverity clears the value of the "severity" field. -func (vu *VulnerabilityUpdate) ClearSeverity() *VulnerabilityUpdate { - vu.mutation.ClearSeverity() - return vu -} - -// SetCvss sets the "cvss" field. -func (vu *VulnerabilityUpdate) SetCvss(s []string) *VulnerabilityUpdate { - vu.mutation.SetCvss(s) - return vu -} - -// ClearCvss clears the value of the "cvss" field. -func (vu *VulnerabilityUpdate) ClearCvss() *VulnerabilityUpdate { - vu.mutation.ClearCvss() - return vu -} - -// SetReferences sets the "references" field. -func (vu *VulnerabilityUpdate) SetReferences(s []string) *VulnerabilityUpdate { - vu.mutation.SetReferences(s) - return vu -} - -// ClearReferences clears the value of the "references" field. -func (vu *VulnerabilityUpdate) ClearReferences() *VulnerabilityUpdate { - vu.mutation.ClearReferences() - return vu -} - -// AddPackageIDs adds the "packages" edge to the PackageRecord entity by IDs. -func (vu *VulnerabilityUpdate) AddPackageIDs(ids ...int) *VulnerabilityUpdate { - vu.mutation.AddPackageIDs(ids...) - return vu -} - -// AddPackages adds the "packages" edges to the PackageRecord entity. -func (vu *VulnerabilityUpdate) AddPackages(p ...*PackageRecord) *VulnerabilityUpdate { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return vu.AddPackageIDs(ids...) -} - -// SetCustomSeverityID sets the "custom_severity" edge to the Severity entity by ID. -func (vu *VulnerabilityUpdate) SetCustomSeverityID(id int) *VulnerabilityUpdate { - vu.mutation.SetCustomSeverityID(id) - return vu -} - -// SetNillableCustomSeverityID sets the "custom_severity" edge to the Severity entity by ID if the given value is not nil. -func (vu *VulnerabilityUpdate) SetNillableCustomSeverityID(id *int) *VulnerabilityUpdate { - if id != nil { - vu = vu.SetCustomSeverityID(*id) - } - return vu -} - -// SetCustomSeverity sets the "custom_severity" edge to the Severity entity. -func (vu *VulnerabilityUpdate) SetCustomSeverity(s *Severity) *VulnerabilityUpdate { - return vu.SetCustomSeverityID(s.ID) -} - -// Mutation returns the VulnerabilityMutation object of the builder. -func (vu *VulnerabilityUpdate) Mutation() *VulnerabilityMutation { - return vu.mutation -} - -// ClearPackages clears all "packages" edges to the PackageRecord entity. -func (vu *VulnerabilityUpdate) ClearPackages() *VulnerabilityUpdate { - vu.mutation.ClearPackages() - return vu -} - -// RemovePackageIDs removes the "packages" edge to PackageRecord entities by IDs. -func (vu *VulnerabilityUpdate) RemovePackageIDs(ids ...int) *VulnerabilityUpdate { - vu.mutation.RemovePackageIDs(ids...) - return vu -} - -// RemovePackages removes "packages" edges to PackageRecord entities. -func (vu *VulnerabilityUpdate) RemovePackages(p ...*PackageRecord) *VulnerabilityUpdate { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return vu.RemovePackageIDs(ids...) -} - -// ClearCustomSeverity clears the "custom_severity" edge to the Severity entity. -func (vu *VulnerabilityUpdate) ClearCustomSeverity() *VulnerabilityUpdate { - vu.mutation.ClearCustomSeverity() - return vu -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (vu *VulnerabilityUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(vu.hooks) == 0 { - affected, err = vu.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnerabilityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - vu.mutation = mutation - affected, err = vu.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(vu.hooks) - 1; i >= 0; i-- { - if vu.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vu.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vu.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (vu *VulnerabilityUpdate) SaveX(ctx context.Context) int { - affected, err := vu.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (vu *VulnerabilityUpdate) Exec(ctx context.Context) error { - _, err := vu.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vu *VulnerabilityUpdate) ExecX(ctx context.Context) { - if err := vu.Exec(ctx); err != nil { - panic(err) - } -} - -func (vu *VulnerabilityUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnerability.Table, - Columns: vulnerability.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - if ps := vu.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := vu.mutation.FirstSeenAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldFirstSeenAt, - }) - } - if value, ok := vu.mutation.AddedFirstSeenAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldFirstSeenAt, - }) - } - if value, ok := vu.mutation.LastModifiedAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldLastModifiedAt, - }) - } - if value, ok := vu.mutation.AddedLastModifiedAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldLastModifiedAt, - }) - } - if value, ok := vu.mutation.Title(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnerability.FieldTitle, - }) - } - if vu.mutation.TitleCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldTitle, - }) - } - if value, ok := vu.mutation.Description(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnerability.FieldDescription, - }) - } - if vu.mutation.DescriptionCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldDescription, - }) - } - if value, ok := vu.mutation.CweID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: vulnerability.FieldCweID, - }) - } - if vu.mutation.CweIDCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Column: vulnerability.FieldCweID, - }) - } - if value, ok := vu.mutation.Severity(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnerability.FieldSeverity, - }) - } - if vu.mutation.SeverityCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldSeverity, - }) - } - if value, ok := vu.mutation.Cvss(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: vulnerability.FieldCvss, - }) - } - if vu.mutation.CvssCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Column: vulnerability.FieldCvss, - }) - } - if value, ok := vu.mutation.References(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: vulnerability.FieldReferences, - }) - } - if vu.mutation.ReferencesCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Column: vulnerability.FieldReferences, - }) - } - if vu.mutation.PackagesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: vulnerability.PackagesTable, - Columns: vulnerability.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vu.mutation.RemovedPackagesIDs(); len(nodes) > 0 && !vu.mutation.PackagesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: vulnerability.PackagesTable, - Columns: vulnerability.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vu.mutation.PackagesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: vulnerability.PackagesTable, - Columns: vulnerability.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if vu.mutation.CustomSeverityCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnerability.CustomSeverityTable, - Columns: []string{vulnerability.CustomSeverityColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vu.mutation.CustomSeverityIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnerability.CustomSeverityTable, - Columns: []string{vulnerability.CustomSeverityColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, vu.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{vulnerability.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// VulnerabilityUpdateOne is the builder for updating a single Vulnerability entity. -type VulnerabilityUpdateOne struct { - config - fields []string - hooks []Hook - mutation *VulnerabilityMutation -} - -// SetFirstSeenAt sets the "first_seen_at" field. -func (vuo *VulnerabilityUpdateOne) SetFirstSeenAt(i int64) *VulnerabilityUpdateOne { - vuo.mutation.ResetFirstSeenAt() - vuo.mutation.SetFirstSeenAt(i) - return vuo -} - -// AddFirstSeenAt adds i to the "first_seen_at" field. -func (vuo *VulnerabilityUpdateOne) AddFirstSeenAt(i int64) *VulnerabilityUpdateOne { - vuo.mutation.AddFirstSeenAt(i) - return vuo -} - -// SetLastModifiedAt sets the "last_modified_at" field. -func (vuo *VulnerabilityUpdateOne) SetLastModifiedAt(i int64) *VulnerabilityUpdateOne { - vuo.mutation.ResetLastModifiedAt() - vuo.mutation.SetLastModifiedAt(i) - return vuo -} - -// AddLastModifiedAt adds i to the "last_modified_at" field. -func (vuo *VulnerabilityUpdateOne) AddLastModifiedAt(i int64) *VulnerabilityUpdateOne { - vuo.mutation.AddLastModifiedAt(i) - return vuo -} - -// SetTitle sets the "title" field. -func (vuo *VulnerabilityUpdateOne) SetTitle(s string) *VulnerabilityUpdateOne { - vuo.mutation.SetTitle(s) - return vuo -} - -// SetNillableTitle sets the "title" field if the given value is not nil. -func (vuo *VulnerabilityUpdateOne) SetNillableTitle(s *string) *VulnerabilityUpdateOne { - if s != nil { - vuo.SetTitle(*s) - } - return vuo -} - -// ClearTitle clears the value of the "title" field. -func (vuo *VulnerabilityUpdateOne) ClearTitle() *VulnerabilityUpdateOne { - vuo.mutation.ClearTitle() - return vuo -} - -// SetDescription sets the "description" field. -func (vuo *VulnerabilityUpdateOne) SetDescription(s string) *VulnerabilityUpdateOne { - vuo.mutation.SetDescription(s) - return vuo -} - -// SetNillableDescription sets the "description" field if the given value is not nil. -func (vuo *VulnerabilityUpdateOne) SetNillableDescription(s *string) *VulnerabilityUpdateOne { - if s != nil { - vuo.SetDescription(*s) - } - return vuo -} - -// ClearDescription clears the value of the "description" field. -func (vuo *VulnerabilityUpdateOne) ClearDescription() *VulnerabilityUpdateOne { - vuo.mutation.ClearDescription() - return vuo -} - -// SetCweID sets the "cwe_id" field. -func (vuo *VulnerabilityUpdateOne) SetCweID(s []string) *VulnerabilityUpdateOne { - vuo.mutation.SetCweID(s) - return vuo -} - -// ClearCweID clears the value of the "cwe_id" field. -func (vuo *VulnerabilityUpdateOne) ClearCweID() *VulnerabilityUpdateOne { - vuo.mutation.ClearCweID() - return vuo -} - -// SetSeverity sets the "severity" field. -func (vuo *VulnerabilityUpdateOne) SetSeverity(s string) *VulnerabilityUpdateOne { - vuo.mutation.SetSeverity(s) - return vuo -} - -// SetNillableSeverity sets the "severity" field if the given value is not nil. -func (vuo *VulnerabilityUpdateOne) SetNillableSeverity(s *string) *VulnerabilityUpdateOne { - if s != nil { - vuo.SetSeverity(*s) - } - return vuo -} - -// ClearSeverity clears the value of the "severity" field. -func (vuo *VulnerabilityUpdateOne) ClearSeverity() *VulnerabilityUpdateOne { - vuo.mutation.ClearSeverity() - return vuo -} - -// SetCvss sets the "cvss" field. -func (vuo *VulnerabilityUpdateOne) SetCvss(s []string) *VulnerabilityUpdateOne { - vuo.mutation.SetCvss(s) - return vuo -} - -// ClearCvss clears the value of the "cvss" field. -func (vuo *VulnerabilityUpdateOne) ClearCvss() *VulnerabilityUpdateOne { - vuo.mutation.ClearCvss() - return vuo -} - -// SetReferences sets the "references" field. -func (vuo *VulnerabilityUpdateOne) SetReferences(s []string) *VulnerabilityUpdateOne { - vuo.mutation.SetReferences(s) - return vuo -} - -// ClearReferences clears the value of the "references" field. -func (vuo *VulnerabilityUpdateOne) ClearReferences() *VulnerabilityUpdateOne { - vuo.mutation.ClearReferences() - return vuo -} - -// AddPackageIDs adds the "packages" edge to the PackageRecord entity by IDs. -func (vuo *VulnerabilityUpdateOne) AddPackageIDs(ids ...int) *VulnerabilityUpdateOne { - vuo.mutation.AddPackageIDs(ids...) - return vuo -} - -// AddPackages adds the "packages" edges to the PackageRecord entity. -func (vuo *VulnerabilityUpdateOne) AddPackages(p ...*PackageRecord) *VulnerabilityUpdateOne { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return vuo.AddPackageIDs(ids...) -} - -// SetCustomSeverityID sets the "custom_severity" edge to the Severity entity by ID. -func (vuo *VulnerabilityUpdateOne) SetCustomSeverityID(id int) *VulnerabilityUpdateOne { - vuo.mutation.SetCustomSeverityID(id) - return vuo -} - -// SetNillableCustomSeverityID sets the "custom_severity" edge to the Severity entity by ID if the given value is not nil. -func (vuo *VulnerabilityUpdateOne) SetNillableCustomSeverityID(id *int) *VulnerabilityUpdateOne { - if id != nil { - vuo = vuo.SetCustomSeverityID(*id) - } - return vuo -} - -// SetCustomSeverity sets the "custom_severity" edge to the Severity entity. -func (vuo *VulnerabilityUpdateOne) SetCustomSeverity(s *Severity) *VulnerabilityUpdateOne { - return vuo.SetCustomSeverityID(s.ID) -} - -// Mutation returns the VulnerabilityMutation object of the builder. -func (vuo *VulnerabilityUpdateOne) Mutation() *VulnerabilityMutation { - return vuo.mutation -} - -// ClearPackages clears all "packages" edges to the PackageRecord entity. -func (vuo *VulnerabilityUpdateOne) ClearPackages() *VulnerabilityUpdateOne { - vuo.mutation.ClearPackages() - return vuo -} - -// RemovePackageIDs removes the "packages" edge to PackageRecord entities by IDs. -func (vuo *VulnerabilityUpdateOne) RemovePackageIDs(ids ...int) *VulnerabilityUpdateOne { - vuo.mutation.RemovePackageIDs(ids...) - return vuo -} - -// RemovePackages removes "packages" edges to PackageRecord entities. -func (vuo *VulnerabilityUpdateOne) RemovePackages(p ...*PackageRecord) *VulnerabilityUpdateOne { - ids := make([]int, len(p)) - for i := range p { - ids[i] = p[i].ID - } - return vuo.RemovePackageIDs(ids...) -} - -// ClearCustomSeverity clears the "custom_severity" edge to the Severity entity. -func (vuo *VulnerabilityUpdateOne) ClearCustomSeverity() *VulnerabilityUpdateOne { - vuo.mutation.ClearCustomSeverity() - return vuo -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (vuo *VulnerabilityUpdateOne) Select(field string, fields ...string) *VulnerabilityUpdateOne { - vuo.fields = append([]string{field}, fields...) - return vuo -} - -// Save executes the query and returns the updated Vulnerability entity. -func (vuo *VulnerabilityUpdateOne) Save(ctx context.Context) (*Vulnerability, error) { - var ( - err error - node *Vulnerability - ) - if len(vuo.hooks) == 0 { - node, err = vuo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnerabilityMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - vuo.mutation = mutation - node, err = vuo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(vuo.hooks) - 1; i >= 0; i-- { - if vuo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vuo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vuo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (vuo *VulnerabilityUpdateOne) SaveX(ctx context.Context) *Vulnerability { - node, err := vuo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (vuo *VulnerabilityUpdateOne) Exec(ctx context.Context) error { - _, err := vuo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vuo *VulnerabilityUpdateOne) ExecX(ctx context.Context) { - if err := vuo.Exec(ctx); err != nil { - panic(err) - } -} - -func (vuo *VulnerabilityUpdateOne) sqlSave(ctx context.Context) (_node *Vulnerability, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnerability.Table, - Columns: vulnerability.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldID, - }, - }, - } - id, ok := vuo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Vulnerability.ID for update")} - } - _spec.Node.ID.Value = id - if fields := vuo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, vulnerability.FieldID) - for _, f := range fields { - if !vulnerability.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != vulnerability.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := vuo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := vuo.mutation.FirstSeenAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldFirstSeenAt, - }) - } - if value, ok := vuo.mutation.AddedFirstSeenAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldFirstSeenAt, - }) - } - if value, ok := vuo.mutation.LastModifiedAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldLastModifiedAt, - }) - } - if value, ok := vuo.mutation.AddedLastModifiedAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnerability.FieldLastModifiedAt, - }) - } - if value, ok := vuo.mutation.Title(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnerability.FieldTitle, - }) - } - if vuo.mutation.TitleCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldTitle, - }) - } - if value, ok := vuo.mutation.Description(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnerability.FieldDescription, - }) - } - if vuo.mutation.DescriptionCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldDescription, - }) - } - if value, ok := vuo.mutation.CweID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: vulnerability.FieldCweID, - }) - } - if vuo.mutation.CweIDCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Column: vulnerability.FieldCweID, - }) - } - if value, ok := vuo.mutation.Severity(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnerability.FieldSeverity, - }) - } - if vuo.mutation.SeverityCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnerability.FieldSeverity, - }) - } - if value, ok := vuo.mutation.Cvss(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: vulnerability.FieldCvss, - }) - } - if vuo.mutation.CvssCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Column: vulnerability.FieldCvss, - }) - } - if value, ok := vuo.mutation.References(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Value: value, - Column: vulnerability.FieldReferences, - }) - } - if vuo.mutation.ReferencesCleared() { - _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ - Type: field.TypeJSON, - Column: vulnerability.FieldReferences, - }) - } - if vuo.mutation.PackagesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: vulnerability.PackagesTable, - Columns: vulnerability.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vuo.mutation.RemovedPackagesIDs(); len(nodes) > 0 && !vuo.mutation.PackagesCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: vulnerability.PackagesTable, - Columns: vulnerability.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vuo.mutation.PackagesIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2M, - Inverse: true, - Table: vulnerability.PackagesTable, - Columns: vulnerability.PackagesPrimaryKey, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: packagerecord.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if vuo.mutation.CustomSeverityCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnerability.CustomSeverityTable, - Columns: []string{vulnerability.CustomSeverityColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vuo.mutation.CustomSeverityIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnerability.CustomSeverityTable, - Columns: []string{vulnerability.CustomSeverityColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: severity.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &Vulnerability{config: vuo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, vuo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{vulnerability.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/vulnstatus.go b/pkg/infra/ent/vulnstatus.go deleted file mode 100644 index f8e5198..0000000 --- a/pkg/infra/ent/vulnstatus.go +++ /dev/null @@ -1,232 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/domain/types" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" -) - -// VulnStatus is the model entity for the VulnStatus schema. -type VulnStatus struct { - config `json:"-"` - // ID of the ent. - ID int `json:"id,omitempty"` - // Status holds the value of the "status" field. - Status types.VulnStatusType `json:"status,omitempty"` - // Source holds the value of the "source" field. - Source string `json:"source,omitempty"` - // PkgName holds the value of the "pkg_name" field. - PkgName string `json:"pkg_name,omitempty"` - // PkgType holds the value of the "pkg_type" field. - PkgType string `json:"pkg_type,omitempty"` - // VulnID holds the value of the "vuln_id" field. - VulnID string `json:"vuln_id,omitempty"` - // ExpiresAt holds the value of the "expires_at" field. - ExpiresAt int64 `json:"expires_at,omitempty"` - // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` - // Comment holds the value of the "comment" field. - Comment string `json:"comment,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the VulnStatusQuery when eager-loading is set. - Edges VulnStatusEdges `json:"edges"` - user_edited_status *int - vuln_status_author *int - vuln_status_index_status *string -} - -// VulnStatusEdges holds the relations/edges for other nodes in the graph. -type VulnStatusEdges struct { - // Author holds the value of the author edge. - Author *User `json:"author,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [1]bool -} - -// AuthorOrErr returns the Author value or an error if the edge -// was not loaded in eager-loading, or loaded but was not found. -func (e VulnStatusEdges) AuthorOrErr() (*User, error) { - if e.loadedTypes[0] { - if e.Author == nil { - // The edge author was loaded in eager-loading, - // but was not found. - return nil, &NotFoundError{label: user.Label} - } - return e.Author, nil - } - return nil, &NotLoadedError{edge: "author"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*VulnStatus) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case vulnstatus.FieldID, vulnstatus.FieldExpiresAt, vulnstatus.FieldCreatedAt: - values[i] = new(sql.NullInt64) - case vulnstatus.FieldStatus, vulnstatus.FieldSource, vulnstatus.FieldPkgName, vulnstatus.FieldPkgType, vulnstatus.FieldVulnID, vulnstatus.FieldComment: - values[i] = new(sql.NullString) - case vulnstatus.ForeignKeys[0]: // user_edited_status - values[i] = new(sql.NullInt64) - case vulnstatus.ForeignKeys[1]: // vuln_status_author - values[i] = new(sql.NullInt64) - case vulnstatus.ForeignKeys[2]: // vuln_status_index_status - values[i] = new(sql.NullString) - default: - return nil, fmt.Errorf("unexpected column %q for type VulnStatus", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the VulnStatus fields. -func (vs *VulnStatus) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case vulnstatus.FieldID: - value, ok := values[i].(*sql.NullInt64) - if !ok { - return fmt.Errorf("unexpected type %T for field id", value) - } - vs.ID = int(value.Int64) - case vulnstatus.FieldStatus: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field status", values[i]) - } else if value.Valid { - vs.Status = types.VulnStatusType(value.String) - } - case vulnstatus.FieldSource: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field source", values[i]) - } else if value.Valid { - vs.Source = value.String - } - case vulnstatus.FieldPkgName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field pkg_name", values[i]) - } else if value.Valid { - vs.PkgName = value.String - } - case vulnstatus.FieldPkgType: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field pkg_type", values[i]) - } else if value.Valid { - vs.PkgType = value.String - } - case vulnstatus.FieldVulnID: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field vuln_id", values[i]) - } else if value.Valid { - vs.VulnID = value.String - } - case vulnstatus.FieldExpiresAt: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field expires_at", values[i]) - } else if value.Valid { - vs.ExpiresAt = value.Int64 - } - case vulnstatus.FieldCreatedAt: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field created_at", values[i]) - } else if value.Valid { - vs.CreatedAt = value.Int64 - } - case vulnstatus.FieldComment: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field comment", values[i]) - } else if value.Valid { - vs.Comment = value.String - } - case vulnstatus.ForeignKeys[0]: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for edge-field user_edited_status", value) - } else if value.Valid { - vs.user_edited_status = new(int) - *vs.user_edited_status = int(value.Int64) - } - case vulnstatus.ForeignKeys[1]: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for edge-field vuln_status_author", value) - } else if value.Valid { - vs.vuln_status_author = new(int) - *vs.vuln_status_author = int(value.Int64) - } - case vulnstatus.ForeignKeys[2]: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field vuln_status_index_status", values[i]) - } else if value.Valid { - vs.vuln_status_index_status = new(string) - *vs.vuln_status_index_status = value.String - } - } - } - return nil -} - -// QueryAuthor queries the "author" edge of the VulnStatus entity. -func (vs *VulnStatus) QueryAuthor() *UserQuery { - return (&VulnStatusClient{config: vs.config}).QueryAuthor(vs) -} - -// Update returns a builder for updating this VulnStatus. -// Note that you need to call VulnStatus.Unwrap() before calling this method if this VulnStatus -// was returned from a transaction, and the transaction was committed or rolled back. -func (vs *VulnStatus) Update() *VulnStatusUpdateOne { - return (&VulnStatusClient{config: vs.config}).UpdateOne(vs) -} - -// Unwrap unwraps the VulnStatus entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (vs *VulnStatus) Unwrap() *VulnStatus { - tx, ok := vs.config.driver.(*txDriver) - if !ok { - panic("ent: VulnStatus is not a transactional entity") - } - vs.config.driver = tx.drv - return vs -} - -// String implements the fmt.Stringer. -func (vs *VulnStatus) String() string { - var builder strings.Builder - builder.WriteString("VulnStatus(") - builder.WriteString(fmt.Sprintf("id=%v", vs.ID)) - builder.WriteString(", status=") - builder.WriteString(fmt.Sprintf("%v", vs.Status)) - builder.WriteString(", source=") - builder.WriteString(vs.Source) - builder.WriteString(", pkg_name=") - builder.WriteString(vs.PkgName) - builder.WriteString(", pkg_type=") - builder.WriteString(vs.PkgType) - builder.WriteString(", vuln_id=") - builder.WriteString(vs.VulnID) - builder.WriteString(", expires_at=") - builder.WriteString(fmt.Sprintf("%v", vs.ExpiresAt)) - builder.WriteString(", created_at=") - builder.WriteString(fmt.Sprintf("%v", vs.CreatedAt)) - builder.WriteString(", comment=") - builder.WriteString(vs.Comment) - builder.WriteByte(')') - return builder.String() -} - -// VulnStatusSlice is a parsable slice of VulnStatus. -type VulnStatusSlice []*VulnStatus - -func (vs VulnStatusSlice) config(cfg config) { - for _i := range vs { - vs[_i].config = cfg - } -} diff --git a/pkg/infra/ent/vulnstatus/vulnstatus.go b/pkg/infra/ent/vulnstatus/vulnstatus.go deleted file mode 100644 index 1a7d9ae..0000000 --- a/pkg/infra/ent/vulnstatus/vulnstatus.go +++ /dev/null @@ -1,89 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package vulnstatus - -import ( - "fmt" - - "github.com/m-mizutani/octovy/pkg/domain/types" -) - -const ( - // Label holds the string label denoting the vulnstatus type in the database. - Label = "vuln_status" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldStatus holds the string denoting the status field in the database. - FieldStatus = "status" - // FieldSource holds the string denoting the source field in the database. - FieldSource = "source" - // FieldPkgName holds the string denoting the pkg_name field in the database. - FieldPkgName = "pkg_name" - // FieldPkgType holds the string denoting the pkg_type field in the database. - FieldPkgType = "pkg_type" - // FieldVulnID holds the string denoting the vuln_id field in the database. - FieldVulnID = "vuln_id" - // FieldExpiresAt holds the string denoting the expires_at field in the database. - FieldExpiresAt = "expires_at" - // FieldCreatedAt holds the string denoting the created_at field in the database. - FieldCreatedAt = "created_at" - // FieldComment holds the string denoting the comment field in the database. - FieldComment = "comment" - // EdgeAuthor holds the string denoting the author edge name in mutations. - EdgeAuthor = "author" - // Table holds the table name of the vulnstatus in the database. - Table = "vuln_status" - // AuthorTable is the table that holds the author relation/edge. - AuthorTable = "vuln_status" - // AuthorInverseTable is the table name for the User entity. - // It exists in this package in order to avoid circular dependency with the "user" package. - AuthorInverseTable = "users" - // AuthorColumn is the table column denoting the author relation/edge. - AuthorColumn = "vuln_status_author" -) - -// Columns holds all SQL columns for vulnstatus fields. -var Columns = []string{ - FieldID, - FieldStatus, - FieldSource, - FieldPkgName, - FieldPkgType, - FieldVulnID, - FieldExpiresAt, - FieldCreatedAt, - FieldComment, -} - -// ForeignKeys holds the SQL foreign-keys that are owned by the "vuln_status" -// table and are not defined as standalone fields in the schema. -var ForeignKeys = []string{ - "user_edited_status", - "vuln_status_author", - "vuln_status_index_status", -} - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - for i := range ForeignKeys { - if column == ForeignKeys[i] { - return true - } - } - return false -} - -// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save. -func StatusValidator(s types.VulnStatusType) error { - switch s { - case "none", "snoozed", "mitigated", "unaffected", "fixed": - return nil - default: - return fmt.Errorf("vulnstatus: invalid enum value for status field: %q", s) - } -} diff --git a/pkg/infra/ent/vulnstatus/where.go b/pkg/infra/ent/vulnstatus/where.go deleted file mode 100644 index 39adba5..0000000 --- a/pkg/infra/ent/vulnstatus/where.go +++ /dev/null @@ -1,959 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package vulnstatus - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/domain/types" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id int) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id int) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id int) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...int) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...int) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id int) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id int) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id int) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id int) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// Source applies equality check predicate on the "source" field. It's identical to SourceEQ. -func Source(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldSource), v)) - }) -} - -// PkgName applies equality check predicate on the "pkg_name" field. It's identical to PkgNameEQ. -func PkgName(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldPkgName), v)) - }) -} - -// PkgType applies equality check predicate on the "pkg_type" field. It's identical to PkgTypeEQ. -func PkgType(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldPkgType), v)) - }) -} - -// VulnID applies equality check predicate on the "vuln_id" field. It's identical to VulnIDEQ. -func VulnID(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldVulnID), v)) - }) -} - -// ExpiresAt applies equality check predicate on the "expires_at" field. It's identical to ExpiresAtEQ. -func ExpiresAt(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldExpiresAt), v)) - }) -} - -// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. -func CreatedAt(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldCreatedAt), v)) - }) -} - -// Comment applies equality check predicate on the "comment" field. It's identical to CommentEQ. -func Comment(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldComment), v)) - }) -} - -// StatusEQ applies the EQ predicate on the "status" field. -func StatusEQ(v types.VulnStatusType) predicate.VulnStatus { - vc := v - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldStatus), vc)) - }) -} - -// StatusNEQ applies the NEQ predicate on the "status" field. -func StatusNEQ(v types.VulnStatusType) predicate.VulnStatus { - vc := v - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldStatus), vc)) - }) -} - -// StatusIn applies the In predicate on the "status" field. -func StatusIn(vs ...types.VulnStatusType) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldStatus), v...)) - }) -} - -// StatusNotIn applies the NotIn predicate on the "status" field. -func StatusNotIn(vs ...types.VulnStatusType) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldStatus), v...)) - }) -} - -// SourceEQ applies the EQ predicate on the "source" field. -func SourceEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldSource), v)) - }) -} - -// SourceNEQ applies the NEQ predicate on the "source" field. -func SourceNEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldSource), v)) - }) -} - -// SourceIn applies the In predicate on the "source" field. -func SourceIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldSource), v...)) - }) -} - -// SourceNotIn applies the NotIn predicate on the "source" field. -func SourceNotIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldSource), v...)) - }) -} - -// SourceGT applies the GT predicate on the "source" field. -func SourceGT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldSource), v)) - }) -} - -// SourceGTE applies the GTE predicate on the "source" field. -func SourceGTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldSource), v)) - }) -} - -// SourceLT applies the LT predicate on the "source" field. -func SourceLT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldSource), v)) - }) -} - -// SourceLTE applies the LTE predicate on the "source" field. -func SourceLTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldSource), v)) - }) -} - -// SourceContains applies the Contains predicate on the "source" field. -func SourceContains(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldSource), v)) - }) -} - -// SourceHasPrefix applies the HasPrefix predicate on the "source" field. -func SourceHasPrefix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldSource), v)) - }) -} - -// SourceHasSuffix applies the HasSuffix predicate on the "source" field. -func SourceHasSuffix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldSource), v)) - }) -} - -// SourceEqualFold applies the EqualFold predicate on the "source" field. -func SourceEqualFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldSource), v)) - }) -} - -// SourceContainsFold applies the ContainsFold predicate on the "source" field. -func SourceContainsFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldSource), v)) - }) -} - -// PkgNameEQ applies the EQ predicate on the "pkg_name" field. -func PkgNameEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldPkgName), v)) - }) -} - -// PkgNameNEQ applies the NEQ predicate on the "pkg_name" field. -func PkgNameNEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldPkgName), v)) - }) -} - -// PkgNameIn applies the In predicate on the "pkg_name" field. -func PkgNameIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldPkgName), v...)) - }) -} - -// PkgNameNotIn applies the NotIn predicate on the "pkg_name" field. -func PkgNameNotIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldPkgName), v...)) - }) -} - -// PkgNameGT applies the GT predicate on the "pkg_name" field. -func PkgNameGT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldPkgName), v)) - }) -} - -// PkgNameGTE applies the GTE predicate on the "pkg_name" field. -func PkgNameGTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldPkgName), v)) - }) -} - -// PkgNameLT applies the LT predicate on the "pkg_name" field. -func PkgNameLT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldPkgName), v)) - }) -} - -// PkgNameLTE applies the LTE predicate on the "pkg_name" field. -func PkgNameLTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldPkgName), v)) - }) -} - -// PkgNameContains applies the Contains predicate on the "pkg_name" field. -func PkgNameContains(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldPkgName), v)) - }) -} - -// PkgNameHasPrefix applies the HasPrefix predicate on the "pkg_name" field. -func PkgNameHasPrefix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldPkgName), v)) - }) -} - -// PkgNameHasSuffix applies the HasSuffix predicate on the "pkg_name" field. -func PkgNameHasSuffix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldPkgName), v)) - }) -} - -// PkgNameEqualFold applies the EqualFold predicate on the "pkg_name" field. -func PkgNameEqualFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldPkgName), v)) - }) -} - -// PkgNameContainsFold applies the ContainsFold predicate on the "pkg_name" field. -func PkgNameContainsFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldPkgName), v)) - }) -} - -// PkgTypeEQ applies the EQ predicate on the "pkg_type" field. -func PkgTypeEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeNEQ applies the NEQ predicate on the "pkg_type" field. -func PkgTypeNEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeIn applies the In predicate on the "pkg_type" field. -func PkgTypeIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldPkgType), v...)) - }) -} - -// PkgTypeNotIn applies the NotIn predicate on the "pkg_type" field. -func PkgTypeNotIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldPkgType), v...)) - }) -} - -// PkgTypeGT applies the GT predicate on the "pkg_type" field. -func PkgTypeGT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeGTE applies the GTE predicate on the "pkg_type" field. -func PkgTypeGTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeLT applies the LT predicate on the "pkg_type" field. -func PkgTypeLT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeLTE applies the LTE predicate on the "pkg_type" field. -func PkgTypeLTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeContains applies the Contains predicate on the "pkg_type" field. -func PkgTypeContains(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeHasPrefix applies the HasPrefix predicate on the "pkg_type" field. -func PkgTypeHasPrefix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeHasSuffix applies the HasSuffix predicate on the "pkg_type" field. -func PkgTypeHasSuffix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeEqualFold applies the EqualFold predicate on the "pkg_type" field. -func PkgTypeEqualFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldPkgType), v)) - }) -} - -// PkgTypeContainsFold applies the ContainsFold predicate on the "pkg_type" field. -func PkgTypeContainsFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldPkgType), v)) - }) -} - -// VulnIDEQ applies the EQ predicate on the "vuln_id" field. -func VulnIDEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldVulnID), v)) - }) -} - -// VulnIDNEQ applies the NEQ predicate on the "vuln_id" field. -func VulnIDNEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldVulnID), v)) - }) -} - -// VulnIDIn applies the In predicate on the "vuln_id" field. -func VulnIDIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldVulnID), v...)) - }) -} - -// VulnIDNotIn applies the NotIn predicate on the "vuln_id" field. -func VulnIDNotIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldVulnID), v...)) - }) -} - -// VulnIDGT applies the GT predicate on the "vuln_id" field. -func VulnIDGT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldVulnID), v)) - }) -} - -// VulnIDGTE applies the GTE predicate on the "vuln_id" field. -func VulnIDGTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldVulnID), v)) - }) -} - -// VulnIDLT applies the LT predicate on the "vuln_id" field. -func VulnIDLT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldVulnID), v)) - }) -} - -// VulnIDLTE applies the LTE predicate on the "vuln_id" field. -func VulnIDLTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldVulnID), v)) - }) -} - -// VulnIDContains applies the Contains predicate on the "vuln_id" field. -func VulnIDContains(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldVulnID), v)) - }) -} - -// VulnIDHasPrefix applies the HasPrefix predicate on the "vuln_id" field. -func VulnIDHasPrefix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldVulnID), v)) - }) -} - -// VulnIDHasSuffix applies the HasSuffix predicate on the "vuln_id" field. -func VulnIDHasSuffix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldVulnID), v)) - }) -} - -// VulnIDEqualFold applies the EqualFold predicate on the "vuln_id" field. -func VulnIDEqualFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldVulnID), v)) - }) -} - -// VulnIDContainsFold applies the ContainsFold predicate on the "vuln_id" field. -func VulnIDContainsFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldVulnID), v)) - }) -} - -// ExpiresAtEQ applies the EQ predicate on the "expires_at" field. -func ExpiresAtEQ(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtNEQ applies the NEQ predicate on the "expires_at" field. -func ExpiresAtNEQ(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtIn applies the In predicate on the "expires_at" field. -func ExpiresAtIn(vs ...int64) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldExpiresAt), v...)) - }) -} - -// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field. -func ExpiresAtNotIn(vs ...int64) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldExpiresAt), v...)) - }) -} - -// ExpiresAtGT applies the GT predicate on the "expires_at" field. -func ExpiresAtGT(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtGTE applies the GTE predicate on the "expires_at" field. -func ExpiresAtGTE(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtLT applies the LT predicate on the "expires_at" field. -func ExpiresAtLT(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldExpiresAt), v)) - }) -} - -// ExpiresAtLTE applies the LTE predicate on the "expires_at" field. -func ExpiresAtLTE(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldExpiresAt), v)) - }) -} - -// CreatedAtEQ applies the EQ predicate on the "created_at" field. -func CreatedAtEQ(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. -func CreatedAtNEQ(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtIn applies the In predicate on the "created_at" field. -func CreatedAtIn(vs ...int64) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldCreatedAt), v...)) - }) -} - -// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. -func CreatedAtNotIn(vs ...int64) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldCreatedAt), v...)) - }) -} - -// CreatedAtGT applies the GT predicate on the "created_at" field. -func CreatedAtGT(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtGTE applies the GTE predicate on the "created_at" field. -func CreatedAtGTE(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtLT applies the LT predicate on the "created_at" field. -func CreatedAtLT(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldCreatedAt), v)) - }) -} - -// CreatedAtLTE applies the LTE predicate on the "created_at" field. -func CreatedAtLTE(v int64) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldCreatedAt), v)) - }) -} - -// CommentEQ applies the EQ predicate on the "comment" field. -func CommentEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldComment), v)) - }) -} - -// CommentNEQ applies the NEQ predicate on the "comment" field. -func CommentNEQ(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldComment), v)) - }) -} - -// CommentIn applies the In predicate on the "comment" field. -func CommentIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.In(s.C(FieldComment), v...)) - }) -} - -// CommentNotIn applies the NotIn predicate on the "comment" field. -func CommentNotIn(vs ...string) predicate.VulnStatus { - v := make([]interface{}, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.VulnStatus(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } - s.Where(sql.NotIn(s.C(FieldComment), v...)) - }) -} - -// CommentGT applies the GT predicate on the "comment" field. -func CommentGT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldComment), v)) - }) -} - -// CommentGTE applies the GTE predicate on the "comment" field. -func CommentGTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldComment), v)) - }) -} - -// CommentLT applies the LT predicate on the "comment" field. -func CommentLT(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldComment), v)) - }) -} - -// CommentLTE applies the LTE predicate on the "comment" field. -func CommentLTE(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldComment), v)) - }) -} - -// CommentContains applies the Contains predicate on the "comment" field. -func CommentContains(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.Contains(s.C(FieldComment), v)) - }) -} - -// CommentHasPrefix applies the HasPrefix predicate on the "comment" field. -func CommentHasPrefix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasPrefix(s.C(FieldComment), v)) - }) -} - -// CommentHasSuffix applies the HasSuffix predicate on the "comment" field. -func CommentHasSuffix(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.HasSuffix(s.C(FieldComment), v)) - }) -} - -// CommentEqualFold applies the EqualFold predicate on the "comment" field. -func CommentEqualFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.EqualFold(s.C(FieldComment), v)) - }) -} - -// CommentContainsFold applies the ContainsFold predicate on the "comment" field. -func CommentContainsFold(v string) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.ContainsFold(s.C(FieldComment), v)) - }) -} - -// HasAuthor applies the HasEdge predicate on the "author" edge. -func HasAuthor() predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(AuthorTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, AuthorTable, AuthorColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasAuthorWith applies the HasEdge predicate on the "author" edge with a given conditions (other predicates). -func HasAuthorWith(preds ...predicate.User) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(AuthorInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, AuthorTable, AuthorColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.VulnStatus) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.VulnStatus) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.VulnStatus) predicate.VulnStatus { - return predicate.VulnStatus(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/vulnstatus_create.go b/pkg/infra/ent/vulnstatus_create.go deleted file mode 100644 index d290f39..0000000 --- a/pkg/infra/ent/vulnstatus_create.go +++ /dev/null @@ -1,941 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/domain/types" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" -) - -// VulnStatusCreate is the builder for creating a VulnStatus entity. -type VulnStatusCreate struct { - config - mutation *VulnStatusMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetStatus sets the "status" field. -func (vsc *VulnStatusCreate) SetStatus(tst types.VulnStatusType) *VulnStatusCreate { - vsc.mutation.SetStatus(tst) - return vsc -} - -// SetSource sets the "source" field. -func (vsc *VulnStatusCreate) SetSource(s string) *VulnStatusCreate { - vsc.mutation.SetSource(s) - return vsc -} - -// SetPkgName sets the "pkg_name" field. -func (vsc *VulnStatusCreate) SetPkgName(s string) *VulnStatusCreate { - vsc.mutation.SetPkgName(s) - return vsc -} - -// SetPkgType sets the "pkg_type" field. -func (vsc *VulnStatusCreate) SetPkgType(s string) *VulnStatusCreate { - vsc.mutation.SetPkgType(s) - return vsc -} - -// SetVulnID sets the "vuln_id" field. -func (vsc *VulnStatusCreate) SetVulnID(s string) *VulnStatusCreate { - vsc.mutation.SetVulnID(s) - return vsc -} - -// SetExpiresAt sets the "expires_at" field. -func (vsc *VulnStatusCreate) SetExpiresAt(i int64) *VulnStatusCreate { - vsc.mutation.SetExpiresAt(i) - return vsc -} - -// SetCreatedAt sets the "created_at" field. -func (vsc *VulnStatusCreate) SetCreatedAt(i int64) *VulnStatusCreate { - vsc.mutation.SetCreatedAt(i) - return vsc -} - -// SetComment sets the "comment" field. -func (vsc *VulnStatusCreate) SetComment(s string) *VulnStatusCreate { - vsc.mutation.SetComment(s) - return vsc -} - -// SetAuthorID sets the "author" edge to the User entity by ID. -func (vsc *VulnStatusCreate) SetAuthorID(id int) *VulnStatusCreate { - vsc.mutation.SetAuthorID(id) - return vsc -} - -// SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil. -func (vsc *VulnStatusCreate) SetNillableAuthorID(id *int) *VulnStatusCreate { - if id != nil { - vsc = vsc.SetAuthorID(*id) - } - return vsc -} - -// SetAuthor sets the "author" edge to the User entity. -func (vsc *VulnStatusCreate) SetAuthor(u *User) *VulnStatusCreate { - return vsc.SetAuthorID(u.ID) -} - -// Mutation returns the VulnStatusMutation object of the builder. -func (vsc *VulnStatusCreate) Mutation() *VulnStatusMutation { - return vsc.mutation -} - -// Save creates the VulnStatus in the database. -func (vsc *VulnStatusCreate) Save(ctx context.Context) (*VulnStatus, error) { - var ( - err error - node *VulnStatus - ) - if len(vsc.hooks) == 0 { - if err = vsc.check(); err != nil { - return nil, err - } - node, err = vsc.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = vsc.check(); err != nil { - return nil, err - } - vsc.mutation = mutation - if node, err = vsc.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(vsc.hooks) - 1; i >= 0; i-- { - if vsc.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vsc.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vsc.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (vsc *VulnStatusCreate) SaveX(ctx context.Context) *VulnStatus { - v, err := vsc.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (vsc *VulnStatusCreate) Exec(ctx context.Context) error { - _, err := vsc.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsc *VulnStatusCreate) ExecX(ctx context.Context) { - if err := vsc.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (vsc *VulnStatusCreate) check() error { - if _, ok := vsc.mutation.Status(); !ok { - return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "status"`)} - } - if v, ok := vsc.mutation.Status(); ok { - if err := vulnstatus.StatusValidator(v); err != nil { - return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "status": %w`, err)} - } - } - if _, ok := vsc.mutation.Source(); !ok { - return &ValidationError{Name: "source", err: errors.New(`ent: missing required field "source"`)} - } - if _, ok := vsc.mutation.PkgName(); !ok { - return &ValidationError{Name: "pkg_name", err: errors.New(`ent: missing required field "pkg_name"`)} - } - if _, ok := vsc.mutation.PkgType(); !ok { - return &ValidationError{Name: "pkg_type", err: errors.New(`ent: missing required field "pkg_type"`)} - } - if _, ok := vsc.mutation.VulnID(); !ok { - return &ValidationError{Name: "vuln_id", err: errors.New(`ent: missing required field "vuln_id"`)} - } - if _, ok := vsc.mutation.ExpiresAt(); !ok { - return &ValidationError{Name: "expires_at", err: errors.New(`ent: missing required field "expires_at"`)} - } - if _, ok := vsc.mutation.CreatedAt(); !ok { - return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "created_at"`)} - } - if _, ok := vsc.mutation.Comment(); !ok { - return &ValidationError{Name: "comment", err: errors.New(`ent: missing required field "comment"`)} - } - return nil -} - -func (vsc *VulnStatusCreate) sqlSave(ctx context.Context) (*VulnStatus, error) { - _node, _spec := vsc.createSpec() - if err := sqlgraph.CreateNode(ctx, vsc.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - id := _spec.ID.Value.(int64) - _node.ID = int(id) - return _node, nil -} - -func (vsc *VulnStatusCreate) createSpec() (*VulnStatus, *sqlgraph.CreateSpec) { - var ( - _node = &VulnStatus{config: vsc.config} - _spec = &sqlgraph.CreateSpec{ - Table: vulnstatus.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - } - ) - _spec.OnConflict = vsc.conflict - if value, ok := vsc.mutation.Status(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeEnum, - Value: value, - Column: vulnstatus.FieldStatus, - }) - _node.Status = value - } - if value, ok := vsc.mutation.Source(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldSource, - }) - _node.Source = value - } - if value, ok := vsc.mutation.PkgName(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldPkgName, - }) - _node.PkgName = value - } - if value, ok := vsc.mutation.PkgType(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldPkgType, - }) - _node.PkgType = value - } - if value, ok := vsc.mutation.VulnID(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldVulnID, - }) - _node.VulnID = value - } - if value, ok := vsc.mutation.ExpiresAt(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldExpiresAt, - }) - _node.ExpiresAt = value - } - if value, ok := vsc.mutation.CreatedAt(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldCreatedAt, - }) - _node.CreatedAt = value - } - if value, ok := vsc.mutation.Comment(); ok { - _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldComment, - }) - _node.Comment = value - } - if nodes := vsc.mutation.AuthorIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatus.AuthorTable, - Columns: []string{vulnstatus.AuthorColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _node.vuln_status_author = &nodes[0] - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.VulnStatus.Create(). -// SetStatus(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.VulnStatusUpsert) { -// SetStatus(v+v). -// }). -// Exec(ctx) -// -func (vsc *VulnStatusCreate) OnConflict(opts ...sql.ConflictOption) *VulnStatusUpsertOne { - vsc.conflict = opts - return &VulnStatusUpsertOne{ - create: vsc, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.VulnStatus.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (vsc *VulnStatusCreate) OnConflictColumns(columns ...string) *VulnStatusUpsertOne { - vsc.conflict = append(vsc.conflict, sql.ConflictColumns(columns...)) - return &VulnStatusUpsertOne{ - create: vsc, - } -} - -type ( - // VulnStatusUpsertOne is the builder for "upsert"-ing - // one VulnStatus node. - VulnStatusUpsertOne struct { - create *VulnStatusCreate - } - - // VulnStatusUpsert is the "OnConflict" setter. - VulnStatusUpsert struct { - *sql.UpdateSet - } -) - -// SetStatus sets the "status" field. -func (u *VulnStatusUpsert) SetStatus(v types.VulnStatusType) *VulnStatusUpsert { - u.Set(vulnstatus.FieldStatus, v) - return u -} - -// UpdateStatus sets the "status" field to the value that was provided on create. -func (u *VulnStatusUpsert) UpdateStatus() *VulnStatusUpsert { - u.SetExcluded(vulnstatus.FieldStatus) - return u -} - -// SetSource sets the "source" field. -func (u *VulnStatusUpsert) SetSource(v string) *VulnStatusUpsert { - u.Set(vulnstatus.FieldSource, v) - return u -} - -// UpdateSource sets the "source" field to the value that was provided on create. -func (u *VulnStatusUpsert) UpdateSource() *VulnStatusUpsert { - u.SetExcluded(vulnstatus.FieldSource) - return u -} - -// SetPkgName sets the "pkg_name" field. -func (u *VulnStatusUpsert) SetPkgName(v string) *VulnStatusUpsert { - u.Set(vulnstatus.FieldPkgName, v) - return u -} - -// UpdatePkgName sets the "pkg_name" field to the value that was provided on create. -func (u *VulnStatusUpsert) UpdatePkgName() *VulnStatusUpsert { - u.SetExcluded(vulnstatus.FieldPkgName) - return u -} - -// SetPkgType sets the "pkg_type" field. -func (u *VulnStatusUpsert) SetPkgType(v string) *VulnStatusUpsert { - u.Set(vulnstatus.FieldPkgType, v) - return u -} - -// UpdatePkgType sets the "pkg_type" field to the value that was provided on create. -func (u *VulnStatusUpsert) UpdatePkgType() *VulnStatusUpsert { - u.SetExcluded(vulnstatus.FieldPkgType) - return u -} - -// SetVulnID sets the "vuln_id" field. -func (u *VulnStatusUpsert) SetVulnID(v string) *VulnStatusUpsert { - u.Set(vulnstatus.FieldVulnID, v) - return u -} - -// UpdateVulnID sets the "vuln_id" field to the value that was provided on create. -func (u *VulnStatusUpsert) UpdateVulnID() *VulnStatusUpsert { - u.SetExcluded(vulnstatus.FieldVulnID) - return u -} - -// SetExpiresAt sets the "expires_at" field. -func (u *VulnStatusUpsert) SetExpiresAt(v int64) *VulnStatusUpsert { - u.Set(vulnstatus.FieldExpiresAt, v) - return u -} - -// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create. -func (u *VulnStatusUpsert) UpdateExpiresAt() *VulnStatusUpsert { - u.SetExcluded(vulnstatus.FieldExpiresAt) - return u -} - -// SetCreatedAt sets the "created_at" field. -func (u *VulnStatusUpsert) SetCreatedAt(v int64) *VulnStatusUpsert { - u.Set(vulnstatus.FieldCreatedAt, v) - return u -} - -// UpdateCreatedAt sets the "created_at" field to the value that was provided on create. -func (u *VulnStatusUpsert) UpdateCreatedAt() *VulnStatusUpsert { - u.SetExcluded(vulnstatus.FieldCreatedAt) - return u -} - -// SetComment sets the "comment" field. -func (u *VulnStatusUpsert) SetComment(v string) *VulnStatusUpsert { - u.Set(vulnstatus.FieldComment, v) - return u -} - -// UpdateComment sets the "comment" field to the value that was provided on create. -func (u *VulnStatusUpsert) UpdateComment() *VulnStatusUpsert { - u.SetExcluded(vulnstatus.FieldComment) - return u -} - -// UpdateNewValues updates the fields using the new values that were set on create. -// Using this option is equivalent to using: -// -// client.VulnStatus.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *VulnStatusUpsertOne) UpdateNewValues() *VulnStatusUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.VulnStatus.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *VulnStatusUpsertOne) Ignore() *VulnStatusUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *VulnStatusUpsertOne) DoNothing() *VulnStatusUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the VulnStatusCreate.OnConflict -// documentation for more info. -func (u *VulnStatusUpsertOne) Update(set func(*VulnStatusUpsert)) *VulnStatusUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&VulnStatusUpsert{UpdateSet: update}) - })) - return u -} - -// SetStatus sets the "status" field. -func (u *VulnStatusUpsertOne) SetStatus(v types.VulnStatusType) *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.SetStatus(v) - }) -} - -// UpdateStatus sets the "status" field to the value that was provided on create. -func (u *VulnStatusUpsertOne) UpdateStatus() *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateStatus() - }) -} - -// SetSource sets the "source" field. -func (u *VulnStatusUpsertOne) SetSource(v string) *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.SetSource(v) - }) -} - -// UpdateSource sets the "source" field to the value that was provided on create. -func (u *VulnStatusUpsertOne) UpdateSource() *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateSource() - }) -} - -// SetPkgName sets the "pkg_name" field. -func (u *VulnStatusUpsertOne) SetPkgName(v string) *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.SetPkgName(v) - }) -} - -// UpdatePkgName sets the "pkg_name" field to the value that was provided on create. -func (u *VulnStatusUpsertOne) UpdatePkgName() *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdatePkgName() - }) -} - -// SetPkgType sets the "pkg_type" field. -func (u *VulnStatusUpsertOne) SetPkgType(v string) *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.SetPkgType(v) - }) -} - -// UpdatePkgType sets the "pkg_type" field to the value that was provided on create. -func (u *VulnStatusUpsertOne) UpdatePkgType() *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdatePkgType() - }) -} - -// SetVulnID sets the "vuln_id" field. -func (u *VulnStatusUpsertOne) SetVulnID(v string) *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.SetVulnID(v) - }) -} - -// UpdateVulnID sets the "vuln_id" field to the value that was provided on create. -func (u *VulnStatusUpsertOne) UpdateVulnID() *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateVulnID() - }) -} - -// SetExpiresAt sets the "expires_at" field. -func (u *VulnStatusUpsertOne) SetExpiresAt(v int64) *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.SetExpiresAt(v) - }) -} - -// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create. -func (u *VulnStatusUpsertOne) UpdateExpiresAt() *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateExpiresAt() - }) -} - -// SetCreatedAt sets the "created_at" field. -func (u *VulnStatusUpsertOne) SetCreatedAt(v int64) *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.SetCreatedAt(v) - }) -} - -// UpdateCreatedAt sets the "created_at" field to the value that was provided on create. -func (u *VulnStatusUpsertOne) UpdateCreatedAt() *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateCreatedAt() - }) -} - -// SetComment sets the "comment" field. -func (u *VulnStatusUpsertOne) SetComment(v string) *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.SetComment(v) - }) -} - -// UpdateComment sets the "comment" field to the value that was provided on create. -func (u *VulnStatusUpsertOne) UpdateComment() *VulnStatusUpsertOne { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateComment() - }) -} - -// Exec executes the query. -func (u *VulnStatusUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for VulnStatusCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *VulnStatusUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *VulnStatusUpsertOne) ID(ctx context.Context) (id int, err error) { - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *VulnStatusUpsertOne) IDX(ctx context.Context) int { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// VulnStatusCreateBulk is the builder for creating many VulnStatus entities in bulk. -type VulnStatusCreateBulk struct { - config - builders []*VulnStatusCreate - conflict []sql.ConflictOption -} - -// Save creates the VulnStatus entities in the database. -func (vscb *VulnStatusCreateBulk) Save(ctx context.Context) ([]*VulnStatus, error) { - specs := make([]*sqlgraph.CreateSpec, len(vscb.builders)) - nodes := make([]*VulnStatus, len(vscb.builders)) - mutators := make([]Mutator, len(vscb.builders)) - for i := range vscb.builders { - func(i int, root context.Context) { - builder := vscb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, vscb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = vscb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, vscb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - if specs[i].ID.Value != nil { - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) - } - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, vscb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (vscb *VulnStatusCreateBulk) SaveX(ctx context.Context) []*VulnStatus { - v, err := vscb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (vscb *VulnStatusCreateBulk) Exec(ctx context.Context) error { - _, err := vscb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vscb *VulnStatusCreateBulk) ExecX(ctx context.Context) { - if err := vscb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.VulnStatus.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.VulnStatusUpsert) { -// SetStatus(v+v). -// }). -// Exec(ctx) -// -func (vscb *VulnStatusCreateBulk) OnConflict(opts ...sql.ConflictOption) *VulnStatusUpsertBulk { - vscb.conflict = opts - return &VulnStatusUpsertBulk{ - create: vscb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.VulnStatus.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (vscb *VulnStatusCreateBulk) OnConflictColumns(columns ...string) *VulnStatusUpsertBulk { - vscb.conflict = append(vscb.conflict, sql.ConflictColumns(columns...)) - return &VulnStatusUpsertBulk{ - create: vscb, - } -} - -// VulnStatusUpsertBulk is the builder for "upsert"-ing -// a bulk of VulnStatus nodes. -type VulnStatusUpsertBulk struct { - create *VulnStatusCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.VulnStatus.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (u *VulnStatusUpsertBulk) UpdateNewValues() *VulnStatusUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.VulnStatus.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *VulnStatusUpsertBulk) Ignore() *VulnStatusUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *VulnStatusUpsertBulk) DoNothing() *VulnStatusUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the VulnStatusCreateBulk.OnConflict -// documentation for more info. -func (u *VulnStatusUpsertBulk) Update(set func(*VulnStatusUpsert)) *VulnStatusUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&VulnStatusUpsert{UpdateSet: update}) - })) - return u -} - -// SetStatus sets the "status" field. -func (u *VulnStatusUpsertBulk) SetStatus(v types.VulnStatusType) *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.SetStatus(v) - }) -} - -// UpdateStatus sets the "status" field to the value that was provided on create. -func (u *VulnStatusUpsertBulk) UpdateStatus() *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateStatus() - }) -} - -// SetSource sets the "source" field. -func (u *VulnStatusUpsertBulk) SetSource(v string) *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.SetSource(v) - }) -} - -// UpdateSource sets the "source" field to the value that was provided on create. -func (u *VulnStatusUpsertBulk) UpdateSource() *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateSource() - }) -} - -// SetPkgName sets the "pkg_name" field. -func (u *VulnStatusUpsertBulk) SetPkgName(v string) *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.SetPkgName(v) - }) -} - -// UpdatePkgName sets the "pkg_name" field to the value that was provided on create. -func (u *VulnStatusUpsertBulk) UpdatePkgName() *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdatePkgName() - }) -} - -// SetPkgType sets the "pkg_type" field. -func (u *VulnStatusUpsertBulk) SetPkgType(v string) *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.SetPkgType(v) - }) -} - -// UpdatePkgType sets the "pkg_type" field to the value that was provided on create. -func (u *VulnStatusUpsertBulk) UpdatePkgType() *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdatePkgType() - }) -} - -// SetVulnID sets the "vuln_id" field. -func (u *VulnStatusUpsertBulk) SetVulnID(v string) *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.SetVulnID(v) - }) -} - -// UpdateVulnID sets the "vuln_id" field to the value that was provided on create. -func (u *VulnStatusUpsertBulk) UpdateVulnID() *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateVulnID() - }) -} - -// SetExpiresAt sets the "expires_at" field. -func (u *VulnStatusUpsertBulk) SetExpiresAt(v int64) *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.SetExpiresAt(v) - }) -} - -// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create. -func (u *VulnStatusUpsertBulk) UpdateExpiresAt() *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateExpiresAt() - }) -} - -// SetCreatedAt sets the "created_at" field. -func (u *VulnStatusUpsertBulk) SetCreatedAt(v int64) *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.SetCreatedAt(v) - }) -} - -// UpdateCreatedAt sets the "created_at" field to the value that was provided on create. -func (u *VulnStatusUpsertBulk) UpdateCreatedAt() *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateCreatedAt() - }) -} - -// SetComment sets the "comment" field. -func (u *VulnStatusUpsertBulk) SetComment(v string) *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.SetComment(v) - }) -} - -// UpdateComment sets the "comment" field to the value that was provided on create. -func (u *VulnStatusUpsertBulk) UpdateComment() *VulnStatusUpsertBulk { - return u.Update(func(s *VulnStatusUpsert) { - s.UpdateComment() - }) -} - -// Exec executes the query. -func (u *VulnStatusUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the VulnStatusCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for VulnStatusCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *VulnStatusUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/vulnstatus_delete.go b/pkg/infra/ent/vulnstatus_delete.go deleted file mode 100644 index fc3a810..0000000 --- a/pkg/infra/ent/vulnstatus_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" -) - -// VulnStatusDelete is the builder for deleting a VulnStatus entity. -type VulnStatusDelete struct { - config - hooks []Hook - mutation *VulnStatusMutation -} - -// Where appends a list predicates to the VulnStatusDelete builder. -func (vsd *VulnStatusDelete) Where(ps ...predicate.VulnStatus) *VulnStatusDelete { - vsd.mutation.Where(ps...) - return vsd -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (vsd *VulnStatusDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(vsd.hooks) == 0 { - affected, err = vsd.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - vsd.mutation = mutation - affected, err = vsd.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(vsd.hooks) - 1; i >= 0; i-- { - if vsd.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vsd.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vsd.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsd *VulnStatusDelete) ExecX(ctx context.Context) int { - n, err := vsd.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (vsd *VulnStatusDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnstatus.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - if ps := vsd.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, vsd.driver, _spec) -} - -// VulnStatusDeleteOne is the builder for deleting a single VulnStatus entity. -type VulnStatusDeleteOne struct { - vsd *VulnStatusDelete -} - -// Exec executes the deletion query. -func (vsdo *VulnStatusDeleteOne) Exec(ctx context.Context) error { - n, err := vsdo.vsd.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{vulnstatus.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsdo *VulnStatusDeleteOne) ExecX(ctx context.Context) { - vsdo.vsd.ExecX(ctx) -} diff --git a/pkg/infra/ent/vulnstatus_query.go b/pkg/infra/ent/vulnstatus_query.go deleted file mode 100644 index a74339c..0000000 --- a/pkg/infra/ent/vulnstatus_query.go +++ /dev/null @@ -1,994 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" -) - -// VulnStatusQuery is the builder for querying VulnStatus entities. -type VulnStatusQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.VulnStatus - // eager-loading edges. - withAuthor *UserQuery - withFKs bool - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the VulnStatusQuery builder. -func (vsq *VulnStatusQuery) Where(ps ...predicate.VulnStatus) *VulnStatusQuery { - vsq.predicates = append(vsq.predicates, ps...) - return vsq -} - -// Limit adds a limit step to the query. -func (vsq *VulnStatusQuery) Limit(limit int) *VulnStatusQuery { - vsq.limit = &limit - return vsq -} - -// Offset adds an offset step to the query. -func (vsq *VulnStatusQuery) Offset(offset int) *VulnStatusQuery { - vsq.offset = &offset - return vsq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (vsq *VulnStatusQuery) Unique(unique bool) *VulnStatusQuery { - vsq.unique = &unique - return vsq -} - -// Order adds an order step to the query. -func (vsq *VulnStatusQuery) Order(o ...OrderFunc) *VulnStatusQuery { - vsq.order = append(vsq.order, o...) - return vsq -} - -// QueryAuthor chains the current query on the "author" edge. -func (vsq *VulnStatusQuery) QueryAuthor() *UserQuery { - query := &UserQuery{config: vsq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := vsq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := vsq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(vulnstatus.Table, vulnstatus.FieldID, selector), - sqlgraph.To(user.Table, user.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, vulnstatus.AuthorTable, vulnstatus.AuthorColumn), - ) - fromU = sqlgraph.SetNeighbors(vsq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first VulnStatus entity from the query. -// Returns a *NotFoundError when no VulnStatus was found. -func (vsq *VulnStatusQuery) First(ctx context.Context) (*VulnStatus, error) { - nodes, err := vsq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{vulnstatus.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (vsq *VulnStatusQuery) FirstX(ctx context.Context) *VulnStatus { - node, err := vsq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first VulnStatus ID from the query. -// Returns a *NotFoundError when no VulnStatus ID was found. -func (vsq *VulnStatusQuery) FirstID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = vsq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{vulnstatus.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (vsq *VulnStatusQuery) FirstIDX(ctx context.Context) int { - id, err := vsq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single VulnStatus entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one VulnStatus entity is not found. -// Returns a *NotFoundError when no VulnStatus entities are found. -func (vsq *VulnStatusQuery) Only(ctx context.Context) (*VulnStatus, error) { - nodes, err := vsq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{vulnstatus.Label} - default: - return nil, &NotSingularError{vulnstatus.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (vsq *VulnStatusQuery) OnlyX(ctx context.Context) *VulnStatus { - node, err := vsq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only VulnStatus ID in the query. -// Returns a *NotSingularError when exactly one VulnStatus ID is not found. -// Returns a *NotFoundError when no entities are found. -func (vsq *VulnStatusQuery) OnlyID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = vsq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{vulnstatus.Label} - default: - err = &NotSingularError{vulnstatus.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (vsq *VulnStatusQuery) OnlyIDX(ctx context.Context) int { - id, err := vsq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of VulnStatusSlice. -func (vsq *VulnStatusQuery) All(ctx context.Context) ([]*VulnStatus, error) { - if err := vsq.prepareQuery(ctx); err != nil { - return nil, err - } - return vsq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (vsq *VulnStatusQuery) AllX(ctx context.Context) []*VulnStatus { - nodes, err := vsq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of VulnStatus IDs. -func (vsq *VulnStatusQuery) IDs(ctx context.Context) ([]int, error) { - var ids []int - if err := vsq.Select(vulnstatus.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (vsq *VulnStatusQuery) IDsX(ctx context.Context) []int { - ids, err := vsq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (vsq *VulnStatusQuery) Count(ctx context.Context) (int, error) { - if err := vsq.prepareQuery(ctx); err != nil { - return 0, err - } - return vsq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (vsq *VulnStatusQuery) CountX(ctx context.Context) int { - count, err := vsq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (vsq *VulnStatusQuery) Exist(ctx context.Context) (bool, error) { - if err := vsq.prepareQuery(ctx); err != nil { - return false, err - } - return vsq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (vsq *VulnStatusQuery) ExistX(ctx context.Context) bool { - exist, err := vsq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the VulnStatusQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (vsq *VulnStatusQuery) Clone() *VulnStatusQuery { - if vsq == nil { - return nil - } - return &VulnStatusQuery{ - config: vsq.config, - limit: vsq.limit, - offset: vsq.offset, - order: append([]OrderFunc{}, vsq.order...), - predicates: append([]predicate.VulnStatus{}, vsq.predicates...), - withAuthor: vsq.withAuthor.Clone(), - // clone intermediate query. - sql: vsq.sql.Clone(), - path: vsq.path, - } -} - -// WithAuthor tells the query-builder to eager-load the nodes that are connected to -// the "author" edge. The optional arguments are used to configure the query builder of the edge. -func (vsq *VulnStatusQuery) WithAuthor(opts ...func(*UserQuery)) *VulnStatusQuery { - query := &UserQuery{config: vsq.config} - for _, opt := range opts { - opt(query) - } - vsq.withAuthor = query - return vsq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// Status types.VulnStatusType `json:"status,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.VulnStatus.Query(). -// GroupBy(vulnstatus.FieldStatus). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -// -func (vsq *VulnStatusQuery) GroupBy(field string, fields ...string) *VulnStatusGroupBy { - group := &VulnStatusGroupBy{config: vsq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := vsq.prepareQuery(ctx); err != nil { - return nil, err - } - return vsq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// Status types.VulnStatusType `json:"status,omitempty"` -// } -// -// client.VulnStatus.Query(). -// Select(vulnstatus.FieldStatus). -// Scan(ctx, &v) -// -func (vsq *VulnStatusQuery) Select(fields ...string) *VulnStatusSelect { - vsq.fields = append(vsq.fields, fields...) - return &VulnStatusSelect{VulnStatusQuery: vsq} -} - -func (vsq *VulnStatusQuery) prepareQuery(ctx context.Context) error { - for _, f := range vsq.fields { - if !vulnstatus.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if vsq.path != nil { - prev, err := vsq.path(ctx) - if err != nil { - return err - } - vsq.sql = prev - } - return nil -} - -func (vsq *VulnStatusQuery) sqlAll(ctx context.Context) ([]*VulnStatus, error) { - var ( - nodes = []*VulnStatus{} - withFKs = vsq.withFKs - _spec = vsq.querySpec() - loadedTypes = [1]bool{ - vsq.withAuthor != nil, - } - ) - if vsq.withAuthor != nil { - withFKs = true - } - if withFKs { - _spec.Node.Columns = append(_spec.Node.Columns, vulnstatus.ForeignKeys...) - } - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &VulnStatus{config: vsq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, vsq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := vsq.withAuthor; query != nil { - ids := make([]int, 0, len(nodes)) - nodeids := make(map[int][]*VulnStatus) - for i := range nodes { - if nodes[i].vuln_status_author == nil { - continue - } - fk := *nodes[i].vuln_status_author - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(user.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "vuln_status_author" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Author = n - } - } - } - - return nodes, nil -} - -func (vsq *VulnStatusQuery) sqlCount(ctx context.Context) (int, error) { - _spec := vsq.querySpec() - return sqlgraph.CountNodes(ctx, vsq.driver, _spec) -} - -func (vsq *VulnStatusQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := vsq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (vsq *VulnStatusQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnstatus.Table, - Columns: vulnstatus.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - From: vsq.sql, - Unique: true, - } - if unique := vsq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := vsq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, vulnstatus.FieldID) - for i := range fields { - if fields[i] != vulnstatus.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := vsq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := vsq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := vsq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := vsq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (vsq *VulnStatusQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(vsq.driver.Dialect()) - t1 := builder.Table(vulnstatus.Table) - columns := vsq.fields - if len(columns) == 0 { - columns = vulnstatus.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if vsq.sql != nil { - selector = vsq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range vsq.predicates { - p(selector) - } - for _, p := range vsq.order { - p(selector) - } - if offset := vsq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := vsq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// VulnStatusGroupBy is the group-by builder for VulnStatus entities. -type VulnStatusGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (vsgb *VulnStatusGroupBy) Aggregate(fns ...AggregateFunc) *VulnStatusGroupBy { - vsgb.fns = append(vsgb.fns, fns...) - return vsgb -} - -// Scan applies the group-by query and scans the result into the given value. -func (vsgb *VulnStatusGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := vsgb.path(ctx) - if err != nil { - return err - } - vsgb.sql = query - return vsgb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (vsgb *VulnStatusGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := vsgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (vsgb *VulnStatusGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(vsgb.fields) > 1 { - return nil, errors.New("ent: VulnStatusGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := vsgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (vsgb *VulnStatusGroupBy) StringsX(ctx context.Context) []string { - v, err := vsgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vsgb *VulnStatusGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = vsgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatus.Label} - default: - err = fmt.Errorf("ent: VulnStatusGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (vsgb *VulnStatusGroupBy) StringX(ctx context.Context) string { - v, err := vsgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (vsgb *VulnStatusGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(vsgb.fields) > 1 { - return nil, errors.New("ent: VulnStatusGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := vsgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (vsgb *VulnStatusGroupBy) IntsX(ctx context.Context) []int { - v, err := vsgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vsgb *VulnStatusGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = vsgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatus.Label} - default: - err = fmt.Errorf("ent: VulnStatusGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (vsgb *VulnStatusGroupBy) IntX(ctx context.Context) int { - v, err := vsgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (vsgb *VulnStatusGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(vsgb.fields) > 1 { - return nil, errors.New("ent: VulnStatusGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := vsgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (vsgb *VulnStatusGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := vsgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vsgb *VulnStatusGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = vsgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatus.Label} - default: - err = fmt.Errorf("ent: VulnStatusGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (vsgb *VulnStatusGroupBy) Float64X(ctx context.Context) float64 { - v, err := vsgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (vsgb *VulnStatusGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(vsgb.fields) > 1 { - return nil, errors.New("ent: VulnStatusGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := vsgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (vsgb *VulnStatusGroupBy) BoolsX(ctx context.Context) []bool { - v, err := vsgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vsgb *VulnStatusGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = vsgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatus.Label} - default: - err = fmt.Errorf("ent: VulnStatusGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (vsgb *VulnStatusGroupBy) BoolX(ctx context.Context) bool { - v, err := vsgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (vsgb *VulnStatusGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range vsgb.fields { - if !vulnstatus.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := vsgb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := vsgb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (vsgb *VulnStatusGroupBy) sqlQuery() *sql.Selector { - selector := vsgb.sql.Select() - aggregation := make([]string, 0, len(vsgb.fns)) - for _, fn := range vsgb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(vsgb.fields)+len(vsgb.fns)) - for _, f := range vsgb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(vsgb.fields...)...) -} - -// VulnStatusSelect is the builder for selecting fields of VulnStatus entities. -type VulnStatusSelect struct { - *VulnStatusQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (vss *VulnStatusSelect) Scan(ctx context.Context, v interface{}) error { - if err := vss.prepareQuery(ctx); err != nil { - return err - } - vss.sql = vss.VulnStatusQuery.sqlQuery(ctx) - return vss.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (vss *VulnStatusSelect) ScanX(ctx context.Context, v interface{}) { - if err := vss.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (vss *VulnStatusSelect) Strings(ctx context.Context) ([]string, error) { - if len(vss.fields) > 1 { - return nil, errors.New("ent: VulnStatusSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := vss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (vss *VulnStatusSelect) StringsX(ctx context.Context) []string { - v, err := vss.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (vss *VulnStatusSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = vss.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatus.Label} - default: - err = fmt.Errorf("ent: VulnStatusSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (vss *VulnStatusSelect) StringX(ctx context.Context) string { - v, err := vss.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (vss *VulnStatusSelect) Ints(ctx context.Context) ([]int, error) { - if len(vss.fields) > 1 { - return nil, errors.New("ent: VulnStatusSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := vss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (vss *VulnStatusSelect) IntsX(ctx context.Context) []int { - v, err := vss.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (vss *VulnStatusSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = vss.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatus.Label} - default: - err = fmt.Errorf("ent: VulnStatusSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (vss *VulnStatusSelect) IntX(ctx context.Context) int { - v, err := vss.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (vss *VulnStatusSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(vss.fields) > 1 { - return nil, errors.New("ent: VulnStatusSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := vss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (vss *VulnStatusSelect) Float64sX(ctx context.Context) []float64 { - v, err := vss.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (vss *VulnStatusSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = vss.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatus.Label} - default: - err = fmt.Errorf("ent: VulnStatusSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (vss *VulnStatusSelect) Float64X(ctx context.Context) float64 { - v, err := vss.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (vss *VulnStatusSelect) Bools(ctx context.Context) ([]bool, error) { - if len(vss.fields) > 1 { - return nil, errors.New("ent: VulnStatusSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := vss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (vss *VulnStatusSelect) BoolsX(ctx context.Context) []bool { - v, err := vss.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (vss *VulnStatusSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = vss.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatus.Label} - default: - err = fmt.Errorf("ent: VulnStatusSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (vss *VulnStatusSelect) BoolX(ctx context.Context) bool { - v, err := vss.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (vss *VulnStatusSelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := vss.sql.Query() - if err := vss.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/vulnstatus_update.go b/pkg/infra/ent/vulnstatus_update.go deleted file mode 100644 index 80544fb..0000000 --- a/pkg/infra/ent/vulnstatus_update.go +++ /dev/null @@ -1,656 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/domain/types" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/user" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" -) - -// VulnStatusUpdate is the builder for updating VulnStatus entities. -type VulnStatusUpdate struct { - config - hooks []Hook - mutation *VulnStatusMutation -} - -// Where appends a list predicates to the VulnStatusUpdate builder. -func (vsu *VulnStatusUpdate) Where(ps ...predicate.VulnStatus) *VulnStatusUpdate { - vsu.mutation.Where(ps...) - return vsu -} - -// SetStatus sets the "status" field. -func (vsu *VulnStatusUpdate) SetStatus(tst types.VulnStatusType) *VulnStatusUpdate { - vsu.mutation.SetStatus(tst) - return vsu -} - -// SetSource sets the "source" field. -func (vsu *VulnStatusUpdate) SetSource(s string) *VulnStatusUpdate { - vsu.mutation.SetSource(s) - return vsu -} - -// SetPkgName sets the "pkg_name" field. -func (vsu *VulnStatusUpdate) SetPkgName(s string) *VulnStatusUpdate { - vsu.mutation.SetPkgName(s) - return vsu -} - -// SetPkgType sets the "pkg_type" field. -func (vsu *VulnStatusUpdate) SetPkgType(s string) *VulnStatusUpdate { - vsu.mutation.SetPkgType(s) - return vsu -} - -// SetVulnID sets the "vuln_id" field. -func (vsu *VulnStatusUpdate) SetVulnID(s string) *VulnStatusUpdate { - vsu.mutation.SetVulnID(s) - return vsu -} - -// SetExpiresAt sets the "expires_at" field. -func (vsu *VulnStatusUpdate) SetExpiresAt(i int64) *VulnStatusUpdate { - vsu.mutation.ResetExpiresAt() - vsu.mutation.SetExpiresAt(i) - return vsu -} - -// AddExpiresAt adds i to the "expires_at" field. -func (vsu *VulnStatusUpdate) AddExpiresAt(i int64) *VulnStatusUpdate { - vsu.mutation.AddExpiresAt(i) - return vsu -} - -// SetCreatedAt sets the "created_at" field. -func (vsu *VulnStatusUpdate) SetCreatedAt(i int64) *VulnStatusUpdate { - vsu.mutation.ResetCreatedAt() - vsu.mutation.SetCreatedAt(i) - return vsu -} - -// AddCreatedAt adds i to the "created_at" field. -func (vsu *VulnStatusUpdate) AddCreatedAt(i int64) *VulnStatusUpdate { - vsu.mutation.AddCreatedAt(i) - return vsu -} - -// SetComment sets the "comment" field. -func (vsu *VulnStatusUpdate) SetComment(s string) *VulnStatusUpdate { - vsu.mutation.SetComment(s) - return vsu -} - -// SetAuthorID sets the "author" edge to the User entity by ID. -func (vsu *VulnStatusUpdate) SetAuthorID(id int) *VulnStatusUpdate { - vsu.mutation.SetAuthorID(id) - return vsu -} - -// SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil. -func (vsu *VulnStatusUpdate) SetNillableAuthorID(id *int) *VulnStatusUpdate { - if id != nil { - vsu = vsu.SetAuthorID(*id) - } - return vsu -} - -// SetAuthor sets the "author" edge to the User entity. -func (vsu *VulnStatusUpdate) SetAuthor(u *User) *VulnStatusUpdate { - return vsu.SetAuthorID(u.ID) -} - -// Mutation returns the VulnStatusMutation object of the builder. -func (vsu *VulnStatusUpdate) Mutation() *VulnStatusMutation { - return vsu.mutation -} - -// ClearAuthor clears the "author" edge to the User entity. -func (vsu *VulnStatusUpdate) ClearAuthor() *VulnStatusUpdate { - vsu.mutation.ClearAuthor() - return vsu -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (vsu *VulnStatusUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(vsu.hooks) == 0 { - if err = vsu.check(); err != nil { - return 0, err - } - affected, err = vsu.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = vsu.check(); err != nil { - return 0, err - } - vsu.mutation = mutation - affected, err = vsu.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(vsu.hooks) - 1; i >= 0; i-- { - if vsu.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vsu.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vsu.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (vsu *VulnStatusUpdate) SaveX(ctx context.Context) int { - affected, err := vsu.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (vsu *VulnStatusUpdate) Exec(ctx context.Context) error { - _, err := vsu.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsu *VulnStatusUpdate) ExecX(ctx context.Context) { - if err := vsu.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (vsu *VulnStatusUpdate) check() error { - if v, ok := vsu.mutation.Status(); ok { - if err := vulnstatus.StatusValidator(v); err != nil { - return &ValidationError{Name: "status", err: fmt.Errorf("ent: validator failed for field \"status\": %w", err)} - } - } - return nil -} - -func (vsu *VulnStatusUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnstatus.Table, - Columns: vulnstatus.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - if ps := vsu.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := vsu.mutation.Status(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeEnum, - Value: value, - Column: vulnstatus.FieldStatus, - }) - } - if value, ok := vsu.mutation.Source(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldSource, - }) - } - if value, ok := vsu.mutation.PkgName(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldPkgName, - }) - } - if value, ok := vsu.mutation.PkgType(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldPkgType, - }) - } - if value, ok := vsu.mutation.VulnID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldVulnID, - }) - } - if value, ok := vsu.mutation.ExpiresAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldExpiresAt, - }) - } - if value, ok := vsu.mutation.AddedExpiresAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldExpiresAt, - }) - } - if value, ok := vsu.mutation.CreatedAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldCreatedAt, - }) - } - if value, ok := vsu.mutation.AddedCreatedAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldCreatedAt, - }) - } - if value, ok := vsu.mutation.Comment(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldComment, - }) - } - if vsu.mutation.AuthorCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatus.AuthorTable, - Columns: []string{vulnstatus.AuthorColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vsu.mutation.AuthorIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatus.AuthorTable, - Columns: []string{vulnstatus.AuthorColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, vsu.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{vulnstatus.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// VulnStatusUpdateOne is the builder for updating a single VulnStatus entity. -type VulnStatusUpdateOne struct { - config - fields []string - hooks []Hook - mutation *VulnStatusMutation -} - -// SetStatus sets the "status" field. -func (vsuo *VulnStatusUpdateOne) SetStatus(tst types.VulnStatusType) *VulnStatusUpdateOne { - vsuo.mutation.SetStatus(tst) - return vsuo -} - -// SetSource sets the "source" field. -func (vsuo *VulnStatusUpdateOne) SetSource(s string) *VulnStatusUpdateOne { - vsuo.mutation.SetSource(s) - return vsuo -} - -// SetPkgName sets the "pkg_name" field. -func (vsuo *VulnStatusUpdateOne) SetPkgName(s string) *VulnStatusUpdateOne { - vsuo.mutation.SetPkgName(s) - return vsuo -} - -// SetPkgType sets the "pkg_type" field. -func (vsuo *VulnStatusUpdateOne) SetPkgType(s string) *VulnStatusUpdateOne { - vsuo.mutation.SetPkgType(s) - return vsuo -} - -// SetVulnID sets the "vuln_id" field. -func (vsuo *VulnStatusUpdateOne) SetVulnID(s string) *VulnStatusUpdateOne { - vsuo.mutation.SetVulnID(s) - return vsuo -} - -// SetExpiresAt sets the "expires_at" field. -func (vsuo *VulnStatusUpdateOne) SetExpiresAt(i int64) *VulnStatusUpdateOne { - vsuo.mutation.ResetExpiresAt() - vsuo.mutation.SetExpiresAt(i) - return vsuo -} - -// AddExpiresAt adds i to the "expires_at" field. -func (vsuo *VulnStatusUpdateOne) AddExpiresAt(i int64) *VulnStatusUpdateOne { - vsuo.mutation.AddExpiresAt(i) - return vsuo -} - -// SetCreatedAt sets the "created_at" field. -func (vsuo *VulnStatusUpdateOne) SetCreatedAt(i int64) *VulnStatusUpdateOne { - vsuo.mutation.ResetCreatedAt() - vsuo.mutation.SetCreatedAt(i) - return vsuo -} - -// AddCreatedAt adds i to the "created_at" field. -func (vsuo *VulnStatusUpdateOne) AddCreatedAt(i int64) *VulnStatusUpdateOne { - vsuo.mutation.AddCreatedAt(i) - return vsuo -} - -// SetComment sets the "comment" field. -func (vsuo *VulnStatusUpdateOne) SetComment(s string) *VulnStatusUpdateOne { - vsuo.mutation.SetComment(s) - return vsuo -} - -// SetAuthorID sets the "author" edge to the User entity by ID. -func (vsuo *VulnStatusUpdateOne) SetAuthorID(id int) *VulnStatusUpdateOne { - vsuo.mutation.SetAuthorID(id) - return vsuo -} - -// SetNillableAuthorID sets the "author" edge to the User entity by ID if the given value is not nil. -func (vsuo *VulnStatusUpdateOne) SetNillableAuthorID(id *int) *VulnStatusUpdateOne { - if id != nil { - vsuo = vsuo.SetAuthorID(*id) - } - return vsuo -} - -// SetAuthor sets the "author" edge to the User entity. -func (vsuo *VulnStatusUpdateOne) SetAuthor(u *User) *VulnStatusUpdateOne { - return vsuo.SetAuthorID(u.ID) -} - -// Mutation returns the VulnStatusMutation object of the builder. -func (vsuo *VulnStatusUpdateOne) Mutation() *VulnStatusMutation { - return vsuo.mutation -} - -// ClearAuthor clears the "author" edge to the User entity. -func (vsuo *VulnStatusUpdateOne) ClearAuthor() *VulnStatusUpdateOne { - vsuo.mutation.ClearAuthor() - return vsuo -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (vsuo *VulnStatusUpdateOne) Select(field string, fields ...string) *VulnStatusUpdateOne { - vsuo.fields = append([]string{field}, fields...) - return vsuo -} - -// Save executes the query and returns the updated VulnStatus entity. -func (vsuo *VulnStatusUpdateOne) Save(ctx context.Context) (*VulnStatus, error) { - var ( - err error - node *VulnStatus - ) - if len(vsuo.hooks) == 0 { - if err = vsuo.check(); err != nil { - return nil, err - } - node, err = vsuo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = vsuo.check(); err != nil { - return nil, err - } - vsuo.mutation = mutation - node, err = vsuo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(vsuo.hooks) - 1; i >= 0; i-- { - if vsuo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vsuo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vsuo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (vsuo *VulnStatusUpdateOne) SaveX(ctx context.Context) *VulnStatus { - node, err := vsuo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (vsuo *VulnStatusUpdateOne) Exec(ctx context.Context) error { - _, err := vsuo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsuo *VulnStatusUpdateOne) ExecX(ctx context.Context) { - if err := vsuo.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (vsuo *VulnStatusUpdateOne) check() error { - if v, ok := vsuo.mutation.Status(); ok { - if err := vulnstatus.StatusValidator(v); err != nil { - return &ValidationError{Name: "status", err: fmt.Errorf("ent: validator failed for field \"status\": %w", err)} - } - } - return nil -} - -func (vsuo *VulnStatusUpdateOne) sqlSave(ctx context.Context) (_node *VulnStatus, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnstatus.Table, - Columns: vulnstatus.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - id, ok := vsuo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing VulnStatus.ID for update")} - } - _spec.Node.ID.Value = id - if fields := vsuo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, vulnstatus.FieldID) - for _, f := range fields { - if !vulnstatus.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != vulnstatus.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := vsuo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := vsuo.mutation.Status(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeEnum, - Value: value, - Column: vulnstatus.FieldStatus, - }) - } - if value, ok := vsuo.mutation.Source(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldSource, - }) - } - if value, ok := vsuo.mutation.PkgName(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldPkgName, - }) - } - if value, ok := vsuo.mutation.PkgType(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldPkgType, - }) - } - if value, ok := vsuo.mutation.VulnID(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldVulnID, - }) - } - if value, ok := vsuo.mutation.ExpiresAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldExpiresAt, - }) - } - if value, ok := vsuo.mutation.AddedExpiresAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldExpiresAt, - }) - } - if value, ok := vsuo.mutation.CreatedAt(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldCreatedAt, - }) - } - if value, ok := vsuo.mutation.AddedCreatedAt(); ok { - _spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{ - Type: field.TypeInt64, - Value: value, - Column: vulnstatus.FieldCreatedAt, - }) - } - if value, ok := vsuo.mutation.Comment(); ok { - _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ - Type: field.TypeString, - Value: value, - Column: vulnstatus.FieldComment, - }) - } - if vsuo.mutation.AuthorCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatus.AuthorTable, - Columns: []string{vulnstatus.AuthorColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vsuo.mutation.AuthorIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatus.AuthorTable, - Columns: []string{vulnstatus.AuthorColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: user.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &VulnStatus{config: vsuo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, vsuo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{vulnstatus.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/ent/vulnstatusindex.go b/pkg/infra/ent/vulnstatusindex.go deleted file mode 100644 index f78c4f2..0000000 --- a/pkg/infra/ent/vulnstatusindex.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "fmt" - "strings" - - "entgo.io/ent/dialect/sql" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// VulnStatusIndex is the model entity for the VulnStatusIndex schema. -type VulnStatusIndex struct { - config - // ID of the ent. - ID string `json:"id,omitempty"` - // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the VulnStatusIndexQuery when eager-loading is set. - Edges VulnStatusIndexEdges `json:"edges"` - repository_status *int - vuln_status_index_latest *int -} - -// VulnStatusIndexEdges holds the relations/edges for other nodes in the graph. -type VulnStatusIndexEdges struct { - // Latest holds the value of the latest edge. - Latest *VulnStatus `json:"latest,omitempty"` - // Status holds the value of the status edge. - Status []*VulnStatus `json:"status,omitempty"` - // loadedTypes holds the information for reporting if a - // type was loaded (or requested) in eager-loading or not. - loadedTypes [2]bool -} - -// LatestOrErr returns the Latest value or an error if the edge -// was not loaded in eager-loading, or loaded but was not found. -func (e VulnStatusIndexEdges) LatestOrErr() (*VulnStatus, error) { - if e.loadedTypes[0] { - if e.Latest == nil { - // The edge latest was loaded in eager-loading, - // but was not found. - return nil, &NotFoundError{label: vulnstatus.Label} - } - return e.Latest, nil - } - return nil, &NotLoadedError{edge: "latest"} -} - -// StatusOrErr returns the Status value or an error if the edge -// was not loaded in eager-loading. -func (e VulnStatusIndexEdges) StatusOrErr() ([]*VulnStatus, error) { - if e.loadedTypes[1] { - return e.Status, nil - } - return nil, &NotLoadedError{edge: "status"} -} - -// scanValues returns the types for scanning values from sql.Rows. -func (*VulnStatusIndex) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) - for i := range columns { - switch columns[i] { - case vulnstatusindex.FieldID: - values[i] = new(sql.NullString) - case vulnstatusindex.ForeignKeys[0]: // repository_status - values[i] = new(sql.NullInt64) - case vulnstatusindex.ForeignKeys[1]: // vuln_status_index_latest - values[i] = new(sql.NullInt64) - default: - return nil, fmt.Errorf("unexpected column %q for type VulnStatusIndex", columns[i]) - } - } - return values, nil -} - -// assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the VulnStatusIndex fields. -func (vsi *VulnStatusIndex) assignValues(columns []string, values []interface{}) error { - if m, n := len(values), len(columns); m < n { - return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) - } - for i := range columns { - switch columns[i] { - case vulnstatusindex.FieldID: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field id", values[i]) - } else if value.Valid { - vsi.ID = value.String - } - case vulnstatusindex.ForeignKeys[0]: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for edge-field repository_status", value) - } else if value.Valid { - vsi.repository_status = new(int) - *vsi.repository_status = int(value.Int64) - } - case vulnstatusindex.ForeignKeys[1]: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for edge-field vuln_status_index_latest", value) - } else if value.Valid { - vsi.vuln_status_index_latest = new(int) - *vsi.vuln_status_index_latest = int(value.Int64) - } - } - } - return nil -} - -// QueryLatest queries the "latest" edge of the VulnStatusIndex entity. -func (vsi *VulnStatusIndex) QueryLatest() *VulnStatusQuery { - return (&VulnStatusIndexClient{config: vsi.config}).QueryLatest(vsi) -} - -// QueryStatus queries the "status" edge of the VulnStatusIndex entity. -func (vsi *VulnStatusIndex) QueryStatus() *VulnStatusQuery { - return (&VulnStatusIndexClient{config: vsi.config}).QueryStatus(vsi) -} - -// Update returns a builder for updating this VulnStatusIndex. -// Note that you need to call VulnStatusIndex.Unwrap() before calling this method if this VulnStatusIndex -// was returned from a transaction, and the transaction was committed or rolled back. -func (vsi *VulnStatusIndex) Update() *VulnStatusIndexUpdateOne { - return (&VulnStatusIndexClient{config: vsi.config}).UpdateOne(vsi) -} - -// Unwrap unwraps the VulnStatusIndex entity that was returned from a transaction after it was closed, -// so that all future queries will be executed through the driver which created the transaction. -func (vsi *VulnStatusIndex) Unwrap() *VulnStatusIndex { - tx, ok := vsi.config.driver.(*txDriver) - if !ok { - panic("ent: VulnStatusIndex is not a transactional entity") - } - vsi.config.driver = tx.drv - return vsi -} - -// String implements the fmt.Stringer. -func (vsi *VulnStatusIndex) String() string { - var builder strings.Builder - builder.WriteString("VulnStatusIndex(") - builder.WriteString(fmt.Sprintf("id=%v", vsi.ID)) - builder.WriteByte(')') - return builder.String() -} - -// VulnStatusIndexes is a parsable slice of VulnStatusIndex. -type VulnStatusIndexes []*VulnStatusIndex - -func (vsi VulnStatusIndexes) config(cfg config) { - for _i := range vsi { - vsi[_i].config = cfg - } -} diff --git a/pkg/infra/ent/vulnstatusindex/vulnstatusindex.go b/pkg/infra/ent/vulnstatusindex/vulnstatusindex.go deleted file mode 100644 index 7c00cb6..0000000 --- a/pkg/infra/ent/vulnstatusindex/vulnstatusindex.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package vulnstatusindex - -const ( - // Label holds the string label denoting the vulnstatusindex type in the database. - Label = "vuln_status_index" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // EdgeLatest holds the string denoting the latest edge name in mutations. - EdgeLatest = "latest" - // EdgeStatus holds the string denoting the status edge name in mutations. - EdgeStatus = "status" - // Table holds the table name of the vulnstatusindex in the database. - Table = "vuln_status_indexes" - // LatestTable is the table that holds the latest relation/edge. - LatestTable = "vuln_status_indexes" - // LatestInverseTable is the table name for the VulnStatus entity. - // It exists in this package in order to avoid circular dependency with the "vulnstatus" package. - LatestInverseTable = "vuln_status" - // LatestColumn is the table column denoting the latest relation/edge. - LatestColumn = "vuln_status_index_latest" - // StatusTable is the table that holds the status relation/edge. - StatusTable = "vuln_status" - // StatusInverseTable is the table name for the VulnStatus entity. - // It exists in this package in order to avoid circular dependency with the "vulnstatus" package. - StatusInverseTable = "vuln_status" - // StatusColumn is the table column denoting the status relation/edge. - StatusColumn = "vuln_status_index_status" -) - -// Columns holds all SQL columns for vulnstatusindex fields. -var Columns = []string{ - FieldID, -} - -// ForeignKeys holds the SQL foreign-keys that are owned by the "vuln_status_indexes" -// table and are not defined as standalone fields in the schema. -var ForeignKeys = []string{ - "repository_status", - "vuln_status_index_latest", -} - -// ValidColumn reports if the column name is valid (part of the table columns). -func ValidColumn(column string) bool { - for i := range Columns { - if column == Columns[i] { - return true - } - } - for i := range ForeignKeys { - if column == ForeignKeys[i] { - return true - } - } - return false -} - -var ( - // IDValidator is a validator for the "id" field. It is called by the builders before save. - IDValidator func(string) error -) diff --git a/pkg/infra/ent/vulnstatusindex/where.go b/pkg/infra/ent/vulnstatusindex/where.go deleted file mode 100644 index 3976502..0000000 --- a/pkg/infra/ent/vulnstatusindex/where.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package vulnstatusindex - -import ( - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" -) - -// ID filters vertices based on their ID field. -func ID(id string) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id string) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - s.Where(sql.EQ(s.C(FieldID), id)) - }) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id string) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - s.Where(sql.NEQ(s.C(FieldID), id)) - }) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...string) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.In(s.C(FieldID), v...)) - }) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...string) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } - v := make([]interface{}, len(ids)) - for i := range v { - v[i] = ids[i] - } - s.Where(sql.NotIn(s.C(FieldID), v...)) - }) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id string) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - s.Where(sql.GT(s.C(FieldID), id)) - }) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id string) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - s.Where(sql.GTE(s.C(FieldID), id)) - }) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id string) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - s.Where(sql.LT(s.C(FieldID), id)) - }) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id string) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - s.Where(sql.LTE(s.C(FieldID), id)) - }) -} - -// HasLatest applies the HasEdge predicate on the "latest" edge. -func HasLatest() predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(LatestTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, LatestTable, LatestColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasLatestWith applies the HasEdge predicate on the "latest" edge with a given conditions (other predicates). -func HasLatestWith(preds ...predicate.VulnStatus) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(LatestInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, LatestTable, LatestColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// HasStatus applies the HasEdge predicate on the "status" edge. -func HasStatus() predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(StatusTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, StatusTable, StatusColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasStatusWith applies the HasEdge predicate on the "status" edge with a given conditions (other predicates). -func HasStatusWith(preds ...predicate.VulnStatus) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.To(StatusInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, StatusTable, StatusColumn), - ) - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.VulnStatusIndex) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.VulnStatusIndex) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.VulnStatusIndex) predicate.VulnStatusIndex { - return predicate.VulnStatusIndex(func(s *sql.Selector) { - p(s.Not()) - }) -} diff --git a/pkg/infra/ent/vulnstatusindex_create.go b/pkg/infra/ent/vulnstatusindex_create.go deleted file mode 100644 index e35745c..0000000 --- a/pkg/infra/ent/vulnstatusindex_create.go +++ /dev/null @@ -1,539 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// VulnStatusIndexCreate is the builder for creating a VulnStatusIndex entity. -type VulnStatusIndexCreate struct { - config - mutation *VulnStatusIndexMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetID sets the "id" field. -func (vsic *VulnStatusIndexCreate) SetID(s string) *VulnStatusIndexCreate { - vsic.mutation.SetID(s) - return vsic -} - -// SetLatestID sets the "latest" edge to the VulnStatus entity by ID. -func (vsic *VulnStatusIndexCreate) SetLatestID(id int) *VulnStatusIndexCreate { - vsic.mutation.SetLatestID(id) - return vsic -} - -// SetNillableLatestID sets the "latest" edge to the VulnStatus entity by ID if the given value is not nil. -func (vsic *VulnStatusIndexCreate) SetNillableLatestID(id *int) *VulnStatusIndexCreate { - if id != nil { - vsic = vsic.SetLatestID(*id) - } - return vsic -} - -// SetLatest sets the "latest" edge to the VulnStatus entity. -func (vsic *VulnStatusIndexCreate) SetLatest(v *VulnStatus) *VulnStatusIndexCreate { - return vsic.SetLatestID(v.ID) -} - -// AddStatuIDs adds the "status" edge to the VulnStatus entity by IDs. -func (vsic *VulnStatusIndexCreate) AddStatuIDs(ids ...int) *VulnStatusIndexCreate { - vsic.mutation.AddStatuIDs(ids...) - return vsic -} - -// AddStatus adds the "status" edges to the VulnStatus entity. -func (vsic *VulnStatusIndexCreate) AddStatus(v ...*VulnStatus) *VulnStatusIndexCreate { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return vsic.AddStatuIDs(ids...) -} - -// Mutation returns the VulnStatusIndexMutation object of the builder. -func (vsic *VulnStatusIndexCreate) Mutation() *VulnStatusIndexMutation { - return vsic.mutation -} - -// Save creates the VulnStatusIndex in the database. -func (vsic *VulnStatusIndexCreate) Save(ctx context.Context) (*VulnStatusIndex, error) { - var ( - err error - node *VulnStatusIndex - ) - if len(vsic.hooks) == 0 { - if err = vsic.check(); err != nil { - return nil, err - } - node, err = vsic.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusIndexMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err = vsic.check(); err != nil { - return nil, err - } - vsic.mutation = mutation - if node, err = vsic.sqlSave(ctx); err != nil { - return nil, err - } - mutation.id = &node.ID - mutation.done = true - return node, err - }) - for i := len(vsic.hooks) - 1; i >= 0; i-- { - if vsic.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vsic.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vsic.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX calls Save and panics if Save returns an error. -func (vsic *VulnStatusIndexCreate) SaveX(ctx context.Context) *VulnStatusIndex { - v, err := vsic.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (vsic *VulnStatusIndexCreate) Exec(ctx context.Context) error { - _, err := vsic.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsic *VulnStatusIndexCreate) ExecX(ctx context.Context) { - if err := vsic.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (vsic *VulnStatusIndexCreate) check() error { - if v, ok := vsic.mutation.ID(); ok { - if err := vulnstatusindex.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`ent: validator failed for field "id": %w`, err)} - } - } - return nil -} - -func (vsic *VulnStatusIndexCreate) sqlSave(ctx context.Context) (*VulnStatusIndex, error) { - _node, _spec := vsic.createSpec() - if err := sqlgraph.CreateNode(ctx, vsic.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - if _spec.ID.Value != nil { - _node.ID = _spec.ID.Value.(string) - } - return _node, nil -} - -func (vsic *VulnStatusIndexCreate) createSpec() (*VulnStatusIndex, *sqlgraph.CreateSpec) { - var ( - _node = &VulnStatusIndex{config: vsic.config} - _spec = &sqlgraph.CreateSpec{ - Table: vulnstatusindex.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - } - ) - _spec.OnConflict = vsic.conflict - if id, ok := vsic.mutation.ID(); ok { - _node.ID = id - _spec.ID.Value = id - } - if nodes := vsic.mutation.LatestIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatusindex.LatestTable, - Columns: []string{vulnstatusindex.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _node.vuln_status_index_latest = &nodes[0] - _spec.Edges = append(_spec.Edges, edge) - } - if nodes := vsic.mutation.StatusIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: vulnstatusindex.StatusTable, - Columns: []string{vulnstatusindex.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.VulnStatusIndex.Create(). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (vsic *VulnStatusIndexCreate) OnConflict(opts ...sql.ConflictOption) *VulnStatusIndexUpsertOne { - vsic.conflict = opts - return &VulnStatusIndexUpsertOne{ - create: vsic, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.VulnStatusIndex.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (vsic *VulnStatusIndexCreate) OnConflictColumns(columns ...string) *VulnStatusIndexUpsertOne { - vsic.conflict = append(vsic.conflict, sql.ConflictColumns(columns...)) - return &VulnStatusIndexUpsertOne{ - create: vsic, - } -} - -type ( - // VulnStatusIndexUpsertOne is the builder for "upsert"-ing - // one VulnStatusIndex node. - VulnStatusIndexUpsertOne struct { - create *VulnStatusIndexCreate - } - - // VulnStatusIndexUpsert is the "OnConflict" setter. - VulnStatusIndexUpsert struct { - *sql.UpdateSet - } -) - -// UpdateNewValues updates the fields using the new values that were set on create except the ID field. -// Using this option is equivalent to using: -// -// client.VulnStatusIndex.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(vulnstatusindex.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *VulnStatusIndexUpsertOne) UpdateNewValues() *VulnStatusIndexUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - if _, exists := u.create.mutation.ID(); exists { - s.SetIgnore(vulnstatusindex.FieldID) - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.VulnStatusIndex.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *VulnStatusIndexUpsertOne) Ignore() *VulnStatusIndexUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *VulnStatusIndexUpsertOne) DoNothing() *VulnStatusIndexUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the VulnStatusIndexCreate.OnConflict -// documentation for more info. -func (u *VulnStatusIndexUpsertOne) Update(set func(*VulnStatusIndexUpsert)) *VulnStatusIndexUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&VulnStatusIndexUpsert{UpdateSet: update}) - })) - return u -} - -// Exec executes the query. -func (u *VulnStatusIndexUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for VulnStatusIndexCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *VulnStatusIndexUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *VulnStatusIndexUpsertOne) ID(ctx context.Context) (id string, err error) { - if u.create.driver.Dialect() == dialect.MySQL { - // In case of "ON CONFLICT", there is no way to get back non-numeric ID - // fields from the database since MySQL does not support the RETURNING clause. - return id, errors.New("ent: VulnStatusIndexUpsertOne.ID is not supported by MySQL driver. Use VulnStatusIndexUpsertOne.Exec instead") - } - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *VulnStatusIndexUpsertOne) IDX(ctx context.Context) string { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// VulnStatusIndexCreateBulk is the builder for creating many VulnStatusIndex entities in bulk. -type VulnStatusIndexCreateBulk struct { - config - builders []*VulnStatusIndexCreate - conflict []sql.ConflictOption -} - -// Save creates the VulnStatusIndex entities in the database. -func (vsicb *VulnStatusIndexCreateBulk) Save(ctx context.Context) ([]*VulnStatusIndex, error) { - specs := make([]*sqlgraph.CreateSpec, len(vsicb.builders)) - nodes := make([]*VulnStatusIndex, len(vsicb.builders)) - mutators := make([]Mutator, len(vsicb.builders)) - for i := range vsicb.builders { - func(i int, root context.Context) { - builder := vsicb.builders[i] - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusIndexMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - nodes[i], specs[i] = builder.createSpec() - var err error - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, vsicb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = vsicb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, vsicb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, vsicb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (vsicb *VulnStatusIndexCreateBulk) SaveX(ctx context.Context) []*VulnStatusIndex { - v, err := vsicb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (vsicb *VulnStatusIndexCreateBulk) Exec(ctx context.Context) error { - _, err := vsicb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsicb *VulnStatusIndexCreateBulk) ExecX(ctx context.Context) { - if err := vsicb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.VulnStatusIndex.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// Exec(ctx) -// -func (vsicb *VulnStatusIndexCreateBulk) OnConflict(opts ...sql.ConflictOption) *VulnStatusIndexUpsertBulk { - vsicb.conflict = opts - return &VulnStatusIndexUpsertBulk{ - create: vsicb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.VulnStatusIndex.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -// -func (vsicb *VulnStatusIndexCreateBulk) OnConflictColumns(columns ...string) *VulnStatusIndexUpsertBulk { - vsicb.conflict = append(vsicb.conflict, sql.ConflictColumns(columns...)) - return &VulnStatusIndexUpsertBulk{ - create: vsicb, - } -} - -// VulnStatusIndexUpsertBulk is the builder for "upsert"-ing -// a bulk of VulnStatusIndex nodes. -type VulnStatusIndexUpsertBulk struct { - create *VulnStatusIndexCreateBulk -} - -// UpdateNewValues updates the fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.VulnStatusIndex.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(vulnstatusindex.FieldID) -// }), -// ). -// Exec(ctx) -// -func (u *VulnStatusIndexUpsertBulk) UpdateNewValues() *VulnStatusIndexUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - for _, b := range u.create.builders { - if _, exists := b.mutation.ID(); exists { - s.SetIgnore(vulnstatusindex.FieldID) - return - } - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.VulnStatusIndex.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -// -func (u *VulnStatusIndexUpsertBulk) Ignore() *VulnStatusIndexUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *VulnStatusIndexUpsertBulk) DoNothing() *VulnStatusIndexUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the VulnStatusIndexCreateBulk.OnConflict -// documentation for more info. -func (u *VulnStatusIndexUpsertBulk) Update(set func(*VulnStatusIndexUpsert)) *VulnStatusIndexUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&VulnStatusIndexUpsert{UpdateSet: update}) - })) - return u -} - -// Exec executes the query. -func (u *VulnStatusIndexUpsertBulk) Exec(ctx context.Context) error { - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the VulnStatusIndexCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("ent: missing options for VulnStatusIndexCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *VulnStatusIndexUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/pkg/infra/ent/vulnstatusindex_delete.go b/pkg/infra/ent/vulnstatusindex_delete.go deleted file mode 100644 index 15f464d..0000000 --- a/pkg/infra/ent/vulnstatusindex_delete.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// VulnStatusIndexDelete is the builder for deleting a VulnStatusIndex entity. -type VulnStatusIndexDelete struct { - config - hooks []Hook - mutation *VulnStatusIndexMutation -} - -// Where appends a list predicates to the VulnStatusIndexDelete builder. -func (vsid *VulnStatusIndexDelete) Where(ps ...predicate.VulnStatusIndex) *VulnStatusIndexDelete { - vsid.mutation.Where(ps...) - return vsid -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (vsid *VulnStatusIndexDelete) Exec(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(vsid.hooks) == 0 { - affected, err = vsid.sqlExec(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusIndexMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - vsid.mutation = mutation - affected, err = vsid.sqlExec(ctx) - mutation.done = true - return affected, err - }) - for i := len(vsid.hooks) - 1; i >= 0; i-- { - if vsid.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vsid.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vsid.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsid *VulnStatusIndexDelete) ExecX(ctx context.Context) int { - n, err := vsid.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (vsid *VulnStatusIndexDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnstatusindex.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - if ps := vsid.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return sqlgraph.DeleteNodes(ctx, vsid.driver, _spec) -} - -// VulnStatusIndexDeleteOne is the builder for deleting a single VulnStatusIndex entity. -type VulnStatusIndexDeleteOne struct { - vsid *VulnStatusIndexDelete -} - -// Exec executes the deletion query. -func (vsido *VulnStatusIndexDeleteOne) Exec(ctx context.Context) error { - n, err := vsido.vsid.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{vulnstatusindex.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsido *VulnStatusIndexDeleteOne) ExecX(ctx context.Context) { - vsido.vsid.ExecX(ctx) -} diff --git a/pkg/infra/ent/vulnstatusindex_query.go b/pkg/infra/ent/vulnstatusindex_query.go deleted file mode 100644 index 103e96a..0000000 --- a/pkg/infra/ent/vulnstatusindex_query.go +++ /dev/null @@ -1,1036 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "database/sql/driver" - "errors" - "fmt" - "math" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// VulnStatusIndexQuery is the builder for querying VulnStatusIndex entities. -type VulnStatusIndexQuery struct { - config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.VulnStatusIndex - // eager-loading edges. - withLatest *VulnStatusQuery - withStatus *VulnStatusQuery - withFKs bool - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the VulnStatusIndexQuery builder. -func (vsiq *VulnStatusIndexQuery) Where(ps ...predicate.VulnStatusIndex) *VulnStatusIndexQuery { - vsiq.predicates = append(vsiq.predicates, ps...) - return vsiq -} - -// Limit adds a limit step to the query. -func (vsiq *VulnStatusIndexQuery) Limit(limit int) *VulnStatusIndexQuery { - vsiq.limit = &limit - return vsiq -} - -// Offset adds an offset step to the query. -func (vsiq *VulnStatusIndexQuery) Offset(offset int) *VulnStatusIndexQuery { - vsiq.offset = &offset - return vsiq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (vsiq *VulnStatusIndexQuery) Unique(unique bool) *VulnStatusIndexQuery { - vsiq.unique = &unique - return vsiq -} - -// Order adds an order step to the query. -func (vsiq *VulnStatusIndexQuery) Order(o ...OrderFunc) *VulnStatusIndexQuery { - vsiq.order = append(vsiq.order, o...) - return vsiq -} - -// QueryLatest chains the current query on the "latest" edge. -func (vsiq *VulnStatusIndexQuery) QueryLatest() *VulnStatusQuery { - query := &VulnStatusQuery{config: vsiq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := vsiq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := vsiq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(vulnstatusindex.Table, vulnstatusindex.FieldID, selector), - sqlgraph.To(vulnstatus.Table, vulnstatus.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, vulnstatusindex.LatestTable, vulnstatusindex.LatestColumn), - ) - fromU = sqlgraph.SetNeighbors(vsiq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// QueryStatus chains the current query on the "status" edge. -func (vsiq *VulnStatusIndexQuery) QueryStatus() *VulnStatusQuery { - query := &VulnStatusQuery{config: vsiq.config} - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := vsiq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := vsiq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(vulnstatusindex.Table, vulnstatusindex.FieldID, selector), - sqlgraph.To(vulnstatus.Table, vulnstatus.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, vulnstatusindex.StatusTable, vulnstatusindex.StatusColumn), - ) - fromU = sqlgraph.SetNeighbors(vsiq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first VulnStatusIndex entity from the query. -// Returns a *NotFoundError when no VulnStatusIndex was found. -func (vsiq *VulnStatusIndexQuery) First(ctx context.Context) (*VulnStatusIndex, error) { - nodes, err := vsiq.Limit(1).All(ctx) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{vulnstatusindex.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (vsiq *VulnStatusIndexQuery) FirstX(ctx context.Context) *VulnStatusIndex { - node, err := vsiq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first VulnStatusIndex ID from the query. -// Returns a *NotFoundError when no VulnStatusIndex ID was found. -func (vsiq *VulnStatusIndexQuery) FirstID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = vsiq.Limit(1).IDs(ctx); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{vulnstatusindex.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (vsiq *VulnStatusIndexQuery) FirstIDX(ctx context.Context) string { - id, err := vsiq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single VulnStatusIndex entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when exactly one VulnStatusIndex entity is not found. -// Returns a *NotFoundError when no VulnStatusIndex entities are found. -func (vsiq *VulnStatusIndexQuery) Only(ctx context.Context) (*VulnStatusIndex, error) { - nodes, err := vsiq.Limit(2).All(ctx) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{vulnstatusindex.Label} - default: - return nil, &NotSingularError{vulnstatusindex.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (vsiq *VulnStatusIndexQuery) OnlyX(ctx context.Context) *VulnStatusIndex { - node, err := vsiq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only VulnStatusIndex ID in the query. -// Returns a *NotSingularError when exactly one VulnStatusIndex ID is not found. -// Returns a *NotFoundError when no entities are found. -func (vsiq *VulnStatusIndexQuery) OnlyID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = vsiq.Limit(2).IDs(ctx); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{vulnstatusindex.Label} - default: - err = &NotSingularError{vulnstatusindex.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (vsiq *VulnStatusIndexQuery) OnlyIDX(ctx context.Context) string { - id, err := vsiq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of VulnStatusIndexes. -func (vsiq *VulnStatusIndexQuery) All(ctx context.Context) ([]*VulnStatusIndex, error) { - if err := vsiq.prepareQuery(ctx); err != nil { - return nil, err - } - return vsiq.sqlAll(ctx) -} - -// AllX is like All, but panics if an error occurs. -func (vsiq *VulnStatusIndexQuery) AllX(ctx context.Context) []*VulnStatusIndex { - nodes, err := vsiq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of VulnStatusIndex IDs. -func (vsiq *VulnStatusIndexQuery) IDs(ctx context.Context) ([]string, error) { - var ids []string - if err := vsiq.Select(vulnstatusindex.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (vsiq *VulnStatusIndexQuery) IDsX(ctx context.Context) []string { - ids, err := vsiq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (vsiq *VulnStatusIndexQuery) Count(ctx context.Context) (int, error) { - if err := vsiq.prepareQuery(ctx); err != nil { - return 0, err - } - return vsiq.sqlCount(ctx) -} - -// CountX is like Count, but panics if an error occurs. -func (vsiq *VulnStatusIndexQuery) CountX(ctx context.Context) int { - count, err := vsiq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (vsiq *VulnStatusIndexQuery) Exist(ctx context.Context) (bool, error) { - if err := vsiq.prepareQuery(ctx); err != nil { - return false, err - } - return vsiq.sqlExist(ctx) -} - -// ExistX is like Exist, but panics if an error occurs. -func (vsiq *VulnStatusIndexQuery) ExistX(ctx context.Context) bool { - exist, err := vsiq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the VulnStatusIndexQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (vsiq *VulnStatusIndexQuery) Clone() *VulnStatusIndexQuery { - if vsiq == nil { - return nil - } - return &VulnStatusIndexQuery{ - config: vsiq.config, - limit: vsiq.limit, - offset: vsiq.offset, - order: append([]OrderFunc{}, vsiq.order...), - predicates: append([]predicate.VulnStatusIndex{}, vsiq.predicates...), - withLatest: vsiq.withLatest.Clone(), - withStatus: vsiq.withStatus.Clone(), - // clone intermediate query. - sql: vsiq.sql.Clone(), - path: vsiq.path, - } -} - -// WithLatest tells the query-builder to eager-load the nodes that are connected to -// the "latest" edge. The optional arguments are used to configure the query builder of the edge. -func (vsiq *VulnStatusIndexQuery) WithLatest(opts ...func(*VulnStatusQuery)) *VulnStatusIndexQuery { - query := &VulnStatusQuery{config: vsiq.config} - for _, opt := range opts { - opt(query) - } - vsiq.withLatest = query - return vsiq -} - -// WithStatus tells the query-builder to eager-load the nodes that are connected to -// the "status" edge. The optional arguments are used to configure the query builder of the edge. -func (vsiq *VulnStatusIndexQuery) WithStatus(opts ...func(*VulnStatusQuery)) *VulnStatusIndexQuery { - query := &VulnStatusQuery{config: vsiq.config} - for _, opt := range opts { - opt(query) - } - vsiq.withStatus = query - return vsiq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -func (vsiq *VulnStatusIndexQuery) GroupBy(field string, fields ...string) *VulnStatusIndexGroupBy { - group := &VulnStatusIndexGroupBy{config: vsiq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { - if err := vsiq.prepareQuery(ctx); err != nil { - return nil, err - } - return vsiq.sqlQuery(ctx), nil - } - return group -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -func (vsiq *VulnStatusIndexQuery) Select(fields ...string) *VulnStatusIndexSelect { - vsiq.fields = append(vsiq.fields, fields...) - return &VulnStatusIndexSelect{VulnStatusIndexQuery: vsiq} -} - -func (vsiq *VulnStatusIndexQuery) prepareQuery(ctx context.Context) error { - for _, f := range vsiq.fields { - if !vulnstatusindex.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if vsiq.path != nil { - prev, err := vsiq.path(ctx) - if err != nil { - return err - } - vsiq.sql = prev - } - return nil -} - -func (vsiq *VulnStatusIndexQuery) sqlAll(ctx context.Context) ([]*VulnStatusIndex, error) { - var ( - nodes = []*VulnStatusIndex{} - withFKs = vsiq.withFKs - _spec = vsiq.querySpec() - loadedTypes = [2]bool{ - vsiq.withLatest != nil, - vsiq.withStatus != nil, - } - ) - if vsiq.withLatest != nil { - withFKs = true - } - if withFKs { - _spec.Node.Columns = append(_spec.Node.Columns, vulnstatusindex.ForeignKeys...) - } - _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &VulnStatusIndex{config: vsiq.config} - nodes = append(nodes, node) - return node.scanValues(columns) - } - _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if err := sqlgraph.QueryNodes(ctx, vsiq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - - if query := vsiq.withLatest; query != nil { - ids := make([]int, 0, len(nodes)) - nodeids := make(map[int][]*VulnStatusIndex) - for i := range nodes { - if nodes[i].vuln_status_index_latest == nil { - continue - } - fk := *nodes[i].vuln_status_index_latest - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(vulnstatus.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "vuln_status_index_latest" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Latest = n - } - } - } - - if query := vsiq.withStatus; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[string]*VulnStatusIndex) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.Status = []*VulnStatus{} - } - query.withFKs = true - query.Where(predicate.VulnStatus(func(s *sql.Selector) { - s.Where(sql.InValues(vulnstatusindex.StatusColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { - return nil, err - } - for _, n := range neighbors { - fk := n.vuln_status_index_status - if fk == nil { - return nil, fmt.Errorf(`foreign-key "vuln_status_index_status" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "vuln_status_index_status" returned %v for node %v`, *fk, n.ID) - } - node.Edges.Status = append(node.Edges.Status, n) - } - } - - return nodes, nil -} - -func (vsiq *VulnStatusIndexQuery) sqlCount(ctx context.Context) (int, error) { - _spec := vsiq.querySpec() - return sqlgraph.CountNodes(ctx, vsiq.driver, _spec) -} - -func (vsiq *VulnStatusIndexQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := vsiq.sqlCount(ctx) - if err != nil { - return false, fmt.Errorf("ent: check existence: %w", err) - } - return n > 0, nil -} - -func (vsiq *VulnStatusIndexQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnstatusindex.Table, - Columns: vulnstatusindex.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - From: vsiq.sql, - Unique: true, - } - if unique := vsiq.unique; unique != nil { - _spec.Unique = *unique - } - if fields := vsiq.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, vulnstatusindex.FieldID) - for i := range fields { - if fields[i] != vulnstatusindex.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := vsiq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := vsiq.limit; limit != nil { - _spec.Limit = *limit - } - if offset := vsiq.offset; offset != nil { - _spec.Offset = *offset - } - if ps := vsiq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (vsiq *VulnStatusIndexQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(vsiq.driver.Dialect()) - t1 := builder.Table(vulnstatusindex.Table) - columns := vsiq.fields - if len(columns) == 0 { - columns = vulnstatusindex.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if vsiq.sql != nil { - selector = vsiq.sql - selector.Select(selector.Columns(columns...)...) - } - for _, p := range vsiq.predicates { - p(selector) - } - for _, p := range vsiq.order { - p(selector) - } - if offset := vsiq.offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := vsiq.limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// VulnStatusIndexGroupBy is the group-by builder for VulnStatusIndex entities. -type VulnStatusIndexGroupBy struct { - config - fields []string - fns []AggregateFunc - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (vsigb *VulnStatusIndexGroupBy) Aggregate(fns ...AggregateFunc) *VulnStatusIndexGroupBy { - vsigb.fns = append(vsigb.fns, fns...) - return vsigb -} - -// Scan applies the group-by query and scans the result into the given value. -func (vsigb *VulnStatusIndexGroupBy) Scan(ctx context.Context, v interface{}) error { - query, err := vsigb.path(ctx) - if err != nil { - return err - } - vsigb.sql = query - return vsigb.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (vsigb *VulnStatusIndexGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := vsigb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (vsigb *VulnStatusIndexGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(vsigb.fields) > 1 { - return nil, errors.New("ent: VulnStatusIndexGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := vsigb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (vsigb *VulnStatusIndexGroupBy) StringsX(ctx context.Context) []string { - v, err := vsigb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vsigb *VulnStatusIndexGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = vsigb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatusindex.Label} - default: - err = fmt.Errorf("ent: VulnStatusIndexGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (vsigb *VulnStatusIndexGroupBy) StringX(ctx context.Context) string { - v, err := vsigb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (vsigb *VulnStatusIndexGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(vsigb.fields) > 1 { - return nil, errors.New("ent: VulnStatusIndexGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := vsigb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (vsigb *VulnStatusIndexGroupBy) IntsX(ctx context.Context) []int { - v, err := vsigb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vsigb *VulnStatusIndexGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = vsigb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatusindex.Label} - default: - err = fmt.Errorf("ent: VulnStatusIndexGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (vsigb *VulnStatusIndexGroupBy) IntX(ctx context.Context) int { - v, err := vsigb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (vsigb *VulnStatusIndexGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(vsigb.fields) > 1 { - return nil, errors.New("ent: VulnStatusIndexGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := vsigb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (vsigb *VulnStatusIndexGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := vsigb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vsigb *VulnStatusIndexGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = vsigb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatusindex.Label} - default: - err = fmt.Errorf("ent: VulnStatusIndexGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (vsigb *VulnStatusIndexGroupBy) Float64X(ctx context.Context) float64 { - v, err := vsigb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (vsigb *VulnStatusIndexGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(vsigb.fields) > 1 { - return nil, errors.New("ent: VulnStatusIndexGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := vsigb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (vsigb *VulnStatusIndexGroupBy) BoolsX(ctx context.Context) []bool { - v, err := vsigb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (vsigb *VulnStatusIndexGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = vsigb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatusindex.Label} - default: - err = fmt.Errorf("ent: VulnStatusIndexGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (vsigb *VulnStatusIndexGroupBy) BoolX(ctx context.Context) bool { - v, err := vsigb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (vsigb *VulnStatusIndexGroupBy) sqlScan(ctx context.Context, v interface{}) error { - for _, f := range vsigb.fields { - if !vulnstatusindex.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} - } - } - selector := vsigb.sqlQuery() - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := vsigb.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -func (vsigb *VulnStatusIndexGroupBy) sqlQuery() *sql.Selector { - selector := vsigb.sql.Select() - aggregation := make([]string, 0, len(vsigb.fns)) - for _, fn := range vsigb.fns { - aggregation = append(aggregation, fn(selector)) - } - // If no columns were selected in a custom aggregation function, the default - // selection is the fields used for "group-by", and the aggregation functions. - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(vsigb.fields)+len(vsigb.fns)) - for _, f := range vsigb.fields { - columns = append(columns, selector.C(f)) - } - for _, c := range aggregation { - columns = append(columns, c) - } - selector.Select(columns...) - } - return selector.GroupBy(selector.Columns(vsigb.fields...)...) -} - -// VulnStatusIndexSelect is the builder for selecting fields of VulnStatusIndex entities. -type VulnStatusIndexSelect struct { - *VulnStatusIndexQuery - // intermediate query (i.e. traversal path). - sql *sql.Selector -} - -// Scan applies the selector query and scans the result into the given value. -func (vsis *VulnStatusIndexSelect) Scan(ctx context.Context, v interface{}) error { - if err := vsis.prepareQuery(ctx); err != nil { - return err - } - vsis.sql = vsis.VulnStatusIndexQuery.sqlQuery(ctx) - return vsis.sqlScan(ctx, v) -} - -// ScanX is like Scan, but panics if an error occurs. -func (vsis *VulnStatusIndexSelect) ScanX(ctx context.Context, v interface{}) { - if err := vsis.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (vsis *VulnStatusIndexSelect) Strings(ctx context.Context) ([]string, error) { - if len(vsis.fields) > 1 { - return nil, errors.New("ent: VulnStatusIndexSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := vsis.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (vsis *VulnStatusIndexSelect) StringsX(ctx context.Context) []string { - v, err := vsis.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (vsis *VulnStatusIndexSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = vsis.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatusindex.Label} - default: - err = fmt.Errorf("ent: VulnStatusIndexSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (vsis *VulnStatusIndexSelect) StringX(ctx context.Context) string { - v, err := vsis.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (vsis *VulnStatusIndexSelect) Ints(ctx context.Context) ([]int, error) { - if len(vsis.fields) > 1 { - return nil, errors.New("ent: VulnStatusIndexSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := vsis.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (vsis *VulnStatusIndexSelect) IntsX(ctx context.Context) []int { - v, err := vsis.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (vsis *VulnStatusIndexSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = vsis.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatusindex.Label} - default: - err = fmt.Errorf("ent: VulnStatusIndexSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (vsis *VulnStatusIndexSelect) IntX(ctx context.Context) int { - v, err := vsis.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (vsis *VulnStatusIndexSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(vsis.fields) > 1 { - return nil, errors.New("ent: VulnStatusIndexSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := vsis.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (vsis *VulnStatusIndexSelect) Float64sX(ctx context.Context) []float64 { - v, err := vsis.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (vsis *VulnStatusIndexSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = vsis.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatusindex.Label} - default: - err = fmt.Errorf("ent: VulnStatusIndexSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (vsis *VulnStatusIndexSelect) Float64X(ctx context.Context) float64 { - v, err := vsis.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (vsis *VulnStatusIndexSelect) Bools(ctx context.Context) ([]bool, error) { - if len(vsis.fields) > 1 { - return nil, errors.New("ent: VulnStatusIndexSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := vsis.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (vsis *VulnStatusIndexSelect) BoolsX(ctx context.Context) []bool { - v, err := vsis.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (vsis *VulnStatusIndexSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = vsis.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{vulnstatusindex.Label} - default: - err = fmt.Errorf("ent: VulnStatusIndexSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (vsis *VulnStatusIndexSelect) BoolX(ctx context.Context) bool { - v, err := vsis.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - -func (vsis *VulnStatusIndexSelect) sqlScan(ctx context.Context, v interface{}) error { - rows := &sql.Rows{} - query, args := vsis.sql.Query() - if err := vsis.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/pkg/infra/ent/vulnstatusindex_update.go b/pkg/infra/ent/vulnstatusindex_update.go deleted file mode 100644 index a7688b0..0000000 --- a/pkg/infra/ent/vulnstatusindex_update.go +++ /dev/null @@ -1,539 +0,0 @@ -// Code generated by entc, DO NOT EDIT. - -package ent - -import ( - "context" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/m-mizutani/octovy/pkg/infra/ent/predicate" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatus" - "github.com/m-mizutani/octovy/pkg/infra/ent/vulnstatusindex" -) - -// VulnStatusIndexUpdate is the builder for updating VulnStatusIndex entities. -type VulnStatusIndexUpdate struct { - config - hooks []Hook - mutation *VulnStatusIndexMutation -} - -// Where appends a list predicates to the VulnStatusIndexUpdate builder. -func (vsiu *VulnStatusIndexUpdate) Where(ps ...predicate.VulnStatusIndex) *VulnStatusIndexUpdate { - vsiu.mutation.Where(ps...) - return vsiu -} - -// SetLatestID sets the "latest" edge to the VulnStatus entity by ID. -func (vsiu *VulnStatusIndexUpdate) SetLatestID(id int) *VulnStatusIndexUpdate { - vsiu.mutation.SetLatestID(id) - return vsiu -} - -// SetNillableLatestID sets the "latest" edge to the VulnStatus entity by ID if the given value is not nil. -func (vsiu *VulnStatusIndexUpdate) SetNillableLatestID(id *int) *VulnStatusIndexUpdate { - if id != nil { - vsiu = vsiu.SetLatestID(*id) - } - return vsiu -} - -// SetLatest sets the "latest" edge to the VulnStatus entity. -func (vsiu *VulnStatusIndexUpdate) SetLatest(v *VulnStatus) *VulnStatusIndexUpdate { - return vsiu.SetLatestID(v.ID) -} - -// AddStatuIDs adds the "status" edge to the VulnStatus entity by IDs. -func (vsiu *VulnStatusIndexUpdate) AddStatuIDs(ids ...int) *VulnStatusIndexUpdate { - vsiu.mutation.AddStatuIDs(ids...) - return vsiu -} - -// AddStatus adds the "status" edges to the VulnStatus entity. -func (vsiu *VulnStatusIndexUpdate) AddStatus(v ...*VulnStatus) *VulnStatusIndexUpdate { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return vsiu.AddStatuIDs(ids...) -} - -// Mutation returns the VulnStatusIndexMutation object of the builder. -func (vsiu *VulnStatusIndexUpdate) Mutation() *VulnStatusIndexMutation { - return vsiu.mutation -} - -// ClearLatest clears the "latest" edge to the VulnStatus entity. -func (vsiu *VulnStatusIndexUpdate) ClearLatest() *VulnStatusIndexUpdate { - vsiu.mutation.ClearLatest() - return vsiu -} - -// ClearStatus clears all "status" edges to the VulnStatus entity. -func (vsiu *VulnStatusIndexUpdate) ClearStatus() *VulnStatusIndexUpdate { - vsiu.mutation.ClearStatus() - return vsiu -} - -// RemoveStatuIDs removes the "status" edge to VulnStatus entities by IDs. -func (vsiu *VulnStatusIndexUpdate) RemoveStatuIDs(ids ...int) *VulnStatusIndexUpdate { - vsiu.mutation.RemoveStatuIDs(ids...) - return vsiu -} - -// RemoveStatus removes "status" edges to VulnStatus entities. -func (vsiu *VulnStatusIndexUpdate) RemoveStatus(v ...*VulnStatus) *VulnStatusIndexUpdate { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return vsiu.RemoveStatuIDs(ids...) -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (vsiu *VulnStatusIndexUpdate) Save(ctx context.Context) (int, error) { - var ( - err error - affected int - ) - if len(vsiu.hooks) == 0 { - affected, err = vsiu.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusIndexMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - vsiu.mutation = mutation - affected, err = vsiu.sqlSave(ctx) - mutation.done = true - return affected, err - }) - for i := len(vsiu.hooks) - 1; i >= 0; i-- { - if vsiu.hooks[i] == nil { - return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vsiu.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vsiu.mutation); err != nil { - return 0, err - } - } - return affected, err -} - -// SaveX is like Save, but panics if an error occurs. -func (vsiu *VulnStatusIndexUpdate) SaveX(ctx context.Context) int { - affected, err := vsiu.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (vsiu *VulnStatusIndexUpdate) Exec(ctx context.Context) error { - _, err := vsiu.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsiu *VulnStatusIndexUpdate) ExecX(ctx context.Context) { - if err := vsiu.Exec(ctx); err != nil { - panic(err) - } -} - -func (vsiu *VulnStatusIndexUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnstatusindex.Table, - Columns: vulnstatusindex.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - if ps := vsiu.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if vsiu.mutation.LatestCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatusindex.LatestTable, - Columns: []string{vulnstatusindex.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vsiu.mutation.LatestIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatusindex.LatestTable, - Columns: []string{vulnstatusindex.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if vsiu.mutation.StatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: vulnstatusindex.StatusTable, - Columns: []string{vulnstatusindex.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vsiu.mutation.RemovedStatusIDs(); len(nodes) > 0 && !vsiu.mutation.StatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: vulnstatusindex.StatusTable, - Columns: []string{vulnstatusindex.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vsiu.mutation.StatusIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: vulnstatusindex.StatusTable, - Columns: []string{vulnstatusindex.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, vsiu.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{vulnstatusindex.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return 0, err - } - return n, nil -} - -// VulnStatusIndexUpdateOne is the builder for updating a single VulnStatusIndex entity. -type VulnStatusIndexUpdateOne struct { - config - fields []string - hooks []Hook - mutation *VulnStatusIndexMutation -} - -// SetLatestID sets the "latest" edge to the VulnStatus entity by ID. -func (vsiuo *VulnStatusIndexUpdateOne) SetLatestID(id int) *VulnStatusIndexUpdateOne { - vsiuo.mutation.SetLatestID(id) - return vsiuo -} - -// SetNillableLatestID sets the "latest" edge to the VulnStatus entity by ID if the given value is not nil. -func (vsiuo *VulnStatusIndexUpdateOne) SetNillableLatestID(id *int) *VulnStatusIndexUpdateOne { - if id != nil { - vsiuo = vsiuo.SetLatestID(*id) - } - return vsiuo -} - -// SetLatest sets the "latest" edge to the VulnStatus entity. -func (vsiuo *VulnStatusIndexUpdateOne) SetLatest(v *VulnStatus) *VulnStatusIndexUpdateOne { - return vsiuo.SetLatestID(v.ID) -} - -// AddStatuIDs adds the "status" edge to the VulnStatus entity by IDs. -func (vsiuo *VulnStatusIndexUpdateOne) AddStatuIDs(ids ...int) *VulnStatusIndexUpdateOne { - vsiuo.mutation.AddStatuIDs(ids...) - return vsiuo -} - -// AddStatus adds the "status" edges to the VulnStatus entity. -func (vsiuo *VulnStatusIndexUpdateOne) AddStatus(v ...*VulnStatus) *VulnStatusIndexUpdateOne { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return vsiuo.AddStatuIDs(ids...) -} - -// Mutation returns the VulnStatusIndexMutation object of the builder. -func (vsiuo *VulnStatusIndexUpdateOne) Mutation() *VulnStatusIndexMutation { - return vsiuo.mutation -} - -// ClearLatest clears the "latest" edge to the VulnStatus entity. -func (vsiuo *VulnStatusIndexUpdateOne) ClearLatest() *VulnStatusIndexUpdateOne { - vsiuo.mutation.ClearLatest() - return vsiuo -} - -// ClearStatus clears all "status" edges to the VulnStatus entity. -func (vsiuo *VulnStatusIndexUpdateOne) ClearStatus() *VulnStatusIndexUpdateOne { - vsiuo.mutation.ClearStatus() - return vsiuo -} - -// RemoveStatuIDs removes the "status" edge to VulnStatus entities by IDs. -func (vsiuo *VulnStatusIndexUpdateOne) RemoveStatuIDs(ids ...int) *VulnStatusIndexUpdateOne { - vsiuo.mutation.RemoveStatuIDs(ids...) - return vsiuo -} - -// RemoveStatus removes "status" edges to VulnStatus entities. -func (vsiuo *VulnStatusIndexUpdateOne) RemoveStatus(v ...*VulnStatus) *VulnStatusIndexUpdateOne { - ids := make([]int, len(v)) - for i := range v { - ids[i] = v[i].ID - } - return vsiuo.RemoveStatuIDs(ids...) -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (vsiuo *VulnStatusIndexUpdateOne) Select(field string, fields ...string) *VulnStatusIndexUpdateOne { - vsiuo.fields = append([]string{field}, fields...) - return vsiuo -} - -// Save executes the query and returns the updated VulnStatusIndex entity. -func (vsiuo *VulnStatusIndexUpdateOne) Save(ctx context.Context) (*VulnStatusIndex, error) { - var ( - err error - node *VulnStatusIndex - ) - if len(vsiuo.hooks) == 0 { - node, err = vsiuo.sqlSave(ctx) - } else { - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*VulnStatusIndexMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - vsiuo.mutation = mutation - node, err = vsiuo.sqlSave(ctx) - mutation.done = true - return node, err - }) - for i := len(vsiuo.hooks) - 1; i >= 0; i-- { - if vsiuo.hooks[i] == nil { - return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") - } - mut = vsiuo.hooks[i](mut) - } - if _, err := mut.Mutate(ctx, vsiuo.mutation); err != nil { - return nil, err - } - } - return node, err -} - -// SaveX is like Save, but panics if an error occurs. -func (vsiuo *VulnStatusIndexUpdateOne) SaveX(ctx context.Context) *VulnStatusIndex { - node, err := vsiuo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (vsiuo *VulnStatusIndexUpdateOne) Exec(ctx context.Context) error { - _, err := vsiuo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (vsiuo *VulnStatusIndexUpdateOne) ExecX(ctx context.Context) { - if err := vsiuo.Exec(ctx); err != nil { - panic(err) - } -} - -func (vsiuo *VulnStatusIndexUpdateOne) sqlSave(ctx context.Context) (_node *VulnStatusIndex, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: vulnstatusindex.Table, - Columns: vulnstatusindex.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeString, - Column: vulnstatusindex.FieldID, - }, - }, - } - id, ok := vsiuo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing VulnStatusIndex.ID for update")} - } - _spec.Node.ID.Value = id - if fields := vsiuo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, vulnstatusindex.FieldID) - for _, f := range fields { - if !vulnstatusindex.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != vulnstatusindex.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := vsiuo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if vsiuo.mutation.LatestCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatusindex.LatestTable, - Columns: []string{vulnstatusindex.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vsiuo.mutation.LatestIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: false, - Table: vulnstatusindex.LatestTable, - Columns: []string{vulnstatusindex.LatestColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if vsiuo.mutation.StatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: vulnstatusindex.StatusTable, - Columns: []string{vulnstatusindex.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vsiuo.mutation.RemovedStatusIDs(); len(nodes) > 0 && !vsiuo.mutation.StatusCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: vulnstatusindex.StatusTable, - Columns: []string{vulnstatusindex.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := vsiuo.mutation.StatusIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: vulnstatusindex.StatusTable, - Columns: []string{vulnstatusindex.StatusColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: vulnstatus.FieldID, - }, - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &VulnStatusIndex{config: vsiuo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, vsiuo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{vulnstatusindex.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} - } - return nil, err - } - return _node, nil -} diff --git a/pkg/infra/gh/client.go b/pkg/infra/gh/client.go new file mode 100644 index 0000000..2151cac --- /dev/null +++ b/pkg/infra/gh/client.go @@ -0,0 +1,158 @@ +package gh + +import ( + "io" + "log/slog" + "net/http" + "net/url" + + "github.com/bradleyfalzon/ghinstallation/v2" + "github.com/google/go-github/v53/github" + "github.com/m-mizutani/goerr" + "github.com/m-mizutani/octovy/pkg/domain/model" + "github.com/m-mizutani/octovy/pkg/domain/types" +) + +type Client interface { + GetArchiveURL(ctx *model.Context, input *GetArchiveURLInput) (*url.URL, error) + // CreateIssueComment(repo *model.GitHubRepo, prID int, body string) error + // CreateCheckRun(repo *model.GitHubRepo, commit string) (int64, error) + // UpdateCheckRun(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error +} + +type GetArchiveURLInput struct { + Owner string + Repo string + CommitID string + InstallID types.GitHubAppInstallID +} + +type clientImpl struct { + appID types.GitHubAppID + pem types.GitHubAppPrivateKey +} + +func New(appID types.GitHubAppID, pem types.GitHubAppPrivateKey) (Client, error) { + if appID == 0 { + return nil, goerr.Wrap(types.ErrInvalidOption, "appID is empty") + } + if pem == "" { + return nil, goerr.Wrap(types.ErrInvalidOption, "pem is empty") + } + + return &clientImpl{ + appID: appID, + pem: pem, + }, nil +} + +func (x *clientImpl) buildGithubClient(installID types.GitHubAppInstallID) (*github.Client, error) { + tr := http.DefaultTransport + itr, err := ghinstallation.New(tr, int64(x.appID), int64(installID), []byte(x.pem)) + + if err != nil { + return nil, goerr.Wrap(err) + } + + return github.NewClient(&http.Client{Transport: itr}), nil +} + +func (x *clientImpl) GetArchiveURL(ctx *model.Context, input *GetArchiveURLInput) (*url.URL, error) { + ctx.Logger().Info("Sending GetArchiveLink request", + slog.Any("appID", x.appID), + slog.Any("privateKey", x.pem), + slog.Any("input", input), + ) + + client, err := x.buildGithubClient(input.InstallID) + if err != nil { + return nil, err + } + + opt := &github.RepositoryContentGetOptions{ + Ref: input.CommitID, + } + + // https://docs.github.com/en/rest/reference/repos#downloads + // https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#get-archive-link + url, r, err := client.Repositories.GetArchiveLink(ctx, input.Owner, input.Repo, github.Zipball, opt, false) + if err != nil { + return nil, goerr.Wrap(err) + } + if r.StatusCode != http.StatusFound { + body, _ := io.ReadAll(r.Body) + return nil, goerr.Wrap(err, "Failed to get archive link").With("status", r.StatusCode).With("body", string(body)) + } + + ctx.Logger().Debug("GetArchiveLink response", slog.Any("url", url), slog.Any("r", r)) + + return url, nil +} + +/* +func (x *clientImpl) CreateIssueComment(repo *model.GitHubRepo, prID int, body string) error { + client, err := x.githubClient() + if err != nil { + return err + } + + ctx := context.Background() + comment := &github.IssueComment{Body: &body} + + ret, resp, err := client.Issues.CreateComment(ctx, repo.Owner, repo.Name, prID, comment) + if err != nil { + return goerr.Wrap(err, "Failed to create github comment").With("repo", repo).With("prID", prID).With("comment", comment) + } + if resp.StatusCode != http.StatusCreated { + return goerr.Wrap(err, "Failed to ") + } + utils.Logger.With("comment", ret).Debug("Commented to PR") + + return nil +} + +func (x *clientImpl) CreateCheckRun(repo *model.GitHubRepo, commit string) (int64, error) { + client, err := x.githubClient() + if err != nil { + return 0, err + } + + ctx := context.Background() + opt := github.CreateCheckRunOptions{ + Name: "Octovy: package vulnerability check", + HeadSHA: commit, + Status: github.String("in_progress"), + } + + run, resp, err := client.Checks.CreateCheckRun(ctx, repo.Owner, repo.Name, opt) + if err != nil { + return 0, goerr.Wrap(err, "Failed to create check run").With("repo", repo).With("commit", commit) + } + if resp.StatusCode != http.StatusCreated { + return 0, goerr.Wrap(err, "Failed to ") + } + utils.Logger.With("run", run).Debug("Created check run") + + return *run.ID, nil +} + +func (x *clientImpl) UpdateCheckRun(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error { + client, err := x.githubClient() + if err != nil { + return err + } + + ctx := context.Background() + + _, resp, err := client.Checks.UpdateCheckRun(ctx, repo.Owner, repo.Name, checkID, *opt) + if err != nil { + return goerr.Wrap(err, "Failed to update check status to complete").With("repo", repo).With("id", checkID).With("opt", opt) + } + if resp.StatusCode != http.StatusOK { + return goerr.Wrap(err, "Failed to update status to complete") + } + utils.Logger.With("repo", repo).With("id", checkID).Debug("Created check run") + + return nil +} +*/ diff --git a/pkg/infra/github/client.go b/pkg/infra/github/client.go deleted file mode 100644 index 7c9c405..0000000 --- a/pkg/infra/github/client.go +++ /dev/null @@ -1,136 +0,0 @@ -package github - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "net/http" - - "github.com/google/go-github/v39/github" - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/utils" -) - -var logger = utils.Logger - -// This package is used to download trivy database, not used by GitHub App. -type Interface interface { - Authenticate(ctx *model.Context, code string) (*model.GitHubToken, error) - GetUser(ctx *model.Context, token *model.GitHubToken) (*github.User, error) -} - -type Client struct { - clientID string - clientSecret string - client *github.Client -} - -func New(id, secret string) (*Client, error) { - if id == "" { - return nil, goerr.Wrap(model.ErrInvalidSystemValue, "clientID is empty") - } - if secret == "" { - return nil, goerr.Wrap(model.ErrInvalidSystemValue, "clientSecret is empty") - } - - return &Client{ - clientID: id, - clientSecret: secret, - client: github.NewClient(&http.Client{}), - }, nil -} - -func (x *Client) Authenticate(ctx *model.Context, code string) (*model.GitHubToken, error) { - if code == "" { - return nil, goerr.Wrap(model.ErrInvalidSystemValue, "code is empty") - } - - authReq := struct { - ClientID string `json:"client_id"` - ClientSecret string `json:"client_secret"` - Code string `json:"code"` - }{ - ClientID: x.clientID, - ClientSecret: x.clientSecret, - Code: code, - } - authReqBody, err := json.Marshal(authReq) - if err != nil { - return nil, goerr.Wrap(err, "Failed to encode authReq") - } - - webURL := "https://github.com/login/oauth/access_token" - req, err := http.NewRequestWithContext(ctx, "POST", webURL, bytes.NewReader(authReqBody)) - if err != nil { - return nil, goerr.Wrap(err, "Failed to create a new auth request").With("url", webURL) - } - req.Header.Add("Content-Type", "application/json") - req.Header.Add("Accept", "application/json") - - client := &http.Client{} - resp, err := client.Do(req) - if err != nil { - return nil, goerr.Wrap(err, "Failed to post access_token").With("url", webURL) - } - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, goerr.Wrap(err) - } - if resp.StatusCode != http.StatusOK { - return nil, goerr.Wrap(err, "Failed to post access_token").With("body", string(body)).With("code", resp.StatusCode).With("url", webURL) - } - - var token model.GitHubToken - if err := json.Unmarshal(body, &token); err != nil { - return nil, goerr.Wrap(err, "Failed to parse GitHub access token").With("url", webURL) - } - ctx.Log().Trace("GitHub Authenticated") - - return &token, nil -} - -func (x *Client) GetUser(ctx *model.Context, token *model.GitHubToken) (*github.User, error) { - body, err := getRequest(ctx, token, "https://api.github.com/user") - if err != nil { - return nil, err - } - - var user github.User - if err := json.Unmarshal(body, &user); err != nil { - return nil, goerr.Wrap(err, "Failed to parse github user").With("body", string(body)) - } - - ctx.Log().With("user", user).Trace("Got github user") - - if user.ID == nil { - return nil, goerr.New("No GitHub user ID").With("user", user) - } - - return &user, nil -} - -func getRequest(ctx *model.Context, token *model.GitHubToken, url string) ([]byte, error) { - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) - if err != nil { - return nil, goerr.Wrap(err) - } - req.Header.Add("Accept", "application/vnd.github.v3+json") - req.Header.Set("Authorization", "token "+token.AccessToken) - - client := &http.Client{} - resp, err := client.Do(req) - if err != nil { - return nil, goerr.Wrap(err) - } - - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, goerr.Wrap(err) - } - if resp.StatusCode != http.StatusOK { - return nil, goerr.Wrap(err, "Failed to get").With("body", string(body)).With("url", url).With("code", resp.StatusCode) - } - - return body, nil -} diff --git a/pkg/infra/github/mock.go b/pkg/infra/github/mock.go deleted file mode 100644 index 843c90b..0000000 --- a/pkg/infra/github/mock.go +++ /dev/null @@ -1,23 +0,0 @@ -package github - -import ( - "github.com/google/go-github/v39/github" - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -func NewMock() *Mock { - return &Mock{} -} - -type Mock struct { - AuthenticateMock func(ctx *model.Context, code string) (*model.GitHubToken, error) - GetUserMock func(ctx *model.Context, token *model.GitHubToken) (*github.User, error) -} - -func (x *Mock) Authenticate(ctx *model.Context, code string) (*model.GitHubToken, error) { - return x.AuthenticateMock(ctx, code) -} - -func (x *Mock) GetUser(ctx *model.Context, token *model.GitHubToken) (*github.User, error) { - return x.GetUserMock(ctx, token) -} diff --git a/pkg/infra/githubapp/app.go b/pkg/infra/githubapp/app.go deleted file mode 100644 index 538d60d..0000000 --- a/pkg/infra/githubapp/app.go +++ /dev/null @@ -1,179 +0,0 @@ -package githubapp - -import ( - "context" - "io" - "io/ioutil" - "net/http" - - "github.com/bradleyfalzon/ghinstallation" - "github.com/google/go-github/v39/github" - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/utils" -) - -var logger = utils.Logger - -type Interface interface { - GetCodeZip(repo *model.GitHubRepo, commitID string, w io.WriteCloser) error - CreateIssueComment(repo *model.GitHubRepo, prID int, body string) error - CreateCheckRun(repo *model.GitHubRepo, commit string) (int64, error) - UpdateCheckRun(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error -} - -type Client struct { - appID int64 - installID int64 - pem []byte - - client *github.Client -} - -type Factory func(installID int64) Interface - -func New(appID int64, pem []byte) Factory { - return func(installID int64) Interface { - return &Client{ - appID: appID, - installID: installID, - pem: pem, - } - } -} - -func (x *Client) githubClient() (*github.Client, error) { - if x.client != nil { - return x.client, nil - } - - tr := http.DefaultTransport - itr, err := ghinstallation.New(tr, x.appID, x.installID, x.pem) - - if err != nil { - return nil, goerr.Wrap(err) - } - - x.client = github.NewClient(&http.Client{Transport: itr}) - - return x.client, nil -} - -func (x *Client) GetCodeZip(repo *model.GitHubRepo, commitID string, w io.WriteCloser) error { - client, err := x.githubClient() - if err != nil { - return err - } - - opt := &github.RepositoryContentGetOptions{ - Ref: commitID, - } - ctx := context.Background() - - utils.Logger. - With("appID", x.appID). - With("repo", repo). - With("installID", x.installID). - With("privateKey.length", len(x.pem)). - Debug("Sending GetArchiveLink request") - - // https://docs.github.com/en/rest/reference/repos#downloads - url, r, err := client.Repositories.GetArchiveLink(ctx, repo.Owner, repo.Name, github.Zipball, opt, false) - if err != nil { - return goerr.Wrap(err) - } - - utils.Logger.With("code", r.StatusCode).Debug("resp of GetArchiveLink") - - req, err := http.NewRequest("GET", url.String(), nil) - if err != nil { - return goerr.Wrap(err) - } - - httpClient := &http.Client{} - resp, err := httpClient.Do(req) - if err != nil { - return goerr.Wrap(err) - } - if resp.StatusCode != http.StatusOK { - var msg string - if body, err := ioutil.ReadAll(resp.Body); err != nil { - msg = err.Error() - } else { - msg = string(body) - } - return goerr.New("GitHub download request is failed").With("status", resp.StatusCode).With("body", msg) - } - - if _, err := io.Copy(w, resp.Body); err != nil { - return goerr.Wrap(err) - } - - return nil -} - -func (x *Client) CreateIssueComment(repo *model.GitHubRepo, prID int, body string) error { - client, err := x.githubClient() - if err != nil { - return err - } - - ctx := context.Background() - comment := &github.IssueComment{Body: &body} - - ret, resp, err := client.Issues.CreateComment(ctx, repo.Owner, repo.Name, prID, comment) - if err != nil { - return goerr.Wrap(err, "Failed to create github comment").With("repo", repo).With("prID", prID).With("comment", comment) - } - if resp.StatusCode != http.StatusCreated { - return goerr.Wrap(err, "Failed to ") - } - utils.Logger.With("comment", ret).Debug("Commented to PR") - - return nil -} - -func (x *Client) CreateCheckRun(repo *model.GitHubRepo, commit string) (int64, error) { - client, err := x.githubClient() - if err != nil { - return 0, err - } - - ctx := context.Background() - opt := github.CreateCheckRunOptions{ - Name: "Octovy: package vulnerability check", - HeadSHA: commit, - Status: github.String("in_progress"), - } - - run, resp, err := client.Checks.CreateCheckRun(ctx, repo.Owner, repo.Name, opt) - if err != nil { - return 0, goerr.Wrap(err, "Failed to create check run").With("repo", repo).With("commit", commit) - } - if resp.StatusCode != http.StatusCreated { - return 0, goerr.Wrap(err, "Failed to ") - } - utils.Logger.With("run", run).Debug("Created check run") - - return *run.ID, nil -} - -func (x *Client) UpdateCheckRun(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error { - client, err := x.githubClient() - if err != nil { - return err - } - - ctx := context.Background() - - _, resp, err := client.Checks.UpdateCheckRun(ctx, repo.Owner, repo.Name, checkID, *opt) - if err != nil { - return goerr.Wrap(err, "Failed to update check status to complete").With("repo", repo).With("id", checkID).With("opt", opt) - } - if resp.StatusCode != http.StatusOK { - return goerr.Wrap(err, "Failed to update status to complete") - } - utils.Logger.With("repo", repo).With("id", checkID).Debug("Created check run") - - return nil -} diff --git a/pkg/infra/githubapp/app_test.go b/pkg/infra/githubapp/app_test.go deleted file mode 100644 index 63f7273..0000000 --- a/pkg/infra/githubapp/app_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package githubapp_test - -import ( - "bytes" - "io/ioutil" - "strconv" - "testing" - - "github.com/Netflix/go-env" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/githubapp" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -type WriteBuffer struct { - bytes.Buffer -} - -func (x *WriteBuffer) Close() error { return nil } - -func TestGitHubDownload(t *testing.T) { - var props struct { - GITHUB_APP_ID string `env:"GITHUB_APP_ID"` - GITHUB_APP_PRIVATE_KEY string `env:"GITHUB_APP_PRIVATE_KEY"` - GITHUB_COMMIT string `env:"GITHUB_COMMIT"` - GITHUB_ENDPOINT string `env:"GITHUB_ENDPOINT"` - GITHUB_INSTALL_ID string `env:"GITHUB_INSTALL_ID"` - GITHUB_ORG string `env:"GITHUB_ORG"` - GITHUB_REPO_NAME string `env:"GITHUB_REPO_NAME"` - } - _, err := env.UnmarshalFromEnviron(&props) - require.NoError(t, err) - - if props.GITHUB_APP_ID == "" || - props.GITHUB_APP_PRIVATE_KEY == "" || - props.GITHUB_COMMIT == "" || - props.GITHUB_INSTALL_ID == "" || - props.GITHUB_ORG == "" || - props.GITHUB_REPO_NAME == "" { - t.Logf("props => %+v\n", props) - t.Skip("Not enough paramters") - } - - installID, err := strconv.ParseInt(props.GITHUB_INSTALL_ID, 10, 64) - require.NoError(t, err) - - privateKey, err := ioutil.ReadFile(props.GITHUB_APP_PRIVATE_KEY) - require.NoError(t, err) - - appID, err := strconv.ParseInt(props.GITHUB_APP_ID, 10, 64) - require.NoError(t, err) - - app := githubapp.New(appID, privateKey)(installID) - - buf := &WriteBuffer{} - repo := &model.GitHubRepo{ - Owner: props.GITHUB_ORG, - Name: props.GITHUB_REPO_NAME, - } - require.NoError(t, app.GetCodeZip(repo, props.GITHUB_COMMIT, buf)) - assert.NotEmpty(t, buf.Bytes()) -} diff --git a/pkg/infra/githubapp/client.go b/pkg/infra/githubapp/client.go new file mode 100644 index 0000000..17d2c48 --- /dev/null +++ b/pkg/infra/githubapp/client.go @@ -0,0 +1,159 @@ +package gh + +import ( + "io" + "log/slog" + "net/http" + "net/url" + + "github.com/bradleyfalzon/ghinstallation/v2" + "github.com/google/go-github/v53/github" + "github.com/m-mizutani/goerr" + "github.com/m-mizutani/octovy/pkg/domain/model" + "github.com/m-mizutani/octovy/pkg/domain/types" +) + +type Client interface { + GetArchiveURL(ctx *model.Context, input *GetArchiveURLInput) (*url.URL, error) + // CreateIssueComment(repo *model.GitHubRepo, prID int, body string) error + // CreateCheckRun(repo *model.GitHubRepo, commit string) (int64, error) + // UpdateCheckRun(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error +} + +type GetArchiveURLInput struct { + Owner string + Repo string + CommitID string + InstallID types.GitHubAppInstallID +} + +type clientImpl struct { + appID types.GitHubAppID + pem types.GitHubAppPrivateKey +} + +func New(appID types.GitHubAppID, pem types.GitHubAppPrivateKey) (Client, error) { + if appID == 0 { + return nil, goerr.Wrap(types.ErrInvalidOption, "appID is empty") + } + if pem == "" { + return nil, goerr.Wrap(types.ErrInvalidOption, "pem is empty") + } + + return &clientImpl{ + appID: appID, + pem: pem, + }, nil +} + +func (x *clientImpl) buildGithubClient(installID types.GitHubAppInstallID) (*github.Client, error) { + tr := http.DefaultTransport + itr, err := ghinstallation.New(tr, int64(x.appID), int64(installID), []byte(x.pem)) + + if err != nil { + return nil, goerr.Wrap(err) + } + + return github.NewClient(&http.Client{Transport: itr}), nil +} + +func (x *clientImpl) GetArchiveURL(ctx *model.Context, input *GetArchiveURLInput) (*url.URL, error) { + client, err := x.buildGithubClient(input.InstallID) + if err != nil { + return nil, err + } + + opt := &github.RepositoryContentGetOptions{ + Ref: input.CommitID, + } + + ctx.Logger().Debug("Sending GetArchiveLink request", + slog.Any("appID", x.appID), + slog.Any("repo", input.Repo), + slog.Any("installID", input.InstallID), + slog.Any("privateKey.length", len(x.pem)), + ) + + // https://docs.github.com/en/rest/reference/repos#downloads + // https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#get-archive-link + url, r, err := client.Repositories.GetArchiveLink(ctx, input.Owner, input.Repo, github.Zipball, opt, false) + if err != nil { + return nil, goerr.Wrap(err) + } + if r.StatusCode != http.StatusFound { + body, _ := io.ReadAll(r.Body) + return nil, goerr.Wrap(err, "Failed to get archive link").With("status", r.StatusCode).With("body", string(body)) + } + + ctx.Logger().Debug("GetArchiveLink response", slog.Any("url", url), slog.Any("r", r)) + + return url, nil +} + +/* +func (x *clientImpl) CreateIssueComment(repo *model.GitHubRepo, prID int, body string) error { + client, err := x.githubClient() + if err != nil { + return err + } + + ctx := context.Background() + comment := &github.IssueComment{Body: &body} + + ret, resp, err := client.Issues.CreateComment(ctx, repo.Owner, repo.Name, prID, comment) + if err != nil { + return goerr.Wrap(err, "Failed to create github comment").With("repo", repo).With("prID", prID).With("comment", comment) + } + if resp.StatusCode != http.StatusCreated { + return goerr.Wrap(err, "Failed to ") + } + utils.Logger.With("comment", ret).Debug("Commented to PR") + + return nil +} + +func (x *clientImpl) CreateCheckRun(repo *model.GitHubRepo, commit string) (int64, error) { + client, err := x.githubClient() + if err != nil { + return 0, err + } + + ctx := context.Background() + opt := github.CreateCheckRunOptions{ + Name: "Octovy: package vulnerability check", + HeadSHA: commit, + Status: github.String("in_progress"), + } + + run, resp, err := client.Checks.CreateCheckRun(ctx, repo.Owner, repo.Name, opt) + if err != nil { + return 0, goerr.Wrap(err, "Failed to create check run").With("repo", repo).With("commit", commit) + } + if resp.StatusCode != http.StatusCreated { + return 0, goerr.Wrap(err, "Failed to ") + } + utils.Logger.With("run", run).Debug("Created check run") + + return *run.ID, nil +} + +func (x *clientImpl) UpdateCheckRun(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error { + client, err := x.githubClient() + if err != nil { + return err + } + + ctx := context.Background() + + _, resp, err := client.Checks.UpdateCheckRun(ctx, repo.Owner, repo.Name, checkID, *opt) + if err != nil { + return goerr.Wrap(err, "Failed to update check status to complete").With("repo", repo).With("id", checkID).With("opt", opt) + } + if resp.StatusCode != http.StatusOK { + return goerr.Wrap(err, "Failed to update status to complete") + } + utils.Logger.With("repo", repo).With("id", checkID).Debug("Created check run") + + return nil +} +*/ diff --git a/pkg/infra/githubapp/mock.go b/pkg/infra/githubapp/mock.go deleted file mode 100644 index 792734f..0000000 --- a/pkg/infra/githubapp/mock.go +++ /dev/null @@ -1,41 +0,0 @@ -package githubapp - -import ( - "io" - - "github.com/google/go-github/v39/github" - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -type Mock struct { - GetCodeZipMock func(repo *model.GitHubRepo, commitID string, w io.WriteCloser) error - CreateIssueCommentMock func(repo *model.GitHubRepo, prID int, body string) error - CreateCheckRunMock func(repo *model.GitHubRepo, commit string) (int64, error) - UpdateCheckRunMock func(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error - - AppID int64 - InstallID int64 - PEM []byte -} - -func NewMock() (Factory, *Mock) { - mock := &Mock{} - return func(installID int64) Interface { - mock.InstallID = installID - - return mock - }, mock -} - -func (x *Mock) GetCodeZip(repo *model.GitHubRepo, commitID string, w io.WriteCloser) error { - return x.GetCodeZipMock(repo, commitID, w) -} -func (x *Mock) CreateIssueComment(repo *model.GitHubRepo, prID int, body string) error { - return x.CreateIssueCommentMock(repo, prID, body) -} -func (x *Mock) CreateCheckRun(repo *model.GitHubRepo, commit string) (int64, error) { - return x.CreateCheckRunMock(repo, commit) -} -func (x *Mock) UpdateCheckRun(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error { - return x.UpdateCheckRunMock(repo, checkID, opt) -} diff --git a/pkg/infra/infra.go b/pkg/infra/infra.go deleted file mode 100644 index 9d4442c..0000000 --- a/pkg/infra/infra.go +++ /dev/null @@ -1,106 +0,0 @@ -package infra - -import ( - "io/ioutil" - "time" - - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/infra/db" - "github.com/m-mizutani/octovy/pkg/infra/github" - "github.com/m-mizutani/octovy/pkg/infra/githubapp" - "github.com/m-mizutani/octovy/pkg/infra/opa" - "github.com/m-mizutani/octovy/pkg/infra/policy" - "github.com/m-mizutani/octovy/pkg/infra/trivy" -) - -type Config struct { - DBType string - DBConfig string `zlog:"secret"` - - GitHubAppID int64 - GitHubAppPrivateKey string `zlog:"secret"` - GitHubAppClientID string - GitHubAppSecret string `zlog:"secret"` - - CheckPolicyData string - - OPA opa.Config - - TrivyPath string -} - -type Clients struct { - DB db.Interface - GitHub github.Interface - NewGitHubApp githubapp.Factory - CheckPolicy policy.Check - Trivy trivy.Interface - OPAClient opa.Interface - Utils *Utils - - config *Config -} - -type Utils struct { - Now func() time.Time - ReadFile func(fname string) ([]byte, error) -} - -func NewUtils() *Utils { - return &Utils{ - Now: time.Now, - ReadFile: ioutil.ReadFile, - } -} - -func New(cfg *Config) (*Clients, error) { - githubClient, err := github.New(cfg.GitHubAppClientID, cfg.GitHubAppSecret) - if err != nil { - return nil, err - } - - clients := &Clients{ - DB: db.New(), - GitHub: githubClient, - NewGitHubApp: githubapp.New(cfg.GitHubAppID, []byte(cfg.GitHubAppPrivateKey)), - Trivy: trivy.New(), - Utils: NewUtils(), - - config: cfg, - } - - if clients.config.TrivyPath != "" { - clients.Trivy.SetPath(clients.config.TrivyPath) - } - - if err := clients.DB.Open(clients.config.DBType, clients.config.DBConfig); err != nil { - return nil, goerr.Wrap(err) - } - - if clients.config.CheckPolicyData != "" { - check, err := policy.NewCheck(clients.config.CheckPolicyData) - if err != nil { - return nil, err - } - - clients.CheckPolicy = check - } - - if clients.config.OPA.BaseURL != "" { - client, err := opa.New(&clients.config.OPA) - if err != nil { - return nil, err - } - clients.OPAClient = client - } - - return clients, nil -} - -func (x *Clients) GitHubAppClientID() string { - return x.config.GitHubAppClientID -} - -func (x *Clients) GitHubAppID() string { - return x.config.GitHubAppClientID -} diff --git a/pkg/infra/opa/client.go b/pkg/infra/opa/client.go deleted file mode 100644 index 31a93a9..0000000 --- a/pkg/infra/opa/client.go +++ /dev/null @@ -1,79 +0,0 @@ -package opa - -import ( - "context" - "net/http" - "strings" - - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/utils" - opaclient "github.com/m-mizutani/opa-go-client" - "google.golang.org/api/idtoken" -) - -var logger = utils.Logger - -type Interface interface { - Data(ctx context.Context, pkg RegoPkg, input interface{}, result interface{}) error -} - -type RegoPkg string - -const ( - Check RegoPkg = "check" -) - -type Client struct { - client *opaclient.Client - config Config - basePath string -} - -type Config struct { - BaseURL string - Path string - UseGoogleIAP bool -} - -type googleIAPClient struct{} - -func (x *googleIAPClient) Do(req *http.Request) (*http.Response, error) { - client, err := idtoken.NewClient(req.Context(), req.URL.String()) - if err != nil { - return nil, goerr.Wrap(err, "failed idtoken.NewClient for GCP IAP").With("req", req) - } - - logger.With("req", req).Debug("Created IAP HTTP request") - - return client.Do(req) - -} - -func New(cfg *Config) (*Client, error) { - var options []opaclient.Option - if cfg.UseGoogleIAP { - options = append(options, opaclient.WithHTTPClient(&googleIAPClient{})) - } - client, err := opaclient.New(cfg.BaseURL, options...) - if err != nil { - return nil, goerr.Wrap(err) - } - - return &Client{ - client: client, - config: *cfg, - basePath: strings.TrimRight(cfg.Path, "/"), - }, nil -} - -func (x *Client) Data(ctx context.Context, pkg RegoPkg, input interface{}, result interface{}) error { - req := &opaclient.DataRequest{ - Path: x.basePath + "/" + string(pkg), - Input: input, - } - if err := x.client.GetData(ctx, req, result); err != nil { - return goerr.Wrap(err) - } - - return nil -} diff --git a/pkg/infra/opa/client_test.go b/pkg/infra/opa/client_test.go deleted file mode 100644 index c25f4ba..0000000 --- a/pkg/infra/opa/client_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package opa_test - -import ( - "context" - "os" - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/opa" - "github.com/stretchr/testify/require" -) - -func TestOPAClient(t *testing.T) { - url, ok := os.LookupEnv("OPA_SERVER_URL") - if !ok { - t.Skip("OPA_SERVER_URL is not set") - } - - obj := map[string]string{ - "user": "blue", - } - var resp model.GitHubCheckResult - - client, err := opa.New(&opa.Config{ - BaseURL: url, - Path: "octovy/testing", - }) - - require.NoError(t, err) - require.NoError(t, client.Data(context.Background(), "", obj, resp)) -} diff --git a/pkg/infra/opa/mock.go b/pkg/infra/opa/mock.go deleted file mode 100644 index 4a80309..0000000 --- a/pkg/infra/opa/mock.go +++ /dev/null @@ -1,11 +0,0 @@ -package opa - -import "context" - -type Mock struct { - MockData func(ctx context.Context, pkg RegoPkg, input interface{}, result interface{}) error -} - -func (x *Mock) Data(ctx context.Context, pkg RegoPkg, input interface{}, result interface{}) error { - return x.MockData(ctx, pkg, input, result) -} diff --git a/pkg/infra/policy/policy.go b/pkg/infra/policy/policy.go deleted file mode 100644 index ee0ed85..0000000 --- a/pkg/infra/policy/policy.go +++ /dev/null @@ -1,69 +0,0 @@ -package policy - -import ( - "encoding/json" - - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/open-policy-agent/opa/ast" - "github.com/open-policy-agent/opa/rego" -) - -func NewCheck(query string) (Check, error) { - compiler, err := ast.CompileModules(map[string]string{ - "check.rego": query, - }) - if err != nil { - return nil, goerr.Wrap(err) - } - return &checkPolicy{ - compiler: compiler, - }, nil -} - -type CheckFactory func(query string) (Check, error) -type Check interface { - Result(ctx *model.Context, inv *model.ScanReport) (*model.GitHubCheckResult, error) -} - -type checkPolicy struct { - compiler *ast.Compiler -} - -func (x *checkPolicy) Result(ctx *model.Context, inv *model.ScanReport) (*model.GitHubCheckResult, error) { - policy := rego.New( - rego.Query(`response = data.octovy.check`), - rego.Compiler(x.compiler), - rego.Input(inv), - ) - rs, err := policy.Eval(ctx) - if err != nil { - return nil, goerr.Wrap(err) - } - - if len(rs) != 1 { - return nil, goerr.Wrap(model.ErrInvalidPolicyResult, "only 1 result is acceptable").With("rego.ResultSet", rs) - } - - response, ok := rs[0].Bindings["response"] - if !ok { - return nil, goerr.Wrap(model.ErrInvalidPolicyResult, "'response' is empty") - } - - raw, err := json.Marshal(response) - if err != nil { - return nil, model.ErrInvalidPolicyResult.Wrap(err) - } - var result model.GitHubCheckResult - if err := json.Unmarshal(raw, &result); err != nil { - return nil, model.ErrInvalidPolicyResult.Wrap(err) - } - - switch result.Conclusion { - case "action_required", "cancelled", "failure", "neutral", "success", "skipped", "stale", "timed_out": - return &result, nil - - default: - return nil, goerr.Wrap(model.ErrInvalidPolicyResult, "Unsupported GitHub check conclusion").With("resultSet", rs) - } -} diff --git a/pkg/infra/policy/policy_test.go b/pkg/infra/policy/policy_test.go deleted file mode 100644 index 5c59a2a..0000000 --- a/pkg/infra/policy/policy_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package policy_test - -import ( - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/infra/policy" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestCheckRule(t *testing.T) { - inv := model.NewScanReport(&ent.Scan{ - Edges: ent.ScanEdges{ - Packages: []*ent.PackageRecord{ - { - Type: "gomod", - Source: "go.sum", - Name: "github.com/dgrijalva/jwt-go", - Version: "3.2.0+incompatible", - VulnIds: []string{"CVE-2020-26160"}, - Edges: ent.PackageRecordEdges{ - Vulnerabilities: []*ent.Vulnerability{ - { - ID: "CVE-2020-26160", - Edges: ent.VulnerabilityEdges{ - CustomSeverity: &ent.Severity{ - Label: "high", - }, - }, - }, - }, - }, - }, - }, - }, - }, nil, 0) - - ctx := model.NewContext() - t.Run("always success", func(t *testing.T) { - check, err := policy.NewCheck(`package octovy.check -conclusion = "success" -`) - require.NoError(t, err) - - result, err := check.Result(ctx, inv) - require.NoError(t, err) - assert.Equal(t, "success", result.Conclusion) - assert.Empty(t, result.Messages) - }) - - t.Run("failure if severity is high", func(t *testing.T) { - check, err := policy.NewCheck(`package octovy.check -default conclusion = "success" -conclusion = "failure" { - vuln := input.sources[_].packages[_].vulnerabilities[_] - vuln.custom_severity == "high" -} -`) - require.NoError(t, err) - - result, err := check.Result(ctx, inv) - require.NoError(t, err) - assert.Equal(t, "failure", result.Conclusion) - assert.Empty(t, result.Messages) - }) - - t.Run("message is set by msg", func(t *testing.T) { - check, err := policy.NewCheck(`package octovy.check - conclusion = "success" - messages = {"blue"} -`) - require.NoError(t, err) - - result, err := check.Result(ctx, inv) - require.NoError(t, err) - assert.Equal(t, "success", result.Conclusion) - assert.Contains(t, result.Messages, "blue") - }) - - t.Run("err if invalid rego", func(t *testing.T) { - _, err := policy.NewCheck(`package octovy.check - default result = "success" - conclusion = "failure" { - vuln := input.sources[_].packages[_].vulnerabilities[_] - vuln.custom_severity == "high" - `) // missing tail bracket - require.Error(t, err) - }) - - t.Run("err if missing result field", func(t *testing.T) { - check, err := policy.NewCheck(`package octovy.check - xxx = "failure" { - vuln := input.sources[_].packages[_].vulnerabilities[_] - vuln.custom_severity == "high" - } - `) - require.NoError(t, err) - - result, err := check.Result(ctx, inv) - require.Error(t, err) - assert.ErrorIs(t, err, model.ErrInvalidPolicyResult) - assert.Nil(t, result) - }) - - t.Run("err if package name is not octovy.check", func(t *testing.T) { - check, err := policy.NewCheck(`package octovy.cheeeeeeeeeeeeeeeeeeek - default result = "success" - conclusion = "failure" { - vuln := input.sources[_].packages[_].vulnerabilities[_] - vuln.custom_severity == "high" - } - `) - require.NoError(t, err) - - result, err := check.Result(ctx, inv) - require.ErrorIs(t, err, model.ErrInvalidPolicyResult) - assert.Nil(t, result) - }) - - t.Run("err if missing package", func(t *testing.T) { - _, err := policy.NewCheck(` - default conclusion = "success" - conclusion = "failure" { - vuln := input.sources[_].packages[_].vulnerabilities[_] - vuln.custom_severity == "high" - } - `) - require.Error(t, err) - }) - - t.Run("err if result is not string", func(t *testing.T) { - check, err := policy.NewCheck(`package octovy.check - conclusion = 0 -`) - require.NoError(t, err) - - result, err := check.Result(ctx, inv) - require.Error(t, err) - assert.ErrorIs(t, err, model.ErrInvalidPolicyResult) - assert.Nil(t, result) - }) -} diff --git a/pkg/infra/trivy/client.go b/pkg/infra/trivy/client.go new file mode 100644 index 0000000..2300683 --- /dev/null +++ b/pkg/infra/trivy/client.go @@ -0,0 +1,40 @@ +package trivy + +import ( + "bytes" + "os/exec" + + "github.com/m-mizutani/goerr" + "github.com/m-mizutani/octovy/pkg/domain/model" +) + +type Client interface { + Run(ctx *model.Context, args []string) error +} + +type clientImpl struct { + path string +} + +func New(path string) Client { + return &clientImpl{ + path: path, + } +} + +func (x *clientImpl) Run(ctx *model.Context, args []string) error { + cmd := exec.CommandContext(ctx, x.path, args...) + var stdout bytes.Buffer + var stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + + if err := cmd.Run(); err != nil { + ctx.Logger().With("stderr", stderr.String()).With("stdout", stdout.String()).Error("trivy failed") + return goerr.Wrap(err, "executing trivy"). + With("stderr", stderr.String()). + With("stdout", stdout.String()) + } + + return nil +} diff --git a/pkg/infra/trivy/client_test.go b/pkg/infra/trivy/client_test.go new file mode 100644 index 0000000..8fb0d58 --- /dev/null +++ b/pkg/infra/trivy/client_test.go @@ -0,0 +1,48 @@ +package trivy_test + +import ( + "encoding/json" + "os" + "path/filepath" + "testing" + + "github.com/m-mizutani/gt" + "github.com/m-mizutani/octovy/pkg/domain/model" + "github.com/m-mizutani/octovy/pkg/infra/trivy" + + ftypes "github.com/aquasecurity/trivy/pkg/fanal/types" + ttypes "github.com/aquasecurity/trivy/pkg/types" +) + +func Test(t *testing.T) { + path, ok := os.LookupEnv("TEST_TRIVY_PATH") + if !ok { + t.Skip("TEST_TRIVY_PATH is not set") + } + + target := gt.R1(filepath.Abs("../../../")).NoError(t) + t.Log(target) + + tmp := gt.R1(os.CreateTemp("", "trivy-scan-*.json")).NoError(t) + gt.NoError(t, tmp.Close()) + + client := trivy.New(path) + ctx := model.NewContext() + gt.NoError(t, client.Run(ctx, []string{ + "fs", + target, + "-f", "json", + "-o", tmp.Name(), + "--list-all-pkgs", + })) + + var report ttypes.Report + body := gt.R1(os.ReadFile(tmp.Name())).NoError(t) + gt.NoError(t, json.Unmarshal(body, &report)) + gt.V(t, report.SchemaVersion).Equal(2) + gt.A(t, report.Results).Length(1).At(0, func(t testing.TB, v ttypes.Result) { + gt.A(t, v.Packages).Any(func(v ftypes.Package) bool { + return v.Name == "github.com/m-mizutani/goerr" + }) + }) +} diff --git a/pkg/infra/trivy/mock.go b/pkg/infra/trivy/mock.go deleted file mode 100644 index abf7f69..0000000 --- a/pkg/infra/trivy/mock.go +++ /dev/null @@ -1,18 +0,0 @@ -package trivy - -import ( - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -type Mock struct { - Interface - ScanMock func(dir string) (*model.TrivyReport, error) -} - -func NewMock() *Mock { - return &Mock{} -} - -func (x *Mock) Scan(dir string) (*model.TrivyReport, error) { - return x.ScanMock(dir) -} diff --git a/pkg/infra/trivy/testdata/Gemfile b/pkg/infra/trivy/testdata/Gemfile deleted file mode 100644 index 8a83a72..0000000 --- a/pkg/infra/trivy/testdata/Gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" - -git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } - -gem "rails" -gem "rubyzip", "1.2.1" - diff --git a/pkg/infra/trivy/testdata/Gemfile.lock b/pkg/infra/trivy/testdata/Gemfile.lock deleted file mode 100644 index 85de348..0000000 --- a/pkg/infra/trivy/testdata/Gemfile.lock +++ /dev/null @@ -1,141 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actioncable (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) - mail (>= 2.7.1) - actionmailer (6.1.4) - actionpack (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activesupport (= 6.1.4) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.4) - actionview (= 6.1.4) - activesupport (= 6.1.4) - rack (~> 2.0, >= 2.0.9) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4) - actionpack (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) - nokogiri (>= 1.8.5) - actionview (6.1.4) - activesupport (= 6.1.4) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4) - activesupport (= 6.1.4) - globalid (>= 0.3.6) - activemodel (6.1.4) - activesupport (= 6.1.4) - activerecord (6.1.4) - activemodel (= 6.1.4) - activesupport (= 6.1.4) - activestorage (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activesupport (= 6.1.4) - marcel (~> 1.0.0) - mini_mime (>= 1.1.0) - activesupport (6.1.4) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) - builder (3.2.4) - concurrent-ruby (1.1.9) - crass (1.0.6) - erubi (1.10.0) - globalid (0.5.2) - activesupport (>= 5.0) - i18n (1.8.10) - concurrent-ruby (~> 1.0) - loofah (2.11.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.1) - method_source (1.0.0) - mini_mime (1.1.0) - mini_portile2 (2.6.1) - minitest (5.14.4) - nio4r (2.5.8) - nokogiri (1.12.2) - mini_portile2 (~> 2.6.1) - racc (~> 1.4) - racc (1.5.2) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.4) - actioncable (= 6.1.4) - actionmailbox (= 6.1.4) - actionmailer (= 6.1.4) - actionpack (= 6.1.4) - actiontext (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activemodel (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) - bundler (>= 1.15.0) - railties (= 6.1.4) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) - method_source - rake (>= 0.13) - thor (~> 1.0) - rake (13.0.6) - rubyzip (1.2.1) - sprockets (4.0.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - thor (1.1.0) - tzinfo (2.0.4) - concurrent-ruby (~> 1.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - zeitwerk (2.4.2) - -PLATFORMS - ruby - -DEPENDENCIES - rails - rubyzip (= 1.2.1) - -BUNDLED WITH - 1.17.2 - diff --git a/pkg/infra/trivy/trivy.go b/pkg/infra/trivy/trivy.go deleted file mode 100644 index 03c8e97..0000000 --- a/pkg/infra/trivy/trivy.go +++ /dev/null @@ -1,76 +0,0 @@ -package trivy - -import ( - "encoding/json" - "io/ioutil" - "os" - "os/exec" - - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/utils" -) - -var logger = utils.Logger - -const ( - DefaultName = "trivy" -) - -type Interface interface { - SetPath(path string) - Scan(dir string) (*model.TrivyReport, error) -} - -type Trivy struct { - path string -} - -func New() *Trivy { - return &Trivy{ - path: DefaultName, - } -} - -func (x *Trivy) SetPath(path string) { - x.path = path -} - -func (x *Trivy) Scan(dir string) (*model.TrivyReport, error) { - temp, err := ioutil.TempFile("", "*.json") - if err != nil { - return nil, goerr.Wrap(err) - } - if err := temp.Close(); err != nil { - return nil, goerr.Wrap(err) - } - defer func() { - if err := os.Remove(temp.Name()); err != nil { - utils.Logger.With("err", err).Error("Failed to remove temp file") - } - }() - - // #nosec - cmd := exec.Command(x.path, "fs", "--list-all-pkgs", "-f", "json", "-o", temp.Name(), dir) - cmd.Env = os.Environ() - // https://github.com/aquasecurity/trivy/discussions/1050 - cmd.Env = append(cmd.Env, "TRIVY_NEW_JSON_SCHEMA=true") - - out, err := cmd.CombinedOutput() - if err != nil { - utils.Logger.With("err", err).With("out", string(out)).Error("failed") - return nil, goerr.Wrap(err).With("path", x.path).With("out", string(out)) - } - - raw, err := ioutil.ReadFile(temp.Name()) - if err != nil { - return nil, goerr.Wrap(err) - } - - var result model.TrivyReport - if err := json.Unmarshal(raw, &result); err != nil { - return nil, goerr.Wrap(err) - } - - return &result, nil -} diff --git a/pkg/infra/trivy/trivy_test.go b/pkg/infra/trivy/trivy_test.go deleted file mode 100644 index 83ea04b..0000000 --- a/pkg/infra/trivy/trivy_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package trivy_test - -import ( - "os" - "testing" - - "github.com/m-mizutani/octovy/pkg/infra/trivy" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestTrivy(t *testing.T) { - if _, ok := os.LookupEnv("WITH_TRIVY_COMMAND"); !ok { - t.Skip() - } - - cmd := trivy.New() - result, err := cmd.Scan("./testdata") - require.NoError(t, err) - require.Len(t, result.Results, 1) - assert.Equal(t, "Gemfile.lock", result.Results[0].Target) - assert.Len(t, result.Results[0].Packages, 42) -} diff --git a/pkg/usecase/auth.go b/pkg/usecase/auth.go deleted file mode 100644 index 5864d3b..0000000 --- a/pkg/usecase/auth.go +++ /dev/null @@ -1,128 +0,0 @@ -package usecase - -import ( - "github.com/google/uuid" - "github.com/m-mizutani/goerr" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/utils" -) - -const authStateTimeoutSecond = 600 -const sessionTokenTimeoutSecond = 24 * 60 * 60 * 7 -const sessionTokenLength = 128 - -func (x *Usecase) CreateAuthState(ctx *model.Context) (string, error) { - state := utils.GenerateToken(128) - - now := x.infra.Utils.Now().Unix() - if err := x.infra.DB.SaveAuthState(ctx, state, now+authStateTimeoutSecond); err != nil { - return "", err - } - - return state, nil -} - -func (x *Usecase) LookupUser(ctx *model.Context, userID int) (*ent.User, error) { - user, err := x.infra.DB.GetUser(ctx, userID) - if err != nil { - return nil, err - } - if user == nil { - return nil, goerr.Wrap(model.ErrUserNotFound) - } - - return user, nil -} - -func (x *Usecase) AuthGitHubUser(ctx *model.Context, code, state string) (*ent.User, error) { - if len(state) < 32 { - return nil, goerr.Wrap(model.ErrAuthenticationFailed, "Auth state is empty or not enough length") - } - - now := x.infra.Utils.Now().Unix() - ctx.Log().With("now", now).With("state", state[:4]).Debug("Looking up state") - found, err := x.infra.DB.HasAuthState(ctx, state, now) - if err != nil { - return nil, goerr.Wrap(err) - } - if !found { - return nil, goerr.Wrap(model.ErrAuthenticationFailed, "Auth state is not found") - } - - token, err := x.infra.GitHub.Authenticate(ctx, code) - if err != nil { - return nil, err - } - - githubUser, err := x.infra.GitHub.GetUser(ctx, token) - if err != nil { - return nil, err - } - - if githubUser.ID == nil { - return nil, goerr.Wrap(model.ErrGitHubAPI, "user.ID is null") - } - if githubUser.Login == nil { - return nil, goerr.Wrap(model.ErrGitHubAPI, "user.Login is null") - } - if githubUser.Name == nil { - return nil, goerr.Wrap(model.ErrGitHubAPI, "user.Name is null") - } - if githubUser.HTMLURL == nil { - return nil, goerr.Wrap(model.ErrGitHubAPI, "user.HTMLURL is null") - } - if githubUser.AvatarURL == nil { - return nil, goerr.Wrap(model.ErrGitHubAPI, "user.AvatarURL is null") - } - user := &ent.User{ - GithubID: *githubUser.ID, - Login: *githubUser.Login, - Name: *githubUser.Name, - URL: *githubUser.HTMLURL, - AvatarURL: *githubUser.AvatarURL, - } - - userID, err := x.infra.DB.PutUser(ctx, user) - if err != nil { - return nil, goerr.Wrap(err) - } - - user.ID = userID - return user, nil -} - -func (x *Usecase) CreateSession(ctx *model.Context, user *ent.User) (*ent.Session, error) { - token := utils.GenerateToken(sessionTokenLength) - now := x.infra.Utils.Now() - ssn := &ent.Session{ - ID: uuid.New().String(), - UserID: user.ID, - Token: token, - CreatedAt: now.Unix(), - ExpiresAt: now.Unix() + sessionTokenTimeoutSecond, - } - - if err := x.infra.DB.PutSession(ctx, ssn); err != nil { - return nil, err - } - - return ssn, nil -} - -func (x *Usecase) ValidateSession(ctx *model.Context, ssnID string) (*ent.Session, error) { - ssn, err := x.infra.DB.GetSession(ctx, ssnID, x.infra.Utils.Now().Unix()) - if err != nil { - return nil, err - } - if ssn == nil { - return nil, goerr.Wrap(model.ErrAuthenticationFailed, "Invalid token") - } - - return ssn, nil -} - -func (x *Usecase) RevokeSession(ctx *model.Context, ssnID string) error { - return x.infra.DB.DeleteSession(ctx, ssnID) -} diff --git a/pkg/usecase/error.go b/pkg/usecase/error.go deleted file mode 100644 index c7d87a2..0000000 --- a/pkg/usecase/error.go +++ /dev/null @@ -1,27 +0,0 @@ -package usecase - -import ( - "time" - - "github.com/getsentry/sentry-go" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/utils" -) - -func (x *Usecase) flushError() { - sentry.Flush(2 * time.Second) - utils.Logger.Debug("sentry flushed") -} - -// HandleError handles a notable error. Logging error and send it to sentry if configured. It should handle an error caused by system, not a user. -func (x *Usecase) HandleError(ctx *model.Context, err error) { - // Logging - entry := ctx.Log() - - if x.config.SentryDSN != "" { - evID := sentry.CaptureException(err) - entry = entry.With("sentry.EventID", evID) - } - - entry.Err(err).Error(err.Error()) -} diff --git a/pkg/usecase/export_test.go b/pkg/usecase/export_test.go index f05c326..c12a692 100644 --- a/pkg/usecase/export_test.go +++ b/pkg/usecase/export_test.go @@ -1,12 +1,6 @@ package usecase -func CloseScanQueue(uc *Usecase) { - close(uc.scanQueue) -} - -type PostGitHubCommentInput postGitHubCommentInput - -func PostGitHubComment(input *PostGitHubCommentInput) error { - d := postGitHubCommentInput(*input) - return postGitHubComment(&d) -} +var ( + CalcPackageID = calcPackageID + SaveScanReportGitHubRepo = saveScanReportGitHubRepo +) diff --git a/pkg/usecase/github_check_run.go b/pkg/usecase/github_check_run.go deleted file mode 100644 index 81b3c6e..0000000 --- a/pkg/usecase/github_check_run.go +++ /dev/null @@ -1,86 +0,0 @@ -package usecase - -import ( - "github.com/google/go-github/v39/github" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/githubapp" -) - -type checkRun struct { - repo *model.GitHubRepo - checkID int64 - app githubapp.Interface - completed bool -} - -func newCheckRun(app githubapp.Interface) *checkRun { - return &checkRun{ - app: app, - } -} - -func (x *checkRun) create(ctx *model.Context, repo *model.GitHubRepo, commitID string) error { - checkID, err := x.app.CreateCheckRun(repo, commitID) - if err != nil { - return err - } - x.repo = repo - x.checkID = checkID - ctx.Log().With("checkID", checkID).Debug("created github check") - return nil -} - -func str(s string) *string { return &s } - -func (x *checkRun) fallback(ctx *model.Context) { - if x.completed { - return - } - - ctx.Log().Debug("Complete to close check run") - - opt := &github.UpdateCheckRunOptions{ - Name: "Octovy: package vulnerability check", - Status: github.String("completed"), - Conclusion: github.String("success"), - Output: &github.CheckRunOutput{ - Title: github.String("❗ Octovy got error, but success to avoid CI failure"), - Summary: github.String("Failed scan procedure"), - Text: github.String("Please contact to administrator of Octovy"), - }, - } - - if err := x.app.UpdateCheckRun(x.repo, x.checkID, opt); err != nil { - ctx.Log().With("opt", opt).Err(err).Error("failed to submit fallback") - } -} - -func (x *checkRun) complete(ctx *model.Context, scanID string, report *model.Report, frontendURL string, result *model.GitHubCheckResult) error { - ctx.Log(). - With("scanID", scanID). - With("url", frontendURL). - Debug("updating check run") - - title := "Package scan report" - - // TODO: use result.Messages - body := report.ToMarkdown() - opt := &github.UpdateCheckRunOptions{ - Name: "Octovy", - Status: str("completed"), - Conclusion: str(string(result.Conclusion)), - DetailsURL: str(frontendURL + "/scan/" + scanID), - Output: &github.CheckRunOutput{ - Title: &title, - Summary: str(report.Summary()), - Text: &body, - }, - } - - if err := x.app.UpdateCheckRun(x.repo, x.checkID, opt); err != nil { - return err - } - ctx.Log().With("opt", opt).Debug("update github check") - x.completed = true - return nil -} diff --git a/pkg/usecase/github_code.go b/pkg/usecase/github_code.go deleted file mode 100644 index 362a218..0000000 --- a/pkg/usecase/github_code.go +++ /dev/null @@ -1,136 +0,0 @@ -package usecase - -import ( - "archive/zip" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/githubapp" -) - -type codes struct { - Path string -} - -func (x *codes) RemoveAll() { - /* - if err := os.RemoveAll(x.Path); err != nil { - logger.Error().Interface("dirname", x.Path).Msg("Failed to remove src files") - } - */ -} - -func extractCode(f *zip.File, dst string) error { - if f.FileInfo().IsDir() { - return nil - } - - target := stepDownDirectory(f.Name) - if target == "" { - return nil - } - - fpath := filepath.Join(dst, target) - if !strings.HasPrefix(fpath, filepath.Clean(dst)+string(os.PathSeparator)) { - return goerr.Wrap(model.ErrInvalidGitHubData, "illegal file path of zip").With("path", fpath) - } - - if err := os.MkdirAll(filepath.Dir(fpath), os.ModePerm); err != nil { - return goerr.Wrap(err).With("fpath", fpath) - } - - // #nosec - out, err := os.OpenFile(fpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) - if err != nil { - return goerr.Wrap(err).With("fpath", fpath) - } - // #nosec, avoiding false positive - defer func() { - if err := out.Close(); err != nil { - logger.With("err", err).Error("Close zip output file") - } - }() - - rc, err := f.Open() - if err != nil { - return goerr.Wrap(err) - } - defer func() { - if err := rc.Close(); err != nil { - logger.With("err", err).Error("Close zip input file") - } - }() - - // #nosec - _, err = io.Copy(out, rc) - if err != nil { - return goerr.Wrap(err) - } - - return nil -} - -func setupGitHubCodes(ctx *model.Context, req *model.ScanRepositoryRequest, app githubapp.Interface) (*codes, error) { - tmp, err := ioutil.TempFile("", "*.zip") - if err != nil { - return nil, goerr.Wrap(err) - } - defer func() { - if err := os.Remove(tmp.Name()); err != nil { - ctx.Log().With("filename", tmp.Name()).Error("Failed to remove zip file") - } - }() - - tmpdir, err := ioutil.TempDir("", "") - if err != nil { - return nil, goerr.Wrap(err) - } - resp := &codes{Path: tmpdir} - - if err := app.GetCodeZip(&req.GitHubRepo, req.CommitID, tmp); err != nil { - return resp, err - } - - zipFile, err := zip.OpenReader(tmp.Name()) - if err != nil { - return resp, goerr.Wrap(err).With("file", tmp.Name()) - } - defer func() { - if err := zipFile.Close(); err != nil { - ctx.Log().With("zip", zipFile).With("err", err).Error("Failed to close zip file") - } - }() - - // Extract a source code zip file - for _, f := range zipFile.File { - if err := extractCode(f, tmpdir); err != nil { - return resp, err - } - } - - return resp, nil -} - -func stepDownDirectory(fpath string) string { - if len(fpath) > 0 && fpath[0] == filepath.Separator { - fpath = fpath[1:] - } - - p := fpath - var arr []string - for { - d, f := filepath.Split(p) - if d == "" { - break - } - arr = append([]string{f}, arr...) - p = filepath.Clean(d) - } - - return filepath.Join(arr...) -} diff --git a/pkg/usecase/github_comment.go b/pkg/usecase/github_comment.go deleted file mode 100644 index 0386027..0000000 --- a/pkg/usecase/github_comment.go +++ /dev/null @@ -1,34 +0,0 @@ -package usecase - -import ( - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/githubapp" - "github.com/m-mizutani/octovy/pkg/utils" -) - -type postGitHubCommentInput struct { - App githubapp.Interface - GitHubEvent string - Target *model.ScanTarget - PullReqNumber *int - Report *model.Report -} - -func postGitHubComment(input *postGitHubCommentInput) error { - if input.PullReqNumber == nil { - return goerr.Wrap(model.ErrInvalidSystemValue).With("input", input) - } - - if input.Report.NothingToNotify(input.GitHubEvent) { - utils.Logger.Debug("nothing to notify, returning") - return nil - } - - body := input.Report.ToMarkdown() - if err := input.App.CreateIssueComment(&input.Target.GitHubRepo, *input.PullReqNumber, body); err != nil { - return err - } - - return nil -} diff --git a/pkg/usecase/github_comment_test.go b/pkg/usecase/github_comment_test.go deleted file mode 100644 index 5fbec3c..0000000 --- a/pkg/usecase/github_comment_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package usecase_test - -import ( - "testing" - - "github.com/google/go-github/v39/github" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/infra/githubapp" - "github.com/m-mizutani/octovy/pkg/usecase" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestPostGitHubComment(t *testing.T) { - t.Run("basic", func(t *testing.T) { - var cntComment int - _, mock := githubapp.NewMock() - mock.CreateIssueCommentMock = func(repo *model.GitHubRepo, prID int, body string) error { - cntComment++ - assert.Contains(t, body, "CVE-2000-0000") - assert.Contains(t, body, "ansuz") - assert.Contains(t, body, "https://octovy.example.com/scan/my-scan-report-id") - return nil - } - - input := &usecase.PostGitHubCommentInput{ - App: mock, - Target: &model.ScanTarget{}, - PullReqNumber: github.Int(24), - GitHubEvent: "opened", - Report: model.MakeReport("my-scan-report-id", model.VulnChanges{ - { - VulnRecord: model.VulnRecord{ - Pkg: &ent.PackageRecord{ - Source: "x", - Name: "box", - }, - Vuln: &ent.Vulnerability{ - ID: "CVE-2000-0000", - Title: "ansuz", - }, - }, - Type: model.VulnAdded, - }, - }, model.NewVulnStatusDB(nil, 0), "https://octovy.example.com"), - } - require.NoError(t, usecase.PostGitHubComment(input)) - assert.Equal(t, 1, cntComment) - }) -} diff --git a/pkg/usecase/github_event_test.go b/pkg/usecase/github_event_test.go deleted file mode 100644 index daae565..0000000 --- a/pkg/usecase/github_event_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package usecase_test - -import ( - "io/ioutil" - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/usecase" - "github.com/stretchr/testify/require" -) - -func TestVerityGitHubSecret(t *testing.T) { - webhookBodySample, err := ioutil.ReadFile("./testdata/webhook-body-sample.json") - secret := "my-github-secret" - require.NoError(t, err) - - t.Run("pass when verifying valid signature", func(t *testing.T) { - uc, err := usecase.New(&model.Config{ - GitHubWebhookSecret: secret, - }, nil) - require.NoError(t, err) - - require.NoError(t, uc.VerifyGitHubSecret("sha256=7b91b4881b9ad0ea39f0e335786e6242b97bb2d9038b25d358dae70a14424535", webhookBodySample)) - }) - - t.Run("error when verifying invalid signature", func(t *testing.T) { - uc, err := usecase.New(&model.Config{ - GitHubWebhookSecret: secret, - }, nil) - require.NoError(t, err) - - require.ErrorIs(t, model.ErrInvalidWebhookData, uc.VerifyGitHubSecret("sha256=7b91b4881b9ad0ea39f0e335786e6242b97bb2d9038b25d358dae70000000000", webhookBodySample)) - }) - - t.Run("ignore when no secret even if invalid signature", func(t *testing.T) { - uc, err := usecase.New(&model.Config{ - GitHubWebhookSecret: "", - }, nil) - require.NoError(t, err) - - require.NoError(t, uc.VerifyGitHubSecret("sha256=7b91b4881b9ad0ea39f0e335786e6242b97bb2d9038b25d358dae70000000000", webhookBodySample)) - }) - - t.Run("error when no signature", func(t *testing.T) { - uc, err := usecase.New(&model.Config{ - GitHubWebhookSecret: secret, - }, nil) - require.NoError(t, err) - - require.ErrorIs(t, model.ErrInvalidWebhookData, uc.VerifyGitHubSecret("", webhookBodySample)) - }) - -} diff --git a/pkg/usecase/gtihub_event.go b/pkg/usecase/gtihub_event.go deleted file mode 100644 index 579402a..0000000 --- a/pkg/usecase/gtihub_event.go +++ /dev/null @@ -1,196 +0,0 @@ -package usecase - -import ( - "sort" - "strings" - - "github.com/google/go-github/v39/github" - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/utils" -) - -func (x *Usecase) HandleGitHubPushEvent(ctx *model.Context, event *github.PushEvent) error { - if event == nil || - event.Repo == nil || - event.Repo.HTMLURL == nil || - event.Repo.DefaultBranch == nil || - event.Repo.Name == nil || - event.Repo.Owner == nil || - event.Repo.Owner.Name == nil || - event.Installation == nil || - event.Installation.ID == nil { - return goerr.Wrap(model.ErrInvalidWebhookData, "Not enough fields").With("event", event) - } - - if len(event.Commits) == 0 { - ctx.Log().With("event", event).Warn("No commit push") - return nil - } - - sort.Slice(event.Commits, func(i, j int) bool { - return event.Commits[i].Timestamp.After(event.Commits[j].Timestamp.Time) - }) - commit := event.Commits[0] - refs := strings.Split(*event.Ref, "/") - - req := model.ScanRepositoryRequest{ - ScanTarget: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: *event.Repo.Owner.Name, - Name: *event.Repo.Name, - }, - Branch: refs[2], - }, - CommitID: *commit.ID, - UpdatedAt: commit.Timestamp.Unix(), - URL: *event.Repo.HTMLURL, - }, - InstallID: *event.Installation.ID, - } - - if err := x.Scan(ctx, &req); err != nil { - return goerr.Wrap(err, "Failed Scan").With("req", req) - } - - repo := &ent.Repository{ - Owner: req.Owner, - Name: req.Name, - URL: *event.Repo.HTMLURL, - InstallID: *event.Installation.ID, - DefaultBranch: event.Repo.DefaultBranch, - AvatarURL: event.Repo.Owner.AvatarURL, - } - if _, err := x.RegisterRepository(ctx, repo); err != nil { - return goerr.Wrap(err, "Failed RegisterRepository").With("repo", repo) - } - - ctx.Log().With("event", event).Debug("Recv github push event") - return nil - -} - -func (x *Usecase) HandleGitHubPullReqEvent(ctx *model.Context, event *github.PullRequestEvent) error { - if event == nil || - event.Action == nil || - event.Repo == nil || - event.Repo.HTMLURL == nil || - event.Repo.DefaultBranch == nil || - event.Repo.Name == nil || - event.Repo.Owner == nil || - event.Repo.Owner.Login == nil || - event.PullRequest == nil || - event.PullRequest.Head == nil || - event.PullRequest.Head.SHA == nil || - event.PullRequest.Head.Label == nil || - event.PullRequest.Base == nil || - event.PullRequest.Base.Ref == nil || - event.PullRequest.CreatedAt == nil || - event.PullRequest.Number == nil || - event.Installation == nil || - event.Installation.ID == nil { - return goerr.Wrap(model.ErrInvalidWebhookData, "Not enough fields").With("event", event) - } - - // Check only PR opened and synchronize - var targetBranch string - switch *event.Action { - case "opened": - targetBranch = *event.PullRequest.Base.Ref - case "synchronize": - targetBranch = *event.PullRequest.Head.Label - default: - return nil - } - - req := model.ScanRepositoryRequest{ - ScanTarget: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: *event.Repo.Owner.Login, - Name: *event.Repo.Name, - }, - Branch: *event.PullRequest.Head.Label, - }, - CommitID: *event.PullRequest.Head.SHA, - UpdatedAt: event.PullRequest.CreatedAt.Unix(), - URL: *event.Repo.HTMLURL, - TargetBranch: targetBranch, - }, - InstallID: *event.Installation.ID, - PullReqNumber: event.PullRequest.Number, - PullReqAction: *event.Action, - } - - if err := x.Scan(ctx, &req); err != nil { - return goerr.Wrap(err, "Failed Scan").With("req", req) - } - - repo := &ent.Repository{ - Owner: req.Owner, - Name: req.Name, - URL: *event.Repo.HTMLURL, - InstallID: *event.Installation.ID, - DefaultBranch: event.Repo.DefaultBranch, - AvatarURL: event.Repo.Owner.AvatarURL, - } - - if _, err := x.RegisterRepository(ctx, repo); err != nil { - return goerr.Wrap(err, "Failed RegisterRepository").With("repo", repo) - } - - ctx.Log().With("event", event).Debug("Recv github PR event") - return nil -} - -func (x *Usecase) HandleGitHubInstallationEvent(ctx *model.Context, event *github.InstallationEvent) error { - if event == nil || - event.Installation == nil || - event.Installation.ID == nil || - event.Installation.Account == nil || - event.Installation.Account.HTMLURL == nil { - return goerr.Wrap(model.ErrInvalidWebhookData, "Not enough event fields").With("event", event) - } - - for _, repo := range event.Repositories { - if repo == nil || repo.FullName == nil { - return goerr.Wrap(model.ErrInvalidWebhookData, "Not enough repository fields").With("repo", repo) - } - - parts := strings.Split(*repo.FullName, "/") - if len(parts) != 2 { - return goerr.Wrap(model.ErrInvalidWebhookData, "") - } - repo := &ent.Repository{ - Owner: parts[0], - Name: parts[1], - URL: *event.Installation.Account.HTMLURL, - InstallID: *event.Installation.ID, - } - - if _, err := x.RegisterRepository(ctx, repo); err != nil { - return goerr.Wrap(err, "Failed RegisterRepository").With("repo", repo) - } - } - - ctx.Log().With("event", event).Debug("Recv github installation event") - return nil -} - -func (x *Usecase) VerifyGitHubSecret(sigSHA256 string, body []byte) error { - if x.config.GitHubWebhookSecret == "" { - if sigSHA256 == "" { - return nil // No secret and no signature - } - utils.Logger.With("signature", sigSHA256).Warn("Got X-Hub-Signature-256, but no secret is configured. Octovy ignore the signature and continue processing") - return nil - } - - if err := github.ValidateSignature(sigSHA256, body, []byte(x.config.GitHubWebhookSecret)); err != nil { - return model.ErrInvalidWebhookData.Wrap(err) - } - - return nil -} diff --git a/pkg/usecase/mock.go b/pkg/usecase/mock.go new file mode 100644 index 0000000..818ca84 --- /dev/null +++ b/pkg/usecase/mock.go @@ -0,0 +1,15 @@ +package usecase + +import "github.com/m-mizutani/octovy/pkg/domain/model" + +type Mock struct { + MockScanGitHubRepo func(ctx *model.Context, input *ScanGitHubRepoInput) error +} + +func NewMock() UseCase { + return &Mock{} +} + +func (x *Mock) ScanGitHubRepo(ctx *model.Context, input *ScanGitHubRepoInput) error { + return x.MockScanGitHubRepo(ctx, input) +} diff --git a/pkg/usecase/proxy.go b/pkg/usecase/proxy.go deleted file mode 100644 index c216eb5..0000000 --- a/pkg/usecase/proxy.go +++ /dev/null @@ -1,174 +0,0 @@ -package usecase - -import ( - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" -) - -func (x *Usecase) RegisterRepository(ctx *model.Context, repo *ent.Repository) (*ent.Repository, error) { - return x.infra.DB.CreateRepo(ctx, repo) -} - -func (x *Usecase) UpdateVulnStatus(ctx *model.Context, req *model.UpdateVulnStatusRequest) (*ent.VulnStatus, error) { - tgt, err := x.infra.DB.CreateRepo(ctx, &ent.Repository{ - Owner: req.Owner, - Name: req.Name, - }) - if err != nil { - return nil, err - } - - status := &ent.VulnStatus{ - Status: req.Status, - Source: req.Source, - PkgName: req.PkgName, - PkgType: req.PkgType, - ExpiresAt: req.ExpiresAt, - CreatedAt: x.infra.Utils.Now().Unix(), - VulnID: req.VulnID, - Comment: req.Comment, - } - - added, err := x.infra.DB.PutVulnStatus(ctx, tgt, status, req.UserID) - if err != nil { - return nil, err - } - - return added, nil -} - -func (x *Usecase) LookupScanReport(ctx *model.Context, scanID string) (*ent.Scan, error) { - return x.infra.DB.GetScan(ctx, scanID) -} - -func (x *Usecase) GetRepositories(ctx *model.Context) ([]*ent.Repository, error) { - return x.infra.DB.GetRepositories(ctx) -} - -func (x *Usecase) GetRepository(ctx *model.Context, req *model.GitHubRepo) (*ent.Repository, error) { - return x.infra.DB.GetRepository(ctx, req) -} - -func (x *Usecase) GetRepositoryScan(ctx *model.Context, req *model.GetRepoScanRequest) ([]*ent.Scan, error) { - if req.Limit == 0 { - req.Limit = 10 - } - return x.infra.DB.GetRepositoryScan(ctx, req) -} - -func (x *Usecase) GetVulnerabilities(ctx *model.Context, offset, limit int64) ([]*ent.Vulnerability, error) { - return x.infra.DB.GetLatestVulnerabilities(ctx, int(offset), int(limit)) -} - -func (x *Usecase) GetVulnerabilityCount(ctx *model.Context) (int, error) { - return x.infra.DB.GetVulnerabilityCount(ctx) -} - -func (x *Usecase) GetVulnerability(ctx *model.Context, vulnID string) (*model.RespVulnerability, error) { - vuln, err := x.infra.DB.GetVulnerability(ctx, vulnID) - if err != nil { - return nil, err - } - if vuln == nil { - return nil, nil - } - - repos, err := x.infra.DB.GetRepositoriesWithVuln(ctx, vulnID) - if err != nil { - return nil, err - } - - return &model.RespVulnerability{ - Vulnerability: vuln, - Affected: repos, - }, nil -} - -func (x *Usecase) CreateVulnerability(ctx *model.Context, vuln *ent.Vulnerability) error { - return x.infra.DB.PutVulnerabilities(ctx, []*ent.Vulnerability{vuln}) -} - -func (x *Usecase) CreateSeverity(ctx *model.Context, req *model.RequestSeverity) (*ent.Severity, error) { - if err := req.IsValid(); err != nil { - return nil, err - } - - return x.infra.DB.CreateSeverity(ctx, req) -} - -func (x *Usecase) DeleteSeverity(ctx *model.Context, id int) error { - return x.infra.DB.DeleteSeverity(ctx, id) -} - -func (x *Usecase) GetSeverities(ctx *model.Context) ([]*ent.Severity, error) { - return x.infra.DB.GetSeverities(ctx) -} - -func (x *Usecase) UpdateSeverity(ctx *model.Context, id int, req *model.RequestSeverity) error { - if err := req.IsValid(); err != nil { - return err - } - - return x.infra.DB.UpdateSeverity(ctx, id, req) -} - -func (x *Usecase) AssignSeverity(ctx *model.Context, vulnID string, id int) error { - return x.infra.DB.AssignSeverity(ctx, vulnID, id) -} - -func (x *Usecase) GetScanReport(ctx *model.Context, scanID string) (*model.ScanReport, error) { - scan, err := x.infra.DB.GetScan(ctx, scanID) - if err != nil { - return nil, err - } - if scan == nil { - return nil, nil - } - if len(scan.Edges.Repository) == 0 { - return nil, goerr.New("invalid data, repository of scan is not found").With("scan", scan) - } - - statuses, err := x.infra.DB.GetVulnStatus(ctx, &model.GitHubRepo{ - Owner: scan.Edges.Repository[0].Owner, - Name: scan.Edges.Repository[0].Name, - }) - if err != nil { - return nil, err - } - - inventry := model.NewScanReport(scan, statuses, x.infra.Utils.Now().Unix()) - - return inventry, nil -} - -// RepoLabel -func (x *Usecase) CreateRepoLabel(ctx *model.Context, req *model.RequestRepoLabel) (*ent.RepoLabel, error) { - if err := req.IsValid(); err != nil { - return nil, err - } - return x.infra.DB.CreateRepoLabel(ctx, req) -} - -func (x *Usecase) UpdateRepoLabel(ctx *model.Context, id int, req *model.RequestRepoLabel) error { - if err := req.IsValid(); err != nil { - return err - } - return x.infra.DB.UpdateRepoLabel(ctx, id, req) -} - -func (x *Usecase) DeleteRepoLabel(ctx *model.Context, id int) error { - return x.infra.DB.DeleteRepoLabel(ctx, id) -} - -func (x *Usecase) GetRepoLabels(ctx *model.Context) ([]*ent.RepoLabel, error) { - return x.infra.DB.GetRepoLabels(ctx) -} - -func (x *Usecase) AssignRepoLabel(ctx *model.Context, repoID int, labelID int) error { - return x.infra.DB.AssignRepoLabel(ctx, repoID, labelID) -} - -func (x *Usecase) UnassignRepoLabel(ctx *model.Context, repoID int, labelID int) error { - return x.infra.DB.UnassignRepoLabel(ctx, repoID, labelID) -} diff --git a/pkg/usecase/proxy_test.go b/pkg/usecase/proxy_test.go deleted file mode 100644 index 75cb877..0000000 --- a/pkg/usecase/proxy_test.go +++ /dev/null @@ -1,244 +0,0 @@ -package usecase_test - -import ( - "path/filepath" - "testing" - - ftypes "github.com/aquasecurity/fanal/types" - "github.com/aquasecurity/trivy/pkg/report" - ttypes "github.com/aquasecurity/trivy/pkg/types" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestGetRepositories(t *testing.T) { - uc, mock := setupUsecase(t, - optDBMock(), - optTrivy(), - optGitHubMock(), - optGitHubAppMock(), - optGitHubAppMockZip(), - ) - - ctx := model.NewContext() - branch := "main" - var calledScan int - mock.Trivy.ScanMock = func(dir string) (*model.TrivyReport, error) { - calledScan++ - assert.FileExists(t, filepath.Join(dir, "Gemfile")) - assert.FileExists(t, filepath.Join(dir, "Gemfile.lock")) - return &model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile", - }, - { - Target: "Gemfile.lock", - }, - }, - }, nil - } - - t.Run("no result before scan", func(t *testing.T) { - r0, err := uc.GetRepositories(ctx) - require.NoError(t, err) - require.Len(t, r0, 0) - }) - - _, err := mock.DB.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "five", - DefaultBranch: &branch, - }) - require.NoError(t, err) - - assert.NoError(t, uc.Scan(ctx, &model.ScanRepositoryRequest{ - InstallID: 1, - ScanTarget: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "five", - }, - Branch: branch, - }, - CommitID: "1234567", - UpdatedAt: 2000, - RequestedAt: 2100, - }, - })) - - { - resp, err := uc.GetRepositories(ctx) - require.NoError(t, err) - require.Len(t, resp, 1) - assert.Equal(t, "blue", resp[0].Owner) - assert.Equal(t, "five", resp[0].Name) - require.NotNil(t, resp[0].Edges.Latest) - assert.Equal(t, "1234567", resp[0].Edges.Latest.CommitID) - } - assert.Equal(t, calledScan, 1) -} - -func TestGetVulnerability(t *testing.T) { - uc, mock := setupUsecase(t, - optDBMock(), - optTrivy(), - optGitHubMock(), - optGitHubAppMock(), - optGitHubAppMockZip(), - ) - - ctx := model.NewContext() - branch := "main" - var calledScan int - - var err error - _, err = mock.DB.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "five", - DefaultBranch: &branch, - }) - require.NoError(t, err) - _, err = mock.DB.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "timeless", - DefaultBranch: &branch, - }) - require.NoError(t, err) - _, err = mock.DB.CreateRepo(ctx, &ent.Repository{ - Owner: "blue", - Name: "words", - DefaultBranch: &branch, - }) - require.NoError(t, err) - - mock.Trivy.ScanMock = func(dir string) (*model.TrivyReport, error) { - calledScan++ - - switch calledScan { - case 1: // has targeted vuln -> blue/five - return &model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Packages: []ftypes.Package{ - { - Name: "orange", - Version: "0.0.1", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-0001", - PkgName: "orange", - InstalledVersion: "0.0.1", - }, - }, - }, - }, - }, nil - - case 2: // not matched -> blue/timeless - return &model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Packages: []ftypes.Package{ - { - Name: "orange", - Version: "0.0.1", - }, - }, - }, - }, - }, nil - - case 3: // matched vuln, but not target -> blue/words - return &model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Packages: []ftypes.Package{ - { - Name: "orange", - Version: "0.0.1", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-0002", - PkgName: "orange", - InstalledVersion: "0.0.1", - }, - }, - }, - }, - }, nil - } - - return nil, nil - } - - require.NoError(t, uc.Scan(ctx, &model.ScanRepositoryRequest{ - InstallID: 1, - ScanTarget: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "five", - }, - Branch: branch, - }, - CommitID: "1234567", - }, - })) - require.NoError(t, uc.Scan(ctx, &model.ScanRepositoryRequest{ - InstallID: 1, - ScanTarget: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "timeless", - }, - Branch: branch, - }, - CommitID: "1234567", - }, - })) - require.NoError(t, uc.Scan(ctx, &model.ScanRepositoryRequest{ - InstallID: 1, - ScanTarget: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "words", - }, - Branch: branch, - }, - CommitID: "1234567", - }, - })) - - t.Run("3 repository with latset scan found", func(t *testing.T) { - resp, err := uc.GetRepositories(ctx) - require.NoError(t, err) - require.Len(t, resp, 3) - for _, repo := range resp { - require.NotNil(t, repo.Edges.Latest) - } - }) - assert.Equal(t, calledScan, 3) - - t.Run("only 1 repository with CVE-0001 found", func(t *testing.T) { - vuln, err := uc.GetVulnerability(ctx, "CVE-0001") - require.NoError(t, err) - require.NotNil(t, vuln) - require.NotNil(t, vuln.Vulnerability) - require.Len(t, vuln.Affected, 1) - assert.Equal(t, "five", vuln.Affected[0].Name) - }) -} diff --git a/pkg/usecase/push.go b/pkg/usecase/push.go deleted file mode 100644 index d58f22c..0000000 --- a/pkg/usecase/push.go +++ /dev/null @@ -1,22 +0,0 @@ -package usecase - -import ( - "github.com/m-mizutani/octovy/pkg/domain/model" -) - -func (x *Usecase) PushTrivyResult(ctx *model.Context, req *model.PushTrivyResultRequest) error { - if err := req.IsValid(); err != nil { - return err - } - - scannedAt := x.infra.Utils.Now() - newPkgs, vulnList := model.TrivyReportToEnt(&req.Report, scannedAt) - - newScan, err := insertScan(ctx, x.infra.DB, &req.Target, newPkgs, vulnList, scannedAt) - if err != nil { - return err - } - ctx.Log().With("scanID", newScan.ID).Debug("inserted scan report") - - return nil -} diff --git a/pkg/usecase/push_test.go b/pkg/usecase/push_test.go deleted file mode 100644 index 7390e94..0000000 --- a/pkg/usecase/push_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package usecase_test - -import ( - "testing" - - ftypes "github.com/aquasecurity/fanal/types" - ttypes "github.com/aquasecurity/trivy/pkg/types" - - "github.com/aquasecurity/trivy/pkg/report" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestPushTrivyResult(t *testing.T) { - uc, mock := setupUsecase(t, optDBMock()) - ctx := model.NewContext() - req := &model.PushTrivyResultRequest{ - Target: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "five", - }, - Branch: "master", - }, - CommitID: "abcde12345abcde12345abcde12345abcde12345", - }, - Report: model.TrivyReport{ - Results: report.Results{ - { - Class: report.ClassOSPkg, - Target: "gcr.io/xxx", - Type: "debian", - Packages: []ftypes.Package{ - { - Name: "libx", - Version: "0.0.1", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-0000", - PkgName: "libx", - InstalledVersion: "0.0.1", - }, - }, - }, - }, - }, - } - require.NoError(t, uc.PushTrivyResult(ctx, req)) - - scan, err := mock.DB.GetLatestScan(ctx, model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "five", - }, - Branch: "master", - }) - require.NoError(t, err) - require.NotNil(t, scan) - assert.Equal(t, "abcde12345abcde12345abcde12345abcde12345", scan.CommitID) - require.Len(t, scan.Edges.Packages, 1) - assert.Equal(t, "os-pkgs@debian", scan.Edges.Packages[0].Source) - assert.Equal(t, "libx", scan.Edges.Packages[0].Name) -} diff --git a/pkg/usecase/save_scan_report.go b/pkg/usecase/save_scan_report.go new file mode 100644 index 0000000..36c86f8 --- /dev/null +++ b/pkg/usecase/save_scan_report.go @@ -0,0 +1,289 @@ +package usecase + +import ( + "bytes" + "crypto/sha256" + "database/sql" + "encoding/hex" + "encoding/json" + + "github.com/google/uuid" + "github.com/m-mizutani/goerr" + "github.com/m-mizutani/octovy/pkg/domain/model" + "github.com/m-mizutani/octovy/pkg/domain/types" + "github.com/m-mizutani/octovy/pkg/infra/db" + "github.com/m-mizutani/octovy/pkg/utils" + "github.com/sqlc-dev/pqtype" + + ftypes "github.com/aquasecurity/trivy/pkg/fanal/types" + ttypes "github.com/aquasecurity/trivy/pkg/types" +) + +func saveScanReportGitHubRepo(ctx *model.Context, dbClient *sql.DB, report *ttypes.Report, meta *GitHubRepoMetadata) error { + for _, result := range report.Results { + if err := saveVulnerabilities(ctx, dbClient, result.Vulnerabilities); err != nil { + return err + } + + if err := savePackages(ctx, dbClient, result.Type, result.Packages); err != nil { + return err + } + } + + if err := saveScanGitHubRepo(ctx, dbClient, report, meta); err != nil { + return err + } + + return nil +} + +func saveScanGitHubRepo(ctx *model.Context, dbClient *sql.DB, report *ttypes.Report, meta *GitHubRepoMetadata) error { + tx, err := dbClient.Begin() + if err != nil { + return goerr.Wrap(err, "starting transaction") + } + defer utils.SafeRollback(tx) + q := db.New(tx) + + scanID := uuid.New() + if err := q.SaveScan(ctx, db.SaveScanParams{ + ID: scanID, + ArtifactName: report.ArtifactName, + ArtifactType: string(report.ArtifactType), + }); err != nil { + return goerr.Wrap(err, "saving scan") + } + + if err := q.SaveMetaGithubRepository(ctx, db.SaveMetaGithubRepositoryParams{ + ID: uuid.New(), + ScanID: scanID, + Owner: meta.Owner, + RepoName: meta.Repo, + CommitID: meta.CommitID, + Branch: sql.NullString{ + String: meta.Branch, + Valid: meta.Branch != "", + }, + IsDefaultBranch: sql.NullBool{ + Bool: meta.IsDefaultBranch, + Valid: meta.Branch != "", + }, + BaseCommitID: sql.NullString{ + String: meta.BaseCommitID, + Valid: meta.BaseCommitID != "", + }, + PullRequestID: sql.NullInt32{ + Int32: int32(meta.PullRequestID), + Valid: meta.PullRequestID != 0, + }, + }); err != nil { + return goerr.Wrap(err, "saving meta github repository") + } + + for _, result := range report.Results { + // @TODO: Support other types + if result.Class != ttypes.ClassLangPkg && result.Class != ttypes.ClassOSPkg { + continue + } + + resultID := uuid.New() + if err := q.SaveResult(ctx, db.SaveResultParams{ + ID: resultID, + ScanID: scanID, + Target: result.Target, + TargetType: string(result.Type), + Class: db.TargetClass(result.Class), + }); err != nil { + return goerr.Wrap(err, "saving result") + } + + for _, vuln := range result.Vulnerabilities { + if err := q.SaveResultVulnerability(ctx, db.SaveResultVulnerabilityParams{ + ID: uuid.New(), + ResultID: resultID, + VulnID: vuln.VulnerabilityID, + PkgID: calcPackageID(result.Type, vuln.PkgName, vuln.InstalledVersion), + FixedVersion: sql.NullString{ + String: vuln.FixedVersion, + Valid: vuln.FixedVersion != "", + }, + PrimaryUrl: sql.NullString{ + String: vuln.PrimaryURL, + Valid: vuln.PrimaryURL != "", + }, + }); err != nil { + return goerr.Wrap(err, "saving result vulnerability") + } + } + + for _, pkg := range result.Packages { + if err := q.SaveResultPackage(ctx, db.SaveResultPackageParams{ + ID: uuid.New(), + ResultID: resultID, + PkgID: calcPackageID(result.Type, pkg.Name, pkg.Version), + }); err != nil { + return goerr.Wrap(err, "saving result package") + } + } + } + + if err := tx.Commit(); err != nil { + return goerr.Wrap(err, "commit transaction") + } + + return nil +} + +// calcPackageID returns a unique ID for a package. It is calculated by sha512 from package name, version and type. +func calcPackageID(typ, name, version string) string { + src := bytes.Join([][]byte{ + []byte(typ), + []byte(name), + []byte(version), + }, []byte{0}) + + hash := sha256.New() + hash.Write(src) + hv := hash.Sum(nil) + return hex.EncodeToString(hv) +} + +func savePackages(ctx *model.Context, dbClient *sql.DB, typ string, packages []ftypes.Package) error { + tx, err := dbClient.Begin() + if err != nil { + return goerr.Wrap(err, "starting transaction") + } + defer utils.SafeRollback(tx) + q := db.New(tx) + + pkgSet := map[string]*ftypes.Package{} + pkgIDs := []string{} + for i, pkg := range packages { + pkgID := calcPackageID(typ, pkg.Name, pkg.Version) + pkgSet[pkgID] = &packages[i] + pkgIDs = append(pkgIDs, calcPackageID(typ, pkg.Name, pkg.Version)) + } + + exists, err := q.GetPackages(ctx, pkgIDs) + if err != nil { + return goerr.Wrap(err, "getting packages") + } + + for _, pkg := range exists { + delete(pkgSet, pkg.ID) + } + + for pkgID, pkg := range pkgSet { + if err := q.SavePackage(ctx, db.SavePackageParams{ + ID: pkgID, + TargetType: typ, + Name: pkg.Name, + Version: pkg.Version, + }); err != nil { + return goerr.Wrap(err, "saving package").With("pkgID", pkgID).With("pkg", pkg) + } + } + + if err := tx.Commit(); err != nil { + return goerr.Wrap(err, "commit transaction") + } + + return nil +} + +func saveVulnerabilities(ctx *model.Context, dbClient *sql.DB, vulns []ttypes.DetectedVulnerability) error { + tx, err := dbClient.Begin() + if err != nil { + return goerr.Wrap(err, "starting transaction") + } + defer utils.SafeRollback(tx) + q := db.New(tx) + + vulnSet := map[string]*ttypes.DetectedVulnerability{} + vulnIDs := []string{} + for i, vuln := range vulns { + vulnSet[vuln.VulnerabilityID] = &vulns[i] + vulnIDs = append(vulnIDs, vuln.VulnerabilityID) + } + + exists, err := q.GetVulnerabilities(ctx, vulnIDs) + if err != nil { + return goerr.Wrap(err, "getting vulnerabilities") + } + + var updated []*ttypes.DetectedVulnerability + for _, vuln := range exists { + v, ok := vulnSet[vuln.ID] + if !ok { + return goerr.Wrap(types.ErrLogicError, "vulnerability ID is not found in vulnSet").With("vulnID", vuln.ID) + } + + if v.LastModifiedDate.Before(vuln.LastModifiedAt.Time) { + updated = append(updated, v) + } else { + delete(vulnSet, vuln.ID) + } + } + + // Update existing vulnerabilities + for _, v := range updated { + cvss, err := json.Marshal(v.CVSS) + if err != nil { + return goerr.Wrap(err, "marshaling CVSS").With("vulnID", v.VulnerabilityID).With("cvss", v.CVSS) + } + + param := db.UpdateVulnerabilityParams{ + ID: v.VulnerabilityID, + Title: v.Title, + Description: v.Description, + Severity: v.Severity, + CweIds: v.CweIDs, + Cvss: pqtype.NullRawMessage{Valid: true, RawMessage: cvss}, + Reference: v.References, + } + if v.PublishedDate != nil { + param.PublishedAt = sql.NullTime{Valid: true, Time: *v.PublishedDate} + } + if v.LastModifiedDate != nil { + param.LastModifiedAt = sql.NullTime{Valid: true, Time: *v.LastModifiedDate} + } + + if err := q.UpdateVulnerability(ctx, param); err != nil { + return goerr.Wrap(err, "updating vulnerability").With("vulnID", v.VulnerabilityID) + } + } + + // Insert new vulnerabilities + for _, v := range vulnSet { + cvss, err := json.Marshal(v.CVSS) + if err != nil { + return goerr.Wrap(err, "marshaling CVSS").With("vulnID", v.VulnerabilityID).With("cvss", v.CVSS) + } + + param := db.SaveVulnerabilityParams{ + ID: v.VulnerabilityID, + Title: v.Title, + Description: v.Description, + Severity: v.Severity, + CweIds: v.CweIDs, + Cvss: pqtype.NullRawMessage{Valid: true, RawMessage: cvss}, + Reference: v.References, + } + if v.PublishedDate != nil { + param.PublishedAt = sql.NullTime{Valid: true, Time: *v.PublishedDate} + } + if v.LastModifiedDate != nil { + param.LastModifiedAt = sql.NullTime{Valid: true, Time: *v.LastModifiedDate} + } + + if err := q.SaveVulnerability(ctx, param); err != nil { + return goerr.Wrap(err, "saving vulnerability").With("vulnID", v.VulnerabilityID) + } + } + + if err := tx.Commit(); err != nil { + return goerr.Wrap(err, "commit transaction") + } + + return nil +} diff --git a/pkg/usecase/save_scan_report_test.go b/pkg/usecase/save_scan_report_test.go new file mode 100644 index 0000000..6e7694d --- /dev/null +++ b/pkg/usecase/save_scan_report_test.go @@ -0,0 +1,101 @@ +package usecase_test + +import ( + "database/sql" + "os" + "testing" + "time" + + ptypes "github.com/aquasecurity/trivy-db/pkg/types" + ftypes "github.com/aquasecurity/trivy/pkg/fanal/types" + ttypes "github.com/aquasecurity/trivy/pkg/types" + "github.com/m-mizutani/gots/ptr" + "github.com/m-mizutani/gots/rands" + "github.com/m-mizutani/gt" + "github.com/m-mizutani/octovy/pkg/domain/model" + "github.com/m-mizutani/octovy/pkg/usecase" + + _ "github.com/lib/pq" +) + +func TestCalcPackageID(t *testing.T) { + hv1 := usecase.CalcPackageID("go", "pkgA", "v1.0.0") + hv2 := usecase.CalcPackageID("go", "pkgA", "v1.0.1") + hv3 := usecase.CalcPackageID("bundler", "pkgA", "v1.0.1") + hv4 := usecase.CalcPackageID("go", "pkgB", "v1.0.0") + + gt.A(t, []string{hv1, hv2, hv3, hv4}).Distinct() +} + +func newTestDB(t *testing.T) *sql.DB { + testDSN, ok := os.LookupEnv("TEST_DB_DSN") + if !ok { + t.Errorf("TEST_DB_DSN is not set") + t.FailNow() + } + dbClient := gt.R1(sql.Open("postgres", testDSN)).NoError(t) + t.Cleanup(func() { + gt.NoError(t, dbClient.Close()) + }) + + return dbClient +} + +func TestSaveScan(t *testing.T) { + salt := rands.AlphaNum(10) + report := ttypes.Report{ + ArtifactName: "github.com/m-mizutani/octovy", + ArtifactType: ttypes.ClassLangPkg, + Results: ttypes.Results{ + { + Target: "Gemfile.lock", + Class: ttypes.ClassLangPkg, + Type: "bundler", + Packages: []ftypes.Package{ + { + Name: "octokit_" + salt, + Version: "4.18.0", + }, + }, + Vulnerabilities: []ttypes.DetectedVulnerability{ + { + VulnerabilityID: "CVE-2020-1234-" + salt, + PkgName: "octokit_" + salt, + InstalledVersion: "4.18.0", + FixedVersion: "4.18.1", + Vulnerability: ptypes.Vulnerability{ + Title: "CVE-2020-1234", + Description: "test", + Severity: "HIGH", + References: []string{"https://example.com"}, + CVSS: ptypes.VendorCVSS{ + "nvd": { + V2Vector: "AV:L/AC:M/Au:N/C:C/I:C/A:C", + V3Vector: "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", + V2Score: 6.9, + V3Score: 6.4, + }, + "redhat": { + V3Vector: "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", + V3Score: 6.4, + }, + }, + CweIDs: []string{"CWE-1234"}, + PublishedDate: ptr.To(time.Now()), + LastModifiedDate: ptr.To(time.Now()), + }, + }, + }, + }, + }, + } + + dbClient := newTestDB(t) + ctx := model.NewContext() + meta := &usecase.GitHubRepoMetadata{ + Owner: "m-mizutani", + Repo: "octovy", + CommitID: "1234567890", + } + gt.NoError(t, usecase.SaveScanReportGitHubRepo(ctx, dbClient, &report, meta)) +} diff --git a/pkg/usecase/scan.go b/pkg/usecase/scan.go deleted file mode 100644 index 6620adc..0000000 --- a/pkg/usecase/scan.go +++ /dev/null @@ -1,200 +0,0 @@ -package usecase - -import ( - "time" - - "github.com/m-mizutani/goerr" - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra" - "github.com/m-mizutani/octovy/pkg/infra/db" - "github.com/m-mizutani/octovy/pkg/infra/ent" - "github.com/m-mizutani/octovy/pkg/infra/githubapp" - "github.com/m-mizutani/octovy/pkg/infra/opa" - "github.com/m-mizutani/octovy/pkg/infra/policy" - "github.com/m-mizutani/octovy/pkg/infra/trivy" -) - -func (x *Usecase) SendScanRequest(req *model.ScanRepositoryRequest) error { - x.scanQueue <- req - return nil -} - -func (x *Usecase) Scan(ctx *model.Context, req *model.ScanRepositoryRequest) error { - ctx.With("scan_req", req) - ctx.Log().Debug("recv scan request") - - clients := &scanClients{ - DB: x.infra.DB, - GitHubApp: x.infra.NewGitHubApp(req.InstallID), - Utils: x.infra.Utils, - Trivy: x.infra.Trivy, - CheckPolicy: x.infra.CheckPolicy, - OPAClient: x.infra.OPAClient, - FrontendURL: x.config.FrontendURL, - } - - if err := scanRepository(ctx, req, clients); err != nil { - return err - } - - return nil -} - -type scanClients struct { - DB db.Interface - GitHubApp githubapp.Interface - Trivy trivy.Interface - Utils *infra.Utils - CheckPolicy policy.Check - OPAClient opa.Interface - - FrontendURL string -} - -func insertScan(ctx *model.Context, client db.Interface, req *model.ScanTarget, pkgs []*ent.PackageRecord, vulnList []*ent.Vulnerability, now time.Time) (*ent.Scan, error) { - if err := client.PutVulnerabilities(ctx, vulnList); err != nil { - return nil, err - } - - addedPkgs, err := client.PutPackages(ctx, pkgs) - if err != nil { - return nil, err - } - - repo, err := client.CreateRepo(ctx, &ent.Repository{ - Owner: req.Owner, - Name: req.Name, - }) - if err != nil { - return nil, err - } - - report := &ent.Scan{ - Branch: req.Branch, - CommitID: req.CommitID, - RequestedAt: req.RequestedAt, - ScannedAt: now.Unix(), - } - added, err := client.PutScan(ctx, report, repo, addedPkgs) - if err != nil { - return nil, err - } - - // Re-get scan result to retrieve all related records - got, err := client.GetScan(ctx, added.ID) - if err != nil { - return nil, err - } - - return got, nil -} - -func scanRepository(ctx *model.Context, req *model.ScanRepositoryRequest, clients *scanClients) error { - var latest *ent.Scan - // TargetBranch should be destination branch of PR (PR opened event) OR - // PR branch (synchronized event). - if req.TargetBranch != "" { - // Retrieve latest scan report to compare with current one before inserting - branch := model.GitHubBranch{ - GitHubRepo: req.GitHubRepo, - Branch: req.TargetBranch, - } - scan, err := clients.DB.GetLatestScan(ctx, branch) - if err != nil { - return goerr.Wrap(err) - } - latest = scan - if scan != nil { - ctx.Log().With("scanID", scan.ID).With("branch", branch).Debug("Got latest scan") - } else { - ctx.Log().With("branch", branch).Debug("No previous scan") - } - } - - check := newCheckRun(clients.GitHubApp) - if clients.CheckPolicy != nil || clients.OPAClient != nil { - if err := check.create(ctx, &req.GitHubRepo, req.CommitID); err != nil { - return err - } - - // Nothing happend if check completed properly - defer check.fallback(ctx) - } - - codes, err := setupGitHubCodes(ctx, req, clients.GitHubApp) - if codes != nil { - defer codes.RemoveAll() - } - if err != nil { - return err - } - - trivyResult, err := clients.Trivy.Scan(codes.Path) - if err != nil { - return err - } - - // TODO: Merge insert scan procedure with PushTrivyResult - scannedAt := clients.Utils.Now() - newPkgs, vulnList := model.TrivyReportToEnt(trivyResult, scannedAt) - - newScan, err := insertScan(ctx, clients.DB, &req.ScanTarget, newPkgs, vulnList, scannedAt) - if err != nil { - return err - } - ctx.Log().With("scanID", newScan.ID).Debug("inserted scan report") - - status, err := clients.DB.GetVulnStatus(ctx, &req.GitHubRepo) - if err != nil { - return err - } - - oldPkgs := []*ent.PackageRecord{} - if latest != nil { - oldPkgs = latest.Edges.Packages - } - - now := scannedAt.Unix() - changes := model.DiffVulnRecords(oldPkgs, newScan.Edges.Packages) - db := model.NewVulnStatusDB(status, now) - report := model.MakeReport(newScan.ID, changes, db, clients.FrontendURL) - - if req.PullReqNumber != nil { - input := &postGitHubCommentInput{ - App: clients.GitHubApp, - Target: &req.ScanTarget, - PullReqNumber: req.PullReqNumber, - Report: report, - GitHubEvent: req.PullReqAction, - } - - if err := postGitHubComment(input); err != nil { - return err - } - } - - scanReport := model.NewScanReport(newScan, status, now) - var result *model.GitHubCheckResult - - if clients.OPAClient != nil { - var r model.GitHubCheckResult - if err := clients.OPAClient.Data(ctx, opa.Check, scanReport, &r); err != nil { - return err - } - result = &r - } else if clients.CheckPolicy != nil { - r, err := clients.CheckPolicy.Result(ctx, scanReport) - if err != nil { - return err - } - result = r - } - - if result != nil { - if err := check.complete(ctx, newScan.ID, report, clients.FrontendURL, result); err != nil { - return err - } - } - - return nil -} diff --git a/pkg/usecase/scan_github_repo.go b/pkg/usecase/scan_github_repo.go new file mode 100644 index 0000000..1c8b48e --- /dev/null +++ b/pkg/usecase/scan_github_repo.go @@ -0,0 +1,271 @@ +package usecase + +import ( + "archive/zip" + "context" + "encoding/json" + "fmt" + "io" + "log/slog" + "net/http" + "net/url" + "os" + "path/filepath" + "strings" + + "github.com/m-mizutani/goerr" + "github.com/m-mizutani/octovy/pkg/domain/model" + "github.com/m-mizutani/octovy/pkg/domain/types" + "github.com/m-mizutani/octovy/pkg/infra" + gh "github.com/m-mizutani/octovy/pkg/infra/gh" + "github.com/m-mizutani/octovy/pkg/utils" + + ttype "github.com/aquasecurity/trivy/pkg/types" +) + +type ScanGitHubRepoInput struct { + GitHubRepoMetadata + InstallID types.GitHubAppInstallID +} + +type GitHubRepoMetadata struct { + Owner string + Repo string + CommitID string + Branch string + IsDefaultBranch bool + BaseCommitID string + PullRequestID int +} + +func (x *ScanGitHubRepoInput) Validate() error { + if x.Owner == "" { + return goerr.Wrap(types.ErrInvalidOption, "owner is empty") + } + if x.Repo == "" { + return goerr.Wrap(types.ErrInvalidOption, "repo is empty") + } + if x.CommitID == "" { + return goerr.Wrap(types.ErrInvalidOption, "commit ID is empty") + } + if x.InstallID == 0 { + return goerr.Wrap(types.ErrInvalidOption, "install ID is empty") + } + + return nil +} + +// ScanGitHubRepo is a usecase to download a source code from GitHub and scan it with Trivy. Using GitHub App credentials to download a private repository, then the app should be installed to the repository and have read access. +// After scanning, the result is stored to the database. The temporary files are removed after the scan. +func (x *useCase) ScanGitHubRepo(ctx *model.Context, input *ScanGitHubRepoInput) error { + if err := input.Validate(); err != nil { + return err + } + + // Extract zip file to local temp directory + tmpDir, err := os.MkdirTemp("", fmt.Sprintf("octovy.%s.%s.%s.*", input.Owner, input.Repo, input.CommitID)) + if err != nil { + return goerr.Wrap(err, "failed to create temp directory for zip file") + } + defer utils.SafeRemoveAll(tmpDir) + + if err := x.downloadGitHubRepo(ctx, input, tmpDir); err != nil { + return err + } + + ctx = ctx.New(model.WithBase(context.Background())) + report, err := x.scanGitHubRepo(ctx, tmpDir) + if err != nil { + return err + } + ctx.Logger().Info("scan finished", slog.Any("input", input)) + + if err := saveScanReportGitHubRepo(ctx, x.clients.DB(), report, &input.GitHubRepoMetadata); err != nil { + return err + } + + return nil +} + +func (x *useCase) downloadGitHubRepo(ctx *model.Context, input *ScanGitHubRepoInput, dstDir string) error { + zipURL, err := x.clients.GitHubApp().GetArchiveURL(ctx, &gh.GetArchiveURLInput{ + Owner: input.Owner, + Repo: input.Repo, + CommitID: input.CommitID, + InstallID: input.InstallID, + }) + if err != nil { + return err + } + + // Download zip file + tmpZip, err := os.CreateTemp("", fmt.Sprintf("octovy_code.%s.%s.%s.*.zip", + input.Owner, input.Repo, input.CommitID, + )) + if err != nil { + return goerr.Wrap(err, "failed to create temp file for zip file") + } + defer utils.SafeRemove(tmpZip.Name()) + + if err := downloadZipFile(ctx, x.clients.HTTPClient(), zipURL, tmpZip); err != nil { + return err + } + if err := tmpZip.Close(); err != nil { + return goerr.Wrap(err, "failed to close temp file for zip file") + } + + if err := extractZipFile(ctx, tmpZip.Name(), dstDir); err != nil { + return err + } + + return nil +} + +func (x *useCase) scanGitHubRepo(ctx *model.Context, codeDir string) (*ttype.Report, error) { + // Scan local directory + tmpResult, err := os.CreateTemp("", "octovy_result.*.json") + if err != nil { + return nil, goerr.Wrap(err, "failed to create temp file for scan result") + } + defer utils.SafeRemove(tmpResult.Name()) + + if err := tmpResult.Close(); err != nil { + return nil, goerr.Wrap(err, "failed to close temp file for scan result") + } + + if err := x.clients.Trivy().Run(ctx, []string{ + "fs", + "--exit-code", "0", + "--no-progress", + "--format", "json", + "--output", tmpResult.Name(), + "--list-all-pkgs", + codeDir, + }); err != nil { + return nil, goerr.Wrap(err, "failed to scan local directory") + } + + var report ttype.Report + if err := unmarshalFile(tmpResult.Name(), &report); err != nil { + return nil, err + } + + ctx.Logger().Info("Scan result", slog.Any("report", tmpResult.Name())) + + return &report, nil +} + +func unmarshalFile(path string, v any) error { + fd, err := os.Open(path) + if err != nil { + return goerr.Wrap(err, "failed to open file").With("path", path) + } + defer utils.SafeClose(fd) + + if err := json.NewDecoder(fd).Decode(v); err != nil { + return goerr.Wrap(err, "failed to decode json").With("path", path) + } + + return nil +} + +func downloadZipFile(ctx *model.Context, httpClient infra.HTTPClient, zipURL *url.URL, w io.Writer) error { + zipReq, err := http.NewRequestWithContext(ctx, http.MethodGet, zipURL.String(), nil) + if err != nil { + return goerr.Wrap(err, "failed to create request for zip file").With("url", zipURL) + } + + zipResp, err := httpClient.Do(zipReq) + if err != nil { + return goerr.Wrap(err, "failed to download zip file").With("url", zipURL) + } + defer zipResp.Body.Close() + + if zipResp.StatusCode != http.StatusOK { + body, _ := io.ReadAll(zipResp.Body) + return goerr.Wrap(types.ErrInvalidGitHubData, "failed to download zip file").With("url", zipURL).With("resp", zipResp).With("body", body) + } + + if _, err = io.Copy(w, zipResp.Body); err != nil { + return goerr.Wrap(err, "failed to write zip file").With("url", zipURL).With("resp", zipResp) + } + + return nil +} + +func extractZipFile(ctx *model.Context, src, dst string) error { + zipFile, err := zip.OpenReader(src) + if err != nil { + return goerr.Wrap(err).With("file", src) + } + defer utils.SafeClose(zipFile) + + // Extract a source code zip file + for _, f := range zipFile.File { + if err := extractCode(ctx, f, dst); err != nil { + return err + } + } + + return nil +} + +func extractCode(ctx *model.Context, f *zip.File, dst string) error { + if f.FileInfo().IsDir() { + return nil + } + + target := stepDownDirectory(f.Name) + if target == "" { + return nil + } + + fpath := filepath.Join(dst, target) + if !strings.HasPrefix(fpath, filepath.Clean(dst)+string(os.PathSeparator)) { + return goerr.Wrap(types.ErrInvalidGitHubData, "illegal file path of zip").With("path", fpath) + } + + if err := os.MkdirAll(filepath.Dir(fpath), os.ModePerm); err != nil { + return goerr.Wrap(err, "failed to create directory").With("path", fpath) + } + + // #nosec + out, err := os.OpenFile(fpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) + if err != nil { + return goerr.Wrap(err).With("fpath", fpath) + } + defer utils.SafeClose(out) + + rc, err := f.Open() + if err != nil { + return goerr.Wrap(err) + } + defer utils.SafeClose(rc) + + // #nosec + _, err = io.Copy(out, rc) + if err != nil { + return goerr.Wrap(err) + } + + return nil +} + +func stepDownDirectory(fpath string) string { + if len(fpath) > 0 && fpath[0] == filepath.Separator { + fpath = fpath[1:] + } + + p := fpath + var arr []string + for { + d, f := filepath.Split(p) + if d == "" { + break + } + arr = append([]string{f}, arr...) + p = filepath.Clean(d) + } + + return filepath.Join(arr...) +} diff --git a/pkg/usecase/scan_github_repo_test.go b/pkg/usecase/scan_github_repo_test.go new file mode 100644 index 0000000..6766cdb --- /dev/null +++ b/pkg/usecase/scan_github_repo_test.go @@ -0,0 +1,176 @@ +package usecase_test + +import ( + "database/sql" + _ "embed" + "fmt" + "os" + "strconv" + + "bytes" + "io" + "net/http" + "net/url" + "testing" + + "github.com/m-mizutani/gt" + "github.com/m-mizutani/octovy/pkg/domain/model" + "github.com/m-mizutani/octovy/pkg/domain/types" + "github.com/m-mizutani/octovy/pkg/infra" + "github.com/m-mizutani/octovy/pkg/infra/gh" + "github.com/m-mizutani/octovy/pkg/usecase" + "github.com/m-mizutani/octovy/pkg/utils" +) + +//go:embed testdata/octovy-test-code-main.zip +var testCodeZip []byte + +//go:embed testdata/trivy-result.json +var testTrivyResult []byte + +func TestScanGitHubRepo(t *testing.T) { + mockGH := &ghMock{} + mockHTTP := &httpMock{} + mockTrivy := &trivyMock{} + testDB := newTestDB(t) + + uc := usecase.New(infra.New( + infra.WithGitHubApp(mockGH), + infra.WithHTTPClient(mockHTTP), + infra.WithTrivy(mockTrivy), + infra.WithDB(testDB), + )) + + ctx := model.NewContext() + + mockGH.mockGetArchiveURL = func(ctx *model.Context, input *gh.GetArchiveURLInput) (*url.URL, error) { + gt.V(t, input.Owner).Equal("m-mizutani") + gt.V(t, input.Repo).Equal("octovy") + gt.V(t, input.CommitID).Equal("1234567890") + gt.V(t, input.InstallID).Equal(12345) + + resp := gt.R1(url.Parse("https://example.com/some/url.zip")).NoError(t) + return resp, nil + } + + mockHTTP.mockDo = func(req *http.Request) (*http.Response, error) { + gt.V(t, req.URL.String()).Equal("https://example.com/some/url.zip") + + resp := &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(testCodeZip)), + } + return resp, nil + } + + mockTrivy.mockRun = func(ctx *model.Context, args []string) error { + gt.A(t, args). + Contain([]string{"--format", "json"}). + Contain([]string{"--list-all-pkgs"}) + + for i := range args { + if args[i] == "--output" { + fd := gt.R1(os.Create(args[i+1])).NoError(t) + gt.R1(fd.Write(testTrivyResult)).NoError(t) + gt.NoError(t, fd.Close()) + return nil + } + } + + t.Error("no --output option") + return nil + } + + gt.NoError(t, uc.ScanGitHubRepo(ctx, &usecase.ScanGitHubRepoInput{ + GitHubRepoMetadata: usecase.GitHubRepoMetadata{ + Owner: "m-mizutani", + Repo: "octovy", + CommitID: "1234567890", + }, + InstallID: 12345, + })) +} + +type ghMock struct { + mockGetArchiveURL func(ctx *model.Context, input *gh.GetArchiveURLInput) (*url.URL, error) +} + +func (x *ghMock) GetArchiveURL(ctx *model.Context, input *gh.GetArchiveURLInput) (*url.URL, error) { + return x.mockGetArchiveURL(ctx, input) +} + +type trivyMock struct { + mockRun func(ctx *model.Context, args []string) error +} + +func (x *trivyMock) Run(ctx *model.Context, args []string) error { + return x.mockRun(ctx, args) +} + +type httpMock struct { + mockDo func(req *http.Request) (*http.Response, error) +} + +func (x *httpMock) Do(req *http.Request) (*http.Response, error) { + return x.mockDo(req) +} + +func TestScanGitHubRepoWithData(t *testing.T) { + if _, ok := os.LookupEnv("TEST_SCAN_GITHUB_REPO"); !ok { + t.Skip("TEST_SCAN_GITHUB_REPO is not set") + } + + // Setting up GitHub App + strAppID, ok := os.LookupEnv("OCTOVY_GITHUB_APP_ID") + if !ok { + t.Error("OCTOVY_GITHUB_APP_ID is not set") + } + privateKey, ok := os.LookupEnv("OCTOVY_GITHUB_APP_PRIVATE_KEY") + if !ok { + t.Error("OCTOVY_GITHUB_APP_PRIVATE_KEY is not set") + } + appID := gt.R1(strconv.ParseInt(strAppID, 10, 64)).NoError(t) + ghApp := gt.R1(gh.New(types.GitHubAppID(appID), types.GitHubAppPrivateKey(privateKey))).NoError(t) + + // Setting up database + dbUser, ok := os.LookupEnv("OCTOVY_DB_USER") + if !ok { + t.Error("OCTOVY_DB_USER is not set") + } + dbPass, ok := os.LookupEnv("OCTOVY_DB_PASSWORD") + if !ok { + t.Error("OCTOVY_DB_PASS is not set") + } + dbName, ok := os.LookupEnv("OCTOVY_DB_NAME") + if !ok { + t.Error("OCTOVY_DB_NAME is not set") + } + dbPort, ok := os.LookupEnv("OCTOVY_DB_PORT") + if !ok { + t.Error("OCTOVY_DB_PORT is not set") + } + dsn := fmt.Sprintf("user=%s password=%s dbname=%s port=%s sslmode=disable", dbUser, dbPass, dbName, dbPort) + + dbClient := gt.R1(sql.Open("postgres", dsn)).NoError(t) + defer utils.SafeClose(dbClient) + + if t.Failed() { + t.FailNow() + } + + uc := usecase.New(infra.New( + infra.WithGitHubApp(ghApp), + infra.WithDB(dbClient), + )) + + ctx := model.NewContext() + + gt.NoError(t, uc.ScanGitHubRepo(ctx, &usecase.ScanGitHubRepoInput{ + GitHubRepoMetadata: usecase.GitHubRepoMetadata{ + Owner: "m-mizutani", + Repo: "octovy", + CommitID: "6581604ef668e77a178e18dbc56e898f5fd87014", + }, + InstallID: 41633205, + })) +} diff --git a/pkg/usecase/scan_pkgs.go b/pkg/usecase/scan_pkgs.go deleted file mode 100644 index 9738122..0000000 --- a/pkg/usecase/scan_pkgs.go +++ /dev/null @@ -1,64 +0,0 @@ -package usecase - -/* -func crawlPackages(req *model.ScanRepositoryRequest, clients *scanClients) ([]*ent.PackageRecord, error) { - tmp, err := ioutil.TempFile("", "*.zip") - if err != nil { - return nil, goerr.Wrap(err) - } - defer func() { - if err := os.Remove(tmp.Name()); err != nil { - logger.Error().Interface("filename", tmp.Name()).Msg("Failed to remove zip file") - } - }() - - if err := clients.GitHubApp.GetCodeZip(&req.GitHubRepo, req.CommitID, tmp); err != nil { - return nil, err - } - - zipFile, err := zip.OpenReader(tmp.Name()) - if err != nil { - return nil, goerr.Wrap(err).With("file", tmp.Name()) - } - defer func() { - if err := zipFile.Close(); err != nil { - logger.Error().Interface("zip", zipFile).Err(err).Msg("Failed to close zip file") - } - }() - - var newPkgs []*ent.PackageRecord - - for _, f := range zipFile.File { - psr, ok := parserMap[filepath.Base(f.Name)] - if !ok { - continue - } - - fd, err := f.Open() - if err != nil { - return nil, goerr.Wrap(err) - } - defer fd.Close() - - pkgs, err := psr.Parse(fd) - if err != nil { - return nil, goerr.Wrap(err) - } - - parsed := make([]*ent.PackageRecord, len(pkgs)) - for i := range pkgs { - pkg := &ent.PackageRecord{ - Source: stepDownDirectory(f.Name), - Type: psr.PkgType, - Name: pkgs[i].Name, - Version: pkgs[i].Version, - } - parsed[i] = pkg - } - - newPkgs = append(newPkgs, parsed...) - } - - return newPkgs, nil -} -*/ diff --git a/pkg/usecase/scan_test.go b/pkg/usecase/scan_test.go deleted file mode 100644 index 7cc498b..0000000 --- a/pkg/usecase/scan_test.go +++ /dev/null @@ -1,309 +0,0 @@ -package usecase_test - -import ( - "context" - "encoding/json" - "testing" - - ftypes "github.com/aquasecurity/fanal/types" - dtypes "github.com/aquasecurity/trivy-db/pkg/types" - "github.com/aquasecurity/trivy/pkg/report" - ttypes "github.com/aquasecurity/trivy/pkg/types" - - "github.com/google/go-github/v39/github" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra/opa" - "github.com/m-mizutani/octovy/pkg/usecase" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestScanProcedure(t *testing.T) { - uc, mock := setupUsecase(t, - optDBMock(), - optTrivy(), - optGitHubMock(), - optGitHubAppMock(), - optGitHubAppMockZip(), - ) - - var calledScan int - mock.Trivy.ScanMock = func(dir string) (*model.TrivyReport, error) { - calledScan++ - return &model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Packages: []ftypes.Package{ - { - Name: "example", - Version: "6.1.4", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-1000", - PkgName: "example", - InstalledVersion: "6.1.4", - FixedVersion: "6.1.5", - Vulnerability: dtypes.Vulnerability{ - Title: "test vuln", - Description: "it's test", - Severity: "low", - }, - }, - }, - }, - }, - }, nil - } - - assert.NoError(t, uc.Scan(model.NewContext(), &model.ScanRepositoryRequest{ - InstallID: 1, - ScanTarget: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "five", - }, - Branch: "main", - }, - CommitID: "1234567", - UpdatedAt: 2000, - RequestedAt: 2100, - }, - })) - - assert.Equal(t, 1, calledScan) - - ctx := model.NewContext() - scan, err := mock.DB.GetLatestScan(ctx, model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "five", - }, - Branch: "main", - }) - require.NoError(t, err) - assert.Equal(t, "1234567", scan.CommitID) - require.Len(t, scan.Edges.Packages, 1) - assert.Equal(t, "example", scan.Edges.Packages[0].Name) - require.Len(t, scan.Edges.Packages[0].Edges.Vulnerabilities, 1) - assert.Equal(t, "test vuln", scan.Edges.Packages[0].Edges.Vulnerabilities[0].Title) -} - -func TestScanProcedureWithRule(t *testing.T) { - setup := func(t *testing.T, rule string, update func(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error) *usecase.Usecase { - uc, mock := setupUsecase(t, - optDBMock(), - optTrivy(), - optGitHubMock(), - optGitHubAppMock(), - optGitHubAppMockZip(), - optCheckRule(rule, update), - ) - - var calledScan int - mock.Trivy.ScanMock = func(dir string) (*model.TrivyReport, error) { - calledScan++ - return &model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Packages: []ftypes.Package{ - { - Name: "example", - Version: "6.1.4", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-1000", - PkgName: "example", - InstalledVersion: "6.1.4", - FixedVersion: "6.1.5", - Vulnerability: dtypes.Vulnerability{ - Title: "test vuln", - Description: "it's test", - Severity: "low", - }, - }, - }, - }, - }, - }, nil - } - - t.Cleanup(func() { - assert.Equal(t, 1, calledScan) - }) - - return uc - } - - scanReq := &model.ScanRepositoryRequest{ - InstallID: 1, - ScanTarget: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "five", - }, - Branch: "main", - }, - CommitID: "1234567", - UpdatedAt: 2000, - RequestedAt: 2100, - }, - } - - testCases := []struct { - title string - called int - rule string - conclusion string - }{ - { - title: "always success", - called: 1, - rule: `package octovy.check - conclusion = "success"`, - conclusion: "success", - }, - { - title: "always failure", - called: 1, - rule: `package octovy.check - conclusion = "failure"`, - conclusion: "failure", - }, - { - title: "failure if vulnID has CVE-1000", - called: 1, - rule: `package octovy.check - default conclusion = "success" - conclusion = "failure" { - vulnID := input.sources[_].packages[_].vuln_ids[_] - vulnID == "CVE-1000" - } - `, - conclusion: "failure", - }, - { - title: "failure if vulnID has CVE-1001, then success", - called: 1, - rule: `package octovy.check - default conclusion = "success" - conclusion = "failure" { - vulnID := input.sources[_].packages[_].vuln_ids[_] - vulnID == "CVE-1001" - } - `, - conclusion: "success", - }, - } - - for _, c := range testCases { - t.Run(c.title, func(t *testing.T) { - var called int - uc := setup(t, c.rule, func(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error { - called++ - assert.Equal(t, c.conclusion, *opt.Conclusion) - return nil - }) - - assert.NoError(t, uc.Scan(model.NewContext(), scanReq)) - assert.Equal(t, 1, called) - }) - } -} - -func TestScanProcedureWithOPA(t *testing.T) { - uc, mock := setupUsecase(t, - optDBMock(), - optTrivy(), - optGitHubMock(), - optGitHubAppMock(), - optGitHubAppMockZip(), - optOPAServer(), - ) - - var calledScan int - mock.Trivy.ScanMock = func(dir string) (*model.TrivyReport, error) { - calledScan++ - return &model.TrivyReport{ - Results: report.Results{ - { - Target: "Gemfile.lock", - Packages: []ftypes.Package{ - { - Name: "example", - Version: "6.1.4", - }, - }, - Vulnerabilities: []ttypes.DetectedVulnerability{ - { - VulnerabilityID: "CVE-1000", - PkgName: "example", - InstalledVersion: "6.1.4", - FixedVersion: "6.1.5", - Vulnerability: dtypes.Vulnerability{ - Title: "test vuln", - Description: "it's test", - Severity: "low", - }, - }, - }, - }, - }, - }, nil - } - - var calledOPA int - mock.OPA.MockData = func(ctx context.Context, pkg opa.RegoPkg, input, result interface{}) error { - var report model.ScanReport - raw, err := json.Marshal(input) - require.NoError(t, err) - json.Unmarshal(raw, &report) - - assert.Equal(t, "blue", report.Repo.Owner) - assert.Equal(t, "five", report.Repo.Name) - assert.Equal(t, opa.Check, pkg) - calledOPA++ - return nil - } - - var callCreateCheck, callUpdateCheck int - mock.GtiHubApp.CreateCheckRunMock = func(repo *model.GitHubRepo, commit string) (int64, error) { - callCreateCheck++ - return 0, nil - } - mock.GtiHubApp.UpdateCheckRunMock = func(repo *model.GitHubRepo, checkID int64, opt *github.UpdateCheckRunOptions) error { - callUpdateCheck++ - return nil - } - - scanReq := &model.ScanRepositoryRequest{ - InstallID: 1, - ScanTarget: model.ScanTarget{ - GitHubBranch: model.GitHubBranch{ - GitHubRepo: model.GitHubRepo{ - Owner: "blue", - Name: "five", - }, - Branch: "main", - }, - CommitID: "1234567", - UpdatedAt: 2000, - RequestedAt: 2100, - }, - } - - assert.NoError(t, uc.Scan(model.NewContext(), scanReq)) - assert.Equal(t, 1, calledScan) - assert.Equal(t, 1, calledOPA) - assert.Equal(t, 1, callCreateCheck) - assert.Equal(t, 1, callUpdateCheck) -} diff --git a/pkg/usecase/testdata/octovy-test-code-main.zip b/pkg/usecase/testdata/octovy-test-code-main.zip new file mode 100644 index 0000000..c6ea07a Binary files /dev/null and b/pkg/usecase/testdata/octovy-test-code-main.zip differ diff --git a/pkg/usecase/testdata/sample-repo.zip b/pkg/usecase/testdata/sample-repo.zip deleted file mode 100644 index f3a818b..0000000 Binary files a/pkg/usecase/testdata/sample-repo.zip and /dev/null differ diff --git a/pkg/usecase/testdata/trivy-result.json b/pkg/usecase/testdata/trivy-result.json new file mode 100644 index 0000000..b9cda40 --- /dev/null +++ b/pkg/usecase/testdata/trivy-result.json @@ -0,0 +1,87 @@ +{ + "SchemaVersion": 2, + "ArtifactName": "/var/folders/yl/q6mn9xxx7tz4xc_dlkx2w57m0000gn/T/octovy.m-mizutani.octovy.1234567890.3658582564", + "ArtifactType": "filesystem", + "Metadata": { + "ImageConfig": { + "architecture": "", + "created": "0001-01-01T00:00:00Z", + "os": "", + "rootfs": { + "type": "", + "diff_ids": null + }, + "config": {} + } + }, + "Results": [ + { + "Target": "Gemfile.lock", + "Class": "lang-pkgs", + "Type": "bundler", + "Packages": [ + { + "Name": "octovy-test", + "Version": "0.1.0", + "Layer": {} + }, + { + "Name": "rake", + "Version": "10.5.0", + "Layer": {} + } + ], + "Vulnerabilities": [ + { + "VulnerabilityID": "CVE-2020-8130", + "PkgName": "rake", + "InstalledVersion": "10.5.0", + "FixedVersion": "\u003e= 12.3.3", + "Layer": {}, + "SeveritySource": "ruby-advisory-db", + "PrimaryURL": "https://avd.aquasec.com/nvd/cve-2020-8130", + "DataSource": { + "ID": "ruby-advisory-db", + "Name": "Ruby Advisory Database", + "URL": "https://github.com/rubysec/ruby-advisory-db" + }, + "Title": "rake: OS Command Injection via egrep in Rake::FileList", + "Description": "There is an OS command injection vulnerability in Ruby Rake \u003c 12.3.3 in Rake::FileList when supplying a filename that begins with the pipe character `|`.", + "Severity": "HIGH", + "CweIDs": [ + "CWE-78" + ], + "CVSS": { + "nvd": { + "V2Vector": "AV:L/AC:M/Au:N/C:C/I:C/A:C", + "V3Vector": "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", + "V2Score": 6.9, + "V3Score": 6.4 + }, + "redhat": { + "V3Vector": "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", + "V3Score": 6.4 + } + }, + "References": [ + "http://lists.opensuse.org/opensuse-security-announce/2020-03/msg00041.html", + "https://access.redhat.com/security/cve/CVE-2020-8130", + "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8130", + "https://github.com/advisories/GHSA-jppv-gw3r-w3q8", + "https://github.com/ruby/rake/commit/5b8f8fc41a5d7d7d6a5d767e48464c60884d3aee", + "https://hackerone.com/reports/651518", + "https://lists.debian.org/debian-lts-announce/2020/02/msg00026.html", + "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/523CLQ62VRN3VVC52KMPTROCCKY4Z36B/", + "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VXMX4ARNX2JLRJMSH4N3J3UBMUT5CI44/", + "https://nvd.nist.gov/vuln/detail/CVE-2020-8130", + "https://ubuntu.com/security/notices/USN-4295-1", + "https://usn.ubuntu.com/4295-1/", + "https://www.cve.org/CVERecord?id=CVE-2020-8130" + ], + "PublishedDate": "2020-02-24T15:15:00Z", + "LastModifiedDate": "2020-06-30T14:00:00Z" + } + ] + } + ] +} diff --git a/pkg/usecase/testdata/trivy-test-master/.github/workflows/trivy.yml b/pkg/usecase/testdata/trivy-test-master/.github/workflows/trivy.yml deleted file mode 100644 index d15d864..0000000 --- a/pkg/usecase/testdata/trivy-test-master/.github/workflows/trivy.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Vuln scan - -on: [push] - -jobs: - scan: - runs-on: ubuntu-latest - - steps: - - name: Checkout upstream repo - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - - name: Run Trivy vulnerability scanner in repo mode - uses: aquasecurity/trivy-action@master - with: - scan-type: "fs" - ignore-unfixed: true - format: "template" - template: "@/contrib/sarif.tpl" - output: "trivy-results.sarif" - - run: cat trivy-results.sarif - - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v1 - with: - sarif_file: "trivy-results.sarif" - notify: - runs-on: ubuntu-latset - if: ${{ github.head_ref != '' }} - needs: scan - steps: - - uses: m-mizutani/code-scanning-notify@33f157c512c492c3b4a1f306e48885da46548f70 - with: - token: ${{ secrets.GITHUB_TOKEN }} - head-ref: ${{ github.head_ref }} - base-ref: ${{ github.base_ref }} - repo: ${{ github.repository }} - issue-id: github.event.number - diff --git a/pkg/usecase/testdata/trivy-test-master/.gitignore b/pkg/usecase/testdata/trivy-test-master/.gitignore deleted file mode 100644 index 22d0d82..0000000 --- a/pkg/usecase/testdata/trivy-test-master/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor diff --git a/pkg/usecase/testdata/trivy-test-master/Gemfile b/pkg/usecase/testdata/trivy-test-master/Gemfile deleted file mode 100644 index 9cd1942..0000000 --- a/pkg/usecase/testdata/trivy-test-master/Gemfile +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" - -git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } - -gem "rails" -gem "rubyzip", "1.2.1" diff --git a/pkg/usecase/testdata/trivy-test-master/Gemfile.lock b/pkg/usecase/testdata/trivy-test-master/Gemfile.lock deleted file mode 100644 index 461dc9c..0000000 --- a/pkg/usecase/testdata/trivy-test-master/Gemfile.lock +++ /dev/null @@ -1,140 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actioncable (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) - mail (>= 2.7.1) - actionmailer (6.1.4) - actionpack (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activesupport (= 6.1.4) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.4) - actionview (= 6.1.4) - activesupport (= 6.1.4) - rack (~> 2.0, >= 2.0.9) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4) - actionpack (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) - nokogiri (>= 1.8.5) - actionview (6.1.4) - activesupport (= 6.1.4) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4) - activesupport (= 6.1.4) - globalid (>= 0.3.6) - activemodel (6.1.4) - activesupport (= 6.1.4) - activerecord (6.1.4) - activemodel (= 6.1.4) - activesupport (= 6.1.4) - activestorage (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activesupport (= 6.1.4) - marcel (~> 1.0.0) - mini_mime (>= 1.1.0) - activesupport (6.1.4) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) - builder (3.2.4) - concurrent-ruby (1.1.9) - crass (1.0.6) - erubi (1.10.0) - globalid (0.5.2) - activesupport (>= 5.0) - i18n (1.8.10) - concurrent-ruby (~> 1.0) - loofah (2.11.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - marcel (1.0.1) - method_source (1.0.0) - mini_mime (1.1.0) - mini_portile2 (2.6.1) - minitest (5.14.4) - nio4r (2.5.8) - nokogiri (1.12.2) - mini_portile2 (~> 2.6.1) - racc (~> 1.4) - racc (1.5.2) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.4) - actioncable (= 6.1.4) - actionmailbox (= 6.1.4) - actionmailer (= 6.1.4) - actionpack (= 6.1.4) - actiontext (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activemodel (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) - bundler (>= 1.15.0) - railties (= 6.1.4) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) - method_source - rake (>= 0.13) - thor (~> 1.0) - rake (13.0.6) - rubyzip (1.2.1) - sprockets (4.0.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - thor (1.1.0) - tzinfo (2.0.4) - concurrent-ruby (~> 1.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - zeitwerk (2.4.2) - -PLATFORMS - ruby - -DEPENDENCIES - rails - rubyzip (= 1.2.1) - -BUNDLED WITH - 1.17.2 diff --git a/pkg/usecase/testdata/webhook-body-sample.json b/pkg/usecase/testdata/webhook-body-sample.json deleted file mode 100644 index 51e5298..0000000 --- a/pkg/usecase/testdata/webhook-body-sample.json +++ /dev/null @@ -1 +0,0 @@ -{"action":"completed","check_suite":{"id":3902091065,"node_id":"CS_kwDOFWYRkM7olS85","head_branch":"fix-for-cloud-run","head_sha":"28b48fec343ec8803b44a7959ae4941a46470eb9","status":"completed","conclusion":"success","url":"https://api.github.com/repos/m-mizutani/octovy/check-suites/3902091065","before":"0000000000000000000000000000000000000000","after":"28b48fec343ec8803b44a7959ae4941a46470eb9","pull_requests":[],"app":{"id":15368,"slug":"github-actions","node_id":"MDM6QXBwMTUzNjg=","owner":{"login":"github","id":9919,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5MTk=","avatar_url":"https://avatars.githubusercontent.com/u/9919?v=4","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"name":"GitHub Actions","description":"Automate your workflow from idea to production","external_url":"https://help.github.com/en/actions","html_url":"https://github.com/apps/github-actions","created_at":"2018-07-30T09:30:17Z","updated_at":"2019-12-10T19:04:12Z","permissions":{"actions":"write","checks":"write","contents":"write","deployments":"write","discussions":"write","issues":"write","metadata":"read","organization_packages":"write","packages":"write","pages":"write","pull_requests":"write","repository_hooks":"write","repository_projects":"write","security_events":"write","statuses":"write","vulnerability_alerts":"read"},"events":["check_run","check_suite","create","delete","deployment","deployment_status","discussion","discussion_comment","fork","gollum","issues","issue_comment","label","milestone","page_build","project","project_card","project_column","public","pull_request","pull_request_review","pull_request_review_comment","push","registry_package","release","repository","repository_dispatch","status","watch","workflow_dispatch","workflow_run"]},"created_at":"2021-09-28T23:58:10Z","updated_at":"2021-09-28T23:58:40Z","latest_check_runs_count":1,"check_runs_url":"https://api.github.com/repos/m-mizutani/octovy/check-suites/3902091065/check-runs","head_commit":{"id":"28b48fec343ec8803b44a7959ae4941a46470eb9","tree_id":"e001bc260964fab5c60648967933057b45a6f025","message":"Add webhook-only mode option","timestamp":"2021-09-28T23:51:11Z","author":{"name":"Masayoshi Mizutani","email":"masayoshi.mizutani@dr-ubie.com"},"committer":{"name":"Masayoshi Mizutani","email":"masayoshi.mizutani@dr-ubie.com"}}},"repository":{"id":359010704,"node_id":"MDEwOlJlcG9zaXRvcnkzNTkwMTA3MDQ=","name":"octovy","full_name":"m-mizutani/octovy","private":false,"owner":{"login":"m-mizutani","id":605953,"node_id":"MDQ6VXNlcjYwNTk1Mw==","avatar_url":"https://avatars.githubusercontent.com/u/605953?v=4","gravatar_id":"","url":"https://api.github.com/users/m-mizutani","html_url":"https://github.com/m-mizutani","followers_url":"https://api.github.com/users/m-mizutani/followers","following_url":"https://api.github.com/users/m-mizutani/following{/other_user}","gists_url":"https://api.github.com/users/m-mizutani/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mizutani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mizutani/subscriptions","organizations_url":"https://api.github.com/users/m-mizutani/orgs","repos_url":"https://api.github.com/users/m-mizutani/repos","events_url":"https://api.github.com/users/m-mizutani/events{/privacy}","received_events_url":"https://api.github.com/users/m-mizutani/received_events","type":"User","site_admin":false},"html_url":"https://github.com/m-mizutani/octovy","description":"Package vulnerability scanner of GitHub repository for organization","fork":false,"url":"https://api.github.com/repos/m-mizutani/octovy","forks_url":"https://api.github.com/repos/m-mizutani/octovy/forks","keys_url":"https://api.github.com/repos/m-mizutani/octovy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m-mizutani/octovy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m-mizutani/octovy/teams","hooks_url":"https://api.github.com/repos/m-mizutani/octovy/hooks","issue_events_url":"https://api.github.com/repos/m-mizutani/octovy/issues/events{/number}","events_url":"https://api.github.com/repos/m-mizutani/octovy/events","assignees_url":"https://api.github.com/repos/m-mizutani/octovy/assignees{/user}","branches_url":"https://api.github.com/repos/m-mizutani/octovy/branches{/branch}","tags_url":"https://api.github.com/repos/m-mizutani/octovy/tags","blobs_url":"https://api.github.com/repos/m-mizutani/octovy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m-mizutani/octovy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m-mizutani/octovy/git/refs{/sha}","trees_url":"https://api.github.com/repos/m-mizutani/octovy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m-mizutani/octovy/statuses/{sha}","languages_url":"https://api.github.com/repos/m-mizutani/octovy/languages","stargazers_url":"https://api.github.com/repos/m-mizutani/octovy/stargazers","contributors_url":"https://api.github.com/repos/m-mizutani/octovy/contributors","subscribers_url":"https://api.github.com/repos/m-mizutani/octovy/subscribers","subscription_url":"https://api.github.com/repos/m-mizutani/octovy/subscription","commits_url":"https://api.github.com/repos/m-mizutani/octovy/commits{/sha}","git_commits_url":"https://api.github.com/repos/m-mizutani/octovy/git/commits{/sha}","comments_url":"https://api.github.com/repos/m-mizutani/octovy/comments{/number}","issue_comment_url":"https://api.github.com/repos/m-mizutani/octovy/issues/comments{/number}","contents_url":"https://api.github.com/repos/m-mizutani/octovy/contents/{+path}","compare_url":"https://api.github.com/repos/m-mizutani/octovy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m-mizutani/octovy/merges","archive_url":"https://api.github.com/repos/m-mizutani/octovy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m-mizutani/octovy/downloads","issues_url":"https://api.github.com/repos/m-mizutani/octovy/issues{/number}","pulls_url":"https://api.github.com/repos/m-mizutani/octovy/pulls{/number}","milestones_url":"https://api.github.com/repos/m-mizutani/octovy/milestones{/number}","notifications_url":"https://api.github.com/repos/m-mizutani/octovy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m-mizutani/octovy/labels{/name}","releases_url":"https://api.github.com/repos/m-mizutani/octovy/releases{/id}","deployments_url":"https://api.github.com/repos/m-mizutani/octovy/deployments","created_at":"2021-04-18T00:25:50Z","updated_at":"2021-09-27T12:24:10Z","pushed_at":"2021-09-28T23:58:08Z","git_url":"git://github.com/m-mizutani/octovy.git","ssh_url":"git@github.com:m-mizutani/octovy.git","clone_url":"https://github.com/m-mizutani/octovy.git","svn_url":"https://github.com/m-mizutani/octovy","homepage":"","size":3543,"stargazers_count":13,"watchers_count":13,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"allow_forking":true,"forks":2,"open_issues":1,"watchers":13,"default_branch":"main"},"sender":{"login":"m-mizutani","id":605953,"node_id":"MDQ6VXNlcjYwNTk1Mw==","avatar_url":"https://avatars.githubusercontent.com/u/605953?v=4","gravatar_id":"","url":"https://api.github.com/users/m-mizutani","html_url":"https://github.com/m-mizutani","followers_url":"https://api.github.com/users/m-mizutani/followers","following_url":"https://api.github.com/users/m-mizutani/following{/other_user}","gists_url":"https://api.github.com/users/m-mizutani/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mizutani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mizutani/subscriptions","organizations_url":"https://api.github.com/users/m-mizutani/orgs","repos_url":"https://api.github.com/users/m-mizutani/repos","events_url":"https://api.github.com/users/m-mizutani/events{/privacy}","received_events_url":"https://api.github.com/users/m-mizutani/received_events","type":"User","site_admin":false},"installation":{"id":18650154,"node_id":"MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMTg2NTAxNTQ="}} \ No newline at end of file diff --git a/pkg/usecase/usecase.go b/pkg/usecase/usecase.go index 24aa1c3..bb20633 100644 --- a/pkg/usecase/usecase.go +++ b/pkg/usecase/usecase.go @@ -1,89 +1,20 @@ package usecase import ( - "testing" - - "github.com/getsentry/sentry-go" - "github.com/m-mizutani/goerr" "github.com/m-mizutani/octovy/pkg/domain/model" "github.com/m-mizutani/octovy/pkg/infra" - "github.com/m-mizutani/octovy/pkg/infra/db" - "github.com/m-mizutani/octovy/pkg/infra/github" - "github.com/m-mizutani/octovy/pkg/infra/githubapp" - "github.com/m-mizutani/octovy/pkg/infra/trivy" - "github.com/m-mizutani/octovy/pkg/utils" - "github.com/stretchr/testify/require" ) -var logger = utils.Logger - -func New(cfg *model.Config, ifs *infra.Clients) (*Usecase, error) { - uc := &Usecase{ - config: cfg, - infra: ifs, - scanQueue: make(chan *model.ScanRepositoryRequest, 1024), - } - - if cfg.SentryDSN != "" { - err := sentry.Init(sentry.ClientOptions{ - Dsn: cfg.SentryDSN, - Environment: cfg.SentryEnv, - }) - if err != nil { - return nil, goerr.Wrap(err) - } - utils.Logger.With("dsn", cfg.SentryDSN).With("env", cfg.SentryEnv).Debug("sentry initialized") - } - - return uc, nil +type UseCase interface { + ScanGitHubRepo(ctx *model.Context, input *ScanGitHubRepoInput) error } -type TestOption func(*Usecase) - -func OptInjectDB(client *db.Client) TestOption { - return func(u *Usecase) { - u.infra.DB = client - } +type useCase struct { + clients *infra.Clients } -func NewTest(t *testing.T, options ...TestOption) *Usecase { - - dbClient := db.NewMock(t) - ghClient := github.NewMock() - newGitHubApp, _ := githubapp.NewMock() - util := infra.NewUtils() - trivyClient := trivy.NewMock() - - uc, err := New(&model.Config{}, &infra.Clients{ - DB: dbClient, - GitHub: ghClient, - NewGitHubApp: newGitHubApp, - Trivy: trivyClient, - Utils: util, - }) - require.NoError(t, err) - - for _, opt := range options { - opt(uc) +func New(clients *infra.Clients) UseCase { + return &useCase{ + clients: clients, } - - return uc -} - -type Usecase struct { - scanQueue chan *model.ScanRepositoryRequest - - config *model.Config - infra *infra.Clients -} - -func (x *Usecase) Close() { - x.flushError() -} - -func (x *Usecase) FrontendURL() string { - return x.config.FrontendURL -} -func (x *Usecase) GetGitHubAppClientID() string { - return x.infra.GitHubAppClientID() } diff --git a/pkg/usecase/usecase_test.go b/pkg/usecase/usecase_test.go deleted file mode 100644 index 53bd4ec..0000000 --- a/pkg/usecase/usecase_test.go +++ /dev/null @@ -1,143 +0,0 @@ -package usecase_test - -import ( - "io" - "os" - "testing" - - "github.com/m-mizutani/octovy/pkg/domain/model" - "github.com/m-mizutani/octovy/pkg/infra" - "github.com/m-mizutani/octovy/pkg/infra/db" - "github.com/m-mizutani/octovy/pkg/infra/github" - "github.com/m-mizutani/octovy/pkg/infra/githubapp" - "github.com/m-mizutani/octovy/pkg/infra/opa" - "github.com/m-mizutani/octovy/pkg/infra/policy" - "github.com/m-mizutani/octovy/pkg/infra/trivy" - "github.com/m-mizutani/octovy/pkg/usecase" - - gh "github.com/google/go-github/v39/github" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -type mockSet struct { - DB *db.Client - GitHub *github.Mock - GtiHubApp *githubapp.Mock - Trivy *trivy.Mock - Utils *infra.Utils - OPA *opa.Mock -} - -type testOption func(t *testing.T, cfg *model.Config, infra *infra.Clients, mock *mockSet) - -func optDBMock() testOption { - return func(t *testing.T, cfg *model.Config, infra *infra.Clients, mock *mockSet) { - dbClient := db.NewMock(t) - infra.DB = dbClient - mock.DB = dbClient - } -} - -func optGitHubMock() testOption { - return func(t *testing.T, cfg *model.Config, infra *infra.Clients, mock *mockSet) { - ghClient := github.NewMock() - infra.GitHub = ghClient - mock.GitHub = ghClient - } -} - -func optGitHubAppMock() testOption { - return func(t *testing.T, cfg *model.Config, infra *infra.Clients, mock *mockSet) { - newGitHubApp, ghApp := githubapp.NewMock() - infra.NewGitHubApp = newGitHubApp - mock.GtiHubApp = ghApp - } -} - -func optGitHubAppMockZip() testOption { - return func(t *testing.T, cfg *model.Config, infra *infra.Clients, mock *mockSet) { - if mock.GtiHubApp == nil { - require.Fail(t, "optGitHubAppMock should be called at first") - } - - var calledGetCodeZipMock int - - mock.GtiHubApp.GetCodeZipMock = func(repo *model.GitHubRepo, commitID string, w io.WriteCloser) error { - calledGetCodeZipMock++ - raw, err := os.ReadFile("./testdata/sample-repo.zip") - require.NoError(t, err) - w.Write(raw) - w.Close() - return nil - } - - t.Cleanup(func() { - assert.GreaterOrEqual(t, calledGetCodeZipMock, 1) - }) - } -} - -func optOPAServer() testOption { - return func(t *testing.T, cfg *model.Config, infra *infra.Clients, mock *mockSet) { - opaMock := &opa.Mock{} - mock.OPA = opaMock - infra.OPAClient = opaMock - } -} - -func optCheckRule(rule string, update func(repo *model.GitHubRepo, checkID int64, opt *gh.UpdateCheckRunOptions) error) testOption { - return func(t *testing.T, cfg *model.Config, infra *infra.Clients, mock *mockSet) { - if mock.GtiHubApp == nil { - require.Fail(t, "optGitHubAppMock should be called at first") - } - - check, err := policy.NewCheck(rule) - require.NoError(t, err) - infra.CheckPolicy = check - - var calledCreateCheckRunMock int - - const dummyCheckID int64 = 999 - mock.GtiHubApp.CreateCheckRunMock = func(repo *model.GitHubRepo, commit string) (int64, error) { - calledCreateCheckRunMock++ - return dummyCheckID, nil - } - - mock.GtiHubApp.UpdateCheckRunMock = update - - t.Cleanup(func() { - assert.GreaterOrEqual(t, calledCreateCheckRunMock, 1) - }) - } -} - -func optTrivy() testOption { - return func(t *testing.T, cfg *model.Config, infra *infra.Clients, mock *mockSet) { - trivyClient := trivy.NewMock() - infra.Trivy = trivyClient - mock.Trivy = trivyClient - } -} - -func setupUsecase(t *testing.T, options ...testOption) (*usecase.Usecase, *mockSet) { - utils := infra.NewUtils() - var cfg model.Config - - mock := &mockSet{ - Utils: utils, - } - inf := &infra.Clients{ - Utils: utils, - } - - for _, opt := range options { - opt(t, &cfg, inf, mock) - } - - uc, err := usecase.New(&cfg, inf) - require.NoError(t, err) - - return uc, mock -} diff --git a/pkg/utils/generate_token.go b/pkg/utils/generate_token.go deleted file mode 100644 index fd23ea9..0000000 --- a/pkg/utils/generate_token.go +++ /dev/null @@ -1,28 +0,0 @@ -package utils - -import ( - cryptoRand "crypto/rand" - "math" - "math/big" - mathRand "math/rand" -) - -func initGenerateToken() { - v, err := cryptoRand.Int(cryptoRand.Reader, big.NewInt(math.MaxInt64)) - if err != nil { - panic(err) - } - mathRand.Seed(v.Int64()) -} - -var randomTokenChars = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") - -func GenerateToken(n int) string { - s := make([]rune, n) - for i := 0; i < n; i++ { - // #nosec, use crypto/rand to generate seed of math/rand - v := mathRand.Int63() % int64(len(randomTokenChars)) - s[i] = randomTokenChars[v] - } - return string(s) -} diff --git a/pkg/utils/generate_token_test.go b/pkg/utils/generate_token_test.go deleted file mode 100644 index 0cf6aa9..0000000 --- a/pkg/utils/generate_token_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package utils_test - -import ( - "testing" - - "github.com/m-mizutani/octovy/pkg/utils" - "github.com/stretchr/testify/assert" -) - -func TestGenerateToken(t *testing.T) { - t1 := utils.GenerateToken(24) - t2 := utils.GenerateToken(24) - - assert.Len(t, t1, 24) - assert.Len(t, t2, 24) - assert.NotEqual(t, t1, t2) -} diff --git a/pkg/utils/init.go b/pkg/utils/init.go deleted file mode 100644 index d4227da..0000000 --- a/pkg/utils/init.go +++ /dev/null @@ -1,6 +0,0 @@ -package utils - -func init() { - initLogger() - initGenerateToken() -} diff --git a/pkg/utils/logger.go b/pkg/utils/logger.go index e27ee1a..6705f11 100644 --- a/pkg/utils/logger.go +++ b/pkg/utils/logger.go @@ -1,34 +1,100 @@ package utils import ( + "io" "os" + "reflect" + "time" + "log/slog" + + "github.com/fatih/color" + "github.com/m-mizutani/clog" "github.com/m-mizutani/goerr" - "github.com/m-mizutani/zlog" - "github.com/m-mizutani/zlog/filter" + "github.com/m-mizutani/masq" + "github.com/m-mizutani/octovy/pkg/domain/types" ) -var Logger *zlog.Logger +var logger = slog.New(slog.NewTextHandler(os.Stdout, nil)) -func initLogger() { - Logger = zlog.New() - Logger.Filters = zlog.Filters{ - filter.Tag(), - } +func Logger() *slog.Logger { + return logger } -func SetLogLevel(logLevel string) error { - return Logger.SetLogLevel(logLevel) -} +func ReconfigureLogger(logFormat, logLevel, logOutput string) error { + filter := masq.New( + // Mask value with `masq:"secret"` tag + masq.WithTag("secret"), + masq.WithType[types.GitHubAppSecret](masq.MaskWithSymbol('*', 64)), + masq.WithType[types.GitHubAppPrivateKey](masq.MaskWithSymbol('*', 16)), + + // Ignore time.Time type + masq.WithAllowedType(reflect.TypeOf(time.Time{})), + ) + + levelMap := map[string]slog.Level{ + "debug": slog.LevelDebug, + "info": slog.LevelInfo, + "warn": slog.LevelWarn, + "error": slog.LevelError, + } + + level, ok := levelMap[logLevel] + if !ok { + return goerr.Wrap(types.ErrInvalidOption, "invalid log level").With("value", logLevel) + } -func SetLogFormat(logFormat string) error { + var w io.Writer + switch logOutput { + case "stdout", "-": + w = os.Stdout + case "stderr": + w = os.Stderr + default: + fd, err := os.Create(logOutput) + if err != nil { + return goerr.Wrap(err, "failed to open log file").With("path", logOutput) + } + w = fd + } + + var handler slog.Handler switch logFormat { - case "console": - Logger.Emitter = zlog.NewWriterWith(zlog.NewConsoleFormatter(), os.Stdout) + case "text": + handler = clog.New( + clog.WithWriter(w), + clog.WithLevel(level), + // clog.WithReplaceAttr(filter), + clog.WithSource(true), + // clog.WithTimeFmt("2006-01-02 15:04:05"), + clog.WithColorMap(&clog.ColorMap{ + Level: map[slog.Level]*color.Color{ + slog.LevelDebug: color.New(color.FgGreen, color.Bold), + slog.LevelInfo: color.New(color.FgCyan, color.Bold), + slog.LevelWarn: color.New(color.FgYellow, color.Bold), + slog.LevelError: color.New(color.FgRed, color.Bold), + }, + LevelDefault: color.New(color.FgBlue, color.Bold), + Time: color.New(color.FgWhite), + Message: color.New(color.FgHiWhite), + AttrKey: color.New(color.FgHiCyan), + AttrValue: color.New(color.FgHiWhite), + }), + clog.WithReplaceAttr(filter), + ) + case "json": - Logger.Emitter = zlog.NewWriterWith(zlog.NewJsonFormatter(), os.Stdout) + handler = slog.NewJSONHandler(w, &slog.HandlerOptions{ + AddSource: true, + Level: level, + ReplaceAttr: filter, + }) + default: - return goerr.New("invalid log format: " + logFormat) + return goerr.Wrap(types.ErrInvalidOption, "invalid log format, should be 'json' or 'text'").With("value", logFormat) } + + logger = slog.New(handler) + return nil } diff --git a/pkg/utils/safe_differ.go b/pkg/utils/safe_differ.go new file mode 100644 index 0000000..d08c3f3 --- /dev/null +++ b/pkg/utils/safe_differ.go @@ -0,0 +1,35 @@ +package utils + +import ( + "database/sql" + "io" + "os" + + "log/slog" +) + +func SafeClose(closer io.Closer) { + if closer != nil { + if err := closer.Close(); err != nil { + logger.Warn("Fail to close resource", slog.Any("error", err)) + } + } +} + +func SafeRemove(path string) { + if err := os.Remove(path); err != nil { + logger.Warn("Fail to remove file", slog.Any("error", err)) + } +} + +func SafeRemoveAll(path string) { + if err := os.RemoveAll(path); err != nil { + logger.Warn("Fail to remove file", slog.Any("error", err)) + } +} + +func SafeRollback(tx *sql.Tx) { + if err := tx.Rollback(); err != nil && err != sql.ErrTxDone { + logger.Warn("Fail to rollback transaction", slog.Any("error", err)) + } +} diff --git a/scripts/reset_db.sh b/scripts/reset_db.sh new file mode 100755 index 0000000..7bfc0f4 --- /dev/null +++ b/scripts/reset_db.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +export CONTAINER_NAME=octovy-db + +if [ -z "$POSTGRES_USER" ]; then + echo "Error: POSTGRES_USER environment variable is not set" + exit 1 +fi + +if [ -z "$POSTGRES_PASSWORD" ]; then + echo "Error: POSTGRES_PASSWORD environment variable is not set" + exit 1 +fi + +if [ -z "$POSTGRES_DB" ]; then + echo "Error: POSTGRES_DB environment variable is not set" + exit 1 +fi + +export PGPASSWORD=$POSTGRES_PASSWORD + +if [ -z "$DO_NOT_START_CONTAINER" ]; then + pid=$(finch ps -q -f "name=$CONTAINER_NAME") + + if [ "$pid" != "" ]; then + echo "Stopping local DB... $pid" + finch kill "$pid" + fi + + pid=$(finch ps -q -a -f "name=$CONTAINER_NAME") + + if [ "$pid" != "" ]; then + echo "Removing local DB... $pid" + finch rm "$pid" + fi + + echo "Starting local DB..." + finch run \ + -e POSTGRES_USER=${POSTGRES_USER} \ + -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \ + -e POSTGRES_DB=${POSTGRES_DB} \ + -p 6432:5432 \ + -d \ + --name $CONTAINER_NAME \ + postgres:14 +fi + +# Wait for the DB to start +while true; do + psql -h localhost -p 6432 -U ${POSTGRES_USER} ${POSTGRES_DB} -c "SELECT 1;" > /dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "Connected" + break + else + echo "Connection failed. Retrying in 1 second..." + sleep 1 + fi +done + +psqldef -U ${POSTGRES_USER} -p 6432 -h localhost -f database/schema.sql ${POSTGRES_DB} diff --git a/sqlc.yaml b/sqlc.yaml new file mode 100644 index 0000000..bc4bcc3 --- /dev/null +++ b/sqlc.yaml @@ -0,0 +1,12 @@ +version: "2" +sql: + - engine: "postgresql" + queries: "database/query.sql" + schema: "database/schema.sql" + gen: + go: + package: "db" + out: "pkg/infra/db" + #overrides: + #- column: delete_requests.id + # go_type: "github.com/ubie-inc/destroyer/pkg/domain/types.DeleteRequestID" diff --git a/tools/deploy_cloud_run.sh b/tools/deploy_cloud_run.sh deleted file mode 100755 index 58dc247..0000000 --- a/tools/deploy_cloud_run.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# Required Variables -# ------------------------- -# GCP_SERVICE_ID -# GCP_PROJECT_NUMBER -# GCP_PROJECT_ID -# GCP_REGION -# GCP_SERVICE_ACCOUNT -# GCP_DB_NAME -# OCTOVY_URL -# OCTOVY_GITHUB_APP_ID -# OCTOVY_GITHUB_CLIENT_ID -# OCTOVY_DB_TYPE - -IMAGE=$1 - -gcloud beta run deploy "${GCP_SERVICE_ID}" \ - --project="${GCP_PROJECT_ID}" \ - --image "${IMAGE}" \ - --region="${GCP_REGION}" \ - --platform="managed" \ - --cpu=1 \ - --memory=512Mi \ - --port 9080 \ - --args serve \ - --allow-unauthenticated \ - --service-account=${GCP_SERVICE_ACCOUNT} \ - --set-cloudsql-instances="octovy-service:asia-northeast1:${GCP_DB_NAME}" \ - --set-env-vars "OCTOVY_LOG_LEVEL=debug, - OCTOVY_LOG_FORMAT=json, - OCTOVY_FRONTEND_URL=${OCTOVY_URL}, - OCTOVY_GITHUB_APP_ID=${OCTOVY_GITHUB_APP_ID}, - OCTOVY_GITHUB_CLIENT_ID=${OCTOVY_GITHUB_CLIENT_ID}, - OCTOVY_ADDR=0.0.0.0, - OCTOVY_DB_TYPE=${OCTOVY_DB_TYPE}, - GIN_MODE=release" \ - --set-secrets "OCTOVY_DB_CONFIG=projects/${GCP_PROJECT_NUMBER}/secrets/OCTOVY_DB_CONFIG:latest, - OCTOVY_GITHUB_WEBHOOK_SECRET=projects/${GCP_PROJECT_NUMBER}/secrets/OCTOVY_GITHUB_WEBHOOK_SECRET:latest, - OCTOVY_GITHUB_APP_PRIVATE_KEY=projects/${GCP_PROJECT_NUMBER}/secrets/OCTOVY_GITHUB_APP_PRIVATE_KEY:latest, - OCTOVY_GITHUB_SECRET=projects/${GCP_PROJECT_NUMBER}/secrets/OCTOVY_GITHUB_SECRET:latest"