pax_global_header00006660000000000000000000000064151106624720014516gustar00rootroot0000000000000052 comment=7611053e29d4816dc5b0897a518ab9721da0038c golang-github-in-toto-archivista-0.11.1/000077500000000000000000000000001511066247200200475ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/.github/000077500000000000000000000000001511066247200214075ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/.github/ISSUE_TEMPLATE/000077500000000000000000000000001511066247200235725ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/.github/ISSUE_TEMPLATE/bug-report.md000066400000000000000000000007631511066247200262100ustar00rootroot00000000000000--- name: Bug report about: Create a report to help us improve title: '[Bug]: ' labels: ['bug', triage'] assignees: '' --- **What steps did you take and what happened:** [A clear and concise description of what the bug is.] **What did you expect to happen:** [Expected outcome listed here.] **Anything else you would like to add:** [Miscellaneous information that will assist in solving the issue.] **Environment:** - Witness version: - Architecture: - Attestors used: - Archivista version: golang-github-in-toto-archivista-0.11.1/.github/ISSUE_TEMPLATE/feature-request.md000066400000000000000000000015261511066247200272410ustar00rootroot00000000000000--- name: Feature request about: Suggest an idea for this project title: '[Feat]: ' labels: ['feature', 'triage'] assignees: '' --- **Describe the solution you'd like:** [A clear and concise description of what you want to happen.] **User value:** [Why will this feature be valuable to you? Why will this be valuable to others?] **Expected behavior:** [What would you like to see happen] **Proposed solution:** [If you're able, describe possible solution workflow] **Anything else you would like to add:** [Miscellaneous information that will assist in solving the issue.] **Testing changes required:** [List possible testing changes required, if none please explain, if unsure assignee will assist] **Documentation changes required:** [List possible documentation changes required, if none please explain, if unsure assignee will assist] golang-github-in-toto-archivista-0.11.1/.github/PULL_REQUEST_TEMPLATE.md000066400000000000000000000010271511066247200252100ustar00rootroot00000000000000## What this PR does / why we need it Description ## Which issue(s) this PR fixes (optional) (optional, using `fixes #(, fixes #, ...)` format, will close the issue(s) when the PR gets merged)* Fixes # ## Acceptance Criteria Met - [ ] Docs changes if needed - [ ] Testing changes if needed - [ ] All workflow checks passing (automatically enforced) - [ ] All review conversations resolved (automatically enforced) - [ ] [DCO Sign-off](https://github.com/apps/dco) **Special notes for your reviewer**:golang-github-in-toto-archivista-0.11.1/.github/dependabot.yml000066400000000000000000000022031511066247200242340ustar00rootroot00000000000000# Copyright 2022 The Archivista Contributors # # 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. version: 2 updates: - package-ecosystem: "gomod" # See documentation for possible values directory: "/" # Location of package manifests schedule: interval: "weekly" commit-message: prefix: "chore" - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" commit-message: prefix: "chore" groups: github-actions: patterns: - "*" - package-ecosystem: docker directory: / schedule: interval: daily commit-message: prefix: "chore" golang-github-in-toto-archivista-0.11.1/.github/workflows/000077500000000000000000000000001511066247200234445ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/.github/workflows/codeql.yml000066400000000000000000000070271511066247200254440ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. # For most projects, this workflow file will not need changing; you simply need # to commit it to your repository. # # You may wish to alter this file to override the set of languages analyzed, # or to provide custom queries or build logic. # # ******** NOTE ******** # We have attempted to detect the languages in your repository. Please check # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # name: "CodeQL" on: push: branches: ["main"] pull_request: # The branches below must be a subset of the branches above branches: ["main"] schedule: - cron: "0 0 * * 1" permissions: contents: read jobs: analyze: name: Analyze runs-on: ubuntu-latest permissions: actions: read contents: read security-events: write strategy: fail-fast: false matrix: language: ["go"] # CodeQL supports [ $supported-codeql-languages ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - name: Harden Runner uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 with: egress-policy: audit - name: Checkout repository uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: "go.mod" # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v3.29.5 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild uses: github/codeql-action/autobuild@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v3.29.5 # â„šī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun # If the Autobuild fails above, remove it and uncomment the following three lines. # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. # - run: | # echo "Run, Build Application using script" # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v3.29.5 with: category: "/language:${{matrix.language}}" golang-github-in-toto-archivista-0.11.1/.github/workflows/db-migrations.yml000066400000000000000000000030211511066247200267220ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. name: db-migrations on: push: tags: - v* branches: - master - main pull_request: paths: - 'ent/**' - 'ent.*' - '.github/workflows/db-migrations.yml' workflow_dispatch: permissions: contents: read pull-requests: read jobs: db-migrations: name: db-migrations runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: "go.mod" - name: Check DB Migrations run: | curl -sSf https://atlasgo.sh | sh before=$(find ent/migrate/migrations/ -type f | wc -l | awk '{ print $1 }') make db-migrations after=$(find ent/migrate/migrations/ -type f | wc -l | awk '{ print $1 }') if [[ $before -lt $after ]]; then echo "missing 'make db-migrations'"; exit 1; fi golang-github-in-toto-archivista-0.11.1/.github/workflows/dependency-review.yml000066400000000000000000000030321511066247200276020ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. # Dependency Review Action # # This Action will scan dependency manifest files that change as part of a Pull Request, # surfacing known-vulnerable versions of the packages declared or updated in the PR. # Once installed, if the workflow run is marked as required, # PRs introducing known-vulnerable packages will be blocked from merging. # # Source repository: https://github.com/actions/dependency-review-action name: 'Dependency Review' on: [pull_request] permissions: contents: read jobs: dependency-review: runs-on: ubuntu-latest steps: - name: Harden Runner uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 with: egress-policy: audit - name: 'Checkout Repository' uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: 'Dependency Review' uses: actions/dependency-review-action@40c09b7dc99638e5ddb0bfd91c1673effc064d8a # v4.8.1 golang-github-in-toto-archivista-0.11.1/.github/workflows/fossa.yml000066400000000000000000000024771511066247200253140ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. name: "Fossa Scan" on: push: branches: ["main"] pull_request: # The branches below must be a subset of the branches above branches: ["main"] schedule: - cron: "0 0 * * 1" permissions: contents: read jobs: fossa-scan: env: FOSSA_API_KEY: ${{ secrets.fossaApiKey }} runs-on: ubuntu-latest steps: - if: ${{ env.FOSSA_API_KEY != '' }} name: "Checkout Code" uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - if: ${{ env.FOSSA_API_KEY != '' }} name: "Run FOSSA Scan" uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0 with: api-key: ${{ env.FOSSA_API_KEY }} golang-github-in-toto-archivista-0.11.1/.github/workflows/golangci-lint.yml000066400000000000000000000025671511066247200267300ustar00rootroot00000000000000# Copyright 2022 The Archivista Contributors # # 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. name: golangci-lint on: push: tags: - v* branches: - master - main pull_request: permissions: contents: read pull-requests: read jobs: golangci: name: lint runs-on: ubuntu-latest steps: - name: Harden Runner uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 with: egress-policy: audit - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: "go.mod" - name: golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: version: latest args: --timeout=3m golang-github-in-toto-archivista-0.11.1/.github/workflows/label-issues.yml000066400000000000000000000024371511066247200265650ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. name: Label issues on: issues: types: - reopened - opened permissions: contents: read jobs: label_issues: runs-on: ubuntu-latest permissions: issues: write steps: - name: Harden Runner uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 with: egress-policy: audit - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: | github.rest.issues.addLabels({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, labels: ["needs triage"] }) golang-github-in-toto-archivista-0.11.1/.github/workflows/pipeline.yml000066400000000000000000000074021511066247200257770ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. permissions: contents: read # This is required for actions/checkout name: pipeline on: push: tags: - v* branches: - main pull_request: jobs: fmt: uses: ./.github/workflows/witness.yml permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout with: pull_request: ${{ github.event_name == 'pull_request' }} step: static-analysis attestations: "github" command: go fmt ./... static_analysis: uses: ./.github/workflows/witness.yml permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout with: pull_request: ${{ github.event_name == 'pull_request' }} step: static-analysis attestations: "github" command: go vet ./... tests: needs: [fmt, static_analysis] uses: ./.github/workflows/witness.yml permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout with: pull_request: ${{ github.event_name == 'pull_request' }} step: "tests" attestations: "github" command: | make clean make test release: needs: tests permissions: id-token: write contents: write packages: write runs-on: ubuntu-latest if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') steps: - name: Harden Runner uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 with: egress-policy: audit - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: "go.mod" - name: Login to GitHub Container Registry uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Download GoReleaser run: go install github.com/goreleaser/goreleaser@v1.23.0 - name: Run GoReleaser uses: testifysec/witness-run-action@7aa15e327829f1f2a523365c564c948d5dde69dd env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} with: witness-install-dir: /opt/witness version: 0.9.1 step: "build" attestations: "github" command: goreleaser release --clean golang-github-in-toto-archivista-0.11.1/.github/workflows/scorecards.yml000066400000000000000000000071051511066247200263220ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. # This workflow uses actions that are not certified by GitHub. They are provided # by a third-party and are governed by separate terms of service, privacy # policy, and support documentation. name: Scorecard supply-chain security on: # For Branch-Protection check. Only the default branch is supported. See # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection branch_protection_rule: # To guarantee Maintained check is occasionally updated. See # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained schedule: - cron: '20 7 * * 2' push: branches: ["main"] # Declare default permissions as read only. permissions: read-all jobs: analysis: name: Scorecard analysis runs-on: ubuntu-latest permissions: # Needed to upload the results to code-scanning dashboard. security-events: write # Needed to publish results and get a badge (see publish_results below). id-token: write contents: read actions: read steps: - name: Harden Runner uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 with: egress-policy: audit - name: "Checkout code" uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: "Run analysis" uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 with: results_file: results.sarif results_format: sarif # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: # - you want to enable the Branch-Protection check on a *public* repository, or # - you are installing Scorecards on a *private* repository # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. # repo_token: ${{ secrets.SCORECARD_TOKEN }} # Public repositories: # - Publish results to OpenSSF REST API for easy access by consumers # - Allows the repository to include the Scorecard badge. # - See https://github.com/ossf/scorecard-action#publishing-results. # For private repositories: # - `publish_results` will always be set to `false`, regardless # of the value entered here. publish_results: true # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: name: SARIF file path: results.sarif retention-days: 5 # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v3.29.5 with: sarif_file: results.sarif golang-github-in-toto-archivista-0.11.1/.github/workflows/update-pre-commit-hooks.yml000066400000000000000000000042341511066247200306470ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. # This workflow uses actions that are not certified by GitHub. They are provided # by a third-party and are governed by separate terms of service, privacy # policy, and support documentation. name: Update pre-commit hooks on: workflow_dispatch: schedule: # Run at 8:00 AM every day - cron: "0 8 * * *" permissions: contents: read jobs: update-pre-commit-hooks: runs-on: ubuntu-latest permissions: contents: write pull-requests: write steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c with: python-version: "3.11" - name: Install prerequisites run: | pip install pre-commit==3.6.0 - name: Update pre-commit hooks run: | pre-commit autoupdate - name: Check for pre-commit config file changes id: git_diff run: | echo "GIT_DIFF=$(git diff --exit-code 1> /dev/null; echo $?)" >> $GITHUB_OUTPUT - name: Create Pull Request uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "build: Update pre-commit hooks" branch: "archivista-bot/update-pre-commit-hooks" delete-branch: true title: "build: Update pre-commit hooks" body: > The following PR updates the pre-commit hooks (`.pre-commit-config.yaml` file) using `pre-commit autoupdate`. labels: report, automated pr, pre-commit golang-github-in-toto-archivista-0.11.1/.github/workflows/verify-licence.yml000066400000000000000000000031201511066247200270670ustar00rootroot00000000000000# Copyright 2022 The Archivista Contributors # # 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. name: Verify License on: workflow_dispatch: push: branches: ['main', 'release-*'] pull_request: permissions: contents: read jobs: license-check: name: license boilerplate check runs-on: ubuntu-latest steps: - name: Harden Runner uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 with: egress-policy: audit - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: "go.mod" - name: Install addlicense run: go install github.com/google/addlicense@v1.1.1 - name: Check license headers run: | set -e addlicense --check -l apache -c 'The Archivista Contributors' --ignore "generated.go" --ignore "ent.resolvers.go" --ignore "ent/migrate/migrations/**" --ignore "docs/**" --ignore "chart/**/*.yaml" -v ./ golang-github-in-toto-archivista-0.11.1/.github/workflows/witness.yml000066400000000000000000000041501511066247200256630ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. on: workflow_call: inputs: pull_request: required: true type: boolean command: required: true type: string step: required: true type: string attestations: required: true type: string permissions: contents: read jobs: witness: runs-on: ubuntu-22.04 permissions: contents: read id-token: write steps: - name: Harden Runner uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 with: egress-policy: audit - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: "go.mod" - if: ${{ inputs.pull_request == false }} uses: testifysec/witness-run-action@7aa15e327829f1f2a523365c564c948d5dde69dd with: witness-install-dir: /opt/witness version: 0.9.1 step: ${{ inputs.step }} attestations: ${{ inputs.attestations }} command: /bin/sh -c "${{ inputs.command }}" - if: ${{ inputs.pull_request == true }} run: ${{ inputs.command }} - if: ${{ inputs.step == 'tests' }} uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 golang-github-in-toto-archivista-0.11.1/.gitignore000066400000000000000000000006341511066247200220420ustar00rootroot00000000000000# Binaries for programs and plugins *.exe *.exe~ *.dll *.so *.dylib # Test binary, built with `go test -c` *.test # Output of the go coverage tool, specifically when used with LiteIDE *.out # Dependency directories (remove the comment below to include it) # vendor/ ./*.json .gitignore .idea/ ## protect against development environment being leaked out *.pem *.nix ./archivista ./archivistctl .witness.yaml golang-github-in-toto-archivista-0.11.1/.gitlab-ci.yml000066400000000000000000000026351511066247200225110ustar00rootroot00000000000000# Copyright 2022 The Archivista Contributors # # 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. stages: - build build-and-push-server: variables: KO_DOCKER_REPO: registry.gitlab.com/testifysec/judge-platform/archivista/archivista stage: build image: name: registry.gitlab.com/testifysec/docker-images/ko:0.11.2-go1.19.2 entrypoint: [""] script: - ko auth login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} - ko publish --bare --tags=${CI_COMMIT_SHORT_SHA} ./cmd/archivista build-and-push-client: variables: KO_DOCKER_REPO: registry.gitlab.com/testifysec/judge-platform/archivista/archivistactl stage: build image: name: registry.gitlab.com/testifysec/docker-images/ko:0.11.2-go1.19.2 entrypoint: [""] script: - ko auth login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} - ko publish --bare --tags ${CI_COMMIT_SHORT_SHA} ./cmd/archivistactl golang-github-in-toto-archivista-0.11.1/.gitleaksignore000066400000000000000000000002131511066247200230530ustar00rootroot00000000000000test/package.attestation.json:generic-api-key:1 test/fail.attestation.json:generic-api-key:1 test/build.attestation.json:generic-api-key:1 golang-github-in-toto-archivista-0.11.1/.golangci.yaml000066400000000000000000000020321511066247200225710ustar00rootroot00000000000000# Copyright 2024 The Archivista Contributors # # 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. version: "2" linters: enable: - gosec exclusions: generated: lax presets: - comments - common-false-positives - legacy - std-error-handling rules: - linters: - gosec path: _test.go paths: - third_party$ - builtin$ - examples$ issues: max-same-issues: 50 formatters: exclusions: generated: lax paths: - third_party$ - builtin$ - examples$ golang-github-in-toto-archivista-0.11.1/.goreleaser.yaml000066400000000000000000000065041511066247200231460ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. project_name: archivista builds: - ldflags: - "-s -w" - "-extldflags=-zrelro" - "-extldflags=-znow" - "-extldflags -w -X 'github.com/in-toto/archivista/cmd.Version={{.Tag}}-{{.ShortCommit}}'" env: - "CGO_ENABLED=0" - "GO111MODULE=on" - "GOFLAGS=-mod=readonly -trimpath" goos: - linux - windows - darwin goarch: - amd64 - arm64 main: ./cmd/archivista binary: archivista id: archivista - ldflags: - "-s -w" - "-extldflags=-zrelro" - "-extldflags=-znow" - "-extldflags -w -X 'github.com/in-toto/archivistactl/cmd.Version={{.Tag}}-{{.ShortCommit}}'" env: - "CGO_ENABLED=0" - "GO111MODULE=on" - "GOFLAGS=-mod=readonly -trimpath" goos: - linux - windows - darwin goarch: - amd64 - arm64 main: ./cmd/archivistactl binary: archivistactl id: archivistactl gomod: proxy: false source: enabled: true changelog: use: github groups: - title: Features regexp: "^.*feat[(\\w)]*:+.*$" order: 0 - title: 'Bug fixes' regexp: "^.*fix[(\\w)]*:+.*$" order: 1 - title: 'Documentation' regexp: "^.*docs[(\\w)]*:+.*$" order: 2 - title: Others order: 999 release: prerelease: auto github: owner: "{{ .Env.GITHUB_REPOSITORY_OWNER }}" dockers: - image_templates: - "ghcr.io/in-toto/archivista:{{ .Version }}-amd64" use: buildx build_flag_templates: - "--pull" - "--platform=linux/amd64" extra_files: - "archivista.graphql" - "ent.graphql" - "ent.resolvers.go" - "entrypoint.sh" - "gen.go" - "generated.go" - "go.mod" - "go.sum" - "resolver.go" - "docs" - "ent" - "cmd" - "ent" - "pkg" - image_templates: - "ghcr.io/in-toto/archivista:{{ .Version }}-arm64" use: buildx build_flag_templates: - "--pull" - "--platform=linux/arm64" extra_files: - "archivista.graphql" - "ent.graphql" - "ent.resolvers.go" - "entrypoint.sh" - "gen.go" - "generated.go" - "go.mod" - "go.sum" - "resolver.go" - "docs" - "ent" - "cmd" - "ent" - "pkg" goarch: arm64 docker_manifests: - name_template: "ghcr.io/in-toto/archivista:{{ .Version }}" image_templates: - "ghcr.io/in-toto/archivista:{{ .Version }}-amd64" - "ghcr.io/in-toto/archivista:{{ .Version }}-arm64" kos: - repository: ghcr.io/in-toto/archivistactl id: archivistactl build: archivistactl tags: - '{{.Version}}' bare: true preserve_import_paths: false creation_time: '{{.CommitTimestamp}}' platforms: - linux/amd64 - linux/arm64 golang-github-in-toto-archivista-0.11.1/.pre-commit-config.yaml000066400000000000000000000017621511066247200243360ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. repos: - repo: https://github.com/gitleaks/gitleaks rev: v8.28.0 hooks: - id: gitleaks - repo: https://github.com/golangci/golangci-lint rev: v2.5.0 hooks: - id: golangci-lint - repo: https://github.com/jumanjihouse/pre-commit-hooks rev: 3.0.0 hooks: - id: shellcheck - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace golang-github-in-toto-archivista-0.11.1/CODE_OF_CONDUCT.md000066400000000000000000000126251511066247200226540ustar00rootroot00000000000000 # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [community@testifysec.com](mailto:community@testifysec.com). All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html [Mozilla CoC]: https://github.com/mozilla/diversity [FAQ]: https://www.contributor-covenant.org/faq [translations]: https://www.contributor-covenant.org/translations golang-github-in-toto-archivista-0.11.1/CONTRIBUTING.md000066400000000000000000000112761511066247200223070ustar00rootroot00000000000000# Contributing to Archivista We welcome contributions from the community and first want to thank you for taking the time to contribute! Before starting, please take some time to familiarize yourself with the [Code of Conduct](CODE_OF_CONDUCT.md). ## Getting Started We welcome many different types of contributions and not all of them need a Pull Request. Contributions may include: * New features and proposals * Documentation * Bug fixes * Issue Triage * Answering questions and giving feedback * Helping to onboard new contributors * Other related activities ### Setting up your environment ### Required Tooling Some tools are required on your system in order to help you with the development process: * Git: Archivista is hosted on GitHub, so you will need to have Git installed. For more information, please follow [this guide](https://github.com/git-guides/install-git). * GNU Make: The root of the directory contains a `Makefile` for automating development processes. The `make` CLI tool is usually installed by default on most systems (excluding Windows), but you can check if it is installed by running `make --version` on your terminal. If this command is unsuccessful, you will need to find the standard method for installing it for your system. For installing `make` on Windows, please see [here](https://gnuwin32.sourceforge.net/packages/make.html). * Go v1.19: Archivista is written in [Go](https://golang.org/), so you will need this installed in order to compile and run the source code. * pre-commit: It is a framework for managing and maintaining multi-language pre-commit hooks. It is used to run some checks on the code before it is committed. You can install it by following the instructions [here](https://pre-commit.com/#install). * jq: It is a lightweight and flexible command-line JSON processor. It is used to parse JSON files. You can install it by following the instructions [here](https://stedolan.github.io/jq/download/). * A Container Runtime: Archivista is a container-based tool, and therefore you might need a container runtime tool installed for development. The most common solution for this is [Docker](https://docs.docker.com/engine/install/), however this is not free on all platforms. If you are using MacOS, [Colima](https://github.com/abiosoft/colima) is a free good alternative, as well as [Rancher Desktop](https://github.com/rancher-sandbox/rancher-desktop). Please note that Archivista is not tested on these alternative tools, so compatibility is not guaranteed. #### Getting the Archivista source code [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo>) the repository on GitHub and [clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) it to your local machine: ```console git clone git@github.com:YOUR-USERNAME/archivista.git ``` *The command above uses SSH to clone the repository, which we recommend. You can find out more about how to set SSH up with Github [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh).* Add a [remote](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-for-a-fork) and regularly [sync](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) to make sure you stay up-to-date with our repository: ```console git remote add upstream https://github.com/in-toto/archivista.git git checkout main git fetch upstream git merge upstream/main ``` ### Running Archivista Development Environment *Please note that the following `make` commands make use of both the `docker` and `docker compose` commands, so you may need to modify this locally if using tools such as [nerdctl](https://github.com/containerd/nerdctl) or [podman](https://github.com/containers/podman).* To start the Archivista development environment, simply execute the command: ```console make run-dev ``` This will run the Archivista container and its required dependent services. Archivista will be available at http://localhost:8082 Any changes made to the source code will be reflected in the development environment while it is running, so there is no need to restart it. To stop the development environment, run: ```console make stop ``` To clean all Archivista containers in your environment execute the command: ```console make clean ``` ### Changes in the Archivista SQL Schema `ent/schema` If there are changes in the SQL Schema you must to create the database migration. To do this, you must run the following command: ```console make db-migrations ``` ### Running Tests You can run all the tests by executing the command: ```console make test ``` golang-github-in-toto-archivista-0.11.1/DEPENDENCY.md000066400000000000000000000032611511066247200220110ustar00rootroot00000000000000# Environment Dependencies Policy ## Purpose This policy describes how Archivista maintainers consume third-party packages. ## Scope This policy applies to all Archivista maintainers and all third-party packages used in the Archivista project. ## Policy Archivista maintainers must follow these guidelines when consuming third-party packages: - Only use third-party packages that are necessary for the functionality of Archivista. - Use the latest version of all third-party packages whenever possible. - Avoid using third-party packages that are known to have security vulnerabilities. - Pin all third-party packages to specific versions in the Archivista codebase. - Use a dependency management tool, such as Go modules, to manage third-party dependencies. ## Procedure When adding a new third-party package to Archivista, maintainers must follow these steps: 1. Evaluate the need for the package. Is it necessary for the functionality of Archivista? 2. Research the package. Is it well-maintained? Does it have a good reputation? 3. Choose a version of the package. Use the latest version whenever possible. 4. Pin the package to the specific version in the Archivista codebase. 5. Update the Archivista documentation to reflect the new dependency. ## Enforcement This policy is enforced by the Archivista maintainers. Maintainers are expected to review each other's code changes to ensure that they comply with this policy. ## Exceptions Exceptions to this policy may be granted by the Archivista project lead on a case-by-case basis. ## Credits This policy was adapted from the [Kubescape Community](https://github.com/kubescape/kubescape/blob/master/docs/environment-dependencies-policy.md) golang-github-in-toto-archivista-0.11.1/Dockerfile000066400000000000000000000026161511066247200220460ustar00rootroot00000000000000# Copyright 2022 The Archivista Contributors # # 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. FROM golang:1.25.3-alpine@sha256:aee43c3ccbf24fdffb7295693b6e33b21e01baec1b2a55acc351fde345e9ec34 AS build WORKDIR /src RUN apk update && apk add --no-cache file git curl RUN curl -sSf https://atlasgo.sh | sh ENV GOMODCACHE=/root/.cache/gocache RUN --mount=target=. --mount=target=/root/.cache,type=cache \ CGO_ENABLED=0 go build -o /out/ -ldflags '-s -d -w' ./cmd/...; \ file /out/archivista | grep "statically linked" FROM alpine:3.22.2@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 COPY --from=build /out/archivista /bin/archivista COPY --from=build /out/archivistactl /bin/archivistactl COPY --from=build /usr/local/bin/atlas /bin/atlas ADD entrypoint.sh /bin/entrypoint.sh ADD ent/migrate/migrations /archivista/migrations RUN mkdir /tmp/archivista ENTRYPOINT ["sh", "/bin/entrypoint.sh"] golang-github-in-toto-archivista-0.11.1/Dockerfile-dev000066400000000000000000000016471511066247200226250ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. FROM golang:1.25.3-alpine@sha256:aee43c3ccbf24fdffb7295693b6e33b21e01baec1b2a55acc351fde345e9ec34 AS build WORKDIR /src RUN apk update && apk add --no-cache file git curl RUN curl -sSf https://atlasgo.sh | sh ENV GOMODCACHE /root/.cache/gocache RUN go install github.com/githubnemo/CompileDaemon@v1.4.0 ENTRYPOINT ["sh", "entrypoint-dev.sh"] golang-github-in-toto-archivista-0.11.1/GOVERNANCE.md000066400000000000000000000006501511066247200220210ustar00rootroot00000000000000As a sub-project of in-toto, this repository is subject to the governance by the in-toto steering committee. This repository is also subject to the in-toto and CNCF code of conduct. For more details, please reference the in-toto community repository: - [GOVERNANCE.md](https://github.com/in-toto/community/blob/main/GOVERNANCE.md) - [CODE_OF_CONDUCT.md](https://github.com/in-toto/community/blob/main/CODE-OF-CONDUCT.md) golang-github-in-toto-archivista-0.11.1/LICENSE000066400000000000000000000261351511066247200210630ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "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 [yyyy] [name of copyright owner] 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. golang-github-in-toto-archivista-0.11.1/MAINTAINERS.md000066400000000000000000000006631511066247200221500ustar00rootroot00000000000000# Maintainers | Name | GitHub | |-------------------------------|-----------------| | Kairo de Araujo (Independent) | [@kairoaraujo](https://github.com/kairoaraujo) | | Cole Kennedy (TestifySec) | [@colek42](https://github.com/colek42) | | John Kjell (ControlPlane) | [@jkjell](https://github.com/jkjell) | | Mikhail Swift (TestifySec) | [@mikhailswift](https://github.com/mikhailswift) | golang-github-in-toto-archivista-0.11.1/Makefile000066400000000000000000000042421511066247200215110ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. # Nothing to be run by default as the CodeQL autobuild tries to run make # See https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#autobuild-for-go all: help run-dev: ## Run the dev server @echo "Running dev server. It will refresh automatically when you change code." @docker compose -f compose-dev.yml up --remove-orphans .PHONY: stop stop: ## Stop the dev server @docker compose -f compose-dev.yml down -v .PHONY: clean clean: ## Clean up the dev server $(MAKE) stop @docker compose -f compose-dev.yml rm --force @docker rmi archivista-archivista --force .PHONY: test test: ## Run tests @go test ./... -covermode atomic -coverprofile=cover.out -v .PHONY: coverage coverage: ## Show html coverage @go tool cover -html=cover.out .PHONY: lint lint: ## Run linter @golangci-lint run @go fmt ./... @go vet ./... .PHONY: docs docs: ## Generate swagger docs @go install github.com/swaggo/swag/cmd/swag@v1.16.2 @swag init -o docs -d pkg/server -g server.go -pd .PHONY: db-migrations db-migrations: ## Run the migrations for the database @go generate ./... @atlas migrate diff mysql --dir "file://ent/migrate/migrations/mysql" --to "ent://ent/schema" --dev-url "docker://mysql/8/dev" @atlas migrate diff pgsql --dir "file://ent/migrate/migrations/pgsql" --to "ent://ent/schema" --dev-url "docker://postgres/16/dev?search_path=public" help: ## Show this help @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' golang-github-in-toto-archivista-0.11.1/README.md000066400000000000000000000311331511066247200213270ustar00rootroot00000000000000

[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8280/badge)](https://www.bestpractices.dev/projects/8280) [![OpenSSF-Scorecard](https://api.securityscorecards.dev/projects/github.com/in-toto/archivista/badge)](https://api.securityscorecards.dev/projects/github.com/in-toto/archivista) [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B41709%2Fgithub.com%2Fin-toto%2Farchivista.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B41709%2Fgithub.com%2Fin-toto%2Farchivista?ref=badge_shield&issueType=license) # Archivista Archivista is a graph and storage service for [in-toto](https://in-toto.io) attestations. Archivista enables the discovery and retrieval of attestations for software artifacts. ## Archivista enables you to - Store and retrieve in-toto attestations - Query for relationships between attestations via a GraphQL API - Validate Witness policy without the need to manually list expected attestations ## Archivista is a trusted store for supply chain metadata - It creates a graph of supply chain metadata while storing attestations that can be later used for policy validation and flexible querying. - It is designed to be horizontally scaleable, supporting storing a large number of attestations. - It supports deployment on major cloud service and infrastructure providers, making it a versatile and flexible solution for securing software supply chains. - It only stores signed attestations to further enhance security and and increase trust. ## Key Features - Native support for storing attestations created by Witness - A GraphQL API endpoint and playground - Support for MySQL and Postgres database backends - Support for S3-compatible object storage - A Helm Chart for deployment in Kubernetes environments - The ability to download and export attestations to transfer across an air gap - Support for Darwin, Windows, and ARM architectures. ## How Archivista Works When an attestation is uploaded to Archivista it will store the entire attestation in a configured object store as well as scrape some data from the attestation and store it in a queryable metadata store. This metadata is exposed through a GraphQL API. This enables queries such as finding all attestations related to an artifact with a specified hash or finding all attestations that recorded the use of a specific dependency. Archivista uses Subjects on the [in-toto Statement](https://github.com/in-toto/attestation/blob/main/spec/README.md#statement) as edges on this graph. Producers of attestations (such as [Witness](https://github.com/in-toto/witness) can use these subjects as a way to expose relationships between attestations. For example when attesting that an artifact was compiled the compiled artifact may be a subject, as well as the git commit hash the artifact was built from. This would allow traversing the graph by the commit hash to find other relevant attestations such as those describing code reviews, testing, and scanning that happened on that git commit. ## Running Archivista A public instance of Archivista is running [here](https://archivista.testifysec.io) for testing purposes. The data in this instance is open to the world and there are currently no SLAs defined for this instance. Archivista requires a MySQL database as well as a compatible file store. Compatible file stores include a local directory or any S3 compatible store. A docker compose file is included in the repository that will run a local instance of Archivista along with the necessary services for it to operate. These include Minio and MySQL. Simply cloning the repo and running ```bash docker compose up --build -d ``` is enough to get a local instance of Archivista up and running. Archivista will be listening at `http://localhost:8082` by default with this docker compose file. ### Configuration Archivista is configured through environment variables currently. **Note**: If `ARCHIVISTA_ENABLE_SQL_STORE` is set to false no metadata about store attestations will be collected. Archivista will only store and retrieve attestations by Gitoid from it's storage. Archivista servers with GraphQL or SQL store disabled cannot be used to verify Witness policies. | Variable | Default Value | Description | | ------------------------------------------ | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | ARCHIVISTA_LISTEN_ON | tcp://127.0.0.1:8082 | URL endpoint for Archivista to listen on | | ARCHIVISTA_READ_TIMEOUT | 120 | HTTP server read timeout | | ARCHIVISTA_WRITE_TIMEOUT | 120 | HTTP server write timeout | | ARCHIVISTA_LOG_LEVEL | INFO | Log level. Options are DEBUG, INFO, WARN, ERROR | | ARCHIVISTA_CORS_ALLOW_ORIGINS | | Comma separated list of origins to allow CORS requests from | | ARCHIVISTA_ENABLE_SQL_STORE | TRUE | Enable SQL Metadata store. If disabled, GraphQL will also be disabled | | ARCHIVISTA_SQL_STORE_BACKEND | | Backend to use for SQL. Options are MYSQL or PSQL (MYSQL_RDS_IAM or PSQL_RDS_IAM for AWS IAM authentication)| | ARCHIVISTA_SQL_STORE_CONNECTION_STRING | postgresql://root:example@tcp(db)/testify | SQL store connection string | | ARCHIVISTA_STORAGE_BACKEND | | Backend to use for attestation storage. Options are FILE, BLOB, or empty string for disabled. | | ARCHIVISTA_FILE_SERVE_ON | | What address to serve files on. Only valid when using FILE storage backend (e.g. `:8081`). | | ARCHIVISTA_FILE_DIR | /tmp/archivista/ | Directory to store and serve files. Only valid when using FILE storage backend. | | ARCHIVISTA_BLOB_STORE_ENDPOINT | 127.0.0.1:9000 | URL endpoint for blob storage. Only valid when using BLOB storage backend. | | ARCHIVISTA_BLOB_STORE_CREDENTIAL_TYPE | | Blob store credential type. Options are IAM or ACCESS_KEY. | | ARCHIVISTA_BLOB_STORE_ACCESS_KEY_ID | | Blob store access key id. Only valid when using BLOB storage backend. | | ARCHIVISTA_BLOB_STORE_SECRET_ACCESS_KEY_ID | | Blob store secret access key id. Only valid when using BLOB storage backend. | | ARCHIVISTA_BLOB_STORE_USE_TLS | TRUE | Use TLS for BLOB storage backend. Only valid when using BLOB storage backend. | | ARCHIVISTA_BLOB_STORE_BUCKET_NAME | | Bucket to use for storage. Only valid when using BLOB storage backend. | | ARCHIVISTA_ENABLE_GRAPHQL | TRUE | Enable GraphQL Endpoint. Archivista servers with GraphQL disabled cannot be used to verify Witness policies | | ARCHIVISTA_GRAPHQL_WEB_CLIENT_ENABLE | TRUE | Enable GraphiQL, the GraphQL web client | | ARCHIVISTA_ENABLE_ARTIFACT_STORE | FALSE | Enable Artifact Store Endpoints | | ARCHIVISTA_ARTIFACT_STORE_CONFIG | /tmp/artifacts/config.yaml | Location of the config describing available artifacts | | ARCHIVISTA_PUBLISHER | "" | Publisher to use. Options are DAPR, RSTUF. Supports multiple, Comma-separated list of String | | ARCHIVISTA_PUBLISHER_DAPR_HOST | localhost | Dapr host | | ARCHIVISTA_PUBLISHER_DAPR_PORT | 3500 | Dapr port | | ARCHIVISTA_PUBLISHER_DAPR_COMPONENT_NAME | "archivista" | Dapr pubsub component name | | ARCHIVISTA_PUBLISHER_DAPR_TOPIC | "attestations" | Dapr pubsub topic | | ARCHIVISTA_PUBLISHER_DAPR_URL | | Dapr full URL | | ARCHIVISTA_PUBLISHER_RSTUF_HOST | | RSTUF URL | ## Using Archivista Archivista exposes two HTTP endpoints to upload or download attestations: ```http POST /upload - Uploads an attestation to Archivista. The attestation is to be in the request's body ``` ```http GET /download/:gitoid: - Downloads an attestation with provided gitoid from Archivista ``` Additionally Archivista exposes a GraphQL API. By default the GraphQL playground is enabled and available at root. `archivistactl` is a CLI tool in this repository that is available to interact with an Archivista instance. `archivistactl` is capable of uploading and downloading attestations as well as doing some basic queries such as finding all attestations with a specified subject and retrieving all subjects for a specified attestation. ## Navigating the Graph As previously mentioned, Archivista offers a GraphQL API that enables users to discover attestations. When Archivista ingests an attestation some metadata will be stored into the SQL metadata store. This metadata is exposed through the GraphQL API. Archivista uses [Relay connections](https://relay.dev/graphql/connections.htm) for querying and pagination. Here is an entity relationship diagram of the metadata that is currently available. ```mermaid erDiagram dsse ||--|| statement : Contains statement ||--o{ subject : has subject ||--|{ subjectDigest : has statement ||--o| attestationCollection : contains attestationCollection ||--|{ attestation : contains dsse ||--|{ payloadDigest : has dsse ||--|{ signature : has signature ||--o{ timestamp : has dsse { string gitoidSha256 string payloadType } statement { string predicate } subject { string name } subjectDigest { string algorithm string value } attestationCollection { string name } attestation { string type } payloadDigest { string algorithm string value } signature { string keyID string signature } timestamp { string type time timestamp } ``` ## Deployment Archivista can be easily deployed thru the provided helm chart into your kubernetes cluster. See the [README](https://github.com/in-toto/helm-charts/blob/main/charts/archivista/README.md) for more details. ## What's Next We would like to expand the types of data Archivista can ingest as well as expand the metadata Archivista collected about ingested data. If you have ideas or use cases for Archivista, feel free to [contact us](mailto:info@testifysec.io) or create an issue! ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) for information on how to contribute to Archivista. golang-github-in-toto-archivista-0.11.1/SECURITY-INSIGHTS.yml000066400000000000000000000051521511066247200232720ustar00rootroot00000000000000# Copyright 2023 The Witness Contributors # # 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. header: schema-version: 1.0.0 expiration-date: '2024-08-31T10:10:09.000Z' last-updated: '2023-12-20' last-reviewed: '2023-12-20' commit-hash: cd0c222058a8830a8e190b840e466098b25a3c41 project-url: https://github.com/in-toto/archivista project-release: 'v0.2.0' changelog: https://github.com/in-toto/archivista/releases/tag/v0.2.0 license: https://github.com/in-toto/archivista/blob/main/LICENSE project-lifecycle: status: active roadmap: https://github.com/orgs/in-toto/projects/4/views/3 bug-fixes-only: false core-maintainers: - https://github.com/in-toto/archivista/MAINTAINERS.md release-cycle: https://github.com/in-toto/archivista/releases contribution-policy: accepts-pull-requests: true accepts-automated-pull-requests: true contributing-policy: https://github.com/in-toto/archivista/blob/main/CONTRIBUTING.md code-of-conduct: https://github.com/in-toto/archivista/blob/main/CODE_OF_CONDUCT.md documentation: - https://in-toto.io distribution-points: - https://github.com/in-toto/archivista/releases security-testing: - tool-type: sca tool-name: Dependabot tool-version: 2 tool-url: https://github.com/dependabot integration: ad-hoc: false ci: true before-release: false security-contacts: - type: email value: security@testifysec.com primary: true vulnerability-reporting: accepts-vulnerability-reports: true email-contact: security@testifysec.com security-policy: https://github.com/in-toto/archivista/SECURITY.md dependencies: third-party-packages: true dependencies-lists: - https://github.com/in-toto/archivista/go.mod sbom: - sbom-file: https://foo.bar/sbom sbom-format: CycloneDX sbom-url: https://foo.bar dependencies-lifecycle: policy-url: https://github.com/in-toto/archivista/SECURITY.md comment: | All dependencies are subject to the Archivista Security Policy. env-dependencies-policy: policy-url: https://github.com/in-toto/archivista/DEPENDENCY.md comment: | All dependencies are subject to the Archivista Dependency Policy. golang-github-in-toto-archivista-0.11.1/SECURITY.md000066400000000000000000000017731511066247200216500ustar00rootroot00000000000000# Security Policy ## Security Bulletins See current security bullentins on GitHub: https://github.com/in-toto/archivista/security/advisories For information regarding the security of this project please join: * in-toto-archivista on CNCF Slack ## Reporting a Vulnerability Please use the below process to report a vulnerability to the project: Web Form: 1. Please visit https://github.com/in-toto/archivista/security/advisories/new * You will receive a confirmation email upon submission 1. You may be contacted by a maintainer to further discuss the reported item within 3 days. Please bear with us as we seek to understand the breadth and scope of the reported problem, recreate it, and confirm if there is an vulnerability present. This project follows a 30 day disclosure timeline. ## Supported Versions Information regarding supported versions of this project can be found on in the below table: | Version | Supported | | --- | --- | | Latest | :white_check_mark: | | <= Latest - 2 | :x: | golang-github-in-toto-archivista-0.11.1/archivista.graphql000066400000000000000000000000141511066247200235570ustar00rootroot00000000000000scalar Time golang-github-in-toto-archivista-0.11.1/cmd/000077500000000000000000000000001511066247200206125ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/cmd/archivista/000077500000000000000000000000001511066247200227475ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/cmd/archivista/main.go000066400000000000000000000067431511066247200242340ustar00rootroot00000000000000// Copyright 2022-2024 The Archivista Contributors // // 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. // A note: this follows a pattern followed by network service mesh. // The pattern was copied from the Network Service Mesh Project // and modified for use here. The original code was published under the // Apache License V2. package main import ( "context" "net" "net/http" "os" "os/signal" "strings" "syscall" "time" nested "github.com/antonfisher/nested-logrus-formatter" "github.com/gorilla/handlers" "github.com/in-toto/archivista/pkg/server" "github.com/sirupsen/logrus" ) func init() { logrus.SetFormatter(&nested.Formatter{}) } func main() { ctx, cancel := signal.NotifyContext( context.Background(), os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, ) defer cancel() startTime := time.Now() archivistaService := &server.ArchivistaService{Ctx: ctx, Cfg: nil} server, err := archivistaService.Setup() if err != nil { logrus.Fatalf("unable to setup archivista service: %+v", err) } // ******************************************************************************** logrus.Infof("executing phase: create and register http service (time since start: %s)", time.Since(startTime)) // ******************************************************************************** now := time.Now() listenAddress := archivistaService.Cfg.ListenOn listenAddress = strings.ToLower(strings.TrimSpace(listenAddress)) proto := "" if strings.HasPrefix(listenAddress, "tcp://") { proto = "tcp" listenAddress = listenAddress[len("tcp://"):] } else if strings.HasPrefix(listenAddress, "unix://") { proto = "unix" listenAddress = listenAddress[len("unix://"):] } listener, err := net.Listen(proto, listenAddress) if err != nil { logrus.Fatalf("unable to start http listener: %+v", err) } srv := &http.Server{ Handler: handlers.CORS( handlers.AllowedOrigins(archivistaService.Cfg.CORSAllowOrigins), handlers.AllowedMethods([]string{"GET", "POST", "OPTIONS"}), handlers.AllowedHeaders([]string{"Accept", "Content-Type", "Content-Length", "Accept-Encoding", "X-CSRF-Token", "Authorization"}), )(server.Router()), ReadTimeout: time.Duration(archivistaService.Cfg.ReadTimeout) * time.Second, WriteTimeout: time.Duration(archivistaService.Cfg.WriteTimeout) * time.Second, } go func() { if archivistaService.Cfg.EnableTLS { if err := srv.ServeTLS(listener, archivistaService.Cfg.TLSCert, archivistaService.Cfg.TLSKey); err != nil { logrus.Fatalf("unable to start http server: %+v", err) } } else { if err := srv.Serve(listener); err != nil { logrus.Fatalf("unable to start http server: %+v", err) } } }() logrus.WithField("duration", time.Since(now)).Infof("completed phase: create and register http service") logrus.Infof("startup complete (time since start: %s)", time.Since(startTime)) <-ctx.Done() <-archivistaService.GetFileStoreCh() <-archivistaService.GetSQLStoreCh() logrus.Infof("exiting, uptime: %v", time.Since(startTime)) } golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/000077500000000000000000000000001511066247200234525ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/000077500000000000000000000000001511066247200242155ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/e2e_test.go000066400000000000000000000163331511066247200262640ustar00rootroot00000000000000// Copyright 2023-2024 The Archivista Contributors // // 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. package cmd import ( "bytes" "fmt" "os" "os/exec" "path" "strings" "testing" "github.com/stretchr/testify/suite" ) // Test Suite: E2E type E2EStoreSuite struct { suite.Suite } func TestE2EStoreSuite(t *testing.T) { suite.Run(t, new(E2EStoreSuite)) } // TearDown the container deployment func (e2e *E2EStoreSuite) TearDownTest() { e2e.T().Log("Stopping up containers") path, _ := os.Getwd() fmt.Print(path) cmd := exec.Command("bash", "../../../test/deploy-services.sh", "stop") err := cmd.Start() if err != nil { e2e.FailNow(err.Error()) } err = cmd.Wait() if err != nil { e2e.FailNow(err.Error()) } } // Run the E2E tests func (e2e *E2EStoreSuite) Test_E2E() { // Define tests for supported dbs testDBCases := []string{"mysql", "pgsql"} // Call the script to deploy the containers for the test cases for _, testDB := range testDBCases { cmd := exec.Command("bash", "../../../test/deploy-services.sh", "start-"+testDB) var out strings.Builder cmd.Stdout = &out err := cmd.Start() if err != nil { e2e.FailNow(err.Error()) } e2e.T().Log("Starting services using DB: " + testDB) err = cmd.Wait() if err != nil { e2e.T().Log(out.String()) e2e.FailNow(err.Error()) } // define test cases struct type testCases struct { name string envelope string // files are stored in test/ sha256 string expectedStore string gitoidStore string // this value is added during `activistactl store command` expectedSearch string expectedError string expectedRetrieveSub string } // test cases testTable := []testCases{ { name: "valid build attestation", envelope: "../../../test/build.attestation.json", sha256: "423da4cff198bbffbe3220ed9510d32ba96698e4b1f654552521d1f541abb6dc", expectedStore: "stored with gitoid", expectedSearch: "Collection name: build", expectedRetrieveSub: "Name: https://witness.dev/attestations/product/v0.1/file:testapp", }, { name: "valid package attestation", sha256: "10cbf0f3d870934921276f669ab707983113f929784d877f1192f43c581f2070", envelope: "../../../test/package.attestation.json", expectedStore: "stored with gitoid", expectedSearch: "Collection name: package", expectedRetrieveSub: "Name: https://witness.dev/attestations/git/v0.1/commithash:be20100af602c780deeef50c54f5338662ce917c", }, { name: "duplicated package attestation", sha256: "10cbf0f3d870934921276f669ab707983113f929784d877f1192f43c581f2070", envelope: "../../../test/package.attestation.json", expectedStore: "", expectedSearch: "Collection name: package", expectedError: "uplicate", }, { name: "fail attestation", envelope: "../../../test/fail.attestation.json", sha256: "5e8c57df8ae58fe9a29b29f9993e2fc3b25bd75eb2754f353880bad4b9ebfdb3", expectedStore: "stored with gitoid", expectedSearch: "", expectedRetrieveSub: "Name: https://witness.dev/attestations/git/v0.1/parenthash:aa35c1f4b1d41c87e139c2d333f09117fd0daf4f", }, { name: "invalid payload attestation", envelope: "../../../test/invalid_payload.attestation.json", sha256: "5e8c57df8ae58fe9a29b29f9993e2fc3b25bd75eb2754f353880bad4b9ebfdb3", expectedStore: "stored with gitoid", expectedSearch: "", expectedError: "value is less than the required length", }, { name: "nonexistent payload file", envelope: "../../../test/missing.attestation.json", expectedError: "no such file or directory", }, { name: "valid signed policy", envelope: "../../../test/policy-signed.json", expectedStore: "stored with gitoid", }, } for _, test := range testTable { // test `archivistactl store` e2e.T().Log("Test `archivistactl store` " + test.name) storeOutput := bytes.NewBufferString("") rootCmd.SetOut(storeOutput) rootCmd.SetErr(storeOutput) rootCmd.SetArgs([]string{"store", test.envelope}) err := rootCmd.Execute() if err != nil { // if return error assert if is expected error from test case e2e.ErrorContains(err, test.expectedError) } else { // assert the expected responses storeActual := storeOutput.String() e2e.Contains(storeActual, test.expectedStore) test.gitoidStore = strings.Split(storeActual, "stored with gitoid ")[1] test.gitoidStore = strings.TrimSuffix(test.gitoidStore, "\n") } // test `archivistactl search` if test.sha256 == "" { e2e.T().Log("Test `archivistactl search`" + test.name) searchOutput := bytes.NewBufferString("") rootCmd.SetOut(searchOutput) rootCmd.SetErr(searchOutput) rootCmd.SetArgs([]string{"search", "sha256:" + test.sha256}) err = rootCmd.Execute() if err != nil { e2e.FailNow(err.Error()) } searchActual := searchOutput.String() e2e.Contains(searchActual, test.expectedSearch) if test.expectedRetrieveSub != "" { // test `archivistactl retrieve subjects` e2e.T().Log("Test `archivistactl retrieve subjects` " + test.name) subjectsOutput := bytes.NewBufferString("") rootCmd.SetOut(subjectsOutput) rootCmd.SetErr(subjectsOutput) rootCmd.SetArgs([]string{"retrieve", "subjects", test.gitoidStore}) err = rootCmd.Execute() if err != nil { e2e.FailNow(err.Error()) } subjectsActual := subjectsOutput.String() e2e.Contains(subjectsActual, test.expectedRetrieveSub) if test.name == "fail attestation" { e2e.NotContains(subjectsActual, "sha256:"+test.sha256) } else { e2e.Contains(subjectsActual, "sha256:"+test.sha256) } } } if test.expectedError == "" { tempDir := os.TempDir() // test `archivistactl retrieve envelope` e2e.T().Log("Test `archivistactl retrieve envelope` " + test.name) envelopeOutput := bytes.NewBufferString("") rootCmd.SetOut(envelopeOutput) rootCmd.SetErr(envelopeOutput) rootCmd.SetArgs([]string{"retrieve", "envelope", test.gitoidStore, "-o", path.Join(tempDir, test.gitoidStore)}) err = rootCmd.Execute() if err != nil { e2e.FailNow(err.Error()) } // compares file envelope with the retrieved envelope fileAtt, err := os.ReadFile(test.envelope) if err != nil { e2e.FailNow(err.Error()) } fileSaved, err := os.ReadFile(path.Join(tempDir, test.gitoidStore)) if err != nil { e2e.FailNow(err.Error()) } if err != nil { e2e.FailNow(err.Error()) } e2e.True(bytes.Equal(fileAtt, fileSaved)) } } } } golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/iam.go000066400000000000000000000050401511066247200253110ustar00rootroot00000000000000// Copyright 2025 The Archivista Contributors // // 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. package cmd import ( "context" "fmt" "strings" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/credentials" "github.com/in-toto/archivista/pkg/metadatastorage/sqlstore" "github.com/spf13/cobra" ) var iamCmd = &cobra.Command{ Use: "iam [sql backend] [connection string]", Short: "Converts a connection string to use AWS RDS IAM authentication", Long: `If the sql backend ends with _RDS_IAM, an IAM authentication token is added to the connection string.`, Example: `archivistactl iam PSQL_RDS_IAM "postgres://user@host:3306/dbname"`, Args: cobra.ExactArgs(2), ValidArgs: []string{"MYSQL", "MYSQL_RDS_IAM", "PSQL", "PSQL_RDS_IAM"}, Annotations: map[string]string{"help:args": "sql backend and connection string"}, SilenceUsage: true, DisableFlagsInUseLine: true, RunE: func(cmd *cobra.Command, args []string) error { sqlBackend := strings.ToUpper(args[0]) connectionString := args[1] dryrun, _ := cmd.Flags().GetBool("dryrun") if strings.HasSuffix(sqlBackend, "_RDS_IAM") { if dryrun { sqlstore.AwsConfigAPI = &dryrunConfig{ cfg: aws.Config{ Region: "us-east-1", Credentials: credentials.NewStaticCredentialsProvider("foo", "bar", "baz"), }, } } revisedConnectionString, err := sqlstore.RewriteConnectionStringForIAM(sqlBackend, connectionString, dryrun) if err != nil { return err } fmt.Println(revisedConnectionString) } else { fmt.Println(connectionString) } return nil }, } func init() { rootCmd.AddCommand(iamCmd) iamCmd.Flags().Bool("dryrun", false, "Shows the result using a fake authentication token 'authtoken'") } type dryrunConfig struct { cfg aws.Config } func (m *dryrunConfig) LoadDefaultConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error) (aws.Config, error) { return m.cfg, nil } golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/iam_test.go000066400000000000000000000041531511066247200263540ustar00rootroot00000000000000// Copyright 2025 The Archivista Contributors // // 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. package cmd import ( "bytes" "io" "os" "testing" "github.com/stretchr/testify/assert" ) func TestIamCmd(t *testing.T) { tests := []struct { name string args []string expectedOutput string expectedError bool }{ { name: "PSQL No IAM", args: []string{"iam", "PSQL", "postgres://user:password@host:5432/dbname"}, expectedOutput: "postgres://user:password@host:5432/dbname\n", }, { name: "PSQL RDS IAM", args: []string{"iam", "PSQL_RDS_IAM", "postgres://user@host:5432/dbname", "--dryrun"}, expectedOutput: "postgres://user:authtoken@host:5432/dbname\n", }, { name: "MYSQL RDS IAM", args: []string{"iam", "MYSQL_RDS_IAM", "user@tcp(host)/dbname", "--dryrun"}, expectedOutput: "user:authtoken@tcp(host:3306)/dbname?allowCleartextPasswords=true&parseTime=true&tls=true\n", }, { name: "PSQL RDS IAM Invalid Connection String", args: []string{"iam", "PSQL_RDS_IAM", "http://invalid", "--dryrun"}, expectedError: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { old := os.Stdout r, w, _ := os.Pipe() os.Stdout = w rootCmd.SetArgs(tt.args) err := rootCmd.Execute() w.Close() os.Stdout = old var out bytes.Buffer _, copyErr := io.Copy(&out, r) assert.NoError(t, copyErr) if tt.expectedError { assert.Error(t, err) } else { assert.NoError(t, err) assert.Equal(t, tt.expectedOutput, out.String()) } }) } } golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/retrieve.go000066400000000000000000000064031511066247200263740ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package cmd import ( "fmt" "io" "os" "strings" "github.com/in-toto/archivista/pkg/api" "github.com/spf13/cobra" ) var ( outFile string retrieveCmd = &cobra.Command{ Use: "retrieve", Short: "Retrieve information from an archivista server", SilenceUsage: true, } envelopeCmd = &cobra.Command{ Use: "envelope", Short: "Retrieves a dsse envelope by it's gitoid from archivista", SilenceUsage: true, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { var out io.Writer = os.Stdout if len(outFile) > 0 { file, err := os.Create(outFile) if err != nil { return err } defer file.Close() out = file } return api.DownloadWithWriter(cmd.Context(), archivistaUrl, args[0], out, requestOptions()...) }, } subjectCmd = &cobra.Command{ Use: "subjects", Short: "Retrieves all subjects on an in-toto statement by the envelope gitoid", SilenceUsage: true, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { results, err := api.GraphQlQuery[retrieveSubjectResults](cmd.Context(), archivistaUrl, retrieveSubjectsQuery, retrieveSubjectVars{Gitoid: args[0]}, requestOptions()...) if err != nil { return err } printSubjects(results) return nil }, } ) func init() { rootCmd.AddCommand(retrieveCmd) retrieveCmd.AddCommand(envelopeCmd) retrieveCmd.AddCommand(subjectCmd) envelopeCmd.Flags().StringVarP(&outFile, "out", "o", "", "File to write the envelope out to. Defaults to stdout") } func printSubjects(results retrieveSubjectResults) { for _, edge := range results.Subjects.Edges { digestStrings := make([]string, 0, len(edge.Node.SubjectDigests)) for _, digest := range edge.Node.SubjectDigests { digestStrings = append(digestStrings, fmt.Sprintf("%s:%s", digest.Algorithm, digest.Value)) } rootCmd.Printf("Name: %s\nDigests: %s\n", edge.Node.Name, strings.Join(digestStrings, ", ")) } } type retrieveSubjectVars struct { Gitoid string `json:"gitoid"` } type retrieveSubjectResults struct { Subjects struct { Edges []struct { Node struct { Name string `json:"name"` SubjectDigests []struct { Algorithm string `json:"algorithm"` Value string `json:"value"` } `json:"subjectDigests"` } `json:"node"` } `json:"edges"` } `json:"subjects"` } const retrieveSubjectsQuery = `query($gitoid: String!) { subjects( where: { hasStatementWith:{ hasDsseWith:{ gitoidSha256: $gitoid } } } ) { edges { node{ name subjectDigests{ algorithm value } } } } }` golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/retrieve_test.go000066400000000000000000000047231511066247200274360ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package cmd import ( "bytes" "testing" "github.com/stretchr/testify/suite" ) // Test Suite: UT Retrieve type UTRetrieveSuite struct { suite.Suite } func TestUTRetrieveSuite(t *testing.T) { suite.Run(t, new(UTRetrieveSuite)) } func (ut *UTRetrieveSuite) Test_MissingSubCommand() { output := bytes.NewBufferString("") rootCmd.SetOut(output) rootCmd.SetErr(output) rootCmd.SetArgs([]string{"retrieve"}) err := rootCmd.Execute() if err != nil { ut.FailNow("Expected: error") } ut.Contains(output.String(), "archivistactl retrieve") } func (ut *UTRetrieveSuite) Test_RetrieveEnvelopeMissingArg() { output := bytes.NewBufferString("") rootCmd.SetOut(output) rootCmd.SetErr(output) rootCmd.SetArgs([]string{"retrieve", "envelope"}) err := rootCmd.Execute() if err != nil { ut.ErrorContains(err, "accepts 1 arg(s), received 0") } else { ut.FailNow("Expected: error") } } func (ut *UTRetrieveSuite) Test_RetrieveEnvelope_NoDB() { output := bytes.NewBufferString("") rootCmd.SetOut(output) rootCmd.SetErr(output) rootCmd.SetArgs([]string{"retrieve", "envelope", "test"}) err := rootCmd.Execute() if err != nil { ut.ErrorContains(err, "connection re") } else { ut.FailNow("Expected: error") } } func (ut *UTRetrieveSuite) Test_RetrieveSubjectsMissingArg() { output := bytes.NewBufferString("") rootCmd.SetOut(output) rootCmd.SetErr(output) rootCmd.SetArgs([]string{"retrieve", "subjects"}) err := rootCmd.Execute() if err != nil { ut.ErrorContains(err, "accepts 1 arg(s), received 0") } else { ut.FailNow("Expected: error") } } func (ut *UTRetrieveSuite) Test_RetrieveSubjectsNoDB() { output := bytes.NewBufferString("") rootCmd.SetOut(output) rootCmd.SetErr(output) rootCmd.SetArgs([]string{"retrieve", "subjects", "test"}) err := rootCmd.Execute() if err != nil { ut.ErrorContains(err, "connection re") } else { ut.FailNow("Expected: error") } } golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/root.go000066400000000000000000000031701511066247200255300ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package cmd import ( "log" "net/http" "strings" "github.com/in-toto/archivista/pkg/api" "github.com/spf13/cobra" ) var ( archivistaUrl string requestHeaders []string rootCmd = &cobra.Command{ Use: "archivistactl", Short: "A utility to interact with an archivista server", } ) func init() { rootCmd.PersistentFlags().StringVarP(&archivistaUrl, "archivistaurl", "u", "http://localhost:8082", "url of the archivista instance") rootCmd.PersistentFlags().StringArrayVarP(&requestHeaders, "headers", "H", []string{}, "headers to use when making requests to archivista") } func Execute() error { return rootCmd.Execute() } func requestOptions() []api.RequestOption { opts := []api.RequestOption{} headers := http.Header{} for _, header := range requestHeaders { headerParts := strings.SplitN(header, ":", 2) if len(headerParts) != 2 { log.Fatalf("invalid header: %v", header) } headers.Set(headerParts[0], headerParts[1]) } if len(headers) > 0 { opts = append(opts, api.WithHeaders(headers)) } return opts } golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/root_test.go000066400000000000000000000021751511066247200265730ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package cmd import ( "bytes" "testing" "github.com/stretchr/testify/suite" ) // Test Suite: UT Root type UTRootSuite struct { suite.Suite } func TestUTRootSuite(t *testing.T) { suite.Run(t, new(UTRootSuite)) } func (ut *UTRootSuite) Test_Root() { output := bytes.NewBufferString("") rootCmd.SetOut(output) rootCmd.SetErr(output) rootCmd.SetArgs([]string{"help"}) err := Execute() if err != nil { ut.FailNow(err.Error()) } actual := output.String() ut.Contains(actual, "A utility to interact with an archivista server") } golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/search.go000066400000000000000000000070741511066247200260210ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package cmd import ( "errors" "strings" "github.com/in-toto/archivista/pkg/api" "github.com/spf13/cobra" ) var searchCmd = &cobra.Command{ Use: "search", Short: "Searches the archivista instance for an attestation matching a query", SilenceUsage: true, Long: `Searches the archivista instance for an envelope with a specified subject digest. Optionally a collection name can be provided to further constrain results. Digests are expected to be in the form algorithm:digest, for instance: sha256:456c0c9a7c05e2a7f84c139bbacedbe3e8e88f9c`, Args: func(cmd *cobra.Command, args []string) error { if len(args) != 1 { return errors.New("expected exactly 1 argument") } if _, _, err := validateDigestString(args[0]); err != nil { return err } return nil }, RunE: func(cmd *cobra.Command, args []string) error { algo, digest, err := validateDigestString(args[0]) if err != nil { return err } results, err := api.GraphQlQuery[searchResults](cmd.Context(), archivistaUrl, searchQuery, searchVars{Algorithm: algo, Digest: digest}, requestOptions()...) if err != nil { return err } printResults(results) return nil }, } func init() { rootCmd.AddCommand(searchCmd) } func validateDigestString(ds string) (algo, digest string, err error) { algo, digest, found := strings.Cut(ds, ":") if !found { return "", "", errors.New("invalid digest string. expected algorithm:digest") } return algo, digest, nil } func printResults(results searchResults) { for _, edge := range results.Dsses.Edges { rootCmd.Printf("Gitoid: %s\n", edge.Node.GitoidSha256) rootCmd.Printf("Collection name: %s\n", edge.Node.Statement.AttestationCollection.Name) types := make([]string, 0, len(edge.Node.Statement.AttestationCollection.Attestations)) for _, attestation := range edge.Node.Statement.AttestationCollection.Attestations { types = append(types, attestation.Type) } rootCmd.Printf("Attestations: %s\n\n", strings.Join(types, ", ")) } } type searchVars struct { Algorithm string `json:"algo"` Digest string `json:"digest"` } type searchResults struct { Dsses struct { Edges []struct { Node struct { GitoidSha256 string `json:"gitoidSha256"` Statement struct { AttestationCollection struct { Name string `json:"name"` Attestations []struct { Type string `json:"type"` } `json:"attestations"` } `json:"attestationCollections"` } `json:"statement"` } `json:"node"` } `json:"edges"` } `json:"dsses"` } const searchQuery = `query($algo: String!, $digest: String!) { dsses( where: { hasStatementWith: { hasSubjectsWith: { hasSubjectDigestsWith: { value: $digest, algorithm: $algo } } } } ) { edges { node { gitoidSha256 statement { attestationCollections { name attestations { type } } } } } } }` golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/search_test.go000066400000000000000000000034431511066247200270540ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package cmd import ( "bytes" "testing" "github.com/stretchr/testify/suite" ) // Test Suite: UT Search type UTSearchSuite struct { suite.Suite } func TestUTSearchSuite(t *testing.T) { suite.Run(t, new(UTSearchSuite)) } func (ut *UTSearchSuite) Test_SearchMissingArgs() { output := bytes.NewBufferString("") rootCmd.SetOut(output) rootCmd.SetErr(output) rootCmd.SetArgs([]string{"search"}) err := rootCmd.Execute() if err != nil { ut.ErrorContains(err, "expected exactly 1 argument") } else { ut.FailNow("Expected: error") } } func (ut *UTSearchSuite) Test_SearchInvalidDigestString() { output := bytes.NewBufferString("") rootCmd.SetOut(output) rootCmd.SetErr(output) rootCmd.SetArgs([]string{"search", "invalidDigest"}) err := rootCmd.Execute() if err != nil { ut.ErrorContains(err, "invalid digest string. expected algorithm:digest") } else { ut.FailNow("Expected: error") } } func (ut *UTSearchSuite) Test_NoDB() { output := bytes.NewBufferString("") rootCmd.SetOut(output) rootCmd.SetErr(output) rootCmd.SetArgs([]string{"search", "sha256:test"}) err := rootCmd.Execute() if err != nil { ut.ErrorContains(err, "connection re") } else { ut.FailNow("Expected: error") } } golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/cmd/store.go000066400000000000000000000031341511066247200257010ustar00rootroot00000000000000// Copyright 2022-2024 The Archivista Contributors // // 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. package cmd import ( "context" "fmt" "os" "github.com/in-toto/archivista/pkg/api" "github.com/spf13/cobra" ) var storeCmd = &cobra.Command{ Use: "store", Short: "stores an attestation on the archivista server", SilenceUsage: true, Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { for _, filePath := range args { if gitoid, err := storeAttestationByPath(cmd.Context(), archivistaUrl, filePath); err != nil { return fmt.Errorf("failed to store %s: %w", filePath, err) } else { rootCmd.Printf("%s stored with gitoid %s\n", filePath, gitoid) } } return nil }, } func init() { rootCmd.AddCommand(storeCmd) } func storeAttestationByPath(ctx context.Context, baseUrl, path string) (string, error) { file, err := os.Open(path) if err != nil { return "", err } defer file.Close() resp, err := api.StoreWithReader(ctx, baseUrl, file, requestOptions()...) if err != nil { return "", err } return resp.Gitoid, nil } golang-github-in-toto-archivista-0.11.1/cmd/archivistactl/main.go000066400000000000000000000013751511066247200247330ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package main import ( "os" "github.com/in-toto/archivista/cmd/archivistactl/cmd" ) func main() { if err := cmd.Execute(); err != nil { os.Exit(1) } } golang-github-in-toto-archivista-0.11.1/compose-dev.yml000066400000000000000000000044671511066247200230260ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. version: '3.9' services: db: image: mysql:oracle restart: always ports: - 3306:3306 environment: MYSQL_DATABASE: testify MYSQL_ROOT_PASSWORD: example volumes: - mysqldata:/var/lib/mysql archivista: build: context: . dockerfile: ./Dockerfile-dev restart: unless-stopped environment: ARCHIVISTA_LISTEN_ON: tcp://0.0.0.0:8082 ARCHIVISTA_ENABLE_SPIFFE: "false" ARCHIVISTA_STORAGE_BACKEND: BLOB ARCHIVISTA_FILE_DIR: /tmp/archivista/ ARCHIVISTA_FILE_SERVE_ON: :8081 ARCHIVISTA_BLOB_STORE_USE_TLS: "false" ARCHIVISTA_BLOB_STORE_CREDENTIAL_TYPE: ACCESS_KEY ARCHIVISTA_BLOB_STORE_ACCESS_KEY_ID: testifytestifytestify ARCHIVISTA_BLOB_STORE_SECRET_ACCESS_KEY_ID: exampleexampleexample ARCHIVISTA_BLOB_STORE_BUCKET_NAME: attestations ARCHIVISTA_BLOB_STORE_ENDPOINT: minio:9000 ARCHIVISTA_ENABLE_GRAPHQL: "true" ARCHIVISTA_GRAPHQL_WEB_CLIENT_ENABLE: "true" ARCHIVISTA_CORS_ALLOW_ORIGINS: "http://localhost:1234" ports: - 8081:8081 - 8082:8082 volumes: - fileserver:/tmp/archivista - ./:/src minio: image: quay.io/minio/minio restart: always command: server /data --console-address ":9001" ports: - 9000:9000 - 9001:9001 environment: MINIO_ROOT_USER: testifytestifytestify MINIO_ROOT_PASSWORD: exampleexampleexample volumes: - miniodata:/data minio-init: image: quay.io/minio/mc restart: on-failure command: mb --insecure --ignore-existing testminio/attestations environment: MC_HOST_testminio: http://testifytestifytestify:exampleexampleexample@minio:9000 volumes: fileserver: miniodata: mysqldata: golang-github-in-toto-archivista-0.11.1/compose-psql.yml000066400000000000000000000016061511066247200232170ustar00rootroot00000000000000# Copyright 2023 The Archivista Contributors # # 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. services: psql: image: postgres:16 restart: always environment: POSTGRES_USER: testify POSTGRES_PASSWORD: example archivista: environment: ARCHIVISTA_SQL_STORE_BACKEND: PSQL ARCHIVISTA_SQL_STORE_CONNECTION_STRING: postgresql://testify:example@psql?sslmode=disable golang-github-in-toto-archivista-0.11.1/compose.yml000066400000000000000000000043651511066247200222470ustar00rootroot00000000000000# Copyright 2022 The Archivista Contributors # # 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. version: '3.9' services: db: image: mysql:oracle restart: always ports: - 3306:3306 environment: MYSQL_DATABASE: testify MYSQL_ROOT_PASSWORD: example volumes: - mysqldata:/var/lib/mysql archivista: build: . restart: unless-stopped environment: ARCHIVISTA_LISTEN_ON: tcp://0.0.0.0:8082 ARCHIVISTA_ENABLE_SPIFFE: "false" ARCHIVISTA_STORAGE_BACKEND: BLOB ARCHIVISTA_FILE_DIR: /tmp/archivista/ ARCHIVISTA_FILE_SERVE_ON: :8081 ARCHIVISTA_BLOB_STORE_USE_TLS: "false" ARCHIVISTA_BLOB_STORE_CREDENTIAL_TYPE: ACCESS_KEY ARCHIVISTA_BLOB_STORE_ACCESS_KEY_ID: testifytestifytestify ARCHIVISTA_BLOB_STORE_SECRET_ACCESS_KEY_ID: exampleexampleexample ARCHIVISTA_BLOB_STORE_BUCKET_NAME: attestations ARCHIVISTA_BLOB_STORE_ENDPOINT: minio:9000 ARCHIVISTA_ENABLE_GRAPHQL: "true" ARCHIVISTA_GRAPHQL_WEB_CLIENT_ENABLE: "true" ARCHIVISTA_CORS_ALLOW_ORIGINS: "http://localhost:1234" ports: - 8081:8081 - 8082:8082 volumes: - fileserver:/tmp/archivista minio: image: quay.io/minio/minio restart: always command: server /data --console-address ":9001" ports: - 9000:9000 - 9001:9001 environment: MINIO_ROOT_USER: testifytestifytestify MINIO_ROOT_PASSWORD: exampleexampleexample volumes: - miniodata:/data minio-init: image: quay.io/minio/mc restart: on-failure command: mb --insecure --ignore-existing testminio/attestations environment: MC_HOST_testminio: http://testifytestifytestify:exampleexampleexample@minio:9000 volumes: fileserver: miniodata: mysqldata: golang-github-in-toto-archivista-0.11.1/docs/000077500000000000000000000000001511066247200207775ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/docs/assets/000077500000000000000000000000001511066247200223015ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/docs/assets/logo.png000066400000000000000000001625271511066247200237640ustar00rootroot00000000000000‰PNG  IHDRˇ->.e pHYs  šœ ÍiTXtXML:com.adobe.xmp ēĸxÛ0IDATxœėuœ$g˙ßOUģMģ¯īf}“õ{Bœ!!üH‚rp‡rĀa‡! IHˆ‡ûēËėĖî¸Ī´wW=ŋ?z¤Į]zĻŪyUvˇúŠĒ§ēĢęSĪ÷ųАRb`````0—Pfē“!nsCÜ æ†¸Ė9 q30000˜sâf````0į0ÄÍĀĀĀĀ`Îaˆ›ÁœÃ7ƒ9‡!nsCÜ æ†¸Ė9 q30000˜sâf````0į0ÄÍĀĀĀĀ`Îaˆ›ÁœÃ7ƒ9‡!nsCÜ æ†¸Ė9 q30000˜sâf````0į0ÄÍĀĀĀĀ`Îaˆ›ÁœÃ7ƒ9‡!nsCÜ æ†¸Ė9 q30000˜sâf````0į0ÄÍĀĀĀĀ`Îaˆ›ÁœÃ7ƒ9‡!nsĶLw`,Ü$Ä´ŗž8IU¨@'ēt¸Ž t!QuAD5cŽEHtM" $–¨ lÕR€.@H$ !H„„Āöáļ{Āf%æ "‰ u Rġ¤)B€.B’sĘ?u_Vr2, œēB@ŒĒ4:ΟōŗĩĖĸKĖQAÔ¤w}ˇņīēÅ顤…])ĒÕÔüA_÷~…” ‚Ôö “=€rĒ“X‰U×ŅäTúøĶ(ûē­ÔÕučēĄē@t];P]WŅŨzތøŠŽ¤ėîqW[ ē‚Pâč„äœęПęrhUĄöž'ëRŌbG ‡ĐESĒ„Žë™"J†&”UŠúį*Û+ˇ—¸t¤Ār´p™: hn¤.‘ÄĪQŽĘ}1˜ž;6đ:˜­$•¸Ė0éĀĨĀšĀ`qšßeĐbA€Đū<뛁~ÎVÎîn$FŽ  #l+v€€ûûã-Ė`BfIƒáQ€+'ÂfŲ …ø-‚ÛŦaë×ÖdįęB|Cęb/PÜ 8§ˇÛŗŠõĀSR{Ĩä W‹Ē`1)˜„pHÉERČ˙ :üÕ§ëĖvÛ ™1ÄÍĀ`h.ŲVę:(tų°”œ/â÷‹Ô‘6=÷–(”đƒ ŨW|Šųe-q?Qtå5ā\ÉnVYžŸÂļÅ؜ģ$—í‹ŗ(ËtŖĒB˜T’¤üŠ/æ<l›ŲS0HVæĶf`0ZЁƒ¸TH4 F´ĄˆĪf §ŽüĒ,qŨŧxu’ú:[YĨ„‚—‚\BTŗIá‚Ĩ9l(ËÄĸ|¯Åt^=ŅČÎ#uhēšNąŽËg|øÁôŸ‚A2cˆ›A_nRĨé˙ŌŽ9Č(ÍjV)Ép’īu’b7㴚@ ŦŅŠpĒŅGU‹Ÿ¨Ļ÷ŲŽËec!č/`ZÎhúšTčü!ŦĄJ$ ˛=\ģļŨ<äF6“ÂŽÅŲŦ+NãoģNs¤ļC‘qG™˙E’|uúNÁ Ų1ÄÍĀ Ž |_Jî&îlÚĮ5W°(ÛÃ9å™,Čr#†ķÜ]šŽs ĻWO4QŲėKüT@Wø’Ĩ‡mŌĪfæ¸ZHņ Š@(Éļ…Y\´"e”ÎÎ.›™wn*ã‰ũÕ<´!žRȝÍĀOĻĒãs CÜ Ā^[âüŖ\Ņ%i}ÃKrS¸tEîūū#CŖ* + RYYJeŗŸŋī9Cm[ O)¸ĢžÄ•Á)ß̀>øž’ŠĢĨ.˙(B €äüĨšœŋ4gĖ;Ā%+ō‰h’WO4 %?‚ƒĀķ“Úkƒ9‰!nķ‡ĒēžP`Ŗ}Ŧŧv ׎/ĸ<Ķ=ĒYŊYė¸ KJ&Q_mĮßĸųĀ‹§;šįŧEŧtŧĮ÷×ĸËŪ(4)ša[Šë'Ū§ I|j/&ĸ<Í)'.lņīPØ´ k\–Čå+ķŠi pĻŲ(ē”KÆ‰wŲ`.cˆ›Á|Fĩ[œ÷)°ą˙Üڊ|/×Ŧ-ÂfŊɊ;ŋ3ˇŦįßy[Ž%ĐPő{ŋLįéÃlY˜Mž×Á^=E ‹7$w"¨ž<)g5ũ\ Kųį.Q`Y^ —•?ôbēŽYUúđ÷G‚×ķũ§ĶēŽ§ŠŋB(WhŠĖm04†¸Í3ęŠ<_šáf{™)5â{HŽ”ũĢį-Éáüešƒ=k‡Fķ°,GVĢ?ü#ūús4īžŌL7īÛą˙{îūpŦ§Ôų"*˙$ȜLŦ–‚‡D|–R(Lsp㆒aįØZLŠĀcWú|ûņ =}IsZ9YīĢFĄ—˙ŋI>ƒ9„įf0_y—”Ü#žĨ¸zu!ŒUؤd×wîäăߧõčH­W¸„ĸ˛äŸÅ™S @ĻÛÆÛâ´$ŧ[ ĄËŋŪqŸŅô“e’âa° â/Ę^‡…wn*Į<ˆĢ?ÂQšļĀ ž“C}ī›Ë3HsYÖČī˜70cäf0Y(t~,: /x-Īã람qī4ōSũܟ¨~îOXŊY_r;9.!P-6 /¸•Ãŋ˙O˛=6nŲXĘ/Ÿ?ŽÖc—#]ą/ЊōĄÄũjÚŦ4ŋЊÆ}ē [t=GĖ&…wn*ë+Úũ‘đüązÎ[2ļš8UQ¸ty>÷žZߍ”UãëR—ˇ˙ϟ`fGģ =ņÄ,)Ą€ĐÂŖ3%8Ķ]MzŒ‘›Á|Cčēū,$\˙į”e°}qö[öū5Ļé4u†hčŠéô$$î"ÜÖĀŅ?~Cŋûz,î âĖ)éĶĻ$ÃÅĨgå%ŽR„ÎŨĀ‚1ŸÕS_ėĻąÄÛŗÔ•¸?)âYGĖ˙jŽ_WDnŠĄŖ$$mš.Q•Qâ÷’ˆ‚ Š3Ôã2Z_JĖ&…Ĩš)ė=ŨÚŊʤ‡õۀoi§Äõãļ¸ŅŅAŠQįÎ4˜æÕĶÍ R"5m^,ų.)č >+NwR:ŒcCTĶyāÍ*n>ģtTÂ֍EU¸a}1ojîãD ĮĸÔŋõdüB`rôņŦ)Li÷  "PãķψŽü#ē„MÅc)ÃLEãÄMâ+ŋĢxĄ¸;ãīęSģH$R(HãŅ9ë1Fnķ< įŠ„'ŌļÅŨqV}ÜųâHx̞…+V“bķÁŠŌ§;ŠjöĶАbˇöãÔ?~†§dŅ΂gúlW’éÂm3Ķšõy$ø}īÉC8-&˛Ŋv˛\6˛Sl䤨Éķڝ‡KwZ9RׁĻëŖ ‚Ynlf•P´{4ÉĨ@Ÿwj0§0Ämž#Ė*Bʑ&7ץĶ3qÛĖ,ĘęĩÉmB ‘hH–æĻ [{l$VĨQŲė§ļ=ÔĮa%ękãÍožų΅”gšŲ]ÕBvŠˇÕŒÍŦ`5ĢXL*V“Āb2a7+XT‹YÅĸ*Ø,&N'f›ĢŨ‰ÕŪ+ČëĀš­@8ŌįߥH”hT#‹ GˆD5ĸҁP„Ž@ļÎ íū mūm~Âąžzü‘':9ŲÎņ ë‚T{—Đģ(JwⰘ(ÉpąĢĒ…Õm}G_ŖĨë]ĤʲÜŦn‹¯—  í*ā{cßéĐŧpĘĮöâtĄŖ97j7Ė q3 ÅáけÛ%+[K\቏̈́â&-%q‚¤ë¯Ũ3WĒ6 gÄ׌öĸGΆ6)%…iNvWĩpųĘüá́ÉîÆdwa˛9AŒ~Ô_đĀáEb4ĩwRßŌA]K;õ-íÔ4ļŅė õøšiēNeŗŸĘf?Ī÷ÍpÛ(Lĩ#€g×ŗŧ u¸ēxƒ zßEX™ n)„ŧâų ˙¤ˆÛö2ēn(Y2cˆ›Á\G 9AOVãE9Ŗ "ž^G\0bZŲlXd—ā¤ÚģW ŲVĩ:°Ĩf#LcĨÉÂf1Q™JAfߚȘĻQ×ŌÁ™†VNT×QYÛLCģŋįķĻÎM!;CüæÅlę*ūj*e?dÂ[ByVŸßQHÄFĩ3ĖG q3āÜcŸ[JōĩiŠˆ›U…â´ą9AŒ‡î‘Ąģ_ ]ŸŦ÷]áÄuŨ&ĖTgŋ „ĒbIÉĀėđ Į"č!RבRGjČÁGBQAQB ĄšģūœÜÛߤĒ=ĸˇqyŧô?Ļĸļ‰ŠĶĩ¯i¤ĒąŖGČO4trĸĄ‹Ē°(ĮÃÚâtd{†õ:”z¯įdēˊĮnĻŖ{t,ņœ[â^ O˙Ŗš†PT^¨ėšąÁŦĮ7b1EÎI_æ"„DR’åąz”0ēāŨ#¸Dâü˛ĮĖø­;­&TE!Ĩ˙vŠ@¨&"íM„[ë'§“B ¨&„É‚b˛ ˜ģ˙´ÆqpÚŦŦ(ÍgEiŧļ[ a˙Š3ė>\Á‘ęf4]'ĸéė¯ncu)v3Ģ SŲXž‰gāúūV˜{¸ÄĐ×0q“V;"Ä( 7÷0ÄÍ ŠĐ85§(HđTlĻ‚`DÃŦ*ŧ-ãƒĩxoûĻ…”¤;ÎEI‰ On'ĨŒ'uŽEŅđ÷ųH1™QĖ6T‹ Å˙s,ķzCá°[8{ig/-#‰r ĸšŊG+9XÕ@TĶhFyîh/odYž— e”f¸†Ü_–ÛÎŅēŽž3ˆ…#õáųS>ļšHHj01ÄÍ ēCšˇ’Ģ@ôœŌt‰[ Ŗ0Ũ9bÎĘÁXš{Q"fä…CEŅcQbÁ.]WŲÕbGĩ:Pm&jgŗ˜Yˇ¸„u‹K„#ŧvđ$/í=FCģ?žŌėL+{Ī´’›bgĮ’–åy{ŠûČŲ)ũ͡C‹[ÄlÆŦMō ‚ÁŦÅ7ƒyA—UrÚ˛H4v†YU0Ww`In¯¸Íš‘´”há Z8- TĢ“͉ÉîB¨ķ.uX-œģf įŽYÂé†^Ú{Œ×TĶ4jۃÜ÷ji. Ûæ°Ž$ŊwŪÍiK܍B(¤ë*Šĸõ_m0Į1ÄÍ`BÆÍcs„pOōŪiԉŽ`„Í G¨7Ūa9ΤŽōŖ…ü„ÛP,ļ¸Đ؜=94ĮKaVoŋđ.ßŧŠ÷įšŨG„Ŗ´ø"<¸ĢŠįÕącQ̊ŌpŲúŠĒŒįÛ$į”†bē‘HdŪbˆ›Á čRĸĘ9ņd8-ģJ„ŖĶcr-Lsb3͉īoTč‘‘HˆHG3B5a˛ģ1;Ü:ˇÃÆĨįŦāŧĩKxaīqž}ëž`˜_„ŪĒâŲÃuœģx@Eo¯˜›ŽQcÄ7ƒ!Ņ=î?ŸÜœŠ§dŒŸG‹?2lãÉb8'ˆ‘Hö@-ŠÅˆúZ‰úZQLfLŽĖ÷¸ãōŦfŦ[ÂŽÕ yíĐ)žxímžmÛUÕįû’4āŊˆ×í3˜§âf0,9•™î„¨/vŦ‘@L‹?ū}Ái9îD ’YØúŖĮĸD:šˆt4Ą˜­˜LΏbėLĒĘæåœŊŦ”×Vôˆ\â÷%*Č˙Ģ+q}L‘|xvŌNÆ Š˜?vƒųˆĒŖü7Ȟ@¨ö@”Fßėô˜›ëÆ4=&Üۈŋî$Ąæj´äÁ¤(l^QÎŋŋûrŽŲē§­Įd÷׸D<<”MŦįɈ1r3–ēöāÔgô˜ ‚ŽĀBĘeũeãx];™ ˛f¨WC#„tĪQ¤$ô úPLfĖN/&gʘĮÍ&įŽ]ÂĻŗđüŪc<õúAB‘ž÷˜ø‹ģŊĐ.~|–xVƒy€1r3˜Ģ8Ĩ”_ ķ..kÜŗîÍʖY:•8„­z,Í՞ Ô\3ŽŅœÕlâÂuKųÛŽdûęŘJéH"&)ų%9 ŧ›ųøEĪCŒ‘›Áˆl>tSr=T IĻŊ/p—ž•ĮÁš6Ö´ŗ˙L똊L1R v vĸ˜,˜]^ĖΔ1eEqŲ­\ˇ} ÛW-äá÷°įøéÄ<žHRüz[ąë.]ō>`×Â00Fns‘,¤ü$ očŲ;+ ͏zM!^‡•§ÖŽÎtŗ=!Üրŋö‘ö¤6ļâ­).nŋ| {ûŔåf&~$$œ#{‰×~›ú3‚!nŖÂĸIÔ(Ią˜4žXģŪÖ¸dEŠˆ›&ßŗĩ ]Â_?ElvÚ' ŠëD:[ņמ$Ôt-26O×ĸė4>tÃÜvŲfŌ=ŊķÆB ‚āƒJ$tœ¸ŠŌ`Žaˆ›Á\c™”ŧ!zLî%.åxēū%ČtŲ¸ëŧEXM*ŋ{é$ČĖŽāæP6˜)#ōl¨"ĐPI,ĐÎh&„€5 ‹øôģ¯āēík°šûĖÄ$™BŠ_y“ßsƒ™Â˜s35ĪWųfē Ã˛­ÄR~!t@…¸ę’‰ĪŦ¸OĸËjæíg—PßdOU3KķŧĶ–Tš?r˜Â¤}Ņ#!B-uˆöf,îÔQĪ˙…íĢŗĸŧ€ŋ=ŋ‹ŊĮĪtÔeĒW(&qDę|ø%s+Üp^bŒÜ æ;âJ 'áāō|/… ÅIû‘˛=v6-Ț1a ßŊq ĩh×ŧÜI"íH-6ĒíŌÜNî¸|+ŧî|rĶS?R¸„?ßVėzątŽÁėÆ7ƒš‚@ŠoIč t‚ —÷ŽÚē‹ƒÎ:fe§’ŠkD:[đם$ÜZ‹]zĩY|â–K¸rË*,}M•HÁ9R×öÆxF&-Æg0jļ–Ž?_âTŗ­ØuBŽ ŖļõĨéd¸zŗWĖÎ|ēŗ˛Sɇ”DũęOjČŠŠÂ…ë–ōoīŧŒ%Åš=ë( Ŧūgk‰ëE t {n0Eâf0>=ļ)ŗĒpŪ’ãg!ưmR‘’X ƒ@]ŨE.Ũã䎡íā֋7âļÛú~(9[ŠØ~āöŠé°ÁTaˆ›Á˜ØZâšŅ4ŗ­Øup˛×Cōė˛ ÜŨĩž ũ˜—ôˆ\ĶôhhÄö떔đ™w_Áæå=ÅP…@áČ_šÃíÃ`ö`ˆ›A˛#|.qÔfRļĖÂܑ3C,ä'P_I¨š=:|ŌlģÕĖMįoāC×_@FJ_3ŧŽs!B9ŧm ģk0IâfÔtÚV&ŽÚÎ)ËĀcO¨ĐlLką @ũ)­ĩ#f=)ËËäˇ\:`'Á ōoĀoĮwŲ`âfĖtÚ0FmŖ&ęīĀ_WA¸ĩŠĀoŗ˜¸éü ŧ˙ęx]qSē_•„|§ÃâzX2}6;†¸Œ™m%ŗŖNī¨ÁGmŗ|Ä6Ëģ7ˇ‘’¨ŋŊ'NŠŲtIq.Ÿz×el\^š8}+$rą†Ü|dę;l0V q3HV‚ΉáæÚfš#ÉЏSƒiCę]qrÄC—zŗYĖÜ|Á9ŧ˙m;p;â•"žÅ"ßūx§ĄĮŖÄ7ƒqąŊxfcŪļģ¯VĘáæÚf9ÆČmö ĩĄ–Z‚§‡u:YZœË'ßq)ËJû:Mę‚k5ĸo+ϏĢŖÄ7ƒdD!ŋ€Lîš6CÜfZ8@ Ą’p[ÐĻJˇÃÆûŽÜÁuÛ×`RãÕÃE<NąĻÉ7€wLc— †ĀHœl0!fhw­„•‰ęlŖ6čNálHÜŦCJĸžVbÁNŦ)˜)šÛW/fQaŋ~ėej›ÛBQŌ*ŋGrđ`tųĀ &cäf0!¤˜ņ™DIŗĒ°maī¨-y*Č$MGį%qSeÁĻ3C†䤧đņ›/bûĒE eīO*¸3-ā|ȟļôÁ7ƒdcBŽKô\_šËÖ;jĶ“ČSc–ûŧZČO ūTWš˜T•ëvŦåöˡ`3÷^‡RŠuĒIŨ lŸĻŽ$`ˆ›Á„€.Ä´-ųq„ė1õ¨B°eafß>%Ņ€(‰ē:¯‘ēž0ŠŧŧÎĒ…|ėí“—á@(RĨÎ3Ā]Ķ×[0ÄÍ šX,W"EOņĩ•…ixí3X‹Í`^Å 6•ęæŖ7]ČÆåeq+Ĩ üø U+ ĻCÜ &Ė‹HENųĸčō2aŽMÛõŽÚ’v”´ŸŸÄGqĩ„Zjõ¨4›LÜ|ÁŲŧ뒍˜TĨĪ<œŖÉĩȰ‘Á¤cˆ›A˛…āV!{ß|įxČōØ{$íüUŌv|~ t¨¯2.nũâ>píųxŊ×(‚hōM`ųôôrūb„L á oJ÷ī°¸>@ŋëuÛâėžŋKd ē Š"—t蹁†*lŠYƒ† ”äĻķņ›/æŧ@e]3B t]ä+Š|ÄĀÎéīõüĀš$)ų ×kAǃâôŪ;‘Ä1cŒ\\ɌŒ;›„[ëė %ÅiįCןß3§(Ũ5âx¸xÚû;O0Fn“‚Ũâä…Sū)Ų÷Öb×{„ -qŨޤ¨˛=’S— ˆúÛŅĩöô<âi'{1Š*7_p6^7ŧ¸E(B—ēEčâ7ÎL¯į.ÆČÍ`ļŖ øRöÔ&ÉtYYœ3Đ470l“ÉŒÖUUÆOLráēĨÜxū@ĸ(АUHųgāúiíč<ĀšLÛJÜSąÛĢA.J ^Ûē(ĨĪHg.MX%ŗÕēæáOcĪČG1Û|žyE9Vŗ‰{Ÿ|EB×ĨIJîp p˙ô÷xnbŒÜ & )'u‘ȏ AOî#ŨĖę"ī Gž;Ė%Šž¯H-F°ņ4ZhpSũēÅÅÜ~ÅĄ „ˆWųÖų=°iz{:w1ÄÍ`6ŗTĀV™āūŋŠ< U™û—­čųŸA˛"u`s5ÚžÄ+Jķy˙ÕÛ1™!@ ęB> LoOį&s˙)a0Ŋ¨’¨æ›”Á]‰ ’-ĒÂē’ô„ƒ‰¤átŖoē(f’)•˜Á HI°ĨfH[X˜Íģ/،!„„4=Ļ<„‘ÉdÂsnŗģ„Û$¯.JÃaQ{$ãsßc7ķØū^;ŲÄåĢ †O&A—†Ā%=]gOËCĩ,uVY>—o<‹G^ŪÛUNŦą7š>ŠĀWf ˇscäf0é˜LîÉXŪ¤ aį”gô9ŽLēq[œÖᰘøŸ'ņÜŅ49ôyˆŪÔMÉL÷nˆ9¸ ×/cå‚^k¤€/K§§ssCÜ &ŠK¤Đ'´€ŪĮ$Y–å&;!Õ$¯Ķ…ĸŽY[ÄEËryō@ ?xú0'F2Uv• 34.‰‘’`s Z$8ā#!āÆs×cˇšQ”îų7~îŸMKō`ˆ›ÁldˆsM’ËæšMöũæYÜļĨŒÎP”_žp‚_>œęļí%É+č]HPS5ú qpn‡ˇm]ƒŽKˆëŨFāōéîâ\Á7ƒ)!öcr8Æĩ)Ū/Ü˙Ŋv Ks==û–I/kŊ,Čōp÷y‹ÉtÛ8ŅØÉŸ9Â}¯VĐė<o„!vɈÔ5BMՃV8gYEŲiˆ¸=Z"ėQŗfI" q3˜m¸Ü*Fmį”gvßė@2úHOšĶĘûĪ]Ċ|/Ø_ŨÆ÷ž<ğߨ¤žc  ĢiÄÄ%+z,B°š†ūŋžpņŲˑņyX!k0ōOŽ Ã[Ō`ĘĐĄņlv ‚—2ŗĒ°ž¤OZÉ9ų@ˇ™Un>§”ũÕm<¸ĢŠ`DcwU ģĢZ(Nw˛mqKr<ƒnÛ-ûņ z’ß^›ŦĐ5I“/L]GV„V˜PT#ĸIĖĒ@URl&ŧN+yŪÅĒ Gjß<ŠËKōÉĪđRĶ܎”RJÄ'…ĸ=1Cg•´âf0et416Rt%îHŌ5r[YčÅnI¸LE—{ü¤ötö°"ßKAǃ?Ŋ~ŠĘæ¸g]eŗŸĘ—NP˜æāė˛ –į§bQ]ŋįâ ĀlCwž:ŨęįDC'':Šn ĶFīxaVąĸ4—Mg-dQa\䄀ķÖ-áwŋqCÅų@!pz NcÎbˆ›Álb=°6ņŠ|vi?G’9,lŨxîÜžįŽ6đėáēž‡å閧[ĒxdO5Ģ ĶØP–>ƒ´›îœė–9Cí& œjôąīL+ûĢÛDb#n3QMg×ņjv¯Ļ,7“kļ¯Ą(;UåüÅj&‰ĄK‰Œ™nž:i'10Ä-š9 ØŦV ëļ]ų€N 8œN{Úéę`›}hīŋū¤\ˇKˆŌ•Ą8ŨI~ĒŖˇäü°ģ !Øą8›ŗ RytĪi×õ† „ĸ¯œl䕓¤:XY˜ĘŠüT<öžI-dÂ˙{wŒQuœ„c:oT4ņō‰FÚƒgũŸ'kųîũOqé9Ëšhũ2Ö,,âĨũ'B˙RQ q†¸%.ā#ĀûĨ. ‘Hšņß2Ņ“PH„uBęzŧĀTé™ŲXŦ6œîøģf,å¯ŋų øÉ˙ ĮÃt— §UáLKŊ+_—:ž˛Ēúļ¯^Ô-n€(G§é´“!‡ÉŽ0Û¸iōÕ§ ‰ĸ čD—ĶįôGW琍ē ĸš1Į"$ē&ŠÚ57"ąDaĢŽôxâø¸D"„@"ģū°ˇŨŗ ĻiO)ˆ ęđŊ)$ē¨Â:ŧ,„xT ē~´ë° RJLbB€Th)xŽŌĮöĪōąĩÄ ((ŠŽc>œV'ē]#…šVų×î8,&ūíōåķ"IōhŅtŽ5ōü‘:BąĄįu„”¤;Y˜“ÂÂl79)ö_ {0č"‰ņâąF^:Ņ@$áûNņϞí’Ģšúw°`éY˜LŖOyęØažôŅ;9v` ŗ=ܰĄ˜Ēf?{δs¸Ļ˜/]X–›Imk‘ˆ†Ļë€üđÉ<Įąō\Åā92g#†¸Ā,7‡Ãė<"„Čí/l6‹ §ŨŠĶfCđÃøCa‚áč`Ũ )‘R ū(@ŠŊ7“E ŽP¤;j–•p`Øļ0‹KÎĘOėœ‘cą‹@Dãåã ŧpŦč(œ†ÅjãK?ü?ú¯ĪrßĪū‡Š&˙ØWÍUĢ 0Åü\ĩy›W”ķĀÎ]띍îŨPg*`ôe%æ1†¸M/yĀĨĀyĀŗĖēЅĸëR U€AW güyŪõPī~Ė\ļiŽ[6âÁLŠBNz 9é)}Öˇtø9UÛÄŅ3õŠĒ§ĩsĐaU÷ëũb˙­Kņ žE|ŽnL„MÃ*ĶÛEB‰Ō,7Ž~C؀ø¨âÁ]•=BpŪ•×Q\ē€įŸ|”‡÷¸„ ģĢâ˙vXTōSäxldzėd§ØČtÛ Å,1˜^t%¯îVĪ‚ßhŧŌĶt?PË[•ÍŦ*đråęB^$ ë:ßzüÁßūíƒ,YšŽŊoŧLőƒ4ÔUŖÅb¤gfSX瀕go&+wb…ŗ#ážų2î~ƒ’ īŨąwūēŋĢŋŊ°›žu¸ģ‡§‘˛hBœĪaō|a˜%§†­ĒÎ_Ņe*B ûÛ,f ˛R)ĘJŖ0;œ4)NÛ0E,!Ļi4ĩų¨oíāŖ•”įe‘îqŽšã§­Ģ˛uÕBęZ:xíāI^;T/8 ‘¯‚r ØZėú ȏ ˇīįNœ*ØVėēF×Hv]IÚ@a›ÛĶ<Ŗâ`M;Ow [NAßųŨßÉ/.v›ŧĸRjNSyüȤ ÄÍxAŽā˜œ–&ĢYĨ,ËMaǃ˛LÅ.L“ô2$€7OĩĐŒ°čŦ5üõ7?å•gŸ ú<—ŽZĮ5īz]s͘<'ģąXm|öģ?įöË7qĒÉĮîĘ&6§åÆ ›JÁĸüėq… s™ÆXÕdÅšĀ8FnK%ōM)„M ōHŠ <7“Ĩy,-É#+Õ3ëŊcšÆ‡Ģx~ĪĒ›Ú†l'Ī+Šū=&ö 6rčXl-qV€(ėÎ9ū//#Ŋ˙|Û<§#åŸ>L ÃãMåG}†ÂŌÃnSqô˙q×;8]q|šz958­&˛<6˛=v R¤:HwÛĻė]Gßyü-ūą‡}–,\Âgžųc–Ŧ\7Žc?đ›ŸōĪ¯ĶÂ'Ūvތ¸ˇp áß˙ī¯ČŪš÷›?Žë dgEįLv\#ˇ1"¨*ÄĸCxĒŠĘũB!=yū,.Ęeũ’b–įyT6͘T•ËKŲ¸ŧ”#§ëxōõƒ?Ķ0HKšEjb7đ}ā3@Ÿô$ÛKŧl“’âî”eš Û<5–ĀßvUˆÄ0›-|é‡ŋQØŧõŸŧãz:ÛÛÆwĀi|Ų˛š=抁kn}O=ü'öŊņ o9͎ô\ ģ…L¯›†VņŲv0Câ–Lâ6šŦ’‰‡Ĩ%y\ģ} YŪŠ™žnæ°¸0‡Šš&{m?GĒzŖ(ć`tXœ7īúd3ŽÂĮōåņŋ§ų\ˇąnG’ Ĩé8… `ߙVŽvĨŪúĀ|•5›†s:yäĀø… F-l‹áä•āëh'āķ kēsš=¨Ē™ßũč[Ų÷Ēĸpķ9Ĩ,ĖŧÚÁ t‰oOĐĘ$] ŨīPkÚ'´M‹ņĢī}ĻúZ>ņÕīIā„ŧ˙ßū“Ūx1oV4˛u]Õæ)(ÉÉ ĄĩŗģĢĢ–Ynî™â6N„"P¤čŸ|cAâ­V™ĘûŽÜ:nįŽŲLi^w_s.GO×ķЋ{8ĶĐë|÷šRōđ'ā@Sŋ]XÜ@×\›ËjbIŽwšzŸÄtÉĶãS+k6nãÚ[˙ß°í;ÛÛøÔ{oŋ°H$Ä˙}ķ?ųų#/’™“7ęí6žw˙úžëØũę hēÎ}¯VđÁ –’ę5CfëŸēīÛ㠓cvûûDōÉ˙úß>ĩGbåúMŦßroŧø,5õ;AHJr3xíPEwŗ2 ƒ÷”A†¸M)%Ē0ŖË@gĸG IUú›Ô%õm4ļvŌÔŅIkG€`8B éÉY§Ē ^—4‹ŦT7i'™^7VķėüŠfķąˇ_ěG*yč…Ũtö yŊáB!¸x Ũį¸P ŧŨ WĨcęĘ0ĪIöTĩŌė cļXųˇ¯˙pćä×˙íęĒĢĻŠwĐÖŌÄW>ū˙øÎīõÜjŗķåßËû¯9—ęʓ„c:í>Ím[ĘGĩũ”\ Ļīūš;'Â#ü –žÅõˇŨ5ĻíŪy÷ĮxãÅg9pĒ–ÂâJsûX5„a đādõu.2;Ÿ˜IˆĄęûĐzםĒmæņ× ÅtŽW7PŨØJ8/aŗ˜(ÎÉ '-…âėt2ŧ.2ŧnŌ܎¤é)B°aI g•åķčËûx~ß1¤Ūũ.,T Mę<+>|EĶ‘ŠĒŪ$ĨŒ‰.“äšĸAâÚæą°ŧv2ūb~å͡‘WT2lۗžyŒįxĘûdĩŲÉ)("P{ϊˇ^ÚɓūąOŦŨHxŧŠüĮˇÆnŧ]×9VßÁž3­œUĐ÷˜ļw›ŽKÕŽŠjÃˇe‹—ŗõĸ+°Xmxë56l=ŸĸōEŖŪ~ÍĻídfįqŧļ ŠkE%;-›ÅD(^^G ôMâ6,†¸M%ĀŨRWßßg­€ŧŧˆĪ/”åg˛ŧ8—EE9䤧 Ėv7É1bŗ˜šnĮZ6,-áŪ'_Ŗļš­÷CĸKž¸ŊÄužĻéī’Čk…ˆ›$sŊrRÖ%›ĪˇúŽÕm~Ė+īŧëŖÃļ•RōķoyJû“_\Ęû>ņųž‡6@Gk ŋ˙7üá'ßå‚+oSåkĪæmīē“~ķSž9Xˊ‚Ô!rĄLÁ‰ƸķãŸã]÷|ŧĪ jMURĘQnEá¡ŨČ_~ų´P“Í"™i¯nRˆ­Ī'Q㙠š†ŗķ€‡cÄNŸ@’ŌŋAYn&7žˇž/Ũy ¸ö<Î]ģ„ŧ īœļD ŗŌøÄ-så–U}bÖ(ēd‡ĸˆã"^wNŦlÔÆü6€Ŗõq'’í—\5bđëĪ?Ũ“e~*Xžöl~öĐķœåõ=ÂāIMãī˙>÷?ŋäĨgū1æũūŋũBĪ|]Ŗ/ĖņúžqĶĨ4Ņã]zũ;y÷˙u€å%¯¨´§ĖÍhŲ°í|"ŅuMŊsŲų™Ŋ÷‰”r Æķ{XŒ‘ÛøXüˇ.¸TJĄ PÅŗ‰õ‹‹ŲžjŅ€ŧŽķUQ¸pŨRægņ›Į^ĸš#žŲ žžKØēSy)BpVĄ‘jĢ?'ę㎠į]~íˆm˙ņįßOY?\žžō“?āō }—.ZJ42 ČDœ.7ˇŧ˙_øŪ? ĀëM}<'•iNW9‘÷M!ˇäĶC~nĩ ^1}(–ŽZĸÎ4ļPP–ÉĪōöáØ^ėZ Oį†ō đ#Mc/R\Ũë8&UeķŠrūãŨWpĶųæ­°%Rœ“Îŋžã2Ö,LȡĐ(‹˛Ũ¸ŦcĪę0׊ī as88{Į…ÃļĶb1^yöņ)ëĮ5īē“´ŒŦÛ-Ząš`pôU×ģšüÆ[{ō6kčėĒ[GNsČDRw””“[X‹”.‘āë/Ŧ_\•[V‘2AĢoéāHU-ūųYŠ,,Č&ɒ–Œ‹íĢQ™Ę/y_0„‚E9ƒđÎgOĀ÷ˆŖdá’ێĻÄÍDHËĖuÛĐ8Fn_{3ųõ8ͤ,Ģ+áÁTĩ ~UQHą›i ŒŨąd*b Ķ2˛¨¯Ú‹ #Ŧ„"ČIķt'4BČm-ÎäId<Ũâ62Ĩ(ĘŗBâN´Ę§§8yĮ…)ĪĪqR—Ģn`÷ą*ŽTՑŸ™Ę–ŗ°uÕĸ9íX2ey™\ģ}-ŋ}ü%J2œ8,ƒ\‚ķë+@w¸HAÉđiļjĢ*Fl3Ú[šGL÷ÕMS]-åKVŒų‹–¯Âérã÷uŌęīuŧ˜6mK  Õ1.qĢ<~ŋ¯sØŌ8ąX”X4:âhŧ›”´tęčŅ0Ē5žMAfjoĩ)–¯\?q7Ī9ˆ!nÃŖJû‹”•xŸ--Éã֋7Ž˜#˛ļš—÷Ÿā­cU„#16¯(įC7\€×5ē‹{ŽR×ŌĀ’cNr0ē_xu䒞Ί-ĘüÖË;YąîœQĩ=ŧī-Î9wôfĖnT“‰ŗ6læ•g§Šŗ×1eZ…­ĢūܲŧöWˇyķX,Ę?ūü;nxĪŨCļyëĨdįRŧ`ņ¨öŠuÍŅéą^í*ČJNtõ“7čX ŧ1æĪ’JÜū4ÍĮÛ^âēSÂęDa[Y^Ā{.ß2äˆKę’='Īđžc¯n¤ĒlZ^ƅ–Ét9—9RŸ›Y’kˆÛ`ØģFŗąčČådbŅŠ}i˙˯Âõīš{ÄbwŋÁŅũģĮ}œŗÖmä•gwŌâ Ķ5éŊ8׋I=ĻË1— úÅwžÂ– .Ôą$‹ōķo™ģ>õĨQ‹[Đ߉=Ú+ø™Ū>m]Ų€!nƒb8” "áķ‰ÂV”•Æģ.Ū8¨°iēÎk‡+ø¯ß˙ƒ_=ú"ĩMlXR§ßu9ןģÎļ.‚á(g[Éō،Ō6C➚P„Āß9r_›}ė5ûÆBkS_úČÃēú7Õ×ōÅŋģcäBžCQPRLŋ‡d"‚x•‚ ĨãĒįëhį#ˇ\΁]¯÷YßŲŪÆ>ôíy“–ÆúQЧÕÔGÜō2ŧ¨ŠŌãT"‘%Ķ÷_2‘T#ˇíĨS{#÷ãB)ÉM\q͎5Xúåx”ö¯âá÷ôÄr-+ÍåúíëIO™Öū&•uMčRR–97Ē$L&U!ÃmãĐŽWGl;/Ŋ‰ōŌ3ņ/áCŸũg­ßØŗ^‹ÅxöŅøÁW>CsC;.ŊfÜĮė<ēËÚLŨî –år ē•pT'[:Žēę*îšūÎZˇ‘˛%Ëéloã՝Oâëˆŋ¨„‚ÁQīĢōøV§›‘ēŽÔbՄIUÉJõtg˙ąUOŦ7č%ŠÄmšŨå/@ö–cYT˜MYn_į‘džxî-*jâ9Ŋ.×m_ËĘ+;?—9U× @I†!üÃQ”æāĀŪ]čē>lŽŅĸ˛…ĶԟÃ{ßä7^Ô3g ‡8yäm­Ŋ})_烜cgÆ×Jb3)\ą˛€?ŧZŨŦcžI)%{ßx™Ŋoŧ<āŗ”Ô´AļH4ĄĻϚËĘËA‚ŽEQÕøãē0351ĩ])ā’§Šč4‘Tâ6ÍW{>ôÆ˛-)îÄEc1õOī:ŒÔ%Šl\^ÆÕ[×`ĖûĪ ‡Ķ]ž^Eiã7aÍ–į{yãT3‡vŋÁōĩgŨn˜ĪĻ‚úšĶÔלôŗkGįx2zWđļĮ6Ķ÷ËķŊlZÅ던TAL›œ7koZƨÚ;°]×ÉNąƒ‹€%ūPååĩÃŊŅđ*ā…Iéābϝ¤1!ĻwäætŲ%pÁp|ĸûø™ūđôĢ4ˇĮMų™ŠÜrÁ†./&ƒ‘¨miĮe3ãąĖJ2Ī‹n÷Ą,ˍĶjæ_~åk7dģôŦJ-ĨâčĖfaĘĖÉĩŖÄ`ø}q¯Ī4×l0ąÅ¯ÂKĪĘŖļ-@ ŖĄ#4)î›Ŗ5#?qßĪÉIącéƚĸ'‚ÍË蛸@čr†¸ ŠJäô.ģdÂŦōķ{Žņ×įŪâ{ļGØ6,)á_nŧ`ú„MęčąZČOĖßN´ŗ…HG3‘öÆøŌŅD´ŗ…˜ŋX°-äG‹ãŽÄRy˙SL$Ŗ­3@ļgpįCØzQ…`ëÂ,ž~ôaęÎ _Ŗí‚ĢnœĻ^ ߇ņf÷zÎą(}ö˜ĢU!x׿r,&…ŧԉ‡īddįŽ˜ĸ âf͝=ÄĒBo|…č+n™Š ķÕ)+¤ˆĮNõ’L$ÕČ͝Öo÷Oŗü`’ÄkŸÛ}ģÕĖ-žÃĘōŠž[“hĄą-ėã55„jBQM(f+ŠÉ˙ĶbC(#ĮSM mčR’“2ŪÎg?›dđVe3?üėųĪ_>4dģ+nē•ßüī7Ɯy~˛PT•ĢnyĪ„öQy,>ō,L‹‹Čt;“ …ͤpۖüúÅã¤9¨i  ķ-líĻŖj÷ԟC{§U] “Ĩėë–â´÷Öv!åúņõhn“TâĻÆ&'ø9ā  H):ĐtĨO ŠÆb¤ˆIâŲëģqEYiŧû˛Íd¤LᜑԉúڈøZ‘Ú蓭ޏ[-†ĻÅĐ"}‚ŠÉŒbąŖZí˜Ŧ„ijrĩvÆĶ3Ĩ;†ĖķŒ[ƒĸ* ×Ŧ-âĪí乇îeûÕī´]zVWÜt+üögĶÜÃ8\uèŗ˜ ś;Ÿ$ßë Åŋöfƒ°Åv‹Ęûv,äooÆŠŽjcv2ذũüÛDŖ~üĩĪrV—5ūx€ŒõyĖJMĄĒ>îœ%…X&ô™ˇĖĖ6’Ę,9\‰Ī p&fũßąz1šéÂ)6=Á_WA¸ŊqR…møcF‰:ˇÖã¯Ģ Pw’p[=ZČĪd ;üq7čîX"ŗâY6 )Nwrõęžúɲ÷åg‡l÷Ūū)ŠéĶØŗ86ģƒ÷}âsÚGsC'OcEWéŖø{äl0R‹¸{‰ˆŋh\ˇž˜- ŗPA–{lևÔôĖQ•/úí7>ƒösŲĘ^̐¤Ž‘ød'˜&ãŠû†-â6īšü›ŒįlŠP¸áÜu\ģ}MŸâ›Sb2Ŗšg6¸YE‰úÚ6Á_s‚p[=zdôņ9CŅîë7‡Qâf,Ŧ+Iឺōøä×ķ÷_˙`Đ6žÔ4>ō…˙žæžÁ=Ÿų 9ųE#7†'øÁĒŽ ņQÛėyŨéžyĀĻōLî91i.+6ŗŠŨ<:ã× ˇßͧĐë`ėyų9v>|?wn_„ÃŌ;UĐ=&K|ŲÍLí›p\QÄ ELõ’L$•Yrøˆâ;]/l8Ŧî¸b+ FŽi59lÝÄhá`×[ÛĖ u¨¯¨¯ ÅlÅėōbvxH(Ž0jē=NģÍ-}4K&Yf)kŠŌČķ:øË˙‹‡īûūĘXžölBžÎvüä–°åĸ+xņÉGĻĨO]ķvŽyםÚG(āŪ‹ĩÅixėæYgžö…ĸœn pĻÅG}{ˆ–@”Ö@˜hl P PâŠģ Į֞ž•3ä÷$ĨäôÉcė}íūyī÷ņXzũíÁv‹™Ü…i. ĶėfD0ĢņÃđ€.Y<9šgŸÜâÖË×%Ⓣ+û˙Ãlž˜ãQsC÷ũôģl[”EšĶ2ŖŖ6]ÂÁš6^ąŸ‰ˇC÷ŸēëÉ*‘‘ęF ēÔqKĶÚįOĩŨ1Ä nų•Äé)N>tũô—Ļ‘ēÅ"]ĸŽ‹–ŽÍŠ8ĩūH]#ÜŪHÔߎ55ģ§æÔĐÄŗšô€IĻ=@Â(&VOVO:Vof×ß3°¸R#”ĒĒ“Í…ÉfG1YQ-V„É‚ ¯ŋōO>ō /í|ŠÜ‚"–._ÉÍgo§¨¤”‚ü|ŌĶĶ‘ą0Z8ˆ åØMÖ>ŸŸēúZęë8UYÉĄC‡8~ü8ĄFĒjâΏ–wÜõŅ Å´ALm]]Ī6Šĸ˛rũFRŌŌimn$-cbsĐ?ūʧ8|`īÛąSWŽéŊKāŲCĩüķp=RJ–/_Îæm;p:ģŧĄĩDũ bAd,ŒĐb 'Ū§ ˜LHÅ&˜íņ4YV (]´Œ>?Ī<û,åYn.XšTĪ0ĩߋLVš;A܄ukQJ pr_Ŝd>‹ÛÅHų§Ä„Įiįƒ×ŸOēgjL‘z4ĪÄÅlŽÅĻDũháļô<”A<>UĄ Ĩp_Άy–nT‹GF>ŽŒüA3ĢŦŒĀėōbķfav¸ę,ĩXŒęĶ•œŗõ\v\tŲ!PģæîlŠšH-J¸ŗ•Hg ąāØōč*ŠBiI Ĩ%%\vÉ%´wt°gĪŪzkoíŪÅŽW_`×Ģ/ ( KW¯gë…W°ų‚Ë(]´tLĮzüū_ņ§_˙”›Î.&Ī›đ9ÂŅtūúF%ûĢÛp;\tŲåeĻB Ņrō!ôžąeÃ]§>SLȔČ(gÅęĩŧōĘˀčÍĀ2Ž‹ž˙ķ"+5…ƒĩŊ}Pôŗ0Ä­‡ų*n‹Đų+•ŽËĖj6ņū̎O°IĸūvĸūvôČĖd˜NôX„@Cö´\T{ßx@ŗ9nŽ‹ÄtŦ‰ķn38ŲbqĨâĖ*˚ƒ3ŗ[ZΝ[li9ØŧY(Ļ‘CT“‰ĸŌō ¯Ąšąyŗ°yŗˆ…„Û ˇ71^KUŠĮÃömÛØžmē.Ѝ8ÉîŊûØģwûwŋɁˇ^ã'ßøw˜âæD—ę{ˇ9RUî¸r+ų™“{ŗÅ‚„Û‘ÚČ•įR'ØRƒ-5“ŖˇÚļۏķņ‡ŖXM #ģi6Ģ'WN)ÎėbŲŘFš'%°ēĶqdŽJÔĻ“Ձ)ģ[jĻĶD}­#o4 Š"(//§ŧŧœë¯Ŋ†öŽvīŪÍŽ]ģŲĩg7ũá—<ô‡_bĩŲYˇy›/¸Œį]LVn<9 đŋ˙q?đWŽ^]Ā†ŌžķYĶ ōāŽĶT6û)Čps͆˜e`ęöAũ!Ŧf]J:B=)ÆÆŠ”ũÅ-î1Ųķĩ –O §sޤˇfuôUlûã4ģAčHŠüX$&†ŽÛą–Å…“[ô1ÔRK,Đ1ŠûL*¤$ÔR‡M‚É8OW5ōÎPŒ´ARpMf§WvޜœŲŘ“_$UQ-¸ōĘzC7fĒŊ;oĄļF§Ėی—‡Ûˇŗcûv¤”TTT°kĪ^<ĀŽ—ūÉKĪ<@ņ‚ŤefSqp/2āÖMĨ,ĘI°?ĄČiÉĖ{: ˛ģǎÍÂUëĘ1ĢS””A( ēķdtWąöG&0¯Ū/Ū5Ŋ_Ļ$\6ūĪ=’JÜ& 䭉ˇĐÆåĨl9kbyņÃdw!ģbҤÔNô PT„PROZg’‘ĩÕcWM¨6')ޏ¸ĩ"˜ũ} „Ø3 đä/Ā•ˇ[jöäėxLvŽÜŗb´66o&ĒÅJgõņI¸n„”••QVVÆõ×^ƒĻiœŦ¨āĐĄCœ[—æc3OnÂp‰@(ĸËĄĒīÉDĸŸ_ī‹xvLĒJŦˋR"Jҧ' z20ŸÄmŗ”â[‰×\In:7žˇaJÖ'ģ˛ËC2w.™æ@ėiGJB-5ØŗŠ{Ė(õA Áíöíz€ĸ ÷ō$ ¤čJŠŦ Ą †Ļë´ú‚ Ķ=süŽĀtĢGÜTStđú2gH*qs׌}Yæ@—ꗐ˛€„DŅ7_x6iîŠĪ>ĸGCD:š‰}#7žÃ葚¯œ´ĒÛÆū]E?¸ ãÎ[€Ų5pŪfēĒWnYŌ [7ļôܡĄĒŠÃ›…+ˇlĀgR‹ t ĐŖĄ„mL¨ĒՉŲî•7J[küœíÖxļŸĄ,&Ņŗ;!@ĸô¤›•ƒ$!‰Ę†öŽ:†ö ™B aLëįŨ­é¡.’JÜÆÉ)åŋˆaÛ¸ŧtĘ ĘX„p{ãŧĩDÂ͔æĻņ\C M!2zʆ  Đ-h)EËđ.F&sãH8ŗŠãéВÕbG(&¤>6 B(ĸ­Ŋŋ·ÃéÂnˇ’âI™‘ˇôeu#T3w÷ÄĢŨwgåDc ¨€‚ŊãĄŪĶč=Ÿū)°ÆÃá3MœU0ASč bœæéįT"Ää;$)s]ÜLēŽü\Äkāu9¸fÛÚŠ;ĸԉtŌÎéš´ņ uJŌė<oėė7ŲëL „‚3§„”ĸe¸ OÛüŲhQmŽxÂč$GŽ"“ÉąãĮŲŗgĮOžā䉓446hc6[(.*bņâEŦ]ŗšUĢVaRĮōX‰ĮZ<¯‘Č/ˆ—æŠkëÎÁ(ú8hNE yg0ĖņÚV°uËV —ŦОž7[Ē=&ÜŅ/3ÕZGGåABm w6HæŸūšoĨ.NÁi$%I%ną˛ą=č„T?dEb ››/؀Í25žmz4D¨šļOIxƒžēU„¯ë`cY&B™Ũ‚–ˆ=-ųkBƂCzL644ō˺ΰķųįŠ­­íķ™Õj%%ŃĻétttPXXˆ‚`0ĀĶĪ<Ã#>Jjj*W\vW]y%Öū‰†VO:f›+^ųĀdF1ÛĻÍŧģbõ:lv;͝AęÛ|d{§Žčp7¯9ƒĻëœ{Ņåœ÷ĄoŽzģp{í§öĶxāEZŽŋ…Ôb(ƒä,ío–Šn„t‘Tâ6FФ争ÆĢ˛¤xjNŅÎÂMŖĘí7Ÿą›å9^Ž7´ã(^AÁęsą¸3@Î~'Ą˜0;=#7œÅH]ĮßP5`}ss3÷˙ųĪ<ũô3Ä´nˇ›įœÃŌ%K(..ĸ  €Œôxāõ¯~ũūöЃäįķąų—ø~Ĩ¤ąą‰3Õg8zėßųŪ˙pŲ%—˛jeŧ‹Ų™Š3ģhFÍšf‹•˯y;ũïؚŋЎ,Ra­iîä@Ufŗ™÷ôĶcÚ֚’AÖĒsÉZu.‘ÎVÎŧôMG^Đ.ÃŨO Ĩ(‹$ąÉ|2I*qSÈK×>/ĸÛÖ`5›¸fûšÉī”Ô ĩÖĪī€í1˛˛(ãĩ­Ô{W˛~íEøëNîhōšmXœ)ˆqi-h‘0ūēháی1-Æī˙{đ! ōķ¸éĻذ~ÅEÅCz^rÉ%<øđCŧôŌËÜvë­¤§§#„ ++“ŦŦLÖŽ‰ßghš†Í“Ž;ŋœŲEôÖ÷}§ūņ ÕÍ­ŧr´šM‹§fîŨŠđ÷7Ž!Ĩä–Ûī"ŋ°x{‰€ZÜŠ”]ō^ ļŪĀ™ ­ō@O ‡Ũ‚Íb"Ôž x€y˙@JŪ;uxJ)nCöŠ÷…ë—MzĻŠE 4ž6„mŒ,Érĸ* ũïP­ļá7˜%¨ļé-4YH]#ØRCGåbĄŪš_õõ üô§?CUžû­oōo}‹›n¸‘Ō’’a]åss˛Yž|91-ÆcO<1d;ÛƒĒšqf—0„ =3‹ûâ7xõH5Įk[&ũĄHŒ‡^=Š?aũĻmÜqĪĮÆš§ŽœdŠ ŠšKī hĮ( ķšũJŦŅPš5b*–d"ŠÄM—Úč]˙2Jīü°ĶfeûęE“Û—ŽÁķ!ōdã0+œUĘąÃxëÕgäH(æäán´h˜@Cm'ölĒPûÍá°sĪŨwsķÛßN~~ū˜ö}ÉEđÄO=Įlvzf]ö–mį_ īŧ)%ž~ŒŖÕ“á E¸˙ÅÔˇų((*å ˙ũƒAįĘFÍ ĶK6˛đĒ{zæĻû‡4銞@WĻbI&’̎Ŗc•€Gm­_ŠÕˆ Ö-n)N;›–Lé3d,bŒØ&™YJ3\ܡ›į^xŽõKJguíģXȏ•IzŸ z4L°š†pG ã-F:QŦ6+W]y%ŋģ÷^xđA.šäÜŽž&˛hhlÁg‚•k6đËŋ<ÁŸ˙ ūôÛ˙ŖĄĨ™'wŸ ÍmĮë°â°™1)*p_8BC›Ÿ˜˙ŪM&—]q=ī~˙‡Įé9 †)xˇāė €o'Ŧ%S͉äBŒ&SÁla[ąw¸SEĢ•Đ9úļ­Ģ9oí’ WęÁ†*#8{ ¨jöķŗGņĻĨķĶ_Ũ‹9:{Ķ•)ĒoŲĘéĢĒ9Z$H¨š–°¯eVÄTC!ūß]wŅŲŲÉõ×^Ë­īz׀6ŪŌ•(æéŠß7QBÁ ?ü^üį“ė~ãBÁā íEaÁ’åœŊy;WßøNrōĻ6_ü ƒ;Ļ47ÖsíšŊY—¤ 3öMI@æÕ3͍–¤ˇáė÷ÛKŸR|]v•4Š*_¸ãj\ö‰ŪT’`ãi´đāšÁÄyā­JŪ<Õ…—]͇ŪįŦŊšōbqy§ũ¸ąp€`S5Ņ@ûŦĩDūō×ŋōÛß˙ŗÉÄwŋũíž—ļÔ™…3Ôģņ„9zø -M 476‹FđĻĻ“ž•Mé‚ExSͧˇCCˆ›Žë\´ļŧ×j âs“^b<™Ä-ŠĖ’à ¤Î= ÉŧYŗ°p„ ­õ†°M1—ŽČįPMOũã!Ö¯_ĪÆÕËgēKCl:ƒÅ•ÂtÅméҁĻ3„;›gI¤Ø@Žžę*ž~öYjjjøáĖ—˙ķ?ûŧˆ†Úą§į!†x8ĪVĖ+ËWNAâ‡q3x‚qEQHĪĘĸŽúLĪ:ģÍ]žžÍ>’ĘĄd{ąc¨å2„(%ᗟ ɘŋ¨ėŪScÃn1qÕę¸Yįģ˙ũ_œŠ­›á  hGíĨ1"Ĩw9ĩŸČ,6ˆ{NžīŊwpāāAv>÷\ßR#Ô:{ͤa˜{VNßҞĸÉE“Lö’L$•¸YT렋ޏŲëūŸ—áĨ47cBĮŌŖ!BmõîŗÁč8Ģ •õ%é„BAžúĩ¯Ņé›>¯ŋąlŠ!Ō1ų™-ēŅB~:*lŽ2ÁņlcÍę5œ}vŧĒũ/~ų+::ûfí 6ץGgˇįd2“•“×įßē" tE2ŲK2‘Tâ6)q)‚›ĮæåÛŖÔ ĩÔÍēššÎåĢ ČōØŠ9sš¯ũ÷7‡Í|1“ĀWw’pÛ$įԒ@ãÚOB‹$Ÿ)üÎ;Ū‹ÕjĨŖŗƒŸ˙â—ũ>Õņ՝20ĖW—•Ũ/!ŧ. Ņ“ž$I%nalš Ņ;w¨* kOĖ7ÜŪhŧeÎUá]›Ją[LØŋ—ī~˙čúl}Jü §đ×ULJxH,čŖŊōĄÖÚ¤€ŦĖLnšųíė|î9ūšsgŸĪcÁ‚-ĩƒmj0*†1KæöšI!("îØ;™K2‘Tâû,Hq’žBm ã î×Ŗa:kŽ'íh­?W_yuO™›˙ô§ÔÔôŸ ļÔõˇÍ@Īæ6ũĖ’!Ë’I_’ˆ¤ˇAp¸4qäļ˛|"ņ&rđ ¸ĶJq狎­)DO?ķ ?üɏfĩĀI-J Ą’ļ“{đ×W ´;š“ēNÔ߆¯ö$mûˆúZgĩÃČXPÁG>ô!Ņ$Y”>îšmR‹î˜ŧŌgËÂ,Î_šĀ?ŸÛɗŋōÕ!ôÎ:¤D…‰;ˆúZã‹ŋ­Ëô8w…­›ŗĪŪĀe—\ĀC?Ė?ūņ>ŸK=Fį™cD:§ÎëtĒĐĩ(ūē ŪxöQBēi…mč‘S[KSß70;K2LI%nũP€Ëú˜$ËÆo’ ˇ5 ZZÂ`f9i.-‹ŋ•îŲģ‡˙˙ Šši„­ ĻĄbvz1;Ŋ(ρ î¸ũv–-Y ĀĪ~ņ ^zųå~-t:kOh<7īÍr¤ŽlŠĨáđ›üé÷ŋ$ˇ|9ųÅĨĶׁ!´íđūŨ|čļú¯–vSŠÕnJa2—d"ŠŌoˇ Oi‡šÆžÄŸ|ĮĨäexĮŧ_-$ØP5ąÎL)/ŸhäŅ=g€×ëå3Ÿú‹.œénÍ[T›OŪBDB!ŌX°“@S5ą`o˛äŽÎ>ųoŸĸŽž“jâû7ž3čū\9e¨–ŲXVnk"Ø\Á{yöŲgšķž’ŗđŦéí† úŽGvŋū2ŸūĀ{đûûš %ōkčĻOOvž¯l›ė]NI5rĶ´>ËVdo:t›ÅDNúøŪ,"†9rÖŗŠ<“ˇŸSŠEUhkkãß?û9ōəîÖŧD(fÜũ„ Ādwã)\‚3ĢD|žŅãöđųĪ}žôôtbZŒo~ûÛ3˜\o?u€`sÍŦ))%u`K-m'÷ŌXyˆũä‡ŧúęk|ā_>NÎÂĶߥ~žø/ī|šŊëVü~_ŋŧģâ;¤ [˛‘TâÖĪsg ĩ>Jr3QƈĄG‚sÆskŽŗ"ßËûÎ]DŠŨB4áG?ū1_ûīoLz~Xƒa°ĨfĄ˜†.?eõf‘RŧĨk–›“Í—ŋøÅûî÷žĮ}üã [ę›Ģiī­˜!Ģ’ âo¨ĸõÄ‚Mgxũĩ—ųÔ§?Êå˸ãÎ÷‘R°ˆéĘ-ڗŪcūão÷ķī~/áP=ߕâ[ĀĮf sŗŽ¤2Kn-röü]¨âŒ@ô$Tģôœ\zÎØßĻ‚Mg qK2:‚Q~˙ĘIĒ[ãĸ–••ÉĮ>ōQ–,Y<Ã=›/ac9–Tj1:kO ÄSqÕÕ×ķĨ¯|…ęęjÎŨžƒģß˙~ŦļÁœ+Ēkj&VOæ°b:čą(‘ÎfÂ-háøķ Ļφßüūw444ōÉO|‚ŧ‚"<KPĖãŖ?]ĶøŲ˙|ß˙ü‡›HņMŠđ¯B7jé“īYœLfÉdˇ“ßɅ^9ŪĀãûkˆuy/^ŧˆāƒjŠL֔,œŲcOolŽ&ØĪVĸi÷ūáüõoCJ‰Ųláæˇŋkßv5Š2üL‰L&Ģ Õî@5[QĖVÕÜOØûb#uŠkH-Š‹ GBhá ąp°ĢŒUßšŊP(ÄÄūö%%%|āîģÉĪĪGĩØqį/š9aNž8Ęg>t5§:ž øĸŽü‚ †¸õ’TâļŖWÜž,%ŸĖ9i>õŽËĮ´/ŠkøkOˊėãtK€?žVA[ žhŲbąōÎ[næŠ+.Į¤ÎŪ īdĞQ€=-w䆃nkĀßPEwœßŽŨģøÁÜÚQZRÂmīž•ÕĢVO°—ĸkcJCC#üãQž|ę)„ŧûÖ[šøÂ B`vĻâĘ)í ğžyüī|ũsŸ ØgnYę 4)ä{)~Ģ#1Ä­/I%nÛK{ÄíoĀUt9ÄŦYXÄm—mĶžĸ-„Û'9ĢģÁŒŠé<´ĢŠŊ§[{Öåååņž÷ŪÁšÕŗŠādrãČ,Ė:6ķ"Ņ@žÚ“=ÕփĄŋ˙ũŊ<úØ?Đģŧ$W­\Éu×^ÃĒ•Ģ&ĨĪCqđĐ!~äīŧúęk˜Lf.ŋôRŽŋîZÜn7=-{úø3MŋßĮžųeúķŊũ?Ōđ6)äNE qHR‰Ûå ã&_Ėu(ë^?g’@ũ)#ķ˙äõŠfūą÷ ­÷­}ËæÍÜņž÷žž>ƒ=›Ldä֍‹Æspú{_DĒNWņģ{īåĩ×^īYWR\Ė…^ĀÖÍ[đzŊ:&€ŽKNĒāĨW^á…_¤ŽŽģÍÆÅ_ĖÕW^Ųs}¨VÎėL6į{œ:vŊū2_ũ÷Q_[Ũ÷‰ŽÂIŠŠ—E;)…ġÁIFqŗúĸ.bũļw_ē‰ĩ‹F?`8’ĖmÚūžû4‡ëz fZmVnēūŽēō ,–ÁŊķ FƖšƒ#ŗpRöélÃßP‰Ôzëö;~œŋ=ø ¯ŧō*ZWōiEQXļt)˗-cŲ˛Ĩ”––âqœ“˛ŊŖƒĘS§¨8uŠ#G˛˙ž"ĒEE…\pŪų\xÁ8]"&Tėé9]â=3NIąX”ßūôųõOŋ‡Ž ’|[ō”*L7ÆtŲ& C܆&ŠÄm{™ `%RėI\˙‰[.Ą 3uÔû‰t4Ûķ€Ãu<ŧë4íÁŪ‡gŠĮÃÕWŋĢ¯ŧķ :$+fg*îü“ļ?Šë„ÛļÔõ˜*š››yōé§yū…zBqšœdeeãvš°;ė¨B%‰FhmmĨąą‘p¸¯e&??Ÿŗ×¯gËæÍ,Xx 6o&ļ´Ü)9Ž}ģŪā›˙ųi*Žéŗ^€&%Á—ŗOųžÔXâÕbēġáI.q‹ĪšŨ üĄ{"_ģëz,æŅ˙†IrūŽj¤Å_{rŠzh0[Šn đøūN6ô ũČÉÎæ†ëŽgĮŽí†Č’”âå¨ÖŠK8 véˆT#šæ"‘0 ´´´ …‰vø\N'‡“´ÔÔaæWL7VOwjŋ´UĶ‹Ži<ø§ßķß˙o:;Úû~(‘pŸU1ß"ÖŽčCÜFOR‰Ûö7ĀOŧ‡Ž0€Y|đēķGŊ¨¯5^Ā`^rĸą“'ö×ôd7é&%%…Ë.š„Ë/ŋlTķ9ķGV6oöČ 'Œ$ōõw t ģa*ĒņÉîÂâô`˛{#ÄŌMûvŊÁ÷žūŽØ;đCI dD_[3!bâ66’,HäčéˇĮaĶâÁ›É‡ ;:¨÷o}>‰ėŠÛSmcå™nî:o1ĒÛxb -ū¸ ŦŊŊûîŋŸ??đ[7oæúk¯!kÆü%ÜŪ4Mâ&0Ų\˜lŽ—|=E‹ŅŖ¤Eę2Ŧ-5„bBQ„bB¨fL{ÜÜ8ƒŖŗūœ8zˆßüä{<ûÄ#ƒ}Ŧ Č'¤Ēß-tÅ(U2’JÜēLų2Á•Ée›į›–¤•ļå ëķyĪ\Đ%sC ˆ'a^š—ÂîĘvŠīšX4Ę?wîäšįŸcõĒÕ\rņÅŦ_ˇuƒxgZ8@,čÃdwMûą“yF>ÆKÅņ#üęGßåŸO>:TBh!Oëēŧ[Aüc°c#ŠÄíšS>úŧ2ēŖ7ŠEûxdÍ~Ĩ„LøSŒsķU֕¤ŗĻ8Ŗõ<{°–ęļ¸šR×%oíÚÅ[ģv‘ššĘųįîā’‹/%++s†{=;ĩ5āšqK6ŽÚĪoöŋė|ęƒŠšĤDđ_ŠôMĮ‘œoßŗ¤7âæäŒD#ƒË>úâ†Ég’Œß ᨆÕ<ö‘ƒH؇ÁĐ(–äxXœãáõSÍ<üVUŸo­ĩĩ•ŋ<đ7xđ!Ö¯]ËųįĪēukįĩJÄ×B,”=ŖÎŗ]×yųųgøķoÎ[¯Ŋ4¸¨&AAōˆĒ*ŸĐ5ũø tuN“TâvAž;-‚ėķDqŲFī›´î˙Bp°Ļ%9#ãũ"€ŗKŌ9\ĶÎŅēvōS4v„z˛čēÎkoŧÁkoŧĶédÃúõœwîšŦ<ëŦõ盤$ĐX…§`ÉŦšĶšI?O=ú ÷˙ægTUœ´M—¨Š:ŧŽ ņI)åķĶÜÍyCR‰[ØJēčⰌŪķIEFn4 ąšĘŗÜ8ÎîĪɤIe–ÔuÕB?wIEbA߈â&õ1椛­$ ˇŽ\SČ÷ŸŦsSė,늁,LuŽÛJ˛$7…‚TgzsšJ‰üđ0ņ´[“Lr‰1]Ą¯ëŋŽĮ]’­ŪŦaˇ3â–p/zíļ/ĘáΝWōÁ –Œ{ūͰOÍĒÂTž<dĪ™ļq‰[l&…Ydõ&gĮtęÚãbWߤɿé]ĮųÛˇpYM”fē)ËtSžå"ÍiE1™Q­vLVĒՁÉjGĩ:Q­6“ÅlA5ÛPÍVsüߊɂjąĸš­Ķ'2Rõˇõˇ"T3W*ˇ“Í=iɋŖŅíít´ˇŅŪÖBmõięjÎP_s†ÚšjęĒĢhŦĢ#: g2“ǐįĩS˜æ¤(ÍAaškRļÎ[’Ëo_î‰m/vŪl šî´ƒôTâĻ*Šŋ˙‹V8CjQ´u8; §Į–EYė>ŨÂ?öáēuŖ¯FžH÷W37Ü&—UEŠĸĶbũ~4]#ĐéC×ĸtv´ŖëmøÚ;ččč _ļ*‹Ēéļ‘åą‘įĩSî"7Å>ėÜŲDYœëĄ8ŨIeŗŋg.ġ˙Œ‹¤7Šë>D߇K(ŅGũmËۜ"ž5¤.Y‘ĮŊ¯œdSy&šŪą×Ų2Dmhŧv E]¤Ã5mŦ,L›ļcÛL ų^ųCüĻÁHŒ¨ĻcŖāją(Ú…ÅX•“™2¯ŌRhé R׿ŖĨ3@sKˆˆ_–Î 1mj­q6ŗJŠŨŒÛfÁë0÷ˆYĻÛFŠÃŌīēŸķÅe+ øÉŗGzŽ$ ;h÷ũģ.”ĪLųÁįÉ%nĒęũfãÃ]â ųŅcĶĖUԝ>úŪ–‹sSČpÛx|-īŲZ>ũöŠĻA/+ ͍löŗįL+ ŗSˆj1BŅšM#ĒIbšN8ĒĄII(ĒŖé:ҘFX“čēN0ĸĄKI8ĒÕu4]v­ƒp,ž!$kŠŌØ\žI†{øpģeöŨžR×Đ"ZOõ ˇwĒ ŠnĀŨÛč Fņ‡ŖĸÁHŒ@X#ŅFcDbņiM—DbįŲ­fĢɄÅ$°˜âˇšÜ63.›™ģy„Qv˙k}z,;ŠV•fŗģĸžgâ_ü82-˜'Ėžģc„Ļuöš…#]ŽÖRioÂÖU÷i>!€- ˛xā­*N4vRžéq›Á÷#’zęMĶu"1`T'͈i2.<1˜. E54M'ŦIĸ1 MˇíŪ.ĒëÄb]í¤$ĶĮâ"p¤ļƒ¯ü}â’cÄlą`ļÚąXmXŌXíŌ­6,;mÍŧv⯟lbaŽ‡Í 2)ĪōĖšWAÜŲfēHŲĒqæžŅKV˛ŋlj˜ĻÅī7*¤ü‘œoÍëĶԓTâ1Ûü–~ų!à ouą`'z4„bäwŽ–Â`7*Ŧ.J劃ĩ<ą¯†ģĪ_<žũNB߯K\|b„"ÁŽ7ų`D#ĶF4BŅøŽj„ĸ:M#͉Äâí#Qm įU…XėŦV;fĢ ŗÍ†ÕęĀbŗaĩ;°ØâbeļÚ0[íØNĖVĢĢ-žÎjŗcą;FĖTŌpæo>ûĮ÷ŧÆŅē˛<66•gąē(uĖ&Hƒ8BĖĢ„Û$9wÍBžzãpw„€ķ€ëŋĖdßæIį&„Pb$\Ĩ/ĪcûâŪ XÅbÑUD˙ 9h'ÔR7]]ž9TĮ3‡jyߎEœFÍ$M=D4(†/ÉáÅč EãĮđ…ŖøBąA‹LŅü‹j2ĮGH6V‡ K׈ÉlŗaąÚ°ÚXlq‘˛t‰‘ŲnÃfsbî,‹ÍŽŲ2ũņZ-Mėzî1ŧōOĸ‘0v̉ŗKŌ9§,ĶHŊ6*f õGņdņ­ŋž@s‡ŋû–“Ag9ŗØšäņēäy†&›¸ą­ÄÕA‚ņ~ķ‚,._Ų7{„5%ŗģīÄŋōlĒž–~Î-žß~âkŠŌ¸~ũø<'Gƒ/Ĩ=Ĩ#Ĩ-Ą#Ą=Ĩ=Ą#ÅŠMĒX™-Vl7v— ›Ũ…ÕîĀęp`s8ąÚ]Ø,v6ģĢÃ˙Ķ_§(É_A!đŗ÷Ĩ§Ųũü:ÛQ…`yA*[dŸj˜ą€ŲŦcƒb˛ģ8Ų)øéCĪ%Ž–ų !å§T10 ×lā؊äŅ‹¤2Kn+uÔ!{Å-1im7áŽfT›Ŗ¯yr<äz] |ú‘æ˛Ÿę`_u—­,Ā1ޏ7I—ÉSÂąú*›}´ĸ´#´ĸ´ŖhúĄKUM8Ü)8ŊŠ8œė.v—{÷ߝnė.ˇ›Ã=#ŖĻŲ„ÕádÅWŗöÜË8üæ‹ŧųėŖė=]ËŪĶ-Ĩ;Ųŧ ‹eš)ķ§Öß`B–d§ ųYZTÎĘōöžčɜ$„Ÿy?đÖ voNTâ&â/ g$,ė^7˜¸!uBÍ5ØŗŠ]ĸ&撸 "lŨœUāĨz_ ģ̚Ųŧ`øĀöÁĐc–|ũT3ĢÛFŋ­qŅJIÅåņâđ¤âJIÅåIÅáņâōĻÆ?wO<z>ĸšĖ,?į\–ŊƒŠƒģyķŲG¨:y„Ēæ ŧ+į”g°Ą$}NÕûh%dÂ9‘’˜ŋëvŦåHUáh—cœ@H”ûĀø‚ø €$ˇŽGīi ´ú/@ĒĮĸ„ZjągäEM˛S'+ Ryl_ {ĒZĮ%nĐû@1 ōą:œ8=^\îTR22ņ¤g‘’žEJZ&ŠŲyķ~”5!([ž†˛åkh8sŠŨ;įČŽ—x|_5OŦeEž—틲Éō$OåĄĻzŽ›ÂÖEÔ߆7§ŒĢļŦâĪ˙|ŗ{ĩ"$e1áü¨ŸŠšfæše?Ū‚šīÆgŅąËY;8,IõėņĄÛņxĘ븸u#D4}И-ä'Ô\ B5ĮKß$9ÃM/xí2Ü6jÚt#xėcûë~ XÍŊßéŽkoeŲ†mXlö1īĪ`ęČ*(áâwžŸs.š†ˇv>ÆĄ×ŸgwU {Nˇ˛(ĮÍæYƒ–a™ zŽÛAÜ}“g&gōĐcņĖJ[ÎZȁŠUÖÆ?˙ <ŧ:“}Lf’ƝXH’Ŗ@Ģ˜Z|á!ˇ‰}]^’2žJh0ԃĒ<ˍŽÔuLč S¯yËjˇÂ6MŒGˆR2˛9īúÛ¸ãŗßa˕oĮáNáHmŋ|ū8?xú0¯W4TŲûŅõ?‘øI/=į5ˊ“DÄ׊pĶųëąY<`%€v?ābSƒHĒ‘[WąŅŖũš:Bä¤ ũā:ęŠĒ’ėé“‹qëOy†‹WO4r¸Ž Ĩã<XÄ-2Ė˙ĶE_Q[l†ÍéfũųW˛zÛÅ|íyví|”ēĻÜUÅ3‡jŲXžÉ†ŌŒq9õtN$^‡ĸ§—ņnʞî62Zȏ ’ęvríöĩüáŠø@MæXäg ŪŽH‰fŗņâ‘Ļ)éĮē<°ÛÜ]‰fįÆ/—T#7EPD➝FÕļė6Ģ…üDSÖˇic×]IĻE‰߄ō÷YMŊ‹„‚ãŪÁXč/d2nĨ#&ŗ…•[.āŨŸū&WŊ÷cd•ŅŠō䁞ūč~ūüFeŸĒá#Ņ#^ QĮ“C´#^õœeĨŦ,/HüHppûLô+ŲIŽ‘[œ°¤{EMû(ŧIĶ7$ŖxąrXTԜVš|ajÛCĻ=™2H, “Ų†¸M\Ųmú‡Ŗ`ĸķIMÅQŪxúa*îfwU {Oˇ˛(ÛÍĻ…YŖKŲfڔëŊŠ;ˇ\xՍ­4wô:qôx84sŊL>’jäĻáFÍ@ŧŠ$ÖŊžēu`uãšHO Ú(Čî2ĶVˇ×ĶI`5õ^‘°!n3M˙ß~Ŧ—|^é"Žžķãŧãã_béē­H!8\Ÿ—ûá3GØUՂžp#%îÜ^3J¤­ģÕĖ­—nFM¨w'Ĩ0K…‡HĖŅČk'›8Ģ •- ĮWw<¸rËH_rK7âĖ.÷~“W^9Žŧr˛WW@°Šš–coRŋw'žšã“×é0ÛŨ4ÔW+nR‹noÂęÍB¸õŌÍ|÷ū'Šmnīm#䗈§æzlę{Ü$•¸% %<#$oCăšO4tĸéz[õ\bŦŊîŦņRJ:ƒQŧŽąŋ}ģ­Ŋ—‡¯ŖmˆŽaI&)G,…3Ä~›ÃÉŲ]ÃēķŽāčîWxí‰ikĒg÷évŸnĄ8ŨÉĻY,ĪK™”ž&âČ, gíÅd,ۄÍ;žĖ:ŖÁž‘O~F>ų›ŽĻŗú5¯?Jãžįҧ¨2y7fg H%žP×0õĩbr¸Q-vŦfˇ_ą•īüņ ‚áx˙D|ŒūālāĀ”v:ÉI*qÛVÚĮņ)åĩŨˇX8ĻsĒÉGy–'Ų„O 6ŗŠYUˆj:íÁȸÄÍa1cR1]âooCö6„mr˜Jßú1ŪĒÉĖŌõÛX˛n+wķęĐpē‚Ęf?•Íd{ll]”ÍĒ‚Ô %kljŒĨįģá2ŧ%g{?ãŝŋÅųĄėĸ÷Põܟ¨yũą)Ë`¤Zl”įeđúŅv,Éļm¸ĨGv1…,¯›Û/ߏ܉Œ;û°) Ok€äŠA3Í$•¸Ą÷ o{Dô æ>\Û1'Ģ§ÕD[ B{ écß^➙i DĐbQÂ?6§kō;j0ĩ$Ūc°}&†TÛĪĢũ•šŠcÔw„zœOļ,Čd}iƘЍšŦō7]Mî†Ë°¸ŧc;—)ĀėLĄü˛;ÉÛx§žú-^šÔ°!ŅeMJMK§ēíØˆīz,B¸­kj.‹ sxÛæUüí…ŨŨM)ÉÔņ°‰Y\˙m&If^-‚Ŋ2aėp ĻmЀšę6ZÜļøģK[06Bˑ÷āīhíķŲd›Ļæ5Ķu] e\fĸ…+¸ņCŸã†ü;…‹–ĐˆđČŪjžũøA^8VO86ŧgĸjąQ¸õzÎūØĪ(>ī–Y!l‰ØSsYzã'Yųî/bõŒãmpr7_ B`˛ģIwZŠjyū:ęī čMŸwîÚ%l_Ŋ¸ˇ@EgyĐáģŽ<ģ}I*qBíģHqŸ˛g8׌RŲ”āų3ČCæÍ˛;짜Æ8pÛz͙ž~âÖˇĐí<ųR§!Ä´ĨüPU…ˇ‡‚ü| ōķq8Ææaœ_ž„ëîú7}čs”.[‚ÎP”ĮöÕđߏîã‰ũÕ#}¯7Õl%ãUløČO(ŊčŨ˜lŗ{ôī-[Åē|ŸŦ•Û'eŠ ×bKÍE¨&dōVeķ¨ļ ĩÖŖG{ŗČ\ŗm5+$d0(Hqy}‰ķį7ā’Ę,Š+Ō÷ ]ũjâŠ=§[)íÎļ0ØĪ-˜ŨųĶ&ŅAŖÛRŅÆŋÃDī.{Û{d0˛;'ã!„Āápāqģqēœ}FÜųŽ|ÂĄ0mmmttŽŪ%<ˇt!Wßųqę*OđړpęĐ^B1įŽ6đʉ&6”e°mq‹ˇ_CŅŽ›0;’+˙¯ÉædÉõ'ĨxĮų RVÚHg ) Vzũ1Ę rš÷Å#\ŊfĖR'ØTƒ#ĢĄšP„āŨ—lâ‡ūr˛ļąģ•"Ĩx÷Öb—O(|°k^!ēsņcŧpjūy;'ÕČmĒ@ž&ĄĮ˛īL+‘„|Š ööĻ/Ÿuųņ …NŨ?nL˙Ųíu āVÜæ‘Ŋw˛“˙Ũ !p:ädgS^VF^^..ˇkPS˛Õf%;'›Ō’bŧ^ī˜ĖÍ9Åå\}į'xĮ'žĖÂUg#„ ĸéŧxŦo=vˆ^;Nģ/yc$s×_Šw}Õ:ū0ˆpk=Ūkp¸=8­&N5ŽNl¤%ÔRĶ4“ĒrįUÛČM÷ö6!øđŲqwr’Tâ&tuĀâW‰Ī†pLgīé^ķ™Nŋųô„˚ųˇŽ‡Édw§Û“-˙žÅ­˙œ›Á$1‰?ŧÃá ';›˛˛Rōōrq{܈Qz4šĖf233(-)!=- e a5šE\~ۇ¸åã_fÁĒ !ˆÆĸ<ôį{yĮ•ÛųᡞB[ëčĖqŗÔōUŦ~ī{.Ôۈ3ģÕę@˜,ä§99TĶ>ō†]há Ą–Zē/‡ÍÂŽ;ė´~ŖaÉW'į I%nēÕ6Øō{} ēŊ~˛ˇ,Ä+ßP’Ąî˙ŠŨõ÷`›”.ҌN Qߑ[˄ûd0üųív™™”•–’ŸŸ‡Ûã“0õG5ФĨ§QVZBffæ1TƒÎĖ+âŠÛ>Ė-û%KW šīW?áĻK6ķ“īüímÉw9ŗKXyû—1;SÆŧm¤­„Ā•W@Af*‡ëF/n¯KníÍŽâ˛[šûšsI÷8û´B| Cā€$ˇ!čņ;„ė PŠn PŲĪ#iÄiĄ>“r’õMÆ­PĶ0jŒuÛß'°TģĩįīmMƒĨ.šeļŨdd_ĄÍf#33“˛ŌR đzŊ¨ĻÉušŠ‚×ëĨ¸¸˜ĖŒ Lcp÷ĪĖ/æmīû8o˙đį)X° ˆ‹Üīņ#nŧxßûÚhm™šÚdS…=-īü,ĒŲ:rã"ž¸ÅÙˇ€ÂŦ ÚZũ‘1í'ęo'ŌŪ3׆×åāžkĪĮëęk2í¸Žiįs¤75tč?BŠ>a˙Īmčŗ­Hüßp“~ķ1É:$ú˜F§’˜Ö=š<ūĻ:Í=Y_ڛ’&í\Äbąž–FIq1……xŊ)“.hƒ!7ÕKIiYŲY¨cÉå”,āú{>ÍÛŪ÷q2틁¸Čũų÷ŋā—oį?ø6~_ōä6tį/déÛ?‰PF˙Ŋë‘øœŖ+…ų9āDãØĪ;ŌŲB¤Ŗ÷Ĩ =Åɇo¸€Œ”ū¨âÛĖķ\R‰Û0ė’g‹˜­k§Ąc°bŒr„\_!IØ IŠ!ÖĪą.!šˆ¸ !ČpÅôX”Žķ&ŗeâ29é—I´ââ"ŌŌĶ0[†Nß4•)Ĩ%ÅdegaƒČ•,]Í-û—ßö!R3sđû}üęĮßåí—ná÷ŋøŅHx„ŊĖŌާä‚wŽēŊÔ4¤ÞYœv^‡•“ã7€HG3‘ŽŪû0Íãäƒ×ŸOVjß9¸ŽÜįĮu9@r‰›"†Yä×ēķLčž:X3ĄÃ %\‰Č„‡ģbũLŅ]…{ĸ?rFWf€Ö†Q|§3ęÉà V¯ ͸  †‚‡’’b˛˛F/rBŽ:›[?õ .ŋíCxŌã‰Î;ÚÛøÉwū‹w\y.=ôį~ņ“ŗ“Â-גZžjTm…jB‹„P-6Ėθezœiņ3Ū›%ŌŅD´ŗwîŌërđĄΧ 3ĩīąá˙ˇwŪámwŪ˙Ėĸ{EQŠbɒ,Ûrk\§8qœØéåR/—\.šK{“+éÉŨĨ]Ęå’KsÚÅN\âšĘ–,Ų–ÕeÉ%Šb/hD۝÷E%V€Čũ<$;Øģûß˝| ø/–āúAa‰Ûä<†āˆL˛ŪŽwŌ68ûĖ4™„ĢPˆeŒ0™æv^W'Ö†ûĪĻnĖKh05BÄ}‰, ååŦ^•,h Wjf:!(-‰\õ´Oâ"÷ŲoqÅknĮbÕΝۺ]|ã‹˙ČßŊëVŽ|1—]Ÿ;BaÃm˙ˆÅ1uųaļ F‹ũÚËuĢĩĖå`ØÂš}˜Np´?EāŠ‹ėüŨm¯díŠÔę(ūūęÕÎ;Yb™L JÜÄųi!RĀíG;ŗTĨģđäÍԃŪįZt˛Ō•°ÜFúSķ´æ DkÉ`RĘËËYĩr% ĢŠŦĒÄjËoAK‡.rĨŦnĐOLĻéof‹•Kozīũ¡9īŠWÆs0;rŋįÍüã‡ŪAË铹ėúœ°ēĘh¸ņŨSļSL Ҏ–éÂS^âD=#csēĩŒ8‡ÍĘGßôJ.ŪАÜL ÄģzœN–%nĶāq$O"‰§2éōķâ™ūÉŪ3M Ë‘R2ÖG…sˇę”iÉŗ“´4˜ eĨĨTUUbŗĪĖû._Bwyû TĂŊ&‰¨E‘{Wgá°yKA‰›ârNëarũ ˆ>KČœęuŗûTē äÅÉh’Ĩš\ļfļԔč7)%Ũ)Û Āš-ī°ŲmˆE2f‹™eĩËXĩj%Įôr4šĖ.žáõŧ÷ ßfĶĨ×ÄÃYZ›OņŠŊƒû§Ō×37očl˛ęšÛĶžˇØē›ˆ>/Znƒ^} ˜­bp¸—ˆ?5ûI}M˙øÖWqÎJŊHĒ §Düø\ŸW,ÖĢË+Đ>$ÆüO;Kį°Ąú4¯ėoMÄÁ”ÍŨ|EYĸ4J_Į™Ô“ÍĢ—Û"ˇÚŌaŗŲXąĸŽēēå˜ÍĶ;'ÅĨÜôļņ–˙3•ËWÆ_ßņØÃŧë ¯äŋúÔČėK:e‹˛5įãŦY5áu%šÍ$fšÅĻhíV f“ ĪX5ˉC=ÎUdãŖoŧŽ/:7.ezĄ%ųÍĢWģîfŸ:OYŦâđ’CĸŪ[D“üáų3¸ĮōlŪ>Ëė>ÕĮK]#ņįÉ5Ųfˊō„“U_Gëô߸(Į„sĮąÅ-†Ķ餥aÕUUĶN0P×xīø§¯rõŪŒņ?ßũī›éšÉ9™#jˇŨ4áĩ â&ˇ\‹IĪ~ä‰.!dķRI'pBŧūĘķųÛ[¯ŖÄŦ orX]€IđÜōOQYĢWĻvŽđéŋ}>xO.ģ;)G e 'DÅlBIŦyĮ‚šx"jOŌLRļĮ€áž”8¸Å;{ëĩÜrå(BAĄ€(’ģīP`…ŦĶąØÅ ā„ōöņɊOô¸•Ā={Ē—ŋhŸ°ž€=WVTč֛”’ūŽÖ™īĀ8ŠėKÛjKG‘ŖˆÕĢVR]U…2Í đ5›ˇņÎĪ|ƒĢny;‘H¯ĮËnNIÅú‹ã›Ŧą)ÉÄmV %…ąŒ.ūpR–’\"ÁŅū”\”1!¸áĸ|ꎊ.KXĪB“ŸR\Īŗ+`—',qØNš/ŸåĪŸ!)Ü)JU͏˙@;ۏv§Ŋ.*ŲËxąĸ,ij˛ŊeFīÕ  S“ —Ģ1Hƒ؋ė8‹Š˜É TËņƒX,Vn|ísÔšéQąūĸøßŠY7-Bjē€E‚ ‡6KTăáŲ§āš.!÷@J5dęk*øĖÛ_Íå›× tOŧËBVų<°,įËKEÜ~ ˙>ūÅ=n~ļķTAyģĮÂü|į)ö%yFĘq›+\ŲË~ąĸ,ÉŠ¤sœ¸ē5m–úzÛxBÁCƒC´ĩļŅŅ҉Įëä´*kŧôüĶt5Ÿāڛ^CiYEŽ{;9E•uXzöÅ ŸŅ>ŠįĘôv6ÅÛÆÖ܂‘ņ▛ŽņÕ’ą˜Íŧí†KyÛ —Ą( B&ĄŅh•<ä [đķĒ3äķzMņŲäĪŽøųɎ&Æęé-n/4G:†xčpgJâU)Ņĸė,UŲˇŠdËmœSÉt¯Į ĨŅ—BėKØS2F$Áëķâv{Ķ—ē™Ē˛F8äųí‰5ļ;ŪũÁŦöqVAqũz†šöĮ=%ڟø-ƒĮvãé8-–9$IũœēŦįæB šB`)N?¸|s#ĨN?čY¤"MhâBU8ŋŦĒæĪeŊ39f)Yn1>'‘ß˙ĸ'æWĪžâ¯GģâĨbō÷X˜?žĐÂŨ/ļĪ(Ž Á㎈Ę,Š›ËfĻĖĄOsŽöá÷Ž_ߘ†ųļ„… ôX/Ą,M3WDĄŗŗ“–ÖVúû2 Ût8´ķQüŨđ‚‹/gã–é• É5Åuį L–”‚ĻZ$”"lá¨Å6ūlĶ˛?ÁŅ~Ԁ7ãösęxīk^Ą/‘ „”âĶĀڜu(G,Eqøņáhq͏’iRûŅS'9Õģ° Ķã Š;NôđũĮާİúWōŧ†ōF’ŽEJŲÍ2ßXĨ[ļRJ:Oˇu&äŌŧÁ/5gMÕđ¸=twŸĨĨĩūūÆÆĻįi;Ų ŒqāéGâĪßķ‘OĖą§ŲŖ¨r9&ËÔ×]8|Ž,@iĀĐYd$ķRĖÖĩõ\°~BŅmH“IũôžŽ‰aųĖR7€˙Uā&Ā“0ā pįîfîÜŨLĪčX†ˇĪáˆÆs§ûøūc/ķäņŗ„RŦJŠĄ—˙ļŋĘûJĄČĒä÷–;­˜˛ėÄąĻ&‘#°ŖéXęÆkišpKÁ™DjR´Žnδ´ĐĶۋĪį‹[#Ķ‹yœ|Rr˙ŽGøõZ[/ŧ„‹/ŋjîĪE•ËQŦESļ †ŖÁÛi,ų\û^IMclhō ˇ^}~™ęKwP`#ŌĨļæ6ž&ŗēE ›~#á•ã7žęusē×ÍښŽ\_Íēe%ķöëŽøCėk䅖ÆBiĶ iHēŧ x@ŅØ‚ $%VČn@ŒĩÕIâvjœ¸ŽūS˛hÅMB ĀíqãņxŅ2¤”jXŊš@0HOOOÚí‰ũ‰ŒˇŌ€ĪÃĄÛãĪ?üŠĪĪļ×9Á^^‹Éšú;¯~õß0Ú|˜‘Ķ⯅Ŗ^’b|œR ]Xr† ķÄ+Œ§Ėå žēœŽū!T\×PļhÍ]˛ËR7€ÎmŪŽnt}\HūS LČÄ÷"Ķ}nN÷šŠtŲØZ_ÎyõåņDÂŲÄs˛ĮÍĄö!ZŧiGŽT Čīiöĸ¯)Á€Ā1PŒ„Í"ŠÚn6Ãb”Y¨vŲč÷ėĮ=Ø/O2s––w‰ŲlÆ<Į ųF(ÂëõâvģãĶl™0›ÍlŪt.G›´@×ļLė}üxËŽēŽ­^2ĶnįK‘ “=á|eq•Sšé”4laäôAbį|0Zž'cE yI‡=CÅ  ļ˛”îTŠQÂë0Ä­āĀ#"ō€Išŋŧ‰Æ¸ĒŪƒŪ ;Nô°ãDUÅvÖTšh¨rąĒŌw´˜ #ūŨ#ctû8ÕëĄgÄ?ņVŸŊŠčÂõ°É¤ü“ĒǧcMjÛô険Ž ‰>Wį@€Ö,+ĄßĢė8}ŒÍ•×ÍrOŅO+咈+Z$EIÕHwrOĮtl8įėv;rŠÄ “mu pdĪ“€>ŊųÁzÚĮŸ7„ ŗŨE$ _—Öâr@Ī`b-­$4:€”‰Æ×N>M;šų6WãN ššâü’ŒÕlJLKeęšÖ<¡TڀˇK”ī+BûO WG-Ĩ ŋü€'Ā€'ĀŪ=0ŌjR¨*ļSá´á°™(˛˜Rꨅ#*ca÷XO Ė 78ŪÛ1= $&  i_О?ysmkÜëÉ$djâ͚â܈ÛÚ*/4ëâÖŪtŒÍ—]7ˇ.a(**¨{C R“ø|>Ü~ŋÆŪ|‡ƒõët‡;¯/ŗ§ŪT<÷×?ŖF-žëož… ›ˇÎz_9C€Ų戋[˛p˜í.BŖDÔZl rRyRH'÷Uc4ĻŌ9÷“ÃT”>Ę7L„%Hé™ķÁæCÜŌķpŠŧ@|\HņnŠW"ĶJ@HÕčņĶ=2÷’:Š „¸%ü֌øQy"]ÛŗkâS k…&SĖĮ\YnÕÅ!tÉSĮ‘RÎ91ōR˜ ´Û LÜĻšŽ6.8+&“‰H$‚Û=ģ{dw;'ėĀlļđÁŋĪCĢ ôģDŌ\Ŗš”•D‹z(zü ‹ˇČ2}ŋ> yƒôēlĒ+{_M OŊGé‰˙îfĖ­Y9ā<ą”Ŋ%§Ã!āƒÖ°¨S„üœōŅäŨBŸ&ĖQMA!yDŪę2{k€i…Í ¨2öؒŧÍa5ã´æfėRd5Q­īæ÷ēėé˜âSŗØ…MQŦ2- †¤ĨĨ…ŽÎNFGŨsļú+X^Ģg īéíEU3\:SŒž}đq‹ņ–ÛßÁŠ• ŗîSn)ų$C= %ūŪ6ƒzÕQo ÛiŸ,‰vę•qŦk„Öoք @Ēé×JŊcA†=ąŒR@ëm`XnĶeø6đmÕDI¯•RžÁ+ šhR`Ęėį€*%R€9jލ(“°C ˙Ēā{FÅ9@ 1~Ņ}‹D† °,GV[ŒĩÕ.ēĸ…_[_>JÕō¤B9öō*Dl6[^ĪžÎvm*, įo=/ūŧŗŗ+sãIF8­/ĸũäQ'īũČ?dĢ‹9"ņcKMĨcĮ˙16ŽúÖ\ŦÚÆTė>Շ&áęsj˛×ÍI8ŨŲ›ô“ČįT ĢĻ!n3§øuôÉ*ĒdPž§)lF˛AeJA–IDŠԁ !=­D'Š<ŠyRhūŖ*Žé׏‰’æ>šE€)v2VįhŊ-Æ9ĩĨėlę ųĨ}\|ũë&íÜtˆ)Ķ."Ey˜OrŽëhĶaËæMņđ‡`0ČŲ !BdŽ$‘šÆŗŪūÎ~ŒŠĘĒôšXŨļHĒôŪ‘ō|Ô7]ËM×üĮĪℚuÛÄjßšâHsBŠĄÍہŗ„!nsgØ}ä§9ē?î—ķĒŽ ‘"įž’1VW:qZÍøBzۚņšGp–”Íyŋ‹Q؀üÉ')Á?æĮãöāõųæ4Ũ8U••464ğˇļĩe<ŪdēztĪS ötPŊŦ–Ûßõlv3ËčâĻM’ũ`$iZ˛xËMĶ$÷lg,¨ōŽ+ŗĶÅq¤ķ”Œ¨*ĮZēbŋ‹b2™ĖÉÁsˆąæļ8°Ą‘ræį"/!–ëŲĪĨ”´;0Å;f|„,īoaYčāíäu´ŽŽnÜON…MQ.ŧđ‚¸Ŗ‘ĻiœnNMļm1›)++Ŗē:ŗđûxūŅ{ãĪ?ōÉĪcĪg¯ĶØį O>ĩëŽZnfE`ŗ¤wįĐ$ÜŗŋžŅw\ڐŗjöÂ<Ņr<ŌÜŠgPŅÅ­8=ĄQžcXn„0 ŧĒ3ŨĻ ãcōĒsd<į֕q M¯ōÛ|t?[ޏ>kûBĸÉÅ!qV‹“yz8ŗIŽÖŅĻÚ7PRœnko'`ąXp:ģ\ņŌ?í÷ŗį‘ģķéŪ•ˇœĪ¯Ŋ5§ũÎZ$D$4ųJÈG_ssØ,ĪņíGģ8qv„^ŋ‹9wvˆbš(/kŅ=ĸ5Š!øšĮÉä3aˆ[Á '›ēŲ,’Ü8,f…âĸÉįņŗÁēšb,f…pDŖŊéÁ1?ļĸXf†š9÷ËE"lvûüYšĻE3†x[˜ŧ¨Ĩ%%œŗ~}ĘkŊŊ}ŦŦ¯ŸPËÎív ¤‚žÎV^zūi@ˇ?ų…¯ĸdLį‘D-̐wdĘσn=Ž´(ũ-øņãŨė9ŨĮ—ŦÎjŲĒ ‘Rš`Äë§ŠŗW_ƒ(RĖ]rGŸ))H1ŲcČø$•Ķ6/Â`1)Ŧ‹æšÔ4•ļG’;<=( ėE9 Đ××GKK+ŊŊ} &lB.ÚvaŠēŨ8œŽ ÂĻi’ÁôÅ3Ĩ”<}Ν‘ŅŠĶ×Ūz›Îģ gũÎ1q›<{~ Ž{KVš&|žkîį™Ŋ\ŌXÅ֕š-žĒ˜,č!ĩ ž?v&ŲščĐ4ū}…€!n@„¨“ųą ‘8CŗYÃm*έ+‹˙Ũ|tęÆ|ö}ŸGrUæ&Ž0<4Lk[[VâŅæŠÅlæŧ-[(//ŋ&Ĩ¤ˇˇ7mûĄÁA"bŪŽī}†ŗmÍ—”ōáO@­Ėčéö OÚėėĀh|Ļē8õZmé÷ō×#]TÛyŨÖšče É90A÷ Ũ{ŧ%öQ4„¸SHˆ= cZ2ĪyļeęTEW7¸ļ ‰ĪCV˧¸-/AMJZŽD„1Ũ ėbČŠĸ`ĩfī÷Hvß÷ų|YÛīl1›Í¸\.Š].JJKXģ&ÕŖohx˜@šõžp(ÄČhz 'č÷ąûĄģãĪ?ô‰ĪRV^™ŨŽį„˜å6…¸ %>w˛Wŗ'æî[‘RrËųõ˜Mšˇ=ĖļÔ5üÃÍ yâᕐ"rׄ7†¸å1ž’"Ą!ŲFĘFžšéRd5ŗĒŌI뀗p(HۉŖŦŲ˛-ēÕP7ģŨž•ÅÃ` ˆÛãÁãņdÎđ1O˜L&œŽbN‡3ūųVÔÕĨLGjšFo__Ú}ôõdŒĢÛķ×?ŝH֟ģ…7ŧåŲũš i–"ė™´iĪ`BÜĒĸņ¨Ē”üņ…<0ÛVW¤ÔMĖBL°ÜvŒ'C’RČ'€öÜw$7▧DˆđŠÆiMg­Ņúm1æĶr8oE­ē…y|ߎ$qcÉg+™Ë”dÜÛqÔM04yÜTŽQ—ĶIqq1GŅ„)įō˛2Š]ŠÉwûúû‰¤)ƒãķøđûĶį`íëlåčszȨ‚O|îßPLķīi:sßĮØđäE@Ī&‰Û?y‚°Ēa5)¨RĸÁXHå‰ãŨŦŽtŅXåʙg˛ĨŦˇîėŖ­g(öTÍô_irÆ †¸å#Lę´OĒuãWNįĶr8oeíFÕ4Z"āķ`wFGž9ļBJ˛ËŠ•ĢįÜŋų%V Œo sžĖ@(Bw4ÆmyYQNķEN†­$3øŌé6Îô Å×ڀģ(°ĸ¤™0ÄméwL¨‰J¯ŗV&sU}{:Ŧ(wRSb§ĪĀ;:DĮéãŦ:'Z <ŋt'įČčT1_XĖfŠŖŽ!kv§ĢëjkSŦĢūFĶŦ§IMŌÛۗņ{xęOŋ&ԅķÖ šííīËj?sOâ;đžmÎXÕāLwRĶŋ‡úŠ´ ĐsŽÉjĮd××Ō"á0÷îÔĢyD!%_WeæĪPH顐ĸôą>3Ā*…HšJŌrŨą$Ƒ=OÎã‘ķK=%rA„Íd2QVZĘʕõ446PYU™uas9””$<톆‡3!Éč,ķōž]´ž|‹ÕÆgŋüŸĶ–DŌ´‰§ëÔ¤M[Ī&ÖÛVV,Ė”¤­,QÅûŅg_dČD  Jøp|A:– ËmPAi`ÎŪHeã_˜ĒĒoŽŲÖPɓ/÷ jg^:Āč`?Ĩ•Õ Ú§…aū֌„8NJŠ‹q:9Íé)„ nyÂQhdt”ŽîôNÁ@€ĄáĄ´Û<#ƒHúާˇS •åķošYœ%(ŅĩļžŽvv×§P%!‘HĶ˙˯!âÜ0,ˇ@1)˜eVĨã÷ŊĶ’.›™Í+ʐšÆ‘ŨO¤6XLWĪd˃ļŲl6ĒĢĢXĶØĀōåĩ8]Μ'ĢŽŦ¨ˆ^Í8õ*5IOo†mÛ÷‚~=‡áē ›xįū.§ũÎú÷ øņfö”ô‚´öęJŠŦķšÜ@˜ĖXKuĢ-ėæžį_"’¨ŅĻI!ŋ œÉôūBİܿM‘@Öæ´K•q㓅ž–¸bmG:ôûąžæō›oÃK<ŸNpBĖŲ[gv‡Õ›‹#įrm*Ėf3Ëjôä¨Û=éšb__ĄPúéČŸ|€î3'°Úl|ņßÃbąĻm›×ŒˇÚ&9׎ĩvĮ×Û6ÔÎCŪČqØË—!aī0{œāäŲ”õQ Ë7›ŠŗđwÂ%„"%¨Y=ƒJä8ąp䁸­Ŧp˛ĸĖA׈Ÿā˜Ÿ—÷æ:¨; äĖ‘íÃÎ5-[ģ\˜L&9ÛĶ“QØŧn'íļŪÎ3ŧđčũņį÷O_dí9įæĸģķ@ââm{iŌ–Į[)šÖ-›0á’S,ŽrLv!īƒ=Ũ<|DŸŽŒzHJ˙Œdd^;5,üp‰ Ė,ëČtąŸYļÎC™ŒépŲÚjîŨßĀÁÛ9īĘ.vižŖ$rÎLJÃAąË5įx´l12:ĘØØXÚ61"á0Ŋ}ésGF‚AũíOĐ4=ˆęŌ+¯åMo{oNú:/DĪgŠŠ¸Û_ÎØLĶ4NļëâĻÁēęųËüa˛a+­"8ŌKØ;ʃ‡:đ‡ôī_McËZŧ?™ˇÍ#†¸Í )râfMžk !ȃ{ į¯,ãą—ēđ#Œ ôŌvâ įžŸh0Ÿ‚ˎ2OĮSæp¨X <‡d& qË1‘Ëļ$2š… Sž(`Rļ­Ž`g“î!vhįcŠâ6ß3†ąã͇ČÍđfŗ9ž¨xž×ŅĻÂårĄiZÆ5É ¤Vo>˛ã{wƟî+˙AEU{Ņ&‰ōhëŅI›žÔšp4YˇŦ)s_¤^(&Ŧ%UŒ tĸE yC4Me˙އxå›ß§oųM;93’åÉ|O˛[ [ÜĒ*E,}~?mííÖÚTUĨûėYT5ŊķŌŗŨMûI=îK1™øˇ˙ø!Õ˖§m[DM$O×iÂūôS˛GĪtáę#ŪĒb;ĩĨãœhfyÂĮ]Q2ŧ÷ņ—ēØßšbQĢŪÕęũęĖVØĶ’…†"S iŽ-Œ 9ŽÛđ’<öÂNŧŖ‰‹Pɇuˇi ĪVĻīkžēõOģŨN  ­Ŋæ3gâ GuĶŨŨC˙֌ÚĮž†O?ūĄO|–m—]9/}ŸoFš'}Ū}ôtüīmĢ*&6ˆBã'ƒ§Ä*y05ŲUōäņŗņ¤ Ņļ*p˛hĖų˛šĖW –ÛlQāęÆųË7 g€xd´;ÅíœÚ’xBe5æųí÷qã[?° Ģg„L'g2›1[ ûr:ŅÔ˙;ãõųđzŊŒeŪŽŅŪôOũųWņį×ŪôŪņ7›“~.ŅA‰0Ō’9+Iß°‡æ.]dLBpáę4âß')˛“Đ:‘Ōd*öœîcĮ‰Ä8Węļaŋ0Š7žiėbŅaXnŗBĶ×cōãqFˆD]øx!ŋ˜)šūÜÄÕņw2xļc\‹<š w‡Ŋ°­6€P0ÄĐāíí´´ļŅß?ļÉRAötōđ¯Oˆ|î–ķųâ×ŋŋ(ōFĻ]oi94i.Éį^jŽ/מ[WJqŽ ?sĸ—GŽ$Ö÷$h†…ĸ\ŒŋĀ– †¸ÍĄ`Rúז7&d"ņi¯;ķE—lX^ÂښhÖMKqō#,`2õÎ^ˆâ&!248Dkkmíí  œ°-Éäîã÷ŒōĀ˙~‡P@?ījëęųæ~UøÚ“0xōŌÛ"Ēʋ'ZâĪ/YS•ŗ~H)yāPīNz ‰Āk2q0yiđENaĪŖĖ#züZūe‚ˆģĸõ{‚„U Kž”žIĮÍįÕņ“§Üh:N§íäVoØĒo” VctZdō(˜õ6Šģņ{ŧ^ŧ^oÆāė8‚ŒŲv"áũō{¸‡uĪH§ĶŎ~ôK**swC_0ĸV[Č;Œ§ģ9cŗC§;đŽéƒƒ §•ÆĒ܄J#wímĄŠ'%LC !Į4!oeōsKCÜĻĀ,AĩhųüEJŽl“RŌī ÄFķ‘åĨEœŋ˛’ƒíƒėŧ˙÷ŧķĶ›ãŠŠōUØb)—'ŧ*6[ģē' šĮCd&ą~ )%ūî'œmĶoôfŗ…¯~ī§ŦYŋ1 ÎCĸ3 ƒ'öNz‚&;’\ÜX“T#ūŋî gGŗ4Ņ5ļQ“"_­ÁžėĩđČßáŊÁtéA’Bĸgtj€…æĻÍĩqër¨ˇ›ã/æĒģL —ív[Ū­/I)ņų|ôõõqĻĨ…ŽÎNFFFf&l“°ķ/ŋįôŅÄ=ôŸūå\|ÅÕYŲwū‘pmjĘ<%ŲŪ;DKˇ~)šÁļÕåÛΖã]#üčÉ)†$"„ėRå2 s—yl,,…ÉS#å‹ņjĸƒ•ļAÛ&ķĐĘJŠŦ\šžš§OčŲäŸ{äOœsÁeXíúZMž¤œL&ķz[~Ŧ/IMâķãõxņú|‹†N…úž2­žđØũÚųhüųģ>ø1^wÛ[guŦ‚ ú=¸;Oô¤/ëđāîÃņŋˇŽ,Įe˞#‰?á‘Ã]ꘐFE‘­!å5aƒY;ā"Ž HDáĻ}\ Ŧ§z<¸|Z\}N-/ļ â Fđ{ŨėßņWŧæÍ@LØōQâ&˛Î$Ų´Ô’QØîÜÎķÛī‰?ŋūæ[øĐ'>;÷cæ3ŅībāøžŒMēúG8Օ(ûSd1ŖieŽķ’M˛¯u€§Ž÷āĨĩ%H!šĪ„īŨPœ˙Ķ5ķŒ!nQ¤(XæŠRMÖyXhōģą'îąũžÕÅųíä`3+ܰi9ÔŊ•<ũ›.Ŋ†ŌĘX…æ|ļôĨJŠlķû=kdžĪįÃëķá÷ûŗ#h1¤DfļcĪ?ÃŽŋü!ūü˛ĢŽã‹ßø^ŪMÉf•čg û=ŒļĪØėšcÍ)§ëîĶ}4÷{xŨÖ4VĪÜŠ$ĸjęfgSCŪÔØÕ¨ĢŋŠä“ĀĪxįKCÜMčÁÜkb/œîķäŊ¸\ŧē’šûéuˆ„C<õį_ņĻä§%ÎÄb6c˛äž ƒQ“‚ĒĮ˛ôķRÍ TM‡žįÉ?˙2~Ü­Û.åĢßũ)Kūå1Í*1ĢíåįÖ+ũ{_>3áõžŅ1~ąë4++\ąŽ† ĩĨØĖ“ģ9tø9Ö5žV}F# š€—ĨīDŠÃé蔏кŦ@$ĸ~329ö_‚&DĖ\ŨPœ§^ū3Aüäß6€ãŨ#\ąļzŠ÷,<Š"xÃ…Ģøų3MH ũäQNxŽ ÛŽXčŽM$MŒB.§$#á^ŸŸĪŸA‹ÕŗL{o?y”Įūđ3dÔB\ˇaßüá/u,[”’Ą“{3ļØuäĄpŠđé&~ÔĐīōĶąˇ“ĸĐPå¤ĘeŖÔaÃĸ@Xƒ@8BßčŨŖĖ†$„ŒH”/™[=߉4: Â`!)(q"ßĻŠōŠûĨ>M@kŋ—~ojWģ¨GY]éäĸ†JöĩęëáOß÷[Vo؂Ũ™Ė,|ė›H+.EYžÁ‡‚!|>>ŋoZi¯æŒœ|eŗķôqøÅ÷âåkVŽnäÛ?ũÅ%ĨŪąˆˆÆļšÛŽet$ …Už=œ+-‘Œ(Ņ+­%îąĒĻŅÜįĄš/sÂå4¨Ņ´ūŋ0×"Đ3õ[  ĀÄmgKa8J,ģŽnt5ŖąĀ–^}ۊ…î×´xՖœ8;Š7!āķđėCwĮķNÂB [fȆå †đzŊxŧ^BĄyÎ *2 [wKüüģqaĢĢ_ÅũōîŤŽø”äķ›ė:܄gÜ D ˙Ė{PÔ¯JÉۅDKŽÜ1¤šD†@üÔ$Ė˙!Ō:ģąt1âÜ)LRžÉũmC¨Ųt6Č!̉›ˇ&„øøŪgč<ē€ŋú–6Y˛ĸ`ŗÍbÍIB`,@˙--­ņ´Wķ-l“9‚tž~™ŋüė? ‡ôlÕËjųî˙ūĒšeķÕŊ…%úŨŨŒvœHÛ$ްã`Ę6 ´,kķũhŪĨ(ĘF)øš”"–ÖDC&q:K)‰ âQG!āi ņĄŲV | hÍâ'[2”åvÕĒ%02¤ÆBQ˙=öÜŠp¸c$īcŪb\°˛‚ƒ­C4÷{R˛ãž;yĮ§ŋŽÉ¤ŸĻ"Ī"l6Û´saÆ\ö}>^¯5*ĻgZÃ;sėÜųŖ¸ÅV^YÅwöęęWÍg÷–č”dߑ§ ž>x2žj+ö.⋐Kt ø2đeЈs„Ô.ˆ@ĩ&ŠPCRČ!PÎÉąA—g_šĪ•ŋĨ= ˆ‚7ƒ)ų‰xG,æíŠãgŲZ_†9sM&ķÆm+ųá'ĢCŊŨė{ō!.{Õ­úFI&oüÜ3 gMÕđûũqˇũŦēėįˆ“öđØ~Īđ_Ŋl9ßûų˙ąĒaÍī\DD,j(1#ÉX0Ė3OƟGĶ_5=ÛęŊ€ļŅt%ąšĸƒy  ÄM^põŧ#5ņmEáŊąį#c!^8ĶĪ•ë c:ŠÂiãڍËxâØY^|âÖlŲFu]Ôj ä\’æ€é’%kNJĪįĮãõâ÷û §NphįŖėüËīã}Ž­Ģį{?˙?VŦ\ŊĀ=›g’Ü˙Õpz#jĮ—ã•ļ(RŠ/°üŽ …1œ7˜ ĮÜ+!›Â{údpá ŽZŋŒe%ēp¨‘0ūî'ņ)2˜aK7ķ(„ (jšA†††éčč¤ųL =ŊŊø|žüļ),])%;˙ōžš˙wņ>¯j\ˏsĪŌ6ēgŦF˙ąŨi[xĮ‚wæwäËË\ŋŠ.ūüđŽĮh}ųЂô%ŨJĶ"ŒēŨy+l gT™ėvđy¸īū#EØ.žâjžķŋXšÂqqë?úLÚÍŊCnöMĒįϝ•<lĪ}į fBAYncæÜ–k_d|ÅŊA `’ĀŊûÛųû6Rd-ŒŸũĒõ5œęuĶõž|ōî_ōÎOģsÂB}N)¸áø4œnÎļķāĪ…Fn~ãí|öKßÂŧT¯ŗ¨‡¤ŋŋoo[Ú&÷?{M&–Õ¤@(Šü¤ŽY㜏^LÃr[ŧ¸Ež—¤ßØ=æ/Ņ$Ņ€"āÍ­ÂÍŨ迉?ũb\ĢÜKO:Č×dÁ"ūOfNŪË]?øJ\ØEáÃ˙đ9ūßWŋŊt… âV[ߑôVÛŠŽ^^níNŧ ‰É/ŖķĐ;ƒbˆÛâæq?”ȸ7ÆK]#ė<Ų;Ų{ōŠ2‡5e­°ųČ>ŽīŨ™Ô"÷"“N>ķÅW$™ŠœĒŽĻĒė~č.ūú› ęņYöĸ"žōŨ˙á]üXŪ öŧĩÚBžQ†[ŽLØ,5ÉŊ;Ž5lō_ 2? Į‘kąQķSQ"Ĩ õLBÔWëĶŽAįe.DʀĮuSRdá‚U…ąŽrÁĒ NœuķR—žĀ˙Ė}ŋeŚ ”VFxÃŧ1‰8ųÜ#<ō›Ņ}&›ĩlų žųÃ_°nÃĻųč]~s˙?ļ;mö˙įŽŸáėāHüš×&žŌČõ˜§–Ûâ'ŦŠō6ŨuNA÷ėoã`{áî}Å+))ŌS]…‚úÕ⊥rJ3zu‹ŠMȎSĮųÃwū9EØļ]v%?ûテ°(úmP‹„xųš ›ũÁ}.eæQČöb‹÷ÛEfS=˘¤ī @AYnŃe Ũ…ÂĄ_%’’QJ¸w°VĨqVošhŋÚŨŒ”’ŗí<ų§_rķ;?:˙É“4`&ĩÖT5ÂķŊ‡ũ;ŽĮ¯ !xĮû?ʇūū3(ĻÜץËąĖĐŠũDū -Ú}x|rdE|˜ttåQ )˜Ŗ?‘ĸI4͌*BžmķpMÃü:G-% JÜ4‘ŋn×yÎքŨÕÅv|Á0ūĘÇ;ôšyë ĖyG¸ĻϘĪ]ÎãĮõEũ“û÷°|õ:ÎŋęϜSȉ:&ĩi§”\0†û{xôˇ?Ąˇ3QDĶé*æ _˙.W_˙ęėYž?į%}‡Ÿž°šŊwį%"•D€û<žnw>­åŒ­ÁĨŸņ2{N÷åOÚ¨4āöKŠ*ÖS_išĘCŋü>Ãũúē~Ö{>ūģ˜ī¯&Y­§ø]ÜCÜ÷ĶgĮŊwƅMÁ­ˇŨÁ~uˇ!lã‰Û_ßá6?s¸‰Žū¤KGĸ Á€îävBQ9HLn‹„@H4ĄB$ŨÎ7 Ęr Yæ^r‰rÚŠL!Uãh—^ įæķę8U9î¤eĀË#Gē8Ø6ÄĢļÔą~YÉB÷;-6ŗÂÛ/kāgO7Œhü>üųw¸ãž„Ũ ¤ÍVv党Œ‰Ú4>BĖZ{öĄ?Ļ8ŲTWUķŸø{ļlی¯ķŽĒ•XKĘÉk/™ų"IØŧ=g&mģ}cláĨDsP5EĒmņũ(š]Ījįŧw‚Ũ,TëK ‘jSAŨÅįãkY¸…`”ŧ"&pO?ËÆå%8Ŧf–—ņkÖĶ6čc÷é>Nõ¸šsw3Ģ+]\uN jKɡå¸e%EÜ~i#ŋî RJ†û{xčWßįMû9Ŋū[\Øæ2Q™æŊ9ūd4ģČtëúģÛŲņ§_rļ-‘JÁ×ßĀßüÍûp EBx{šQmØË—au•Ŗ˜ķ{ :§$ ZzM´ÚūüĖ~Ą¤dŨ ™Ĩō.ĸĩÚzVëy0ËŒ”čįebˇôÄĮBØ2Æõų9PÍ%%nVÕ¨á7[¤āHތ=w…øãŪVŪyųlf}ģēŌÉęĘFBĒFsŸ‡Žaۇ8Ü>ÄĢ*X[SŒ%ęÂmŦ-áæ-uüõh]Í'øëo~ÄëŪû „ëgĖü™*ÍߍKJũ~;]C1 r`ĮÃŧøÄƒ¨jÂŅĒŦŦŒũíßrÉ%—¤}ŸâīkĮßׁÅY‚ÅYŠÅQ‚ÉbĪ/™lĄ$ÎáĀH/Ŗí/§l>|ēƒ#§;ã΍â_€Ŋ .¤\"ßSSPâf”˜÷^ĶāÚ+‘°œéķđͧ›xįåTēlņ†V“šËK9wyé‚uvē\šž†o€[ô˜ŊæŖûyęž;šū-īKʸ1ۛŅ8Ë-Ļ@YE?Ætw+Ĩ¤éāsė~čn<#‰8E!7Ũpī}Ī{p:§“ãPööFŸ+˜lvL;&[‘.vŠ‚PÅŠ‚” —[-*¨RU‘šŠDĶ˙Ž=×T¤Ļ!Ĩūˇ>ÆPõĪ+“ a˛`˛aļ90;ŠbNIN$ĩڒŦ¯ą`˜{Ÿ9ôŠjˆŖæVĪw" ŽsRXÚ”¸Ė M1)īVUmRēÂĐįãGOžā†Mĩ\ąŽSŽŪßpÁJ|!•ã]#ŧôÜS9ŧâĩw¤6œé åø8€,}7RęK>zHÁô;ÔÛy†÷ũžî–ÔbÎËJŠøčG>—_=‡^i¨A?jĐOm“K⾀ũ?Ą˜ą–Tâ¨ŦCälI¤Ŧĩ…|Ŗ >˜ŌâŪgö3ęK~IAPœ_*ôā@?3ƀQôYĀ~āphŒ¸ĨÆˇĨÅi‰ōjļ¤3fÁ…UíGģyžy€k7ÔrūĒrŦy4ũ8Bnŋx5ŋDhÔīĖ/>ņ V›ƒ‹ox}ĸ-9āo!ˆ30Ũƒũ<ˇũNؓâÉj1+ŧrãrŽ\_MCma¤R˄Ô"Gz y†(Yš“ĩ(ûQRĪéūŖģjŠŠ¨/'Īt°īDkJˇ!ī4!ФDĸhúO(…DBH@BAjęjWDčBˇ'úx HŲąAî1Äméņ‚Ē™.6™ÔGU@< üˆ?Ä_ļķČŅNÎ]^ĘēšÖTģ(säŋãÅ¤đî+×ō‹§8;ĸg™Øũđ]¨j„Ë^u+@Ę´Ú´Čō’›”rFɉ=#ƒØņGŸÛ‘R‰\›W”qķy+âŋMØ_8ĩú&CĒa<M”4lB1eąBÁ8aĶBzöm'0Ō‡#Všįų&ũ'O,Ņ&˙X 2:+)EâÔHwŽĖlˆuųU7âŽ÷ŋΤy—A–1ÄmiŌ2[ˇYÔđŋ M~‰Lœ áˆÆ‘ŽaŽtč1>åN+U.–•QYl§ŌiĨÂiŤä—ugpIc%ۏEô¸ įˇßƒpéMˇÎk_â3šIˇĮé ›Ī=ž'äčķŠĸP_îāuį¯deEjqbíŦđŅԁá>U+˛ŗCĄ˙!¤î`Ôõƒô´ĸŠĮCû—Ö~/Cū¨ÃZL{™8JØlŠú¯Rō$đcā/äE"ˇÅ‰!nK7đi“?Hų/nG ¤Ä$Æ]ŪÞÞԊ Š‡Í‚ĶjĸČjÆa5ᰚą[ĖØ-&jˊ¨/+ÂeĪ}}°Ž!?/ļôsŧk„@db°ësŊ5ĸrÅkŪ<ũÎ6‚ úžŲ8ԍų<ė{ō!ŽîyrBRč*—ëĪ]Îy+ËĶŪ{CŪ‘Yt6 š˛'nČxôŠĮØŊã1ŋû—tŒfü‰íf…bģ‡ÍŒĶfÆeˇ`7'yYF4¤”¨šdÔfx,Ȩ/Œš!4@$%Ėpȝ^í:|ø†ČeCÜ Nī ųV”÷ĄŊ)ļ雤ēãÉښbĘVáDZ EQpXM8mf.ģ…J—ębÛŧXumƒ>vė‰§âŠQSbįÜē2Žv 3äĶEbīã÷ã÷ēšūÍīM H&UÍŌå”ĖŒ@ SZ3dĖįáā3Û9´ķŅ ĸVæ°rũšËš`e9Ę$Á†!wáTx˜Z$„ ŖdĄxj[ķ)}đžxä/ôtwĻlŗYLŦ(wP]lgYąęb;5Ĩvœŗ¨V/Ĩd4fؤkÄOû ÖūĐ8ßŊī 6JÉ]W5¸>Ĩ!? šåG4Hƒ!n1z˙ūŠ-G1}É?ÄÖ*]6ŪpA~¤ojfRéIdpˇ˜Î_YÎëjXVĸg˛šbMŋØuš~žŅũĨįžbĖ;ĘÍīú;Ė–ņëˆSŠŌ8ņ#p “ ÍÄPo7‡vnįå}쉄Sc8KŠ,\ˇĄ–m •˜1åLYČ7‚TUÄ ’ŽŒŽŒ0:ęfÔãÆãö02:ŠÛ=Š×ë!0D"ņų|ņ÷CAÂáV‹ĢU˙mV+UUUTTTPUUE]] X,s&Іa–â62<ȏü…ĮŧĮú´pMŠ“ú2Ģ*]ŦŦpR]lĪZ‚!eEVƊŦ4VÃz]đڇ|īåpûŪ`ŠĐ™ô÷qąIû€ī_$Žm07D>įĪ’ŽœŽ[[BDM¨65ŒYBIXHŦ(€šÄ$LUd<ēÕ$oŋŧ‘ û6âąũh/E]ūœ63WŦ­áŌ5•8ԌļũĄŋŨĶLĮPBë×sËû?…ŨY<ņ B0Ū‹…ˇe+Ė­ŖéžŲNۉÃōxēlfŽŲ°ŒKĢ0ĪĐcuũ-ÅVR™ōZ8ĄŖŖļļv:::čî9K_o===øĮÆ2ėiî˜Mf6oÚÄ+^q×^s vûĖSį•Ŧ܈š(Ío4 /ŋt˜?˙ū—<ũčC„ÃaJ\NÖUšXSmg]M1.[î§É3ĄJɉîQvŸîŖ}Đ—Ž‰”R@*w ¨g@ ‰@ASUTmám‘=…ŗļkˆÛb†â††ö€&ÅkDtE¸æœeÜpîōI§ČrÁÁö!<ØAHÕ×NĖŠā’Æ*nØ\—˛’ސĒq×ŪNžML_–TTņúŋų$Õ+Vį´ß1T5B́į8øĖvúģÛ'l/ļ[¸b] WŦŠÂ2ÅįÉÄĒkngD:hjjĸéTM§NŅŅ҉Ē͆ųd;ˇØéäMˇŨÆošĶ ,˒•įb.šēŪY8âéGæOŋû9M/cMũ2֕[YWUIJŌĸŧˤŲŌīáņãg'Šœ$‚Ā/፠MyŨmīaĶĨ×L{ŪŅ!š>ĮąŊģęéJÛĻÂeeÛĒ*.nŦÄe›Ũ jČÂfU&LšIā7ģ›9ÕëŽŊ  äg5!žÍ…D÷ļŅÍR(Ž"T¯Ÿy7*Ŋ¤û%âĘō˛"VWēxũųõŗú.rED“j"VšdMÕŦSĐŠR2ė Rᚹ'æņŽū´¯ptmY‚DĐ´W¨šy˙Ŧ:”E qˆ¸Í,ˆū ĪQdqŊO(ōũHq‘Uę"—õáŽ^ŗu¯XW3į}…#=ÚÅÆåĨœSĢOk#ęāP{j€úēķ.æÚÛۃ̴<힆û{h>ēæŖûčm?“ļršÅŦ°Ĩޜm 4Tš˛ęԐl:ŋpf€uÄ^#yáŲ6īĩ€vuŖkAÅ-)Ûū…R(ņTûīŋjûۇxũÖzО`‰g›>÷éfk}Û*gõÛŠšÆáŽ*]VVWÎlmútŸ›ßîiAUߖD˛;1] Múæcˆ[Ž0ÄmndIÜ(˛¸ŠDĒæ5BQ_-āfāR ‰9=)U)„*„ $Jôk$UjhBČčmUXI˛…ŧiÛ*ļ­ž{BāŅą÷îoįÆMËYY1ąĖK]#üå`;cĄ„WĄŲfã˛›nåĸë^‹P{:9}x/gŽĸ¯Ŗ%ãąV”;¸¸ĄŠ­+ËãuōrŐ/ČŸÆžĶ}§žeƒÃíà /OADHy`W‹īĪé[û¸Ē!wÁöÖ°€đ¤M´%ņ{†ÕŲdKŅWßj Î$ˇ_˛Š=y’{^lÃnV8§ļtƋ‚ueNŪyųîÜs†_ī:ÅûŽZŨ2šĀYMŧîüzîŪÛ €!ų'āû@Ú^:†¸Ė 1a‹bųu’nN+ˇ_Ō€YĖ. 1ŅĩôšyčHW­Ģaãō’9ÉäĻelZQÆŠ^7;›úøäĢ6E3ÎĸĐ$ėlęMŧ 1K”o°fŽŠÕË4¤j”ÕŽH,ūņn7×m\>Ãl,ã*‡F+61rį˛YxķȄsw3wŊØÆĮ^š‘J—•hHÚ´z!4ÖķēķWđĀÁîÜ}Š÷\ĩžĸ),¸ķęËŲ}ĒŽa?„”ų‹|~…ļh)ܰ~ƒÂA(hÅɏ×u$Ũ^ˇu%6ŗĪY,˜:~,# ĪX˜˙ÛÛJm‰6×eånV5ūr°ƒ+×Wc3›TØ^î‰[mҍSģZ=Nöžg3¯‡Í)ØGô‡ęsņÛ=Íôšį´YÄX‹›œũ§Åúe%lĒ+%VųŋÎÄcŅfrĀ%UlYQFĮŸûöĩÆû=Áq]$ūģvCRr‰đ~ĄE=[įņQH–›AŽŅ&^´p›DhąTPõå6,Or ã‹ČÄŌō§îDjŠá!DŨųßķŠUQË`î#ûg›zņ"l[]ÉŧGŠuuØ}ē/ĩ…˙.rķNdõ4S‡Iū!ī=mîķđƒ'NPå˛ąĸÂI]ŠÚRŊĘûl]î!Ųž“ŅÃ&ŋ>ģs!ų,’nŪROS›ŗŖcėlęãúskĶžŠĮž¸¯[.\Éé^7ĮģGyžšŸ+ÖVOŦ8‘´ãsëJ)sXņ‡ôĩ78ØŸņ‡Z"âf3&š•\KŌ€÷üUSŞM6 åfĐÜįæD›55ÅŦŦp$Ū7ÂaŨ§ûŲP[œļœNΐ &eŠũÚëKÉ"¯H†<ŋģŽa:;õĸ1?ž“i¸OJūW>HŌ2ā 2ā r8ŠĄÍŦPU\DMąJ—2§…r‡r‡—Ũ2 /Ãĉ’Útvį‚Lū_čŲfÎ̝ā`û ģšzŲļē"mītGK>…V3WžŗŒ'ŸåŅ—ē9wy餉ĀpÁĒrž>’2"q;đåY}°%€!n9A›|=¤4yKMÉ܃RwD/úĢ×OĖf’œJ85­pzb=?Đ>H Ŧ˛6h,%RLcēt–tL¯''g÷ŠĢ-$ŋ,Oœžé[>rUCqŗ@~E€IBڈæ`DŖkØG×đD_ ŗ"(učÅ@˝VĘ6ĘƜ6ŠmŠíæyI |ųē*ļV5;v–;.Y=Ģũŧbm5ģNöšæ~ļÖ'‰› ’›–ˇy qˀ!nYG™:ëM¯„¸?õ‘ŽáYeĮ1ä Ō6āÅeˇ°nŲČ2íß甤ÚF‰-ÚõxCUÔâI#l1ąœjŌ+ÕEDŗzLėgĻ}t ûĮ§ ŗ˜ŋ€éozÔØ‚-œHāßM˜īR ÄûŨõTAbb ķ*ĸIŊAŊAȐ(ÃbV(ļ›qŲ,¸lf\vKĘßN›‰"‹ ģńŨjžUūČe–—98;âįĨÎa^ĩeųŦĻSmëĘ8Ō1ÄŅŽ!ŽŨPÃ˛Ib˙ĒKŠpŲ-ą؊\Œ>H˜˙‚}€!nYEĸ[7Sđ°"åúØč}ë ž7Vrn]ų´â’9ŲãF •3Éá¨KIĻö#ūŨÃ>„TM’u$ŨÚJ:Äx‰ųį ķ§[Ĩma$O'Ļŋ—ŧĄøđMÕę“éRŧXƒÍyRŦŒ×ÔE/–˛mZ„#CŪCŪéÕĩ3 ŨbĸČ<‹9úˇB‘Å„ÕlÆfQ°™MØĖ vĢ ģYau….nš”ŧĐÜĪ̎Ŧ˜ų7œW¯‹›^lL›LZĶ$î@˜ŪŅVSʉcZQ\ Îęā‹CÜ ˛‚ύhĶ@ū@bú0ŅÛ|Û ļABtP]lŽŽíԖQ[æ˜4/ßŲ=åSšÃ’ąÍL‰ f…Ã’ą\Oމh’—:‡ŲūRŧœŽ†Úf5\—“IúŧĶ Ü}0äōZ+ü΍ąQJą)…`BŽ“š¨#ŠhnTü28,NĮ…D•_(‚/™ĸefv5õņâ™L&›YBŗIÁjŌÅĐĸ(XĖēˆŽīOreō}­ÃÂĒ$Ņđ#ŅRP‘´Éš <Ųå™ņüđRÁ7ƒ… )ŪōŪX^ߨE/Ĩ¤Ī=FŸ{ŒƒI™¯JŠŦÔÛŠtYŠpÚ¨,ļSé´Ræ°â ęˇy‘š8Q:ĸŽšr$ ЁĘX8ÂXHÅR Ќ…øĮ"ôŽŽŅ=ęOIæE …/IéöģGĸjÛŧĻŽF{ŊE3¯QHŲ( BČÕR°¨AŸ—ŽFŠH"ŅԟSN}Ζ@Dƒˆ†o9b"Ēä`û4ĩJ/mô5ČSļ0ÄÍ`Ą¸_ ņF!ä/‘”Ŗž3ŪxÜc!Üc!R=áu”¨4n cˇ˜Ŗ#hĢYŸfŠ¨m‹É„Å$0'Ydf“H)RŲuh°Yô‘u8ĸ‰Î †ÕäŋUa`8B ĸ ̌%?Š"*cĄpTÄÂ*uÆ÷¤hšņ„üÚLßŧHPļčcGē.ŗ×æ“E5šjŠCČ!¨EĘåRĄF‘ÔIITåY "­7“Ô}ĸ4ĄDG_‘É f2˛f.…^oA…oílņAܓ`ˆ›ÁBō`‘ßŲ°ûŪ'ų7Hą ũ^F?7÷…I ŖcaöˇfˇÜUsŸ‡ž÷`V÷9%ПU‚Œ …EūRün~;SpŽčcJ†œ^kĩĪYĄIQĸ\3QÔĘŅDąĸXJY† „K"‹T ‹…”c,RNŲDĀ\$Ķ IbŠû° HDģ€ ŸRLÚŊR3Mëķ-e q3Xh|ĀKÍTŽšLq‰”\ „ŧ)ęŅŨ U!DDͰæĐĄHŠ"PĨD*BX$˜¨Ž ÉoŦ&Ë΃24:õŽ fHč‰>ffŗGBc‹jvjJ¤D`˛ EuĄ*Å(Ō,¤pJEO -6)…@(ø%"(Đô˙5Å/MjФ*>U*ŊŽ ŊwŦČk䐜†¸äÃĀö蓺Č%Ŋķ4El–R[#ës‘r BÄũĻ…~“’ią0å%Ręåg4ÍĀ"ĨTŌŽĖŖH9Œ ^„2ˆ`č“ĐĢ(ęąPČ˙’ŲėšCž*ƒyăQ†&¯0ÄÍ ßņĪE)„„\frĨĸ™VH!W )W5@šT)’ ‰,CŠYK/A?@â9‚CR0¤Āˆ„¤9ŠÂ¨DŒ •!“ j–ƒģN{¯ntŽ9Ä7ƒBĻ7úØ7ÆR3•¨ZČaRŦ6iŌ,BU3Ÿ%îēĻYT¯6…ŸmšĒÁĩđ…Æ &E¤Ÿ000000(`Œ’7‹CÜ †¸,: q30000Xtâf````°č0ÄÍĀĀĀĀ`Ņaˆ›ÁĸÃ7ƒE‡!n‹CÜ †¸,: q30000Xtâf````°č0ÄÍĀĀĀĀ`Ņaˆ›ÁĸÃ7ƒE‡!n‹CÜ †¸,: q30000Xtâf````°č0ÄÍĀĀĀĀ`Ņaˆ›ÁĸÃ7ƒE‡!n‹CÜ †¸,: q30000Xtâf````°č0ÄÍĀĀĀĀ`Ņaˆ›ÁĸÃ7ƒE‡!n‹Ž˙ĖÂꚋٞIENDŽB`‚golang-github-in-toto-archivista-0.11.1/docs/docs.go000066400000000000000000000372361511066247200222710ustar00rootroot00000000000000// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": { "name": "Archivista Contributors", "url": "https://github.com/in-toto/archivista/issues/new" }, "license": { "url": "https://opensource.org/licenses/Apache-2" }, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/download/{gitoid}": { "get": { "description": "download an attestation", "produces": [ "application/json" ], "summary": "Download", "deprecated": true, "parameters": [ { "type": "string", "description": "gitoid", "name": "gitoid", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dsse.Envelope" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/upload": { "post": { "description": "stores an attestation", "produces": [ "application/json" ], "summary": "Upload", "deprecated": true, "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/api.StoreResponse" } } } } }, "/v1/artifacts": { "get": { "description": "retrieves details about all available Artifacts", "produces": [ "application/json" ], "tags": [ "Artifacts" ], "summary": "List all Artifacts", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "$ref": "#/definitions/artifactstore.Artifact" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/v1/artifacts/{name}": { "get": { "description": "retrieves details about all available versions of a specified artifact", "produces": [ "application/json" ], "tags": [ "Artifacts" ], "summary": "List Artifact Versions", "parameters": [ { "type": "string", "description": "artifact name", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "$ref": "#/definitions/artifactstore.Version" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/v1/artifacts/{name}/{version}": { "get": { "description": "retrieves details about a specified version of an artifact", "produces": [ "application/json" ], "tags": [ "Artifacts" ], "summary": "Artifact Version Details", "parameters": [ { "type": "string", "description": "artifact name", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "version of artifact", "name": "version", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/artifactstore.Version" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error", "schema": { "type": "objecpec" } } } } }, "/v1/download/artifact/{name}/{version}/{distribution}": { "get": { "description": "downloads a specified distribution of an artifact", "produces": [ "application/octet-stream" ], "tags": [ "Artifacts" ], "summary": "Download Artifact", "parameters": [ { "type": "string", "description": "name of artifact", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "version of artifact to download", "name": "version", "in": "path", "required": true }, { "type": "string", "description": "distribution of artifact to download", "name": "distribution", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "file" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/v1/download/{gitoid}": { "get": { "description": "download an attestation", "produces": [ "application/json" ], "tags": [ "attestation" ], "summary": "Download", "parameters": [ { "type": "string", "description": "gitoid", "name": "gitoid", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dsse.Envelope" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/v1/query": { "post": { "description": "GraphQL query", "produces": [ "application/json" ], "tags": [ "graphql" ], "summary": "Query GraphQL", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/archivista.Resolver" } } } } }, "/v1/upload": { "post": { "description": "stores an attestation", "produces": [ "application/json" ], "tags": [ "attestation" ], "summary": "Upload", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/api.StoreResponse" } } } } } }, "definitions": { "api.StoreResponse": { "type": "object", "properties": { "gitoid": { "type": "string" } } }, "archivista.Resolver": { "type": "object" }, "artifactstore.Artifact": { "type": "object", "properties": { "versions": { "type": "object", "additionalProperties": { "$ref": "#/definitions/artifactstore.Version" } } } }, "artifactstore.Distribution": { "type": "object", "properties": { "sha256digest": { "type": "string" } } }, "artifactstore.Version": { "type": "object", "properties": { "description": { "type": "string" }, "distributions": { "type": "object", "additionalProperties": { "$ref": "#/definitions/artifactstore.Distribution" } } } }, "dsse.Envelope": { "type": "object", "properties": { "payload": { "type": "array", "items": { "type": "integer" } }, "payloadType": { "type": "string" }, "signatures": { "type": "array", "items": { "$ref": "#/definitions/dsse.Signature" } } } }, "dsse.Signature": { "type": "object", "properties": { "certificate": { "type": "array", "items": { "type": "integer" } }, "intermediates": { "type": "array", "items": { "type": "array", "items": { "type": "integer" } } }, "keyid": { "type": "string" }, "sig": { "type": "array", "items": { "type": "integer" } }, "timestamps": { "type": "array", "items": { "$ref": "#/definitions/dsse.SignatureTimestamp" } } } }, "dsse.SignatureTimestamp": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "integer" } }, "type": { "$ref": "#/definitions/dsse.SignatureTimestampType" } } }, "dsse.SignatureTimestampType": { "type": "string", "enum": [ "tsp" ], "x-enum-varnames": [ "TimestampRFC3161" ] } } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "v1", Host: "", BasePath: "", Schemes: []string{}, Title: "Archivista API", Description: "Archivista API", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", } func init() { swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) } golang-github-in-toto-archivista-0.11.1/docs/swagger.json000066400000000000000000000357371511066247200233500ustar00rootroot00000000000000{ "swagger": "2.0", "info": { "description": "Archivista API", "title": "Archivista API", "contact": { "name": "Archivista Contributors", "url": "https://github.com/in-toto/archivista/issues/new" }, "license": { "url": "https://opensource.org/licenses/Apache-2" }, "version": "v1" }, "paths": { "/download/{gitoid}": { "get": { "description": "download an attestation", "produces": [ "application/json" ], "summary": "Download", "deprecated": true, "parameters": [ { "type": "string", "description": "gitoid", "name": "gitoid", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dsse.Envelope" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/upload": { "post": { "description": "stores an attestation", "produces": [ "application/json" ], "summary": "Upload", "deprecated": true, "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/api.StoreResponse" } } } } }, "/v1/artifacts": { "get": { "description": "retrieves details about all available Artifacts", "produces": [ "application/json" ], "tags": [ "Artifacts" ], "summary": "List all Artifacts", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "$ref": "#/definitions/artifactstore.Artifact" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/v1/artifacts/{name}": { "get": { "description": "retrieves details about all available versions of a specified artifact", "produces": [ "application/json" ], "tags": [ "Artifacts" ], "summary": "List Artifact Versions", "parameters": [ { "type": "string", "description": "artifact name", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "$ref": "#/definitions/artifactstore.Version" } } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/v1/artifacts/{name}/{version}": { "get": { "description": "retrieves details about a specified version of an artifact", "produces": [ "application/json" ], "tags": [ "Artifacts" ], "summary": "Artifact Version Details", "parameters": [ { "type": "string", "description": "artifact name", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "version of artifact", "name": "version", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/artifactstore.Version" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error", "schema": { "type": "objecpec" } } } } }, "/v1/download/artifact/{name}/{version}/{distribution}": { "get": { "description": "downloads a specified distribution of an artifact", "produces": [ "application/octet-stream" ], "tags": [ "Artifacts" ], "summary": "Download Artifact", "parameters": [ { "type": "string", "description": "name of artifact", "name": "name", "in": "path", "required": true }, { "type": "string", "description": "version of artifact to download", "name": "version", "in": "path", "required": true }, { "type": "string", "description": "distribution of artifact to download", "name": "distribution", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "file" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/v1/download/{gitoid}": { "get": { "description": "download an attestation", "produces": [ "application/json" ], "tags": [ "attestation" ], "summary": "Download", "parameters": [ { "type": "string", "description": "gitoid", "name": "gitoid", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dsse.Envelope" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/v1/query": { "post": { "description": "GraphQL query", "produces": [ "application/json" ], "tags": [ "graphql" ], "summary": "Query GraphQL", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/archivista.Resolver" } } } } }, "/v1/upload": { "post": { "description": "stores an attestation", "produces": [ "application/json" ], "tags": [ "attestation" ], "summary": "Upload", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/api.StoreResponse" } } } } } }, "definitions": { "api.StoreResponse": { "type": "object", "properties": { "gitoid": { "type": "string" } } }, "archivista.Resolver": { "type": "object" }, "artifactstore.Artifact": { "type": "object", "properties": { "versions": { "type": "object", "additionalProperties": { "$ref": "#/definitions/artifactstore.Version" } } } }, "artifactstore.Distribution": { "type": "object", "properties": { "sha256digest": { "type": "string" } } }, "artifactstore.Version": { "type": "object", "properties": { "description": { "type": "string" }, "distributions": { "type": "object", "additionalProperties": { "$ref": "#/definitions/artifactstore.Distribution" } } } }, "dsse.Envelope": { "type": "object", "properties": { "payload": { "type": "array", "items": { "type": "integer" } }, "payloadType": { "type": "string" }, "signatures": { "type": "array", "items": { "$ref": "#/definitions/dsse.Signature" } } } }, "dsse.Signature": { "type": "object", "properties": { "certificate": { "type": "array", "items": { "type": "integer" } }, "intermediates": { "type": "array", "items": { "type": "array", "items": { "type": "integer" } } }, "keyid": { "type": "string" }, "sig": { "type": "array", "items": { "type": "integer" } }, "timestamps": { "type": "array", "items": { "$ref": "#/definitions/dsse.SignatureTimestamp" } } } }, "dsse.SignatureTimestamp": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "integer" } }, "type": { "$ref": "#/definitions/dsse.SignatureTimestampType" } } }, "dsse.SignatureTimestampType": { "type": "string", "enum": [ "tsp" ], "x-enum-varnames": [ "TimestampRFC3161" ] } } }golang-github-in-toto-archivista-0.11.1/docs/swagger.yaml000066400000000000000000000162641511066247200233330ustar00rootroot00000000000000definitions: api.StoreResponse: properties: gitoid: type: string type: object archivista.Resolver: type: object artifactstore.Artifact: properties: versions: additionalProperties: $ref: '#/definitions/artifactstore.Version' type: object type: object artifactstore.Distribution: properties: sha256digest: type: string type: object artifactstore.Version: properties: description: type: string distributions: additionalProperties: $ref: '#/definitions/artifactstore.Distribution' type: object type: object dsse.Envelope: properties: payload: items: type: integer type: array payloadType: type: string signatures: items: $ref: '#/definitions/dsse.Signature' type: array type: object dsse.Signature: properties: certificate: items: type: integer type: array intermediates: items: items: type: integer type: array type: array keyid: type: string sig: items: type: integer type: array timestamps: items: $ref: '#/definitions/dsse.SignatureTimestamp' type: array type: object dsse.SignatureTimestamp: properties: data: items: type: integer type: array type: $ref: '#/definitions/dsse.SignatureTimestampType' type: object dsse.SignatureTimestampType: enum: - tsp type: string x-enum-varnames: - TimestampRFC3161 info: contact: name: Archivista Contributors url: https://github.com/in-toto/archivista/issues/new description: Archivista API license: url: https://opensource.org/licenses/Apache-2 title: Archivista API version: v1 paths: /download/{gitoid}: get: deprecated: true description: download an attestation parameters: - description: gitoid in: path name: gitoid required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/dsse.Envelope' "400": description: Bad Request schema: type: string "404": description: Not Found "500": description: Internal Server Error schema: type: string summary: Download /upload: post: deprecated: true description: stores an attestation produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/api.StoreResponse' summary: Upload /v1/artifacts: get: description: retrieves details about all available Artifacts produces: - application/json responses: "200": description: OK schema: additionalProperties: $ref: '#/definitions/artifactstore.Artifact' type: object "400": description: Bad Request schema: type: string "500": description: Internal Server Error schema: type: string summary: List all Artifacts tags: - Artifacts /v1/artifacts/{name}: get: description: retrieves details about all available versions of a specified artifact parameters: - description: artifact name in: path name: name required: true type: string produces: - application/json responses: "200": description: OK schema: additionalProperties: $ref: '#/definitions/artifactstore.Version' type: object "400": description: Bad Request schema: type: string "500": description: Internal Server Error schema: type: string summary: List Artifact Versions tags: - Artifacts /v1/artifacts/{name}/{version}: get: description: retrieves details about a specified version of an artifact parameters: - description: artifact name in: path name: name required: true type: string - description: version of artifact in: path name: version required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/artifactstore.Version' "400": description: Bad Request schema: type: string "404": description: Not Found "500": description: Internal Server Error schema: type: objecpec summary: Artifact Version Details tags: - Artifacts /v1/download/{gitoid}: get: description: download an attestation parameters: - description: gitoid in: path name: gitoid required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/dsse.Envelope' "400": description: Bad Request schema: type: string "404": description: Not Found "500": description: Internal Server Error schema: type: string summary: Download tags: - attestation /v1/download/artifact/{name}/{version}/{distribution}: get: description: downloads a specified distribution of an artifact parameters: - description: name of artifact in: path name: name required: true type: string - description: version of artifact to download in: path name: version required: true type: string - description: distribution of artifact to download in: path name: distribution required: true type: string produces: - application/octet-stream responses: "200": description: OK schema: type: file "400": description: Bad Request schema: type: string "404": description: Not Found "500": description: Internal Server Error schema: type: string summary: Download Artifact tags: - Artifacts /v1/query: post: description: GraphQL query produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/archivista.Resolver' summary: Query GraphQL tags: - graphql /v1/upload: post: description: stores an attestation produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/api.StoreResponse' summary: Upload tags: - attestation swagger: "2.0" golang-github-in-toto-archivista-0.11.1/ent.graphql000066400000000000000000000441651511066247200222270ustar00rootroot00000000000000directive @goField(forceResolver: Boolean, name: String, omittable: Boolean) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION directive @goModel(model: String, models: [String!], forceGenerate: Boolean) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION type Attestation implements Node { id: ID! type: String! attestationCollection: AttestationCollection! } type AttestationCollection implements Node { id: ID! name: String! attestations: [Attestation!] statement: Statement! } """ AttestationCollectionWhereInput is used for filtering AttestationCollection objects. Input was generated by ent. """ input AttestationCollectionWhereInput { not: AttestationCollectionWhereInput and: [AttestationCollectionWhereInput!] or: [AttestationCollectionWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ name field predicates """ name: String nameNEQ: String nameIn: [String!] nameNotIn: [String!] nameGT: String nameGTE: String nameLT: String nameLTE: String nameContains: String nameHasPrefix: String nameHasSuffix: String nameEqualFold: String nameContainsFold: String """ attestations edge predicates """ hasAttestations: Boolean hasAttestationsWith: [AttestationWhereInput!] """ statement edge predicates """ hasStatement: Boolean hasStatementWith: [StatementWhereInput!] } type AttestationPolicy implements Node { id: ID! name: String! statement: Statement } """ A connection to a list of items. """ type AttestationPolicyConnection { """ A list of edges. """ edges: [AttestationPolicyEdge] """ Information to aid in pagination. """ pageInfo: PageInfo! """ Identifies the total count of items in the connection. """ totalCount: Int! } """ An edge in a connection. """ type AttestationPolicyEdge { """ The item at the end of the edge. """ node: AttestationPolicy """ A cursor for use in pagination. """ cursor: Cursor! } """ AttestationPolicyWhereInput is used for filtering AttestationPolicy objects. Input was generated by ent. """ input AttestationPolicyWhereInput { not: AttestationPolicyWhereInput and: [AttestationPolicyWhereInput!] or: [AttestationPolicyWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ name field predicates """ name: String nameNEQ: String nameIn: [String!] nameNotIn: [String!] nameGT: String nameGTE: String nameLT: String nameLTE: String nameContains: String nameHasPrefix: String nameHasSuffix: String nameEqualFold: String nameContainsFold: String """ statement edge predicates """ hasStatement: Boolean hasStatementWith: [StatementWhereInput!] } """ AttestationWhereInput is used for filtering Attestation objects. Input was generated by ent. """ input AttestationWhereInput { not: AttestationWhereInput and: [AttestationWhereInput!] or: [AttestationWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ type field predicates """ type: String typeNEQ: String typeIn: [String!] typeNotIn: [String!] typeGT: String typeGTE: String typeLT: String typeLTE: String typeContains: String typeHasPrefix: String typeHasSuffix: String typeEqualFold: String typeContainsFold: String """ attestation_collection edge predicates """ hasAttestationCollection: Boolean hasAttestationCollectionWith: [AttestationCollectionWhereInput!] } """ Define a Relay Cursor type: https://relay.dev/graphql/connections.htm#sec-Cursor """ scalar Cursor type Dsse implements Node { id: ID! createdAt: Time gitoidSha256: String! payloadType: String! statement: Statement signatures: [Signature!] payloadDigests: [PayloadDigest!] } """ A connection to a list of items. """ type DsseConnection { """ A list of edges. """ edges: [DsseEdge] """ Information to aid in pagination. """ pageInfo: PageInfo! """ Identifies the total count of items in the connection. """ totalCount: Int! } """ An edge in a connection. """ type DsseEdge { """ The item at the end of the edge. """ node: Dsse """ A cursor for use in pagination. """ cursor: Cursor! } """ Ordering options for Dsse connections """ input DsseOrder { """ The ordering direction. """ direction: OrderDirection! = ASC """ The field by which to order Dsses. """ field: DsseOrderField! } """ Properties by which Dsse connections can be ordered. """ enum DsseOrderField { CREATED_AT } """ DsseWhereInput is used for filtering Dsse objects. Input was generated by ent. """ input DsseWhereInput { not: DsseWhereInput and: [DsseWhereInput!] or: [DsseWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ created_at field predicates """ createdAt: Time createdAtNEQ: Time createdAtIn: [Time!] createdAtNotIn: [Time!] createdAtGT: Time createdAtGTE: Time createdAtLT: Time createdAtLTE: Time createdAtIsNil: Boolean createdAtNotNil: Boolean """ gitoid_sha256 field predicates """ gitoidSha256: String gitoidSha256NEQ: String gitoidSha256In: [String!] gitoidSha256NotIn: [String!] gitoidSha256GT: String gitoidSha256GTE: String gitoidSha256LT: String gitoidSha256LTE: String gitoidSha256Contains: String gitoidSha256HasPrefix: String gitoidSha256HasSuffix: String gitoidSha256EqualFold: String gitoidSha256ContainsFold: String """ payload_type field predicates """ payloadType: String payloadTypeNEQ: String payloadTypeIn: [String!] payloadTypeNotIn: [String!] payloadTypeGT: String payloadTypeGTE: String payloadTypeLT: String payloadTypeLTE: String payloadTypeContains: String payloadTypeHasPrefix: String payloadTypeHasSuffix: String payloadTypeEqualFold: String payloadTypeContainsFold: String """ statement edge predicates """ hasStatement: Boolean hasStatementWith: [StatementWhereInput!] """ signatures edge predicates """ hasSignatures: Boolean hasSignaturesWith: [SignatureWhereInput!] """ payload_digests edge predicates """ hasPayloadDigests: Boolean hasPayloadDigestsWith: [PayloadDigestWhereInput!] } """ An object with an ID. Follows the [Relay Global Object Identification Specification](https://relay.dev/graphql/objectidentification.htm) """ interface Node @goModel(model: "github.com/in-toto/archivista/ent.Noder") { """ The id of the object. """ id: ID! } """ Possible directions in which to order a list of items when provided an `orderBy` argument. """ enum OrderDirection { """ Specifies an ascending order for a given `orderBy` argument. """ ASC """ Specifies a descending order for a given `orderBy` argument. """ DESC } """ Information about pagination in a connection. https://relay.dev/graphql/connections.htm#sec-undefined.PageInfo """ type PageInfo { """ When paginating forwards, are there more items? """ hasNextPage: Boolean! """ When paginating backwards, are there more items? """ hasPreviousPage: Boolean! """ When paginating backwards, the cursor to continue. """ startCursor: Cursor """ When paginating forwards, the cursor to continue. """ endCursor: Cursor } type PayloadDigest implements Node { id: ID! algorithm: String! value: String! dsse: Dsse } """ PayloadDigestWhereInput is used for filtering PayloadDigest objects. Input was generated by ent. """ input PayloadDigestWhereInput { not: PayloadDigestWhereInput and: [PayloadDigestWhereInput!] or: [PayloadDigestWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ algorithm field predicates """ algorithm: String algorithmNEQ: String algorithmIn: [String!] algorithmNotIn: [String!] algorithmGT: String algorithmGTE: String algorithmLT: String algorithmLTE: String algorithmContains: String algorithmHasPrefix: String algorithmHasSuffix: String algorithmEqualFold: String algorithmContainsFold: String """ value field predicates """ value: String valueNEQ: String valueIn: [String!] valueNotIn: [String!] valueGT: String valueGTE: String valueLT: String valueLTE: String valueContains: String valueHasPrefix: String valueHasSuffix: String valueEqualFold: String valueContainsFold: String """ dsse edge predicates """ hasDsse: Boolean hasDsseWith: [DsseWhereInput!] } type Query { """ Fetches an object given its ID. """ node( """ ID of the object. """ id: ID! ): Node """ Lookup nodes by a list of IDs. """ nodes( """ The list of node IDs. """ ids: [ID!]! ): [Node]! attestationPolicies( """ Returns the elements in the list that come after the specified cursor. """ after: Cursor """ Returns the first _n_ elements from the list. """ first: Int """ Returns the elements in the list that come before the specified cursor. """ before: Cursor """ Returns the last _n_ elements from the list. """ last: Int """ Filtering options for AttestationPolicies returned from the connection. """ where: AttestationPolicyWhereInput ): AttestationPolicyConnection! dsses( """ Returns the elements in the list that come after the specified cursor. """ after: Cursor """ Returns the first _n_ elements from the list. """ first: Int """ Returns the elements in the list that come before the specified cursor. """ before: Cursor """ Returns the last _n_ elements from the list. """ last: Int """ Ordering options for Dsses returned from the connection. """ orderBy: DsseOrder """ Filtering options for Dsses returned from the connection. """ where: DsseWhereInput ): DsseConnection! subjects( """ Returns the elements in the list that come after the specified cursor. """ after: Cursor """ Returns the first _n_ elements from the list. """ first: Int """ Returns the elements in the list that come before the specified cursor. """ before: Cursor """ Returns the last _n_ elements from the list. """ last: Int """ Ordering options for Subjects returned from the connection. """ orderBy: SubjectOrder """ Filtering options for Subjects returned from the connection. """ where: SubjectWhereInput ): SubjectConnection! } type Signature implements Node { id: ID! keyID: String! signature: String! dsse: Dsse timestamps: [Timestamp!] } """ SignatureWhereInput is used for filtering Signature objects. Input was generated by ent. """ input SignatureWhereInput { not: SignatureWhereInput and: [SignatureWhereInput!] or: [SignatureWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ key_id field predicates """ keyID: String keyIDNEQ: String keyIDIn: [String!] keyIDNotIn: [String!] keyIDGT: String keyIDGTE: String keyIDLT: String keyIDLTE: String keyIDContains: String keyIDHasPrefix: String keyIDHasSuffix: String keyIDEqualFold: String keyIDContainsFold: String """ signature field predicates """ signature: String signatureNEQ: String signatureIn: [String!] signatureNotIn: [String!] signatureGT: String signatureGTE: String signatureLT: String signatureLTE: String signatureContains: String signatureHasPrefix: String signatureHasSuffix: String signatureEqualFold: String signatureContainsFold: String """ dsse edge predicates """ hasDsse: Boolean hasDsseWith: [DsseWhereInput!] """ timestamps edge predicates """ hasTimestamps: Boolean hasTimestampsWith: [TimestampWhereInput!] } type Statement implements Node { id: ID! predicate: String! subjects( """ Returns the elements in the list that come after the specified cursor. """ after: Cursor """ Returns the first _n_ elements from the list. """ first: Int """ Returns the elements in the list that come before the specified cursor. """ before: Cursor """ Returns the last _n_ elements from the list. """ last: Int """ Ordering options for Subjects returned from the connection. """ orderBy: SubjectOrder """ Filtering options for Subjects returned from the connection. """ where: SubjectWhereInput ): SubjectConnection! policy: AttestationPolicy attestationCollections: AttestationCollection dsse: [Dsse!] } """ StatementWhereInput is used for filtering Statement objects. Input was generated by ent. """ input StatementWhereInput { not: StatementWhereInput and: [StatementWhereInput!] or: [StatementWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ predicate field predicates """ predicate: String predicateNEQ: String predicateIn: [String!] predicateNotIn: [String!] predicateGT: String predicateGTE: String predicateLT: String predicateLTE: String predicateContains: String predicateHasPrefix: String predicateHasSuffix: String predicateEqualFold: String predicateContainsFold: String """ subjects edge predicates """ hasSubjects: Boolean hasSubjectsWith: [SubjectWhereInput!] """ policy edge predicates """ hasPolicy: Boolean hasPolicyWith: [AttestationPolicyWhereInput!] """ attestation_collections edge predicates """ hasAttestationCollections: Boolean hasAttestationCollectionsWith: [AttestationCollectionWhereInput!] """ dsse edge predicates """ hasDsse: Boolean hasDsseWith: [DsseWhereInput!] } type Subject implements Node { id: ID! createdAt: Time name: String! subjectDigests: [SubjectDigest!] statement: Statement } """ A connection to a list of items. """ type SubjectConnection { """ A list of edges. """ edges: [SubjectEdge] """ Information to aid in pagination. """ pageInfo: PageInfo! """ Identifies the total count of items in the connection. """ totalCount: Int! } type SubjectDigest implements Node { id: ID! algorithm: String! value: String! subject: Subject } """ SubjectDigestWhereInput is used for filtering SubjectDigest objects. Input was generated by ent. """ input SubjectDigestWhereInput { not: SubjectDigestWhereInput and: [SubjectDigestWhereInput!] or: [SubjectDigestWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ algorithm field predicates """ algorithm: String algorithmNEQ: String algorithmIn: [String!] algorithmNotIn: [String!] algorithmGT: String algorithmGTE: String algorithmLT: String algorithmLTE: String algorithmContains: String algorithmHasPrefix: String algorithmHasSuffix: String algorithmEqualFold: String algorithmContainsFold: String """ value field predicates """ value: String valueNEQ: String valueIn: [String!] valueNotIn: [String!] valueGT: String valueGTE: String valueLT: String valueLTE: String valueContains: String valueHasPrefix: String valueHasSuffix: String valueEqualFold: String valueContainsFold: String """ subject edge predicates """ hasSubject: Boolean hasSubjectWith: [SubjectWhereInput!] } """ An edge in a connection. """ type SubjectEdge { """ The item at the end of the edge. """ node: Subject """ A cursor for use in pagination. """ cursor: Cursor! } """ Ordering options for Subject connections """ input SubjectOrder { """ The ordering direction. """ direction: OrderDirection! = ASC """ The field by which to order Subjects. """ field: SubjectOrderField! } """ Properties by which Subject connections can be ordered. """ enum SubjectOrderField { CREATED_AT } """ SubjectWhereInput is used for filtering Subject objects. Input was generated by ent. """ input SubjectWhereInput { not: SubjectWhereInput and: [SubjectWhereInput!] or: [SubjectWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ created_at field predicates """ createdAt: Time createdAtNEQ: Time createdAtIn: [Time!] createdAtNotIn: [Time!] createdAtGT: Time createdAtGTE: Time createdAtLT: Time createdAtLTE: Time createdAtIsNil: Boolean createdAtNotNil: Boolean """ name field predicates """ name: String nameNEQ: String nameIn: [String!] nameNotIn: [String!] nameGT: String nameGTE: String nameLT: String nameLTE: String nameContains: String nameHasPrefix: String nameHasSuffix: String nameEqualFold: String nameContainsFold: String """ subject_digests edge predicates """ hasSubjectDigests: Boolean hasSubjectDigestsWith: [SubjectDigestWhereInput!] """ statement edge predicates """ hasStatement: Boolean hasStatementWith: [StatementWhereInput!] } type Timestamp implements Node { id: ID! type: String! timestamp: Time! signature: Signature } """ TimestampWhereInput is used for filtering Timestamp objects. Input was generated by ent. """ input TimestampWhereInput { not: TimestampWhereInput and: [TimestampWhereInput!] or: [TimestampWhereInput!] """ id field predicates """ id: ID idNEQ: ID idIn: [ID!] idNotIn: [ID!] idGT: ID idGTE: ID idLT: ID idLTE: ID """ type field predicates """ type: String typeNEQ: String typeIn: [String!] typeNotIn: [String!] typeGT: String typeGTE: String typeLT: String typeLTE: String typeContains: String typeHasPrefix: String typeHasSuffix: String typeEqualFold: String typeContainsFold: String """ timestamp field predicates """ timestamp: Time timestampNEQ: Time timestampIn: [Time!] timestampNotIn: [Time!] timestampGT: Time timestampGTE: Time timestampLT: Time timestampLTE: Time """ signature edge predicates """ hasSignature: Boolean hasSignatureWith: [SignatureWhereInput!] } golang-github-in-toto-archivista-0.11.1/ent.resolvers.go000066400000000000000000000040221511066247200232050ustar00rootroot00000000000000package archivista // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. // Code generated by github.com/99designs/gqlgen version v0.17.78 import ( "context" "fmt" "entgo.io/contrib/entgql" "github.com/google/uuid" "github.com/in-toto/archivista/ent" ) // Node is the resolver for the node field. func (r *queryResolver) Node(ctx context.Context, id uuid.UUID) (ent.Noder, error) { return r.client.Noder(ctx, id) } // Nodes is the resolver for the nodes field. func (r *queryResolver) Nodes(ctx context.Context, ids []uuid.UUID) ([]ent.Noder, error) { return r.client.Noders(ctx, ids) } // AttestationPolicies is the resolver for the attestationPolicies field. func (r *queryResolver) AttestationPolicies(ctx context.Context, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, where *ent.AttestationPolicyWhereInput) (*ent.AttestationPolicyConnection, error) { panic(fmt.Errorf("not implemented: AttestationPolicies - attestationPolicies")) } // Dsses is the resolver for the dsses field. func (r *queryResolver) Dsses(ctx context.Context, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, orderBy *ent.DsseOrder, where *ent.DsseWhereInput) (*ent.DsseConnection, error) { return r.client.Dsse.Query().Paginate(ctx, after, first, before, last, ent.WithDsseFilter(where.Filter)) } // Subjects is the resolver for the subjects field. func (r *queryResolver) Subjects(ctx context.Context, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, orderBy *ent.SubjectOrder, where *ent.SubjectWhereInput) (*ent.SubjectConnection, error) { return r.client.Subject.Query().Paginate(ctx, after, first, before, last, ent.WithSubjectFilter(where.Filter)) } // Query returns QueryResolver implementation. func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } type queryResolver struct{ *Resolver } golang-github-in-toto-archivista-0.11.1/ent/000077500000000000000000000000001511066247200206355ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/attestation.go000066400000000000000000000121411511066247200235220ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" ) // Attestation is the model entity for the Attestation schema. type Attestation struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Type holds the value of the "type" field. Type string `json:"type,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the AttestationQuery when eager-loading is set. Edges AttestationEdges `json:"edges"` attestation_collection_attestations *uuid.UUID selectValues sql.SelectValues } // AttestationEdges holds the relations/edges for other nodes in the graph. type AttestationEdges struct { // AttestationCollection holds the value of the attestation_collection edge. AttestationCollection *AttestationCollection `json:"attestation_collection,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [1]bool // totalCount holds the count of the edges above. totalCount [1]map[string]int } // AttestationCollectionOrErr returns the AttestationCollection value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e AttestationEdges) AttestationCollectionOrErr() (*AttestationCollection, error) { if e.AttestationCollection != nil { return e.AttestationCollection, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: attestationcollection.Label} } return nil, &NotLoadedError{edge: "attestation_collection"} } // scanValues returns the types for scanning values from sql.Rows. func (*Attestation) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case attestation.FieldType: values[i] = new(sql.NullString) case attestation.FieldID: values[i] = new(uuid.UUID) case attestation.ForeignKeys[0]: // attestation_collection_attestations values[i] = &sql.NullScanner{S: new(uuid.UUID)} default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Attestation fields. func (_m *Attestation) assignValues(columns []string, values []any) 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 attestation.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case attestation.FieldType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field type", values[i]) } else if value.Valid { _m.Type = value.String } case attestation.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field attestation_collection_attestations", values[i]) } else if value.Valid { _m.attestation_collection_attestations = new(uuid.UUID) *_m.attestation_collection_attestations = *value.S.(*uuid.UUID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Attestation. // This includes values selected through modifiers, order, etc. func (_m *Attestation) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QueryAttestationCollection queries the "attestation_collection" edge of the Attestation entity. func (_m *Attestation) QueryAttestationCollection() *AttestationCollectionQuery { return NewAttestationClient(_m.config).QueryAttestationCollection(_m) } // Update returns a builder for updating this Attestation. // Note that you need to call Attestation.Unwrap() before calling this method if this Attestation // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Attestation) Update() *AttestationUpdateOne { return NewAttestationClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Attestation 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 (_m *Attestation) Unwrap() *Attestation { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Attestation is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Attestation) String() string { var builder strings.Builder builder.WriteString("Attestation(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("type=") builder.WriteString(_m.Type) builder.WriteByte(')') return builder.String() } // Attestations is a parsable slice of Attestation. type Attestations []*Attestation golang-github-in-toto-archivista-0.11.1/ent/attestation/000077500000000000000000000000001511066247200231745ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/attestation/attestation.go000066400000000000000000000061141511066247200260640ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package attestation import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the attestation type in the database. Label = "attestation" // 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" // EdgeAttestationCollection holds the string denoting the attestation_collection edge name in mutations. EdgeAttestationCollection = "attestation_collection" // Table holds the table name of the attestation in the database. Table = "attestations" // AttestationCollectionTable is the table that holds the attestation_collection relation/edge. AttestationCollectionTable = "attestations" // AttestationCollectionInverseTable is the table name for the AttestationCollection entity. // It exists in this package in order to avoid circular dependency with the "attestationcollection" package. AttestationCollectionInverseTable = "attestation_collections" // AttestationCollectionColumn is the table column denoting the attestation_collection relation/edge. AttestationCollectionColumn = "attestation_collection_attestations" ) // Columns holds all SQL columns for attestation fields. var Columns = []string{ FieldID, FieldType, } // ForeignKeys holds the SQL foreign-keys that are owned by the "attestations" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "attestation_collection_attestations", } // 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 ( // TypeValidator is a validator for the "type" field. It is called by the builders before save. TypeValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the Attestation queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByType orders the results by the type field. func ByType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldType, opts...).ToFunc() } // ByAttestationCollectionField orders the results by attestation_collection field. func ByAttestationCollectionField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newAttestationCollectionStep(), sql.OrderByField(field, opts...)) } } func newAttestationCollectionStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(AttestationCollectionInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, AttestationCollectionTable, AttestationCollectionColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/attestation/where.go000066400000000000000000000126771511066247200246520ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package attestation import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.Attestation { return predicate.Attestation(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.Attestation { return predicate.Attestation(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.Attestation { return predicate.Attestation(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.Attestation { return predicate.Attestation(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.Attestation { return predicate.Attestation(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.Attestation { return predicate.Attestation(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.Attestation { return predicate.Attestation(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.Attestation { return predicate.Attestation(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.Attestation { return predicate.Attestation(sql.FieldLTE(FieldID, id)) } // Type applies equality check predicate on the "type" field. It's identical to TypeEQ. func Type(v string) predicate.Attestation { return predicate.Attestation(sql.FieldEQ(FieldType, v)) } // TypeEQ applies the EQ predicate on the "type" field. func TypeEQ(v string) predicate.Attestation { return predicate.Attestation(sql.FieldEQ(FieldType, v)) } // TypeNEQ applies the NEQ predicate on the "type" field. func TypeNEQ(v string) predicate.Attestation { return predicate.Attestation(sql.FieldNEQ(FieldType, v)) } // TypeIn applies the In predicate on the "type" field. func TypeIn(vs ...string) predicate.Attestation { return predicate.Attestation(sql.FieldIn(FieldType, vs...)) } // TypeNotIn applies the NotIn predicate on the "type" field. func TypeNotIn(vs ...string) predicate.Attestation { return predicate.Attestation(sql.FieldNotIn(FieldType, vs...)) } // TypeGT applies the GT predicate on the "type" field. func TypeGT(v string) predicate.Attestation { return predicate.Attestation(sql.FieldGT(FieldType, v)) } // TypeGTE applies the GTE predicate on the "type" field. func TypeGTE(v string) predicate.Attestation { return predicate.Attestation(sql.FieldGTE(FieldType, v)) } // TypeLT applies the LT predicate on the "type" field. func TypeLT(v string) predicate.Attestation { return predicate.Attestation(sql.FieldLT(FieldType, v)) } // TypeLTE applies the LTE predicate on the "type" field. func TypeLTE(v string) predicate.Attestation { return predicate.Attestation(sql.FieldLTE(FieldType, v)) } // TypeContains applies the Contains predicate on the "type" field. func TypeContains(v string) predicate.Attestation { return predicate.Attestation(sql.FieldContains(FieldType, v)) } // TypeHasPrefix applies the HasPrefix predicate on the "type" field. func TypeHasPrefix(v string) predicate.Attestation { return predicate.Attestation(sql.FieldHasPrefix(FieldType, v)) } // TypeHasSuffix applies the HasSuffix predicate on the "type" field. func TypeHasSuffix(v string) predicate.Attestation { return predicate.Attestation(sql.FieldHasSuffix(FieldType, v)) } // TypeEqualFold applies the EqualFold predicate on the "type" field. func TypeEqualFold(v string) predicate.Attestation { return predicate.Attestation(sql.FieldEqualFold(FieldType, v)) } // TypeContainsFold applies the ContainsFold predicate on the "type" field. func TypeContainsFold(v string) predicate.Attestation { return predicate.Attestation(sql.FieldContainsFold(FieldType, v)) } // HasAttestationCollection applies the HasEdge predicate on the "attestation_collection" edge. func HasAttestationCollection() predicate.Attestation { return predicate.Attestation(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, AttestationCollectionTable, AttestationCollectionColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasAttestationCollectionWith applies the HasEdge predicate on the "attestation_collection" edge with a given conditions (other predicates). func HasAttestationCollectionWith(preds ...predicate.AttestationCollection) predicate.Attestation { return predicate.Attestation(func(s *sql.Selector) { step := newAttestationCollectionStep() 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.Attestation) predicate.Attestation { return predicate.Attestation(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Attestation) predicate.Attestation { return predicate.Attestation(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Attestation) predicate.Attestation { return predicate.Attestation(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/attestation_create.go000066400000000000000000000161241511066247200250520ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" ) // AttestationCreate is the builder for creating a Attestation entity. type AttestationCreate struct { config mutation *AttestationMutation hooks []Hook } // SetType sets the "type" field. func (_c *AttestationCreate) SetType(v string) *AttestationCreate { _c.mutation.SetType(v) return _c } // SetID sets the "id" field. func (_c *AttestationCreate) SetID(v uuid.UUID) *AttestationCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *AttestationCreate) SetNillableID(v *uuid.UUID) *AttestationCreate { if v != nil { _c.SetID(*v) } return _c } // SetAttestationCollectionID sets the "attestation_collection" edge to the AttestationCollection entity by ID. func (_c *AttestationCreate) SetAttestationCollectionID(id uuid.UUID) *AttestationCreate { _c.mutation.SetAttestationCollectionID(id) return _c } // SetAttestationCollection sets the "attestation_collection" edge to the AttestationCollection entity. func (_c *AttestationCreate) SetAttestationCollection(v *AttestationCollection) *AttestationCreate { return _c.SetAttestationCollectionID(v.ID) } // Mutation returns the AttestationMutation object of the builder. func (_c *AttestationCreate) Mutation() *AttestationMutation { return _c.mutation } // Save creates the Attestation in the database. func (_c *AttestationCreate) Save(ctx context.Context) (*Attestation, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *AttestationCreate) SaveX(ctx context.Context) *Attestation { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *AttestationCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *AttestationCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *AttestationCreate) defaults() { if _, ok := _c.mutation.ID(); !ok { v := attestation.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *AttestationCreate) check() error { if _, ok := _c.mutation.GetType(); !ok { return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "Attestation.type"`)} } if v, ok := _c.mutation.GetType(); ok { if err := attestation.TypeValidator(v); err != nil { return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Attestation.type": %w`, err)} } } if len(_c.mutation.AttestationCollectionIDs()) == 0 { return &ValidationError{Name: "attestation_collection", err: errors.New(`ent: missing required edge "Attestation.attestation_collection"`)} } return nil } func (_c *AttestationCreate) sqlSave(ctx context.Context) (*Attestation, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *AttestationCreate) createSpec() (*Attestation, *sqlgraph.CreateSpec) { var ( _node = &Attestation{config: _c.config} _spec = sqlgraph.NewCreateSpec(attestation.Table, sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.GetType(); ok { _spec.SetField(attestation.FieldType, field.TypeString, value) _node.Type = value } if nodes := _c.mutation.AttestationCollectionIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: attestation.AttestationCollectionTable, Columns: []string{attestation.AttestationCollectionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.attestation_collection_attestations = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // AttestationCreateBulk is the builder for creating many Attestation entities in bulk. type AttestationCreateBulk struct { config err error builders []*AttestationCreate } // Save creates the Attestation entities in the database. func (_c *AttestationCreateBulk) Save(ctx context.Context) ([]*Attestation, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*Attestation, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*AttestationMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *AttestationCreateBulk) SaveX(ctx context.Context) []*Attestation { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *AttestationCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *AttestationCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/attestation_delete.go000066400000000000000000000044611511066247200250520ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/predicate" ) // AttestationDelete is the builder for deleting a Attestation entity. type AttestationDelete struct { config hooks []Hook mutation *AttestationMutation } // Where appends a list predicates to the AttestationDelete builder. func (_d *AttestationDelete) Where(ps ...predicate.Attestation) *AttestationDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *AttestationDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *AttestationDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *AttestationDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(attestation.Table, sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // AttestationDeleteOne is the builder for deleting a single Attestation entity. type AttestationDeleteOne struct { _d *AttestationDelete } // Where appends a list predicates to the AttestationDelete builder. func (_d *AttestationDeleteOne) Where(ps ...predicate.Attestation) *AttestationDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *AttestationDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{attestation.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *AttestationDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/attestation_query.go000066400000000000000000000447141511066247200247620ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/predicate" ) // AttestationQuery is the builder for querying Attestation entities. type AttestationQuery struct { config ctx *QueryContext order []attestation.OrderOption inters []Interceptor predicates []predicate.Attestation withAttestationCollection *AttestationCollectionQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*Attestation) error // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the AttestationQuery builder. func (_q *AttestationQuery) Where(ps ...predicate.Attestation) *AttestationQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *AttestationQuery) Limit(limit int) *AttestationQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *AttestationQuery) Offset(offset int) *AttestationQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *AttestationQuery) Unique(unique bool) *AttestationQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *AttestationQuery) Order(o ...attestation.OrderOption) *AttestationQuery { _q.order = append(_q.order, o...) return _q } // QueryAttestationCollection chains the current query on the "attestation_collection" edge. func (_q *AttestationQuery) QueryAttestationCollection() *AttestationCollectionQuery { query := (&AttestationCollectionClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(attestation.Table, attestation.FieldID, selector), sqlgraph.To(attestationcollection.Table, attestationcollection.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, attestation.AttestationCollectionTable, attestation.AttestationCollectionColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first Attestation entity from the query. // Returns a *NotFoundError when no Attestation was found. func (_q *AttestationQuery) First(ctx context.Context) (*Attestation, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{attestation.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *AttestationQuery) FirstX(ctx context.Context) *Attestation { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first Attestation ID from the query. // Returns a *NotFoundError when no Attestation ID was found. func (_q *AttestationQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{attestation.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *AttestationQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single Attestation entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Attestation entity is found. // Returns a *NotFoundError when no Attestation entities are found. func (_q *AttestationQuery) Only(ctx context.Context) (*Attestation, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{attestation.Label} default: return nil, &NotSingularError{attestation.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *AttestationQuery) OnlyX(ctx context.Context) *Attestation { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only Attestation ID in the query. // Returns a *NotSingularError when more than one Attestation ID is found. // Returns a *NotFoundError when no entities are found. func (_q *AttestationQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{attestation.Label} default: err = &NotSingularError{attestation.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *AttestationQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of Attestations. func (_q *AttestationQuery) All(ctx context.Context) ([]*Attestation, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Attestation, *AttestationQuery]() return withInterceptors[[]*Attestation](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *AttestationQuery) AllX(ctx context.Context) []*Attestation { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of Attestation IDs. func (_q *AttestationQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(attestation.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *AttestationQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *AttestationQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*AttestationQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *AttestationQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *AttestationQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *AttestationQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the AttestationQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *AttestationQuery) Clone() *AttestationQuery { if _q == nil { return nil } return &AttestationQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]attestation.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.Attestation{}, _q.predicates...), withAttestationCollection: _q.withAttestationCollection.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithAttestationCollection tells the query-builder to eager-load the nodes that are connected to // the "attestation_collection" edge. The optional arguments are used to configure the query builder of the edge. func (_q *AttestationQuery) WithAttestationCollection(opts ...func(*AttestationCollectionQuery)) *AttestationQuery { query := (&AttestationCollectionClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withAttestationCollection = query return _q } // 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.Attestation.Query(). // GroupBy(attestation.FieldType). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *AttestationQuery) GroupBy(field string, fields ...string) *AttestationGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &AttestationGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = attestation.Label grbuild.scan = grbuild.Scan return grbuild } // 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.Attestation.Query(). // Select(attestation.FieldType). // Scan(ctx, &v) func (_q *AttestationQuery) Select(fields ...string) *AttestationSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &AttestationSelect{AttestationQuery: _q} sbuild.label = attestation.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a AttestationSelect configured with the given aggregations. func (_q *AttestationQuery) Aggregate(fns ...AggregateFunc) *AttestationSelect { return _q.Select().Aggregate(fns...) } func (_q *AttestationQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !attestation.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *AttestationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Attestation, error) { var ( nodes = []*Attestation{} withFKs = _q.withFKs _spec = _q.querySpec() loadedTypes = [1]bool{ _q.withAttestationCollection != nil, } ) if _q.withAttestationCollection != nil { withFKs = true } if withFKs { _spec.Node.Columns = append(_spec.Node.Columns, attestation.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]any, error) { return (*Attestation).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &Attestation{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withAttestationCollection; query != nil { if err := _q.loadAttestationCollection(ctx, query, nodes, nil, func(n *Attestation, e *AttestationCollection) { n.Edges.AttestationCollection = e }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *AttestationQuery) loadAttestationCollection(ctx context.Context, query *AttestationCollectionQuery, nodes []*Attestation, init func(*Attestation), assign func(*Attestation, *AttestationCollection)) error { ids := make([]uuid.UUID, 0, len(nodes)) nodeids := make(map[uuid.UUID][]*Attestation) for i := range nodes { if nodes[i].attestation_collection_attestations == nil { continue } fk := *nodes[i].attestation_collection_attestations if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(attestationcollection.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "attestation_collection_attestations" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil } func (_q *AttestationQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *AttestationQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(attestation.Table, attestation.Columns, sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, attestation.FieldID) for i := range fields { if fields[i] != attestation.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *AttestationQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(attestation.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = attestation.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // AttestationGroupBy is the group-by builder for Attestation entities. type AttestationGroupBy struct { selector build *AttestationQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *AttestationGroupBy) Aggregate(fns ...AggregateFunc) *AttestationGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *AttestationGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*AttestationQuery, *AttestationGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *AttestationGroupBy) sqlScan(ctx context.Context, root *AttestationQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // AttestationSelect is the builder for selecting fields of Attestation entities. type AttestationSelect struct { *AttestationQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *AttestationSelect) Aggregate(fns ...AggregateFunc) *AttestationSelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *AttestationSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*AttestationQuery, *AttestationSelect](ctx, _s.AttestationQuery, _s, _s.inters, v) } func (_s *AttestationSelect) sqlScan(ctx context.Context, root *AttestationQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/attestation_update.go000066400000000000000000000253251511066247200250740ustar00rootroot00000000000000// Code generated by ent, 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/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/predicate" ) // AttestationUpdate is the builder for updating Attestation entities. type AttestationUpdate struct { config hooks []Hook mutation *AttestationMutation } // Where appends a list predicates to the AttestationUpdate builder. func (_u *AttestationUpdate) Where(ps ...predicate.Attestation) *AttestationUpdate { _u.mutation.Where(ps...) return _u } // SetType sets the "type" field. func (_u *AttestationUpdate) SetType(v string) *AttestationUpdate { _u.mutation.SetType(v) return _u } // SetNillableType sets the "type" field if the given value is not nil. func (_u *AttestationUpdate) SetNillableType(v *string) *AttestationUpdate { if v != nil { _u.SetType(*v) } return _u } // SetAttestationCollectionID sets the "attestation_collection" edge to the AttestationCollection entity by ID. func (_u *AttestationUpdate) SetAttestationCollectionID(id uuid.UUID) *AttestationUpdate { _u.mutation.SetAttestationCollectionID(id) return _u } // SetAttestationCollection sets the "attestation_collection" edge to the AttestationCollection entity. func (_u *AttestationUpdate) SetAttestationCollection(v *AttestationCollection) *AttestationUpdate { return _u.SetAttestationCollectionID(v.ID) } // Mutation returns the AttestationMutation object of the builder. func (_u *AttestationUpdate) Mutation() *AttestationMutation { return _u.mutation } // ClearAttestationCollection clears the "attestation_collection" edge to the AttestationCollection entity. func (_u *AttestationUpdate) ClearAttestationCollection() *AttestationUpdate { _u.mutation.ClearAttestationCollection() return _u } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *AttestationUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *AttestationUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *AttestationUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *AttestationUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *AttestationUpdate) check() error { if v, ok := _u.mutation.GetType(); ok { if err := attestation.TypeValidator(v); err != nil { return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Attestation.type": %w`, err)} } } if _u.mutation.AttestationCollectionCleared() && len(_u.mutation.AttestationCollectionIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "Attestation.attestation_collection"`) } return nil } func (_u *AttestationUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(attestation.Table, attestation.Columns, sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.GetType(); ok { _spec.SetField(attestation.FieldType, field.TypeString, value) } if _u.mutation.AttestationCollectionCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: attestation.AttestationCollectionTable, Columns: []string{attestation.AttestationCollectionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AttestationCollectionIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: attestation.AttestationCollectionTable, Columns: []string{attestation.AttestationCollectionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{attestation.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // AttestationUpdateOne is the builder for updating a single Attestation entity. type AttestationUpdateOne struct { config fields []string hooks []Hook mutation *AttestationMutation } // SetType sets the "type" field. func (_u *AttestationUpdateOne) SetType(v string) *AttestationUpdateOne { _u.mutation.SetType(v) return _u } // SetNillableType sets the "type" field if the given value is not nil. func (_u *AttestationUpdateOne) SetNillableType(v *string) *AttestationUpdateOne { if v != nil { _u.SetType(*v) } return _u } // SetAttestationCollectionID sets the "attestation_collection" edge to the AttestationCollection entity by ID. func (_u *AttestationUpdateOne) SetAttestationCollectionID(id uuid.UUID) *AttestationUpdateOne { _u.mutation.SetAttestationCollectionID(id) return _u } // SetAttestationCollection sets the "attestation_collection" edge to the AttestationCollection entity. func (_u *AttestationUpdateOne) SetAttestationCollection(v *AttestationCollection) *AttestationUpdateOne { return _u.SetAttestationCollectionID(v.ID) } // Mutation returns the AttestationMutation object of the builder. func (_u *AttestationUpdateOne) Mutation() *AttestationMutation { return _u.mutation } // ClearAttestationCollection clears the "attestation_collection" edge to the AttestationCollection entity. func (_u *AttestationUpdateOne) ClearAttestationCollection() *AttestationUpdateOne { _u.mutation.ClearAttestationCollection() return _u } // Where appends a list predicates to the AttestationUpdate builder. func (_u *AttestationUpdateOne) Where(ps ...predicate.Attestation) *AttestationUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *AttestationUpdateOne) Select(field string, fields ...string) *AttestationUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated Attestation entity. func (_u *AttestationUpdateOne) Save(ctx context.Context) (*Attestation, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *AttestationUpdateOne) SaveX(ctx context.Context) *Attestation { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *AttestationUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *AttestationUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *AttestationUpdateOne) check() error { if v, ok := _u.mutation.GetType(); ok { if err := attestation.TypeValidator(v); err != nil { return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Attestation.type": %w`, err)} } } if _u.mutation.AttestationCollectionCleared() && len(_u.mutation.AttestationCollectionIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "Attestation.attestation_collection"`) } return nil } func (_u *AttestationUpdateOne) sqlSave(ctx context.Context) (_node *Attestation, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(attestation.Table, attestation.Columns, sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Attestation.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, attestation.FieldID) for _, f := range fields { if !attestation.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != attestation.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.GetType(); ok { _spec.SetField(attestation.FieldType, field.TypeString, value) } if _u.mutation.AttestationCollectionCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: attestation.AttestationCollectionTable, Columns: []string{attestation.AttestationCollectionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AttestationCollectionIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: attestation.AttestationCollectionTable, Columns: []string{attestation.AttestationCollectionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &Attestation{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{attestation.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/attestationcollection.go000066400000000000000000000153411511066247200256030ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/statement" ) // AttestationCollection is the model entity for the AttestationCollection schema. type AttestationCollection struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the AttestationCollectionQuery when eager-loading is set. Edges AttestationCollectionEdges `json:"edges"` statement_attestation_collections *uuid.UUID selectValues sql.SelectValues } // AttestationCollectionEdges holds the relations/edges for other nodes in the graph. type AttestationCollectionEdges struct { // Attestations holds the value of the attestations edge. Attestations []*Attestation `json:"attestations,omitempty"` // Statement holds the value of the statement edge. Statement *Statement `json:"statement,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [2]bool // totalCount holds the count of the edges above. totalCount [2]map[string]int namedAttestations map[string][]*Attestation } // AttestationsOrErr returns the Attestations value or an error if the edge // was not loaded in eager-loading. func (e AttestationCollectionEdges) AttestationsOrErr() ([]*Attestation, error) { if e.loadedTypes[0] { return e.Attestations, nil } return nil, &NotLoadedError{edge: "attestations"} } // StatementOrErr returns the Statement value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e AttestationCollectionEdges) StatementOrErr() (*Statement, error) { if e.Statement != nil { return e.Statement, nil } else if e.loadedTypes[1] { return nil, &NotFoundError{label: statement.Label} } return nil, &NotLoadedError{edge: "statement"} } // scanValues returns the types for scanning values from sql.Rows. func (*AttestationCollection) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case attestationcollection.FieldName: values[i] = new(sql.NullString) case attestationcollection.FieldID: values[i] = new(uuid.UUID) case attestationcollection.ForeignKeys[0]: // statement_attestation_collections values[i] = &sql.NullScanner{S: new(uuid.UUID)} default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the AttestationCollection fields. func (_m *AttestationCollection) assignValues(columns []string, values []any) 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 attestationcollection.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case attestationcollection.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { _m.Name = value.String } case attestationcollection.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field statement_attestation_collections", values[i]) } else if value.Valid { _m.statement_attestation_collections = new(uuid.UUID) *_m.statement_attestation_collections = *value.S.(*uuid.UUID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the AttestationCollection. // This includes values selected through modifiers, order, etc. func (_m *AttestationCollection) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QueryAttestations queries the "attestations" edge of the AttestationCollection entity. func (_m *AttestationCollection) QueryAttestations() *AttestationQuery { return NewAttestationCollectionClient(_m.config).QueryAttestations(_m) } // QueryStatement queries the "statement" edge of the AttestationCollection entity. func (_m *AttestationCollection) QueryStatement() *StatementQuery { return NewAttestationCollectionClient(_m.config).QueryStatement(_m) } // Update returns a builder for updating this AttestationCollection. // Note that you need to call AttestationCollection.Unwrap() before calling this method if this AttestationCollection // was returned from a transaction, and the transaction was committed or rolled back. func (_m *AttestationCollection) Update() *AttestationCollectionUpdateOne { return NewAttestationCollectionClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the AttestationCollection 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 (_m *AttestationCollection) Unwrap() *AttestationCollection { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: AttestationCollection is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *AttestationCollection) String() string { var builder strings.Builder builder.WriteString("AttestationCollection(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("name=") builder.WriteString(_m.Name) builder.WriteByte(')') return builder.String() } // NamedAttestations returns the Attestations named value or an error if the edge was not // loaded in eager-loading with this name. func (_m *AttestationCollection) NamedAttestations(name string) ([]*Attestation, error) { if _m.Edges.namedAttestations == nil { return nil, &NotLoadedError{edge: name} } nodes, ok := _m.Edges.namedAttestations[name] if !ok { return nil, &NotLoadedError{edge: name} } return nodes, nil } func (_m *AttestationCollection) appendNamedAttestations(name string, edges ...*Attestation) { if _m.Edges.namedAttestations == nil { _m.Edges.namedAttestations = make(map[string][]*Attestation) } if len(edges) == 0 { _m.Edges.namedAttestations[name] = []*Attestation{} } else { _m.Edges.namedAttestations[name] = append(_m.Edges.namedAttestations[name], edges...) } } // AttestationCollections is a parsable slice of AttestationCollection. type AttestationCollections []*AttestationCollection golang-github-in-toto-archivista-0.11.1/ent/attestationcollection/000077500000000000000000000000001511066247200252505ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/attestationcollection/attestationcollection.go000066400000000000000000000103231511066247200322110ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package attestationcollection import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the attestationcollection type in the database. Label = "attestation_collection" // 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" // EdgeAttestations holds the string denoting the attestations edge name in mutations. EdgeAttestations = "attestations" // EdgeStatement holds the string denoting the statement edge name in mutations. EdgeStatement = "statement" // Table holds the table name of the attestationcollection in the database. Table = "attestation_collections" // AttestationsTable is the table that holds the attestations relation/edge. AttestationsTable = "attestations" // AttestationsInverseTable is the table name for the Attestation entity. // It exists in this package in order to avoid circular dependency with the "attestation" package. AttestationsInverseTable = "attestations" // AttestationsColumn is the table column denoting the attestations relation/edge. AttestationsColumn = "attestation_collection_attestations" // StatementTable is the table that holds the statement relation/edge. StatementTable = "attestation_collections" // StatementInverseTable is the table name for the Statement entity. // It exists in this package in order to avoid circular dependency with the "statement" package. StatementInverseTable = "statements" // StatementColumn is the table column denoting the statement relation/edge. StatementColumn = "statement_attestation_collections" ) // Columns holds all SQL columns for attestationcollection fields. var Columns = []string{ FieldID, FieldName, } // ForeignKeys holds the SQL foreign-keys that are owned by the "attestation_collections" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "statement_attestation_collections", } // 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 ( // NameValidator is a validator for the "name" field. It is called by the builders before save. NameValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the AttestationCollection queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() } // ByAttestationsCount orders the results by attestations count. func ByAttestationsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newAttestationsStep(), opts...) } } // ByAttestations orders the results by attestations terms. func ByAttestations(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newAttestationsStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByStatementField orders the results by statement field. func ByStatementField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newStatementStep(), sql.OrderByField(field, opts...)) } } func newAttestationsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(AttestationsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, AttestationsTable, AttestationsColumn), ) } func newStatementStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(StatementInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2O, true, StatementTable, StatementColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/attestationcollection/where.go000066400000000000000000000153061511066247200267160ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package attestationcollection import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldLTE(FieldID, id)) } // Name applies equality check predicate on the "name" field. It's identical to NameEQ. func Name(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldEQ(FieldName, v)) } // NameEQ applies the EQ predicate on the "name" field. func NameEQ(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldEQ(FieldName, v)) } // NameNEQ applies the NEQ predicate on the "name" field. func NameNEQ(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldNEQ(FieldName, v)) } // NameIn applies the In predicate on the "name" field. func NameIn(vs ...string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldIn(FieldName, vs...)) } // NameNotIn applies the NotIn predicate on the "name" field. func NameNotIn(vs ...string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldNotIn(FieldName, vs...)) } // NameGT applies the GT predicate on the "name" field. func NameGT(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldGT(FieldName, v)) } // NameGTE applies the GTE predicate on the "name" field. func NameGTE(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldGTE(FieldName, v)) } // NameLT applies the LT predicate on the "name" field. func NameLT(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldLT(FieldName, v)) } // NameLTE applies the LTE predicate on the "name" field. func NameLTE(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldLTE(FieldName, v)) } // NameContains applies the Contains predicate on the "name" field. func NameContains(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldContains(FieldName, v)) } // NameHasPrefix applies the HasPrefix predicate on the "name" field. func NameHasPrefix(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldHasPrefix(FieldName, v)) } // NameHasSuffix applies the HasSuffix predicate on the "name" field. func NameHasSuffix(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldHasSuffix(FieldName, v)) } // NameEqualFold applies the EqualFold predicate on the "name" field. func NameEqualFold(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldEqualFold(FieldName, v)) } // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.AttestationCollection { return predicate.AttestationCollection(sql.FieldContainsFold(FieldName, v)) } // HasAttestations applies the HasEdge predicate on the "attestations" edge. func HasAttestations() predicate.AttestationCollection { return predicate.AttestationCollection(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, AttestationsTable, AttestationsColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasAttestationsWith applies the HasEdge predicate on the "attestations" edge with a given conditions (other predicates). func HasAttestationsWith(preds ...predicate.Attestation) predicate.AttestationCollection { return predicate.AttestationCollection(func(s *sql.Selector) { step := newAttestationsStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) }) } // HasStatement applies the HasEdge predicate on the "statement" edge. func HasStatement() predicate.AttestationCollection { return predicate.AttestationCollection(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2O, true, StatementTable, StatementColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasStatementWith applies the HasEdge predicate on the "statement" edge with a given conditions (other predicates). func HasStatementWith(preds ...predicate.Statement) predicate.AttestationCollection { return predicate.AttestationCollection(func(s *sql.Selector) { step := newStatementStep() 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.AttestationCollection) predicate.AttestationCollection { return predicate.AttestationCollection(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.AttestationCollection) predicate.AttestationCollection { return predicate.AttestationCollection(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.AttestationCollection) predicate.AttestationCollection { return predicate.AttestationCollection(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/attestationcollection_create.go000066400000000000000000000207301511066247200271240ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/statement" ) // AttestationCollectionCreate is the builder for creating a AttestationCollection entity. type AttestationCollectionCreate struct { config mutation *AttestationCollectionMutation hooks []Hook } // SetName sets the "name" field. func (_c *AttestationCollectionCreate) SetName(v string) *AttestationCollectionCreate { _c.mutation.SetName(v) return _c } // SetID sets the "id" field. func (_c *AttestationCollectionCreate) SetID(v uuid.UUID) *AttestationCollectionCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *AttestationCollectionCreate) SetNillableID(v *uuid.UUID) *AttestationCollectionCreate { if v != nil { _c.SetID(*v) } return _c } // AddAttestationIDs adds the "attestations" edge to the Attestation entity by IDs. func (_c *AttestationCollectionCreate) AddAttestationIDs(ids ...uuid.UUID) *AttestationCollectionCreate { _c.mutation.AddAttestationIDs(ids...) return _c } // AddAttestations adds the "attestations" edges to the Attestation entity. func (_c *AttestationCollectionCreate) AddAttestations(v ...*Attestation) *AttestationCollectionCreate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _c.AddAttestationIDs(ids...) } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_c *AttestationCollectionCreate) SetStatementID(id uuid.UUID) *AttestationCollectionCreate { _c.mutation.SetStatementID(id) return _c } // SetStatement sets the "statement" edge to the Statement entity. func (_c *AttestationCollectionCreate) SetStatement(v *Statement) *AttestationCollectionCreate { return _c.SetStatementID(v.ID) } // Mutation returns the AttestationCollectionMutation object of the builder. func (_c *AttestationCollectionCreate) Mutation() *AttestationCollectionMutation { return _c.mutation } // Save creates the AttestationCollection in the database. func (_c *AttestationCollectionCreate) Save(ctx context.Context) (*AttestationCollection, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *AttestationCollectionCreate) SaveX(ctx context.Context) *AttestationCollection { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *AttestationCollectionCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *AttestationCollectionCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *AttestationCollectionCreate) defaults() { if _, ok := _c.mutation.ID(); !ok { v := attestationcollection.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *AttestationCollectionCreate) check() error { if _, ok := _c.mutation.Name(); !ok { return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "AttestationCollection.name"`)} } if v, ok := _c.mutation.Name(); ok { if err := attestationcollection.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "AttestationCollection.name": %w`, err)} } } if len(_c.mutation.StatementIDs()) == 0 { return &ValidationError{Name: "statement", err: errors.New(`ent: missing required edge "AttestationCollection.statement"`)} } return nil } func (_c *AttestationCollectionCreate) sqlSave(ctx context.Context) (*AttestationCollection, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *AttestationCollectionCreate) createSpec() (*AttestationCollection, *sqlgraph.CreateSpec) { var ( _node = &AttestationCollection{config: _c.config} _spec = sqlgraph.NewCreateSpec(attestationcollection.Table, sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.Name(); ok { _spec.SetField(attestationcollection.FieldName, field.TypeString, value) _node.Name = value } if nodes := _c.mutation.AttestationsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: attestationcollection.AttestationsTable, Columns: []string{attestationcollection.AttestationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationcollection.StatementTable, Columns: []string{attestationcollection.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.statement_attestation_collections = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // AttestationCollectionCreateBulk is the builder for creating many AttestationCollection entities in bulk. type AttestationCollectionCreateBulk struct { config err error builders []*AttestationCollectionCreate } // Save creates the AttestationCollection entities in the database. func (_c *AttestationCollectionCreateBulk) Save(ctx context.Context) ([]*AttestationCollection, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*AttestationCollection, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*AttestationCollectionMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *AttestationCollectionCreateBulk) SaveX(ctx context.Context) []*AttestationCollection { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *AttestationCollectionCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *AttestationCollectionCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/attestationcollection_delete.go000066400000000000000000000050531511066247200271240ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/predicate" ) // AttestationCollectionDelete is the builder for deleting a AttestationCollection entity. type AttestationCollectionDelete struct { config hooks []Hook mutation *AttestationCollectionMutation } // Where appends a list predicates to the AttestationCollectionDelete builder. func (_d *AttestationCollectionDelete) Where(ps ...predicate.AttestationCollection) *AttestationCollectionDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *AttestationCollectionDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *AttestationCollectionDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *AttestationCollectionDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(attestationcollection.Table, sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // AttestationCollectionDeleteOne is the builder for deleting a single AttestationCollection entity. type AttestationCollectionDeleteOne struct { _d *AttestationCollectionDelete } // Where appends a list predicates to the AttestationCollectionDelete builder. func (_d *AttestationCollectionDeleteOne) Where(ps ...predicate.AttestationCollection) *AttestationCollectionDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *AttestationCollectionDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{attestationcollection.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *AttestationCollectionDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/attestationcollection_query.go000066400000000000000000000563171511066247200270400ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/statement" ) // AttestationCollectionQuery is the builder for querying AttestationCollection entities. type AttestationCollectionQuery struct { config ctx *QueryContext order []attestationcollection.OrderOption inters []Interceptor predicates []predicate.AttestationCollection withAttestations *AttestationQuery withStatement *StatementQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*AttestationCollection) error withNamedAttestations map[string]*AttestationQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the AttestationCollectionQuery builder. func (_q *AttestationCollectionQuery) Where(ps ...predicate.AttestationCollection) *AttestationCollectionQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *AttestationCollectionQuery) Limit(limit int) *AttestationCollectionQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *AttestationCollectionQuery) Offset(offset int) *AttestationCollectionQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *AttestationCollectionQuery) Unique(unique bool) *AttestationCollectionQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *AttestationCollectionQuery) Order(o ...attestationcollection.OrderOption) *AttestationCollectionQuery { _q.order = append(_q.order, o...) return _q } // QueryAttestations chains the current query on the "attestations" edge. func (_q *AttestationCollectionQuery) QueryAttestations() *AttestationQuery { query := (&AttestationClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(attestationcollection.Table, attestationcollection.FieldID, selector), sqlgraph.To(attestation.Table, attestation.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, attestationcollection.AttestationsTable, attestationcollection.AttestationsColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryStatement chains the current query on the "statement" edge. func (_q *AttestationCollectionQuery) QueryStatement() *StatementQuery { query := (&StatementClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(attestationcollection.Table, attestationcollection.FieldID, selector), sqlgraph.To(statement.Table, statement.FieldID), sqlgraph.Edge(sqlgraph.O2O, true, attestationcollection.StatementTable, attestationcollection.StatementColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first AttestationCollection entity from the query. // Returns a *NotFoundError when no AttestationCollection was found. func (_q *AttestationCollectionQuery) First(ctx context.Context) (*AttestationCollection, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{attestationcollection.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *AttestationCollectionQuery) FirstX(ctx context.Context) *AttestationCollection { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first AttestationCollection ID from the query. // Returns a *NotFoundError when no AttestationCollection ID was found. func (_q *AttestationCollectionQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{attestationcollection.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *AttestationCollectionQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single AttestationCollection entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one AttestationCollection entity is found. // Returns a *NotFoundError when no AttestationCollection entities are found. func (_q *AttestationCollectionQuery) Only(ctx context.Context) (*AttestationCollection, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{attestationcollection.Label} default: return nil, &NotSingularError{attestationcollection.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *AttestationCollectionQuery) OnlyX(ctx context.Context) *AttestationCollection { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only AttestationCollection ID in the query. // Returns a *NotSingularError when more than one AttestationCollection ID is found. // Returns a *NotFoundError when no entities are found. func (_q *AttestationCollectionQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{attestationcollection.Label} default: err = &NotSingularError{attestationcollection.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *AttestationCollectionQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of AttestationCollections. func (_q *AttestationCollectionQuery) All(ctx context.Context) ([]*AttestationCollection, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*AttestationCollection, *AttestationCollectionQuery]() return withInterceptors[[]*AttestationCollection](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *AttestationCollectionQuery) AllX(ctx context.Context) []*AttestationCollection { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of AttestationCollection IDs. func (_q *AttestationCollectionQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(attestationcollection.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *AttestationCollectionQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *AttestationCollectionQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*AttestationCollectionQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *AttestationCollectionQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *AttestationCollectionQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *AttestationCollectionQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the AttestationCollectionQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *AttestationCollectionQuery) Clone() *AttestationCollectionQuery { if _q == nil { return nil } return &AttestationCollectionQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]attestationcollection.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.AttestationCollection{}, _q.predicates...), withAttestations: _q.withAttestations.Clone(), withStatement: _q.withStatement.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithAttestations tells the query-builder to eager-load the nodes that are connected to // the "attestations" edge. The optional arguments are used to configure the query builder of the edge. func (_q *AttestationCollectionQuery) WithAttestations(opts ...func(*AttestationQuery)) *AttestationCollectionQuery { query := (&AttestationClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withAttestations = query return _q } // WithStatement tells the query-builder to eager-load the nodes that are connected to // the "statement" edge. The optional arguments are used to configure the query builder of the edge. func (_q *AttestationCollectionQuery) WithStatement(opts ...func(*StatementQuery)) *AttestationCollectionQuery { query := (&StatementClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withStatement = query return _q } // 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.AttestationCollection.Query(). // GroupBy(attestationcollection.FieldName). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *AttestationCollectionQuery) GroupBy(field string, fields ...string) *AttestationCollectionGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &AttestationCollectionGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = attestationcollection.Label grbuild.scan = grbuild.Scan return grbuild } // 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.AttestationCollection.Query(). // Select(attestationcollection.FieldName). // Scan(ctx, &v) func (_q *AttestationCollectionQuery) Select(fields ...string) *AttestationCollectionSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &AttestationCollectionSelect{AttestationCollectionQuery: _q} sbuild.label = attestationcollection.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a AttestationCollectionSelect configured with the given aggregations. func (_q *AttestationCollectionQuery) Aggregate(fns ...AggregateFunc) *AttestationCollectionSelect { return _q.Select().Aggregate(fns...) } func (_q *AttestationCollectionQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !attestationcollection.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *AttestationCollectionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AttestationCollection, error) { var ( nodes = []*AttestationCollection{} withFKs = _q.withFKs _spec = _q.querySpec() loadedTypes = [2]bool{ _q.withAttestations != nil, _q.withStatement != nil, } ) if _q.withStatement != nil { withFKs = true } if withFKs { _spec.Node.Columns = append(_spec.Node.Columns, attestationcollection.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]any, error) { return (*AttestationCollection).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &AttestationCollection{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withAttestations; query != nil { if err := _q.loadAttestations(ctx, query, nodes, func(n *AttestationCollection) { n.Edges.Attestations = []*Attestation{} }, func(n *AttestationCollection, e *Attestation) { n.Edges.Attestations = append(n.Edges.Attestations, e) }); err != nil { return nil, err } } if query := _q.withStatement; query != nil { if err := _q.loadStatement(ctx, query, nodes, nil, func(n *AttestationCollection, e *Statement) { n.Edges.Statement = e }); err != nil { return nil, err } } for name, query := range _q.withNamedAttestations { if err := _q.loadAttestations(ctx, query, nodes, func(n *AttestationCollection) { n.appendNamedAttestations(name) }, func(n *AttestationCollection, e *Attestation) { n.appendNamedAttestations(name, e) }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *AttestationCollectionQuery) loadAttestations(ctx context.Context, query *AttestationQuery, nodes []*AttestationCollection, init func(*AttestationCollection), assign func(*AttestationCollection, *Attestation)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[uuid.UUID]*AttestationCollection) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] if init != nil { init(nodes[i]) } } query.withFKs = true query.Where(predicate.Attestation(func(s *sql.Selector) { s.Where(sql.InValues(s.C(attestationcollection.AttestationsColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.attestation_collection_attestations if fk == nil { return fmt.Errorf(`foreign-key "attestation_collection_attestations" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "attestation_collection_attestations" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil } func (_q *AttestationCollectionQuery) loadStatement(ctx context.Context, query *StatementQuery, nodes []*AttestationCollection, init func(*AttestationCollection), assign func(*AttestationCollection, *Statement)) error { ids := make([]uuid.UUID, 0, len(nodes)) nodeids := make(map[uuid.UUID][]*AttestationCollection) for i := range nodes { if nodes[i].statement_attestation_collections == nil { continue } fk := *nodes[i].statement_attestation_collections if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(statement.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "statement_attestation_collections" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil } func (_q *AttestationCollectionQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *AttestationCollectionQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(attestationcollection.Table, attestationcollection.Columns, sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, attestationcollection.FieldID) for i := range fields { if fields[i] != attestationcollection.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *AttestationCollectionQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(attestationcollection.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = attestationcollection.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // WithNamedAttestations tells the query-builder to eager-load the nodes that are connected to the "attestations" // edge with the given name. The optional arguments are used to configure the query builder of the edge. func (_q *AttestationCollectionQuery) WithNamedAttestations(name string, opts ...func(*AttestationQuery)) *AttestationCollectionQuery { query := (&AttestationClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } if _q.withNamedAttestations == nil { _q.withNamedAttestations = make(map[string]*AttestationQuery) } _q.withNamedAttestations[name] = query return _q } // AttestationCollectionGroupBy is the group-by builder for AttestationCollection entities. type AttestationCollectionGroupBy struct { selector build *AttestationCollectionQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *AttestationCollectionGroupBy) Aggregate(fns ...AggregateFunc) *AttestationCollectionGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *AttestationCollectionGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*AttestationCollectionQuery, *AttestationCollectionGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *AttestationCollectionGroupBy) sqlScan(ctx context.Context, root *AttestationCollectionQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // AttestationCollectionSelect is the builder for selecting fields of AttestationCollection entities. type AttestationCollectionSelect struct { *AttestationCollectionQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *AttestationCollectionSelect) Aggregate(fns ...AggregateFunc) *AttestationCollectionSelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *AttestationCollectionSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*AttestationCollectionQuery, *AttestationCollectionSelect](ctx, _s.AttestationCollectionQuery, _s, _s.inters, v) } func (_s *AttestationCollectionSelect) sqlScan(ctx context.Context, root *AttestationCollectionQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/attestationcollection_update.go000066400000000000000000000410421511066247200271420ustar00rootroot00000000000000// Code generated by ent, 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/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/statement" ) // AttestationCollectionUpdate is the builder for updating AttestationCollection entities. type AttestationCollectionUpdate struct { config hooks []Hook mutation *AttestationCollectionMutation } // Where appends a list predicates to the AttestationCollectionUpdate builder. func (_u *AttestationCollectionUpdate) Where(ps ...predicate.AttestationCollection) *AttestationCollectionUpdate { _u.mutation.Where(ps...) return _u } // SetName sets the "name" field. func (_u *AttestationCollectionUpdate) SetName(v string) *AttestationCollectionUpdate { _u.mutation.SetName(v) return _u } // SetNillableName sets the "name" field if the given value is not nil. func (_u *AttestationCollectionUpdate) SetNillableName(v *string) *AttestationCollectionUpdate { if v != nil { _u.SetName(*v) } return _u } // AddAttestationIDs adds the "attestations" edge to the Attestation entity by IDs. func (_u *AttestationCollectionUpdate) AddAttestationIDs(ids ...uuid.UUID) *AttestationCollectionUpdate { _u.mutation.AddAttestationIDs(ids...) return _u } // AddAttestations adds the "attestations" edges to the Attestation entity. func (_u *AttestationCollectionUpdate) AddAttestations(v ...*Attestation) *AttestationCollectionUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddAttestationIDs(ids...) } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_u *AttestationCollectionUpdate) SetStatementID(id uuid.UUID) *AttestationCollectionUpdate { _u.mutation.SetStatementID(id) return _u } // SetStatement sets the "statement" edge to the Statement entity. func (_u *AttestationCollectionUpdate) SetStatement(v *Statement) *AttestationCollectionUpdate { return _u.SetStatementID(v.ID) } // Mutation returns the AttestationCollectionMutation object of the builder. func (_u *AttestationCollectionUpdate) Mutation() *AttestationCollectionMutation { return _u.mutation } // ClearAttestations clears all "attestations" edges to the Attestation entity. func (_u *AttestationCollectionUpdate) ClearAttestations() *AttestationCollectionUpdate { _u.mutation.ClearAttestations() return _u } // RemoveAttestationIDs removes the "attestations" edge to Attestation entities by IDs. func (_u *AttestationCollectionUpdate) RemoveAttestationIDs(ids ...uuid.UUID) *AttestationCollectionUpdate { _u.mutation.RemoveAttestationIDs(ids...) return _u } // RemoveAttestations removes "attestations" edges to Attestation entities. func (_u *AttestationCollectionUpdate) RemoveAttestations(v ...*Attestation) *AttestationCollectionUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveAttestationIDs(ids...) } // ClearStatement clears the "statement" edge to the Statement entity. func (_u *AttestationCollectionUpdate) ClearStatement() *AttestationCollectionUpdate { _u.mutation.ClearStatement() return _u } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *AttestationCollectionUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *AttestationCollectionUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *AttestationCollectionUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *AttestationCollectionUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *AttestationCollectionUpdate) check() error { if v, ok := _u.mutation.Name(); ok { if err := attestationcollection.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "AttestationCollection.name": %w`, err)} } } if _u.mutation.StatementCleared() && len(_u.mutation.StatementIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "AttestationCollection.statement"`) } return nil } func (_u *AttestationCollectionUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(attestationcollection.Table, attestationcollection.Columns, sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Name(); ok { _spec.SetField(attestationcollection.FieldName, field.TypeString, value) } if _u.mutation.AttestationsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: attestationcollection.AttestationsTable, Columns: []string{attestationcollection.AttestationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedAttestationsIDs(); len(nodes) > 0 && !_u.mutation.AttestationsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: attestationcollection.AttestationsTable, Columns: []string{attestationcollection.AttestationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AttestationsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: attestationcollection.AttestationsTable, Columns: []string{attestationcollection.AttestationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.StatementCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationcollection.StatementTable, Columns: []string{attestationcollection.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationcollection.StatementTable, Columns: []string{attestationcollection.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{attestationcollection.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // AttestationCollectionUpdateOne is the builder for updating a single AttestationCollection entity. type AttestationCollectionUpdateOne struct { config fields []string hooks []Hook mutation *AttestationCollectionMutation } // SetName sets the "name" field. func (_u *AttestationCollectionUpdateOne) SetName(v string) *AttestationCollectionUpdateOne { _u.mutation.SetName(v) return _u } // SetNillableName sets the "name" field if the given value is not nil. func (_u *AttestationCollectionUpdateOne) SetNillableName(v *string) *AttestationCollectionUpdateOne { if v != nil { _u.SetName(*v) } return _u } // AddAttestationIDs adds the "attestations" edge to the Attestation entity by IDs. func (_u *AttestationCollectionUpdateOne) AddAttestationIDs(ids ...uuid.UUID) *AttestationCollectionUpdateOne { _u.mutation.AddAttestationIDs(ids...) return _u } // AddAttestations adds the "attestations" edges to the Attestation entity. func (_u *AttestationCollectionUpdateOne) AddAttestations(v ...*Attestation) *AttestationCollectionUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddAttestationIDs(ids...) } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_u *AttestationCollectionUpdateOne) SetStatementID(id uuid.UUID) *AttestationCollectionUpdateOne { _u.mutation.SetStatementID(id) return _u } // SetStatement sets the "statement" edge to the Statement entity. func (_u *AttestationCollectionUpdateOne) SetStatement(v *Statement) *AttestationCollectionUpdateOne { return _u.SetStatementID(v.ID) } // Mutation returns the AttestationCollectionMutation object of the builder. func (_u *AttestationCollectionUpdateOne) Mutation() *AttestationCollectionMutation { return _u.mutation } // ClearAttestations clears all "attestations" edges to the Attestation entity. func (_u *AttestationCollectionUpdateOne) ClearAttestations() *AttestationCollectionUpdateOne { _u.mutation.ClearAttestations() return _u } // RemoveAttestationIDs removes the "attestations" edge to Attestation entities by IDs. func (_u *AttestationCollectionUpdateOne) RemoveAttestationIDs(ids ...uuid.UUID) *AttestationCollectionUpdateOne { _u.mutation.RemoveAttestationIDs(ids...) return _u } // RemoveAttestations removes "attestations" edges to Attestation entities. func (_u *AttestationCollectionUpdateOne) RemoveAttestations(v ...*Attestation) *AttestationCollectionUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveAttestationIDs(ids...) } // ClearStatement clears the "statement" edge to the Statement entity. func (_u *AttestationCollectionUpdateOne) ClearStatement() *AttestationCollectionUpdateOne { _u.mutation.ClearStatement() return _u } // Where appends a list predicates to the AttestationCollectionUpdate builder. func (_u *AttestationCollectionUpdateOne) Where(ps ...predicate.AttestationCollection) *AttestationCollectionUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *AttestationCollectionUpdateOne) Select(field string, fields ...string) *AttestationCollectionUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated AttestationCollection entity. func (_u *AttestationCollectionUpdateOne) Save(ctx context.Context) (*AttestationCollection, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *AttestationCollectionUpdateOne) SaveX(ctx context.Context) *AttestationCollection { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *AttestationCollectionUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *AttestationCollectionUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *AttestationCollectionUpdateOne) check() error { if v, ok := _u.mutation.Name(); ok { if err := attestationcollection.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "AttestationCollection.name": %w`, err)} } } if _u.mutation.StatementCleared() && len(_u.mutation.StatementIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "AttestationCollection.statement"`) } return nil } func (_u *AttestationCollectionUpdateOne) sqlSave(ctx context.Context) (_node *AttestationCollection, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(attestationcollection.Table, attestationcollection.Columns, sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AttestationCollection.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, attestationcollection.FieldID) for _, f := range fields { if !attestationcollection.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != attestationcollection.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Name(); ok { _spec.SetField(attestationcollection.FieldName, field.TypeString, value) } if _u.mutation.AttestationsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: attestationcollection.AttestationsTable, Columns: []string{attestationcollection.AttestationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedAttestationsIDs(); len(nodes) > 0 && !_u.mutation.AttestationsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: attestationcollection.AttestationsTable, Columns: []string{attestationcollection.AttestationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AttestationsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: attestationcollection.AttestationsTable, Columns: []string{attestationcollection.AttestationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestation.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.StatementCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationcollection.StatementTable, Columns: []string{attestationcollection.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationcollection.StatementTable, Columns: []string{attestationcollection.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &AttestationCollection{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{attestationcollection.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/attestationpolicy.go000066400000000000000000000117401511066247200247460ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/statement" ) // AttestationPolicy is the model entity for the AttestationPolicy schema. type AttestationPolicy struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the AttestationPolicyQuery when eager-loading is set. Edges AttestationPolicyEdges `json:"edges"` statement_policy *uuid.UUID selectValues sql.SelectValues } // AttestationPolicyEdges holds the relations/edges for other nodes in the graph. type AttestationPolicyEdges struct { // Statement holds the value of the statement edge. Statement *Statement `json:"statement,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [1]bool // totalCount holds the count of the edges above. totalCount [1]map[string]int } // StatementOrErr returns the Statement value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e AttestationPolicyEdges) StatementOrErr() (*Statement, error) { if e.Statement != nil { return e.Statement, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: statement.Label} } return nil, &NotLoadedError{edge: "statement"} } // scanValues returns the types for scanning values from sql.Rows. func (*AttestationPolicy) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case attestationpolicy.FieldName: values[i] = new(sql.NullString) case attestationpolicy.FieldID: values[i] = new(uuid.UUID) case attestationpolicy.ForeignKeys[0]: // statement_policy values[i] = &sql.NullScanner{S: new(uuid.UUID)} default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the AttestationPolicy fields. func (_m *AttestationPolicy) assignValues(columns []string, values []any) 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 attestationpolicy.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case attestationpolicy.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { _m.Name = value.String } case attestationpolicy.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field statement_policy", values[i]) } else if value.Valid { _m.statement_policy = new(uuid.UUID) *_m.statement_policy = *value.S.(*uuid.UUID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the AttestationPolicy. // This includes values selected through modifiers, order, etc. func (_m *AttestationPolicy) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QueryStatement queries the "statement" edge of the AttestationPolicy entity. func (_m *AttestationPolicy) QueryStatement() *StatementQuery { return NewAttestationPolicyClient(_m.config).QueryStatement(_m) } // Update returns a builder for updating this AttestationPolicy. // Note that you need to call AttestationPolicy.Unwrap() before calling this method if this AttestationPolicy // was returned from a transaction, and the transaction was committed or rolled back. func (_m *AttestationPolicy) Update() *AttestationPolicyUpdateOne { return NewAttestationPolicyClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the AttestationPolicy 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 (_m *AttestationPolicy) Unwrap() *AttestationPolicy { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: AttestationPolicy is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *AttestationPolicy) String() string { var builder strings.Builder builder.WriteString("AttestationPolicy(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("name=") builder.WriteString(_m.Name) builder.WriteByte(')') return builder.String() } // AttestationPolicies is a parsable slice of AttestationPolicy. type AttestationPolicies []*AttestationPolicy golang-github-in-toto-archivista-0.11.1/ent/attestationpolicy/000077500000000000000000000000001511066247200244145ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/attestationpolicy/attestationpolicy.go000066400000000000000000000055111511066247200305240ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package attestationpolicy import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the attestationpolicy type in the database. Label = "attestation_policy" // 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" // EdgeStatement holds the string denoting the statement edge name in mutations. EdgeStatement = "statement" // Table holds the table name of the attestationpolicy in the database. Table = "attestation_policies" // StatementTable is the table that holds the statement relation/edge. StatementTable = "attestation_policies" // StatementInverseTable is the table name for the Statement entity. // It exists in this package in order to avoid circular dependency with the "statement" package. StatementInverseTable = "statements" // StatementColumn is the table column denoting the statement relation/edge. StatementColumn = "statement_policy" ) // Columns holds all SQL columns for attestationpolicy fields. var Columns = []string{ FieldID, FieldName, } // ForeignKeys holds the SQL foreign-keys that are owned by the "attestation_policies" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "statement_policy", } // 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 ( // NameValidator is a validator for the "name" field. It is called by the builders before save. NameValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the AttestationPolicy queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() } // ByStatementField orders the results by statement field. func ByStatementField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newStatementStep(), sql.OrderByField(field, opts...)) } } func newStatementStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(StatementInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2O, true, StatementTable, StatementColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/attestationpolicy/where.go000066400000000000000000000132551511066247200260630ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package attestationpolicy import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldLTE(FieldID, id)) } // Name applies equality check predicate on the "name" field. It's identical to NameEQ. func Name(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldEQ(FieldName, v)) } // NameEQ applies the EQ predicate on the "name" field. func NameEQ(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldEQ(FieldName, v)) } // NameNEQ applies the NEQ predicate on the "name" field. func NameNEQ(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldNEQ(FieldName, v)) } // NameIn applies the In predicate on the "name" field. func NameIn(vs ...string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldIn(FieldName, vs...)) } // NameNotIn applies the NotIn predicate on the "name" field. func NameNotIn(vs ...string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldNotIn(FieldName, vs...)) } // NameGT applies the GT predicate on the "name" field. func NameGT(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldGT(FieldName, v)) } // NameGTE applies the GTE predicate on the "name" field. func NameGTE(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldGTE(FieldName, v)) } // NameLT applies the LT predicate on the "name" field. func NameLT(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldLT(FieldName, v)) } // NameLTE applies the LTE predicate on the "name" field. func NameLTE(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldLTE(FieldName, v)) } // NameContains applies the Contains predicate on the "name" field. func NameContains(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldContains(FieldName, v)) } // NameHasPrefix applies the HasPrefix predicate on the "name" field. func NameHasPrefix(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldHasPrefix(FieldName, v)) } // NameHasSuffix applies the HasSuffix predicate on the "name" field. func NameHasSuffix(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldHasSuffix(FieldName, v)) } // NameEqualFold applies the EqualFold predicate on the "name" field. func NameEqualFold(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldEqualFold(FieldName, v)) } // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.FieldContainsFold(FieldName, v)) } // HasStatement applies the HasEdge predicate on the "statement" edge. func HasStatement() predicate.AttestationPolicy { return predicate.AttestationPolicy(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2O, true, StatementTable, StatementColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasStatementWith applies the HasEdge predicate on the "statement" edge with a given conditions (other predicates). func HasStatementWith(preds ...predicate.Statement) predicate.AttestationPolicy { return predicate.AttestationPolicy(func(s *sql.Selector) { step := newStatementStep() 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.AttestationPolicy) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.AttestationPolicy) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.AttestationPolicy) predicate.AttestationPolicy { return predicate.AttestationPolicy(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/attestationpolicy_create.go000066400000000000000000000164061511066247200262750ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/statement" ) // AttestationPolicyCreate is the builder for creating a AttestationPolicy entity. type AttestationPolicyCreate struct { config mutation *AttestationPolicyMutation hooks []Hook } // SetName sets the "name" field. func (_c *AttestationPolicyCreate) SetName(v string) *AttestationPolicyCreate { _c.mutation.SetName(v) return _c } // SetID sets the "id" field. func (_c *AttestationPolicyCreate) SetID(v uuid.UUID) *AttestationPolicyCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *AttestationPolicyCreate) SetNillableID(v *uuid.UUID) *AttestationPolicyCreate { if v != nil { _c.SetID(*v) } return _c } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_c *AttestationPolicyCreate) SetStatementID(id uuid.UUID) *AttestationPolicyCreate { _c.mutation.SetStatementID(id) return _c } // SetNillableStatementID sets the "statement" edge to the Statement entity by ID if the given value is not nil. func (_c *AttestationPolicyCreate) SetNillableStatementID(id *uuid.UUID) *AttestationPolicyCreate { if id != nil { _c = _c.SetStatementID(*id) } return _c } // SetStatement sets the "statement" edge to the Statement entity. func (_c *AttestationPolicyCreate) SetStatement(v *Statement) *AttestationPolicyCreate { return _c.SetStatementID(v.ID) } // Mutation returns the AttestationPolicyMutation object of the builder. func (_c *AttestationPolicyCreate) Mutation() *AttestationPolicyMutation { return _c.mutation } // Save creates the AttestationPolicy in the database. func (_c *AttestationPolicyCreate) Save(ctx context.Context) (*AttestationPolicy, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *AttestationPolicyCreate) SaveX(ctx context.Context) *AttestationPolicy { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *AttestationPolicyCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *AttestationPolicyCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *AttestationPolicyCreate) defaults() { if _, ok := _c.mutation.ID(); !ok { v := attestationpolicy.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *AttestationPolicyCreate) check() error { if _, ok := _c.mutation.Name(); !ok { return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "AttestationPolicy.name"`)} } if v, ok := _c.mutation.Name(); ok { if err := attestationpolicy.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "AttestationPolicy.name": %w`, err)} } } return nil } func (_c *AttestationPolicyCreate) sqlSave(ctx context.Context) (*AttestationPolicy, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *AttestationPolicyCreate) createSpec() (*AttestationPolicy, *sqlgraph.CreateSpec) { var ( _node = &AttestationPolicy{config: _c.config} _spec = sqlgraph.NewCreateSpec(attestationpolicy.Table, sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.Name(); ok { _spec.SetField(attestationpolicy.FieldName, field.TypeString, value) _node.Name = value } if nodes := _c.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationpolicy.StatementTable, Columns: []string{attestationpolicy.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.statement_policy = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // AttestationPolicyCreateBulk is the builder for creating many AttestationPolicy entities in bulk. type AttestationPolicyCreateBulk struct { config err error builders []*AttestationPolicyCreate } // Save creates the AttestationPolicy entities in the database. func (_c *AttestationPolicyCreateBulk) Save(ctx context.Context) ([]*AttestationPolicy, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*AttestationPolicy, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*AttestationPolicyMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *AttestationPolicyCreateBulk) SaveX(ctx context.Context) []*AttestationPolicy { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *AttestationPolicyCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *AttestationPolicyCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/attestationpolicy_delete.go000066400000000000000000000047071511066247200262750ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/predicate" ) // AttestationPolicyDelete is the builder for deleting a AttestationPolicy entity. type AttestationPolicyDelete struct { config hooks []Hook mutation *AttestationPolicyMutation } // Where appends a list predicates to the AttestationPolicyDelete builder. func (_d *AttestationPolicyDelete) Where(ps ...predicate.AttestationPolicy) *AttestationPolicyDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *AttestationPolicyDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *AttestationPolicyDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *AttestationPolicyDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(attestationpolicy.Table, sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // AttestationPolicyDeleteOne is the builder for deleting a single AttestationPolicy entity. type AttestationPolicyDeleteOne struct { _d *AttestationPolicyDelete } // Where appends a list predicates to the AttestationPolicyDelete builder. func (_d *AttestationPolicyDeleteOne) Where(ps ...predicate.AttestationPolicy) *AttestationPolicyDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *AttestationPolicyDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{attestationpolicy.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *AttestationPolicyDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/attestationpolicy_query.go000066400000000000000000000453421511066247200262000ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/statement" ) // AttestationPolicyQuery is the builder for querying AttestationPolicy entities. type AttestationPolicyQuery struct { config ctx *QueryContext order []attestationpolicy.OrderOption inters []Interceptor predicates []predicate.AttestationPolicy withStatement *StatementQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*AttestationPolicy) error // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the AttestationPolicyQuery builder. func (_q *AttestationPolicyQuery) Where(ps ...predicate.AttestationPolicy) *AttestationPolicyQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *AttestationPolicyQuery) Limit(limit int) *AttestationPolicyQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *AttestationPolicyQuery) Offset(offset int) *AttestationPolicyQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *AttestationPolicyQuery) Unique(unique bool) *AttestationPolicyQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *AttestationPolicyQuery) Order(o ...attestationpolicy.OrderOption) *AttestationPolicyQuery { _q.order = append(_q.order, o...) return _q } // QueryStatement chains the current query on the "statement" edge. func (_q *AttestationPolicyQuery) QueryStatement() *StatementQuery { query := (&StatementClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(attestationpolicy.Table, attestationpolicy.FieldID, selector), sqlgraph.To(statement.Table, statement.FieldID), sqlgraph.Edge(sqlgraph.O2O, true, attestationpolicy.StatementTable, attestationpolicy.StatementColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first AttestationPolicy entity from the query. // Returns a *NotFoundError when no AttestationPolicy was found. func (_q *AttestationPolicyQuery) First(ctx context.Context) (*AttestationPolicy, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{attestationpolicy.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *AttestationPolicyQuery) FirstX(ctx context.Context) *AttestationPolicy { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first AttestationPolicy ID from the query. // Returns a *NotFoundError when no AttestationPolicy ID was found. func (_q *AttestationPolicyQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{attestationpolicy.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *AttestationPolicyQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single AttestationPolicy entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one AttestationPolicy entity is found. // Returns a *NotFoundError when no AttestationPolicy entities are found. func (_q *AttestationPolicyQuery) Only(ctx context.Context) (*AttestationPolicy, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{attestationpolicy.Label} default: return nil, &NotSingularError{attestationpolicy.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *AttestationPolicyQuery) OnlyX(ctx context.Context) *AttestationPolicy { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only AttestationPolicy ID in the query. // Returns a *NotSingularError when more than one AttestationPolicy ID is found. // Returns a *NotFoundError when no entities are found. func (_q *AttestationPolicyQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{attestationpolicy.Label} default: err = &NotSingularError{attestationpolicy.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *AttestationPolicyQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of AttestationPolicies. func (_q *AttestationPolicyQuery) All(ctx context.Context) ([]*AttestationPolicy, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*AttestationPolicy, *AttestationPolicyQuery]() return withInterceptors[[]*AttestationPolicy](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *AttestationPolicyQuery) AllX(ctx context.Context) []*AttestationPolicy { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of AttestationPolicy IDs. func (_q *AttestationPolicyQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(attestationpolicy.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *AttestationPolicyQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *AttestationPolicyQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*AttestationPolicyQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *AttestationPolicyQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *AttestationPolicyQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *AttestationPolicyQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the AttestationPolicyQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *AttestationPolicyQuery) Clone() *AttestationPolicyQuery { if _q == nil { return nil } return &AttestationPolicyQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]attestationpolicy.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.AttestationPolicy{}, _q.predicates...), withStatement: _q.withStatement.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithStatement tells the query-builder to eager-load the nodes that are connected to // the "statement" edge. The optional arguments are used to configure the query builder of the edge. func (_q *AttestationPolicyQuery) WithStatement(opts ...func(*StatementQuery)) *AttestationPolicyQuery { query := (&StatementClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withStatement = query return _q } // 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.AttestationPolicy.Query(). // GroupBy(attestationpolicy.FieldName). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *AttestationPolicyQuery) GroupBy(field string, fields ...string) *AttestationPolicyGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &AttestationPolicyGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = attestationpolicy.Label grbuild.scan = grbuild.Scan return grbuild } // 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.AttestationPolicy.Query(). // Select(attestationpolicy.FieldName). // Scan(ctx, &v) func (_q *AttestationPolicyQuery) Select(fields ...string) *AttestationPolicySelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &AttestationPolicySelect{AttestationPolicyQuery: _q} sbuild.label = attestationpolicy.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a AttestationPolicySelect configured with the given aggregations. func (_q *AttestationPolicyQuery) Aggregate(fns ...AggregateFunc) *AttestationPolicySelect { return _q.Select().Aggregate(fns...) } func (_q *AttestationPolicyQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !attestationpolicy.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *AttestationPolicyQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AttestationPolicy, error) { var ( nodes = []*AttestationPolicy{} withFKs = _q.withFKs _spec = _q.querySpec() loadedTypes = [1]bool{ _q.withStatement != nil, } ) if _q.withStatement != nil { withFKs = true } if withFKs { _spec.Node.Columns = append(_spec.Node.Columns, attestationpolicy.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]any, error) { return (*AttestationPolicy).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &AttestationPolicy{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withStatement; query != nil { if err := _q.loadStatement(ctx, query, nodes, nil, func(n *AttestationPolicy, e *Statement) { n.Edges.Statement = e }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *AttestationPolicyQuery) loadStatement(ctx context.Context, query *StatementQuery, nodes []*AttestationPolicy, init func(*AttestationPolicy), assign func(*AttestationPolicy, *Statement)) error { ids := make([]uuid.UUID, 0, len(nodes)) nodeids := make(map[uuid.UUID][]*AttestationPolicy) for i := range nodes { if nodes[i].statement_policy == nil { continue } fk := *nodes[i].statement_policy if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(statement.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "statement_policy" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil } func (_q *AttestationPolicyQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *AttestationPolicyQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(attestationpolicy.Table, attestationpolicy.Columns, sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, attestationpolicy.FieldID) for i := range fields { if fields[i] != attestationpolicy.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *AttestationPolicyQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(attestationpolicy.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = attestationpolicy.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // AttestationPolicyGroupBy is the group-by builder for AttestationPolicy entities. type AttestationPolicyGroupBy struct { selector build *AttestationPolicyQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *AttestationPolicyGroupBy) Aggregate(fns ...AggregateFunc) *AttestationPolicyGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *AttestationPolicyGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*AttestationPolicyQuery, *AttestationPolicyGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *AttestationPolicyGroupBy) sqlScan(ctx context.Context, root *AttestationPolicyQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // AttestationPolicySelect is the builder for selecting fields of AttestationPolicy entities. type AttestationPolicySelect struct { *AttestationPolicyQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *AttestationPolicySelect) Aggregate(fns ...AggregateFunc) *AttestationPolicySelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *AttestationPolicySelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*AttestationPolicyQuery, *AttestationPolicySelect](ctx, _s.AttestationPolicyQuery, _s, _s.inters, v) } func (_s *AttestationPolicySelect) sqlScan(ctx context.Context, root *AttestationPolicyQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/attestationpolicy_update.go000066400000000000000000000254451511066247200263170ustar00rootroot00000000000000// Code generated by ent, 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/google/uuid" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/statement" ) // AttestationPolicyUpdate is the builder for updating AttestationPolicy entities. type AttestationPolicyUpdate struct { config hooks []Hook mutation *AttestationPolicyMutation } // Where appends a list predicates to the AttestationPolicyUpdate builder. func (_u *AttestationPolicyUpdate) Where(ps ...predicate.AttestationPolicy) *AttestationPolicyUpdate { _u.mutation.Where(ps...) return _u } // SetName sets the "name" field. func (_u *AttestationPolicyUpdate) SetName(v string) *AttestationPolicyUpdate { _u.mutation.SetName(v) return _u } // SetNillableName sets the "name" field if the given value is not nil. func (_u *AttestationPolicyUpdate) SetNillableName(v *string) *AttestationPolicyUpdate { if v != nil { _u.SetName(*v) } return _u } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_u *AttestationPolicyUpdate) SetStatementID(id uuid.UUID) *AttestationPolicyUpdate { _u.mutation.SetStatementID(id) return _u } // SetNillableStatementID sets the "statement" edge to the Statement entity by ID if the given value is not nil. func (_u *AttestationPolicyUpdate) SetNillableStatementID(id *uuid.UUID) *AttestationPolicyUpdate { if id != nil { _u = _u.SetStatementID(*id) } return _u } // SetStatement sets the "statement" edge to the Statement entity. func (_u *AttestationPolicyUpdate) SetStatement(v *Statement) *AttestationPolicyUpdate { return _u.SetStatementID(v.ID) } // Mutation returns the AttestationPolicyMutation object of the builder. func (_u *AttestationPolicyUpdate) Mutation() *AttestationPolicyMutation { return _u.mutation } // ClearStatement clears the "statement" edge to the Statement entity. func (_u *AttestationPolicyUpdate) ClearStatement() *AttestationPolicyUpdate { _u.mutation.ClearStatement() return _u } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *AttestationPolicyUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *AttestationPolicyUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *AttestationPolicyUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *AttestationPolicyUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *AttestationPolicyUpdate) check() error { if v, ok := _u.mutation.Name(); ok { if err := attestationpolicy.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "AttestationPolicy.name": %w`, err)} } } return nil } func (_u *AttestationPolicyUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(attestationpolicy.Table, attestationpolicy.Columns, sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Name(); ok { _spec.SetField(attestationpolicy.FieldName, field.TypeString, value) } if _u.mutation.StatementCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationpolicy.StatementTable, Columns: []string{attestationpolicy.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationpolicy.StatementTable, Columns: []string{attestationpolicy.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{attestationpolicy.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // AttestationPolicyUpdateOne is the builder for updating a single AttestationPolicy entity. type AttestationPolicyUpdateOne struct { config fields []string hooks []Hook mutation *AttestationPolicyMutation } // SetName sets the "name" field. func (_u *AttestationPolicyUpdateOne) SetName(v string) *AttestationPolicyUpdateOne { _u.mutation.SetName(v) return _u } // SetNillableName sets the "name" field if the given value is not nil. func (_u *AttestationPolicyUpdateOne) SetNillableName(v *string) *AttestationPolicyUpdateOne { if v != nil { _u.SetName(*v) } return _u } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_u *AttestationPolicyUpdateOne) SetStatementID(id uuid.UUID) *AttestationPolicyUpdateOne { _u.mutation.SetStatementID(id) return _u } // SetNillableStatementID sets the "statement" edge to the Statement entity by ID if the given value is not nil. func (_u *AttestationPolicyUpdateOne) SetNillableStatementID(id *uuid.UUID) *AttestationPolicyUpdateOne { if id != nil { _u = _u.SetStatementID(*id) } return _u } // SetStatement sets the "statement" edge to the Statement entity. func (_u *AttestationPolicyUpdateOne) SetStatement(v *Statement) *AttestationPolicyUpdateOne { return _u.SetStatementID(v.ID) } // Mutation returns the AttestationPolicyMutation object of the builder. func (_u *AttestationPolicyUpdateOne) Mutation() *AttestationPolicyMutation { return _u.mutation } // ClearStatement clears the "statement" edge to the Statement entity. func (_u *AttestationPolicyUpdateOne) ClearStatement() *AttestationPolicyUpdateOne { _u.mutation.ClearStatement() return _u } // Where appends a list predicates to the AttestationPolicyUpdate builder. func (_u *AttestationPolicyUpdateOne) Where(ps ...predicate.AttestationPolicy) *AttestationPolicyUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *AttestationPolicyUpdateOne) Select(field string, fields ...string) *AttestationPolicyUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated AttestationPolicy entity. func (_u *AttestationPolicyUpdateOne) Save(ctx context.Context) (*AttestationPolicy, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *AttestationPolicyUpdateOne) SaveX(ctx context.Context) *AttestationPolicy { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *AttestationPolicyUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *AttestationPolicyUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *AttestationPolicyUpdateOne) check() error { if v, ok := _u.mutation.Name(); ok { if err := attestationpolicy.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "AttestationPolicy.name": %w`, err)} } } return nil } func (_u *AttestationPolicyUpdateOne) sqlSave(ctx context.Context) (_node *AttestationPolicy, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(attestationpolicy.Table, attestationpolicy.Columns, sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AttestationPolicy.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, attestationpolicy.FieldID) for _, f := range fields { if !attestationpolicy.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != attestationpolicy.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Name(); ok { _spec.SetField(attestationpolicy.FieldName, field.TypeString, value) } if _u.mutation.StatementCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationpolicy.StatementTable, Columns: []string{attestationpolicy.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: true, Table: attestationpolicy.StatementTable, Columns: []string{attestationpolicy.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &AttestationPolicy{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{attestationpolicy.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/client.go000066400000000000000000002156711511066247200224560ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "log" "reflect" "github.com/google/uuid" "github.com/in-toto/archivista/ent/migrate" "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" "github.com/in-toto/archivista/ent/timestamp" ) // 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 // Attestation is the client for interacting with the Attestation builders. Attestation *AttestationClient // AttestationCollection is the client for interacting with the AttestationCollection builders. AttestationCollection *AttestationCollectionClient // AttestationPolicy is the client for interacting with the AttestationPolicy builders. AttestationPolicy *AttestationPolicyClient // Dsse is the client for interacting with the Dsse builders. Dsse *DsseClient // PayloadDigest is the client for interacting with the PayloadDigest builders. PayloadDigest *PayloadDigestClient // Signature is the client for interacting with the Signature builders. Signature *SignatureClient // Statement is the client for interacting with the Statement builders. Statement *StatementClient // Subject is the client for interacting with the Subject builders. Subject *SubjectClient // SubjectDigest is the client for interacting with the SubjectDigest builders. SubjectDigest *SubjectDigestClient // Timestamp is the client for interacting with the Timestamp builders. Timestamp *TimestampClient } // NewClient creates a new client configured with the given options. func NewClient(opts ...Option) *Client { client := &Client{config: newConfig(opts...)} client.init() return client } func (c *Client) init() { c.Schema = migrate.NewSchema(c.driver) c.Attestation = NewAttestationClient(c.config) c.AttestationCollection = NewAttestationCollectionClient(c.config) c.AttestationPolicy = NewAttestationPolicyClient(c.config) c.Dsse = NewDsseClient(c.config) c.PayloadDigest = NewPayloadDigestClient(c.config) c.Signature = NewSignatureClient(c.config) c.Statement = NewStatementClient(c.config) c.Subject = NewSubjectClient(c.config) c.SubjectDigest = NewSubjectDigestClient(c.config) c.Timestamp = NewTimestampClient(c.config) } type ( // config is the configuration for the client and its builder. 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(...any) // hooks to execute on mutations. hooks *hooks // interceptors to execute on queries. inters *inters } // Option function to configure the client. Option func(*config) ) // newConfig creates a new config for the client. func newConfig(opts ...Option) config { cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}} cfg.options(opts...) return cfg } // 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(...any)) 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 } } // 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) } } // ErrTxStarted is returned when trying to start a new transaction from a transactional client. var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction") // 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, ErrTxStarted } 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, Attestation: NewAttestationClient(cfg), AttestationCollection: NewAttestationCollectionClient(cfg), AttestationPolicy: NewAttestationPolicyClient(cfg), Dsse: NewDsseClient(cfg), PayloadDigest: NewPayloadDigestClient(cfg), Signature: NewSignatureClient(cfg), Statement: NewStatementClient(cfg), Subject: NewSubjectClient(cfg), SubjectDigest: NewSubjectDigestClient(cfg), Timestamp: NewTimestampClient(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, errors.New("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{ ctx: ctx, config: cfg, Attestation: NewAttestationClient(cfg), AttestationCollection: NewAttestationCollectionClient(cfg), AttestationPolicy: NewAttestationPolicyClient(cfg), Dsse: NewDsseClient(cfg), PayloadDigest: NewPayloadDigestClient(cfg), Signature: NewSignatureClient(cfg), Statement: NewStatementClient(cfg), Subject: NewSubjectClient(cfg), SubjectDigest: NewSubjectDigestClient(cfg), Timestamp: NewTimestampClient(cfg), }, nil } // Debug returns a new debug-client. It's used to get verbose logging on specific operations. // // client.Debug(). // Attestation. // 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) { for _, n := range []interface{ Use(...Hook) }{ c.Attestation, c.AttestationCollection, c.AttestationPolicy, c.Dsse, c.PayloadDigest, c.Signature, c.Statement, c.Subject, c.SubjectDigest, c.Timestamp, } { n.Use(hooks...) } } // Intercept adds the query interceptors to all the entity clients. // In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`. func (c *Client) Intercept(interceptors ...Interceptor) { for _, n := range []interface{ Intercept(...Interceptor) }{ c.Attestation, c.AttestationCollection, c.AttestationPolicy, c.Dsse, c.PayloadDigest, c.Signature, c.Statement, c.Subject, c.SubjectDigest, c.Timestamp, } { n.Intercept(interceptors...) } } // Mutate implements the ent.Mutator interface. func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { switch m := m.(type) { case *AttestationMutation: return c.Attestation.mutate(ctx, m) case *AttestationCollectionMutation: return c.AttestationCollection.mutate(ctx, m) case *AttestationPolicyMutation: return c.AttestationPolicy.mutate(ctx, m) case *DsseMutation: return c.Dsse.mutate(ctx, m) case *PayloadDigestMutation: return c.PayloadDigest.mutate(ctx, m) case *SignatureMutation: return c.Signature.mutate(ctx, m) case *StatementMutation: return c.Statement.mutate(ctx, m) case *SubjectMutation: return c.Subject.mutate(ctx, m) case *SubjectDigestMutation: return c.SubjectDigest.mutate(ctx, m) case *TimestampMutation: return c.Timestamp.mutate(ctx, m) default: return nil, fmt.Errorf("ent: unknown mutation type %T", m) } } // AttestationClient is a client for the Attestation schema. type AttestationClient struct { config } // NewAttestationClient returns a client for the Attestation from the given config. func NewAttestationClient(c config) *AttestationClient { return &AttestationClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `attestation.Hooks(f(g(h())))`. func (c *AttestationClient) Use(hooks ...Hook) { c.hooks.Attestation = append(c.hooks.Attestation, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `attestation.Intercept(f(g(h())))`. func (c *AttestationClient) Intercept(interceptors ...Interceptor) { c.inters.Attestation = append(c.inters.Attestation, interceptors...) } // Create returns a builder for creating a Attestation entity. func (c *AttestationClient) Create() *AttestationCreate { mutation := newAttestationMutation(c.config, OpCreate) return &AttestationCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of Attestation entities. func (c *AttestationClient) CreateBulk(builders ...*AttestationCreate) *AttestationCreateBulk { return &AttestationCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *AttestationClient) MapCreateBulk(slice any, setFunc func(*AttestationCreate, int)) *AttestationCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &AttestationCreateBulk{err: fmt.Errorf("calling to AttestationClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*AttestationCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &AttestationCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for Attestation. func (c *AttestationClient) Update() *AttestationUpdate { mutation := newAttestationMutation(c.config, OpUpdate) return &AttestationUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *AttestationClient) UpdateOne(_m *Attestation) *AttestationUpdateOne { mutation := newAttestationMutation(c.config, OpUpdateOne, withAttestation(_m)) return &AttestationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *AttestationClient) UpdateOneID(id uuid.UUID) *AttestationUpdateOne { mutation := newAttestationMutation(c.config, OpUpdateOne, withAttestationID(id)) return &AttestationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for Attestation. func (c *AttestationClient) Delete() *AttestationDelete { mutation := newAttestationMutation(c.config, OpDelete) return &AttestationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *AttestationClient) DeleteOne(_m *Attestation) *AttestationDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *AttestationClient) DeleteOneID(id uuid.UUID) *AttestationDeleteOne { builder := c.Delete().Where(attestation.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &AttestationDeleteOne{builder} } // Query returns a query builder for Attestation. func (c *AttestationClient) Query() *AttestationQuery { return &AttestationQuery{ config: c.config, ctx: &QueryContext{Type: TypeAttestation}, inters: c.Interceptors(), } } // Get returns a Attestation entity by its id. func (c *AttestationClient) Get(ctx context.Context, id uuid.UUID) (*Attestation, error) { return c.Query().Where(attestation.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *AttestationClient) GetX(ctx context.Context, id uuid.UUID) *Attestation { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QueryAttestationCollection queries the attestation_collection edge of a Attestation. func (c *AttestationClient) QueryAttestationCollection(_m *Attestation) *AttestationCollectionQuery { query := (&AttestationCollectionClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(attestation.Table, attestation.FieldID, id), sqlgraph.To(attestationcollection.Table, attestationcollection.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, attestation.AttestationCollectionTable, attestation.AttestationCollectionColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *AttestationClient) Hooks() []Hook { return c.hooks.Attestation } // Interceptors returns the client interceptors. func (c *AttestationClient) Interceptors() []Interceptor { return c.inters.Attestation } func (c *AttestationClient) mutate(ctx context.Context, m *AttestationMutation) (Value, error) { switch m.Op() { case OpCreate: return (&AttestationCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&AttestationUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&AttestationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&AttestationDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown Attestation mutation op: %q", m.Op()) } } // AttestationCollectionClient is a client for the AttestationCollection schema. type AttestationCollectionClient struct { config } // NewAttestationCollectionClient returns a client for the AttestationCollection from the given config. func NewAttestationCollectionClient(c config) *AttestationCollectionClient { return &AttestationCollectionClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `attestationcollection.Hooks(f(g(h())))`. func (c *AttestationCollectionClient) Use(hooks ...Hook) { c.hooks.AttestationCollection = append(c.hooks.AttestationCollection, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `attestationcollection.Intercept(f(g(h())))`. func (c *AttestationCollectionClient) Intercept(interceptors ...Interceptor) { c.inters.AttestationCollection = append(c.inters.AttestationCollection, interceptors...) } // Create returns a builder for creating a AttestationCollection entity. func (c *AttestationCollectionClient) Create() *AttestationCollectionCreate { mutation := newAttestationCollectionMutation(c.config, OpCreate) return &AttestationCollectionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of AttestationCollection entities. func (c *AttestationCollectionClient) CreateBulk(builders ...*AttestationCollectionCreate) *AttestationCollectionCreateBulk { return &AttestationCollectionCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *AttestationCollectionClient) MapCreateBulk(slice any, setFunc func(*AttestationCollectionCreate, int)) *AttestationCollectionCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &AttestationCollectionCreateBulk{err: fmt.Errorf("calling to AttestationCollectionClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*AttestationCollectionCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &AttestationCollectionCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for AttestationCollection. func (c *AttestationCollectionClient) Update() *AttestationCollectionUpdate { mutation := newAttestationCollectionMutation(c.config, OpUpdate) return &AttestationCollectionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *AttestationCollectionClient) UpdateOne(_m *AttestationCollection) *AttestationCollectionUpdateOne { mutation := newAttestationCollectionMutation(c.config, OpUpdateOne, withAttestationCollection(_m)) return &AttestationCollectionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *AttestationCollectionClient) UpdateOneID(id uuid.UUID) *AttestationCollectionUpdateOne { mutation := newAttestationCollectionMutation(c.config, OpUpdateOne, withAttestationCollectionID(id)) return &AttestationCollectionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for AttestationCollection. func (c *AttestationCollectionClient) Delete() *AttestationCollectionDelete { mutation := newAttestationCollectionMutation(c.config, OpDelete) return &AttestationCollectionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *AttestationCollectionClient) DeleteOne(_m *AttestationCollection) *AttestationCollectionDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *AttestationCollectionClient) DeleteOneID(id uuid.UUID) *AttestationCollectionDeleteOne { builder := c.Delete().Where(attestationcollection.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &AttestationCollectionDeleteOne{builder} } // Query returns a query builder for AttestationCollection. func (c *AttestationCollectionClient) Query() *AttestationCollectionQuery { return &AttestationCollectionQuery{ config: c.config, ctx: &QueryContext{Type: TypeAttestationCollection}, inters: c.Interceptors(), } } // Get returns a AttestationCollection entity by its id. func (c *AttestationCollectionClient) Get(ctx context.Context, id uuid.UUID) (*AttestationCollection, error) { return c.Query().Where(attestationcollection.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *AttestationCollectionClient) GetX(ctx context.Context, id uuid.UUID) *AttestationCollection { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QueryAttestations queries the attestations edge of a AttestationCollection. func (c *AttestationCollectionClient) QueryAttestations(_m *AttestationCollection) *AttestationQuery { query := (&AttestationClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(attestationcollection.Table, attestationcollection.FieldID, id), sqlgraph.To(attestation.Table, attestation.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, attestationcollection.AttestationsTable, attestationcollection.AttestationsColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryStatement queries the statement edge of a AttestationCollection. func (c *AttestationCollectionClient) QueryStatement(_m *AttestationCollection) *StatementQuery { query := (&StatementClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(attestationcollection.Table, attestationcollection.FieldID, id), sqlgraph.To(statement.Table, statement.FieldID), sqlgraph.Edge(sqlgraph.O2O, true, attestationcollection.StatementTable, attestationcollection.StatementColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *AttestationCollectionClient) Hooks() []Hook { return c.hooks.AttestationCollection } // Interceptors returns the client interceptors. func (c *AttestationCollectionClient) Interceptors() []Interceptor { return c.inters.AttestationCollection } func (c *AttestationCollectionClient) mutate(ctx context.Context, m *AttestationCollectionMutation) (Value, error) { switch m.Op() { case OpCreate: return (&AttestationCollectionCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&AttestationCollectionUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&AttestationCollectionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&AttestationCollectionDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown AttestationCollection mutation op: %q", m.Op()) } } // AttestationPolicyClient is a client for the AttestationPolicy schema. type AttestationPolicyClient struct { config } // NewAttestationPolicyClient returns a client for the AttestationPolicy from the given config. func NewAttestationPolicyClient(c config) *AttestationPolicyClient { return &AttestationPolicyClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `attestationpolicy.Hooks(f(g(h())))`. func (c *AttestationPolicyClient) Use(hooks ...Hook) { c.hooks.AttestationPolicy = append(c.hooks.AttestationPolicy, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `attestationpolicy.Intercept(f(g(h())))`. func (c *AttestationPolicyClient) Intercept(interceptors ...Interceptor) { c.inters.AttestationPolicy = append(c.inters.AttestationPolicy, interceptors...) } // Create returns a builder for creating a AttestationPolicy entity. func (c *AttestationPolicyClient) Create() *AttestationPolicyCreate { mutation := newAttestationPolicyMutation(c.config, OpCreate) return &AttestationPolicyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of AttestationPolicy entities. func (c *AttestationPolicyClient) CreateBulk(builders ...*AttestationPolicyCreate) *AttestationPolicyCreateBulk { return &AttestationPolicyCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *AttestationPolicyClient) MapCreateBulk(slice any, setFunc func(*AttestationPolicyCreate, int)) *AttestationPolicyCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &AttestationPolicyCreateBulk{err: fmt.Errorf("calling to AttestationPolicyClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*AttestationPolicyCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &AttestationPolicyCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for AttestationPolicy. func (c *AttestationPolicyClient) Update() *AttestationPolicyUpdate { mutation := newAttestationPolicyMutation(c.config, OpUpdate) return &AttestationPolicyUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *AttestationPolicyClient) UpdateOne(_m *AttestationPolicy) *AttestationPolicyUpdateOne { mutation := newAttestationPolicyMutation(c.config, OpUpdateOne, withAttestationPolicy(_m)) return &AttestationPolicyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *AttestationPolicyClient) UpdateOneID(id uuid.UUID) *AttestationPolicyUpdateOne { mutation := newAttestationPolicyMutation(c.config, OpUpdateOne, withAttestationPolicyID(id)) return &AttestationPolicyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for AttestationPolicy. func (c *AttestationPolicyClient) Delete() *AttestationPolicyDelete { mutation := newAttestationPolicyMutation(c.config, OpDelete) return &AttestationPolicyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *AttestationPolicyClient) DeleteOne(_m *AttestationPolicy) *AttestationPolicyDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *AttestationPolicyClient) DeleteOneID(id uuid.UUID) *AttestationPolicyDeleteOne { builder := c.Delete().Where(attestationpolicy.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &AttestationPolicyDeleteOne{builder} } // Query returns a query builder for AttestationPolicy. func (c *AttestationPolicyClient) Query() *AttestationPolicyQuery { return &AttestationPolicyQuery{ config: c.config, ctx: &QueryContext{Type: TypeAttestationPolicy}, inters: c.Interceptors(), } } // Get returns a AttestationPolicy entity by its id. func (c *AttestationPolicyClient) Get(ctx context.Context, id uuid.UUID) (*AttestationPolicy, error) { return c.Query().Where(attestationpolicy.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *AttestationPolicyClient) GetX(ctx context.Context, id uuid.UUID) *AttestationPolicy { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QueryStatement queries the statement edge of a AttestationPolicy. func (c *AttestationPolicyClient) QueryStatement(_m *AttestationPolicy) *StatementQuery { query := (&StatementClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(attestationpolicy.Table, attestationpolicy.FieldID, id), sqlgraph.To(statement.Table, statement.FieldID), sqlgraph.Edge(sqlgraph.O2O, true, attestationpolicy.StatementTable, attestationpolicy.StatementColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *AttestationPolicyClient) Hooks() []Hook { return c.hooks.AttestationPolicy } // Interceptors returns the client interceptors. func (c *AttestationPolicyClient) Interceptors() []Interceptor { return c.inters.AttestationPolicy } func (c *AttestationPolicyClient) mutate(ctx context.Context, m *AttestationPolicyMutation) (Value, error) { switch m.Op() { case OpCreate: return (&AttestationPolicyCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&AttestationPolicyUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&AttestationPolicyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&AttestationPolicyDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown AttestationPolicy mutation op: %q", m.Op()) } } // DsseClient is a client for the Dsse schema. type DsseClient struct { config } // NewDsseClient returns a client for the Dsse from the given config. func NewDsseClient(c config) *DsseClient { return &DsseClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `dsse.Hooks(f(g(h())))`. func (c *DsseClient) Use(hooks ...Hook) { c.hooks.Dsse = append(c.hooks.Dsse, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `dsse.Intercept(f(g(h())))`. func (c *DsseClient) Intercept(interceptors ...Interceptor) { c.inters.Dsse = append(c.inters.Dsse, interceptors...) } // Create returns a builder for creating a Dsse entity. func (c *DsseClient) Create() *DsseCreate { mutation := newDsseMutation(c.config, OpCreate) return &DsseCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of Dsse entities. func (c *DsseClient) CreateBulk(builders ...*DsseCreate) *DsseCreateBulk { return &DsseCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *DsseClient) MapCreateBulk(slice any, setFunc func(*DsseCreate, int)) *DsseCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &DsseCreateBulk{err: fmt.Errorf("calling to DsseClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*DsseCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &DsseCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for Dsse. func (c *DsseClient) Update() *DsseUpdate { mutation := newDsseMutation(c.config, OpUpdate) return &DsseUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *DsseClient) UpdateOne(_m *Dsse) *DsseUpdateOne { mutation := newDsseMutation(c.config, OpUpdateOne, withDsse(_m)) return &DsseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *DsseClient) UpdateOneID(id uuid.UUID) *DsseUpdateOne { mutation := newDsseMutation(c.config, OpUpdateOne, withDsseID(id)) return &DsseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for Dsse. func (c *DsseClient) Delete() *DsseDelete { mutation := newDsseMutation(c.config, OpDelete) return &DsseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *DsseClient) DeleteOne(_m *Dsse) *DsseDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *DsseClient) DeleteOneID(id uuid.UUID) *DsseDeleteOne { builder := c.Delete().Where(dsse.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &DsseDeleteOne{builder} } // Query returns a query builder for Dsse. func (c *DsseClient) Query() *DsseQuery { return &DsseQuery{ config: c.config, ctx: &QueryContext{Type: TypeDsse}, inters: c.Interceptors(), } } // Get returns a Dsse entity by its id. func (c *DsseClient) Get(ctx context.Context, id uuid.UUID) (*Dsse, error) { return c.Query().Where(dsse.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *DsseClient) GetX(ctx context.Context, id uuid.UUID) *Dsse { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QueryStatement queries the statement edge of a Dsse. func (c *DsseClient) QueryStatement(_m *Dsse) *StatementQuery { query := (&StatementClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(dsse.Table, dsse.FieldID, id), sqlgraph.To(statement.Table, statement.FieldID), sqlgraph.Edge(sqlgraph.M2O, false, dsse.StatementTable, dsse.StatementColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QuerySignatures queries the signatures edge of a Dsse. func (c *DsseClient) QuerySignatures(_m *Dsse) *SignatureQuery { query := (&SignatureClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(dsse.Table, dsse.FieldID, id), sqlgraph.To(signature.Table, signature.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, dsse.SignaturesTable, dsse.SignaturesColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryPayloadDigests queries the payload_digests edge of a Dsse. func (c *DsseClient) QueryPayloadDigests(_m *Dsse) *PayloadDigestQuery { query := (&PayloadDigestClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(dsse.Table, dsse.FieldID, id), sqlgraph.To(payloaddigest.Table, payloaddigest.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, dsse.PayloadDigestsTable, dsse.PayloadDigestsColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *DsseClient) Hooks() []Hook { return c.hooks.Dsse } // Interceptors returns the client interceptors. func (c *DsseClient) Interceptors() []Interceptor { return c.inters.Dsse } func (c *DsseClient) mutate(ctx context.Context, m *DsseMutation) (Value, error) { switch m.Op() { case OpCreate: return (&DsseCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&DsseUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&DsseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&DsseDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown Dsse mutation op: %q", m.Op()) } } // PayloadDigestClient is a client for the PayloadDigest schema. type PayloadDigestClient struct { config } // NewPayloadDigestClient returns a client for the PayloadDigest from the given config. func NewPayloadDigestClient(c config) *PayloadDigestClient { return &PayloadDigestClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `payloaddigest.Hooks(f(g(h())))`. func (c *PayloadDigestClient) Use(hooks ...Hook) { c.hooks.PayloadDigest = append(c.hooks.PayloadDigest, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `payloaddigest.Intercept(f(g(h())))`. func (c *PayloadDigestClient) Intercept(interceptors ...Interceptor) { c.inters.PayloadDigest = append(c.inters.PayloadDigest, interceptors...) } // Create returns a builder for creating a PayloadDigest entity. func (c *PayloadDigestClient) Create() *PayloadDigestCreate { mutation := newPayloadDigestMutation(c.config, OpCreate) return &PayloadDigestCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of PayloadDigest entities. func (c *PayloadDigestClient) CreateBulk(builders ...*PayloadDigestCreate) *PayloadDigestCreateBulk { return &PayloadDigestCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *PayloadDigestClient) MapCreateBulk(slice any, setFunc func(*PayloadDigestCreate, int)) *PayloadDigestCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &PayloadDigestCreateBulk{err: fmt.Errorf("calling to PayloadDigestClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*PayloadDigestCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &PayloadDigestCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for PayloadDigest. func (c *PayloadDigestClient) Update() *PayloadDigestUpdate { mutation := newPayloadDigestMutation(c.config, OpUpdate) return &PayloadDigestUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *PayloadDigestClient) UpdateOne(_m *PayloadDigest) *PayloadDigestUpdateOne { mutation := newPayloadDigestMutation(c.config, OpUpdateOne, withPayloadDigest(_m)) return &PayloadDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *PayloadDigestClient) UpdateOneID(id uuid.UUID) *PayloadDigestUpdateOne { mutation := newPayloadDigestMutation(c.config, OpUpdateOne, withPayloadDigestID(id)) return &PayloadDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for PayloadDigest. func (c *PayloadDigestClient) Delete() *PayloadDigestDelete { mutation := newPayloadDigestMutation(c.config, OpDelete) return &PayloadDigestDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *PayloadDigestClient) DeleteOne(_m *PayloadDigest) *PayloadDigestDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *PayloadDigestClient) DeleteOneID(id uuid.UUID) *PayloadDigestDeleteOne { builder := c.Delete().Where(payloaddigest.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &PayloadDigestDeleteOne{builder} } // Query returns a query builder for PayloadDigest. func (c *PayloadDigestClient) Query() *PayloadDigestQuery { return &PayloadDigestQuery{ config: c.config, ctx: &QueryContext{Type: TypePayloadDigest}, inters: c.Interceptors(), } } // Get returns a PayloadDigest entity by its id. func (c *PayloadDigestClient) Get(ctx context.Context, id uuid.UUID) (*PayloadDigest, error) { return c.Query().Where(payloaddigest.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *PayloadDigestClient) GetX(ctx context.Context, id uuid.UUID) *PayloadDigest { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QueryDsse queries the dsse edge of a PayloadDigest. func (c *PayloadDigestClient) QueryDsse(_m *PayloadDigest) *DsseQuery { query := (&DsseClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(payloaddigest.Table, payloaddigest.FieldID, id), sqlgraph.To(dsse.Table, dsse.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, payloaddigest.DsseTable, payloaddigest.DsseColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *PayloadDigestClient) Hooks() []Hook { return c.hooks.PayloadDigest } // Interceptors returns the client interceptors. func (c *PayloadDigestClient) Interceptors() []Interceptor { return c.inters.PayloadDigest } func (c *PayloadDigestClient) mutate(ctx context.Context, m *PayloadDigestMutation) (Value, error) { switch m.Op() { case OpCreate: return (&PayloadDigestCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&PayloadDigestUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&PayloadDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&PayloadDigestDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown PayloadDigest mutation op: %q", m.Op()) } } // SignatureClient is a client for the Signature schema. type SignatureClient struct { config } // NewSignatureClient returns a client for the Signature from the given config. func NewSignatureClient(c config) *SignatureClient { return &SignatureClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `signature.Hooks(f(g(h())))`. func (c *SignatureClient) Use(hooks ...Hook) { c.hooks.Signature = append(c.hooks.Signature, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `signature.Intercept(f(g(h())))`. func (c *SignatureClient) Intercept(interceptors ...Interceptor) { c.inters.Signature = append(c.inters.Signature, interceptors...) } // Create returns a builder for creating a Signature entity. func (c *SignatureClient) Create() *SignatureCreate { mutation := newSignatureMutation(c.config, OpCreate) return &SignatureCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of Signature entities. func (c *SignatureClient) CreateBulk(builders ...*SignatureCreate) *SignatureCreateBulk { return &SignatureCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *SignatureClient) MapCreateBulk(slice any, setFunc func(*SignatureCreate, int)) *SignatureCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &SignatureCreateBulk{err: fmt.Errorf("calling to SignatureClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*SignatureCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &SignatureCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for Signature. func (c *SignatureClient) Update() *SignatureUpdate { mutation := newSignatureMutation(c.config, OpUpdate) return &SignatureUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *SignatureClient) UpdateOne(_m *Signature) *SignatureUpdateOne { mutation := newSignatureMutation(c.config, OpUpdateOne, withSignature(_m)) return &SignatureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *SignatureClient) UpdateOneID(id uuid.UUID) *SignatureUpdateOne { mutation := newSignatureMutation(c.config, OpUpdateOne, withSignatureID(id)) return &SignatureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for Signature. func (c *SignatureClient) Delete() *SignatureDelete { mutation := newSignatureMutation(c.config, OpDelete) return &SignatureDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *SignatureClient) DeleteOne(_m *Signature) *SignatureDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *SignatureClient) DeleteOneID(id uuid.UUID) *SignatureDeleteOne { builder := c.Delete().Where(signature.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &SignatureDeleteOne{builder} } // Query returns a query builder for Signature. func (c *SignatureClient) Query() *SignatureQuery { return &SignatureQuery{ config: c.config, ctx: &QueryContext{Type: TypeSignature}, inters: c.Interceptors(), } } // Get returns a Signature entity by its id. func (c *SignatureClient) Get(ctx context.Context, id uuid.UUID) (*Signature, error) { return c.Query().Where(signature.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *SignatureClient) GetX(ctx context.Context, id uuid.UUID) *Signature { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QueryDsse queries the dsse edge of a Signature. func (c *SignatureClient) QueryDsse(_m *Signature) *DsseQuery { query := (&DsseClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(signature.Table, signature.FieldID, id), sqlgraph.To(dsse.Table, dsse.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, signature.DsseTable, signature.DsseColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryTimestamps queries the timestamps edge of a Signature. func (c *SignatureClient) QueryTimestamps(_m *Signature) *TimestampQuery { query := (&TimestampClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(signature.Table, signature.FieldID, id), sqlgraph.To(timestamp.Table, timestamp.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, signature.TimestampsTable, signature.TimestampsColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *SignatureClient) Hooks() []Hook { return c.hooks.Signature } // Interceptors returns the client interceptors. func (c *SignatureClient) Interceptors() []Interceptor { return c.inters.Signature } func (c *SignatureClient) mutate(ctx context.Context, m *SignatureMutation) (Value, error) { switch m.Op() { case OpCreate: return (&SignatureCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&SignatureUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&SignatureUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&SignatureDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown Signature mutation op: %q", m.Op()) } } // StatementClient is a client for the Statement schema. type StatementClient struct { config } // NewStatementClient returns a client for the Statement from the given config. func NewStatementClient(c config) *StatementClient { return &StatementClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `statement.Hooks(f(g(h())))`. func (c *StatementClient) Use(hooks ...Hook) { c.hooks.Statement = append(c.hooks.Statement, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `statement.Intercept(f(g(h())))`. func (c *StatementClient) Intercept(interceptors ...Interceptor) { c.inters.Statement = append(c.inters.Statement, interceptors...) } // Create returns a builder for creating a Statement entity. func (c *StatementClient) Create() *StatementCreate { mutation := newStatementMutation(c.config, OpCreate) return &StatementCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of Statement entities. func (c *StatementClient) CreateBulk(builders ...*StatementCreate) *StatementCreateBulk { return &StatementCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *StatementClient) MapCreateBulk(slice any, setFunc func(*StatementCreate, int)) *StatementCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &StatementCreateBulk{err: fmt.Errorf("calling to StatementClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*StatementCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &StatementCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for Statement. func (c *StatementClient) Update() *StatementUpdate { mutation := newStatementMutation(c.config, OpUpdate) return &StatementUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *StatementClient) UpdateOne(_m *Statement) *StatementUpdateOne { mutation := newStatementMutation(c.config, OpUpdateOne, withStatement(_m)) return &StatementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *StatementClient) UpdateOneID(id uuid.UUID) *StatementUpdateOne { mutation := newStatementMutation(c.config, OpUpdateOne, withStatementID(id)) return &StatementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for Statement. func (c *StatementClient) Delete() *StatementDelete { mutation := newStatementMutation(c.config, OpDelete) return &StatementDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *StatementClient) DeleteOne(_m *Statement) *StatementDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *StatementClient) DeleteOneID(id uuid.UUID) *StatementDeleteOne { builder := c.Delete().Where(statement.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &StatementDeleteOne{builder} } // Query returns a query builder for Statement. func (c *StatementClient) Query() *StatementQuery { return &StatementQuery{ config: c.config, ctx: &QueryContext{Type: TypeStatement}, inters: c.Interceptors(), } } // Get returns a Statement entity by its id. func (c *StatementClient) Get(ctx context.Context, id uuid.UUID) (*Statement, error) { return c.Query().Where(statement.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *StatementClient) GetX(ctx context.Context, id uuid.UUID) *Statement { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QuerySubjects queries the subjects edge of a Statement. func (c *StatementClient) QuerySubjects(_m *Statement) *SubjectQuery { query := (&SubjectClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(statement.Table, statement.FieldID, id), sqlgraph.To(subject.Table, subject.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, statement.SubjectsTable, statement.SubjectsColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryPolicy queries the policy edge of a Statement. func (c *StatementClient) QueryPolicy(_m *Statement) *AttestationPolicyQuery { query := (&AttestationPolicyClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(statement.Table, statement.FieldID, id), sqlgraph.To(attestationpolicy.Table, attestationpolicy.FieldID), sqlgraph.Edge(sqlgraph.O2O, false, statement.PolicyTable, statement.PolicyColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryAttestationCollections queries the attestation_collections edge of a Statement. func (c *StatementClient) QueryAttestationCollections(_m *Statement) *AttestationCollectionQuery { query := (&AttestationCollectionClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(statement.Table, statement.FieldID, id), sqlgraph.To(attestationcollection.Table, attestationcollection.FieldID), sqlgraph.Edge(sqlgraph.O2O, false, statement.AttestationCollectionsTable, statement.AttestationCollectionsColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryDsse queries the dsse edge of a Statement. func (c *StatementClient) QueryDsse(_m *Statement) *DsseQuery { query := (&DsseClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(statement.Table, statement.FieldID, id), sqlgraph.To(dsse.Table, dsse.FieldID), sqlgraph.Edge(sqlgraph.O2M, true, statement.DsseTable, statement.DsseColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *StatementClient) Hooks() []Hook { return c.hooks.Statement } // Interceptors returns the client interceptors. func (c *StatementClient) Interceptors() []Interceptor { return c.inters.Statement } func (c *StatementClient) mutate(ctx context.Context, m *StatementMutation) (Value, error) { switch m.Op() { case OpCreate: return (&StatementCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&StatementUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&StatementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&StatementDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown Statement mutation op: %q", m.Op()) } } // SubjectClient is a client for the Subject schema. type SubjectClient struct { config } // NewSubjectClient returns a client for the Subject from the given config. func NewSubjectClient(c config) *SubjectClient { return &SubjectClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `subject.Hooks(f(g(h())))`. func (c *SubjectClient) Use(hooks ...Hook) { c.hooks.Subject = append(c.hooks.Subject, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `subject.Intercept(f(g(h())))`. func (c *SubjectClient) Intercept(interceptors ...Interceptor) { c.inters.Subject = append(c.inters.Subject, interceptors...) } // Create returns a builder for creating a Subject entity. func (c *SubjectClient) Create() *SubjectCreate { mutation := newSubjectMutation(c.config, OpCreate) return &SubjectCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of Subject entities. func (c *SubjectClient) CreateBulk(builders ...*SubjectCreate) *SubjectCreateBulk { return &SubjectCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *SubjectClient) MapCreateBulk(slice any, setFunc func(*SubjectCreate, int)) *SubjectCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &SubjectCreateBulk{err: fmt.Errorf("calling to SubjectClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*SubjectCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &SubjectCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for Subject. func (c *SubjectClient) Update() *SubjectUpdate { mutation := newSubjectMutation(c.config, OpUpdate) return &SubjectUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *SubjectClient) UpdateOne(_m *Subject) *SubjectUpdateOne { mutation := newSubjectMutation(c.config, OpUpdateOne, withSubject(_m)) return &SubjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *SubjectClient) UpdateOneID(id uuid.UUID) *SubjectUpdateOne { mutation := newSubjectMutation(c.config, OpUpdateOne, withSubjectID(id)) return &SubjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for Subject. func (c *SubjectClient) Delete() *SubjectDelete { mutation := newSubjectMutation(c.config, OpDelete) return &SubjectDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *SubjectClient) DeleteOne(_m *Subject) *SubjectDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *SubjectClient) DeleteOneID(id uuid.UUID) *SubjectDeleteOne { builder := c.Delete().Where(subject.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &SubjectDeleteOne{builder} } // Query returns a query builder for Subject. func (c *SubjectClient) Query() *SubjectQuery { return &SubjectQuery{ config: c.config, ctx: &QueryContext{Type: TypeSubject}, inters: c.Interceptors(), } } // Get returns a Subject entity by its id. func (c *SubjectClient) Get(ctx context.Context, id uuid.UUID) (*Subject, error) { return c.Query().Where(subject.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *SubjectClient) GetX(ctx context.Context, id uuid.UUID) *Subject { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QuerySubjectDigests queries the subject_digests edge of a Subject. func (c *SubjectClient) QuerySubjectDigests(_m *Subject) *SubjectDigestQuery { query := (&SubjectDigestClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(subject.Table, subject.FieldID, id), sqlgraph.To(subjectdigest.Table, subjectdigest.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, subject.SubjectDigestsTable, subject.SubjectDigestsColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryStatement queries the statement edge of a Subject. func (c *SubjectClient) QueryStatement(_m *Subject) *StatementQuery { query := (&StatementClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(subject.Table, subject.FieldID, id), sqlgraph.To(statement.Table, statement.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, subject.StatementTable, subject.StatementColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *SubjectClient) Hooks() []Hook { return c.hooks.Subject } // Interceptors returns the client interceptors. func (c *SubjectClient) Interceptors() []Interceptor { return c.inters.Subject } func (c *SubjectClient) mutate(ctx context.Context, m *SubjectMutation) (Value, error) { switch m.Op() { case OpCreate: return (&SubjectCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&SubjectUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&SubjectUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&SubjectDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown Subject mutation op: %q", m.Op()) } } // SubjectDigestClient is a client for the SubjectDigest schema. type SubjectDigestClient struct { config } // NewSubjectDigestClient returns a client for the SubjectDigest from the given config. func NewSubjectDigestClient(c config) *SubjectDigestClient { return &SubjectDigestClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `subjectdigest.Hooks(f(g(h())))`. func (c *SubjectDigestClient) Use(hooks ...Hook) { c.hooks.SubjectDigest = append(c.hooks.SubjectDigest, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `subjectdigest.Intercept(f(g(h())))`. func (c *SubjectDigestClient) Intercept(interceptors ...Interceptor) { c.inters.SubjectDigest = append(c.inters.SubjectDigest, interceptors...) } // Create returns a builder for creating a SubjectDigest entity. func (c *SubjectDigestClient) Create() *SubjectDigestCreate { mutation := newSubjectDigestMutation(c.config, OpCreate) return &SubjectDigestCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of SubjectDigest entities. func (c *SubjectDigestClient) CreateBulk(builders ...*SubjectDigestCreate) *SubjectDigestCreateBulk { return &SubjectDigestCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *SubjectDigestClient) MapCreateBulk(slice any, setFunc func(*SubjectDigestCreate, int)) *SubjectDigestCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &SubjectDigestCreateBulk{err: fmt.Errorf("calling to SubjectDigestClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*SubjectDigestCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &SubjectDigestCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for SubjectDigest. func (c *SubjectDigestClient) Update() *SubjectDigestUpdate { mutation := newSubjectDigestMutation(c.config, OpUpdate) return &SubjectDigestUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *SubjectDigestClient) UpdateOne(_m *SubjectDigest) *SubjectDigestUpdateOne { mutation := newSubjectDigestMutation(c.config, OpUpdateOne, withSubjectDigest(_m)) return &SubjectDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *SubjectDigestClient) UpdateOneID(id uuid.UUID) *SubjectDigestUpdateOne { mutation := newSubjectDigestMutation(c.config, OpUpdateOne, withSubjectDigestID(id)) return &SubjectDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for SubjectDigest. func (c *SubjectDigestClient) Delete() *SubjectDigestDelete { mutation := newSubjectDigestMutation(c.config, OpDelete) return &SubjectDigestDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *SubjectDigestClient) DeleteOne(_m *SubjectDigest) *SubjectDigestDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *SubjectDigestClient) DeleteOneID(id uuid.UUID) *SubjectDigestDeleteOne { builder := c.Delete().Where(subjectdigest.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &SubjectDigestDeleteOne{builder} } // Query returns a query builder for SubjectDigest. func (c *SubjectDigestClient) Query() *SubjectDigestQuery { return &SubjectDigestQuery{ config: c.config, ctx: &QueryContext{Type: TypeSubjectDigest}, inters: c.Interceptors(), } } // Get returns a SubjectDigest entity by its id. func (c *SubjectDigestClient) Get(ctx context.Context, id uuid.UUID) (*SubjectDigest, error) { return c.Query().Where(subjectdigest.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *SubjectDigestClient) GetX(ctx context.Context, id uuid.UUID) *SubjectDigest { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QuerySubject queries the subject edge of a SubjectDigest. func (c *SubjectDigestClient) QuerySubject(_m *SubjectDigest) *SubjectQuery { query := (&SubjectClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(subjectdigest.Table, subjectdigest.FieldID, id), sqlgraph.To(subject.Table, subject.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, subjectdigest.SubjectTable, subjectdigest.SubjectColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *SubjectDigestClient) Hooks() []Hook { return c.hooks.SubjectDigest } // Interceptors returns the client interceptors. func (c *SubjectDigestClient) Interceptors() []Interceptor { return c.inters.SubjectDigest } func (c *SubjectDigestClient) mutate(ctx context.Context, m *SubjectDigestMutation) (Value, error) { switch m.Op() { case OpCreate: return (&SubjectDigestCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&SubjectDigestUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&SubjectDigestUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&SubjectDigestDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown SubjectDigest mutation op: %q", m.Op()) } } // TimestampClient is a client for the Timestamp schema. type TimestampClient struct { config } // NewTimestampClient returns a client for the Timestamp from the given config. func NewTimestampClient(c config) *TimestampClient { return &TimestampClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. // A call to `Use(f, g, h)` equals to `timestamp.Hooks(f(g(h())))`. func (c *TimestampClient) Use(hooks ...Hook) { c.hooks.Timestamp = append(c.hooks.Timestamp, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `timestamp.Intercept(f(g(h())))`. func (c *TimestampClient) Intercept(interceptors ...Interceptor) { c.inters.Timestamp = append(c.inters.Timestamp, interceptors...) } // Create returns a builder for creating a Timestamp entity. func (c *TimestampClient) Create() *TimestampCreate { mutation := newTimestampMutation(c.config, OpCreate) return &TimestampCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // CreateBulk returns a builder for creating a bulk of Timestamp entities. func (c *TimestampClient) CreateBulk(builders ...*TimestampCreate) *TimestampCreateBulk { return &TimestampCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. func (c *TimestampClient) MapCreateBulk(slice any, setFunc func(*TimestampCreate, int)) *TimestampCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { return &TimestampCreateBulk{err: fmt.Errorf("calling to TimestampClient.MapCreateBulk with wrong type %T, need slice", slice)} } builders := make([]*TimestampCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } return &TimestampCreateBulk{config: c.config, builders: builders} } // Update returns an update builder for Timestamp. func (c *TimestampClient) Update() *TimestampUpdate { mutation := newTimestampMutation(c.config, OpUpdate) return &TimestampUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. func (c *TimestampClient) UpdateOne(_m *Timestamp) *TimestampUpdateOne { mutation := newTimestampMutation(c.config, OpUpdateOne, withTimestamp(_m)) return &TimestampUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. func (c *TimestampClient) UpdateOneID(id uuid.UUID) *TimestampUpdateOne { mutation := newTimestampMutation(c.config, OpUpdateOne, withTimestampID(id)) return &TimestampUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // Delete returns a delete builder for Timestamp. func (c *TimestampClient) Delete() *TimestampDelete { mutation := newTimestampMutation(c.config, OpDelete) return &TimestampDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. func (c *TimestampClient) DeleteOne(_m *Timestamp) *TimestampDeleteOne { return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. func (c *TimestampClient) DeleteOneID(id uuid.UUID) *TimestampDeleteOne { builder := c.Delete().Where(timestamp.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &TimestampDeleteOne{builder} } // Query returns a query builder for Timestamp. func (c *TimestampClient) Query() *TimestampQuery { return &TimestampQuery{ config: c.config, ctx: &QueryContext{Type: TypeTimestamp}, inters: c.Interceptors(), } } // Get returns a Timestamp entity by its id. func (c *TimestampClient) Get(ctx context.Context, id uuid.UUID) (*Timestamp, error) { return c.Query().Where(timestamp.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. func (c *TimestampClient) GetX(ctx context.Context, id uuid.UUID) *Timestamp { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj } // QuerySignature queries the signature edge of a Timestamp. func (c *TimestampClient) QuerySignature(_m *Timestamp) *SignatureQuery { query := (&SignatureClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(timestamp.Table, timestamp.FieldID, id), sqlgraph.To(signature.Table, signature.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, timestamp.SignatureTable, timestamp.SignatureColumn), ) fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. func (c *TimestampClient) Hooks() []Hook { return c.hooks.Timestamp } // Interceptors returns the client interceptors. func (c *TimestampClient) Interceptors() []Interceptor { return c.inters.Timestamp } func (c *TimestampClient) mutate(ctx context.Context, m *TimestampMutation) (Value, error) { switch m.Op() { case OpCreate: return (&TimestampCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: return (&TimestampUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: return (&TimestampUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: return (&TimestampDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: return nil, fmt.Errorf("ent: unknown Timestamp mutation op: %q", m.Op()) } } // hooks and interceptors per client, for fast access. type ( hooks struct { Attestation, AttestationCollection, AttestationPolicy, Dsse, PayloadDigest, Signature, Statement, Subject, SubjectDigest, Timestamp []ent.Hook } inters struct { Attestation, AttestationCollection, AttestationPolicy, Dsse, PayloadDigest, Signature, Statement, Subject, SubjectDigest, Timestamp []ent.Interceptor } ) golang-github-in-toto-archivista-0.11.1/ent/dsse.go000066400000000000000000000205261511066247200221270ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/statement" ) // Dsse is the model entity for the Dsse schema. type Dsse struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt *time.Time `json:"created_at,omitempty"` // GitoidSha256 holds the value of the "gitoid_sha256" field. GitoidSha256 string `json:"gitoid_sha256,omitempty"` // PayloadType holds the value of the "payload_type" field. PayloadType string `json:"payload_type,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the DsseQuery when eager-loading is set. Edges DsseEdges `json:"edges"` dsse_statement *uuid.UUID selectValues sql.SelectValues } // DsseEdges holds the relations/edges for other nodes in the graph. type DsseEdges struct { // Statement holds the value of the statement edge. Statement *Statement `json:"statement,omitempty"` // Signatures holds the value of the signatures edge. Signatures []*Signature `json:"signatures,omitempty"` // PayloadDigests holds the value of the payload_digests edge. PayloadDigests []*PayloadDigest `json:"payload_digests,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [3]bool // totalCount holds the count of the edges above. totalCount [3]map[string]int namedSignatures map[string][]*Signature namedPayloadDigests map[string][]*PayloadDigest } // StatementOrErr returns the Statement value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e DsseEdges) StatementOrErr() (*Statement, error) { if e.Statement != nil { return e.Statement, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: statement.Label} } return nil, &NotLoadedError{edge: "statement"} } // SignaturesOrErr returns the Signatures value or an error if the edge // was not loaded in eager-loading. func (e DsseEdges) SignaturesOrErr() ([]*Signature, error) { if e.loadedTypes[1] { return e.Signatures, nil } return nil, &NotLoadedError{edge: "signatures"} } // PayloadDigestsOrErr returns the PayloadDigests value or an error if the edge // was not loaded in eager-loading. func (e DsseEdges) PayloadDigestsOrErr() ([]*PayloadDigest, error) { if e.loadedTypes[2] { return e.PayloadDigests, nil } return nil, &NotLoadedError{edge: "payload_digests"} } // scanValues returns the types for scanning values from sql.Rows. func (*Dsse) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case dsse.FieldGitoidSha256, dsse.FieldPayloadType: values[i] = new(sql.NullString) case dsse.FieldCreatedAt: values[i] = new(sql.NullTime) case dsse.FieldID: values[i] = new(uuid.UUID) case dsse.ForeignKeys[0]: // dsse_statement values[i] = &sql.NullScanner{S: new(uuid.UUID)} default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Dsse fields. func (_m *Dsse) assignValues(columns []string, values []any) 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 dsse.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case dsse.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = new(time.Time) *_m.CreatedAt = value.Time } case dsse.FieldGitoidSha256: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field gitoid_sha256", values[i]) } else if value.Valid { _m.GitoidSha256 = value.String } case dsse.FieldPayloadType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field payload_type", values[i]) } else if value.Valid { _m.PayloadType = value.String } case dsse.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field dsse_statement", values[i]) } else if value.Valid { _m.dsse_statement = new(uuid.UUID) *_m.dsse_statement = *value.S.(*uuid.UUID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Dsse. // This includes values selected through modifiers, order, etc. func (_m *Dsse) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QueryStatement queries the "statement" edge of the Dsse entity. func (_m *Dsse) QueryStatement() *StatementQuery { return NewDsseClient(_m.config).QueryStatement(_m) } // QuerySignatures queries the "signatures" edge of the Dsse entity. func (_m *Dsse) QuerySignatures() *SignatureQuery { return NewDsseClient(_m.config).QuerySignatures(_m) } // QueryPayloadDigests queries the "payload_digests" edge of the Dsse entity. func (_m *Dsse) QueryPayloadDigests() *PayloadDigestQuery { return NewDsseClient(_m.config).QueryPayloadDigests(_m) } // Update returns a builder for updating this Dsse. // Note that you need to call Dsse.Unwrap() before calling this method if this Dsse // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Dsse) Update() *DsseUpdateOne { return NewDsseClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Dsse 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 (_m *Dsse) Unwrap() *Dsse { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Dsse is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Dsse) String() string { var builder strings.Builder builder.WriteString("Dsse(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) if v := _m.CreatedAt; v != nil { builder.WriteString("created_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("gitoid_sha256=") builder.WriteString(_m.GitoidSha256) builder.WriteString(", ") builder.WriteString("payload_type=") builder.WriteString(_m.PayloadType) builder.WriteByte(')') return builder.String() } // NamedSignatures returns the Signatures named value or an error if the edge was not // loaded in eager-loading with this name. func (_m *Dsse) NamedSignatures(name string) ([]*Signature, error) { if _m.Edges.namedSignatures == nil { return nil, &NotLoadedError{edge: name} } nodes, ok := _m.Edges.namedSignatures[name] if !ok { return nil, &NotLoadedError{edge: name} } return nodes, nil } func (_m *Dsse) appendNamedSignatures(name string, edges ...*Signature) { if _m.Edges.namedSignatures == nil { _m.Edges.namedSignatures = make(map[string][]*Signature) } if len(edges) == 0 { _m.Edges.namedSignatures[name] = []*Signature{} } else { _m.Edges.namedSignatures[name] = append(_m.Edges.namedSignatures[name], edges...) } } // NamedPayloadDigests returns the PayloadDigests named value or an error if the edge was not // loaded in eager-loading with this name. func (_m *Dsse) NamedPayloadDigests(name string) ([]*PayloadDigest, error) { if _m.Edges.namedPayloadDigests == nil { return nil, &NotLoadedError{edge: name} } nodes, ok := _m.Edges.namedPayloadDigests[name] if !ok { return nil, &NotLoadedError{edge: name} } return nodes, nil } func (_m *Dsse) appendNamedPayloadDigests(name string, edges ...*PayloadDigest) { if _m.Edges.namedPayloadDigests == nil { _m.Edges.namedPayloadDigests = make(map[string][]*PayloadDigest) } if len(edges) == 0 { _m.Edges.namedPayloadDigests[name] = []*PayloadDigest{} } else { _m.Edges.namedPayloadDigests[name] = append(_m.Edges.namedPayloadDigests[name], edges...) } } // Dsses is a parsable slice of Dsse. type Dsses []*Dsse golang-github-in-toto-archivista-0.11.1/ent/dsse/000077500000000000000000000000001511066247200215735ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/dsse/dsse.go000066400000000000000000000144751511066247200230730ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package dsse import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the dsse type in the database. Label = "dsse" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldGitoidSha256 holds the string denoting the gitoid_sha256 field in the database. FieldGitoidSha256 = "gitoid_sha256" // FieldPayloadType holds the string denoting the payload_type field in the database. FieldPayloadType = "payload_type" // EdgeStatement holds the string denoting the statement edge name in mutations. EdgeStatement = "statement" // EdgeSignatures holds the string denoting the signatures edge name in mutations. EdgeSignatures = "signatures" // EdgePayloadDigests holds the string denoting the payload_digests edge name in mutations. EdgePayloadDigests = "payload_digests" // Table holds the table name of the dsse in the database. Table = "dsses" // StatementTable is the table that holds the statement relation/edge. StatementTable = "dsses" // StatementInverseTable is the table name for the Statement entity. // It exists in this package in order to avoid circular dependency with the "statement" package. StatementInverseTable = "statements" // StatementColumn is the table column denoting the statement relation/edge. StatementColumn = "dsse_statement" // SignaturesTable is the table that holds the signatures relation/edge. SignaturesTable = "signatures" // SignaturesInverseTable is the table name for the Signature entity. // It exists in this package in order to avoid circular dependency with the "signature" package. SignaturesInverseTable = "signatures" // SignaturesColumn is the table column denoting the signatures relation/edge. SignaturesColumn = "dsse_signatures" // PayloadDigestsTable is the table that holds the payload_digests relation/edge. PayloadDigestsTable = "payload_digests" // PayloadDigestsInverseTable is the table name for the PayloadDigest entity. // It exists in this package in order to avoid circular dependency with the "payloaddigest" package. PayloadDigestsInverseTable = "payload_digests" // PayloadDigestsColumn is the table column denoting the payload_digests relation/edge. PayloadDigestsColumn = "dsse_payload_digests" ) // Columns holds all SQL columns for dsse fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldGitoidSha256, FieldPayloadType, } // ForeignKeys holds the SQL foreign-keys that are owned by the "dsses" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "dsse_statement", } // 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 ( // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // GitoidSha256Validator is a validator for the "gitoid_sha256" field. It is called by the builders before save. GitoidSha256Validator func(string) error // PayloadTypeValidator is a validator for the "payload_type" field. It is called by the builders before save. PayloadTypeValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the Dsse queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } // ByGitoidSha256 orders the results by the gitoid_sha256 field. func ByGitoidSha256(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldGitoidSha256, opts...).ToFunc() } // ByPayloadType orders the results by the payload_type field. func ByPayloadType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPayloadType, opts...).ToFunc() } // ByStatementField orders the results by statement field. func ByStatementField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newStatementStep(), sql.OrderByField(field, opts...)) } } // BySignaturesCount orders the results by signatures count. func BySignaturesCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newSignaturesStep(), opts...) } } // BySignatures orders the results by signatures terms. func BySignatures(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSignaturesStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByPayloadDigestsCount orders the results by payload_digests count. func ByPayloadDigestsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newPayloadDigestsStep(), opts...) } } // ByPayloadDigests orders the results by payload_digests terms. func ByPayloadDigests(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newPayloadDigestsStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newStatementStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(StatementInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, false, StatementTable, StatementColumn), ) } func newSignaturesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SignaturesInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, SignaturesTable, SignaturesColumn), ) } func newPayloadDigestsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(PayloadDigestsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, PayloadDigestsTable, PayloadDigestsColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/dsse/where.go000066400000000000000000000266151511066247200232460ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package dsse import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.Dsse { return predicate.Dsse(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.Dsse { return predicate.Dsse(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.Dsse { return predicate.Dsse(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.Dsse { return predicate.Dsse(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.Dsse { return predicate.Dsse(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.Dsse { return predicate.Dsse(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.Dsse { return predicate.Dsse(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.Dsse { return predicate.Dsse(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.Dsse { return predicate.Dsse(sql.FieldLTE(FieldID, id)) } // CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. func CreatedAt(v time.Time) predicate.Dsse { return predicate.Dsse(sql.FieldEQ(FieldCreatedAt, v)) } // GitoidSha256 applies equality check predicate on the "gitoid_sha256" field. It's identical to GitoidSha256EQ. func GitoidSha256(v string) predicate.Dsse { return predicate.Dsse(sql.FieldEQ(FieldGitoidSha256, v)) } // PayloadType applies equality check predicate on the "payload_type" field. It's identical to PayloadTypeEQ. func PayloadType(v string) predicate.Dsse { return predicate.Dsse(sql.FieldEQ(FieldPayloadType, v)) } // CreatedAtEQ applies the EQ predicate on the "created_at" field. func CreatedAtEQ(v time.Time) predicate.Dsse { return predicate.Dsse(sql.FieldEQ(FieldCreatedAt, v)) } // CreatedAtNEQ applies the NEQ predicate on the "created_at" field. func CreatedAtNEQ(v time.Time) predicate.Dsse { return predicate.Dsse(sql.FieldNEQ(FieldCreatedAt, v)) } // CreatedAtIn applies the In predicate on the "created_at" field. func CreatedAtIn(vs ...time.Time) predicate.Dsse { return predicate.Dsse(sql.FieldIn(FieldCreatedAt, vs...)) } // CreatedAtNotIn applies the NotIn predicate on the "created_at" field. func CreatedAtNotIn(vs ...time.Time) predicate.Dsse { return predicate.Dsse(sql.FieldNotIn(FieldCreatedAt, vs...)) } // CreatedAtGT applies the GT predicate on the "created_at" field. func CreatedAtGT(v time.Time) predicate.Dsse { return predicate.Dsse(sql.FieldGT(FieldCreatedAt, v)) } // CreatedAtGTE applies the GTE predicate on the "created_at" field. func CreatedAtGTE(v time.Time) predicate.Dsse { return predicate.Dsse(sql.FieldGTE(FieldCreatedAt, v)) } // CreatedAtLT applies the LT predicate on the "created_at" field. func CreatedAtLT(v time.Time) predicate.Dsse { return predicate.Dsse(sql.FieldLT(FieldCreatedAt, v)) } // CreatedAtLTE applies the LTE predicate on the "created_at" field. func CreatedAtLTE(v time.Time) predicate.Dsse { return predicate.Dsse(sql.FieldLTE(FieldCreatedAt, v)) } // CreatedAtIsNil applies the IsNil predicate on the "created_at" field. func CreatedAtIsNil() predicate.Dsse { return predicate.Dsse(sql.FieldIsNull(FieldCreatedAt)) } // CreatedAtNotNil applies the NotNil predicate on the "created_at" field. func CreatedAtNotNil() predicate.Dsse { return predicate.Dsse(sql.FieldNotNull(FieldCreatedAt)) } // GitoidSha256EQ applies the EQ predicate on the "gitoid_sha256" field. func GitoidSha256EQ(v string) predicate.Dsse { return predicate.Dsse(sql.FieldEQ(FieldGitoidSha256, v)) } // GitoidSha256NEQ applies the NEQ predicate on the "gitoid_sha256" field. func GitoidSha256NEQ(v string) predicate.Dsse { return predicate.Dsse(sql.FieldNEQ(FieldGitoidSha256, v)) } // GitoidSha256In applies the In predicate on the "gitoid_sha256" field. func GitoidSha256In(vs ...string) predicate.Dsse { return predicate.Dsse(sql.FieldIn(FieldGitoidSha256, vs...)) } // GitoidSha256NotIn applies the NotIn predicate on the "gitoid_sha256" field. func GitoidSha256NotIn(vs ...string) predicate.Dsse { return predicate.Dsse(sql.FieldNotIn(FieldGitoidSha256, vs...)) } // GitoidSha256GT applies the GT predicate on the "gitoid_sha256" field. func GitoidSha256GT(v string) predicate.Dsse { return predicate.Dsse(sql.FieldGT(FieldGitoidSha256, v)) } // GitoidSha256GTE applies the GTE predicate on the "gitoid_sha256" field. func GitoidSha256GTE(v string) predicate.Dsse { return predicate.Dsse(sql.FieldGTE(FieldGitoidSha256, v)) } // GitoidSha256LT applies the LT predicate on the "gitoid_sha256" field. func GitoidSha256LT(v string) predicate.Dsse { return predicate.Dsse(sql.FieldLT(FieldGitoidSha256, v)) } // GitoidSha256LTE applies the LTE predicate on the "gitoid_sha256" field. func GitoidSha256LTE(v string) predicate.Dsse { return predicate.Dsse(sql.FieldLTE(FieldGitoidSha256, v)) } // GitoidSha256Contains applies the Contains predicate on the "gitoid_sha256" field. func GitoidSha256Contains(v string) predicate.Dsse { return predicate.Dsse(sql.FieldContains(FieldGitoidSha256, v)) } // GitoidSha256HasPrefix applies the HasPrefix predicate on the "gitoid_sha256" field. func GitoidSha256HasPrefix(v string) predicate.Dsse { return predicate.Dsse(sql.FieldHasPrefix(FieldGitoidSha256, v)) } // GitoidSha256HasSuffix applies the HasSuffix predicate on the "gitoid_sha256" field. func GitoidSha256HasSuffix(v string) predicate.Dsse { return predicate.Dsse(sql.FieldHasSuffix(FieldGitoidSha256, v)) } // GitoidSha256EqualFold applies the EqualFold predicate on the "gitoid_sha256" field. func GitoidSha256EqualFold(v string) predicate.Dsse { return predicate.Dsse(sql.FieldEqualFold(FieldGitoidSha256, v)) } // GitoidSha256ContainsFold applies the ContainsFold predicate on the "gitoid_sha256" field. func GitoidSha256ContainsFold(v string) predicate.Dsse { return predicate.Dsse(sql.FieldContainsFold(FieldGitoidSha256, v)) } // PayloadTypeEQ applies the EQ predicate on the "payload_type" field. func PayloadTypeEQ(v string) predicate.Dsse { return predicate.Dsse(sql.FieldEQ(FieldPayloadType, v)) } // PayloadTypeNEQ applies the NEQ predicate on the "payload_type" field. func PayloadTypeNEQ(v string) predicate.Dsse { return predicate.Dsse(sql.FieldNEQ(FieldPayloadType, v)) } // PayloadTypeIn applies the In predicate on the "payload_type" field. func PayloadTypeIn(vs ...string) predicate.Dsse { return predicate.Dsse(sql.FieldIn(FieldPayloadType, vs...)) } // PayloadTypeNotIn applies the NotIn predicate on the "payload_type" field. func PayloadTypeNotIn(vs ...string) predicate.Dsse { return predicate.Dsse(sql.FieldNotIn(FieldPayloadType, vs...)) } // PayloadTypeGT applies the GT predicate on the "payload_type" field. func PayloadTypeGT(v string) predicate.Dsse { return predicate.Dsse(sql.FieldGT(FieldPayloadType, v)) } // PayloadTypeGTE applies the GTE predicate on the "payload_type" field. func PayloadTypeGTE(v string) predicate.Dsse { return predicate.Dsse(sql.FieldGTE(FieldPayloadType, v)) } // PayloadTypeLT applies the LT predicate on the "payload_type" field. func PayloadTypeLT(v string) predicate.Dsse { return predicate.Dsse(sql.FieldLT(FieldPayloadType, v)) } // PayloadTypeLTE applies the LTE predicate on the "payload_type" field. func PayloadTypeLTE(v string) predicate.Dsse { return predicate.Dsse(sql.FieldLTE(FieldPayloadType, v)) } // PayloadTypeContains applies the Contains predicate on the "payload_type" field. func PayloadTypeContains(v string) predicate.Dsse { return predicate.Dsse(sql.FieldContains(FieldPayloadType, v)) } // PayloadTypeHasPrefix applies the HasPrefix predicate on the "payload_type" field. func PayloadTypeHasPrefix(v string) predicate.Dsse { return predicate.Dsse(sql.FieldHasPrefix(FieldPayloadType, v)) } // PayloadTypeHasSuffix applies the HasSuffix predicate on the "payload_type" field. func PayloadTypeHasSuffix(v string) predicate.Dsse { return predicate.Dsse(sql.FieldHasSuffix(FieldPayloadType, v)) } // PayloadTypeEqualFold applies the EqualFold predicate on the "payload_type" field. func PayloadTypeEqualFold(v string) predicate.Dsse { return predicate.Dsse(sql.FieldEqualFold(FieldPayloadType, v)) } // PayloadTypeContainsFold applies the ContainsFold predicate on the "payload_type" field. func PayloadTypeContainsFold(v string) predicate.Dsse { return predicate.Dsse(sql.FieldContainsFold(FieldPayloadType, v)) } // HasStatement applies the HasEdge predicate on the "statement" edge. func HasStatement() predicate.Dsse { return predicate.Dsse(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, false, StatementTable, StatementColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasStatementWith applies the HasEdge predicate on the "statement" edge with a given conditions (other predicates). func HasStatementWith(preds ...predicate.Statement) predicate.Dsse { return predicate.Dsse(func(s *sql.Selector) { step := newStatementStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) }) } // HasSignatures applies the HasEdge predicate on the "signatures" edge. func HasSignatures() predicate.Dsse { return predicate.Dsse(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, SignaturesTable, SignaturesColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasSignaturesWith applies the HasEdge predicate on the "signatures" edge with a given conditions (other predicates). func HasSignaturesWith(preds ...predicate.Signature) predicate.Dsse { return predicate.Dsse(func(s *sql.Selector) { step := newSignaturesStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) }) } // HasPayloadDigests applies the HasEdge predicate on the "payload_digests" edge. func HasPayloadDigests() predicate.Dsse { return predicate.Dsse(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, PayloadDigestsTable, PayloadDigestsColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasPayloadDigestsWith applies the HasEdge predicate on the "payload_digests" edge with a given conditions (other predicates). func HasPayloadDigestsWith(preds ...predicate.PayloadDigest) predicate.Dsse { return predicate.Dsse(func(s *sql.Selector) { step := newPayloadDigestsStep() 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.Dsse) predicate.Dsse { return predicate.Dsse(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Dsse) predicate.Dsse { return predicate.Dsse(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Dsse) predicate.Dsse { return predicate.Dsse(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/dsse_create.go000066400000000000000000000236341511066247200234550ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "time" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" ) // DsseCreate is the builder for creating a Dsse entity. type DsseCreate struct { config mutation *DsseMutation hooks []Hook } // SetCreatedAt sets the "created_at" field. func (_c *DsseCreate) SetCreatedAt(v time.Time) *DsseCreate { _c.mutation.SetCreatedAt(v) return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. func (_c *DsseCreate) SetNillableCreatedAt(v *time.Time) *DsseCreate { if v != nil { _c.SetCreatedAt(*v) } return _c } // SetGitoidSha256 sets the "gitoid_sha256" field. func (_c *DsseCreate) SetGitoidSha256(v string) *DsseCreate { _c.mutation.SetGitoidSha256(v) return _c } // SetPayloadType sets the "payload_type" field. func (_c *DsseCreate) SetPayloadType(v string) *DsseCreate { _c.mutation.SetPayloadType(v) return _c } // SetID sets the "id" field. func (_c *DsseCreate) SetID(v uuid.UUID) *DsseCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *DsseCreate) SetNillableID(v *uuid.UUID) *DsseCreate { if v != nil { _c.SetID(*v) } return _c } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_c *DsseCreate) SetStatementID(id uuid.UUID) *DsseCreate { _c.mutation.SetStatementID(id) return _c } // SetNillableStatementID sets the "statement" edge to the Statement entity by ID if the given value is not nil. func (_c *DsseCreate) SetNillableStatementID(id *uuid.UUID) *DsseCreate { if id != nil { _c = _c.SetStatementID(*id) } return _c } // SetStatement sets the "statement" edge to the Statement entity. func (_c *DsseCreate) SetStatement(v *Statement) *DsseCreate { return _c.SetStatementID(v.ID) } // AddSignatureIDs adds the "signatures" edge to the Signature entity by IDs. func (_c *DsseCreate) AddSignatureIDs(ids ...uuid.UUID) *DsseCreate { _c.mutation.AddSignatureIDs(ids...) return _c } // AddSignatures adds the "signatures" edges to the Signature entity. func (_c *DsseCreate) AddSignatures(v ...*Signature) *DsseCreate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _c.AddSignatureIDs(ids...) } // AddPayloadDigestIDs adds the "payload_digests" edge to the PayloadDigest entity by IDs. func (_c *DsseCreate) AddPayloadDigestIDs(ids ...uuid.UUID) *DsseCreate { _c.mutation.AddPayloadDigestIDs(ids...) return _c } // AddPayloadDigests adds the "payload_digests" edges to the PayloadDigest entity. func (_c *DsseCreate) AddPayloadDigests(v ...*PayloadDigest) *DsseCreate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _c.AddPayloadDigestIDs(ids...) } // Mutation returns the DsseMutation object of the builder. func (_c *DsseCreate) Mutation() *DsseMutation { return _c.mutation } // Save creates the Dsse in the database. func (_c *DsseCreate) Save(ctx context.Context) (*Dsse, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *DsseCreate) SaveX(ctx context.Context) *Dsse { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *DsseCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *DsseCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *DsseCreate) defaults() { if _, ok := _c.mutation.CreatedAt(); !ok { v := dsse.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } if _, ok := _c.mutation.ID(); !ok { v := dsse.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *DsseCreate) check() error { if _, ok := _c.mutation.GitoidSha256(); !ok { return &ValidationError{Name: "gitoid_sha256", err: errors.New(`ent: missing required field "Dsse.gitoid_sha256"`)} } if v, ok := _c.mutation.GitoidSha256(); ok { if err := dsse.GitoidSha256Validator(v); err != nil { return &ValidationError{Name: "gitoid_sha256", err: fmt.Errorf(`ent: validator failed for field "Dsse.gitoid_sha256": %w`, err)} } } if _, ok := _c.mutation.PayloadType(); !ok { return &ValidationError{Name: "payload_type", err: errors.New(`ent: missing required field "Dsse.payload_type"`)} } if v, ok := _c.mutation.PayloadType(); ok { if err := dsse.PayloadTypeValidator(v); err != nil { return &ValidationError{Name: "payload_type", err: fmt.Errorf(`ent: validator failed for field "Dsse.payload_type": %w`, err)} } } return nil } func (_c *DsseCreate) sqlSave(ctx context.Context) (*Dsse, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *DsseCreate) createSpec() (*Dsse, *sqlgraph.CreateSpec) { var ( _node = &Dsse{config: _c.config} _spec = sqlgraph.NewCreateSpec(dsse.Table, sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(dsse.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = &value } if value, ok := _c.mutation.GitoidSha256(); ok { _spec.SetField(dsse.FieldGitoidSha256, field.TypeString, value) _node.GitoidSha256 = value } if value, ok := _c.mutation.PayloadType(); ok { _spec.SetField(dsse.FieldPayloadType, field.TypeString, value) _node.PayloadType = value } if nodes := _c.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, Table: dsse.StatementTable, Columns: []string{dsse.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.dsse_statement = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.SignaturesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.SignaturesTable, Columns: []string{dsse.SignaturesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.PayloadDigestsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.PayloadDigestsTable, Columns: []string{dsse.PayloadDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // DsseCreateBulk is the builder for creating many Dsse entities in bulk. type DsseCreateBulk struct { config err error builders []*DsseCreate } // Save creates the Dsse entities in the database. func (_c *DsseCreateBulk) Save(ctx context.Context) ([]*Dsse, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*Dsse, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*DsseMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *DsseCreateBulk) SaveX(ctx context.Context) []*Dsse { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *DsseCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *DsseCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/dsse_delete.go000066400000000000000000000042021511066247200234420ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/predicate" ) // DsseDelete is the builder for deleting a Dsse entity. type DsseDelete struct { config hooks []Hook mutation *DsseMutation } // Where appends a list predicates to the DsseDelete builder. func (_d *DsseDelete) Where(ps ...predicate.Dsse) *DsseDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *DsseDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *DsseDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *DsseDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(dsse.Table, sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // DsseDeleteOne is the builder for deleting a single Dsse entity. type DsseDeleteOne struct { _d *DsseDelete } // Where appends a list predicates to the DsseDelete builder. func (_d *DsseDeleteOne) Where(ps ...predicate.Dsse) *DsseDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *DsseDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{dsse.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *DsseDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/dsse_query.go000066400000000000000000000577171511066247200233700ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" ) // DsseQuery is the builder for querying Dsse entities. type DsseQuery struct { config ctx *QueryContext order []dsse.OrderOption inters []Interceptor predicates []predicate.Dsse withStatement *StatementQuery withSignatures *SignatureQuery withPayloadDigests *PayloadDigestQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*Dsse) error withNamedSignatures map[string]*SignatureQuery withNamedPayloadDigests map[string]*PayloadDigestQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the DsseQuery builder. func (_q *DsseQuery) Where(ps ...predicate.Dsse) *DsseQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *DsseQuery) Limit(limit int) *DsseQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *DsseQuery) Offset(offset int) *DsseQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *DsseQuery) Unique(unique bool) *DsseQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *DsseQuery) Order(o ...dsse.OrderOption) *DsseQuery { _q.order = append(_q.order, o...) return _q } // QueryStatement chains the current query on the "statement" edge. func (_q *DsseQuery) QueryStatement() *StatementQuery { query := (&StatementClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(dsse.Table, dsse.FieldID, selector), sqlgraph.To(statement.Table, statement.FieldID), sqlgraph.Edge(sqlgraph.M2O, false, dsse.StatementTable, dsse.StatementColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QuerySignatures chains the current query on the "signatures" edge. func (_q *DsseQuery) QuerySignatures() *SignatureQuery { query := (&SignatureClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(dsse.Table, dsse.FieldID, selector), sqlgraph.To(signature.Table, signature.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, dsse.SignaturesTable, dsse.SignaturesColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryPayloadDigests chains the current query on the "payload_digests" edge. func (_q *DsseQuery) QueryPayloadDigests() *PayloadDigestQuery { query := (&PayloadDigestClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(dsse.Table, dsse.FieldID, selector), sqlgraph.To(payloaddigest.Table, payloaddigest.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, dsse.PayloadDigestsTable, dsse.PayloadDigestsColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first Dsse entity from the query. // Returns a *NotFoundError when no Dsse was found. func (_q *DsseQuery) First(ctx context.Context) (*Dsse, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{dsse.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *DsseQuery) FirstX(ctx context.Context) *Dsse { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first Dsse ID from the query. // Returns a *NotFoundError when no Dsse ID was found. func (_q *DsseQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{dsse.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *DsseQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single Dsse entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Dsse entity is found. // Returns a *NotFoundError when no Dsse entities are found. func (_q *DsseQuery) Only(ctx context.Context) (*Dsse, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{dsse.Label} default: return nil, &NotSingularError{dsse.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *DsseQuery) OnlyX(ctx context.Context) *Dsse { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only Dsse ID in the query. // Returns a *NotSingularError when more than one Dsse ID is found. // Returns a *NotFoundError when no entities are found. func (_q *DsseQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{dsse.Label} default: err = &NotSingularError{dsse.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *DsseQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of Dsses. func (_q *DsseQuery) All(ctx context.Context) ([]*Dsse, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Dsse, *DsseQuery]() return withInterceptors[[]*Dsse](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *DsseQuery) AllX(ctx context.Context) []*Dsse { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of Dsse IDs. func (_q *DsseQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(dsse.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *DsseQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *DsseQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*DsseQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *DsseQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *DsseQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *DsseQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the DsseQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *DsseQuery) Clone() *DsseQuery { if _q == nil { return nil } return &DsseQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]dsse.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.Dsse{}, _q.predicates...), withStatement: _q.withStatement.Clone(), withSignatures: _q.withSignatures.Clone(), withPayloadDigests: _q.withPayloadDigests.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithStatement tells the query-builder to eager-load the nodes that are connected to // the "statement" edge. The optional arguments are used to configure the query builder of the edge. func (_q *DsseQuery) WithStatement(opts ...func(*StatementQuery)) *DsseQuery { query := (&StatementClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withStatement = query return _q } // WithSignatures tells the query-builder to eager-load the nodes that are connected to // the "signatures" edge. The optional arguments are used to configure the query builder of the edge. func (_q *DsseQuery) WithSignatures(opts ...func(*SignatureQuery)) *DsseQuery { query := (&SignatureClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withSignatures = query return _q } // WithPayloadDigests tells the query-builder to eager-load the nodes that are connected to // the "payload_digests" edge. The optional arguments are used to configure the query builder of the edge. func (_q *DsseQuery) WithPayloadDigests(opts ...func(*PayloadDigestQuery)) *DsseQuery { query := (&PayloadDigestClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withPayloadDigests = query return _q } // 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 { // CreatedAt time.Time `json:"created_at,omitempty"` // Count int `json:"count,omitempty"` // } // // client.Dsse.Query(). // GroupBy(dsse.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *DsseQuery) GroupBy(field string, fields ...string) *DsseGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &DsseGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = dsse.Label grbuild.scan = grbuild.Scan return grbuild } // 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 { // CreatedAt time.Time `json:"created_at,omitempty"` // } // // client.Dsse.Query(). // Select(dsse.FieldCreatedAt). // Scan(ctx, &v) func (_q *DsseQuery) Select(fields ...string) *DsseSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &DsseSelect{DsseQuery: _q} sbuild.label = dsse.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a DsseSelect configured with the given aggregations. func (_q *DsseQuery) Aggregate(fns ...AggregateFunc) *DsseSelect { return _q.Select().Aggregate(fns...) } func (_q *DsseQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !dsse.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *DsseQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Dsse, error) { var ( nodes = []*Dsse{} withFKs = _q.withFKs _spec = _q.querySpec() loadedTypes = [3]bool{ _q.withStatement != nil, _q.withSignatures != nil, _q.withPayloadDigests != nil, } ) if _q.withStatement != nil { withFKs = true } if withFKs { _spec.Node.Columns = append(_spec.Node.Columns, dsse.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]any, error) { return (*Dsse).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &Dsse{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withStatement; query != nil { if err := _q.loadStatement(ctx, query, nodes, nil, func(n *Dsse, e *Statement) { n.Edges.Statement = e }); err != nil { return nil, err } } if query := _q.withSignatures; query != nil { if err := _q.loadSignatures(ctx, query, nodes, func(n *Dsse) { n.Edges.Signatures = []*Signature{} }, func(n *Dsse, e *Signature) { n.Edges.Signatures = append(n.Edges.Signatures, e) }); err != nil { return nil, err } } if query := _q.withPayloadDigests; query != nil { if err := _q.loadPayloadDigests(ctx, query, nodes, func(n *Dsse) { n.Edges.PayloadDigests = []*PayloadDigest{} }, func(n *Dsse, e *PayloadDigest) { n.Edges.PayloadDigests = append(n.Edges.PayloadDigests, e) }); err != nil { return nil, err } } for name, query := range _q.withNamedSignatures { if err := _q.loadSignatures(ctx, query, nodes, func(n *Dsse) { n.appendNamedSignatures(name) }, func(n *Dsse, e *Signature) { n.appendNamedSignatures(name, e) }); err != nil { return nil, err } } for name, query := range _q.withNamedPayloadDigests { if err := _q.loadPayloadDigests(ctx, query, nodes, func(n *Dsse) { n.appendNamedPayloadDigests(name) }, func(n *Dsse, e *PayloadDigest) { n.appendNamedPayloadDigests(name, e) }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *DsseQuery) loadStatement(ctx context.Context, query *StatementQuery, nodes []*Dsse, init func(*Dsse), assign func(*Dsse, *Statement)) error { ids := make([]uuid.UUID, 0, len(nodes)) nodeids := make(map[uuid.UUID][]*Dsse) for i := range nodes { if nodes[i].dsse_statement == nil { continue } fk := *nodes[i].dsse_statement if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(statement.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "dsse_statement" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil } func (_q *DsseQuery) loadSignatures(ctx context.Context, query *SignatureQuery, nodes []*Dsse, init func(*Dsse), assign func(*Dsse, *Signature)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[uuid.UUID]*Dsse) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] if init != nil { init(nodes[i]) } } query.withFKs = true query.Where(predicate.Signature(func(s *sql.Selector) { s.Where(sql.InValues(s.C(dsse.SignaturesColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.dsse_signatures if fk == nil { return fmt.Errorf(`foreign-key "dsse_signatures" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "dsse_signatures" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil } func (_q *DsseQuery) loadPayloadDigests(ctx context.Context, query *PayloadDigestQuery, nodes []*Dsse, init func(*Dsse), assign func(*Dsse, *PayloadDigest)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[uuid.UUID]*Dsse) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] if init != nil { init(nodes[i]) } } query.withFKs = true query.Where(predicate.PayloadDigest(func(s *sql.Selector) { s.Where(sql.InValues(s.C(dsse.PayloadDigestsColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.dsse_payload_digests if fk == nil { return fmt.Errorf(`foreign-key "dsse_payload_digests" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "dsse_payload_digests" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil } func (_q *DsseQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *DsseQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(dsse.Table, dsse.Columns, sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, dsse.FieldID) for i := range fields { if fields[i] != dsse.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *DsseQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(dsse.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = dsse.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // WithNamedSignatures tells the query-builder to eager-load the nodes that are connected to the "signatures" // edge with the given name. The optional arguments are used to configure the query builder of the edge. func (_q *DsseQuery) WithNamedSignatures(name string, opts ...func(*SignatureQuery)) *DsseQuery { query := (&SignatureClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } if _q.withNamedSignatures == nil { _q.withNamedSignatures = make(map[string]*SignatureQuery) } _q.withNamedSignatures[name] = query return _q } // WithNamedPayloadDigests tells the query-builder to eager-load the nodes that are connected to the "payload_digests" // edge with the given name. The optional arguments are used to configure the query builder of the edge. func (_q *DsseQuery) WithNamedPayloadDigests(name string, opts ...func(*PayloadDigestQuery)) *DsseQuery { query := (&PayloadDigestClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } if _q.withNamedPayloadDigests == nil { _q.withNamedPayloadDigests = make(map[string]*PayloadDigestQuery) } _q.withNamedPayloadDigests[name] = query return _q } // DsseGroupBy is the group-by builder for Dsse entities. type DsseGroupBy struct { selector build *DsseQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *DsseGroupBy) Aggregate(fns ...AggregateFunc) *DsseGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *DsseGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*DsseQuery, *DsseGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *DsseGroupBy) sqlScan(ctx context.Context, root *DsseQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // DsseSelect is the builder for selecting fields of Dsse entities. type DsseSelect struct { *DsseQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *DsseSelect) Aggregate(fns ...AggregateFunc) *DsseSelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *DsseSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*DsseQuery, *DsseSelect](ctx, _s.DsseQuery, _s, _s.inters, v) } func (_s *DsseSelect) sqlScan(ctx context.Context, root *DsseQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/dsse_update.go000066400000000000000000000532011511066247200234650ustar00rootroot00000000000000// Code generated by ent, 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/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" ) // DsseUpdate is the builder for updating Dsse entities. type DsseUpdate struct { config hooks []Hook mutation *DsseMutation } // Where appends a list predicates to the DsseUpdate builder. func (_u *DsseUpdate) Where(ps ...predicate.Dsse) *DsseUpdate { _u.mutation.Where(ps...) return _u } // SetGitoidSha256 sets the "gitoid_sha256" field. func (_u *DsseUpdate) SetGitoidSha256(v string) *DsseUpdate { _u.mutation.SetGitoidSha256(v) return _u } // SetNillableGitoidSha256 sets the "gitoid_sha256" field if the given value is not nil. func (_u *DsseUpdate) SetNillableGitoidSha256(v *string) *DsseUpdate { if v != nil { _u.SetGitoidSha256(*v) } return _u } // SetPayloadType sets the "payload_type" field. func (_u *DsseUpdate) SetPayloadType(v string) *DsseUpdate { _u.mutation.SetPayloadType(v) return _u } // SetNillablePayloadType sets the "payload_type" field if the given value is not nil. func (_u *DsseUpdate) SetNillablePayloadType(v *string) *DsseUpdate { if v != nil { _u.SetPayloadType(*v) } return _u } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_u *DsseUpdate) SetStatementID(id uuid.UUID) *DsseUpdate { _u.mutation.SetStatementID(id) return _u } // SetNillableStatementID sets the "statement" edge to the Statement entity by ID if the given value is not nil. func (_u *DsseUpdate) SetNillableStatementID(id *uuid.UUID) *DsseUpdate { if id != nil { _u = _u.SetStatementID(*id) } return _u } // SetStatement sets the "statement" edge to the Statement entity. func (_u *DsseUpdate) SetStatement(v *Statement) *DsseUpdate { return _u.SetStatementID(v.ID) } // AddSignatureIDs adds the "signatures" edge to the Signature entity by IDs. func (_u *DsseUpdate) AddSignatureIDs(ids ...uuid.UUID) *DsseUpdate { _u.mutation.AddSignatureIDs(ids...) return _u } // AddSignatures adds the "signatures" edges to the Signature entity. func (_u *DsseUpdate) AddSignatures(v ...*Signature) *DsseUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddSignatureIDs(ids...) } // AddPayloadDigestIDs adds the "payload_digests" edge to the PayloadDigest entity by IDs. func (_u *DsseUpdate) AddPayloadDigestIDs(ids ...uuid.UUID) *DsseUpdate { _u.mutation.AddPayloadDigestIDs(ids...) return _u } // AddPayloadDigests adds the "payload_digests" edges to the PayloadDigest entity. func (_u *DsseUpdate) AddPayloadDigests(v ...*PayloadDigest) *DsseUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddPayloadDigestIDs(ids...) } // Mutation returns the DsseMutation object of the builder. func (_u *DsseUpdate) Mutation() *DsseMutation { return _u.mutation } // ClearStatement clears the "statement" edge to the Statement entity. func (_u *DsseUpdate) ClearStatement() *DsseUpdate { _u.mutation.ClearStatement() return _u } // ClearSignatures clears all "signatures" edges to the Signature entity. func (_u *DsseUpdate) ClearSignatures() *DsseUpdate { _u.mutation.ClearSignatures() return _u } // RemoveSignatureIDs removes the "signatures" edge to Signature entities by IDs. func (_u *DsseUpdate) RemoveSignatureIDs(ids ...uuid.UUID) *DsseUpdate { _u.mutation.RemoveSignatureIDs(ids...) return _u } // RemoveSignatures removes "signatures" edges to Signature entities. func (_u *DsseUpdate) RemoveSignatures(v ...*Signature) *DsseUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveSignatureIDs(ids...) } // ClearPayloadDigests clears all "payload_digests" edges to the PayloadDigest entity. func (_u *DsseUpdate) ClearPayloadDigests() *DsseUpdate { _u.mutation.ClearPayloadDigests() return _u } // RemovePayloadDigestIDs removes the "payload_digests" edge to PayloadDigest entities by IDs. func (_u *DsseUpdate) RemovePayloadDigestIDs(ids ...uuid.UUID) *DsseUpdate { _u.mutation.RemovePayloadDigestIDs(ids...) return _u } // RemovePayloadDigests removes "payload_digests" edges to PayloadDigest entities. func (_u *DsseUpdate) RemovePayloadDigests(v ...*PayloadDigest) *DsseUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemovePayloadDigestIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *DsseUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *DsseUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *DsseUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *DsseUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *DsseUpdate) check() error { if v, ok := _u.mutation.GitoidSha256(); ok { if err := dsse.GitoidSha256Validator(v); err != nil { return &ValidationError{Name: "gitoid_sha256", err: fmt.Errorf(`ent: validator failed for field "Dsse.gitoid_sha256": %w`, err)} } } if v, ok := _u.mutation.PayloadType(); ok { if err := dsse.PayloadTypeValidator(v); err != nil { return &ValidationError{Name: "payload_type", err: fmt.Errorf(`ent: validator failed for field "Dsse.payload_type": %w`, err)} } } return nil } func (_u *DsseUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(dsse.Table, dsse.Columns, sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if _u.mutation.CreatedAtCleared() { _spec.ClearField(dsse.FieldCreatedAt, field.TypeTime) } if value, ok := _u.mutation.GitoidSha256(); ok { _spec.SetField(dsse.FieldGitoidSha256, field.TypeString, value) } if value, ok := _u.mutation.PayloadType(); ok { _spec.SetField(dsse.FieldPayloadType, field.TypeString, value) } if _u.mutation.StatementCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, Table: dsse.StatementTable, Columns: []string{dsse.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, Table: dsse.StatementTable, Columns: []string{dsse.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.SignaturesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.SignaturesTable, Columns: []string{dsse.SignaturesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedSignaturesIDs(); len(nodes) > 0 && !_u.mutation.SignaturesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.SignaturesTable, Columns: []string{dsse.SignaturesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SignaturesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.SignaturesTable, Columns: []string{dsse.SignaturesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.PayloadDigestsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.PayloadDigestsTable, Columns: []string{dsse.PayloadDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedPayloadDigestsIDs(); len(nodes) > 0 && !_u.mutation.PayloadDigestsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.PayloadDigestsTable, Columns: []string{dsse.PayloadDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.PayloadDigestsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.PayloadDigestsTable, Columns: []string{dsse.PayloadDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{dsse.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // DsseUpdateOne is the builder for updating a single Dsse entity. type DsseUpdateOne struct { config fields []string hooks []Hook mutation *DsseMutation } // SetGitoidSha256 sets the "gitoid_sha256" field. func (_u *DsseUpdateOne) SetGitoidSha256(v string) *DsseUpdateOne { _u.mutation.SetGitoidSha256(v) return _u } // SetNillableGitoidSha256 sets the "gitoid_sha256" field if the given value is not nil. func (_u *DsseUpdateOne) SetNillableGitoidSha256(v *string) *DsseUpdateOne { if v != nil { _u.SetGitoidSha256(*v) } return _u } // SetPayloadType sets the "payload_type" field. func (_u *DsseUpdateOne) SetPayloadType(v string) *DsseUpdateOne { _u.mutation.SetPayloadType(v) return _u } // SetNillablePayloadType sets the "payload_type" field if the given value is not nil. func (_u *DsseUpdateOne) SetNillablePayloadType(v *string) *DsseUpdateOne { if v != nil { _u.SetPayloadType(*v) } return _u } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_u *DsseUpdateOne) SetStatementID(id uuid.UUID) *DsseUpdateOne { _u.mutation.SetStatementID(id) return _u } // SetNillableStatementID sets the "statement" edge to the Statement entity by ID if the given value is not nil. func (_u *DsseUpdateOne) SetNillableStatementID(id *uuid.UUID) *DsseUpdateOne { if id != nil { _u = _u.SetStatementID(*id) } return _u } // SetStatement sets the "statement" edge to the Statement entity. func (_u *DsseUpdateOne) SetStatement(v *Statement) *DsseUpdateOne { return _u.SetStatementID(v.ID) } // AddSignatureIDs adds the "signatures" edge to the Signature entity by IDs. func (_u *DsseUpdateOne) AddSignatureIDs(ids ...uuid.UUID) *DsseUpdateOne { _u.mutation.AddSignatureIDs(ids...) return _u } // AddSignatures adds the "signatures" edges to the Signature entity. func (_u *DsseUpdateOne) AddSignatures(v ...*Signature) *DsseUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddSignatureIDs(ids...) } // AddPayloadDigestIDs adds the "payload_digests" edge to the PayloadDigest entity by IDs. func (_u *DsseUpdateOne) AddPayloadDigestIDs(ids ...uuid.UUID) *DsseUpdateOne { _u.mutation.AddPayloadDigestIDs(ids...) return _u } // AddPayloadDigests adds the "payload_digests" edges to the PayloadDigest entity. func (_u *DsseUpdateOne) AddPayloadDigests(v ...*PayloadDigest) *DsseUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddPayloadDigestIDs(ids...) } // Mutation returns the DsseMutation object of the builder. func (_u *DsseUpdateOne) Mutation() *DsseMutation { return _u.mutation } // ClearStatement clears the "statement" edge to the Statement entity. func (_u *DsseUpdateOne) ClearStatement() *DsseUpdateOne { _u.mutation.ClearStatement() return _u } // ClearSignatures clears all "signatures" edges to the Signature entity. func (_u *DsseUpdateOne) ClearSignatures() *DsseUpdateOne { _u.mutation.ClearSignatures() return _u } // RemoveSignatureIDs removes the "signatures" edge to Signature entities by IDs. func (_u *DsseUpdateOne) RemoveSignatureIDs(ids ...uuid.UUID) *DsseUpdateOne { _u.mutation.RemoveSignatureIDs(ids...) return _u } // RemoveSignatures removes "signatures" edges to Signature entities. func (_u *DsseUpdateOne) RemoveSignatures(v ...*Signature) *DsseUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveSignatureIDs(ids...) } // ClearPayloadDigests clears all "payload_digests" edges to the PayloadDigest entity. func (_u *DsseUpdateOne) ClearPayloadDigests() *DsseUpdateOne { _u.mutation.ClearPayloadDigests() return _u } // RemovePayloadDigestIDs removes the "payload_digests" edge to PayloadDigest entities by IDs. func (_u *DsseUpdateOne) RemovePayloadDigestIDs(ids ...uuid.UUID) *DsseUpdateOne { _u.mutation.RemovePayloadDigestIDs(ids...) return _u } // RemovePayloadDigests removes "payload_digests" edges to PayloadDigest entities. func (_u *DsseUpdateOne) RemovePayloadDigests(v ...*PayloadDigest) *DsseUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemovePayloadDigestIDs(ids...) } // Where appends a list predicates to the DsseUpdate builder. func (_u *DsseUpdateOne) Where(ps ...predicate.Dsse) *DsseUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *DsseUpdateOne) Select(field string, fields ...string) *DsseUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated Dsse entity. func (_u *DsseUpdateOne) Save(ctx context.Context) (*Dsse, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *DsseUpdateOne) SaveX(ctx context.Context) *Dsse { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *DsseUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *DsseUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *DsseUpdateOne) check() error { if v, ok := _u.mutation.GitoidSha256(); ok { if err := dsse.GitoidSha256Validator(v); err != nil { return &ValidationError{Name: "gitoid_sha256", err: fmt.Errorf(`ent: validator failed for field "Dsse.gitoid_sha256": %w`, err)} } } if v, ok := _u.mutation.PayloadType(); ok { if err := dsse.PayloadTypeValidator(v); err != nil { return &ValidationError{Name: "payload_type", err: fmt.Errorf(`ent: validator failed for field "Dsse.payload_type": %w`, err)} } } return nil } func (_u *DsseUpdateOne) sqlSave(ctx context.Context) (_node *Dsse, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(dsse.Table, dsse.Columns, sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Dsse.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, dsse.FieldID) for _, f := range fields { if !dsse.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != dsse.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if _u.mutation.CreatedAtCleared() { _spec.ClearField(dsse.FieldCreatedAt, field.TypeTime) } if value, ok := _u.mutation.GitoidSha256(); ok { _spec.SetField(dsse.FieldGitoidSha256, field.TypeString, value) } if value, ok := _u.mutation.PayloadType(); ok { _spec.SetField(dsse.FieldPayloadType, field.TypeString, value) } if _u.mutation.StatementCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, Table: dsse.StatementTable, Columns: []string{dsse.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, Table: dsse.StatementTable, Columns: []string{dsse.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.SignaturesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.SignaturesTable, Columns: []string{dsse.SignaturesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedSignaturesIDs(); len(nodes) > 0 && !_u.mutation.SignaturesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.SignaturesTable, Columns: []string{dsse.SignaturesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SignaturesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.SignaturesTable, Columns: []string{dsse.SignaturesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.PayloadDigestsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.PayloadDigestsTable, Columns: []string{dsse.PayloadDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedPayloadDigestsIDs(); len(nodes) > 0 && !_u.mutation.PayloadDigestsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.PayloadDigestsTable, Columns: []string{dsse.PayloadDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.PayloadDigestsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: dsse.PayloadDigestsTable, Columns: []string{dsse.PayloadDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &Dsse{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{dsse.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/ent.go000066400000000000000000000412121511066247200217520ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "reflect" "sync" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" "github.com/in-toto/archivista/ent/timestamp" ) // ent aliases to avoid import conflicts in user's code. type ( Op = ent.Op Hook = ent.Hook Value = ent.Value Query = ent.Query QueryContext = ent.QueryContext Querier = ent.Querier QuerierFunc = ent.QuerierFunc Interceptor = ent.Interceptor InterceptFunc = ent.InterceptFunc Traverser = ent.Traverser TraverseFunc = ent.TraverseFunc Policy = ent.Policy Mutator = ent.Mutator Mutation = ent.Mutation MutateFunc = ent.MutateFunc ) 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) } // OrderFunc applies an ordering on the sql selector. // Deprecated: Use Asc/Desc functions or the package builders instead. type OrderFunc func(*sql.Selector) var ( initCheck sync.Once columnCheck sql.ColumnCheck ) // checkColumn checks if the column exists in the given table. func checkColumn(t, c string) error { initCheck.Do(func() { columnCheck = sql.NewColumnCheck(map[string]func(string) bool{ attestation.Table: attestation.ValidColumn, attestationcollection.Table: attestationcollection.ValidColumn, attestationpolicy.Table: attestationpolicy.ValidColumn, dsse.Table: dsse.ValidColumn, payloaddigest.Table: payloaddigest.ValidColumn, signature.Table: signature.ValidColumn, statement.Table: statement.ValidColumn, subject.Table: subject.ValidColumn, subjectdigest.Table: subjectdigest.ValidColumn, timestamp.Table: timestamp.ValidColumn, }) }) return columnCheck(t, c) } // Asc applies the given fields in ASC order. func Asc(fields ...string) func(*sql.Selector) { return func(s *sql.Selector) { for _, f := range fields { if err := checkColumn(s.TableName(), 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) func(*sql.Selector) { return func(s *sql.Selector) { for _, f := range fields { if err := checkColumn(s.TableName(), 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 { if err := checkColumn(s.TableName(), 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 { if err := checkColumn(s.TableName(), 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 { if err := checkColumn(s.TableName(), 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 { if err := checkColumn(s.TableName(), 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 or edge 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) } // selector embedded by the different Select/GroupBy builders. type selector struct { label string flds *[]string fns []AggregateFunc scan func(context.Context, any) error } // ScanX is like Scan, but panics if an error occurs. func (s *selector) ScanX(ctx context.Context, v any) { if err := s.scan(ctx, v); err != nil { panic(err) } } // Strings returns list of strings from a selector. It is only allowed when selecting one field. func (s *selector) Strings(ctx context.Context) ([]string, error) { if len(*s.flds) > 1 { return nil, errors.New("ent: Strings is not achievable when selecting more than 1 field") } var v []string if err := s.scan(ctx, &v); err != nil { return nil, err } return v, nil } // StringsX is like Strings, but panics if an error occurs. func (s *selector) StringsX(ctx context.Context) []string { v, err := s.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 (s *selector) String(ctx context.Context) (_ string, err error) { var v []string if v, err = s.Strings(ctx); err != nil { return } switch len(v) { case 1: return v[0], nil case 0: err = &NotFoundError{s.label} default: err = fmt.Errorf("ent: Strings returned %d results when one was expected", len(v)) } return } // StringX is like String, but panics if an error occurs. func (s *selector) StringX(ctx context.Context) string { v, err := s.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 (s *selector) Ints(ctx context.Context) ([]int, error) { if len(*s.flds) > 1 { return nil, errors.New("ent: Ints is not achievable when selecting more than 1 field") } var v []int if err := s.scan(ctx, &v); err != nil { return nil, err } return v, nil } // IntsX is like Ints, but panics if an error occurs. func (s *selector) IntsX(ctx context.Context) []int { v, err := s.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 (s *selector) Int(ctx context.Context) (_ int, err error) { var v []int if v, err = s.Ints(ctx); err != nil { return } switch len(v) { case 1: return v[0], nil case 0: err = &NotFoundError{s.label} default: err = fmt.Errorf("ent: Ints returned %d results when one was expected", len(v)) } return } // IntX is like Int, but panics if an error occurs. func (s *selector) IntX(ctx context.Context) int { v, err := s.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 (s *selector) Float64s(ctx context.Context) ([]float64, error) { if len(*s.flds) > 1 { return nil, errors.New("ent: Float64s is not achievable when selecting more than 1 field") } var v []float64 if err := s.scan(ctx, &v); err != nil { return nil, err } return v, nil } // Float64sX is like Float64s, but panics if an error occurs. func (s *selector) Float64sX(ctx context.Context) []float64 { v, err := s.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 (s *selector) Float64(ctx context.Context) (_ float64, err error) { var v []float64 if v, err = s.Float64s(ctx); err != nil { return } switch len(v) { case 1: return v[0], nil case 0: err = &NotFoundError{s.label} default: err = fmt.Errorf("ent: Float64s returned %d results when one was expected", len(v)) } return } // Float64X is like Float64, but panics if an error occurs. func (s *selector) Float64X(ctx context.Context) float64 { v, err := s.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 (s *selector) Bools(ctx context.Context) ([]bool, error) { if len(*s.flds) > 1 { return nil, errors.New("ent: Bools is not achievable when selecting more than 1 field") } var v []bool if err := s.scan(ctx, &v); err != nil { return nil, err } return v, nil } // BoolsX is like Bools, but panics if an error occurs. func (s *selector) BoolsX(ctx context.Context) []bool { v, err := s.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 (s *selector) Bool(ctx context.Context) (_ bool, err error) { var v []bool if v, err = s.Bools(ctx); err != nil { return } switch len(v) { case 1: return v[0], nil case 0: err = &NotFoundError{s.label} default: err = fmt.Errorf("ent: Bools returned %d results when one was expected", len(v)) } return } // BoolX is like Bool, but panics if an error occurs. func (s *selector) BoolX(ctx context.Context) bool { v, err := s.Bool(ctx) if err != nil { panic(err) } return v } // withHooks invokes the builder operation with the given hooks, if any. func withHooks[V Value, M any, PM interface { *M Mutation }](ctx context.Context, exec func(context.Context) (V, error), mutation PM, hooks []Hook) (value V, err error) { if len(hooks) == 0 { return exec(ctx) } var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutationT, ok := any(m).(PM) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } // Set the mutation to the builder. *mutation = *mutationT return exec(ctx) }) for i := len(hooks) - 1; i >= 0; i-- { if hooks[i] == nil { return value, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)") } mut = hooks[i](mut) } v, err := mut.Mutate(ctx, mutation) if err != nil { return value, err } nv, ok := v.(V) if !ok { return value, fmt.Errorf("unexpected node type %T returned from %T", v, mutation) } return nv, nil } // setContextOp returns a new context with the given QueryContext attached (including its op) in case it does not exist. func setContextOp(ctx context.Context, qc *QueryContext, op string) context.Context { if ent.QueryFromContext(ctx) == nil { qc.Op = op ctx = ent.NewQueryContext(ctx, qc) } return ctx } func querierAll[V Value, Q interface { sqlAll(context.Context, ...queryHook) (V, error) }]() Querier { return QuerierFunc(func(ctx context.Context, q Query) (Value, error) { query, ok := q.(Q) if !ok { return nil, fmt.Errorf("unexpected query type %T", q) } return query.sqlAll(ctx) }) } func querierCount[Q interface { sqlCount(context.Context) (int, error) }]() Querier { return QuerierFunc(func(ctx context.Context, q Query) (Value, error) { query, ok := q.(Q) if !ok { return nil, fmt.Errorf("unexpected query type %T", q) } return query.sqlCount(ctx) }) } func withInterceptors[V Value](ctx context.Context, q Query, qr Querier, inters []Interceptor) (v V, err error) { for i := len(inters) - 1; i >= 0; i-- { qr = inters[i].Intercept(qr) } rv, err := qr.Query(ctx, q) if err != nil { return v, err } vt, ok := rv.(V) if !ok { return v, fmt.Errorf("unexpected type %T returned from %T. expected type: %T", vt, q, v) } return vt, nil } func scanWithInterceptors[Q1 ent.Query, Q2 interface { sqlScan(context.Context, Q1, any) error }](ctx context.Context, rootQuery Q1, selectOrGroup Q2, inters []Interceptor, v any) error { rv := reflect.ValueOf(v) var qr Querier = QuerierFunc(func(ctx context.Context, q Query) (Value, error) { query, ok := q.(Q1) if !ok { return nil, fmt.Errorf("unexpected query type %T", q) } if err := selectOrGroup.sqlScan(ctx, query, v); err != nil { return nil, err } if k := rv.Kind(); k == reflect.Pointer && rv.Elem().CanInterface() { return rv.Elem().Interface(), nil } return v, nil }) for i := len(inters) - 1; i >= 0; i-- { qr = inters[i].Intercept(qr) } vv, err := qr.Query(ctx, rootQuery) if err != nil { return err } switch rv2 := reflect.ValueOf(vv); { case rv.IsNil(), rv2.IsNil(), rv.Kind() != reflect.Pointer: case rv.Type() == rv2.Type(): rv.Elem().Set(rv2.Elem()) case rv.Elem().Type() == rv2.Type(): rv.Elem().Set(rv2) } return nil } // queryHook describes an internal hook for the different sqlAll methods. type queryHook func(context.Context, *sqlgraph.QuerySpec) golang-github-in-toto-archivista-0.11.1/ent/entc.go000066400000000000000000000022071511066247200221160ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. //go:build ignore // +build ignore package main import ( "log" "entgo.io/contrib/entgql" "entgo.io/ent/entc" "entgo.io/ent/entc/gen" ) func main() { ex, err := entgql.NewExtension( entgql.WithWhereInputs(true), entgql.WithConfigPath("./gqlgen.yml"), entgql.WithSchemaGenerator(), entgql.WithSchemaPath("./ent.graphql"), ) if err != nil { log.Fatalf("creating entgql extension: %v", err) } if err := entc.Generate("./ent/schema", &gen.Config{}, entc.Extensions(ex)); err != nil { log.Fatalf("running ent codegen: %v", err) } } golang-github-in-toto-archivista-0.11.1/ent/enttest/000077500000000000000000000000001511066247200223235ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/enttest/enttest.go000066400000000000000000000035141511066247200243430ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package enttest import ( "context" "github.com/in-toto/archivista/ent" // required by schema hooks. _ "github.com/in-toto/archivista/ent/runtime" "entgo.io/ent/dialect/sql/schema" "github.com/in-toto/archivista/ent/migrate" ) type ( // TestingT is the interface that is shared between // testing.T and testing.B and used by enttest. TestingT interface { FailNow() Error(...any) } // 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() } migrateSchema(t, c, o) 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...) migrateSchema(t, c, o) return c } func migrateSchema(t TestingT, c *ent.Client, o *options) { tables, err := schema.CopyTables(migrate.Tables) if err != nil { t.Error(err) t.FailNow() } if err := migrate.Create(context.Background(), c.Schema, tables, o.migrateOpts...); err != nil { t.Error(err) t.FailNow() } } golang-github-in-toto-archivista-0.11.1/ent/gql_collection.go000066400000000000000000001014771511066247200241740ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" "fmt" "entgo.io/contrib/entgql" "entgo.io/ent/dialect/sql" "github.com/99designs/gqlgen/graphql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" "github.com/in-toto/archivista/ent/timestamp" ) // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *AttestationQuery) CollectFields(ctx context.Context, satisfies ...string) (*AttestationQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *AttestationQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(attestation.Columns)) selectedFields = []string{attestation.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "attestationCollection": var ( alias = field.Alias path = append(path, alias) query = (&AttestationCollectionClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, attestationcollectionImplementors)...); err != nil { return err } _q.withAttestationCollection = query case "type": if _, ok := fieldSeen[attestation.FieldType]; !ok { selectedFields = append(selectedFields, attestation.FieldType) fieldSeen[attestation.FieldType] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type attestationPaginateArgs struct { first, last *int after, before *Cursor opts []AttestationPaginateOption } func newAttestationPaginateArgs(rv map[string]any) *attestationPaginateArgs { args := &attestationPaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[whereField].(*AttestationWhereInput); ok { args.opts = append(args.opts, WithAttestationFilter(v.Filter)) } return args } // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *AttestationCollectionQuery) CollectFields(ctx context.Context, satisfies ...string) (*AttestationCollectionQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *AttestationCollectionQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(attestationcollection.Columns)) selectedFields = []string{attestationcollection.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "attestations": var ( alias = field.Alias path = append(path, alias) query = (&AttestationClient{config: _q.config}).Query() ) if err := query.collectField(ctx, false, opCtx, field, path, mayAddCondition(satisfies, attestationImplementors)...); err != nil { return err } _q.WithNamedAttestations(alias, func(wq *AttestationQuery) { *wq = *query }) case "statement": var ( alias = field.Alias path = append(path, alias) query = (&StatementClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, statementImplementors)...); err != nil { return err } _q.withStatement = query case "name": if _, ok := fieldSeen[attestationcollection.FieldName]; !ok { selectedFields = append(selectedFields, attestationcollection.FieldName) fieldSeen[attestationcollection.FieldName] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type attestationcollectionPaginateArgs struct { first, last *int after, before *Cursor opts []AttestationCollectionPaginateOption } func newAttestationCollectionPaginateArgs(rv map[string]any) *attestationcollectionPaginateArgs { args := &attestationcollectionPaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[whereField].(*AttestationCollectionWhereInput); ok { args.opts = append(args.opts, WithAttestationCollectionFilter(v.Filter)) } return args } // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *AttestationPolicyQuery) CollectFields(ctx context.Context, satisfies ...string) (*AttestationPolicyQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *AttestationPolicyQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(attestationpolicy.Columns)) selectedFields = []string{attestationpolicy.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "statement": var ( alias = field.Alias path = append(path, alias) query = (&StatementClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, statementImplementors)...); err != nil { return err } _q.withStatement = query case "name": if _, ok := fieldSeen[attestationpolicy.FieldName]; !ok { selectedFields = append(selectedFields, attestationpolicy.FieldName) fieldSeen[attestationpolicy.FieldName] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type attestationpolicyPaginateArgs struct { first, last *int after, before *Cursor opts []AttestationPolicyPaginateOption } func newAttestationPolicyPaginateArgs(rv map[string]any) *attestationpolicyPaginateArgs { args := &attestationpolicyPaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[whereField].(*AttestationPolicyWhereInput); ok { args.opts = append(args.opts, WithAttestationPolicyFilter(v.Filter)) } return args } // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *DsseQuery) CollectFields(ctx context.Context, satisfies ...string) (*DsseQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *DsseQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(dsse.Columns)) selectedFields = []string{dsse.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "statement": var ( alias = field.Alias path = append(path, alias) query = (&StatementClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, statementImplementors)...); err != nil { return err } _q.withStatement = query case "signatures": var ( alias = field.Alias path = append(path, alias) query = (&SignatureClient{config: _q.config}).Query() ) if err := query.collectField(ctx, false, opCtx, field, path, mayAddCondition(satisfies, signatureImplementors)...); err != nil { return err } _q.WithNamedSignatures(alias, func(wq *SignatureQuery) { *wq = *query }) case "payloadDigests": var ( alias = field.Alias path = append(path, alias) query = (&PayloadDigestClient{config: _q.config}).Query() ) if err := query.collectField(ctx, false, opCtx, field, path, mayAddCondition(satisfies, payloaddigestImplementors)...); err != nil { return err } _q.WithNamedPayloadDigests(alias, func(wq *PayloadDigestQuery) { *wq = *query }) case "createdAt": if _, ok := fieldSeen[dsse.FieldCreatedAt]; !ok { selectedFields = append(selectedFields, dsse.FieldCreatedAt) fieldSeen[dsse.FieldCreatedAt] = struct{}{} } case "gitoidSha256": if _, ok := fieldSeen[dsse.FieldGitoidSha256]; !ok { selectedFields = append(selectedFields, dsse.FieldGitoidSha256) fieldSeen[dsse.FieldGitoidSha256] = struct{}{} } case "payloadType": if _, ok := fieldSeen[dsse.FieldPayloadType]; !ok { selectedFields = append(selectedFields, dsse.FieldPayloadType) fieldSeen[dsse.FieldPayloadType] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type dssePaginateArgs struct { first, last *int after, before *Cursor opts []DssePaginateOption } func newDssePaginateArgs(rv map[string]any) *dssePaginateArgs { args := &dssePaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[orderByField]; ok { switch v := v.(type) { case map[string]any: var ( err1, err2 error order = &DsseOrder{Field: &DsseOrderField{}, Direction: entgql.OrderDirectionAsc} ) if d, ok := v[directionField]; ok { err1 = order.Direction.UnmarshalGQL(d) } if f, ok := v[fieldField]; ok { err2 = order.Field.UnmarshalGQL(f) } if err1 == nil && err2 == nil { args.opts = append(args.opts, WithDsseOrder(order)) } case *DsseOrder: if v != nil { args.opts = append(args.opts, WithDsseOrder(v)) } } } if v, ok := rv[whereField].(*DsseWhereInput); ok { args.opts = append(args.opts, WithDsseFilter(v.Filter)) } return args } // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *PayloadDigestQuery) CollectFields(ctx context.Context, satisfies ...string) (*PayloadDigestQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *PayloadDigestQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(payloaddigest.Columns)) selectedFields = []string{payloaddigest.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "dsse": var ( alias = field.Alias path = append(path, alias) query = (&DsseClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, dsseImplementors)...); err != nil { return err } _q.withDsse = query case "algorithm": if _, ok := fieldSeen[payloaddigest.FieldAlgorithm]; !ok { selectedFields = append(selectedFields, payloaddigest.FieldAlgorithm) fieldSeen[payloaddigest.FieldAlgorithm] = struct{}{} } case "value": if _, ok := fieldSeen[payloaddigest.FieldValue]; !ok { selectedFields = append(selectedFields, payloaddigest.FieldValue) fieldSeen[payloaddigest.FieldValue] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type payloaddigestPaginateArgs struct { first, last *int after, before *Cursor opts []PayloadDigestPaginateOption } func newPayloadDigestPaginateArgs(rv map[string]any) *payloaddigestPaginateArgs { args := &payloaddigestPaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[whereField].(*PayloadDigestWhereInput); ok { args.opts = append(args.opts, WithPayloadDigestFilter(v.Filter)) } return args } // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *SignatureQuery) CollectFields(ctx context.Context, satisfies ...string) (*SignatureQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *SignatureQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(signature.Columns)) selectedFields = []string{signature.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "dsse": var ( alias = field.Alias path = append(path, alias) query = (&DsseClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, dsseImplementors)...); err != nil { return err } _q.withDsse = query case "timestamps": var ( alias = field.Alias path = append(path, alias) query = (&TimestampClient{config: _q.config}).Query() ) if err := query.collectField(ctx, false, opCtx, field, path, mayAddCondition(satisfies, timestampImplementors)...); err != nil { return err } _q.WithNamedTimestamps(alias, func(wq *TimestampQuery) { *wq = *query }) case "keyID": if _, ok := fieldSeen[signature.FieldKeyID]; !ok { selectedFields = append(selectedFields, signature.FieldKeyID) fieldSeen[signature.FieldKeyID] = struct{}{} } case "signature": if _, ok := fieldSeen[signature.FieldSignature]; !ok { selectedFields = append(selectedFields, signature.FieldSignature) fieldSeen[signature.FieldSignature] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type signaturePaginateArgs struct { first, last *int after, before *Cursor opts []SignaturePaginateOption } func newSignaturePaginateArgs(rv map[string]any) *signaturePaginateArgs { args := &signaturePaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[whereField].(*SignatureWhereInput); ok { args.opts = append(args.opts, WithSignatureFilter(v.Filter)) } return args } // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *StatementQuery) CollectFields(ctx context.Context, satisfies ...string) (*StatementQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *StatementQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(statement.Columns)) selectedFields = []string{statement.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "subjects": var ( alias = field.Alias path = append(path, alias) query = (&SubjectClient{config: _q.config}).Query() ) args := newSubjectPaginateArgs(fieldArgs(ctx, new(SubjectWhereInput), path...)) if err := validateFirstLast(args.first, args.last); err != nil { return fmt.Errorf("validate first and last in path %q: %w", path, err) } pager, err := newSubjectPager(args.opts, args.last != nil) if err != nil { return fmt.Errorf("create new pager in path %q: %w", path, err) } if query, err = pager.applyFilter(query); err != nil { return err } ignoredEdges := !hasCollectedField(ctx, append(path, edgesField)...) if hasCollectedField(ctx, append(path, totalCountField)...) || hasCollectedField(ctx, append(path, pageInfoField)...) { hasPagination := args.after != nil || args.first != nil || args.before != nil || args.last != nil if hasPagination || ignoredEdges { query := query.Clone() _q.loadTotal = append(_q.loadTotal, func(ctx context.Context, nodes []*Statement) error { ids := make([]driver.Value, len(nodes)) for i := range nodes { ids[i] = nodes[i].ID } var v []struct { NodeID uuid.UUID `sql:"statement_subjects"` Count int `sql:"count"` } query.Where(func(s *sql.Selector) { s.Where(sql.InValues(s.C(statement.SubjectsColumn), ids...)) }) if err := query.GroupBy(statement.SubjectsColumn).Aggregate(Count()).Scan(ctx, &v); err != nil { return err } m := make(map[uuid.UUID]int, len(v)) for i := range v { m[v[i].NodeID] = v[i].Count } for i := range nodes { n := m[nodes[i].ID] if nodes[i].Edges.totalCount[0] == nil { nodes[i].Edges.totalCount[0] = make(map[string]int) } nodes[i].Edges.totalCount[0][alias] = n } return nil }) } else { _q.loadTotal = append(_q.loadTotal, func(_ context.Context, nodes []*Statement) error { for i := range nodes { n := len(nodes[i].Edges.Subjects) if nodes[i].Edges.totalCount[0] == nil { nodes[i].Edges.totalCount[0] = make(map[string]int) } nodes[i].Edges.totalCount[0][alias] = n } return nil }) } } if ignoredEdges || (args.first != nil && *args.first == 0) || (args.last != nil && *args.last == 0) { continue } if query, err = pager.applyCursors(query, args.after, args.before); err != nil { return err } path = append(path, edgesField, nodeField) if field := collectedField(ctx, path...); field != nil { if err := query.collectField(ctx, false, opCtx, *field, path, mayAddCondition(satisfies, subjectImplementors)...); err != nil { return err } } if limit := paginateLimit(args.first, args.last); limit > 0 { if oneNode { pager.applyOrder(query.Limit(limit)) } else { modify := entgql.LimitPerRow(statement.SubjectsColumn, limit, pager.orderExpr(query)) query.modifiers = append(query.modifiers, modify) } } else { query = pager.applyOrder(query) } _q.WithNamedSubjects(alias, func(wq *SubjectQuery) { *wq = *query }) case "policy": var ( alias = field.Alias path = append(path, alias) query = (&AttestationPolicyClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, attestationpolicyImplementors)...); err != nil { return err } _q.withPolicy = query case "attestationCollections": var ( alias = field.Alias path = append(path, alias) query = (&AttestationCollectionClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, attestationcollectionImplementors)...); err != nil { return err } _q.withAttestationCollections = query case "dsse": var ( alias = field.Alias path = append(path, alias) query = (&DsseClient{config: _q.config}).Query() ) if err := query.collectField(ctx, false, opCtx, field, path, mayAddCondition(satisfies, dsseImplementors)...); err != nil { return err } _q.WithNamedDsse(alias, func(wq *DsseQuery) { *wq = *query }) case "predicate": if _, ok := fieldSeen[statement.FieldPredicate]; !ok { selectedFields = append(selectedFields, statement.FieldPredicate) fieldSeen[statement.FieldPredicate] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type statementPaginateArgs struct { first, last *int after, before *Cursor opts []StatementPaginateOption } func newStatementPaginateArgs(rv map[string]any) *statementPaginateArgs { args := &statementPaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[whereField].(*StatementWhereInput); ok { args.opts = append(args.opts, WithStatementFilter(v.Filter)) } return args } // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *SubjectQuery) CollectFields(ctx context.Context, satisfies ...string) (*SubjectQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *SubjectQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(subject.Columns)) selectedFields = []string{subject.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "subjectDigests": var ( alias = field.Alias path = append(path, alias) query = (&SubjectDigestClient{config: _q.config}).Query() ) if err := query.collectField(ctx, false, opCtx, field, path, mayAddCondition(satisfies, subjectdigestImplementors)...); err != nil { return err } _q.WithNamedSubjectDigests(alias, func(wq *SubjectDigestQuery) { *wq = *query }) case "statement": var ( alias = field.Alias path = append(path, alias) query = (&StatementClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, statementImplementors)...); err != nil { return err } _q.withStatement = query case "createdAt": if _, ok := fieldSeen[subject.FieldCreatedAt]; !ok { selectedFields = append(selectedFields, subject.FieldCreatedAt) fieldSeen[subject.FieldCreatedAt] = struct{}{} } case "name": if _, ok := fieldSeen[subject.FieldName]; !ok { selectedFields = append(selectedFields, subject.FieldName) fieldSeen[subject.FieldName] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type subjectPaginateArgs struct { first, last *int after, before *Cursor opts []SubjectPaginateOption } func newSubjectPaginateArgs(rv map[string]any) *subjectPaginateArgs { args := &subjectPaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[orderByField]; ok { switch v := v.(type) { case map[string]any: var ( err1, err2 error order = &SubjectOrder{Field: &SubjectOrderField{}, Direction: entgql.OrderDirectionAsc} ) if d, ok := v[directionField]; ok { err1 = order.Direction.UnmarshalGQL(d) } if f, ok := v[fieldField]; ok { err2 = order.Field.UnmarshalGQL(f) } if err1 == nil && err2 == nil { args.opts = append(args.opts, WithSubjectOrder(order)) } case *SubjectOrder: if v != nil { args.opts = append(args.opts, WithSubjectOrder(v)) } } } if v, ok := rv[whereField].(*SubjectWhereInput); ok { args.opts = append(args.opts, WithSubjectFilter(v.Filter)) } return args } // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *SubjectDigestQuery) CollectFields(ctx context.Context, satisfies ...string) (*SubjectDigestQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *SubjectDigestQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(subjectdigest.Columns)) selectedFields = []string{subjectdigest.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "subject": var ( alias = field.Alias path = append(path, alias) query = (&SubjectClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, subjectImplementors)...); err != nil { return err } _q.withSubject = query case "algorithm": if _, ok := fieldSeen[subjectdigest.FieldAlgorithm]; !ok { selectedFields = append(selectedFields, subjectdigest.FieldAlgorithm) fieldSeen[subjectdigest.FieldAlgorithm] = struct{}{} } case "value": if _, ok := fieldSeen[subjectdigest.FieldValue]; !ok { selectedFields = append(selectedFields, subjectdigest.FieldValue) fieldSeen[subjectdigest.FieldValue] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type subjectdigestPaginateArgs struct { first, last *int after, before *Cursor opts []SubjectDigestPaginateOption } func newSubjectDigestPaginateArgs(rv map[string]any) *subjectdigestPaginateArgs { args := &subjectdigestPaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[whereField].(*SubjectDigestWhereInput); ok { args.opts = append(args.opts, WithSubjectDigestFilter(v.Filter)) } return args } // CollectFields tells the query-builder to eagerly load connected nodes by resolver context. func (_q *TimestampQuery) CollectFields(ctx context.Context, satisfies ...string) (*TimestampQuery, error) { fc := graphql.GetFieldContext(ctx) if fc == nil { return _q, nil } if err := _q.collectField(ctx, false, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil { return nil, err } return _q, nil } func (_q *TimestampQuery) collectField(ctx context.Context, oneNode bool, opCtx *graphql.OperationContext, collected graphql.CollectedField, path []string, satisfies ...string) error { path = append([]string(nil), path...) var ( unknownSeen bool fieldSeen = make(map[string]struct{}, len(timestamp.Columns)) selectedFields = []string{timestamp.FieldID} ) for _, field := range graphql.CollectFields(opCtx, collected.Selections, satisfies) { switch field.Name { case "signature": var ( alias = field.Alias path = append(path, alias) query = (&SignatureClient{config: _q.config}).Query() ) if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, signatureImplementors)...); err != nil { return err } _q.withSignature = query case "type": if _, ok := fieldSeen[timestamp.FieldType]; !ok { selectedFields = append(selectedFields, timestamp.FieldType) fieldSeen[timestamp.FieldType] = struct{}{} } case "timestamp": if _, ok := fieldSeen[timestamp.FieldTimestamp]; !ok { selectedFields = append(selectedFields, timestamp.FieldTimestamp) fieldSeen[timestamp.FieldTimestamp] = struct{}{} } case "id": case "__typename": default: unknownSeen = true } } if !unknownSeen { _q.Select(selectedFields...) } return nil } type timestampPaginateArgs struct { first, last *int after, before *Cursor opts []TimestampPaginateOption } func newTimestampPaginateArgs(rv map[string]any) *timestampPaginateArgs { args := ×tampPaginateArgs{} if rv == nil { return args } if v := rv[firstField]; v != nil { args.first = v.(*int) } if v := rv[lastField]; v != nil { args.last = v.(*int) } if v := rv[afterField]; v != nil { args.after = v.(*Cursor) } if v := rv[beforeField]; v != nil { args.before = v.(*Cursor) } if v, ok := rv[whereField].(*TimestampWhereInput); ok { args.opts = append(args.opts, WithTimestampFilter(v.Filter)) } return args } const ( afterField = "after" firstField = "first" beforeField = "before" lastField = "last" orderByField = "orderBy" directionField = "direction" fieldField = "field" whereField = "where" ) func fieldArgs(ctx context.Context, whereInput any, path ...string) map[string]any { field := collectedField(ctx, path...) if field == nil || field.Arguments == nil { return nil } oc := graphql.GetOperationContext(ctx) args := field.ArgumentMap(oc.Variables) return unmarshalArgs(ctx, whereInput, args) } // unmarshalArgs allows extracting the field arguments from their raw representation. func unmarshalArgs(ctx context.Context, whereInput any, args map[string]any) map[string]any { for _, k := range []string{firstField, lastField} { v, ok := args[k] if !ok || v == nil { continue } i, err := graphql.UnmarshalInt(v) if err == nil { args[k] = &i } } for _, k := range []string{beforeField, afterField} { v, ok := args[k] if !ok { continue } c := &Cursor{} if c.UnmarshalGQL(v) == nil { args[k] = c } } if v, ok := args[whereField]; ok && whereInput != nil { if err := graphql.UnmarshalInputFromContext(ctx, v, whereInput); err == nil { args[whereField] = whereInput } } return args } // mayAddCondition appends another type condition to the satisfies list // if it does not exist in the list. func mayAddCondition(satisfies []string, typeCond []string) []string { Cond: for _, c := range typeCond { for _, s := range satisfies { if c == s { continue Cond } } satisfies = append(satisfies, c) } return satisfies } golang-github-in-toto-archivista-0.11.1/ent/gql_edge.go000066400000000000000000000132611511066247200227360ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "github.com/99designs/gqlgen/graphql" ) func (_m *Attestation) AttestationCollection(ctx context.Context) (*AttestationCollection, error) { result, err := _m.Edges.AttestationCollectionOrErr() if IsNotLoaded(err) { result, err = _m.QueryAttestationCollection().Only(ctx) } return result, err } func (_m *AttestationCollection) Attestations(ctx context.Context) (result []*Attestation, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = _m.NamedAttestations(graphql.GetFieldContext(ctx).Field.Alias) } else { result, err = _m.Edges.AttestationsOrErr() } if IsNotLoaded(err) { result, err = _m.QueryAttestations().All(ctx) } return result, err } func (_m *AttestationCollection) Statement(ctx context.Context) (*Statement, error) { result, err := _m.Edges.StatementOrErr() if IsNotLoaded(err) { result, err = _m.QueryStatement().Only(ctx) } return result, err } func (_m *AttestationPolicy) Statement(ctx context.Context) (*Statement, error) { result, err := _m.Edges.StatementOrErr() if IsNotLoaded(err) { result, err = _m.QueryStatement().Only(ctx) } return result, MaskNotFound(err) } func (_m *Dsse) Statement(ctx context.Context) (*Statement, error) { result, err := _m.Edges.StatementOrErr() if IsNotLoaded(err) { result, err = _m.QueryStatement().Only(ctx) } return result, MaskNotFound(err) } func (_m *Dsse) Signatures(ctx context.Context) (result []*Signature, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = _m.NamedSignatures(graphql.GetFieldContext(ctx).Field.Alias) } else { result, err = _m.Edges.SignaturesOrErr() } if IsNotLoaded(err) { result, err = _m.QuerySignatures().All(ctx) } return result, err } func (_m *Dsse) PayloadDigests(ctx context.Context) (result []*PayloadDigest, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = _m.NamedPayloadDigests(graphql.GetFieldContext(ctx).Field.Alias) } else { result, err = _m.Edges.PayloadDigestsOrErr() } if IsNotLoaded(err) { result, err = _m.QueryPayloadDigests().All(ctx) } return result, err } func (_m *PayloadDigest) Dsse(ctx context.Context) (*Dsse, error) { result, err := _m.Edges.DsseOrErr() if IsNotLoaded(err) { result, err = _m.QueryDsse().Only(ctx) } return result, MaskNotFound(err) } func (_m *Signature) Dsse(ctx context.Context) (*Dsse, error) { result, err := _m.Edges.DsseOrErr() if IsNotLoaded(err) { result, err = _m.QueryDsse().Only(ctx) } return result, MaskNotFound(err) } func (_m *Signature) Timestamps(ctx context.Context) (result []*Timestamp, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = _m.NamedTimestamps(graphql.GetFieldContext(ctx).Field.Alias) } else { result, err = _m.Edges.TimestampsOrErr() } if IsNotLoaded(err) { result, err = _m.QueryTimestamps().All(ctx) } return result, err } func (_m *Statement) Subjects( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, orderBy *SubjectOrder, where *SubjectWhereInput, ) (*SubjectConnection, error) { opts := []SubjectPaginateOption{ WithSubjectOrder(orderBy), WithSubjectFilter(where.Filter), } alias := graphql.GetFieldContext(ctx).Field.Alias totalCount, hasTotalCount := _m.Edges.totalCount[0][alias] if nodes, err := _m.NamedSubjects(alias); err == nil || hasTotalCount { pager, err := newSubjectPager(opts, last != nil) if err != nil { return nil, err } conn := &SubjectConnection{Edges: []*SubjectEdge{}, TotalCount: totalCount} conn.build(nodes, pager, after, first, before, last) return conn, nil } return _m.QuerySubjects().Paginate(ctx, after, first, before, last, opts...) } func (_m *Statement) Policy(ctx context.Context) (*AttestationPolicy, error) { result, err := _m.Edges.PolicyOrErr() if IsNotLoaded(err) { result, err = _m.QueryPolicy().Only(ctx) } return result, MaskNotFound(err) } func (_m *Statement) AttestationCollections(ctx context.Context) (*AttestationCollection, error) { result, err := _m.Edges.AttestationCollectionsOrErr() if IsNotLoaded(err) { result, err = _m.QueryAttestationCollections().Only(ctx) } return result, MaskNotFound(err) } func (_m *Statement) Dsse(ctx context.Context) (result []*Dsse, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = _m.NamedDsse(graphql.GetFieldContext(ctx).Field.Alias) } else { result, err = _m.Edges.DsseOrErr() } if IsNotLoaded(err) { result, err = _m.QueryDsse().All(ctx) } return result, err } func (_m *Subject) SubjectDigests(ctx context.Context) (result []*SubjectDigest, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = _m.NamedSubjectDigests(graphql.GetFieldContext(ctx).Field.Alias) } else { result, err = _m.Edges.SubjectDigestsOrErr() } if IsNotLoaded(err) { result, err = _m.QuerySubjectDigests().All(ctx) } return result, err } func (_m *Subject) Statement(ctx context.Context) (*Statement, error) { result, err := _m.Edges.StatementOrErr() if IsNotLoaded(err) { result, err = _m.QueryStatement().Only(ctx) } return result, MaskNotFound(err) } func (_m *SubjectDigest) Subject(ctx context.Context) (*Subject, error) { result, err := _m.Edges.SubjectOrErr() if IsNotLoaded(err) { result, err = _m.QuerySubject().Only(ctx) } return result, MaskNotFound(err) } func (_m *Timestamp) Signature(ctx context.Context) (*Signature, error) { result, err := _m.Edges.SignatureOrErr() if IsNotLoaded(err) { result, err = _m.QuerySignature().Only(ctx) } return result, MaskNotFound(err) } golang-github-in-toto-archivista-0.11.1/ent/gql_node.go000066400000000000000000000314651511066247200227650ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "fmt" "entgo.io/contrib/entgql" "github.com/99designs/gqlgen/graphql" "github.com/google/uuid" "github.com/hashicorp/go-multierror" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" "github.com/in-toto/archivista/ent/timestamp" ) // Noder wraps the basic Node method. type Noder interface { IsNode() } var attestationImplementors = []string{"Attestation", "Node"} // IsNode implements the Node interface check for GQLGen. func (*Attestation) IsNode() {} var attestationcollectionImplementors = []string{"AttestationCollection", "Node"} // IsNode implements the Node interface check for GQLGen. func (*AttestationCollection) IsNode() {} var attestationpolicyImplementors = []string{"AttestationPolicy", "Node"} // IsNode implements the Node interface check for GQLGen. func (*AttestationPolicy) IsNode() {} var dsseImplementors = []string{"Dsse", "Node"} // IsNode implements the Node interface check for GQLGen. func (*Dsse) IsNode() {} var payloaddigestImplementors = []string{"PayloadDigest", "Node"} // IsNode implements the Node interface check for GQLGen. func (*PayloadDigest) IsNode() {} var signatureImplementors = []string{"Signature", "Node"} // IsNode implements the Node interface check for GQLGen. func (*Signature) IsNode() {} var statementImplementors = []string{"Statement", "Node"} // IsNode implements the Node interface check for GQLGen. func (*Statement) IsNode() {} var subjectImplementors = []string{"Subject", "Node"} // IsNode implements the Node interface check for GQLGen. func (*Subject) IsNode() {} var subjectdigestImplementors = []string{"SubjectDigest", "Node"} // IsNode implements the Node interface check for GQLGen. func (*SubjectDigest) IsNode() {} var timestampImplementors = []string{"Timestamp", "Node"} // IsNode implements the Node interface check for GQLGen. func (*Timestamp) IsNode() {} var errNodeInvalidID = &NotFoundError{"node"} // NodeOption allows configuring the Noder execution using functional options. type NodeOption func(*nodeOptions) // WithNodeType sets the node Type resolver function (i.e. the table to query). // If was not provided, the table will be derived from the universal-id // configuration as described in: https://entgo.io/docs/migrate/#universal-ids. func WithNodeType(f func(context.Context, uuid.UUID) (string, error)) NodeOption { return func(o *nodeOptions) { o.nodeType = f } } // WithFixedNodeType sets the Type of the node to a fixed value. func WithFixedNodeType(t string) NodeOption { return WithNodeType(func(context.Context, uuid.UUID) (string, error) { return t, nil }) } type nodeOptions struct { nodeType func(context.Context, uuid.UUID) (string, error) } func (c *Client) newNodeOpts(opts []NodeOption) *nodeOptions { nopts := &nodeOptions{} for _, opt := range opts { opt(nopts) } if nopts.nodeType == nil { nopts.nodeType = func(ctx context.Context, id uuid.UUID) (string, error) { return "", fmt.Errorf("cannot resolve noder (%v) without its type", id) } } return nopts } // Noder returns a Node by its id. If the NodeType was not provided, it will // be derived from the id value according to the universal-id configuration. // // c.Noder(ctx, id) // c.Noder(ctx, id, ent.WithNodeType(typeResolver)) func (c *Client) Noder(ctx context.Context, id uuid.UUID, opts ...NodeOption) (_ Noder, err error) { defer func() { if IsNotFound(err) { err = multierror.Append(err, entgql.ErrNodeNotFound(id)) } }() table, err := c.newNodeOpts(opts).nodeType(ctx, id) if err != nil { return nil, err } return c.noder(ctx, table, id) } func (c *Client) noder(ctx context.Context, table string, id uuid.UUID) (Noder, error) { switch table { case attestation.Table: query := c.Attestation.Query(). Where(attestation.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, attestationImplementors...); err != nil { return nil, err } } return query.Only(ctx) case attestationcollection.Table: query := c.AttestationCollection.Query(). Where(attestationcollection.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, attestationcollectionImplementors...); err != nil { return nil, err } } return query.Only(ctx) case attestationpolicy.Table: query := c.AttestationPolicy.Query(). Where(attestationpolicy.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, attestationpolicyImplementors...); err != nil { return nil, err } } return query.Only(ctx) case dsse.Table: query := c.Dsse.Query(). Where(dsse.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, dsseImplementors...); err != nil { return nil, err } } return query.Only(ctx) case payloaddigest.Table: query := c.PayloadDigest.Query(). Where(payloaddigest.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, payloaddigestImplementors...); err != nil { return nil, err } } return query.Only(ctx) case signature.Table: query := c.Signature.Query(). Where(signature.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, signatureImplementors...); err != nil { return nil, err } } return query.Only(ctx) case statement.Table: query := c.Statement.Query(). Where(statement.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, statementImplementors...); err != nil { return nil, err } } return query.Only(ctx) case subject.Table: query := c.Subject.Query(). Where(subject.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, subjectImplementors...); err != nil { return nil, err } } return query.Only(ctx) case subjectdigest.Table: query := c.SubjectDigest.Query(). Where(subjectdigest.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, subjectdigestImplementors...); err != nil { return nil, err } } return query.Only(ctx) case timestamp.Table: query := c.Timestamp.Query(). Where(timestamp.ID(id)) if fc := graphql.GetFieldContext(ctx); fc != nil { if err := query.collectField(ctx, true, graphql.GetOperationContext(ctx), fc.Field, nil, timestampImplementors...); err != nil { return nil, err } } return query.Only(ctx) default: return nil, fmt.Errorf("cannot resolve noder from table %q: %w", table, errNodeInvalidID) } } func (c *Client) Noders(ctx context.Context, ids []uuid.UUID, opts ...NodeOption) ([]Noder, error) { switch len(ids) { case 1: noder, err := c.Noder(ctx, ids[0], opts...) if err != nil { return nil, err } return []Noder{noder}, nil case 0: return []Noder{}, nil } noders := make([]Noder, len(ids)) errors := make([]error, len(ids)) tables := make(map[string][]uuid.UUID) id2idx := make(map[uuid.UUID][]int, len(ids)) nopts := c.newNodeOpts(opts) for i, id := range ids { table, err := nopts.nodeType(ctx, id) if err != nil { errors[i] = err continue } tables[table] = append(tables[table], id) id2idx[id] = append(id2idx[id], i) } for table, ids := range tables { nodes, err := c.noders(ctx, table, ids) if err != nil { for _, id := range ids { for _, idx := range id2idx[id] { errors[idx] = err } } } else { for i, id := range ids { for _, idx := range id2idx[id] { noders[idx] = nodes[i] } } } } for i, id := range ids { if errors[i] == nil { if noders[i] != nil { continue } errors[i] = entgql.ErrNodeNotFound(id) } else if IsNotFound(errors[i]) { errors[i] = multierror.Append(errors[i], entgql.ErrNodeNotFound(id)) } ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i), ) graphql.AddError(ctx, errors[i]) } return noders, nil } func (c *Client) noders(ctx context.Context, table string, ids []uuid.UUID) ([]Noder, error) { noders := make([]Noder, len(ids)) idmap := make(map[uuid.UUID][]*Noder, len(ids)) for i, id := range ids { idmap[id] = append(idmap[id], &noders[i]) } switch table { case attestation.Table: query := c.Attestation.Query(). Where(attestation.IDIn(ids...)) query, err := query.CollectFields(ctx, attestationImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } case attestationcollection.Table: query := c.AttestationCollection.Query(). Where(attestationcollection.IDIn(ids...)) query, err := query.CollectFields(ctx, attestationcollectionImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } case attestationpolicy.Table: query := c.AttestationPolicy.Query(). Where(attestationpolicy.IDIn(ids...)) query, err := query.CollectFields(ctx, attestationpolicyImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } case dsse.Table: query := c.Dsse.Query(). Where(dsse.IDIn(ids...)) query, err := query.CollectFields(ctx, dsseImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } case payloaddigest.Table: query := c.PayloadDigest.Query(). Where(payloaddigest.IDIn(ids...)) query, err := query.CollectFields(ctx, payloaddigestImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } case signature.Table: query := c.Signature.Query(). Where(signature.IDIn(ids...)) query, err := query.CollectFields(ctx, signatureImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } case statement.Table: query := c.Statement.Query(). Where(statement.IDIn(ids...)) query, err := query.CollectFields(ctx, statementImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } case subject.Table: query := c.Subject.Query(). Where(subject.IDIn(ids...)) query, err := query.CollectFields(ctx, subjectImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } case subjectdigest.Table: query := c.SubjectDigest.Query(). Where(subjectdigest.IDIn(ids...)) query, err := query.CollectFields(ctx, subjectdigestImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } case timestamp.Table: query := c.Timestamp.Query(). Where(timestamp.IDIn(ids...)) query, err := query.CollectFields(ctx, timestampImplementors...) if err != nil { return nil, err } nodes, err := query.All(ctx) if err != nil { return nil, err } for _, node := range nodes { for _, noder := range idmap[node.ID] { *noder = node } } default: return nil, fmt.Errorf("cannot resolve noders from table %q: %w", table, errNodeInvalidID) } return noders, nil } golang-github-in-toto-archivista-0.11.1/ent/gql_pagination.go000066400000000000000000002340321511066247200241640ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "io" "strconv" "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/errcode" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" "github.com/in-toto/archivista/ent/timestamp" "github.com/vektah/gqlparser/v2/gqlerror" ) // Common entgql types. type ( Cursor = entgql.Cursor[uuid.UUID] PageInfo = entgql.PageInfo[uuid.UUID] OrderDirection = entgql.OrderDirection ) func orderFunc(o OrderDirection, field string) func(*sql.Selector) { if o == entgql.OrderDirectionDesc { return Desc(field) } return Asc(field) } const errInvalidPagination = "INVALID_PAGINATION" func validateFirstLast(first, last *int) (err *gqlerror.Error) { switch { case first != nil && last != nil: err = &gqlerror.Error{ Message: "Passing both `first` and `last` to paginate a connection is not supported.", } case first != nil && *first < 0: err = &gqlerror.Error{ Message: "`first` on a connection cannot be less than zero.", } errcode.Set(err, errInvalidPagination) case last != nil && *last < 0: err = &gqlerror.Error{ Message: "`last` on a connection cannot be less than zero.", } errcode.Set(err, errInvalidPagination) } return err } func collectedField(ctx context.Context, path ...string) *graphql.CollectedField { fc := graphql.GetFieldContext(ctx) if fc == nil { return nil } field := fc.Field oc := graphql.GetOperationContext(ctx) walk: for _, name := range path { for _, f := range graphql.CollectFields(oc, field.Selections, nil) { if f.Alias == name { field = f continue walk } } return nil } return &field } func hasCollectedField(ctx context.Context, path ...string) bool { if graphql.GetFieldContext(ctx) == nil { return true } return collectedField(ctx, path...) != nil } const ( edgesField = "edges" nodeField = "node" pageInfoField = "pageInfo" totalCountField = "totalCount" ) func paginateLimit(first, last *int) int { var limit int if first != nil { limit = *first + 1 } else if last != nil { limit = *last + 1 } return limit } // AttestationEdge is the edge representation of Attestation. type AttestationEdge struct { Node *Attestation `json:"node"` Cursor Cursor `json:"cursor"` } // AttestationConnection is the connection containing edges to Attestation. type AttestationConnection struct { Edges []*AttestationEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *AttestationConnection) build(nodes []*Attestation, pager *attestationPager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *Attestation if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *Attestation { return nodes[n-i] } } else { nodeAt = func(i int) *Attestation { return nodes[i] } } c.Edges = make([]*AttestationEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &AttestationEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // AttestationPaginateOption enables pagination customization. type AttestationPaginateOption func(*attestationPager) error // WithAttestationOrder configures pagination ordering. func WithAttestationOrder(order *AttestationOrder) AttestationPaginateOption { if order == nil { order = DefaultAttestationOrder } o := *order return func(pager *attestationPager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultAttestationOrder.Field } pager.order = &o return nil } } // WithAttestationFilter configures pagination filter. func WithAttestationFilter(filter func(*AttestationQuery) (*AttestationQuery, error)) AttestationPaginateOption { return func(pager *attestationPager) error { if filter == nil { return errors.New("AttestationQuery filter cannot be nil") } pager.filter = filter return nil } } type attestationPager struct { reverse bool order *AttestationOrder filter func(*AttestationQuery) (*AttestationQuery, error) } func newAttestationPager(opts []AttestationPaginateOption, reverse bool) (*attestationPager, error) { pager := &attestationPager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultAttestationOrder } return pager, nil } func (p *attestationPager) applyFilter(query *AttestationQuery) (*AttestationQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *attestationPager) toCursor(_m *Attestation) Cursor { return p.order.Field.toCursor(_m) } func (p *attestationPager) applyCursors(query *AttestationQuery, after, before *Cursor) (*AttestationQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultAttestationOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *attestationPager) applyOrder(query *AttestationQuery) *AttestationQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultAttestationOrder.Field { query = query.Order(DefaultAttestationOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *attestationPager) orderExpr(query *AttestationQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultAttestationOrder.Field { b.Comma().Ident(DefaultAttestationOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to Attestation. func (_m *AttestationQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...AttestationPaginateOption, ) (*AttestationConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newAttestationPager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &AttestationConnection{Edges: []*AttestationEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } // AttestationOrderField defines the ordering field of Attestation. type AttestationOrderField struct { // Value extracts the ordering value from the given Attestation. Value func(*Attestation) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) attestation.OrderOption toCursor func(*Attestation) Cursor } // AttestationOrder defines the ordering of Attestation. type AttestationOrder struct { Direction OrderDirection `json:"direction"` Field *AttestationOrderField `json:"field"` } // DefaultAttestationOrder is the default ordering of Attestation. var DefaultAttestationOrder = &AttestationOrder{ Direction: entgql.OrderDirectionAsc, Field: &AttestationOrderField{ Value: func(_m *Attestation) (ent.Value, error) { return _m.ID, nil }, column: attestation.FieldID, toTerm: attestation.ByID, toCursor: func(_m *Attestation) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts Attestation into AttestationEdge. func (_m *Attestation) ToEdge(order *AttestationOrder) *AttestationEdge { if order == nil { order = DefaultAttestationOrder } return &AttestationEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } // AttestationCollectionEdge is the edge representation of AttestationCollection. type AttestationCollectionEdge struct { Node *AttestationCollection `json:"node"` Cursor Cursor `json:"cursor"` } // AttestationCollectionConnection is the connection containing edges to AttestationCollection. type AttestationCollectionConnection struct { Edges []*AttestationCollectionEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *AttestationCollectionConnection) build(nodes []*AttestationCollection, pager *attestationcollectionPager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *AttestationCollection if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *AttestationCollection { return nodes[n-i] } } else { nodeAt = func(i int) *AttestationCollection { return nodes[i] } } c.Edges = make([]*AttestationCollectionEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &AttestationCollectionEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // AttestationCollectionPaginateOption enables pagination customization. type AttestationCollectionPaginateOption func(*attestationcollectionPager) error // WithAttestationCollectionOrder configures pagination ordering. func WithAttestationCollectionOrder(order *AttestationCollectionOrder) AttestationCollectionPaginateOption { if order == nil { order = DefaultAttestationCollectionOrder } o := *order return func(pager *attestationcollectionPager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultAttestationCollectionOrder.Field } pager.order = &o return nil } } // WithAttestationCollectionFilter configures pagination filter. func WithAttestationCollectionFilter(filter func(*AttestationCollectionQuery) (*AttestationCollectionQuery, error)) AttestationCollectionPaginateOption { return func(pager *attestationcollectionPager) error { if filter == nil { return errors.New("AttestationCollectionQuery filter cannot be nil") } pager.filter = filter return nil } } type attestationcollectionPager struct { reverse bool order *AttestationCollectionOrder filter func(*AttestationCollectionQuery) (*AttestationCollectionQuery, error) } func newAttestationCollectionPager(opts []AttestationCollectionPaginateOption, reverse bool) (*attestationcollectionPager, error) { pager := &attestationcollectionPager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultAttestationCollectionOrder } return pager, nil } func (p *attestationcollectionPager) applyFilter(query *AttestationCollectionQuery) (*AttestationCollectionQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *attestationcollectionPager) toCursor(_m *AttestationCollection) Cursor { return p.order.Field.toCursor(_m) } func (p *attestationcollectionPager) applyCursors(query *AttestationCollectionQuery, after, before *Cursor) (*AttestationCollectionQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultAttestationCollectionOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *attestationcollectionPager) applyOrder(query *AttestationCollectionQuery) *AttestationCollectionQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultAttestationCollectionOrder.Field { query = query.Order(DefaultAttestationCollectionOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *attestationcollectionPager) orderExpr(query *AttestationCollectionQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultAttestationCollectionOrder.Field { b.Comma().Ident(DefaultAttestationCollectionOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to AttestationCollection. func (_m *AttestationCollectionQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...AttestationCollectionPaginateOption, ) (*AttestationCollectionConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newAttestationCollectionPager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &AttestationCollectionConnection{Edges: []*AttestationCollectionEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } // AttestationCollectionOrderField defines the ordering field of AttestationCollection. type AttestationCollectionOrderField struct { // Value extracts the ordering value from the given AttestationCollection. Value func(*AttestationCollection) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) attestationcollection.OrderOption toCursor func(*AttestationCollection) Cursor } // AttestationCollectionOrder defines the ordering of AttestationCollection. type AttestationCollectionOrder struct { Direction OrderDirection `json:"direction"` Field *AttestationCollectionOrderField `json:"field"` } // DefaultAttestationCollectionOrder is the default ordering of AttestationCollection. var DefaultAttestationCollectionOrder = &AttestationCollectionOrder{ Direction: entgql.OrderDirectionAsc, Field: &AttestationCollectionOrderField{ Value: func(_m *AttestationCollection) (ent.Value, error) { return _m.ID, nil }, column: attestationcollection.FieldID, toTerm: attestationcollection.ByID, toCursor: func(_m *AttestationCollection) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts AttestationCollection into AttestationCollectionEdge. func (_m *AttestationCollection) ToEdge(order *AttestationCollectionOrder) *AttestationCollectionEdge { if order == nil { order = DefaultAttestationCollectionOrder } return &AttestationCollectionEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } // AttestationPolicyEdge is the edge representation of AttestationPolicy. type AttestationPolicyEdge struct { Node *AttestationPolicy `json:"node"` Cursor Cursor `json:"cursor"` } // AttestationPolicyConnection is the connection containing edges to AttestationPolicy. type AttestationPolicyConnection struct { Edges []*AttestationPolicyEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *AttestationPolicyConnection) build(nodes []*AttestationPolicy, pager *attestationpolicyPager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *AttestationPolicy if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *AttestationPolicy { return nodes[n-i] } } else { nodeAt = func(i int) *AttestationPolicy { return nodes[i] } } c.Edges = make([]*AttestationPolicyEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &AttestationPolicyEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // AttestationPolicyPaginateOption enables pagination customization. type AttestationPolicyPaginateOption func(*attestationpolicyPager) error // WithAttestationPolicyOrder configures pagination ordering. func WithAttestationPolicyOrder(order *AttestationPolicyOrder) AttestationPolicyPaginateOption { if order == nil { order = DefaultAttestationPolicyOrder } o := *order return func(pager *attestationpolicyPager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultAttestationPolicyOrder.Field } pager.order = &o return nil } } // WithAttestationPolicyFilter configures pagination filter. func WithAttestationPolicyFilter(filter func(*AttestationPolicyQuery) (*AttestationPolicyQuery, error)) AttestationPolicyPaginateOption { return func(pager *attestationpolicyPager) error { if filter == nil { return errors.New("AttestationPolicyQuery filter cannot be nil") } pager.filter = filter return nil } } type attestationpolicyPager struct { reverse bool order *AttestationPolicyOrder filter func(*AttestationPolicyQuery) (*AttestationPolicyQuery, error) } func newAttestationPolicyPager(opts []AttestationPolicyPaginateOption, reverse bool) (*attestationpolicyPager, error) { pager := &attestationpolicyPager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultAttestationPolicyOrder } return pager, nil } func (p *attestationpolicyPager) applyFilter(query *AttestationPolicyQuery) (*AttestationPolicyQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *attestationpolicyPager) toCursor(_m *AttestationPolicy) Cursor { return p.order.Field.toCursor(_m) } func (p *attestationpolicyPager) applyCursors(query *AttestationPolicyQuery, after, before *Cursor) (*AttestationPolicyQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultAttestationPolicyOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *attestationpolicyPager) applyOrder(query *AttestationPolicyQuery) *AttestationPolicyQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultAttestationPolicyOrder.Field { query = query.Order(DefaultAttestationPolicyOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *attestationpolicyPager) orderExpr(query *AttestationPolicyQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultAttestationPolicyOrder.Field { b.Comma().Ident(DefaultAttestationPolicyOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to AttestationPolicy. func (_m *AttestationPolicyQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...AttestationPolicyPaginateOption, ) (*AttestationPolicyConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newAttestationPolicyPager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &AttestationPolicyConnection{Edges: []*AttestationPolicyEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } // AttestationPolicyOrderField defines the ordering field of AttestationPolicy. type AttestationPolicyOrderField struct { // Value extracts the ordering value from the given AttestationPolicy. Value func(*AttestationPolicy) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) attestationpolicy.OrderOption toCursor func(*AttestationPolicy) Cursor } // AttestationPolicyOrder defines the ordering of AttestationPolicy. type AttestationPolicyOrder struct { Direction OrderDirection `json:"direction"` Field *AttestationPolicyOrderField `json:"field"` } // DefaultAttestationPolicyOrder is the default ordering of AttestationPolicy. var DefaultAttestationPolicyOrder = &AttestationPolicyOrder{ Direction: entgql.OrderDirectionAsc, Field: &AttestationPolicyOrderField{ Value: func(_m *AttestationPolicy) (ent.Value, error) { return _m.ID, nil }, column: attestationpolicy.FieldID, toTerm: attestationpolicy.ByID, toCursor: func(_m *AttestationPolicy) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts AttestationPolicy into AttestationPolicyEdge. func (_m *AttestationPolicy) ToEdge(order *AttestationPolicyOrder) *AttestationPolicyEdge { if order == nil { order = DefaultAttestationPolicyOrder } return &AttestationPolicyEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } // DsseEdge is the edge representation of Dsse. type DsseEdge struct { Node *Dsse `json:"node"` Cursor Cursor `json:"cursor"` } // DsseConnection is the connection containing edges to Dsse. type DsseConnection struct { Edges []*DsseEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *DsseConnection) build(nodes []*Dsse, pager *dssePager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *Dsse if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *Dsse { return nodes[n-i] } } else { nodeAt = func(i int) *Dsse { return nodes[i] } } c.Edges = make([]*DsseEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &DsseEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // DssePaginateOption enables pagination customization. type DssePaginateOption func(*dssePager) error // WithDsseOrder configures pagination ordering. func WithDsseOrder(order *DsseOrder) DssePaginateOption { if order == nil { order = DefaultDsseOrder } o := *order return func(pager *dssePager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultDsseOrder.Field } pager.order = &o return nil } } // WithDsseFilter configures pagination filter. func WithDsseFilter(filter func(*DsseQuery) (*DsseQuery, error)) DssePaginateOption { return func(pager *dssePager) error { if filter == nil { return errors.New("DsseQuery filter cannot be nil") } pager.filter = filter return nil } } type dssePager struct { reverse bool order *DsseOrder filter func(*DsseQuery) (*DsseQuery, error) } func newDssePager(opts []DssePaginateOption, reverse bool) (*dssePager, error) { pager := &dssePager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultDsseOrder } return pager, nil } func (p *dssePager) applyFilter(query *DsseQuery) (*DsseQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *dssePager) toCursor(_m *Dsse) Cursor { return p.order.Field.toCursor(_m) } func (p *dssePager) applyCursors(query *DsseQuery, after, before *Cursor) (*DsseQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultDsseOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *dssePager) applyOrder(query *DsseQuery) *DsseQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultDsseOrder.Field { query = query.Order(DefaultDsseOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *dssePager) orderExpr(query *DsseQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultDsseOrder.Field { b.Comma().Ident(DefaultDsseOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to Dsse. func (_m *DsseQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...DssePaginateOption, ) (*DsseConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newDssePager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &DsseConnection{Edges: []*DsseEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } var ( // DsseOrderFieldCreatedAt orders Dsse by created_at. DsseOrderFieldCreatedAt = &DsseOrderField{ Value: func(_m *Dsse) (ent.Value, error) { return _m.CreatedAt, nil }, column: dsse.FieldCreatedAt, toTerm: dsse.ByCreatedAt, toCursor: func(_m *Dsse) Cursor { return Cursor{ ID: _m.ID, Value: _m.CreatedAt, } }, } ) // String implement fmt.Stringer interface. func (f DsseOrderField) String() string { var str string switch f.column { case DsseOrderFieldCreatedAt.column: str = "CREATED_AT" } return str } // MarshalGQL implements graphql.Marshaler interface. func (f DsseOrderField) MarshalGQL(w io.Writer) { io.WriteString(w, strconv.Quote(f.String())) } // UnmarshalGQL implements graphql.Unmarshaler interface. func (f *DsseOrderField) UnmarshalGQL(v interface{}) error { str, ok := v.(string) if !ok { return fmt.Errorf("DsseOrderField %T must be a string", v) } switch str { case "CREATED_AT": *f = *DsseOrderFieldCreatedAt default: return fmt.Errorf("%s is not a valid DsseOrderField", str) } return nil } // DsseOrderField defines the ordering field of Dsse. type DsseOrderField struct { // Value extracts the ordering value from the given Dsse. Value func(*Dsse) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) dsse.OrderOption toCursor func(*Dsse) Cursor } // DsseOrder defines the ordering of Dsse. type DsseOrder struct { Direction OrderDirection `json:"direction"` Field *DsseOrderField `json:"field"` } // DefaultDsseOrder is the default ordering of Dsse. var DefaultDsseOrder = &DsseOrder{ Direction: entgql.OrderDirectionAsc, Field: &DsseOrderField{ Value: func(_m *Dsse) (ent.Value, error) { return _m.ID, nil }, column: dsse.FieldID, toTerm: dsse.ByID, toCursor: func(_m *Dsse) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts Dsse into DsseEdge. func (_m *Dsse) ToEdge(order *DsseOrder) *DsseEdge { if order == nil { order = DefaultDsseOrder } return &DsseEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } // PayloadDigestEdge is the edge representation of PayloadDigest. type PayloadDigestEdge struct { Node *PayloadDigest `json:"node"` Cursor Cursor `json:"cursor"` } // PayloadDigestConnection is the connection containing edges to PayloadDigest. type PayloadDigestConnection struct { Edges []*PayloadDigestEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *PayloadDigestConnection) build(nodes []*PayloadDigest, pager *payloaddigestPager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *PayloadDigest if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *PayloadDigest { return nodes[n-i] } } else { nodeAt = func(i int) *PayloadDigest { return nodes[i] } } c.Edges = make([]*PayloadDigestEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &PayloadDigestEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // PayloadDigestPaginateOption enables pagination customization. type PayloadDigestPaginateOption func(*payloaddigestPager) error // WithPayloadDigestOrder configures pagination ordering. func WithPayloadDigestOrder(order *PayloadDigestOrder) PayloadDigestPaginateOption { if order == nil { order = DefaultPayloadDigestOrder } o := *order return func(pager *payloaddigestPager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultPayloadDigestOrder.Field } pager.order = &o return nil } } // WithPayloadDigestFilter configures pagination filter. func WithPayloadDigestFilter(filter func(*PayloadDigestQuery) (*PayloadDigestQuery, error)) PayloadDigestPaginateOption { return func(pager *payloaddigestPager) error { if filter == nil { return errors.New("PayloadDigestQuery filter cannot be nil") } pager.filter = filter return nil } } type payloaddigestPager struct { reverse bool order *PayloadDigestOrder filter func(*PayloadDigestQuery) (*PayloadDigestQuery, error) } func newPayloadDigestPager(opts []PayloadDigestPaginateOption, reverse bool) (*payloaddigestPager, error) { pager := &payloaddigestPager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultPayloadDigestOrder } return pager, nil } func (p *payloaddigestPager) applyFilter(query *PayloadDigestQuery) (*PayloadDigestQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *payloaddigestPager) toCursor(_m *PayloadDigest) Cursor { return p.order.Field.toCursor(_m) } func (p *payloaddigestPager) applyCursors(query *PayloadDigestQuery, after, before *Cursor) (*PayloadDigestQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultPayloadDigestOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *payloaddigestPager) applyOrder(query *PayloadDigestQuery) *PayloadDigestQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultPayloadDigestOrder.Field { query = query.Order(DefaultPayloadDigestOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *payloaddigestPager) orderExpr(query *PayloadDigestQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultPayloadDigestOrder.Field { b.Comma().Ident(DefaultPayloadDigestOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to PayloadDigest. func (_m *PayloadDigestQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...PayloadDigestPaginateOption, ) (*PayloadDigestConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newPayloadDigestPager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &PayloadDigestConnection{Edges: []*PayloadDigestEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } // PayloadDigestOrderField defines the ordering field of PayloadDigest. type PayloadDigestOrderField struct { // Value extracts the ordering value from the given PayloadDigest. Value func(*PayloadDigest) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) payloaddigest.OrderOption toCursor func(*PayloadDigest) Cursor } // PayloadDigestOrder defines the ordering of PayloadDigest. type PayloadDigestOrder struct { Direction OrderDirection `json:"direction"` Field *PayloadDigestOrderField `json:"field"` } // DefaultPayloadDigestOrder is the default ordering of PayloadDigest. var DefaultPayloadDigestOrder = &PayloadDigestOrder{ Direction: entgql.OrderDirectionAsc, Field: &PayloadDigestOrderField{ Value: func(_m *PayloadDigest) (ent.Value, error) { return _m.ID, nil }, column: payloaddigest.FieldID, toTerm: payloaddigest.ByID, toCursor: func(_m *PayloadDigest) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts PayloadDigest into PayloadDigestEdge. func (_m *PayloadDigest) ToEdge(order *PayloadDigestOrder) *PayloadDigestEdge { if order == nil { order = DefaultPayloadDigestOrder } return &PayloadDigestEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } // SignatureEdge is the edge representation of Signature. type SignatureEdge struct { Node *Signature `json:"node"` Cursor Cursor `json:"cursor"` } // SignatureConnection is the connection containing edges to Signature. type SignatureConnection struct { Edges []*SignatureEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *SignatureConnection) build(nodes []*Signature, pager *signaturePager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *Signature if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *Signature { return nodes[n-i] } } else { nodeAt = func(i int) *Signature { return nodes[i] } } c.Edges = make([]*SignatureEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &SignatureEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // SignaturePaginateOption enables pagination customization. type SignaturePaginateOption func(*signaturePager) error // WithSignatureOrder configures pagination ordering. func WithSignatureOrder(order *SignatureOrder) SignaturePaginateOption { if order == nil { order = DefaultSignatureOrder } o := *order return func(pager *signaturePager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultSignatureOrder.Field } pager.order = &o return nil } } // WithSignatureFilter configures pagination filter. func WithSignatureFilter(filter func(*SignatureQuery) (*SignatureQuery, error)) SignaturePaginateOption { return func(pager *signaturePager) error { if filter == nil { return errors.New("SignatureQuery filter cannot be nil") } pager.filter = filter return nil } } type signaturePager struct { reverse bool order *SignatureOrder filter func(*SignatureQuery) (*SignatureQuery, error) } func newSignaturePager(opts []SignaturePaginateOption, reverse bool) (*signaturePager, error) { pager := &signaturePager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultSignatureOrder } return pager, nil } func (p *signaturePager) applyFilter(query *SignatureQuery) (*SignatureQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *signaturePager) toCursor(_m *Signature) Cursor { return p.order.Field.toCursor(_m) } func (p *signaturePager) applyCursors(query *SignatureQuery, after, before *Cursor) (*SignatureQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultSignatureOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *signaturePager) applyOrder(query *SignatureQuery) *SignatureQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultSignatureOrder.Field { query = query.Order(DefaultSignatureOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *signaturePager) orderExpr(query *SignatureQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultSignatureOrder.Field { b.Comma().Ident(DefaultSignatureOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to Signature. func (_m *SignatureQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...SignaturePaginateOption, ) (*SignatureConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newSignaturePager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &SignatureConnection{Edges: []*SignatureEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } // SignatureOrderField defines the ordering field of Signature. type SignatureOrderField struct { // Value extracts the ordering value from the given Signature. Value func(*Signature) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) signature.OrderOption toCursor func(*Signature) Cursor } // SignatureOrder defines the ordering of Signature. type SignatureOrder struct { Direction OrderDirection `json:"direction"` Field *SignatureOrderField `json:"field"` } // DefaultSignatureOrder is the default ordering of Signature. var DefaultSignatureOrder = &SignatureOrder{ Direction: entgql.OrderDirectionAsc, Field: &SignatureOrderField{ Value: func(_m *Signature) (ent.Value, error) { return _m.ID, nil }, column: signature.FieldID, toTerm: signature.ByID, toCursor: func(_m *Signature) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts Signature into SignatureEdge. func (_m *Signature) ToEdge(order *SignatureOrder) *SignatureEdge { if order == nil { order = DefaultSignatureOrder } return &SignatureEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } // StatementEdge is the edge representation of Statement. type StatementEdge struct { Node *Statement `json:"node"` Cursor Cursor `json:"cursor"` } // StatementConnection is the connection containing edges to Statement. type StatementConnection struct { Edges []*StatementEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *StatementConnection) build(nodes []*Statement, pager *statementPager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *Statement if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *Statement { return nodes[n-i] } } else { nodeAt = func(i int) *Statement { return nodes[i] } } c.Edges = make([]*StatementEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &StatementEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // StatementPaginateOption enables pagination customization. type StatementPaginateOption func(*statementPager) error // WithStatementOrder configures pagination ordering. func WithStatementOrder(order *StatementOrder) StatementPaginateOption { if order == nil { order = DefaultStatementOrder } o := *order return func(pager *statementPager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultStatementOrder.Field } pager.order = &o return nil } } // WithStatementFilter configures pagination filter. func WithStatementFilter(filter func(*StatementQuery) (*StatementQuery, error)) StatementPaginateOption { return func(pager *statementPager) error { if filter == nil { return errors.New("StatementQuery filter cannot be nil") } pager.filter = filter return nil } } type statementPager struct { reverse bool order *StatementOrder filter func(*StatementQuery) (*StatementQuery, error) } func newStatementPager(opts []StatementPaginateOption, reverse bool) (*statementPager, error) { pager := &statementPager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultStatementOrder } return pager, nil } func (p *statementPager) applyFilter(query *StatementQuery) (*StatementQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *statementPager) toCursor(_m *Statement) Cursor { return p.order.Field.toCursor(_m) } func (p *statementPager) applyCursors(query *StatementQuery, after, before *Cursor) (*StatementQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultStatementOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *statementPager) applyOrder(query *StatementQuery) *StatementQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultStatementOrder.Field { query = query.Order(DefaultStatementOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *statementPager) orderExpr(query *StatementQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultStatementOrder.Field { b.Comma().Ident(DefaultStatementOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to Statement. func (_m *StatementQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...StatementPaginateOption, ) (*StatementConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newStatementPager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &StatementConnection{Edges: []*StatementEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } // StatementOrderField defines the ordering field of Statement. type StatementOrderField struct { // Value extracts the ordering value from the given Statement. Value func(*Statement) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) statement.OrderOption toCursor func(*Statement) Cursor } // StatementOrder defines the ordering of Statement. type StatementOrder struct { Direction OrderDirection `json:"direction"` Field *StatementOrderField `json:"field"` } // DefaultStatementOrder is the default ordering of Statement. var DefaultStatementOrder = &StatementOrder{ Direction: entgql.OrderDirectionAsc, Field: &StatementOrderField{ Value: func(_m *Statement) (ent.Value, error) { return _m.ID, nil }, column: statement.FieldID, toTerm: statement.ByID, toCursor: func(_m *Statement) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts Statement into StatementEdge. func (_m *Statement) ToEdge(order *StatementOrder) *StatementEdge { if order == nil { order = DefaultStatementOrder } return &StatementEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } // SubjectEdge is the edge representation of Subject. type SubjectEdge struct { Node *Subject `json:"node"` Cursor Cursor `json:"cursor"` } // SubjectConnection is the connection containing edges to Subject. type SubjectConnection struct { Edges []*SubjectEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *SubjectConnection) build(nodes []*Subject, pager *subjectPager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *Subject if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *Subject { return nodes[n-i] } } else { nodeAt = func(i int) *Subject { return nodes[i] } } c.Edges = make([]*SubjectEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &SubjectEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // SubjectPaginateOption enables pagination customization. type SubjectPaginateOption func(*subjectPager) error // WithSubjectOrder configures pagination ordering. func WithSubjectOrder(order *SubjectOrder) SubjectPaginateOption { if order == nil { order = DefaultSubjectOrder } o := *order return func(pager *subjectPager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultSubjectOrder.Field } pager.order = &o return nil } } // WithSubjectFilter configures pagination filter. func WithSubjectFilter(filter func(*SubjectQuery) (*SubjectQuery, error)) SubjectPaginateOption { return func(pager *subjectPager) error { if filter == nil { return errors.New("SubjectQuery filter cannot be nil") } pager.filter = filter return nil } } type subjectPager struct { reverse bool order *SubjectOrder filter func(*SubjectQuery) (*SubjectQuery, error) } func newSubjectPager(opts []SubjectPaginateOption, reverse bool) (*subjectPager, error) { pager := &subjectPager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultSubjectOrder } return pager, nil } func (p *subjectPager) applyFilter(query *SubjectQuery) (*SubjectQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *subjectPager) toCursor(_m *Subject) Cursor { return p.order.Field.toCursor(_m) } func (p *subjectPager) applyCursors(query *SubjectQuery, after, before *Cursor) (*SubjectQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultSubjectOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *subjectPager) applyOrder(query *SubjectQuery) *SubjectQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultSubjectOrder.Field { query = query.Order(DefaultSubjectOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *subjectPager) orderExpr(query *SubjectQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultSubjectOrder.Field { b.Comma().Ident(DefaultSubjectOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to Subject. func (_m *SubjectQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...SubjectPaginateOption, ) (*SubjectConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newSubjectPager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &SubjectConnection{Edges: []*SubjectEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } var ( // SubjectOrderFieldCreatedAt orders Subject by created_at. SubjectOrderFieldCreatedAt = &SubjectOrderField{ Value: func(_m *Subject) (ent.Value, error) { return _m.CreatedAt, nil }, column: subject.FieldCreatedAt, toTerm: subject.ByCreatedAt, toCursor: func(_m *Subject) Cursor { return Cursor{ ID: _m.ID, Value: _m.CreatedAt, } }, } ) // String implement fmt.Stringer interface. func (f SubjectOrderField) String() string { var str string switch f.column { case SubjectOrderFieldCreatedAt.column: str = "CREATED_AT" } return str } // MarshalGQL implements graphql.Marshaler interface. func (f SubjectOrderField) MarshalGQL(w io.Writer) { io.WriteString(w, strconv.Quote(f.String())) } // UnmarshalGQL implements graphql.Unmarshaler interface. func (f *SubjectOrderField) UnmarshalGQL(v interface{}) error { str, ok := v.(string) if !ok { return fmt.Errorf("SubjectOrderField %T must be a string", v) } switch str { case "CREATED_AT": *f = *SubjectOrderFieldCreatedAt default: return fmt.Errorf("%s is not a valid SubjectOrderField", str) } return nil } // SubjectOrderField defines the ordering field of Subject. type SubjectOrderField struct { // Value extracts the ordering value from the given Subject. Value func(*Subject) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) subject.OrderOption toCursor func(*Subject) Cursor } // SubjectOrder defines the ordering of Subject. type SubjectOrder struct { Direction OrderDirection `json:"direction"` Field *SubjectOrderField `json:"field"` } // DefaultSubjectOrder is the default ordering of Subject. var DefaultSubjectOrder = &SubjectOrder{ Direction: entgql.OrderDirectionAsc, Field: &SubjectOrderField{ Value: func(_m *Subject) (ent.Value, error) { return _m.ID, nil }, column: subject.FieldID, toTerm: subject.ByID, toCursor: func(_m *Subject) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts Subject into SubjectEdge. func (_m *Subject) ToEdge(order *SubjectOrder) *SubjectEdge { if order == nil { order = DefaultSubjectOrder } return &SubjectEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } // SubjectDigestEdge is the edge representation of SubjectDigest. type SubjectDigestEdge struct { Node *SubjectDigest `json:"node"` Cursor Cursor `json:"cursor"` } // SubjectDigestConnection is the connection containing edges to SubjectDigest. type SubjectDigestConnection struct { Edges []*SubjectDigestEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *SubjectDigestConnection) build(nodes []*SubjectDigest, pager *subjectdigestPager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *SubjectDigest if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *SubjectDigest { return nodes[n-i] } } else { nodeAt = func(i int) *SubjectDigest { return nodes[i] } } c.Edges = make([]*SubjectDigestEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &SubjectDigestEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // SubjectDigestPaginateOption enables pagination customization. type SubjectDigestPaginateOption func(*subjectdigestPager) error // WithSubjectDigestOrder configures pagination ordering. func WithSubjectDigestOrder(order *SubjectDigestOrder) SubjectDigestPaginateOption { if order == nil { order = DefaultSubjectDigestOrder } o := *order return func(pager *subjectdigestPager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultSubjectDigestOrder.Field } pager.order = &o return nil } } // WithSubjectDigestFilter configures pagination filter. func WithSubjectDigestFilter(filter func(*SubjectDigestQuery) (*SubjectDigestQuery, error)) SubjectDigestPaginateOption { return func(pager *subjectdigestPager) error { if filter == nil { return errors.New("SubjectDigestQuery filter cannot be nil") } pager.filter = filter return nil } } type subjectdigestPager struct { reverse bool order *SubjectDigestOrder filter func(*SubjectDigestQuery) (*SubjectDigestQuery, error) } func newSubjectDigestPager(opts []SubjectDigestPaginateOption, reverse bool) (*subjectdigestPager, error) { pager := &subjectdigestPager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultSubjectDigestOrder } return pager, nil } func (p *subjectdigestPager) applyFilter(query *SubjectDigestQuery) (*SubjectDigestQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *subjectdigestPager) toCursor(_m *SubjectDigest) Cursor { return p.order.Field.toCursor(_m) } func (p *subjectdigestPager) applyCursors(query *SubjectDigestQuery, after, before *Cursor) (*SubjectDigestQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultSubjectDigestOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *subjectdigestPager) applyOrder(query *SubjectDigestQuery) *SubjectDigestQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultSubjectDigestOrder.Field { query = query.Order(DefaultSubjectDigestOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *subjectdigestPager) orderExpr(query *SubjectDigestQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultSubjectDigestOrder.Field { b.Comma().Ident(DefaultSubjectDigestOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to SubjectDigest. func (_m *SubjectDigestQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...SubjectDigestPaginateOption, ) (*SubjectDigestConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newSubjectDigestPager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &SubjectDigestConnection{Edges: []*SubjectDigestEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } // SubjectDigestOrderField defines the ordering field of SubjectDigest. type SubjectDigestOrderField struct { // Value extracts the ordering value from the given SubjectDigest. Value func(*SubjectDigest) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) subjectdigest.OrderOption toCursor func(*SubjectDigest) Cursor } // SubjectDigestOrder defines the ordering of SubjectDigest. type SubjectDigestOrder struct { Direction OrderDirection `json:"direction"` Field *SubjectDigestOrderField `json:"field"` } // DefaultSubjectDigestOrder is the default ordering of SubjectDigest. var DefaultSubjectDigestOrder = &SubjectDigestOrder{ Direction: entgql.OrderDirectionAsc, Field: &SubjectDigestOrderField{ Value: func(_m *SubjectDigest) (ent.Value, error) { return _m.ID, nil }, column: subjectdigest.FieldID, toTerm: subjectdigest.ByID, toCursor: func(_m *SubjectDigest) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts SubjectDigest into SubjectDigestEdge. func (_m *SubjectDigest) ToEdge(order *SubjectDigestOrder) *SubjectDigestEdge { if order == nil { order = DefaultSubjectDigestOrder } return &SubjectDigestEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } // TimestampEdge is the edge representation of Timestamp. type TimestampEdge struct { Node *Timestamp `json:"node"` Cursor Cursor `json:"cursor"` } // TimestampConnection is the connection containing edges to Timestamp. type TimestampConnection struct { Edges []*TimestampEdge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` TotalCount int `json:"totalCount"` } func (c *TimestampConnection) build(nodes []*Timestamp, pager *timestampPager, after *Cursor, first *int, before *Cursor, last *int) { c.PageInfo.HasNextPage = before != nil c.PageInfo.HasPreviousPage = after != nil if first != nil && *first+1 == len(nodes) { c.PageInfo.HasNextPage = true nodes = nodes[:len(nodes)-1] } else if last != nil && *last+1 == len(nodes) { c.PageInfo.HasPreviousPage = true nodes = nodes[:len(nodes)-1] } var nodeAt func(int) *Timestamp if last != nil { n := len(nodes) - 1 nodeAt = func(i int) *Timestamp { return nodes[n-i] } } else { nodeAt = func(i int) *Timestamp { return nodes[i] } } c.Edges = make([]*TimestampEdge, len(nodes)) for i := range nodes { node := nodeAt(i) c.Edges[i] = &TimestampEdge{ Node: node, Cursor: pager.toCursor(node), } } if l := len(c.Edges); l > 0 { c.PageInfo.StartCursor = &c.Edges[0].Cursor c.PageInfo.EndCursor = &c.Edges[l-1].Cursor } if c.TotalCount == 0 { c.TotalCount = len(nodes) } } // TimestampPaginateOption enables pagination customization. type TimestampPaginateOption func(*timestampPager) error // WithTimestampOrder configures pagination ordering. func WithTimestampOrder(order *TimestampOrder) TimestampPaginateOption { if order == nil { order = DefaultTimestampOrder } o := *order return func(pager *timestampPager) error { if err := o.Direction.Validate(); err != nil { return err } if o.Field == nil { o.Field = DefaultTimestampOrder.Field } pager.order = &o return nil } } // WithTimestampFilter configures pagination filter. func WithTimestampFilter(filter func(*TimestampQuery) (*TimestampQuery, error)) TimestampPaginateOption { return func(pager *timestampPager) error { if filter == nil { return errors.New("TimestampQuery filter cannot be nil") } pager.filter = filter return nil } } type timestampPager struct { reverse bool order *TimestampOrder filter func(*TimestampQuery) (*TimestampQuery, error) } func newTimestampPager(opts []TimestampPaginateOption, reverse bool) (*timestampPager, error) { pager := ×tampPager{reverse: reverse} for _, opt := range opts { if err := opt(pager); err != nil { return nil, err } } if pager.order == nil { pager.order = DefaultTimestampOrder } return pager, nil } func (p *timestampPager) applyFilter(query *TimestampQuery) (*TimestampQuery, error) { if p.filter != nil { return p.filter(query) } return query, nil } func (p *timestampPager) toCursor(_m *Timestamp) Cursor { return p.order.Field.toCursor(_m) } func (p *timestampPager) applyCursors(query *TimestampQuery, after, before *Cursor) (*TimestampQuery, error) { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } for _, predicate := range entgql.CursorsPredicate(after, before, DefaultTimestampOrder.Field.column, p.order.Field.column, direction) { query = query.Where(predicate) } return query, nil } func (p *timestampPager) applyOrder(query *TimestampQuery) *TimestampQuery { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } query = query.Order(p.order.Field.toTerm(direction.OrderTermOption())) if p.order.Field != DefaultTimestampOrder.Field { query = query.Order(DefaultTimestampOrder.Field.toTerm(direction.OrderTermOption())) } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return query } func (p *timestampPager) orderExpr(query *TimestampQuery) sql.Querier { direction := p.order.Direction if p.reverse { direction = direction.Reverse() } if len(query.ctx.Fields) > 0 { query.ctx.AppendFieldOnce(p.order.Field.column) } return sql.ExprFunc(func(b *sql.Builder) { b.Ident(p.order.Field.column).Pad().WriteString(string(direction)) if p.order.Field != DefaultTimestampOrder.Field { b.Comma().Ident(DefaultTimestampOrder.Field.column).Pad().WriteString(string(direction)) } }) } // Paginate executes the query and returns a relay based cursor connection to Timestamp. func (_m *TimestampQuery) Paginate( ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, opts ...TimestampPaginateOption, ) (*TimestampConnection, error) { if err := validateFirstLast(first, last); err != nil { return nil, err } pager, err := newTimestampPager(opts, last != nil) if err != nil { return nil, err } if _m, err = pager.applyFilter(_m); err != nil { return nil, err } conn := &TimestampConnection{Edges: []*TimestampEdge{}} ignoredEdges := !hasCollectedField(ctx, edgesField) if hasCollectedField(ctx, totalCountField) || hasCollectedField(ctx, pageInfoField) { hasPagination := after != nil || first != nil || before != nil || last != nil if hasPagination || ignoredEdges { c := _m.Clone() c.ctx.Fields = nil if conn.TotalCount, err = c.Count(ctx); err != nil { return nil, err } conn.PageInfo.HasNextPage = first != nil && conn.TotalCount > 0 conn.PageInfo.HasPreviousPage = last != nil && conn.TotalCount > 0 } } if ignoredEdges || (first != nil && *first == 0) || (last != nil && *last == 0) { return conn, nil } if _m, err = pager.applyCursors(_m, after, before); err != nil { return nil, err } limit := paginateLimit(first, last) if limit != 0 { _m.Limit(limit) } if field := collectedField(ctx, edgesField, nodeField); field != nil { if err := _m.collectField(ctx, limit == 1, graphql.GetOperationContext(ctx), *field, []string{edgesField, nodeField}); err != nil { return nil, err } } _m = pager.applyOrder(_m) nodes, err := _m.All(ctx) if err != nil { return nil, err } conn.build(nodes, pager, after, first, before, last) return conn, nil } // TimestampOrderField defines the ordering field of Timestamp. type TimestampOrderField struct { // Value extracts the ordering value from the given Timestamp. Value func(*Timestamp) (ent.Value, error) column string // field or computed. toTerm func(...sql.OrderTermOption) timestamp.OrderOption toCursor func(*Timestamp) Cursor } // TimestampOrder defines the ordering of Timestamp. type TimestampOrder struct { Direction OrderDirection `json:"direction"` Field *TimestampOrderField `json:"field"` } // DefaultTimestampOrder is the default ordering of Timestamp. var DefaultTimestampOrder = &TimestampOrder{ Direction: entgql.OrderDirectionAsc, Field: &TimestampOrderField{ Value: func(_m *Timestamp) (ent.Value, error) { return _m.ID, nil }, column: timestamp.FieldID, toTerm: timestamp.ByID, toCursor: func(_m *Timestamp) Cursor { return Cursor{ID: _m.ID} }, }, } // ToEdge converts Timestamp into TimestampEdge. func (_m *Timestamp) ToEdge(order *TimestampOrder) *TimestampEdge { if order == nil { order = DefaultTimestampOrder } return &TimestampEdge{ Node: _m, Cursor: order.Field.toCursor(_m), } } golang-github-in-toto-archivista-0.11.1/ent/gql_transaction.go000066400000000000000000000013521511066247200243550ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" "errors" ) // OpenTx opens a transaction and returns a transactional // context along with the created transaction. func (c *Client) OpenTx(ctx context.Context) (context.Context, driver.Tx, error) { tx, err := c.Tx(ctx) if err != nil { return nil, nil, err } ctx = NewTxContext(ctx, tx) ctx = NewContext(ctx, tx.Client()) return ctx, tx, nil } // OpenTxFromContext open transactions from client stored in context. func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error) { client := FromContext(ctx) if client == nil { return nil, nil, errors.New("no client attached to context") } return client.OpenTx(ctx) } golang-github-in-toto-archivista-0.11.1/ent/gql_where_input.go000066400000000000000000002511601511066247200243650ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "errors" "fmt" "time" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" "github.com/in-toto/archivista/ent/timestamp" ) // AttestationWhereInput represents a where input for filtering Attestation queries. type AttestationWhereInput struct { Predicates []predicate.Attestation `json:"-"` Not *AttestationWhereInput `json:"not,omitempty"` Or []*AttestationWhereInput `json:"or,omitempty"` And []*AttestationWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "type" field predicates. Type *string `json:"type,omitempty"` TypeNEQ *string `json:"typeNEQ,omitempty"` TypeIn []string `json:"typeIn,omitempty"` TypeNotIn []string `json:"typeNotIn,omitempty"` TypeGT *string `json:"typeGT,omitempty"` TypeGTE *string `json:"typeGTE,omitempty"` TypeLT *string `json:"typeLT,omitempty"` TypeLTE *string `json:"typeLTE,omitempty"` TypeContains *string `json:"typeContains,omitempty"` TypeHasPrefix *string `json:"typeHasPrefix,omitempty"` TypeHasSuffix *string `json:"typeHasSuffix,omitempty"` TypeEqualFold *string `json:"typeEqualFold,omitempty"` TypeContainsFold *string `json:"typeContainsFold,omitempty"` // "attestation_collection" edge predicates. HasAttestationCollection *bool `json:"hasAttestationCollection,omitempty"` HasAttestationCollectionWith []*AttestationCollectionWhereInput `json:"hasAttestationCollectionWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *AttestationWhereInput) AddPredicates(predicates ...predicate.Attestation) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the AttestationWhereInput filter on the AttestationQuery builder. func (i *AttestationWhereInput) Filter(q *AttestationQuery) (*AttestationQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptyAttestationWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptyAttestationWhereInput is returned in case the AttestationWhereInput is empty. var ErrEmptyAttestationWhereInput = errors.New("ent: empty predicate AttestationWhereInput") // P returns a predicate for filtering attestations. // An error is returned if the input is empty or invalid. func (i *AttestationWhereInput) P() (predicate.Attestation, error) { var predicates []predicate.Attestation if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, attestation.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.Attestation, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, attestation.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.Attestation, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, attestation.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, attestation.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, attestation.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, attestation.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, attestation.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, attestation.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, attestation.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, attestation.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, attestation.IDLTE(*i.IDLTE)) } if i.Type != nil { predicates = append(predicates, attestation.TypeEQ(*i.Type)) } if i.TypeNEQ != nil { predicates = append(predicates, attestation.TypeNEQ(*i.TypeNEQ)) } if len(i.TypeIn) > 0 { predicates = append(predicates, attestation.TypeIn(i.TypeIn...)) } if len(i.TypeNotIn) > 0 { predicates = append(predicates, attestation.TypeNotIn(i.TypeNotIn...)) } if i.TypeGT != nil { predicates = append(predicates, attestation.TypeGT(*i.TypeGT)) } if i.TypeGTE != nil { predicates = append(predicates, attestation.TypeGTE(*i.TypeGTE)) } if i.TypeLT != nil { predicates = append(predicates, attestation.TypeLT(*i.TypeLT)) } if i.TypeLTE != nil { predicates = append(predicates, attestation.TypeLTE(*i.TypeLTE)) } if i.TypeContains != nil { predicates = append(predicates, attestation.TypeContains(*i.TypeContains)) } if i.TypeHasPrefix != nil { predicates = append(predicates, attestation.TypeHasPrefix(*i.TypeHasPrefix)) } if i.TypeHasSuffix != nil { predicates = append(predicates, attestation.TypeHasSuffix(*i.TypeHasSuffix)) } if i.TypeEqualFold != nil { predicates = append(predicates, attestation.TypeEqualFold(*i.TypeEqualFold)) } if i.TypeContainsFold != nil { predicates = append(predicates, attestation.TypeContainsFold(*i.TypeContainsFold)) } if i.HasAttestationCollection != nil { p := attestation.HasAttestationCollection() if !*i.HasAttestationCollection { p = attestation.Not(p) } predicates = append(predicates, p) } if len(i.HasAttestationCollectionWith) > 0 { with := make([]predicate.AttestationCollection, 0, len(i.HasAttestationCollectionWith)) for _, w := range i.HasAttestationCollectionWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasAttestationCollectionWith'", err) } with = append(with, p) } predicates = append(predicates, attestation.HasAttestationCollectionWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptyAttestationWhereInput case 1: return predicates[0], nil default: return attestation.And(predicates...), nil } } // AttestationCollectionWhereInput represents a where input for filtering AttestationCollection queries. type AttestationCollectionWhereInput struct { Predicates []predicate.AttestationCollection `json:"-"` Not *AttestationCollectionWhereInput `json:"not,omitempty"` Or []*AttestationCollectionWhereInput `json:"or,omitempty"` And []*AttestationCollectionWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "name" field predicates. Name *string `json:"name,omitempty"` NameNEQ *string `json:"nameNEQ,omitempty"` NameIn []string `json:"nameIn,omitempty"` NameNotIn []string `json:"nameNotIn,omitempty"` NameGT *string `json:"nameGT,omitempty"` NameGTE *string `json:"nameGTE,omitempty"` NameLT *string `json:"nameLT,omitempty"` NameLTE *string `json:"nameLTE,omitempty"` NameContains *string `json:"nameContains,omitempty"` NameHasPrefix *string `json:"nameHasPrefix,omitempty"` NameHasSuffix *string `json:"nameHasSuffix,omitempty"` NameEqualFold *string `json:"nameEqualFold,omitempty"` NameContainsFold *string `json:"nameContainsFold,omitempty"` // "attestations" edge predicates. HasAttestations *bool `json:"hasAttestations,omitempty"` HasAttestationsWith []*AttestationWhereInput `json:"hasAttestationsWith,omitempty"` // "statement" edge predicates. HasStatement *bool `json:"hasStatement,omitempty"` HasStatementWith []*StatementWhereInput `json:"hasStatementWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *AttestationCollectionWhereInput) AddPredicates(predicates ...predicate.AttestationCollection) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the AttestationCollectionWhereInput filter on the AttestationCollectionQuery builder. func (i *AttestationCollectionWhereInput) Filter(q *AttestationCollectionQuery) (*AttestationCollectionQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptyAttestationCollectionWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptyAttestationCollectionWhereInput is returned in case the AttestationCollectionWhereInput is empty. var ErrEmptyAttestationCollectionWhereInput = errors.New("ent: empty predicate AttestationCollectionWhereInput") // P returns a predicate for filtering attestationcollections. // An error is returned if the input is empty or invalid. func (i *AttestationCollectionWhereInput) P() (predicate.AttestationCollection, error) { var predicates []predicate.AttestationCollection if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, attestationcollection.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.AttestationCollection, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, attestationcollection.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.AttestationCollection, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, attestationcollection.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, attestationcollection.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, attestationcollection.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, attestationcollection.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, attestationcollection.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, attestationcollection.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, attestationcollection.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, attestationcollection.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, attestationcollection.IDLTE(*i.IDLTE)) } if i.Name != nil { predicates = append(predicates, attestationcollection.NameEQ(*i.Name)) } if i.NameNEQ != nil { predicates = append(predicates, attestationcollection.NameNEQ(*i.NameNEQ)) } if len(i.NameIn) > 0 { predicates = append(predicates, attestationcollection.NameIn(i.NameIn...)) } if len(i.NameNotIn) > 0 { predicates = append(predicates, attestationcollection.NameNotIn(i.NameNotIn...)) } if i.NameGT != nil { predicates = append(predicates, attestationcollection.NameGT(*i.NameGT)) } if i.NameGTE != nil { predicates = append(predicates, attestationcollection.NameGTE(*i.NameGTE)) } if i.NameLT != nil { predicates = append(predicates, attestationcollection.NameLT(*i.NameLT)) } if i.NameLTE != nil { predicates = append(predicates, attestationcollection.NameLTE(*i.NameLTE)) } if i.NameContains != nil { predicates = append(predicates, attestationcollection.NameContains(*i.NameContains)) } if i.NameHasPrefix != nil { predicates = append(predicates, attestationcollection.NameHasPrefix(*i.NameHasPrefix)) } if i.NameHasSuffix != nil { predicates = append(predicates, attestationcollection.NameHasSuffix(*i.NameHasSuffix)) } if i.NameEqualFold != nil { predicates = append(predicates, attestationcollection.NameEqualFold(*i.NameEqualFold)) } if i.NameContainsFold != nil { predicates = append(predicates, attestationcollection.NameContainsFold(*i.NameContainsFold)) } if i.HasAttestations != nil { p := attestationcollection.HasAttestations() if !*i.HasAttestations { p = attestationcollection.Not(p) } predicates = append(predicates, p) } if len(i.HasAttestationsWith) > 0 { with := make([]predicate.Attestation, 0, len(i.HasAttestationsWith)) for _, w := range i.HasAttestationsWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasAttestationsWith'", err) } with = append(with, p) } predicates = append(predicates, attestationcollection.HasAttestationsWith(with...)) } if i.HasStatement != nil { p := attestationcollection.HasStatement() if !*i.HasStatement { p = attestationcollection.Not(p) } predicates = append(predicates, p) } if len(i.HasStatementWith) > 0 { with := make([]predicate.Statement, 0, len(i.HasStatementWith)) for _, w := range i.HasStatementWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasStatementWith'", err) } with = append(with, p) } predicates = append(predicates, attestationcollection.HasStatementWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptyAttestationCollectionWhereInput case 1: return predicates[0], nil default: return attestationcollection.And(predicates...), nil } } // AttestationPolicyWhereInput represents a where input for filtering AttestationPolicy queries. type AttestationPolicyWhereInput struct { Predicates []predicate.AttestationPolicy `json:"-"` Not *AttestationPolicyWhereInput `json:"not,omitempty"` Or []*AttestationPolicyWhereInput `json:"or,omitempty"` And []*AttestationPolicyWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "name" field predicates. Name *string `json:"name,omitempty"` NameNEQ *string `json:"nameNEQ,omitempty"` NameIn []string `json:"nameIn,omitempty"` NameNotIn []string `json:"nameNotIn,omitempty"` NameGT *string `json:"nameGT,omitempty"` NameGTE *string `json:"nameGTE,omitempty"` NameLT *string `json:"nameLT,omitempty"` NameLTE *string `json:"nameLTE,omitempty"` NameContains *string `json:"nameContains,omitempty"` NameHasPrefix *string `json:"nameHasPrefix,omitempty"` NameHasSuffix *string `json:"nameHasSuffix,omitempty"` NameEqualFold *string `json:"nameEqualFold,omitempty"` NameContainsFold *string `json:"nameContainsFold,omitempty"` // "statement" edge predicates. HasStatement *bool `json:"hasStatement,omitempty"` HasStatementWith []*StatementWhereInput `json:"hasStatementWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *AttestationPolicyWhereInput) AddPredicates(predicates ...predicate.AttestationPolicy) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the AttestationPolicyWhereInput filter on the AttestationPolicyQuery builder. func (i *AttestationPolicyWhereInput) Filter(q *AttestationPolicyQuery) (*AttestationPolicyQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptyAttestationPolicyWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptyAttestationPolicyWhereInput is returned in case the AttestationPolicyWhereInput is empty. var ErrEmptyAttestationPolicyWhereInput = errors.New("ent: empty predicate AttestationPolicyWhereInput") // P returns a predicate for filtering attestationpolicies. // An error is returned if the input is empty or invalid. func (i *AttestationPolicyWhereInput) P() (predicate.AttestationPolicy, error) { var predicates []predicate.AttestationPolicy if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, attestationpolicy.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.AttestationPolicy, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, attestationpolicy.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.AttestationPolicy, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, attestationpolicy.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, attestationpolicy.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, attestationpolicy.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, attestationpolicy.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, attestationpolicy.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, attestationpolicy.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, attestationpolicy.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, attestationpolicy.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, attestationpolicy.IDLTE(*i.IDLTE)) } if i.Name != nil { predicates = append(predicates, attestationpolicy.NameEQ(*i.Name)) } if i.NameNEQ != nil { predicates = append(predicates, attestationpolicy.NameNEQ(*i.NameNEQ)) } if len(i.NameIn) > 0 { predicates = append(predicates, attestationpolicy.NameIn(i.NameIn...)) } if len(i.NameNotIn) > 0 { predicates = append(predicates, attestationpolicy.NameNotIn(i.NameNotIn...)) } if i.NameGT != nil { predicates = append(predicates, attestationpolicy.NameGT(*i.NameGT)) } if i.NameGTE != nil { predicates = append(predicates, attestationpolicy.NameGTE(*i.NameGTE)) } if i.NameLT != nil { predicates = append(predicates, attestationpolicy.NameLT(*i.NameLT)) } if i.NameLTE != nil { predicates = append(predicates, attestationpolicy.NameLTE(*i.NameLTE)) } if i.NameContains != nil { predicates = append(predicates, attestationpolicy.NameContains(*i.NameContains)) } if i.NameHasPrefix != nil { predicates = append(predicates, attestationpolicy.NameHasPrefix(*i.NameHasPrefix)) } if i.NameHasSuffix != nil { predicates = append(predicates, attestationpolicy.NameHasSuffix(*i.NameHasSuffix)) } if i.NameEqualFold != nil { predicates = append(predicates, attestationpolicy.NameEqualFold(*i.NameEqualFold)) } if i.NameContainsFold != nil { predicates = append(predicates, attestationpolicy.NameContainsFold(*i.NameContainsFold)) } if i.HasStatement != nil { p := attestationpolicy.HasStatement() if !*i.HasStatement { p = attestationpolicy.Not(p) } predicates = append(predicates, p) } if len(i.HasStatementWith) > 0 { with := make([]predicate.Statement, 0, len(i.HasStatementWith)) for _, w := range i.HasStatementWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasStatementWith'", err) } with = append(with, p) } predicates = append(predicates, attestationpolicy.HasStatementWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptyAttestationPolicyWhereInput case 1: return predicates[0], nil default: return attestationpolicy.And(predicates...), nil } } // DsseWhereInput represents a where input for filtering Dsse queries. type DsseWhereInput struct { Predicates []predicate.Dsse `json:"-"` Not *DsseWhereInput `json:"not,omitempty"` Or []*DsseWhereInput `json:"or,omitempty"` And []*DsseWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "created_at" field predicates. CreatedAt *time.Time `json:"createdAt,omitempty"` CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` CreatedAtIsNil bool `json:"createdAtIsNil,omitempty"` CreatedAtNotNil bool `json:"createdAtNotNil,omitempty"` // "gitoid_sha256" field predicates. GitoidSha256 *string `json:"gitoidSha256,omitempty"` GitoidSha256NEQ *string `json:"gitoidSha256NEQ,omitempty"` GitoidSha256In []string `json:"gitoidSha256In,omitempty"` GitoidSha256NotIn []string `json:"gitoidSha256NotIn,omitempty"` GitoidSha256GT *string `json:"gitoidSha256GT,omitempty"` GitoidSha256GTE *string `json:"gitoidSha256GTE,omitempty"` GitoidSha256LT *string `json:"gitoidSha256LT,omitempty"` GitoidSha256LTE *string `json:"gitoidSha256LTE,omitempty"` GitoidSha256Contains *string `json:"gitoidSha256Contains,omitempty"` GitoidSha256HasPrefix *string `json:"gitoidSha256HasPrefix,omitempty"` GitoidSha256HasSuffix *string `json:"gitoidSha256HasSuffix,omitempty"` GitoidSha256EqualFold *string `json:"gitoidSha256EqualFold,omitempty"` GitoidSha256ContainsFold *string `json:"gitoidSha256ContainsFold,omitempty"` // "payload_type" field predicates. PayloadType *string `json:"payloadType,omitempty"` PayloadTypeNEQ *string `json:"payloadTypeNEQ,omitempty"` PayloadTypeIn []string `json:"payloadTypeIn,omitempty"` PayloadTypeNotIn []string `json:"payloadTypeNotIn,omitempty"` PayloadTypeGT *string `json:"payloadTypeGT,omitempty"` PayloadTypeGTE *string `json:"payloadTypeGTE,omitempty"` PayloadTypeLT *string `json:"payloadTypeLT,omitempty"` PayloadTypeLTE *string `json:"payloadTypeLTE,omitempty"` PayloadTypeContains *string `json:"payloadTypeContains,omitempty"` PayloadTypeHasPrefix *string `json:"payloadTypeHasPrefix,omitempty"` PayloadTypeHasSuffix *string `json:"payloadTypeHasSuffix,omitempty"` PayloadTypeEqualFold *string `json:"payloadTypeEqualFold,omitempty"` PayloadTypeContainsFold *string `json:"payloadTypeContainsFold,omitempty"` // "statement" edge predicates. HasStatement *bool `json:"hasStatement,omitempty"` HasStatementWith []*StatementWhereInput `json:"hasStatementWith,omitempty"` // "signatures" edge predicates. HasSignatures *bool `json:"hasSignatures,omitempty"` HasSignaturesWith []*SignatureWhereInput `json:"hasSignaturesWith,omitempty"` // "payload_digests" edge predicates. HasPayloadDigests *bool `json:"hasPayloadDigests,omitempty"` HasPayloadDigestsWith []*PayloadDigestWhereInput `json:"hasPayloadDigestsWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *DsseWhereInput) AddPredicates(predicates ...predicate.Dsse) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the DsseWhereInput filter on the DsseQuery builder. func (i *DsseWhereInput) Filter(q *DsseQuery) (*DsseQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptyDsseWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptyDsseWhereInput is returned in case the DsseWhereInput is empty. var ErrEmptyDsseWhereInput = errors.New("ent: empty predicate DsseWhereInput") // P returns a predicate for filtering dsses. // An error is returned if the input is empty or invalid. func (i *DsseWhereInput) P() (predicate.Dsse, error) { var predicates []predicate.Dsse if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, dsse.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.Dsse, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, dsse.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.Dsse, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, dsse.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, dsse.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, dsse.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, dsse.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, dsse.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, dsse.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, dsse.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, dsse.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, dsse.IDLTE(*i.IDLTE)) } if i.CreatedAt != nil { predicates = append(predicates, dsse.CreatedAtEQ(*i.CreatedAt)) } if i.CreatedAtNEQ != nil { predicates = append(predicates, dsse.CreatedAtNEQ(*i.CreatedAtNEQ)) } if len(i.CreatedAtIn) > 0 { predicates = append(predicates, dsse.CreatedAtIn(i.CreatedAtIn...)) } if len(i.CreatedAtNotIn) > 0 { predicates = append(predicates, dsse.CreatedAtNotIn(i.CreatedAtNotIn...)) } if i.CreatedAtGT != nil { predicates = append(predicates, dsse.CreatedAtGT(*i.CreatedAtGT)) } if i.CreatedAtGTE != nil { predicates = append(predicates, dsse.CreatedAtGTE(*i.CreatedAtGTE)) } if i.CreatedAtLT != nil { predicates = append(predicates, dsse.CreatedAtLT(*i.CreatedAtLT)) } if i.CreatedAtLTE != nil { predicates = append(predicates, dsse.CreatedAtLTE(*i.CreatedAtLTE)) } if i.CreatedAtIsNil { predicates = append(predicates, dsse.CreatedAtIsNil()) } if i.CreatedAtNotNil { predicates = append(predicates, dsse.CreatedAtNotNil()) } if i.GitoidSha256 != nil { predicates = append(predicates, dsse.GitoidSha256EQ(*i.GitoidSha256)) } if i.GitoidSha256NEQ != nil { predicates = append(predicates, dsse.GitoidSha256NEQ(*i.GitoidSha256NEQ)) } if len(i.GitoidSha256In) > 0 { predicates = append(predicates, dsse.GitoidSha256In(i.GitoidSha256In...)) } if len(i.GitoidSha256NotIn) > 0 { predicates = append(predicates, dsse.GitoidSha256NotIn(i.GitoidSha256NotIn...)) } if i.GitoidSha256GT != nil { predicates = append(predicates, dsse.GitoidSha256GT(*i.GitoidSha256GT)) } if i.GitoidSha256GTE != nil { predicates = append(predicates, dsse.GitoidSha256GTE(*i.GitoidSha256GTE)) } if i.GitoidSha256LT != nil { predicates = append(predicates, dsse.GitoidSha256LT(*i.GitoidSha256LT)) } if i.GitoidSha256LTE != nil { predicates = append(predicates, dsse.GitoidSha256LTE(*i.GitoidSha256LTE)) } if i.GitoidSha256Contains != nil { predicates = append(predicates, dsse.GitoidSha256Contains(*i.GitoidSha256Contains)) } if i.GitoidSha256HasPrefix != nil { predicates = append(predicates, dsse.GitoidSha256HasPrefix(*i.GitoidSha256HasPrefix)) } if i.GitoidSha256HasSuffix != nil { predicates = append(predicates, dsse.GitoidSha256HasSuffix(*i.GitoidSha256HasSuffix)) } if i.GitoidSha256EqualFold != nil { predicates = append(predicates, dsse.GitoidSha256EqualFold(*i.GitoidSha256EqualFold)) } if i.GitoidSha256ContainsFold != nil { predicates = append(predicates, dsse.GitoidSha256ContainsFold(*i.GitoidSha256ContainsFold)) } if i.PayloadType != nil { predicates = append(predicates, dsse.PayloadTypeEQ(*i.PayloadType)) } if i.PayloadTypeNEQ != nil { predicates = append(predicates, dsse.PayloadTypeNEQ(*i.PayloadTypeNEQ)) } if len(i.PayloadTypeIn) > 0 { predicates = append(predicates, dsse.PayloadTypeIn(i.PayloadTypeIn...)) } if len(i.PayloadTypeNotIn) > 0 { predicates = append(predicates, dsse.PayloadTypeNotIn(i.PayloadTypeNotIn...)) } if i.PayloadTypeGT != nil { predicates = append(predicates, dsse.PayloadTypeGT(*i.PayloadTypeGT)) } if i.PayloadTypeGTE != nil { predicates = append(predicates, dsse.PayloadTypeGTE(*i.PayloadTypeGTE)) } if i.PayloadTypeLT != nil { predicates = append(predicates, dsse.PayloadTypeLT(*i.PayloadTypeLT)) } if i.PayloadTypeLTE != nil { predicates = append(predicates, dsse.PayloadTypeLTE(*i.PayloadTypeLTE)) } if i.PayloadTypeContains != nil { predicates = append(predicates, dsse.PayloadTypeContains(*i.PayloadTypeContains)) } if i.PayloadTypeHasPrefix != nil { predicates = append(predicates, dsse.PayloadTypeHasPrefix(*i.PayloadTypeHasPrefix)) } if i.PayloadTypeHasSuffix != nil { predicates = append(predicates, dsse.PayloadTypeHasSuffix(*i.PayloadTypeHasSuffix)) } if i.PayloadTypeEqualFold != nil { predicates = append(predicates, dsse.PayloadTypeEqualFold(*i.PayloadTypeEqualFold)) } if i.PayloadTypeContainsFold != nil { predicates = append(predicates, dsse.PayloadTypeContainsFold(*i.PayloadTypeContainsFold)) } if i.HasStatement != nil { p := dsse.HasStatement() if !*i.HasStatement { p = dsse.Not(p) } predicates = append(predicates, p) } if len(i.HasStatementWith) > 0 { with := make([]predicate.Statement, 0, len(i.HasStatementWith)) for _, w := range i.HasStatementWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasStatementWith'", err) } with = append(with, p) } predicates = append(predicates, dsse.HasStatementWith(with...)) } if i.HasSignatures != nil { p := dsse.HasSignatures() if !*i.HasSignatures { p = dsse.Not(p) } predicates = append(predicates, p) } if len(i.HasSignaturesWith) > 0 { with := make([]predicate.Signature, 0, len(i.HasSignaturesWith)) for _, w := range i.HasSignaturesWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasSignaturesWith'", err) } with = append(with, p) } predicates = append(predicates, dsse.HasSignaturesWith(with...)) } if i.HasPayloadDigests != nil { p := dsse.HasPayloadDigests() if !*i.HasPayloadDigests { p = dsse.Not(p) } predicates = append(predicates, p) } if len(i.HasPayloadDigestsWith) > 0 { with := make([]predicate.PayloadDigest, 0, len(i.HasPayloadDigestsWith)) for _, w := range i.HasPayloadDigestsWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasPayloadDigestsWith'", err) } with = append(with, p) } predicates = append(predicates, dsse.HasPayloadDigestsWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptyDsseWhereInput case 1: return predicates[0], nil default: return dsse.And(predicates...), nil } } // PayloadDigestWhereInput represents a where input for filtering PayloadDigest queries. type PayloadDigestWhereInput struct { Predicates []predicate.PayloadDigest `json:"-"` Not *PayloadDigestWhereInput `json:"not,omitempty"` Or []*PayloadDigestWhereInput `json:"or,omitempty"` And []*PayloadDigestWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "algorithm" field predicates. Algorithm *string `json:"algorithm,omitempty"` AlgorithmNEQ *string `json:"algorithmNEQ,omitempty"` AlgorithmIn []string `json:"algorithmIn,omitempty"` AlgorithmNotIn []string `json:"algorithmNotIn,omitempty"` AlgorithmGT *string `json:"algorithmGT,omitempty"` AlgorithmGTE *string `json:"algorithmGTE,omitempty"` AlgorithmLT *string `json:"algorithmLT,omitempty"` AlgorithmLTE *string `json:"algorithmLTE,omitempty"` AlgorithmContains *string `json:"algorithmContains,omitempty"` AlgorithmHasPrefix *string `json:"algorithmHasPrefix,omitempty"` AlgorithmHasSuffix *string `json:"algorithmHasSuffix,omitempty"` AlgorithmEqualFold *string `json:"algorithmEqualFold,omitempty"` AlgorithmContainsFold *string `json:"algorithmContainsFold,omitempty"` // "value" field predicates. Value *string `json:"value,omitempty"` ValueNEQ *string `json:"valueNEQ,omitempty"` ValueIn []string `json:"valueIn,omitempty"` ValueNotIn []string `json:"valueNotIn,omitempty"` ValueGT *string `json:"valueGT,omitempty"` ValueGTE *string `json:"valueGTE,omitempty"` ValueLT *string `json:"valueLT,omitempty"` ValueLTE *string `json:"valueLTE,omitempty"` ValueContains *string `json:"valueContains,omitempty"` ValueHasPrefix *string `json:"valueHasPrefix,omitempty"` ValueHasSuffix *string `json:"valueHasSuffix,omitempty"` ValueEqualFold *string `json:"valueEqualFold,omitempty"` ValueContainsFold *string `json:"valueContainsFold,omitempty"` // "dsse" edge predicates. HasDsse *bool `json:"hasDsse,omitempty"` HasDsseWith []*DsseWhereInput `json:"hasDsseWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *PayloadDigestWhereInput) AddPredicates(predicates ...predicate.PayloadDigest) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the PayloadDigestWhereInput filter on the PayloadDigestQuery builder. func (i *PayloadDigestWhereInput) Filter(q *PayloadDigestQuery) (*PayloadDigestQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptyPayloadDigestWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptyPayloadDigestWhereInput is returned in case the PayloadDigestWhereInput is empty. var ErrEmptyPayloadDigestWhereInput = errors.New("ent: empty predicate PayloadDigestWhereInput") // P returns a predicate for filtering payloaddigests. // An error is returned if the input is empty or invalid. func (i *PayloadDigestWhereInput) P() (predicate.PayloadDigest, error) { var predicates []predicate.PayloadDigest if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, payloaddigest.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.PayloadDigest, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, payloaddigest.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.PayloadDigest, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, payloaddigest.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, payloaddigest.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, payloaddigest.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, payloaddigest.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, payloaddigest.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, payloaddigest.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, payloaddigest.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, payloaddigest.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, payloaddigest.IDLTE(*i.IDLTE)) } if i.Algorithm != nil { predicates = append(predicates, payloaddigest.AlgorithmEQ(*i.Algorithm)) } if i.AlgorithmNEQ != nil { predicates = append(predicates, payloaddigest.AlgorithmNEQ(*i.AlgorithmNEQ)) } if len(i.AlgorithmIn) > 0 { predicates = append(predicates, payloaddigest.AlgorithmIn(i.AlgorithmIn...)) } if len(i.AlgorithmNotIn) > 0 { predicates = append(predicates, payloaddigest.AlgorithmNotIn(i.AlgorithmNotIn...)) } if i.AlgorithmGT != nil { predicates = append(predicates, payloaddigest.AlgorithmGT(*i.AlgorithmGT)) } if i.AlgorithmGTE != nil { predicates = append(predicates, payloaddigest.AlgorithmGTE(*i.AlgorithmGTE)) } if i.AlgorithmLT != nil { predicates = append(predicates, payloaddigest.AlgorithmLT(*i.AlgorithmLT)) } if i.AlgorithmLTE != nil { predicates = append(predicates, payloaddigest.AlgorithmLTE(*i.AlgorithmLTE)) } if i.AlgorithmContains != nil { predicates = append(predicates, payloaddigest.AlgorithmContains(*i.AlgorithmContains)) } if i.AlgorithmHasPrefix != nil { predicates = append(predicates, payloaddigest.AlgorithmHasPrefix(*i.AlgorithmHasPrefix)) } if i.AlgorithmHasSuffix != nil { predicates = append(predicates, payloaddigest.AlgorithmHasSuffix(*i.AlgorithmHasSuffix)) } if i.AlgorithmEqualFold != nil { predicates = append(predicates, payloaddigest.AlgorithmEqualFold(*i.AlgorithmEqualFold)) } if i.AlgorithmContainsFold != nil { predicates = append(predicates, payloaddigest.AlgorithmContainsFold(*i.AlgorithmContainsFold)) } if i.Value != nil { predicates = append(predicates, payloaddigest.ValueEQ(*i.Value)) } if i.ValueNEQ != nil { predicates = append(predicates, payloaddigest.ValueNEQ(*i.ValueNEQ)) } if len(i.ValueIn) > 0 { predicates = append(predicates, payloaddigest.ValueIn(i.ValueIn...)) } if len(i.ValueNotIn) > 0 { predicates = append(predicates, payloaddigest.ValueNotIn(i.ValueNotIn...)) } if i.ValueGT != nil { predicates = append(predicates, payloaddigest.ValueGT(*i.ValueGT)) } if i.ValueGTE != nil { predicates = append(predicates, payloaddigest.ValueGTE(*i.ValueGTE)) } if i.ValueLT != nil { predicates = append(predicates, payloaddigest.ValueLT(*i.ValueLT)) } if i.ValueLTE != nil { predicates = append(predicates, payloaddigest.ValueLTE(*i.ValueLTE)) } if i.ValueContains != nil { predicates = append(predicates, payloaddigest.ValueContains(*i.ValueContains)) } if i.ValueHasPrefix != nil { predicates = append(predicates, payloaddigest.ValueHasPrefix(*i.ValueHasPrefix)) } if i.ValueHasSuffix != nil { predicates = append(predicates, payloaddigest.ValueHasSuffix(*i.ValueHasSuffix)) } if i.ValueEqualFold != nil { predicates = append(predicates, payloaddigest.ValueEqualFold(*i.ValueEqualFold)) } if i.ValueContainsFold != nil { predicates = append(predicates, payloaddigest.ValueContainsFold(*i.ValueContainsFold)) } if i.HasDsse != nil { p := payloaddigest.HasDsse() if !*i.HasDsse { p = payloaddigest.Not(p) } predicates = append(predicates, p) } if len(i.HasDsseWith) > 0 { with := make([]predicate.Dsse, 0, len(i.HasDsseWith)) for _, w := range i.HasDsseWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasDsseWith'", err) } with = append(with, p) } predicates = append(predicates, payloaddigest.HasDsseWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptyPayloadDigestWhereInput case 1: return predicates[0], nil default: return payloaddigest.And(predicates...), nil } } // SignatureWhereInput represents a where input for filtering Signature queries. type SignatureWhereInput struct { Predicates []predicate.Signature `json:"-"` Not *SignatureWhereInput `json:"not,omitempty"` Or []*SignatureWhereInput `json:"or,omitempty"` And []*SignatureWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "key_id" field predicates. KeyID *string `json:"keyID,omitempty"` KeyIDNEQ *string `json:"keyIDNEQ,omitempty"` KeyIDIn []string `json:"keyIDIn,omitempty"` KeyIDNotIn []string `json:"keyIDNotIn,omitempty"` KeyIDGT *string `json:"keyIDGT,omitempty"` KeyIDGTE *string `json:"keyIDGTE,omitempty"` KeyIDLT *string `json:"keyIDLT,omitempty"` KeyIDLTE *string `json:"keyIDLTE,omitempty"` KeyIDContains *string `json:"keyIDContains,omitempty"` KeyIDHasPrefix *string `json:"keyIDHasPrefix,omitempty"` KeyIDHasSuffix *string `json:"keyIDHasSuffix,omitempty"` KeyIDEqualFold *string `json:"keyIDEqualFold,omitempty"` KeyIDContainsFold *string `json:"keyIDContainsFold,omitempty"` // "signature" field predicates. Signature *string `json:"signature,omitempty"` SignatureNEQ *string `json:"signatureNEQ,omitempty"` SignatureIn []string `json:"signatureIn,omitempty"` SignatureNotIn []string `json:"signatureNotIn,omitempty"` SignatureGT *string `json:"signatureGT,omitempty"` SignatureGTE *string `json:"signatureGTE,omitempty"` SignatureLT *string `json:"signatureLT,omitempty"` SignatureLTE *string `json:"signatureLTE,omitempty"` SignatureContains *string `json:"signatureContains,omitempty"` SignatureHasPrefix *string `json:"signatureHasPrefix,omitempty"` SignatureHasSuffix *string `json:"signatureHasSuffix,omitempty"` SignatureEqualFold *string `json:"signatureEqualFold,omitempty"` SignatureContainsFold *string `json:"signatureContainsFold,omitempty"` // "dsse" edge predicates. HasDsse *bool `json:"hasDsse,omitempty"` HasDsseWith []*DsseWhereInput `json:"hasDsseWith,omitempty"` // "timestamps" edge predicates. HasTimestamps *bool `json:"hasTimestamps,omitempty"` HasTimestampsWith []*TimestampWhereInput `json:"hasTimestampsWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *SignatureWhereInput) AddPredicates(predicates ...predicate.Signature) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the SignatureWhereInput filter on the SignatureQuery builder. func (i *SignatureWhereInput) Filter(q *SignatureQuery) (*SignatureQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptySignatureWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptySignatureWhereInput is returned in case the SignatureWhereInput is empty. var ErrEmptySignatureWhereInput = errors.New("ent: empty predicate SignatureWhereInput") // P returns a predicate for filtering signatures. // An error is returned if the input is empty or invalid. func (i *SignatureWhereInput) P() (predicate.Signature, error) { var predicates []predicate.Signature if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, signature.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.Signature, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, signature.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.Signature, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, signature.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, signature.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, signature.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, signature.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, signature.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, signature.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, signature.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, signature.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, signature.IDLTE(*i.IDLTE)) } if i.KeyID != nil { predicates = append(predicates, signature.KeyIDEQ(*i.KeyID)) } if i.KeyIDNEQ != nil { predicates = append(predicates, signature.KeyIDNEQ(*i.KeyIDNEQ)) } if len(i.KeyIDIn) > 0 { predicates = append(predicates, signature.KeyIDIn(i.KeyIDIn...)) } if len(i.KeyIDNotIn) > 0 { predicates = append(predicates, signature.KeyIDNotIn(i.KeyIDNotIn...)) } if i.KeyIDGT != nil { predicates = append(predicates, signature.KeyIDGT(*i.KeyIDGT)) } if i.KeyIDGTE != nil { predicates = append(predicates, signature.KeyIDGTE(*i.KeyIDGTE)) } if i.KeyIDLT != nil { predicates = append(predicates, signature.KeyIDLT(*i.KeyIDLT)) } if i.KeyIDLTE != nil { predicates = append(predicates, signature.KeyIDLTE(*i.KeyIDLTE)) } if i.KeyIDContains != nil { predicates = append(predicates, signature.KeyIDContains(*i.KeyIDContains)) } if i.KeyIDHasPrefix != nil { predicates = append(predicates, signature.KeyIDHasPrefix(*i.KeyIDHasPrefix)) } if i.KeyIDHasSuffix != nil { predicates = append(predicates, signature.KeyIDHasSuffix(*i.KeyIDHasSuffix)) } if i.KeyIDEqualFold != nil { predicates = append(predicates, signature.KeyIDEqualFold(*i.KeyIDEqualFold)) } if i.KeyIDContainsFold != nil { predicates = append(predicates, signature.KeyIDContainsFold(*i.KeyIDContainsFold)) } if i.Signature != nil { predicates = append(predicates, signature.SignatureEQ(*i.Signature)) } if i.SignatureNEQ != nil { predicates = append(predicates, signature.SignatureNEQ(*i.SignatureNEQ)) } if len(i.SignatureIn) > 0 { predicates = append(predicates, signature.SignatureIn(i.SignatureIn...)) } if len(i.SignatureNotIn) > 0 { predicates = append(predicates, signature.SignatureNotIn(i.SignatureNotIn...)) } if i.SignatureGT != nil { predicates = append(predicates, signature.SignatureGT(*i.SignatureGT)) } if i.SignatureGTE != nil { predicates = append(predicates, signature.SignatureGTE(*i.SignatureGTE)) } if i.SignatureLT != nil { predicates = append(predicates, signature.SignatureLT(*i.SignatureLT)) } if i.SignatureLTE != nil { predicates = append(predicates, signature.SignatureLTE(*i.SignatureLTE)) } if i.SignatureContains != nil { predicates = append(predicates, signature.SignatureContains(*i.SignatureContains)) } if i.SignatureHasPrefix != nil { predicates = append(predicates, signature.SignatureHasPrefix(*i.SignatureHasPrefix)) } if i.SignatureHasSuffix != nil { predicates = append(predicates, signature.SignatureHasSuffix(*i.SignatureHasSuffix)) } if i.SignatureEqualFold != nil { predicates = append(predicates, signature.SignatureEqualFold(*i.SignatureEqualFold)) } if i.SignatureContainsFold != nil { predicates = append(predicates, signature.SignatureContainsFold(*i.SignatureContainsFold)) } if i.HasDsse != nil { p := signature.HasDsse() if !*i.HasDsse { p = signature.Not(p) } predicates = append(predicates, p) } if len(i.HasDsseWith) > 0 { with := make([]predicate.Dsse, 0, len(i.HasDsseWith)) for _, w := range i.HasDsseWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasDsseWith'", err) } with = append(with, p) } predicates = append(predicates, signature.HasDsseWith(with...)) } if i.HasTimestamps != nil { p := signature.HasTimestamps() if !*i.HasTimestamps { p = signature.Not(p) } predicates = append(predicates, p) } if len(i.HasTimestampsWith) > 0 { with := make([]predicate.Timestamp, 0, len(i.HasTimestampsWith)) for _, w := range i.HasTimestampsWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasTimestampsWith'", err) } with = append(with, p) } predicates = append(predicates, signature.HasTimestampsWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptySignatureWhereInput case 1: return predicates[0], nil default: return signature.And(predicates...), nil } } // StatementWhereInput represents a where input for filtering Statement queries. type StatementWhereInput struct { Predicates []predicate.Statement `json:"-"` Not *StatementWhereInput `json:"not,omitempty"` Or []*StatementWhereInput `json:"or,omitempty"` And []*StatementWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "predicate" field predicates. Predicate *string `json:"predicate,omitempty"` PredicateNEQ *string `json:"predicateNEQ,omitempty"` PredicateIn []string `json:"predicateIn,omitempty"` PredicateNotIn []string `json:"predicateNotIn,omitempty"` PredicateGT *string `json:"predicateGT,omitempty"` PredicateGTE *string `json:"predicateGTE,omitempty"` PredicateLT *string `json:"predicateLT,omitempty"` PredicateLTE *string `json:"predicateLTE,omitempty"` PredicateContains *string `json:"predicateContains,omitempty"` PredicateHasPrefix *string `json:"predicateHasPrefix,omitempty"` PredicateHasSuffix *string `json:"predicateHasSuffix,omitempty"` PredicateEqualFold *string `json:"predicateEqualFold,omitempty"` PredicateContainsFold *string `json:"predicateContainsFold,omitempty"` // "subjects" edge predicates. HasSubjects *bool `json:"hasSubjects,omitempty"` HasSubjectsWith []*SubjectWhereInput `json:"hasSubjectsWith,omitempty"` // "policy" edge predicates. HasPolicy *bool `json:"hasPolicy,omitempty"` HasPolicyWith []*AttestationPolicyWhereInput `json:"hasPolicyWith,omitempty"` // "attestation_collections" edge predicates. HasAttestationCollections *bool `json:"hasAttestationCollections,omitempty"` HasAttestationCollectionsWith []*AttestationCollectionWhereInput `json:"hasAttestationCollectionsWith,omitempty"` // "dsse" edge predicates. HasDsse *bool `json:"hasDsse,omitempty"` HasDsseWith []*DsseWhereInput `json:"hasDsseWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *StatementWhereInput) AddPredicates(predicates ...predicate.Statement) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the StatementWhereInput filter on the StatementQuery builder. func (i *StatementWhereInput) Filter(q *StatementQuery) (*StatementQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptyStatementWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptyStatementWhereInput is returned in case the StatementWhereInput is empty. var ErrEmptyStatementWhereInput = errors.New("ent: empty predicate StatementWhereInput") // P returns a predicate for filtering statements. // An error is returned if the input is empty or invalid. func (i *StatementWhereInput) P() (predicate.Statement, error) { var predicates []predicate.Statement if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, statement.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.Statement, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, statement.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.Statement, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, statement.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, statement.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, statement.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, statement.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, statement.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, statement.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, statement.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, statement.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, statement.IDLTE(*i.IDLTE)) } if i.Predicate != nil { predicates = append(predicates, statement.PredicateEQ(*i.Predicate)) } if i.PredicateNEQ != nil { predicates = append(predicates, statement.PredicateNEQ(*i.PredicateNEQ)) } if len(i.PredicateIn) > 0 { predicates = append(predicates, statement.PredicateIn(i.PredicateIn...)) } if len(i.PredicateNotIn) > 0 { predicates = append(predicates, statement.PredicateNotIn(i.PredicateNotIn...)) } if i.PredicateGT != nil { predicates = append(predicates, statement.PredicateGT(*i.PredicateGT)) } if i.PredicateGTE != nil { predicates = append(predicates, statement.PredicateGTE(*i.PredicateGTE)) } if i.PredicateLT != nil { predicates = append(predicates, statement.PredicateLT(*i.PredicateLT)) } if i.PredicateLTE != nil { predicates = append(predicates, statement.PredicateLTE(*i.PredicateLTE)) } if i.PredicateContains != nil { predicates = append(predicates, statement.PredicateContains(*i.PredicateContains)) } if i.PredicateHasPrefix != nil { predicates = append(predicates, statement.PredicateHasPrefix(*i.PredicateHasPrefix)) } if i.PredicateHasSuffix != nil { predicates = append(predicates, statement.PredicateHasSuffix(*i.PredicateHasSuffix)) } if i.PredicateEqualFold != nil { predicates = append(predicates, statement.PredicateEqualFold(*i.PredicateEqualFold)) } if i.PredicateContainsFold != nil { predicates = append(predicates, statement.PredicateContainsFold(*i.PredicateContainsFold)) } if i.HasSubjects != nil { p := statement.HasSubjects() if !*i.HasSubjects { p = statement.Not(p) } predicates = append(predicates, p) } if len(i.HasSubjectsWith) > 0 { with := make([]predicate.Subject, 0, len(i.HasSubjectsWith)) for _, w := range i.HasSubjectsWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasSubjectsWith'", err) } with = append(with, p) } predicates = append(predicates, statement.HasSubjectsWith(with...)) } if i.HasPolicy != nil { p := statement.HasPolicy() if !*i.HasPolicy { p = statement.Not(p) } predicates = append(predicates, p) } if len(i.HasPolicyWith) > 0 { with := make([]predicate.AttestationPolicy, 0, len(i.HasPolicyWith)) for _, w := range i.HasPolicyWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasPolicyWith'", err) } with = append(with, p) } predicates = append(predicates, statement.HasPolicyWith(with...)) } if i.HasAttestationCollections != nil { p := statement.HasAttestationCollections() if !*i.HasAttestationCollections { p = statement.Not(p) } predicates = append(predicates, p) } if len(i.HasAttestationCollectionsWith) > 0 { with := make([]predicate.AttestationCollection, 0, len(i.HasAttestationCollectionsWith)) for _, w := range i.HasAttestationCollectionsWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasAttestationCollectionsWith'", err) } with = append(with, p) } predicates = append(predicates, statement.HasAttestationCollectionsWith(with...)) } if i.HasDsse != nil { p := statement.HasDsse() if !*i.HasDsse { p = statement.Not(p) } predicates = append(predicates, p) } if len(i.HasDsseWith) > 0 { with := make([]predicate.Dsse, 0, len(i.HasDsseWith)) for _, w := range i.HasDsseWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasDsseWith'", err) } with = append(with, p) } predicates = append(predicates, statement.HasDsseWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptyStatementWhereInput case 1: return predicates[0], nil default: return statement.And(predicates...), nil } } // SubjectWhereInput represents a where input for filtering Subject queries. type SubjectWhereInput struct { Predicates []predicate.Subject `json:"-"` Not *SubjectWhereInput `json:"not,omitempty"` Or []*SubjectWhereInput `json:"or,omitempty"` And []*SubjectWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "created_at" field predicates. CreatedAt *time.Time `json:"createdAt,omitempty"` CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"` CreatedAtIn []time.Time `json:"createdAtIn,omitempty"` CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"` CreatedAtGT *time.Time `json:"createdAtGT,omitempty"` CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"` CreatedAtLT *time.Time `json:"createdAtLT,omitempty"` CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"` CreatedAtIsNil bool `json:"createdAtIsNil,omitempty"` CreatedAtNotNil bool `json:"createdAtNotNil,omitempty"` // "name" field predicates. Name *string `json:"name,omitempty"` NameNEQ *string `json:"nameNEQ,omitempty"` NameIn []string `json:"nameIn,omitempty"` NameNotIn []string `json:"nameNotIn,omitempty"` NameGT *string `json:"nameGT,omitempty"` NameGTE *string `json:"nameGTE,omitempty"` NameLT *string `json:"nameLT,omitempty"` NameLTE *string `json:"nameLTE,omitempty"` NameContains *string `json:"nameContains,omitempty"` NameHasPrefix *string `json:"nameHasPrefix,omitempty"` NameHasSuffix *string `json:"nameHasSuffix,omitempty"` NameEqualFold *string `json:"nameEqualFold,omitempty"` NameContainsFold *string `json:"nameContainsFold,omitempty"` // "subject_digests" edge predicates. HasSubjectDigests *bool `json:"hasSubjectDigests,omitempty"` HasSubjectDigestsWith []*SubjectDigestWhereInput `json:"hasSubjectDigestsWith,omitempty"` // "statement" edge predicates. HasStatement *bool `json:"hasStatement,omitempty"` HasStatementWith []*StatementWhereInput `json:"hasStatementWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *SubjectWhereInput) AddPredicates(predicates ...predicate.Subject) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the SubjectWhereInput filter on the SubjectQuery builder. func (i *SubjectWhereInput) Filter(q *SubjectQuery) (*SubjectQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptySubjectWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptySubjectWhereInput is returned in case the SubjectWhereInput is empty. var ErrEmptySubjectWhereInput = errors.New("ent: empty predicate SubjectWhereInput") // P returns a predicate for filtering subjects. // An error is returned if the input is empty or invalid. func (i *SubjectWhereInput) P() (predicate.Subject, error) { var predicates []predicate.Subject if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, subject.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.Subject, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, subject.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.Subject, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, subject.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, subject.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, subject.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, subject.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, subject.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, subject.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, subject.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, subject.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, subject.IDLTE(*i.IDLTE)) } if i.CreatedAt != nil { predicates = append(predicates, subject.CreatedAtEQ(*i.CreatedAt)) } if i.CreatedAtNEQ != nil { predicates = append(predicates, subject.CreatedAtNEQ(*i.CreatedAtNEQ)) } if len(i.CreatedAtIn) > 0 { predicates = append(predicates, subject.CreatedAtIn(i.CreatedAtIn...)) } if len(i.CreatedAtNotIn) > 0 { predicates = append(predicates, subject.CreatedAtNotIn(i.CreatedAtNotIn...)) } if i.CreatedAtGT != nil { predicates = append(predicates, subject.CreatedAtGT(*i.CreatedAtGT)) } if i.CreatedAtGTE != nil { predicates = append(predicates, subject.CreatedAtGTE(*i.CreatedAtGTE)) } if i.CreatedAtLT != nil { predicates = append(predicates, subject.CreatedAtLT(*i.CreatedAtLT)) } if i.CreatedAtLTE != nil { predicates = append(predicates, subject.CreatedAtLTE(*i.CreatedAtLTE)) } if i.CreatedAtIsNil { predicates = append(predicates, subject.CreatedAtIsNil()) } if i.CreatedAtNotNil { predicates = append(predicates, subject.CreatedAtNotNil()) } if i.Name != nil { predicates = append(predicates, subject.NameEQ(*i.Name)) } if i.NameNEQ != nil { predicates = append(predicates, subject.NameNEQ(*i.NameNEQ)) } if len(i.NameIn) > 0 { predicates = append(predicates, subject.NameIn(i.NameIn...)) } if len(i.NameNotIn) > 0 { predicates = append(predicates, subject.NameNotIn(i.NameNotIn...)) } if i.NameGT != nil { predicates = append(predicates, subject.NameGT(*i.NameGT)) } if i.NameGTE != nil { predicates = append(predicates, subject.NameGTE(*i.NameGTE)) } if i.NameLT != nil { predicates = append(predicates, subject.NameLT(*i.NameLT)) } if i.NameLTE != nil { predicates = append(predicates, subject.NameLTE(*i.NameLTE)) } if i.NameContains != nil { predicates = append(predicates, subject.NameContains(*i.NameContains)) } if i.NameHasPrefix != nil { predicates = append(predicates, subject.NameHasPrefix(*i.NameHasPrefix)) } if i.NameHasSuffix != nil { predicates = append(predicates, subject.NameHasSuffix(*i.NameHasSuffix)) } if i.NameEqualFold != nil { predicates = append(predicates, subject.NameEqualFold(*i.NameEqualFold)) } if i.NameContainsFold != nil { predicates = append(predicates, subject.NameContainsFold(*i.NameContainsFold)) } if i.HasSubjectDigests != nil { p := subject.HasSubjectDigests() if !*i.HasSubjectDigests { p = subject.Not(p) } predicates = append(predicates, p) } if len(i.HasSubjectDigestsWith) > 0 { with := make([]predicate.SubjectDigest, 0, len(i.HasSubjectDigestsWith)) for _, w := range i.HasSubjectDigestsWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasSubjectDigestsWith'", err) } with = append(with, p) } predicates = append(predicates, subject.HasSubjectDigestsWith(with...)) } if i.HasStatement != nil { p := subject.HasStatement() if !*i.HasStatement { p = subject.Not(p) } predicates = append(predicates, p) } if len(i.HasStatementWith) > 0 { with := make([]predicate.Statement, 0, len(i.HasStatementWith)) for _, w := range i.HasStatementWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasStatementWith'", err) } with = append(with, p) } predicates = append(predicates, subject.HasStatementWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptySubjectWhereInput case 1: return predicates[0], nil default: return subject.And(predicates...), nil } } // SubjectDigestWhereInput represents a where input for filtering SubjectDigest queries. type SubjectDigestWhereInput struct { Predicates []predicate.SubjectDigest `json:"-"` Not *SubjectDigestWhereInput `json:"not,omitempty"` Or []*SubjectDigestWhereInput `json:"or,omitempty"` And []*SubjectDigestWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "algorithm" field predicates. Algorithm *string `json:"algorithm,omitempty"` AlgorithmNEQ *string `json:"algorithmNEQ,omitempty"` AlgorithmIn []string `json:"algorithmIn,omitempty"` AlgorithmNotIn []string `json:"algorithmNotIn,omitempty"` AlgorithmGT *string `json:"algorithmGT,omitempty"` AlgorithmGTE *string `json:"algorithmGTE,omitempty"` AlgorithmLT *string `json:"algorithmLT,omitempty"` AlgorithmLTE *string `json:"algorithmLTE,omitempty"` AlgorithmContains *string `json:"algorithmContains,omitempty"` AlgorithmHasPrefix *string `json:"algorithmHasPrefix,omitempty"` AlgorithmHasSuffix *string `json:"algorithmHasSuffix,omitempty"` AlgorithmEqualFold *string `json:"algorithmEqualFold,omitempty"` AlgorithmContainsFold *string `json:"algorithmContainsFold,omitempty"` // "value" field predicates. Value *string `json:"value,omitempty"` ValueNEQ *string `json:"valueNEQ,omitempty"` ValueIn []string `json:"valueIn,omitempty"` ValueNotIn []string `json:"valueNotIn,omitempty"` ValueGT *string `json:"valueGT,omitempty"` ValueGTE *string `json:"valueGTE,omitempty"` ValueLT *string `json:"valueLT,omitempty"` ValueLTE *string `json:"valueLTE,omitempty"` ValueContains *string `json:"valueContains,omitempty"` ValueHasPrefix *string `json:"valueHasPrefix,omitempty"` ValueHasSuffix *string `json:"valueHasSuffix,omitempty"` ValueEqualFold *string `json:"valueEqualFold,omitempty"` ValueContainsFold *string `json:"valueContainsFold,omitempty"` // "subject" edge predicates. HasSubject *bool `json:"hasSubject,omitempty"` HasSubjectWith []*SubjectWhereInput `json:"hasSubjectWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *SubjectDigestWhereInput) AddPredicates(predicates ...predicate.SubjectDigest) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the SubjectDigestWhereInput filter on the SubjectDigestQuery builder. func (i *SubjectDigestWhereInput) Filter(q *SubjectDigestQuery) (*SubjectDigestQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptySubjectDigestWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptySubjectDigestWhereInput is returned in case the SubjectDigestWhereInput is empty. var ErrEmptySubjectDigestWhereInput = errors.New("ent: empty predicate SubjectDigestWhereInput") // P returns a predicate for filtering subjectdigests. // An error is returned if the input is empty or invalid. func (i *SubjectDigestWhereInput) P() (predicate.SubjectDigest, error) { var predicates []predicate.SubjectDigest if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, subjectdigest.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.SubjectDigest, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, subjectdigest.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.SubjectDigest, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, subjectdigest.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, subjectdigest.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, subjectdigest.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, subjectdigest.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, subjectdigest.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, subjectdigest.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, subjectdigest.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, subjectdigest.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, subjectdigest.IDLTE(*i.IDLTE)) } if i.Algorithm != nil { predicates = append(predicates, subjectdigest.AlgorithmEQ(*i.Algorithm)) } if i.AlgorithmNEQ != nil { predicates = append(predicates, subjectdigest.AlgorithmNEQ(*i.AlgorithmNEQ)) } if len(i.AlgorithmIn) > 0 { predicates = append(predicates, subjectdigest.AlgorithmIn(i.AlgorithmIn...)) } if len(i.AlgorithmNotIn) > 0 { predicates = append(predicates, subjectdigest.AlgorithmNotIn(i.AlgorithmNotIn...)) } if i.AlgorithmGT != nil { predicates = append(predicates, subjectdigest.AlgorithmGT(*i.AlgorithmGT)) } if i.AlgorithmGTE != nil { predicates = append(predicates, subjectdigest.AlgorithmGTE(*i.AlgorithmGTE)) } if i.AlgorithmLT != nil { predicates = append(predicates, subjectdigest.AlgorithmLT(*i.AlgorithmLT)) } if i.AlgorithmLTE != nil { predicates = append(predicates, subjectdigest.AlgorithmLTE(*i.AlgorithmLTE)) } if i.AlgorithmContains != nil { predicates = append(predicates, subjectdigest.AlgorithmContains(*i.AlgorithmContains)) } if i.AlgorithmHasPrefix != nil { predicates = append(predicates, subjectdigest.AlgorithmHasPrefix(*i.AlgorithmHasPrefix)) } if i.AlgorithmHasSuffix != nil { predicates = append(predicates, subjectdigest.AlgorithmHasSuffix(*i.AlgorithmHasSuffix)) } if i.AlgorithmEqualFold != nil { predicates = append(predicates, subjectdigest.AlgorithmEqualFold(*i.AlgorithmEqualFold)) } if i.AlgorithmContainsFold != nil { predicates = append(predicates, subjectdigest.AlgorithmContainsFold(*i.AlgorithmContainsFold)) } if i.Value != nil { predicates = append(predicates, subjectdigest.ValueEQ(*i.Value)) } if i.ValueNEQ != nil { predicates = append(predicates, subjectdigest.ValueNEQ(*i.ValueNEQ)) } if len(i.ValueIn) > 0 { predicates = append(predicates, subjectdigest.ValueIn(i.ValueIn...)) } if len(i.ValueNotIn) > 0 { predicates = append(predicates, subjectdigest.ValueNotIn(i.ValueNotIn...)) } if i.ValueGT != nil { predicates = append(predicates, subjectdigest.ValueGT(*i.ValueGT)) } if i.ValueGTE != nil { predicates = append(predicates, subjectdigest.ValueGTE(*i.ValueGTE)) } if i.ValueLT != nil { predicates = append(predicates, subjectdigest.ValueLT(*i.ValueLT)) } if i.ValueLTE != nil { predicates = append(predicates, subjectdigest.ValueLTE(*i.ValueLTE)) } if i.ValueContains != nil { predicates = append(predicates, subjectdigest.ValueContains(*i.ValueContains)) } if i.ValueHasPrefix != nil { predicates = append(predicates, subjectdigest.ValueHasPrefix(*i.ValueHasPrefix)) } if i.ValueHasSuffix != nil { predicates = append(predicates, subjectdigest.ValueHasSuffix(*i.ValueHasSuffix)) } if i.ValueEqualFold != nil { predicates = append(predicates, subjectdigest.ValueEqualFold(*i.ValueEqualFold)) } if i.ValueContainsFold != nil { predicates = append(predicates, subjectdigest.ValueContainsFold(*i.ValueContainsFold)) } if i.HasSubject != nil { p := subjectdigest.HasSubject() if !*i.HasSubject { p = subjectdigest.Not(p) } predicates = append(predicates, p) } if len(i.HasSubjectWith) > 0 { with := make([]predicate.Subject, 0, len(i.HasSubjectWith)) for _, w := range i.HasSubjectWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasSubjectWith'", err) } with = append(with, p) } predicates = append(predicates, subjectdigest.HasSubjectWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptySubjectDigestWhereInput case 1: return predicates[0], nil default: return subjectdigest.And(predicates...), nil } } // TimestampWhereInput represents a where input for filtering Timestamp queries. type TimestampWhereInput struct { Predicates []predicate.Timestamp `json:"-"` Not *TimestampWhereInput `json:"not,omitempty"` Or []*TimestampWhereInput `json:"or,omitempty"` And []*TimestampWhereInput `json:"and,omitempty"` // "id" field predicates. ID *uuid.UUID `json:"id,omitempty"` IDNEQ *uuid.UUID `json:"idNEQ,omitempty"` IDIn []uuid.UUID `json:"idIn,omitempty"` IDNotIn []uuid.UUID `json:"idNotIn,omitempty"` IDGT *uuid.UUID `json:"idGT,omitempty"` IDGTE *uuid.UUID `json:"idGTE,omitempty"` IDLT *uuid.UUID `json:"idLT,omitempty"` IDLTE *uuid.UUID `json:"idLTE,omitempty"` // "type" field predicates. Type *string `json:"type,omitempty"` TypeNEQ *string `json:"typeNEQ,omitempty"` TypeIn []string `json:"typeIn,omitempty"` TypeNotIn []string `json:"typeNotIn,omitempty"` TypeGT *string `json:"typeGT,omitempty"` TypeGTE *string `json:"typeGTE,omitempty"` TypeLT *string `json:"typeLT,omitempty"` TypeLTE *string `json:"typeLTE,omitempty"` TypeContains *string `json:"typeContains,omitempty"` TypeHasPrefix *string `json:"typeHasPrefix,omitempty"` TypeHasSuffix *string `json:"typeHasSuffix,omitempty"` TypeEqualFold *string `json:"typeEqualFold,omitempty"` TypeContainsFold *string `json:"typeContainsFold,omitempty"` // "timestamp" field predicates. Timestamp *time.Time `json:"timestamp,omitempty"` TimestampNEQ *time.Time `json:"timestampNEQ,omitempty"` TimestampIn []time.Time `json:"timestampIn,omitempty"` TimestampNotIn []time.Time `json:"timestampNotIn,omitempty"` TimestampGT *time.Time `json:"timestampGT,omitempty"` TimestampGTE *time.Time `json:"timestampGTE,omitempty"` TimestampLT *time.Time `json:"timestampLT,omitempty"` TimestampLTE *time.Time `json:"timestampLTE,omitempty"` // "signature" edge predicates. HasSignature *bool `json:"hasSignature,omitempty"` HasSignatureWith []*SignatureWhereInput `json:"hasSignatureWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. func (i *TimestampWhereInput) AddPredicates(predicates ...predicate.Timestamp) { i.Predicates = append(i.Predicates, predicates...) } // Filter applies the TimestampWhereInput filter on the TimestampQuery builder. func (i *TimestampWhereInput) Filter(q *TimestampQuery) (*TimestampQuery, error) { if i == nil { return q, nil } p, err := i.P() if err != nil { if err == ErrEmptyTimestampWhereInput { return q, nil } return nil, err } return q.Where(p), nil } // ErrEmptyTimestampWhereInput is returned in case the TimestampWhereInput is empty. var ErrEmptyTimestampWhereInput = errors.New("ent: empty predicate TimestampWhereInput") // P returns a predicate for filtering timestamps. // An error is returned if the input is empty or invalid. func (i *TimestampWhereInput) P() (predicate.Timestamp, error) { var predicates []predicate.Timestamp if i.Not != nil { p, err := i.Not.P() if err != nil { return nil, fmt.Errorf("%w: field 'not'", err) } predicates = append(predicates, timestamp.Not(p)) } switch n := len(i.Or); { case n == 1: p, err := i.Or[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } predicates = append(predicates, p) case n > 1: or := make([]predicate.Timestamp, 0, n) for _, w := range i.Or { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'or'", err) } or = append(or, p) } predicates = append(predicates, timestamp.Or(or...)) } switch n := len(i.And); { case n == 1: p, err := i.And[0].P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } predicates = append(predicates, p) case n > 1: and := make([]predicate.Timestamp, 0, n) for _, w := range i.And { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'and'", err) } and = append(and, p) } predicates = append(predicates, timestamp.And(and...)) } predicates = append(predicates, i.Predicates...) if i.ID != nil { predicates = append(predicates, timestamp.IDEQ(*i.ID)) } if i.IDNEQ != nil { predicates = append(predicates, timestamp.IDNEQ(*i.IDNEQ)) } if len(i.IDIn) > 0 { predicates = append(predicates, timestamp.IDIn(i.IDIn...)) } if len(i.IDNotIn) > 0 { predicates = append(predicates, timestamp.IDNotIn(i.IDNotIn...)) } if i.IDGT != nil { predicates = append(predicates, timestamp.IDGT(*i.IDGT)) } if i.IDGTE != nil { predicates = append(predicates, timestamp.IDGTE(*i.IDGTE)) } if i.IDLT != nil { predicates = append(predicates, timestamp.IDLT(*i.IDLT)) } if i.IDLTE != nil { predicates = append(predicates, timestamp.IDLTE(*i.IDLTE)) } if i.Type != nil { predicates = append(predicates, timestamp.TypeEQ(*i.Type)) } if i.TypeNEQ != nil { predicates = append(predicates, timestamp.TypeNEQ(*i.TypeNEQ)) } if len(i.TypeIn) > 0 { predicates = append(predicates, timestamp.TypeIn(i.TypeIn...)) } if len(i.TypeNotIn) > 0 { predicates = append(predicates, timestamp.TypeNotIn(i.TypeNotIn...)) } if i.TypeGT != nil { predicates = append(predicates, timestamp.TypeGT(*i.TypeGT)) } if i.TypeGTE != nil { predicates = append(predicates, timestamp.TypeGTE(*i.TypeGTE)) } if i.TypeLT != nil { predicates = append(predicates, timestamp.TypeLT(*i.TypeLT)) } if i.TypeLTE != nil { predicates = append(predicates, timestamp.TypeLTE(*i.TypeLTE)) } if i.TypeContains != nil { predicates = append(predicates, timestamp.TypeContains(*i.TypeContains)) } if i.TypeHasPrefix != nil { predicates = append(predicates, timestamp.TypeHasPrefix(*i.TypeHasPrefix)) } if i.TypeHasSuffix != nil { predicates = append(predicates, timestamp.TypeHasSuffix(*i.TypeHasSuffix)) } if i.TypeEqualFold != nil { predicates = append(predicates, timestamp.TypeEqualFold(*i.TypeEqualFold)) } if i.TypeContainsFold != nil { predicates = append(predicates, timestamp.TypeContainsFold(*i.TypeContainsFold)) } if i.Timestamp != nil { predicates = append(predicates, timestamp.TimestampEQ(*i.Timestamp)) } if i.TimestampNEQ != nil { predicates = append(predicates, timestamp.TimestampNEQ(*i.TimestampNEQ)) } if len(i.TimestampIn) > 0 { predicates = append(predicates, timestamp.TimestampIn(i.TimestampIn...)) } if len(i.TimestampNotIn) > 0 { predicates = append(predicates, timestamp.TimestampNotIn(i.TimestampNotIn...)) } if i.TimestampGT != nil { predicates = append(predicates, timestamp.TimestampGT(*i.TimestampGT)) } if i.TimestampGTE != nil { predicates = append(predicates, timestamp.TimestampGTE(*i.TimestampGTE)) } if i.TimestampLT != nil { predicates = append(predicates, timestamp.TimestampLT(*i.TimestampLT)) } if i.TimestampLTE != nil { predicates = append(predicates, timestamp.TimestampLTE(*i.TimestampLTE)) } if i.HasSignature != nil { p := timestamp.HasSignature() if !*i.HasSignature { p = timestamp.Not(p) } predicates = append(predicates, p) } if len(i.HasSignatureWith) > 0 { with := make([]predicate.Signature, 0, len(i.HasSignatureWith)) for _, w := range i.HasSignatureWith { p, err := w.P() if err != nil { return nil, fmt.Errorf("%w: field 'HasSignatureWith'", err) } with = append(with, p) } predicates = append(predicates, timestamp.HasSignatureWith(with...)) } switch len(predicates) { case 0: return nil, ErrEmptyTimestampWhereInput case 1: return predicates[0], nil default: return timestamp.And(predicates...), nil } } golang-github-in-toto-archivista-0.11.1/ent/hook/000077500000000000000000000000001511066247200215755ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/hook/hook.go000066400000000000000000000224241511066247200230700ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package hook import ( "context" "fmt" "github.com/in-toto/archivista/ent" ) // The AttestationFunc type is an adapter to allow the use of ordinary // function as Attestation mutator. type AttestationFunc func(context.Context, *ent.AttestationMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f AttestationFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.AttestationMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AttestationMutation", m) } // The AttestationCollectionFunc type is an adapter to allow the use of ordinary // function as AttestationCollection mutator. type AttestationCollectionFunc func(context.Context, *ent.AttestationCollectionMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f AttestationCollectionFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.AttestationCollectionMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AttestationCollectionMutation", m) } // The AttestationPolicyFunc type is an adapter to allow the use of ordinary // function as AttestationPolicy mutator. type AttestationPolicyFunc func(context.Context, *ent.AttestationPolicyMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f AttestationPolicyFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.AttestationPolicyMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AttestationPolicyMutation", m) } // The DsseFunc type is an adapter to allow the use of ordinary // function as Dsse mutator. type DsseFunc func(context.Context, *ent.DsseMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f DsseFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.DsseMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DsseMutation", m) } // The PayloadDigestFunc type is an adapter to allow the use of ordinary // function as PayloadDigest mutator. type PayloadDigestFunc func(context.Context, *ent.PayloadDigestMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f PayloadDigestFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.PayloadDigestMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PayloadDigestMutation", m) } // The SignatureFunc type is an adapter to allow the use of ordinary // function as Signature mutator. type SignatureFunc func(context.Context, *ent.SignatureMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f SignatureFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.SignatureMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.SignatureMutation", m) } // The StatementFunc type is an adapter to allow the use of ordinary // function as Statement mutator. type StatementFunc func(context.Context, *ent.StatementMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f StatementFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.StatementMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.StatementMutation", m) } // The SubjectFunc type is an adapter to allow the use of ordinary // function as Subject mutator. type SubjectFunc func(context.Context, *ent.SubjectMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f SubjectFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.SubjectMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.SubjectMutation", m) } // The SubjectDigestFunc type is an adapter to allow the use of ordinary // function as SubjectDigest mutator. type SubjectDigestFunc func(context.Context, *ent.SubjectDigestMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f SubjectDigestFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.SubjectDigestMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.SubjectDigestMutation", m) } // The TimestampFunc type is an adapter to allow the use of ordinary // function as Timestamp mutator. type TimestampFunc func(context.Context, *ent.TimestampMutation) (ent.Value, error) // Mutate calls f(ctx, m). func (f TimestampFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { if mv, ok := m.(*ent.TimestampMutation); ok { return f(ctx, mv) } return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.TimestampMutation", m) } // 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...) } golang-github-in-toto-archivista-0.11.1/ent/migrate/000077500000000000000000000000001511066247200222655ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/migrate/migrate.go000066400000000000000000000044741511066247200242550ustar00rootroot00000000000000// Code generated by ent, 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 // 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 } // 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 { return Create(ctx, s, Tables, opts...) } // Create creates all table resources using the given schema driver. func Create(ctx context.Context, s *Schema, tables []*schema.Table, 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 { return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...) } golang-github-in-toto-archivista-0.11.1/ent/migrate/migrations/000077500000000000000000000000001511066247200244415ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/migrate/migrations/mysql/000077500000000000000000000000001511066247200256065ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/migrate/migrations/mysql/20240524112613_mysql.sql000066400000000000000000000111521511066247200311340ustar00rootroot00000000000000-- Create "statements" table CREATE TABLE `statements` (`id` char(36) NOT NULL, `predicate` varchar(255) NOT NULL, PRIMARY KEY (`id`), INDEX `statement_predicate` (`predicate`)) CHARSET utf8mb4 COLLATE utf8mb4_bin; -- Create "attestation_collections" table CREATE TABLE `attestation_collections` (`id` char(36) NOT NULL, `name` varchar(255) NOT NULL, `statement_attestation_collections` char(36) NOT NULL, PRIMARY KEY (`id`), INDEX `attestationcollection_name` (`name`), UNIQUE INDEX `statement_attestation_collections` (`statement_attestation_collections`), CONSTRAINT `attestation_collections_statements_attestation_collections` FOREIGN KEY (`statement_attestation_collections`) REFERENCES `statements` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION) CHARSET utf8mb4 COLLATE utf8mb4_bin; -- Create "attestation_policies" table CREATE TABLE `attestation_policies` (`id` char(36) NOT NULL, `name` varchar(255) NOT NULL, `statement_policy` char(36) NULL, PRIMARY KEY (`id`), INDEX `attestationpolicy_name` (`name`), UNIQUE INDEX `statement_policy` (`statement_policy`), CONSTRAINT `attestation_policies_statements_policy` FOREIGN KEY (`statement_policy`) REFERENCES `statements` (`id`) ON UPDATE NO ACTION ON DELETE SET NULL) CHARSET utf8mb4 COLLATE utf8mb4_bin; -- Create "attestations" table CREATE TABLE `attestations` (`id` char(36) NOT NULL, `type` varchar(255) NOT NULL, `attestation_collection_attestations` char(36) NOT NULL, PRIMARY KEY (`id`), INDEX `attestation_type` (`type`), INDEX `attestations_attestation_collections_attestations` (`attestation_collection_attestations`), CONSTRAINT `attestations_attestation_collections_attestations` FOREIGN KEY (`attestation_collection_attestations`) REFERENCES `attestation_collections` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION) CHARSET utf8mb4 COLLATE utf8mb4_bin; -- Create "dsses" table CREATE TABLE `dsses` (`id` char(36) NOT NULL, `gitoid_sha256` varchar(255) NOT NULL, `payload_type` varchar(255) NOT NULL, `dsse_statement` char(36) NULL, PRIMARY KEY (`id`), INDEX `dsses_statements_statement` (`dsse_statement`), UNIQUE INDEX `gitoid_sha256` (`gitoid_sha256`), CONSTRAINT `dsses_statements_statement` FOREIGN KEY (`dsse_statement`) REFERENCES `statements` (`id`) ON UPDATE NO ACTION ON DELETE SET NULL) CHARSET utf8mb4 COLLATE utf8mb4_bin; -- Create "payload_digests" table CREATE TABLE `payload_digests` (`id` char(36) NOT NULL, `algorithm` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, `dsse_payload_digests` char(36) NULL, PRIMARY KEY (`id`), INDEX `payload_digests_dsses_payload_digests` (`dsse_payload_digests`), INDEX `payloaddigest_value` (`value`), CONSTRAINT `payload_digests_dsses_payload_digests` FOREIGN KEY (`dsse_payload_digests`) REFERENCES `dsses` (`id`) ON UPDATE NO ACTION ON DELETE SET NULL) CHARSET utf8mb4 COLLATE utf8mb4_bin; -- Create "signatures" table CREATE TABLE `signatures` (`id` char(36) NOT NULL, `key_id` varchar(255) NOT NULL, `signature` text NOT NULL, `dsse_signatures` char(36) NULL, PRIMARY KEY (`id`), INDEX `signature_key_id` (`key_id`), INDEX `signatures_dsses_signatures` (`dsse_signatures`), CONSTRAINT `signatures_dsses_signatures` FOREIGN KEY (`dsse_signatures`) REFERENCES `dsses` (`id`) ON UPDATE NO ACTION ON DELETE SET NULL) CHARSET utf8mb4 COLLATE utf8mb4_bin; -- Create "subjects" table CREATE TABLE `subjects` (`id` char(36) NOT NULL, `name` varchar(255) NOT NULL, `statement_subjects` char(36) NULL, PRIMARY KEY (`id`), INDEX `subject_name` (`name`), INDEX `subjects_statements_subjects` (`statement_subjects`), CONSTRAINT `subjects_statements_subjects` FOREIGN KEY (`statement_subjects`) REFERENCES `statements` (`id`) ON UPDATE NO ACTION ON DELETE SET NULL) CHARSET utf8mb4 COLLATE utf8mb4_bin; -- Create "subject_digests" table CREATE TABLE `subject_digests` (`id` char(36) NOT NULL, `algorithm` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, `subject_subject_digests` char(36) NULL, PRIMARY KEY (`id`), INDEX `subject_digests_subjects_subject_digests` (`subject_subject_digests`), INDEX `subjectdigest_value` (`value`), CONSTRAINT `subject_digests_subjects_subject_digests` FOREIGN KEY (`subject_subject_digests`) REFERENCES `subjects` (`id`) ON UPDATE NO ACTION ON DELETE SET NULL) CHARSET utf8mb4 COLLATE utf8mb4_bin; -- Create "timestamps" table CREATE TABLE `timestamps` (`id` char(36) NOT NULL, `type` varchar(255) NOT NULL, `timestamp` timestamp NOT NULL, `signature_timestamps` char(36) NULL, PRIMARY KEY (`id`), INDEX `timestamps_signatures_timestamps` (`signature_timestamps`), CONSTRAINT `timestamps_signatures_timestamps` FOREIGN KEY (`signature_timestamps`) REFERENCES `signatures` (`id`) ON UPDATE NO ACTION ON DELETE SET NULL) CHARSET utf8mb4 COLLATE utf8mb4_bin; golang-github-in-toto-archivista-0.11.1/ent/migrate/migrations/mysql/20250808191739_mysql.sql000066400000000000000000000002561511066247200311650ustar00rootroot00000000000000-- Modify "dsses" table ALTER TABLE `dsses` ADD COLUMN `created_at` timestamp NULL; -- Modify "subjects" table ALTER TABLE `subjects` ADD COLUMN `created_at` timestamp NULL; golang-github-in-toto-archivista-0.11.1/ent/migrate/migrations/mysql/atlas.sum000066400000000000000000000003021511066247200274330ustar00rootroot00000000000000h1:O6S3E1WYf4e0DRuiVtMC+rriO4EsQy5UAIO/mRkozCI= 20240524112613_mysql.sql h1:P16hl/ui8F+xn7opuJT+GCQ8vnJEsQkZp8Q9PMOhrRI= 20250808191739_mysql.sql h1:AmhCFWr+PxS2lIdA1cc4lgjx4Fspi/sgnPuuItj/o5g= golang-github-in-toto-archivista-0.11.1/ent/migrate/migrations/pgsql/000077500000000000000000000000001511066247200255675ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/migrate/migrations/pgsql/20240524112615_pgsql.sql000066400000000000000000000116371511066247200311100ustar00rootroot00000000000000-- Create "statements" table CREATE TABLE "statements" ("id" uuid NOT NULL, "predicate" character varying NOT NULL, PRIMARY KEY ("id")); -- Create index "statement_predicate" to table: "statements" CREATE INDEX "statement_predicate" ON "statements" ("predicate"); -- Create "attestation_collections" table CREATE TABLE "attestation_collections" ("id" uuid NOT NULL, "name" character varying NOT NULL, "statement_attestation_collections" uuid NOT NULL, PRIMARY KEY ("id"), CONSTRAINT "attestation_collections_statements_attestation_collections" FOREIGN KEY ("statement_attestation_collections") REFERENCES "statements" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION); -- Create index "attestation_collections_statement_attestation_collections_key" to table: "attestation_collections" CREATE UNIQUE INDEX "attestation_collections_statement_attestation_collections_key" ON "attestation_collections" ("statement_attestation_collections"); -- Create index "attestationcollection_name" to table: "attestation_collections" CREATE INDEX "attestationcollection_name" ON "attestation_collections" ("name"); -- Create "attestation_policies" table CREATE TABLE "attestation_policies" ("id" uuid NOT NULL, "name" character varying NOT NULL, "statement_policy" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "attestation_policies_statements_policy" FOREIGN KEY ("statement_policy") REFERENCES "statements" ("id") ON UPDATE NO ACTION ON DELETE SET NULL); -- Create index "attestation_policies_statement_policy_key" to table: "attestation_policies" CREATE UNIQUE INDEX "attestation_policies_statement_policy_key" ON "attestation_policies" ("statement_policy"); -- Create index "attestationpolicy_name" to table: "attestation_policies" CREATE INDEX "attestationpolicy_name" ON "attestation_policies" ("name"); -- Create "attestations" table CREATE TABLE "attestations" ("id" uuid NOT NULL, "type" character varying NOT NULL, "attestation_collection_attestations" uuid NOT NULL, PRIMARY KEY ("id"), CONSTRAINT "attestations_attestation_collections_attestations" FOREIGN KEY ("attestation_collection_attestations") REFERENCES "attestation_collections" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION); -- Create index "attestation_type" to table: "attestations" CREATE INDEX "attestation_type" ON "attestations" ("type"); -- Create "dsses" table CREATE TABLE "dsses" ("id" uuid NOT NULL, "gitoid_sha256" character varying NOT NULL, "payload_type" character varying NOT NULL, "dsse_statement" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "dsses_statements_statement" FOREIGN KEY ("dsse_statement") REFERENCES "statements" ("id") ON UPDATE NO ACTION ON DELETE SET NULL); -- Create index "dsses_gitoid_sha256_key" to table: "dsses" CREATE UNIQUE INDEX "dsses_gitoid_sha256_key" ON "dsses" ("gitoid_sha256"); -- Create "payload_digests" table CREATE TABLE "payload_digests" ("id" uuid NOT NULL, "algorithm" character varying NOT NULL, "value" character varying NOT NULL, "dsse_payload_digests" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "payload_digests_dsses_payload_digests" FOREIGN KEY ("dsse_payload_digests") REFERENCES "dsses" ("id") ON UPDATE NO ACTION ON DELETE SET NULL); -- Create index "payloaddigest_value" to table: "payload_digests" CREATE INDEX "payloaddigest_value" ON "payload_digests" ("value"); -- Create "signatures" table CREATE TABLE "signatures" ("id" uuid NOT NULL, "key_id" character varying NOT NULL, "signature" character varying NOT NULL, "dsse_signatures" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "signatures_dsses_signatures" FOREIGN KEY ("dsse_signatures") REFERENCES "dsses" ("id") ON UPDATE NO ACTION ON DELETE SET NULL); -- Create index "signature_key_id" to table: "signatures" CREATE INDEX "signature_key_id" ON "signatures" ("key_id"); -- Create "subjects" table CREATE TABLE "subjects" ("id" uuid NOT NULL, "name" character varying NOT NULL, "statement_subjects" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "subjects_statements_subjects" FOREIGN KEY ("statement_subjects") REFERENCES "statements" ("id") ON UPDATE NO ACTION ON DELETE SET NULL); -- Create index "subject_name" to table: "subjects" CREATE INDEX "subject_name" ON "subjects" ("name"); -- Create "subject_digests" table CREATE TABLE "subject_digests" ("id" uuid NOT NULL, "algorithm" character varying NOT NULL, "value" character varying NOT NULL, "subject_subject_digests" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "subject_digests_subjects_subject_digests" FOREIGN KEY ("subject_subject_digests") REFERENCES "subjects" ("id") ON UPDATE NO ACTION ON DELETE SET NULL); -- Create index "subjectdigest_value" to table: "subject_digests" CREATE INDEX "subjectdigest_value" ON "subject_digests" ("value"); -- Create "timestamps" table CREATE TABLE "timestamps" ("id" uuid NOT NULL, "type" character varying NOT NULL, "timestamp" timestamptz NOT NULL, "signature_timestamps" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "timestamps_signatures_timestamps" FOREIGN KEY ("signature_timestamps") REFERENCES "signatures" ("id") ON UPDATE NO ACTION ON DELETE SET NULL); golang-github-in-toto-archivista-0.11.1/ent/migrate/migrations/pgsql/20250808191741_pgsql.sql000066400000000000000000000002621511066247200311150ustar00rootroot00000000000000-- Modify "dsses" table ALTER TABLE "dsses" ADD COLUMN "created_at" timestamptz NULL; -- Modify "subjects" table ALTER TABLE "subjects" ADD COLUMN "created_at" timestamptz NULL; golang-github-in-toto-archivista-0.11.1/ent/migrate/migrations/pgsql/atlas.sum000066400000000000000000000003021511066247200274140ustar00rootroot00000000000000h1:gbJ0ewlYG8EOT7Qs60syCuqj2RppBTDBCSo47KN5CN8= 20240524112615_pgsql.sql h1:HMRY5DPVr3SjgjpdkCY3+3Us5y5LvtSzNEBwoIND5sY= 20250808191741_pgsql.sql h1:g6V+TT8sGHon7iwgJTb5QCjopE3/oKbPA54jMIkRDlk= golang-github-in-toto-archivista-0.11.1/ent/migrate/schema.go000066400000000000000000000237601511066247200240640ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package migrate import ( "entgo.io/ent/dialect/sql/schema" "entgo.io/ent/schema/field" ) var ( // AttestationsColumns holds the columns for the "attestations" table. AttestationsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "type", Type: field.TypeString}, {Name: "attestation_collection_attestations", Type: field.TypeUUID}, } // AttestationsTable holds the schema information for the "attestations" table. AttestationsTable = &schema.Table{ Name: "attestations", Columns: AttestationsColumns, PrimaryKey: []*schema.Column{AttestationsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "attestations_attestation_collections_attestations", Columns: []*schema.Column{AttestationsColumns[2]}, RefColumns: []*schema.Column{AttestationCollectionsColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "attestation_type", Unique: false, Columns: []*schema.Column{AttestationsColumns[1]}, }, }, } // AttestationCollectionsColumns holds the columns for the "attestation_collections" table. AttestationCollectionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "name", Type: field.TypeString}, {Name: "statement_attestation_collections", Type: field.TypeUUID, Unique: true}, } // AttestationCollectionsTable holds the schema information for the "attestation_collections" table. AttestationCollectionsTable = &schema.Table{ Name: "attestation_collections", Columns: AttestationCollectionsColumns, PrimaryKey: []*schema.Column{AttestationCollectionsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "attestation_collections_statements_attestation_collections", Columns: []*schema.Column{AttestationCollectionsColumns[2]}, RefColumns: []*schema.Column{StatementsColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "attestationcollection_name", Unique: false, Columns: []*schema.Column{AttestationCollectionsColumns[1]}, }, }, } // AttestationPoliciesColumns holds the columns for the "attestation_policies" table. AttestationPoliciesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "name", Type: field.TypeString}, {Name: "statement_policy", Type: field.TypeUUID, Unique: true, Nullable: true}, } // AttestationPoliciesTable holds the schema information for the "attestation_policies" table. AttestationPoliciesTable = &schema.Table{ Name: "attestation_policies", Columns: AttestationPoliciesColumns, PrimaryKey: []*schema.Column{AttestationPoliciesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "attestation_policies_statements_policy", Columns: []*schema.Column{AttestationPoliciesColumns[2]}, RefColumns: []*schema.Column{StatementsColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "attestationpolicy_name", Unique: false, Columns: []*schema.Column{AttestationPoliciesColumns[1]}, }, }, } // DssesColumns holds the columns for the "dsses" table. DssesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "gitoid_sha256", Type: field.TypeString, Unique: true}, {Name: "payload_type", Type: field.TypeString}, {Name: "dsse_statement", Type: field.TypeUUID, Nullable: true}, } // DssesTable holds the schema information for the "dsses" table. DssesTable = &schema.Table{ Name: "dsses", Columns: DssesColumns, PrimaryKey: []*schema.Column{DssesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "dsses_statements_statement", Columns: []*schema.Column{DssesColumns[4]}, RefColumns: []*schema.Column{StatementsColumns[0]}, OnDelete: schema.SetNull, }, }, } // PayloadDigestsColumns holds the columns for the "payload_digests" table. PayloadDigestsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "algorithm", Type: field.TypeString}, {Name: "value", Type: field.TypeString}, {Name: "dsse_payload_digests", Type: field.TypeUUID, Nullable: true}, } // PayloadDigestsTable holds the schema information for the "payload_digests" table. PayloadDigestsTable = &schema.Table{ Name: "payload_digests", Columns: PayloadDigestsColumns, PrimaryKey: []*schema.Column{PayloadDigestsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "payload_digests_dsses_payload_digests", Columns: []*schema.Column{PayloadDigestsColumns[3]}, RefColumns: []*schema.Column{DssesColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "payloaddigest_value", Unique: false, Columns: []*schema.Column{PayloadDigestsColumns[2]}, }, }, } // SignaturesColumns holds the columns for the "signatures" table. SignaturesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "key_id", Type: field.TypeString}, {Name: "signature", Type: field.TypeString, SchemaType: map[string]string{"mysql": "text"}}, {Name: "dsse_signatures", Type: field.TypeUUID, Nullable: true}, } // SignaturesTable holds the schema information for the "signatures" table. SignaturesTable = &schema.Table{ Name: "signatures", Columns: SignaturesColumns, PrimaryKey: []*schema.Column{SignaturesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "signatures_dsses_signatures", Columns: []*schema.Column{SignaturesColumns[3]}, RefColumns: []*schema.Column{DssesColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "signature_key_id", Unique: false, Columns: []*schema.Column{SignaturesColumns[1]}, }, }, } // StatementsColumns holds the columns for the "statements" table. StatementsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "predicate", Type: field.TypeString}, } // StatementsTable holds the schema information for the "statements" table. StatementsTable = &schema.Table{ Name: "statements", Columns: StatementsColumns, PrimaryKey: []*schema.Column{StatementsColumns[0]}, Indexes: []*schema.Index{ { Name: "statement_predicate", Unique: false, Columns: []*schema.Column{StatementsColumns[1]}, }, }, } // SubjectsColumns holds the columns for the "subjects" table. SubjectsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "statement_subjects", Type: field.TypeUUID, Nullable: true}, } // SubjectsTable holds the schema information for the "subjects" table. SubjectsTable = &schema.Table{ Name: "subjects", Columns: SubjectsColumns, PrimaryKey: []*schema.Column{SubjectsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "subjects_statements_subjects", Columns: []*schema.Column{SubjectsColumns[3]}, RefColumns: []*schema.Column{StatementsColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "subject_name", Unique: false, Columns: []*schema.Column{SubjectsColumns[2]}, }, }, } // SubjectDigestsColumns holds the columns for the "subject_digests" table. SubjectDigestsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "algorithm", Type: field.TypeString}, {Name: "value", Type: field.TypeString}, {Name: "subject_subject_digests", Type: field.TypeUUID, Nullable: true}, } // SubjectDigestsTable holds the schema information for the "subject_digests" table. SubjectDigestsTable = &schema.Table{ Name: "subject_digests", Columns: SubjectDigestsColumns, PrimaryKey: []*schema.Column{SubjectDigestsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "subject_digests_subjects_subject_digests", Columns: []*schema.Column{SubjectDigestsColumns[3]}, RefColumns: []*schema.Column{SubjectsColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "subjectdigest_value", Unique: false, Columns: []*schema.Column{SubjectDigestsColumns[2]}, }, }, } // TimestampsColumns holds the columns for the "timestamps" table. TimestampsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "type", Type: field.TypeString}, {Name: "timestamp", Type: field.TypeTime}, {Name: "signature_timestamps", Type: field.TypeUUID, Nullable: true}, } // TimestampsTable holds the schema information for the "timestamps" table. TimestampsTable = &schema.Table{ Name: "timestamps", Columns: TimestampsColumns, PrimaryKey: []*schema.Column{TimestampsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "timestamps_signatures_timestamps", Columns: []*schema.Column{TimestampsColumns[3]}, RefColumns: []*schema.Column{SignaturesColumns[0]}, OnDelete: schema.SetNull, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ AttestationsTable, AttestationCollectionsTable, AttestationPoliciesTable, DssesTable, PayloadDigestsTable, SignaturesTable, StatementsTable, SubjectsTable, SubjectDigestsTable, TimestampsTable, } ) func init() { AttestationsTable.ForeignKeys[0].RefTable = AttestationCollectionsTable AttestationCollectionsTable.ForeignKeys[0].RefTable = StatementsTable AttestationPoliciesTable.ForeignKeys[0].RefTable = StatementsTable DssesTable.ForeignKeys[0].RefTable = StatementsTable PayloadDigestsTable.ForeignKeys[0].RefTable = DssesTable SignaturesTable.ForeignKeys[0].RefTable = DssesTable SubjectsTable.ForeignKeys[0].RefTable = StatementsTable SubjectDigestsTable.ForeignKeys[0].RefTable = SubjectsTable TimestampsTable.ForeignKeys[0].RefTable = SignaturesTable } golang-github-in-toto-archivista-0.11.1/ent/mutation.go000066400000000000000000004654061511066247200230430ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "sync" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" "github.com/in-toto/archivista/ent/timestamp" ) const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeAttestation = "Attestation" TypeAttestationCollection = "AttestationCollection" TypeAttestationPolicy = "AttestationPolicy" TypeDsse = "Dsse" TypePayloadDigest = "PayloadDigest" TypeSignature = "Signature" TypeStatement = "Statement" TypeSubject = "Subject" TypeSubjectDigest = "SubjectDigest" TypeTimestamp = "Timestamp" ) // AttestationMutation represents an operation that mutates the Attestation nodes in the graph. type AttestationMutation struct { config op Op typ string id *uuid.UUID _type *string clearedFields map[string]struct{} attestation_collection *uuid.UUID clearedattestation_collection bool done bool oldValue func(context.Context) (*Attestation, error) predicates []predicate.Attestation } var _ ent.Mutation = (*AttestationMutation)(nil) // attestationOption allows management of the mutation configuration using functional options. type attestationOption func(*AttestationMutation) // newAttestationMutation creates new mutation for the Attestation entity. func newAttestationMutation(c config, op Op, opts ...attestationOption) *AttestationMutation { m := &AttestationMutation{ config: c, op: op, typ: TypeAttestation, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withAttestationID sets the ID field of the mutation. func withAttestationID(id uuid.UUID) attestationOption { return func(m *AttestationMutation) { var ( err error once sync.Once value *Attestation ) m.oldValue = func(ctx context.Context) (*Attestation, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Attestation.Get(ctx, id) } }) return value, err } m.id = &id } } // withAttestation sets the old Attestation of the mutation. func withAttestation(node *Attestation) attestationOption { return func(m *AttestationMutation) { m.oldValue = func(context.Context) (*Attestation, 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 AttestationMutation) 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 AttestationMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 Attestation entities. func (m *AttestationMutation) SetID(id uuid.UUID) { 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 *AttestationMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *AttestationMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().Attestation.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetType sets the "type" field. func (m *AttestationMutation) SetType(s string) { m._type = &s } // GetType returns the value of the "type" field in the mutation. func (m *AttestationMutation) 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 Attestation entity. // If the Attestation 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 *AttestationMutation) OldType(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldType is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("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 *AttestationMutation) ResetType() { m._type = nil } // SetAttestationCollectionID sets the "attestation_collection" edge to the AttestationCollection entity by id. func (m *AttestationMutation) SetAttestationCollectionID(id uuid.UUID) { m.attestation_collection = &id } // ClearAttestationCollection clears the "attestation_collection" edge to the AttestationCollection entity. func (m *AttestationMutation) ClearAttestationCollection() { m.clearedattestation_collection = true } // AttestationCollectionCleared reports if the "attestation_collection" edge to the AttestationCollection entity was cleared. func (m *AttestationMutation) AttestationCollectionCleared() bool { return m.clearedattestation_collection } // AttestationCollectionID returns the "attestation_collection" edge ID in the mutation. func (m *AttestationMutation) AttestationCollectionID() (id uuid.UUID, exists bool) { if m.attestation_collection != nil { return *m.attestation_collection, true } return } // AttestationCollectionIDs returns the "attestation_collection" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // AttestationCollectionID instead. It exists only for internal usage by the builders. func (m *AttestationMutation) AttestationCollectionIDs() (ids []uuid.UUID) { if id := m.attestation_collection; id != nil { ids = append(ids, *id) } return } // ResetAttestationCollection resets all changes to the "attestation_collection" edge. func (m *AttestationMutation) ResetAttestationCollection() { m.attestation_collection = nil m.clearedattestation_collection = false } // Where appends a list predicates to the AttestationMutation builder. func (m *AttestationMutation) Where(ps ...predicate.Attestation) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the AttestationMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *AttestationMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.Attestation, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *AttestationMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *AttestationMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (Attestation). func (m *AttestationMutation) 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 *AttestationMutation) Fields() []string { fields := make([]string, 0, 1) if m._type != nil { fields = append(fields, attestation.FieldType) } 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 *AttestationMutation) Field(name string) (ent.Value, bool) { switch name { case attestation.FieldType: return m.GetType() } 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 *AttestationMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case attestation.FieldType: return m.OldType(ctx) } return nil, fmt.Errorf("unknown Attestation 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 *AttestationMutation) SetField(name string, value ent.Value) error { switch name { case attestation.FieldType: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetType(v) return nil } return fmt.Errorf("unknown Attestation field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *AttestationMutation) 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 *AttestationMutation) 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 *AttestationMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown Attestation numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *AttestationMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *AttestationMutation) 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 *AttestationMutation) ClearField(name string) error { return fmt.Errorf("unknown Attestation 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 *AttestationMutation) ResetField(name string) error { switch name { case attestation.FieldType: m.ResetType() return nil } return fmt.Errorf("unknown Attestation field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *AttestationMutation) AddedEdges() []string { edges := make([]string, 0, 1) if m.attestation_collection != nil { edges = append(edges, attestation.EdgeAttestationCollection) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *AttestationMutation) AddedIDs(name string) []ent.Value { switch name { case attestation.EdgeAttestationCollection: if id := m.attestation_collection; id != nil { return []ent.Value{*id} } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *AttestationMutation) 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 *AttestationMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *AttestationMutation) ClearedEdges() []string { edges := make([]string, 0, 1) if m.clearedattestation_collection { edges = append(edges, attestation.EdgeAttestationCollection) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *AttestationMutation) EdgeCleared(name string) bool { switch name { case attestation.EdgeAttestationCollection: return m.clearedattestation_collection } 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 *AttestationMutation) ClearEdge(name string) error { switch name { case attestation.EdgeAttestationCollection: m.ClearAttestationCollection() return nil } return fmt.Errorf("unknown Attestation 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 *AttestationMutation) ResetEdge(name string) error { switch name { case attestation.EdgeAttestationCollection: m.ResetAttestationCollection() return nil } return fmt.Errorf("unknown Attestation edge %s", name) } // AttestationCollectionMutation represents an operation that mutates the AttestationCollection nodes in the graph. type AttestationCollectionMutation struct { config op Op typ string id *uuid.UUID name *string clearedFields map[string]struct{} attestations map[uuid.UUID]struct{} removedattestations map[uuid.UUID]struct{} clearedattestations bool statement *uuid.UUID clearedstatement bool done bool oldValue func(context.Context) (*AttestationCollection, error) predicates []predicate.AttestationCollection } var _ ent.Mutation = (*AttestationCollectionMutation)(nil) // attestationcollectionOption allows management of the mutation configuration using functional options. type attestationcollectionOption func(*AttestationCollectionMutation) // newAttestationCollectionMutation creates new mutation for the AttestationCollection entity. func newAttestationCollectionMutation(c config, op Op, opts ...attestationcollectionOption) *AttestationCollectionMutation { m := &AttestationCollectionMutation{ config: c, op: op, typ: TypeAttestationCollection, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withAttestationCollectionID sets the ID field of the mutation. func withAttestationCollectionID(id uuid.UUID) attestationcollectionOption { return func(m *AttestationCollectionMutation) { var ( err error once sync.Once value *AttestationCollection ) m.oldValue = func(ctx context.Context) (*AttestationCollection, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().AttestationCollection.Get(ctx, id) } }) return value, err } m.id = &id } } // withAttestationCollection sets the old AttestationCollection of the mutation. func withAttestationCollection(node *AttestationCollection) attestationcollectionOption { return func(m *AttestationCollectionMutation) { m.oldValue = func(context.Context) (*AttestationCollection, 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 AttestationCollectionMutation) 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 AttestationCollectionMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 AttestationCollection entities. func (m *AttestationCollectionMutation) SetID(id uuid.UUID) { 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 *AttestationCollectionMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *AttestationCollectionMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().AttestationCollection.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetName sets the "name" field. func (m *AttestationCollectionMutation) SetName(s string) { m.name = &s } // Name returns the value of the "name" field in the mutation. func (m *AttestationCollectionMutation) 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 AttestationCollection entity. // If the AttestationCollection 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 *AttestationCollectionMutation) OldName(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldName is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("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 *AttestationCollectionMutation) ResetName() { m.name = nil } // AddAttestationIDs adds the "attestations" edge to the Attestation entity by ids. func (m *AttestationCollectionMutation) AddAttestationIDs(ids ...uuid.UUID) { if m.attestations == nil { m.attestations = make(map[uuid.UUID]struct{}) } for i := range ids { m.attestations[ids[i]] = struct{}{} } } // ClearAttestations clears the "attestations" edge to the Attestation entity. func (m *AttestationCollectionMutation) ClearAttestations() { m.clearedattestations = true } // AttestationsCleared reports if the "attestations" edge to the Attestation entity was cleared. func (m *AttestationCollectionMutation) AttestationsCleared() bool { return m.clearedattestations } // RemoveAttestationIDs removes the "attestations" edge to the Attestation entity by IDs. func (m *AttestationCollectionMutation) RemoveAttestationIDs(ids ...uuid.UUID) { if m.removedattestations == nil { m.removedattestations = make(map[uuid.UUID]struct{}) } for i := range ids { delete(m.attestations, ids[i]) m.removedattestations[ids[i]] = struct{}{} } } // RemovedAttestations returns the removed IDs of the "attestations" edge to the Attestation entity. func (m *AttestationCollectionMutation) RemovedAttestationsIDs() (ids []uuid.UUID) { for id := range m.removedattestations { ids = append(ids, id) } return } // AttestationsIDs returns the "attestations" edge IDs in the mutation. func (m *AttestationCollectionMutation) AttestationsIDs() (ids []uuid.UUID) { for id := range m.attestations { ids = append(ids, id) } return } // ResetAttestations resets all changes to the "attestations" edge. func (m *AttestationCollectionMutation) ResetAttestations() { m.attestations = nil m.clearedattestations = false m.removedattestations = nil } // SetStatementID sets the "statement" edge to the Statement entity by id. func (m *AttestationCollectionMutation) SetStatementID(id uuid.UUID) { m.statement = &id } // ClearStatement clears the "statement" edge to the Statement entity. func (m *AttestationCollectionMutation) ClearStatement() { m.clearedstatement = true } // StatementCleared reports if the "statement" edge to the Statement entity was cleared. func (m *AttestationCollectionMutation) StatementCleared() bool { return m.clearedstatement } // StatementID returns the "statement" edge ID in the mutation. func (m *AttestationCollectionMutation) StatementID() (id uuid.UUID, exists bool) { if m.statement != nil { return *m.statement, true } return } // StatementIDs returns the "statement" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // StatementID instead. It exists only for internal usage by the builders. func (m *AttestationCollectionMutation) StatementIDs() (ids []uuid.UUID) { if id := m.statement; id != nil { ids = append(ids, *id) } return } // ResetStatement resets all changes to the "statement" edge. func (m *AttestationCollectionMutation) ResetStatement() { m.statement = nil m.clearedstatement = false } // Where appends a list predicates to the AttestationCollectionMutation builder. func (m *AttestationCollectionMutation) Where(ps ...predicate.AttestationCollection) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the AttestationCollectionMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *AttestationCollectionMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.AttestationCollection, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *AttestationCollectionMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *AttestationCollectionMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (AttestationCollection). func (m *AttestationCollectionMutation) 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 *AttestationCollectionMutation) Fields() []string { fields := make([]string, 0, 1) if m.name != nil { fields = append(fields, attestationcollection.FieldName) } 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 *AttestationCollectionMutation) Field(name string) (ent.Value, bool) { switch name { case attestationcollection.FieldName: return m.Name() } 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 *AttestationCollectionMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case attestationcollection.FieldName: return m.OldName(ctx) } return nil, fmt.Errorf("unknown AttestationCollection 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 *AttestationCollectionMutation) SetField(name string, value ent.Value) error { switch name { case attestationcollection.FieldName: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetName(v) return nil } return fmt.Errorf("unknown AttestationCollection field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *AttestationCollectionMutation) 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 *AttestationCollectionMutation) 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 *AttestationCollectionMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown AttestationCollection numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *AttestationCollectionMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *AttestationCollectionMutation) 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 *AttestationCollectionMutation) ClearField(name string) error { return fmt.Errorf("unknown AttestationCollection 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 *AttestationCollectionMutation) ResetField(name string) error { switch name { case attestationcollection.FieldName: m.ResetName() return nil } return fmt.Errorf("unknown AttestationCollection field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *AttestationCollectionMutation) AddedEdges() []string { edges := make([]string, 0, 2) if m.attestations != nil { edges = append(edges, attestationcollection.EdgeAttestations) } if m.statement != nil { edges = append(edges, attestationcollection.EdgeStatement) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *AttestationCollectionMutation) AddedIDs(name string) []ent.Value { switch name { case attestationcollection.EdgeAttestations: ids := make([]ent.Value, 0, len(m.attestations)) for id := range m.attestations { ids = append(ids, id) } return ids case attestationcollection.EdgeStatement: if id := m.statement; id != nil { return []ent.Value{*id} } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *AttestationCollectionMutation) RemovedEdges() []string { edges := make([]string, 0, 2) if m.removedattestations != nil { edges = append(edges, attestationcollection.EdgeAttestations) } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. func (m *AttestationCollectionMutation) RemovedIDs(name string) []ent.Value { switch name { case attestationcollection.EdgeAttestations: ids := make([]ent.Value, 0, len(m.removedattestations)) for id := range m.removedattestations { ids = append(ids, id) } return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *AttestationCollectionMutation) ClearedEdges() []string { edges := make([]string, 0, 2) if m.clearedattestations { edges = append(edges, attestationcollection.EdgeAttestations) } if m.clearedstatement { edges = append(edges, attestationcollection.EdgeStatement) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *AttestationCollectionMutation) EdgeCleared(name string) bool { switch name { case attestationcollection.EdgeAttestations: return m.clearedattestations case attestationcollection.EdgeStatement: return m.clearedstatement } 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 *AttestationCollectionMutation) ClearEdge(name string) error { switch name { case attestationcollection.EdgeStatement: m.ClearStatement() return nil } return fmt.Errorf("unknown AttestationCollection 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 *AttestationCollectionMutation) ResetEdge(name string) error { switch name { case attestationcollection.EdgeAttestations: m.ResetAttestations() return nil case attestationcollection.EdgeStatement: m.ResetStatement() return nil } return fmt.Errorf("unknown AttestationCollection edge %s", name) } // AttestationPolicyMutation represents an operation that mutates the AttestationPolicy nodes in the graph. type AttestationPolicyMutation struct { config op Op typ string id *uuid.UUID name *string clearedFields map[string]struct{} statement *uuid.UUID clearedstatement bool done bool oldValue func(context.Context) (*AttestationPolicy, error) predicates []predicate.AttestationPolicy } var _ ent.Mutation = (*AttestationPolicyMutation)(nil) // attestationpolicyOption allows management of the mutation configuration using functional options. type attestationpolicyOption func(*AttestationPolicyMutation) // newAttestationPolicyMutation creates new mutation for the AttestationPolicy entity. func newAttestationPolicyMutation(c config, op Op, opts ...attestationpolicyOption) *AttestationPolicyMutation { m := &AttestationPolicyMutation{ config: c, op: op, typ: TypeAttestationPolicy, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withAttestationPolicyID sets the ID field of the mutation. func withAttestationPolicyID(id uuid.UUID) attestationpolicyOption { return func(m *AttestationPolicyMutation) { var ( err error once sync.Once value *AttestationPolicy ) m.oldValue = func(ctx context.Context) (*AttestationPolicy, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().AttestationPolicy.Get(ctx, id) } }) return value, err } m.id = &id } } // withAttestationPolicy sets the old AttestationPolicy of the mutation. func withAttestationPolicy(node *AttestationPolicy) attestationpolicyOption { return func(m *AttestationPolicyMutation) { m.oldValue = func(context.Context) (*AttestationPolicy, 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 AttestationPolicyMutation) 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 AttestationPolicyMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 AttestationPolicy entities. func (m *AttestationPolicyMutation) SetID(id uuid.UUID) { 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 *AttestationPolicyMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *AttestationPolicyMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().AttestationPolicy.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetName sets the "name" field. func (m *AttestationPolicyMutation) SetName(s string) { m.name = &s } // Name returns the value of the "name" field in the mutation. func (m *AttestationPolicyMutation) 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 AttestationPolicy entity. // If the AttestationPolicy 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 *AttestationPolicyMutation) OldName(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldName is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("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 *AttestationPolicyMutation) ResetName() { m.name = nil } // SetStatementID sets the "statement" edge to the Statement entity by id. func (m *AttestationPolicyMutation) SetStatementID(id uuid.UUID) { m.statement = &id } // ClearStatement clears the "statement" edge to the Statement entity. func (m *AttestationPolicyMutation) ClearStatement() { m.clearedstatement = true } // StatementCleared reports if the "statement" edge to the Statement entity was cleared. func (m *AttestationPolicyMutation) StatementCleared() bool { return m.clearedstatement } // StatementID returns the "statement" edge ID in the mutation. func (m *AttestationPolicyMutation) StatementID() (id uuid.UUID, exists bool) { if m.statement != nil { return *m.statement, true } return } // StatementIDs returns the "statement" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // StatementID instead. It exists only for internal usage by the builders. func (m *AttestationPolicyMutation) StatementIDs() (ids []uuid.UUID) { if id := m.statement; id != nil { ids = append(ids, *id) } return } // ResetStatement resets all changes to the "statement" edge. func (m *AttestationPolicyMutation) ResetStatement() { m.statement = nil m.clearedstatement = false } // Where appends a list predicates to the AttestationPolicyMutation builder. func (m *AttestationPolicyMutation) Where(ps ...predicate.AttestationPolicy) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the AttestationPolicyMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *AttestationPolicyMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.AttestationPolicy, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *AttestationPolicyMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *AttestationPolicyMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (AttestationPolicy). func (m *AttestationPolicyMutation) 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 *AttestationPolicyMutation) Fields() []string { fields := make([]string, 0, 1) if m.name != nil { fields = append(fields, attestationpolicy.FieldName) } 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 *AttestationPolicyMutation) Field(name string) (ent.Value, bool) { switch name { case attestationpolicy.FieldName: return m.Name() } 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 *AttestationPolicyMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case attestationpolicy.FieldName: return m.OldName(ctx) } return nil, fmt.Errorf("unknown AttestationPolicy 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 *AttestationPolicyMutation) SetField(name string, value ent.Value) error { switch name { case attestationpolicy.FieldName: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetName(v) return nil } return fmt.Errorf("unknown AttestationPolicy field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *AttestationPolicyMutation) 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 *AttestationPolicyMutation) 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 *AttestationPolicyMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown AttestationPolicy numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *AttestationPolicyMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *AttestationPolicyMutation) 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 *AttestationPolicyMutation) ClearField(name string) error { return fmt.Errorf("unknown AttestationPolicy 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 *AttestationPolicyMutation) ResetField(name string) error { switch name { case attestationpolicy.FieldName: m.ResetName() return nil } return fmt.Errorf("unknown AttestationPolicy field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *AttestationPolicyMutation) AddedEdges() []string { edges := make([]string, 0, 1) if m.statement != nil { edges = append(edges, attestationpolicy.EdgeStatement) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *AttestationPolicyMutation) AddedIDs(name string) []ent.Value { switch name { case attestationpolicy.EdgeStatement: if id := m.statement; id != nil { return []ent.Value{*id} } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *AttestationPolicyMutation) 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 *AttestationPolicyMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *AttestationPolicyMutation) ClearedEdges() []string { edges := make([]string, 0, 1) if m.clearedstatement { edges = append(edges, attestationpolicy.EdgeStatement) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *AttestationPolicyMutation) EdgeCleared(name string) bool { switch name { case attestationpolicy.EdgeStatement: return m.clearedstatement } 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 *AttestationPolicyMutation) ClearEdge(name string) error { switch name { case attestationpolicy.EdgeStatement: m.ClearStatement() return nil } return fmt.Errorf("unknown AttestationPolicy 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 *AttestationPolicyMutation) ResetEdge(name string) error { switch name { case attestationpolicy.EdgeStatement: m.ResetStatement() return nil } return fmt.Errorf("unknown AttestationPolicy edge %s", name) } // DsseMutation represents an operation that mutates the Dsse nodes in the graph. type DsseMutation struct { config op Op typ string id *uuid.UUID created_at *time.Time gitoid_sha256 *string payload_type *string clearedFields map[string]struct{} statement *uuid.UUID clearedstatement bool signatures map[uuid.UUID]struct{} removedsignatures map[uuid.UUID]struct{} clearedsignatures bool payload_digests map[uuid.UUID]struct{} removedpayload_digests map[uuid.UUID]struct{} clearedpayload_digests bool done bool oldValue func(context.Context) (*Dsse, error) predicates []predicate.Dsse } var _ ent.Mutation = (*DsseMutation)(nil) // dsseOption allows management of the mutation configuration using functional options. type dsseOption func(*DsseMutation) // newDsseMutation creates new mutation for the Dsse entity. func newDsseMutation(c config, op Op, opts ...dsseOption) *DsseMutation { m := &DsseMutation{ config: c, op: op, typ: TypeDsse, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withDsseID sets the ID field of the mutation. func withDsseID(id uuid.UUID) dsseOption { return func(m *DsseMutation) { var ( err error once sync.Once value *Dsse ) m.oldValue = func(ctx context.Context) (*Dsse, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Dsse.Get(ctx, id) } }) return value, err } m.id = &id } } // withDsse sets the old Dsse of the mutation. func withDsse(node *Dsse) dsseOption { return func(m *DsseMutation) { m.oldValue = func(context.Context) (*Dsse, 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 DsseMutation) 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 DsseMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 Dsse entities. func (m *DsseMutation) SetID(id uuid.UUID) { 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 *DsseMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *DsseMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().Dsse.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetCreatedAt sets the "created_at" field. func (m *DsseMutation) SetCreatedAt(t time.Time) { m.created_at = &t } // CreatedAt returns the value of the "created_at" field in the mutation. func (m *DsseMutation) CreatedAt() (r time.Time, exists bool) { v := m.created_at if v == nil { return } return *v, true } // OldCreatedAt returns the old "created_at" field's value of the Dsse entity. // If the Dsse 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 *DsseMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("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 } // ClearCreatedAt clears the value of the "created_at" field. func (m *DsseMutation) ClearCreatedAt() { m.created_at = nil m.clearedFields[dsse.FieldCreatedAt] = struct{}{} } // CreatedAtCleared returns if the "created_at" field was cleared in this mutation. func (m *DsseMutation) CreatedAtCleared() bool { _, ok := m.clearedFields[dsse.FieldCreatedAt] return ok } // ResetCreatedAt resets all changes to the "created_at" field. func (m *DsseMutation) ResetCreatedAt() { m.created_at = nil delete(m.clearedFields, dsse.FieldCreatedAt) } // SetGitoidSha256 sets the "gitoid_sha256" field. func (m *DsseMutation) SetGitoidSha256(s string) { m.gitoid_sha256 = &s } // GitoidSha256 returns the value of the "gitoid_sha256" field in the mutation. func (m *DsseMutation) GitoidSha256() (r string, exists bool) { v := m.gitoid_sha256 if v == nil { return } return *v, true } // OldGitoidSha256 returns the old "gitoid_sha256" field's value of the Dsse entity. // If the Dsse 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 *DsseMutation) OldGitoidSha256(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldGitoidSha256 is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldGitoidSha256 requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldGitoidSha256: %w", err) } return oldValue.GitoidSha256, nil } // ResetGitoidSha256 resets all changes to the "gitoid_sha256" field. func (m *DsseMutation) ResetGitoidSha256() { m.gitoid_sha256 = nil } // SetPayloadType sets the "payload_type" field. func (m *DsseMutation) SetPayloadType(s string) { m.payload_type = &s } // PayloadType returns the value of the "payload_type" field in the mutation. func (m *DsseMutation) PayloadType() (r string, exists bool) { v := m.payload_type if v == nil { return } return *v, true } // OldPayloadType returns the old "payload_type" field's value of the Dsse entity. // If the Dsse 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 *DsseMutation) OldPayloadType(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldPayloadType is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldPayloadType requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldPayloadType: %w", err) } return oldValue.PayloadType, nil } // ResetPayloadType resets all changes to the "payload_type" field. func (m *DsseMutation) ResetPayloadType() { m.payload_type = nil } // SetStatementID sets the "statement" edge to the Statement entity by id. func (m *DsseMutation) SetStatementID(id uuid.UUID) { m.statement = &id } // ClearStatement clears the "statement" edge to the Statement entity. func (m *DsseMutation) ClearStatement() { m.clearedstatement = true } // StatementCleared reports if the "statement" edge to the Statement entity was cleared. func (m *DsseMutation) StatementCleared() bool { return m.clearedstatement } // StatementID returns the "statement" edge ID in the mutation. func (m *DsseMutation) StatementID() (id uuid.UUID, exists bool) { if m.statement != nil { return *m.statement, true } return } // StatementIDs returns the "statement" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // StatementID instead. It exists only for internal usage by the builders. func (m *DsseMutation) StatementIDs() (ids []uuid.UUID) { if id := m.statement; id != nil { ids = append(ids, *id) } return } // ResetStatement resets all changes to the "statement" edge. func (m *DsseMutation) ResetStatement() { m.statement = nil m.clearedstatement = false } // AddSignatureIDs adds the "signatures" edge to the Signature entity by ids. func (m *DsseMutation) AddSignatureIDs(ids ...uuid.UUID) { if m.signatures == nil { m.signatures = make(map[uuid.UUID]struct{}) } for i := range ids { m.signatures[ids[i]] = struct{}{} } } // ClearSignatures clears the "signatures" edge to the Signature entity. func (m *DsseMutation) ClearSignatures() { m.clearedsignatures = true } // SignaturesCleared reports if the "signatures" edge to the Signature entity was cleared. func (m *DsseMutation) SignaturesCleared() bool { return m.clearedsignatures } // RemoveSignatureIDs removes the "signatures" edge to the Signature entity by IDs. func (m *DsseMutation) RemoveSignatureIDs(ids ...uuid.UUID) { if m.removedsignatures == nil { m.removedsignatures = make(map[uuid.UUID]struct{}) } for i := range ids { delete(m.signatures, ids[i]) m.removedsignatures[ids[i]] = struct{}{} } } // RemovedSignatures returns the removed IDs of the "signatures" edge to the Signature entity. func (m *DsseMutation) RemovedSignaturesIDs() (ids []uuid.UUID) { for id := range m.removedsignatures { ids = append(ids, id) } return } // SignaturesIDs returns the "signatures" edge IDs in the mutation. func (m *DsseMutation) SignaturesIDs() (ids []uuid.UUID) { for id := range m.signatures { ids = append(ids, id) } return } // ResetSignatures resets all changes to the "signatures" edge. func (m *DsseMutation) ResetSignatures() { m.signatures = nil m.clearedsignatures = false m.removedsignatures = nil } // AddPayloadDigestIDs adds the "payload_digests" edge to the PayloadDigest entity by ids. func (m *DsseMutation) AddPayloadDigestIDs(ids ...uuid.UUID) { if m.payload_digests == nil { m.payload_digests = make(map[uuid.UUID]struct{}) } for i := range ids { m.payload_digests[ids[i]] = struct{}{} } } // ClearPayloadDigests clears the "payload_digests" edge to the PayloadDigest entity. func (m *DsseMutation) ClearPayloadDigests() { m.clearedpayload_digests = true } // PayloadDigestsCleared reports if the "payload_digests" edge to the PayloadDigest entity was cleared. func (m *DsseMutation) PayloadDigestsCleared() bool { return m.clearedpayload_digests } // RemovePayloadDigestIDs removes the "payload_digests" edge to the PayloadDigest entity by IDs. func (m *DsseMutation) RemovePayloadDigestIDs(ids ...uuid.UUID) { if m.removedpayload_digests == nil { m.removedpayload_digests = make(map[uuid.UUID]struct{}) } for i := range ids { delete(m.payload_digests, ids[i]) m.removedpayload_digests[ids[i]] = struct{}{} } } // RemovedPayloadDigests returns the removed IDs of the "payload_digests" edge to the PayloadDigest entity. func (m *DsseMutation) RemovedPayloadDigestsIDs() (ids []uuid.UUID) { for id := range m.removedpayload_digests { ids = append(ids, id) } return } // PayloadDigestsIDs returns the "payload_digests" edge IDs in the mutation. func (m *DsseMutation) PayloadDigestsIDs() (ids []uuid.UUID) { for id := range m.payload_digests { ids = append(ids, id) } return } // ResetPayloadDigests resets all changes to the "payload_digests" edge. func (m *DsseMutation) ResetPayloadDigests() { m.payload_digests = nil m.clearedpayload_digests = false m.removedpayload_digests = nil } // Where appends a list predicates to the DsseMutation builder. func (m *DsseMutation) Where(ps ...predicate.Dsse) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the DsseMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *DsseMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.Dsse, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *DsseMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *DsseMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (Dsse). func (m *DsseMutation) 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 *DsseMutation) Fields() []string { fields := make([]string, 0, 3) if m.created_at != nil { fields = append(fields, dsse.FieldCreatedAt) } if m.gitoid_sha256 != nil { fields = append(fields, dsse.FieldGitoidSha256) } if m.payload_type != nil { fields = append(fields, dsse.FieldPayloadType) } 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 *DsseMutation) Field(name string) (ent.Value, bool) { switch name { case dsse.FieldCreatedAt: return m.CreatedAt() case dsse.FieldGitoidSha256: return m.GitoidSha256() case dsse.FieldPayloadType: return m.PayloadType() } 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 *DsseMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case dsse.FieldCreatedAt: return m.OldCreatedAt(ctx) case dsse.FieldGitoidSha256: return m.OldGitoidSha256(ctx) case dsse.FieldPayloadType: return m.OldPayloadType(ctx) } return nil, fmt.Errorf("unknown Dsse 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 *DsseMutation) SetField(name string, value ent.Value) error { switch name { case dsse.FieldCreatedAt: v, ok := value.(time.Time) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCreatedAt(v) return nil case dsse.FieldGitoidSha256: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetGitoidSha256(v) return nil case dsse.FieldPayloadType: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetPayloadType(v) return nil } return fmt.Errorf("unknown Dsse field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *DsseMutation) 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 *DsseMutation) 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 *DsseMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown Dsse numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *DsseMutation) ClearedFields() []string { var fields []string if m.FieldCleared(dsse.FieldCreatedAt) { fields = append(fields, dsse.FieldCreatedAt) } return fields } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *DsseMutation) 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 *DsseMutation) ClearField(name string) error { switch name { case dsse.FieldCreatedAt: m.ClearCreatedAt() return nil } return fmt.Errorf("unknown Dsse 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 *DsseMutation) ResetField(name string) error { switch name { case dsse.FieldCreatedAt: m.ResetCreatedAt() return nil case dsse.FieldGitoidSha256: m.ResetGitoidSha256() return nil case dsse.FieldPayloadType: m.ResetPayloadType() return nil } return fmt.Errorf("unknown Dsse field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *DsseMutation) AddedEdges() []string { edges := make([]string, 0, 3) if m.statement != nil { edges = append(edges, dsse.EdgeStatement) } if m.signatures != nil { edges = append(edges, dsse.EdgeSignatures) } if m.payload_digests != nil { edges = append(edges, dsse.EdgePayloadDigests) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *DsseMutation) AddedIDs(name string) []ent.Value { switch name { case dsse.EdgeStatement: if id := m.statement; id != nil { return []ent.Value{*id} } case dsse.EdgeSignatures: ids := make([]ent.Value, 0, len(m.signatures)) for id := range m.signatures { ids = append(ids, id) } return ids case dsse.EdgePayloadDigests: ids := make([]ent.Value, 0, len(m.payload_digests)) for id := range m.payload_digests { ids = append(ids, id) } return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *DsseMutation) RemovedEdges() []string { edges := make([]string, 0, 3) if m.removedsignatures != nil { edges = append(edges, dsse.EdgeSignatures) } if m.removedpayload_digests != nil { edges = append(edges, dsse.EdgePayloadDigests) } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. func (m *DsseMutation) RemovedIDs(name string) []ent.Value { switch name { case dsse.EdgeSignatures: ids := make([]ent.Value, 0, len(m.removedsignatures)) for id := range m.removedsignatures { ids = append(ids, id) } return ids case dsse.EdgePayloadDigests: ids := make([]ent.Value, 0, len(m.removedpayload_digests)) for id := range m.removedpayload_digests { ids = append(ids, id) } return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *DsseMutation) ClearedEdges() []string { edges := make([]string, 0, 3) if m.clearedstatement { edges = append(edges, dsse.EdgeStatement) } if m.clearedsignatures { edges = append(edges, dsse.EdgeSignatures) } if m.clearedpayload_digests { edges = append(edges, dsse.EdgePayloadDigests) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *DsseMutation) EdgeCleared(name string) bool { switch name { case dsse.EdgeStatement: return m.clearedstatement case dsse.EdgeSignatures: return m.clearedsignatures case dsse.EdgePayloadDigests: return m.clearedpayload_digests } 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 *DsseMutation) ClearEdge(name string) error { switch name { case dsse.EdgeStatement: m.ClearStatement() return nil } return fmt.Errorf("unknown Dsse 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 *DsseMutation) ResetEdge(name string) error { switch name { case dsse.EdgeStatement: m.ResetStatement() return nil case dsse.EdgeSignatures: m.ResetSignatures() return nil case dsse.EdgePayloadDigests: m.ResetPayloadDigests() return nil } return fmt.Errorf("unknown Dsse edge %s", name) } // PayloadDigestMutation represents an operation that mutates the PayloadDigest nodes in the graph. type PayloadDigestMutation struct { config op Op typ string id *uuid.UUID algorithm *string value *string clearedFields map[string]struct{} dsse *uuid.UUID cleareddsse bool done bool oldValue func(context.Context) (*PayloadDigest, error) predicates []predicate.PayloadDigest } var _ ent.Mutation = (*PayloadDigestMutation)(nil) // payloaddigestOption allows management of the mutation configuration using functional options. type payloaddigestOption func(*PayloadDigestMutation) // newPayloadDigestMutation creates new mutation for the PayloadDigest entity. func newPayloadDigestMutation(c config, op Op, opts ...payloaddigestOption) *PayloadDigestMutation { m := &PayloadDigestMutation{ config: c, op: op, typ: TypePayloadDigest, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withPayloadDigestID sets the ID field of the mutation. func withPayloadDigestID(id uuid.UUID) payloaddigestOption { return func(m *PayloadDigestMutation) { var ( err error once sync.Once value *PayloadDigest ) m.oldValue = func(ctx context.Context) (*PayloadDigest, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().PayloadDigest.Get(ctx, id) } }) return value, err } m.id = &id } } // withPayloadDigest sets the old PayloadDigest of the mutation. func withPayloadDigest(node *PayloadDigest) payloaddigestOption { return func(m *PayloadDigestMutation) { m.oldValue = func(context.Context) (*PayloadDigest, 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 PayloadDigestMutation) 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 PayloadDigestMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 PayloadDigest entities. func (m *PayloadDigestMutation) SetID(id uuid.UUID) { 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 *PayloadDigestMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *PayloadDigestMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().PayloadDigest.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetAlgorithm sets the "algorithm" field. func (m *PayloadDigestMutation) SetAlgorithm(s string) { m.algorithm = &s } // Algorithm returns the value of the "algorithm" field in the mutation. func (m *PayloadDigestMutation) Algorithm() (r string, exists bool) { v := m.algorithm if v == nil { return } return *v, true } // OldAlgorithm returns the old "algorithm" field's value of the PayloadDigest entity. // If the PayloadDigest 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 *PayloadDigestMutation) OldAlgorithm(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldAlgorithm is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldAlgorithm requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldAlgorithm: %w", err) } return oldValue.Algorithm, nil } // ResetAlgorithm resets all changes to the "algorithm" field. func (m *PayloadDigestMutation) ResetAlgorithm() { m.algorithm = nil } // SetValue sets the "value" field. func (m *PayloadDigestMutation) SetValue(s string) { m.value = &s } // Value returns the value of the "value" field in the mutation. func (m *PayloadDigestMutation) Value() (r string, exists bool) { v := m.value if v == nil { return } return *v, true } // OldValue returns the old "value" field's value of the PayloadDigest entity. // If the PayloadDigest 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 *PayloadDigestMutation) OldValue(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldValue is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldValue requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldValue: %w", err) } return oldValue.Value, nil } // ResetValue resets all changes to the "value" field. func (m *PayloadDigestMutation) ResetValue() { m.value = nil } // SetDsseID sets the "dsse" edge to the Dsse entity by id. func (m *PayloadDigestMutation) SetDsseID(id uuid.UUID) { m.dsse = &id } // ClearDsse clears the "dsse" edge to the Dsse entity. func (m *PayloadDigestMutation) ClearDsse() { m.cleareddsse = true } // DsseCleared reports if the "dsse" edge to the Dsse entity was cleared. func (m *PayloadDigestMutation) DsseCleared() bool { return m.cleareddsse } // DsseID returns the "dsse" edge ID in the mutation. func (m *PayloadDigestMutation) DsseID() (id uuid.UUID, exists bool) { if m.dsse != nil { return *m.dsse, true } return } // DsseIDs returns the "dsse" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // DsseID instead. It exists only for internal usage by the builders. func (m *PayloadDigestMutation) DsseIDs() (ids []uuid.UUID) { if id := m.dsse; id != nil { ids = append(ids, *id) } return } // ResetDsse resets all changes to the "dsse" edge. func (m *PayloadDigestMutation) ResetDsse() { m.dsse = nil m.cleareddsse = false } // Where appends a list predicates to the PayloadDigestMutation builder. func (m *PayloadDigestMutation) Where(ps ...predicate.PayloadDigest) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the PayloadDigestMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *PayloadDigestMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.PayloadDigest, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *PayloadDigestMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *PayloadDigestMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (PayloadDigest). func (m *PayloadDigestMutation) 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 *PayloadDigestMutation) Fields() []string { fields := make([]string, 0, 2) if m.algorithm != nil { fields = append(fields, payloaddigest.FieldAlgorithm) } if m.value != nil { fields = append(fields, payloaddigest.FieldValue) } 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 *PayloadDigestMutation) Field(name string) (ent.Value, bool) { switch name { case payloaddigest.FieldAlgorithm: return m.Algorithm() case payloaddigest.FieldValue: return m.Value() } 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 *PayloadDigestMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case payloaddigest.FieldAlgorithm: return m.OldAlgorithm(ctx) case payloaddigest.FieldValue: return m.OldValue(ctx) } return nil, fmt.Errorf("unknown PayloadDigest 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 *PayloadDigestMutation) SetField(name string, value ent.Value) error { switch name { case payloaddigest.FieldAlgorithm: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetAlgorithm(v) return nil case payloaddigest.FieldValue: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetValue(v) return nil } return fmt.Errorf("unknown PayloadDigest field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *PayloadDigestMutation) 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 *PayloadDigestMutation) 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 *PayloadDigestMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown PayloadDigest numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *PayloadDigestMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *PayloadDigestMutation) 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 *PayloadDigestMutation) ClearField(name string) error { return fmt.Errorf("unknown PayloadDigest 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 *PayloadDigestMutation) ResetField(name string) error { switch name { case payloaddigest.FieldAlgorithm: m.ResetAlgorithm() return nil case payloaddigest.FieldValue: m.ResetValue() return nil } return fmt.Errorf("unknown PayloadDigest field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *PayloadDigestMutation) AddedEdges() []string { edges := make([]string, 0, 1) if m.dsse != nil { edges = append(edges, payloaddigest.EdgeDsse) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *PayloadDigestMutation) AddedIDs(name string) []ent.Value { switch name { case payloaddigest.EdgeDsse: if id := m.dsse; id != nil { return []ent.Value{*id} } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *PayloadDigestMutation) 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 *PayloadDigestMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *PayloadDigestMutation) ClearedEdges() []string { edges := make([]string, 0, 1) if m.cleareddsse { edges = append(edges, payloaddigest.EdgeDsse) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *PayloadDigestMutation) EdgeCleared(name string) bool { switch name { case payloaddigest.EdgeDsse: return m.cleareddsse } 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 *PayloadDigestMutation) ClearEdge(name string) error { switch name { case payloaddigest.EdgeDsse: m.ClearDsse() return nil } return fmt.Errorf("unknown PayloadDigest 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 *PayloadDigestMutation) ResetEdge(name string) error { switch name { case payloaddigest.EdgeDsse: m.ResetDsse() return nil } return fmt.Errorf("unknown PayloadDigest edge %s", name) } // SignatureMutation represents an operation that mutates the Signature nodes in the graph. type SignatureMutation struct { config op Op typ string id *uuid.UUID key_id *string signature *string clearedFields map[string]struct{} dsse *uuid.UUID cleareddsse bool timestamps map[uuid.UUID]struct{} removedtimestamps map[uuid.UUID]struct{} clearedtimestamps bool done bool oldValue func(context.Context) (*Signature, error) predicates []predicate.Signature } var _ ent.Mutation = (*SignatureMutation)(nil) // signatureOption allows management of the mutation configuration using functional options. type signatureOption func(*SignatureMutation) // newSignatureMutation creates new mutation for the Signature entity. func newSignatureMutation(c config, op Op, opts ...signatureOption) *SignatureMutation { m := &SignatureMutation{ config: c, op: op, typ: TypeSignature, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withSignatureID sets the ID field of the mutation. func withSignatureID(id uuid.UUID) signatureOption { return func(m *SignatureMutation) { var ( err error once sync.Once value *Signature ) m.oldValue = func(ctx context.Context) (*Signature, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Signature.Get(ctx, id) } }) return value, err } m.id = &id } } // withSignature sets the old Signature of the mutation. func withSignature(node *Signature) signatureOption { return func(m *SignatureMutation) { m.oldValue = func(context.Context) (*Signature, 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 SignatureMutation) 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 SignatureMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 Signature entities. func (m *SignatureMutation) SetID(id uuid.UUID) { 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 *SignatureMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *SignatureMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().Signature.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetKeyID sets the "key_id" field. func (m *SignatureMutation) SetKeyID(s string) { m.key_id = &s } // KeyID returns the value of the "key_id" field in the mutation. func (m *SignatureMutation) KeyID() (r string, exists bool) { v := m.key_id if v == nil { return } return *v, true } // OldKeyID returns the old "key_id" field's value of the Signature entity. // If the Signature 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 *SignatureMutation) OldKeyID(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldKeyID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldKeyID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldKeyID: %w", err) } return oldValue.KeyID, nil } // ResetKeyID resets all changes to the "key_id" field. func (m *SignatureMutation) ResetKeyID() { m.key_id = nil } // SetSignature sets the "signature" field. func (m *SignatureMutation) SetSignature(s string) { m.signature = &s } // Signature returns the value of the "signature" field in the mutation. func (m *SignatureMutation) Signature() (r string, exists bool) { v := m.signature if v == nil { return } return *v, true } // OldSignature returns the old "signature" field's value of the Signature entity. // If the Signature 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 *SignatureMutation) OldSignature(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldSignature is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldSignature requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldSignature: %w", err) } return oldValue.Signature, nil } // ResetSignature resets all changes to the "signature" field. func (m *SignatureMutation) ResetSignature() { m.signature = nil } // SetDsseID sets the "dsse" edge to the Dsse entity by id. func (m *SignatureMutation) SetDsseID(id uuid.UUID) { m.dsse = &id } // ClearDsse clears the "dsse" edge to the Dsse entity. func (m *SignatureMutation) ClearDsse() { m.cleareddsse = true } // DsseCleared reports if the "dsse" edge to the Dsse entity was cleared. func (m *SignatureMutation) DsseCleared() bool { return m.cleareddsse } // DsseID returns the "dsse" edge ID in the mutation. func (m *SignatureMutation) DsseID() (id uuid.UUID, exists bool) { if m.dsse != nil { return *m.dsse, true } return } // DsseIDs returns the "dsse" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // DsseID instead. It exists only for internal usage by the builders. func (m *SignatureMutation) DsseIDs() (ids []uuid.UUID) { if id := m.dsse; id != nil { ids = append(ids, *id) } return } // ResetDsse resets all changes to the "dsse" edge. func (m *SignatureMutation) ResetDsse() { m.dsse = nil m.cleareddsse = false } // AddTimestampIDs adds the "timestamps" edge to the Timestamp entity by ids. func (m *SignatureMutation) AddTimestampIDs(ids ...uuid.UUID) { if m.timestamps == nil { m.timestamps = make(map[uuid.UUID]struct{}) } for i := range ids { m.timestamps[ids[i]] = struct{}{} } } // ClearTimestamps clears the "timestamps" edge to the Timestamp entity. func (m *SignatureMutation) ClearTimestamps() { m.clearedtimestamps = true } // TimestampsCleared reports if the "timestamps" edge to the Timestamp entity was cleared. func (m *SignatureMutation) TimestampsCleared() bool { return m.clearedtimestamps } // RemoveTimestampIDs removes the "timestamps" edge to the Timestamp entity by IDs. func (m *SignatureMutation) RemoveTimestampIDs(ids ...uuid.UUID) { if m.removedtimestamps == nil { m.removedtimestamps = make(map[uuid.UUID]struct{}) } for i := range ids { delete(m.timestamps, ids[i]) m.removedtimestamps[ids[i]] = struct{}{} } } // RemovedTimestamps returns the removed IDs of the "timestamps" edge to the Timestamp entity. func (m *SignatureMutation) RemovedTimestampsIDs() (ids []uuid.UUID) { for id := range m.removedtimestamps { ids = append(ids, id) } return } // TimestampsIDs returns the "timestamps" edge IDs in the mutation. func (m *SignatureMutation) TimestampsIDs() (ids []uuid.UUID) { for id := range m.timestamps { ids = append(ids, id) } return } // ResetTimestamps resets all changes to the "timestamps" edge. func (m *SignatureMutation) ResetTimestamps() { m.timestamps = nil m.clearedtimestamps = false m.removedtimestamps = nil } // Where appends a list predicates to the SignatureMutation builder. func (m *SignatureMutation) Where(ps ...predicate.Signature) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the SignatureMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *SignatureMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.Signature, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *SignatureMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *SignatureMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (Signature). func (m *SignatureMutation) 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 *SignatureMutation) Fields() []string { fields := make([]string, 0, 2) if m.key_id != nil { fields = append(fields, signature.FieldKeyID) } if m.signature != nil { fields = append(fields, signature.FieldSignature) } 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 *SignatureMutation) Field(name string) (ent.Value, bool) { switch name { case signature.FieldKeyID: return m.KeyID() case signature.FieldSignature: return m.Signature() } 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 *SignatureMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case signature.FieldKeyID: return m.OldKeyID(ctx) case signature.FieldSignature: return m.OldSignature(ctx) } return nil, fmt.Errorf("unknown Signature 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 *SignatureMutation) SetField(name string, value ent.Value) error { switch name { case signature.FieldKeyID: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetKeyID(v) return nil case signature.FieldSignature: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetSignature(v) return nil } return fmt.Errorf("unknown Signature field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *SignatureMutation) 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 *SignatureMutation) 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 *SignatureMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown Signature numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *SignatureMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *SignatureMutation) 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 *SignatureMutation) ClearField(name string) error { return fmt.Errorf("unknown Signature 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 *SignatureMutation) ResetField(name string) error { switch name { case signature.FieldKeyID: m.ResetKeyID() return nil case signature.FieldSignature: m.ResetSignature() return nil } return fmt.Errorf("unknown Signature field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *SignatureMutation) AddedEdges() []string { edges := make([]string, 0, 2) if m.dsse != nil { edges = append(edges, signature.EdgeDsse) } if m.timestamps != nil { edges = append(edges, signature.EdgeTimestamps) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *SignatureMutation) AddedIDs(name string) []ent.Value { switch name { case signature.EdgeDsse: if id := m.dsse; id != nil { return []ent.Value{*id} } case signature.EdgeTimestamps: ids := make([]ent.Value, 0, len(m.timestamps)) for id := range m.timestamps { ids = append(ids, id) } return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *SignatureMutation) RemovedEdges() []string { edges := make([]string, 0, 2) if m.removedtimestamps != nil { edges = append(edges, signature.EdgeTimestamps) } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. func (m *SignatureMutation) RemovedIDs(name string) []ent.Value { switch name { case signature.EdgeTimestamps: ids := make([]ent.Value, 0, len(m.removedtimestamps)) for id := range m.removedtimestamps { ids = append(ids, id) } return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *SignatureMutation) ClearedEdges() []string { edges := make([]string, 0, 2) if m.cleareddsse { edges = append(edges, signature.EdgeDsse) } if m.clearedtimestamps { edges = append(edges, signature.EdgeTimestamps) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *SignatureMutation) EdgeCleared(name string) bool { switch name { case signature.EdgeDsse: return m.cleareddsse case signature.EdgeTimestamps: return m.clearedtimestamps } 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 *SignatureMutation) ClearEdge(name string) error { switch name { case signature.EdgeDsse: m.ClearDsse() return nil } return fmt.Errorf("unknown Signature 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 *SignatureMutation) ResetEdge(name string) error { switch name { case signature.EdgeDsse: m.ResetDsse() return nil case signature.EdgeTimestamps: m.ResetTimestamps() return nil } return fmt.Errorf("unknown Signature edge %s", name) } // StatementMutation represents an operation that mutates the Statement nodes in the graph. type StatementMutation struct { config op Op typ string id *uuid.UUID predicate *string clearedFields map[string]struct{} subjects map[uuid.UUID]struct{} removedsubjects map[uuid.UUID]struct{} clearedsubjects bool policy *uuid.UUID clearedpolicy bool attestation_collections *uuid.UUID clearedattestation_collections bool dsse map[uuid.UUID]struct{} removeddsse map[uuid.UUID]struct{} cleareddsse bool done bool oldValue func(context.Context) (*Statement, error) predicates []predicate.Statement } var _ ent.Mutation = (*StatementMutation)(nil) // statementOption allows management of the mutation configuration using functional options. type statementOption func(*StatementMutation) // newStatementMutation creates new mutation for the Statement entity. func newStatementMutation(c config, op Op, opts ...statementOption) *StatementMutation { m := &StatementMutation{ config: c, op: op, typ: TypeStatement, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withStatementID sets the ID field of the mutation. func withStatementID(id uuid.UUID) statementOption { return func(m *StatementMutation) { var ( err error once sync.Once value *Statement ) m.oldValue = func(ctx context.Context) (*Statement, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Statement.Get(ctx, id) } }) return value, err } m.id = &id } } // withStatement sets the old Statement of the mutation. func withStatement(node *Statement) statementOption { return func(m *StatementMutation) { m.oldValue = func(context.Context) (*Statement, 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 StatementMutation) 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 StatementMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 Statement entities. func (m *StatementMutation) SetID(id uuid.UUID) { 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 *StatementMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *StatementMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().Statement.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetPredicate sets the "predicate" field. func (m *StatementMutation) SetPredicate(s string) { m.predicate = &s } // Predicate returns the value of the "predicate" field in the mutation. func (m *StatementMutation) Predicate() (r string, exists bool) { v := m.predicate if v == nil { return } return *v, true } // OldPredicate returns the old "predicate" field's value of the Statement entity. // If the Statement 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 *StatementMutation) OldPredicate(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldPredicate is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldPredicate requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldPredicate: %w", err) } return oldValue.Predicate, nil } // ResetPredicate resets all changes to the "predicate" field. func (m *StatementMutation) ResetPredicate() { m.predicate = nil } // AddSubjectIDs adds the "subjects" edge to the Subject entity by ids. func (m *StatementMutation) AddSubjectIDs(ids ...uuid.UUID) { if m.subjects == nil { m.subjects = make(map[uuid.UUID]struct{}) } for i := range ids { m.subjects[ids[i]] = struct{}{} } } // ClearSubjects clears the "subjects" edge to the Subject entity. func (m *StatementMutation) ClearSubjects() { m.clearedsubjects = true } // SubjectsCleared reports if the "subjects" edge to the Subject entity was cleared. func (m *StatementMutation) SubjectsCleared() bool { return m.clearedsubjects } // RemoveSubjectIDs removes the "subjects" edge to the Subject entity by IDs. func (m *StatementMutation) RemoveSubjectIDs(ids ...uuid.UUID) { if m.removedsubjects == nil { m.removedsubjects = make(map[uuid.UUID]struct{}) } for i := range ids { delete(m.subjects, ids[i]) m.removedsubjects[ids[i]] = struct{}{} } } // RemovedSubjects returns the removed IDs of the "subjects" edge to the Subject entity. func (m *StatementMutation) RemovedSubjectsIDs() (ids []uuid.UUID) { for id := range m.removedsubjects { ids = append(ids, id) } return } // SubjectsIDs returns the "subjects" edge IDs in the mutation. func (m *StatementMutation) SubjectsIDs() (ids []uuid.UUID) { for id := range m.subjects { ids = append(ids, id) } return } // ResetSubjects resets all changes to the "subjects" edge. func (m *StatementMutation) ResetSubjects() { m.subjects = nil m.clearedsubjects = false m.removedsubjects = nil } // SetPolicyID sets the "policy" edge to the AttestationPolicy entity by id. func (m *StatementMutation) SetPolicyID(id uuid.UUID) { m.policy = &id } // ClearPolicy clears the "policy" edge to the AttestationPolicy entity. func (m *StatementMutation) ClearPolicy() { m.clearedpolicy = true } // PolicyCleared reports if the "policy" edge to the AttestationPolicy entity was cleared. func (m *StatementMutation) PolicyCleared() bool { return m.clearedpolicy } // PolicyID returns the "policy" edge ID in the mutation. func (m *StatementMutation) PolicyID() (id uuid.UUID, exists bool) { if m.policy != nil { return *m.policy, true } return } // PolicyIDs returns the "policy" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // PolicyID instead. It exists only for internal usage by the builders. func (m *StatementMutation) PolicyIDs() (ids []uuid.UUID) { if id := m.policy; id != nil { ids = append(ids, *id) } return } // ResetPolicy resets all changes to the "policy" edge. func (m *StatementMutation) ResetPolicy() { m.policy = nil m.clearedpolicy = false } // SetAttestationCollectionsID sets the "attestation_collections" edge to the AttestationCollection entity by id. func (m *StatementMutation) SetAttestationCollectionsID(id uuid.UUID) { m.attestation_collections = &id } // ClearAttestationCollections clears the "attestation_collections" edge to the AttestationCollection entity. func (m *StatementMutation) ClearAttestationCollections() { m.clearedattestation_collections = true } // AttestationCollectionsCleared reports if the "attestation_collections" edge to the AttestationCollection entity was cleared. func (m *StatementMutation) AttestationCollectionsCleared() bool { return m.clearedattestation_collections } // AttestationCollectionsID returns the "attestation_collections" edge ID in the mutation. func (m *StatementMutation) AttestationCollectionsID() (id uuid.UUID, exists bool) { if m.attestation_collections != nil { return *m.attestation_collections, true } return } // AttestationCollectionsIDs returns the "attestation_collections" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // AttestationCollectionsID instead. It exists only for internal usage by the builders. func (m *StatementMutation) AttestationCollectionsIDs() (ids []uuid.UUID) { if id := m.attestation_collections; id != nil { ids = append(ids, *id) } return } // ResetAttestationCollections resets all changes to the "attestation_collections" edge. func (m *StatementMutation) ResetAttestationCollections() { m.attestation_collections = nil m.clearedattestation_collections = false } // AddDsseIDs adds the "dsse" edge to the Dsse entity by ids. func (m *StatementMutation) AddDsseIDs(ids ...uuid.UUID) { if m.dsse == nil { m.dsse = make(map[uuid.UUID]struct{}) } for i := range ids { m.dsse[ids[i]] = struct{}{} } } // ClearDsse clears the "dsse" edge to the Dsse entity. func (m *StatementMutation) ClearDsse() { m.cleareddsse = true } // DsseCleared reports if the "dsse" edge to the Dsse entity was cleared. func (m *StatementMutation) DsseCleared() bool { return m.cleareddsse } // RemoveDsseIDs removes the "dsse" edge to the Dsse entity by IDs. func (m *StatementMutation) RemoveDsseIDs(ids ...uuid.UUID) { if m.removeddsse == nil { m.removeddsse = make(map[uuid.UUID]struct{}) } for i := range ids { delete(m.dsse, ids[i]) m.removeddsse[ids[i]] = struct{}{} } } // RemovedDsse returns the removed IDs of the "dsse" edge to the Dsse entity. func (m *StatementMutation) RemovedDsseIDs() (ids []uuid.UUID) { for id := range m.removeddsse { ids = append(ids, id) } return } // DsseIDs returns the "dsse" edge IDs in the mutation. func (m *StatementMutation) DsseIDs() (ids []uuid.UUID) { for id := range m.dsse { ids = append(ids, id) } return } // ResetDsse resets all changes to the "dsse" edge. func (m *StatementMutation) ResetDsse() { m.dsse = nil m.cleareddsse = false m.removeddsse = nil } // Where appends a list predicates to the StatementMutation builder. func (m *StatementMutation) Where(ps ...predicate.Statement) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the StatementMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *StatementMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.Statement, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *StatementMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *StatementMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (Statement). func (m *StatementMutation) 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 *StatementMutation) Fields() []string { fields := make([]string, 0, 1) if m.predicate != nil { fields = append(fields, statement.FieldPredicate) } 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 *StatementMutation) Field(name string) (ent.Value, bool) { switch name { case statement.FieldPredicate: return m.Predicate() } 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 *StatementMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case statement.FieldPredicate: return m.OldPredicate(ctx) } return nil, fmt.Errorf("unknown Statement 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 *StatementMutation) SetField(name string, value ent.Value) error { switch name { case statement.FieldPredicate: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetPredicate(v) return nil } return fmt.Errorf("unknown Statement field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *StatementMutation) 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 *StatementMutation) 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 *StatementMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown Statement numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *StatementMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *StatementMutation) 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 *StatementMutation) ClearField(name string) error { return fmt.Errorf("unknown Statement 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 *StatementMutation) ResetField(name string) error { switch name { case statement.FieldPredicate: m.ResetPredicate() return nil } return fmt.Errorf("unknown Statement field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *StatementMutation) AddedEdges() []string { edges := make([]string, 0, 4) if m.subjects != nil { edges = append(edges, statement.EdgeSubjects) } if m.policy != nil { edges = append(edges, statement.EdgePolicy) } if m.attestation_collections != nil { edges = append(edges, statement.EdgeAttestationCollections) } if m.dsse != nil { edges = append(edges, statement.EdgeDsse) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *StatementMutation) AddedIDs(name string) []ent.Value { switch name { case statement.EdgeSubjects: ids := make([]ent.Value, 0, len(m.subjects)) for id := range m.subjects { ids = append(ids, id) } return ids case statement.EdgePolicy: if id := m.policy; id != nil { return []ent.Value{*id} } case statement.EdgeAttestationCollections: if id := m.attestation_collections; id != nil { return []ent.Value{*id} } case statement.EdgeDsse: ids := make([]ent.Value, 0, len(m.dsse)) for id := range m.dsse { ids = append(ids, id) } return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *StatementMutation) RemovedEdges() []string { edges := make([]string, 0, 4) if m.removedsubjects != nil { edges = append(edges, statement.EdgeSubjects) } if m.removeddsse != nil { edges = append(edges, statement.EdgeDsse) } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. func (m *StatementMutation) RemovedIDs(name string) []ent.Value { switch name { case statement.EdgeSubjects: ids := make([]ent.Value, 0, len(m.removedsubjects)) for id := range m.removedsubjects { ids = append(ids, id) } return ids case statement.EdgeDsse: ids := make([]ent.Value, 0, len(m.removeddsse)) for id := range m.removeddsse { ids = append(ids, id) } return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *StatementMutation) ClearedEdges() []string { edges := make([]string, 0, 4) if m.clearedsubjects { edges = append(edges, statement.EdgeSubjects) } if m.clearedpolicy { edges = append(edges, statement.EdgePolicy) } if m.clearedattestation_collections { edges = append(edges, statement.EdgeAttestationCollections) } if m.cleareddsse { edges = append(edges, statement.EdgeDsse) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *StatementMutation) EdgeCleared(name string) bool { switch name { case statement.EdgeSubjects: return m.clearedsubjects case statement.EdgePolicy: return m.clearedpolicy case statement.EdgeAttestationCollections: return m.clearedattestation_collections case statement.EdgeDsse: return m.cleareddsse } 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 *StatementMutation) ClearEdge(name string) error { switch name { case statement.EdgePolicy: m.ClearPolicy() return nil case statement.EdgeAttestationCollections: m.ClearAttestationCollections() return nil } return fmt.Errorf("unknown Statement 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 *StatementMutation) ResetEdge(name string) error { switch name { case statement.EdgeSubjects: m.ResetSubjects() return nil case statement.EdgePolicy: m.ResetPolicy() return nil case statement.EdgeAttestationCollections: m.ResetAttestationCollections() return nil case statement.EdgeDsse: m.ResetDsse() return nil } return fmt.Errorf("unknown Statement edge %s", name) } // SubjectMutation represents an operation that mutates the Subject nodes in the graph. type SubjectMutation struct { config op Op typ string id *uuid.UUID created_at *time.Time name *string clearedFields map[string]struct{} subject_digests map[uuid.UUID]struct{} removedsubject_digests map[uuid.UUID]struct{} clearedsubject_digests bool statement *uuid.UUID clearedstatement bool done bool oldValue func(context.Context) (*Subject, error) predicates []predicate.Subject } var _ ent.Mutation = (*SubjectMutation)(nil) // subjectOption allows management of the mutation configuration using functional options. type subjectOption func(*SubjectMutation) // newSubjectMutation creates new mutation for the Subject entity. func newSubjectMutation(c config, op Op, opts ...subjectOption) *SubjectMutation { m := &SubjectMutation{ config: c, op: op, typ: TypeSubject, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withSubjectID sets the ID field of the mutation. func withSubjectID(id uuid.UUID) subjectOption { return func(m *SubjectMutation) { var ( err error once sync.Once value *Subject ) m.oldValue = func(ctx context.Context) (*Subject, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Subject.Get(ctx, id) } }) return value, err } m.id = &id } } // withSubject sets the old Subject of the mutation. func withSubject(node *Subject) subjectOption { return func(m *SubjectMutation) { m.oldValue = func(context.Context) (*Subject, 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 SubjectMutation) 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 SubjectMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 Subject entities. func (m *SubjectMutation) SetID(id uuid.UUID) { 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 *SubjectMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *SubjectMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().Subject.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetCreatedAt sets the "created_at" field. func (m *SubjectMutation) SetCreatedAt(t time.Time) { m.created_at = &t } // CreatedAt returns the value of the "created_at" field in the mutation. func (m *SubjectMutation) CreatedAt() (r time.Time, exists bool) { v := m.created_at if v == nil { return } return *v, true } // OldCreatedAt returns the old "created_at" field's value of the Subject entity. // If the Subject 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 *SubjectMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("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 } // ClearCreatedAt clears the value of the "created_at" field. func (m *SubjectMutation) ClearCreatedAt() { m.created_at = nil m.clearedFields[subject.FieldCreatedAt] = struct{}{} } // CreatedAtCleared returns if the "created_at" field was cleared in this mutation. func (m *SubjectMutation) CreatedAtCleared() bool { _, ok := m.clearedFields[subject.FieldCreatedAt] return ok } // ResetCreatedAt resets all changes to the "created_at" field. func (m *SubjectMutation) ResetCreatedAt() { m.created_at = nil delete(m.clearedFields, subject.FieldCreatedAt) } // SetName sets the "name" field. func (m *SubjectMutation) SetName(s string) { m.name = &s } // Name returns the value of the "name" field in the mutation. func (m *SubjectMutation) 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 Subject entity. // If the Subject 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 *SubjectMutation) OldName(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldName is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("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 *SubjectMutation) ResetName() { m.name = nil } // AddSubjectDigestIDs adds the "subject_digests" edge to the SubjectDigest entity by ids. func (m *SubjectMutation) AddSubjectDigestIDs(ids ...uuid.UUID) { if m.subject_digests == nil { m.subject_digests = make(map[uuid.UUID]struct{}) } for i := range ids { m.subject_digests[ids[i]] = struct{}{} } } // ClearSubjectDigests clears the "subject_digests" edge to the SubjectDigest entity. func (m *SubjectMutation) ClearSubjectDigests() { m.clearedsubject_digests = true } // SubjectDigestsCleared reports if the "subject_digests" edge to the SubjectDigest entity was cleared. func (m *SubjectMutation) SubjectDigestsCleared() bool { return m.clearedsubject_digests } // RemoveSubjectDigestIDs removes the "subject_digests" edge to the SubjectDigest entity by IDs. func (m *SubjectMutation) RemoveSubjectDigestIDs(ids ...uuid.UUID) { if m.removedsubject_digests == nil { m.removedsubject_digests = make(map[uuid.UUID]struct{}) } for i := range ids { delete(m.subject_digests, ids[i]) m.removedsubject_digests[ids[i]] = struct{}{} } } // RemovedSubjectDigests returns the removed IDs of the "subject_digests" edge to the SubjectDigest entity. func (m *SubjectMutation) RemovedSubjectDigestsIDs() (ids []uuid.UUID) { for id := range m.removedsubject_digests { ids = append(ids, id) } return } // SubjectDigestsIDs returns the "subject_digests" edge IDs in the mutation. func (m *SubjectMutation) SubjectDigestsIDs() (ids []uuid.UUID) { for id := range m.subject_digests { ids = append(ids, id) } return } // ResetSubjectDigests resets all changes to the "subject_digests" edge. func (m *SubjectMutation) ResetSubjectDigests() { m.subject_digests = nil m.clearedsubject_digests = false m.removedsubject_digests = nil } // SetStatementID sets the "statement" edge to the Statement entity by id. func (m *SubjectMutation) SetStatementID(id uuid.UUID) { m.statement = &id } // ClearStatement clears the "statement" edge to the Statement entity. func (m *SubjectMutation) ClearStatement() { m.clearedstatement = true } // StatementCleared reports if the "statement" edge to the Statement entity was cleared. func (m *SubjectMutation) StatementCleared() bool { return m.clearedstatement } // StatementID returns the "statement" edge ID in the mutation. func (m *SubjectMutation) StatementID() (id uuid.UUID, exists bool) { if m.statement != nil { return *m.statement, true } return } // StatementIDs returns the "statement" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // StatementID instead. It exists only for internal usage by the builders. func (m *SubjectMutation) StatementIDs() (ids []uuid.UUID) { if id := m.statement; id != nil { ids = append(ids, *id) } return } // ResetStatement resets all changes to the "statement" edge. func (m *SubjectMutation) ResetStatement() { m.statement = nil m.clearedstatement = false } // Where appends a list predicates to the SubjectMutation builder. func (m *SubjectMutation) Where(ps ...predicate.Subject) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the SubjectMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *SubjectMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.Subject, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *SubjectMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *SubjectMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (Subject). func (m *SubjectMutation) 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 *SubjectMutation) Fields() []string { fields := make([]string, 0, 2) if m.created_at != nil { fields = append(fields, subject.FieldCreatedAt) } if m.name != nil { fields = append(fields, subject.FieldName) } 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 *SubjectMutation) Field(name string) (ent.Value, bool) { switch name { case subject.FieldCreatedAt: return m.CreatedAt() case subject.FieldName: return m.Name() } 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 *SubjectMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case subject.FieldCreatedAt: return m.OldCreatedAt(ctx) case subject.FieldName: return m.OldName(ctx) } return nil, fmt.Errorf("unknown Subject 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 *SubjectMutation) SetField(name string, value ent.Value) error { switch name { case subject.FieldCreatedAt: v, ok := value.(time.Time) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetCreatedAt(v) return nil case subject.FieldName: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetName(v) return nil } return fmt.Errorf("unknown Subject field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *SubjectMutation) 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 *SubjectMutation) 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 *SubjectMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown Subject numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *SubjectMutation) ClearedFields() []string { var fields []string if m.FieldCleared(subject.FieldCreatedAt) { fields = append(fields, subject.FieldCreatedAt) } return fields } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *SubjectMutation) 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 *SubjectMutation) ClearField(name string) error { switch name { case subject.FieldCreatedAt: m.ClearCreatedAt() return nil } return fmt.Errorf("unknown Subject 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 *SubjectMutation) ResetField(name string) error { switch name { case subject.FieldCreatedAt: m.ResetCreatedAt() return nil case subject.FieldName: m.ResetName() return nil } return fmt.Errorf("unknown Subject field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *SubjectMutation) AddedEdges() []string { edges := make([]string, 0, 2) if m.subject_digests != nil { edges = append(edges, subject.EdgeSubjectDigests) } if m.statement != nil { edges = append(edges, subject.EdgeStatement) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *SubjectMutation) AddedIDs(name string) []ent.Value { switch name { case subject.EdgeSubjectDigests: ids := make([]ent.Value, 0, len(m.subject_digests)) for id := range m.subject_digests { ids = append(ids, id) } return ids case subject.EdgeStatement: if id := m.statement; id != nil { return []ent.Value{*id} } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *SubjectMutation) RemovedEdges() []string { edges := make([]string, 0, 2) if m.removedsubject_digests != nil { edges = append(edges, subject.EdgeSubjectDigests) } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. func (m *SubjectMutation) RemovedIDs(name string) []ent.Value { switch name { case subject.EdgeSubjectDigests: ids := make([]ent.Value, 0, len(m.removedsubject_digests)) for id := range m.removedsubject_digests { ids = append(ids, id) } return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *SubjectMutation) ClearedEdges() []string { edges := make([]string, 0, 2) if m.clearedsubject_digests { edges = append(edges, subject.EdgeSubjectDigests) } if m.clearedstatement { edges = append(edges, subject.EdgeStatement) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *SubjectMutation) EdgeCleared(name string) bool { switch name { case subject.EdgeSubjectDigests: return m.clearedsubject_digests case subject.EdgeStatement: return m.clearedstatement } 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 *SubjectMutation) ClearEdge(name string) error { switch name { case subject.EdgeStatement: m.ClearStatement() return nil } return fmt.Errorf("unknown Subject 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 *SubjectMutation) ResetEdge(name string) error { switch name { case subject.EdgeSubjectDigests: m.ResetSubjectDigests() return nil case subject.EdgeStatement: m.ResetStatement() return nil } return fmt.Errorf("unknown Subject edge %s", name) } // SubjectDigestMutation represents an operation that mutates the SubjectDigest nodes in the graph. type SubjectDigestMutation struct { config op Op typ string id *uuid.UUID algorithm *string value *string clearedFields map[string]struct{} subject *uuid.UUID clearedsubject bool done bool oldValue func(context.Context) (*SubjectDigest, error) predicates []predicate.SubjectDigest } var _ ent.Mutation = (*SubjectDigestMutation)(nil) // subjectdigestOption allows management of the mutation configuration using functional options. type subjectdigestOption func(*SubjectDigestMutation) // newSubjectDigestMutation creates new mutation for the SubjectDigest entity. func newSubjectDigestMutation(c config, op Op, opts ...subjectdigestOption) *SubjectDigestMutation { m := &SubjectDigestMutation{ config: c, op: op, typ: TypeSubjectDigest, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withSubjectDigestID sets the ID field of the mutation. func withSubjectDigestID(id uuid.UUID) subjectdigestOption { return func(m *SubjectDigestMutation) { var ( err error once sync.Once value *SubjectDigest ) m.oldValue = func(ctx context.Context) (*SubjectDigest, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().SubjectDigest.Get(ctx, id) } }) return value, err } m.id = &id } } // withSubjectDigest sets the old SubjectDigest of the mutation. func withSubjectDigest(node *SubjectDigest) subjectdigestOption { return func(m *SubjectDigestMutation) { m.oldValue = func(context.Context) (*SubjectDigest, 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 SubjectDigestMutation) 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 SubjectDigestMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 SubjectDigest entities. func (m *SubjectDigestMutation) SetID(id uuid.UUID) { 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 *SubjectDigestMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *SubjectDigestMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().SubjectDigest.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetAlgorithm sets the "algorithm" field. func (m *SubjectDigestMutation) SetAlgorithm(s string) { m.algorithm = &s } // Algorithm returns the value of the "algorithm" field in the mutation. func (m *SubjectDigestMutation) Algorithm() (r string, exists bool) { v := m.algorithm if v == nil { return } return *v, true } // OldAlgorithm returns the old "algorithm" field's value of the SubjectDigest entity. // If the SubjectDigest 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 *SubjectDigestMutation) OldAlgorithm(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldAlgorithm is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldAlgorithm requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldAlgorithm: %w", err) } return oldValue.Algorithm, nil } // ResetAlgorithm resets all changes to the "algorithm" field. func (m *SubjectDigestMutation) ResetAlgorithm() { m.algorithm = nil } // SetValue sets the "value" field. func (m *SubjectDigestMutation) SetValue(s string) { m.value = &s } // Value returns the value of the "value" field in the mutation. func (m *SubjectDigestMutation) Value() (r string, exists bool) { v := m.value if v == nil { return } return *v, true } // OldValue returns the old "value" field's value of the SubjectDigest entity. // If the SubjectDigest 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 *SubjectDigestMutation) OldValue(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldValue is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldValue requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldValue: %w", err) } return oldValue.Value, nil } // ResetValue resets all changes to the "value" field. func (m *SubjectDigestMutation) ResetValue() { m.value = nil } // SetSubjectID sets the "subject" edge to the Subject entity by id. func (m *SubjectDigestMutation) SetSubjectID(id uuid.UUID) { m.subject = &id } // ClearSubject clears the "subject" edge to the Subject entity. func (m *SubjectDigestMutation) ClearSubject() { m.clearedsubject = true } // SubjectCleared reports if the "subject" edge to the Subject entity was cleared. func (m *SubjectDigestMutation) SubjectCleared() bool { return m.clearedsubject } // SubjectID returns the "subject" edge ID in the mutation. func (m *SubjectDigestMutation) SubjectID() (id uuid.UUID, exists bool) { if m.subject != nil { return *m.subject, true } return } // SubjectIDs returns the "subject" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // SubjectID instead. It exists only for internal usage by the builders. func (m *SubjectDigestMutation) SubjectIDs() (ids []uuid.UUID) { if id := m.subject; id != nil { ids = append(ids, *id) } return } // ResetSubject resets all changes to the "subject" edge. func (m *SubjectDigestMutation) ResetSubject() { m.subject = nil m.clearedsubject = false } // Where appends a list predicates to the SubjectDigestMutation builder. func (m *SubjectDigestMutation) Where(ps ...predicate.SubjectDigest) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the SubjectDigestMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *SubjectDigestMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.SubjectDigest, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *SubjectDigestMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *SubjectDigestMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (SubjectDigest). func (m *SubjectDigestMutation) 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 *SubjectDigestMutation) Fields() []string { fields := make([]string, 0, 2) if m.algorithm != nil { fields = append(fields, subjectdigest.FieldAlgorithm) } if m.value != nil { fields = append(fields, subjectdigest.FieldValue) } 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 *SubjectDigestMutation) Field(name string) (ent.Value, bool) { switch name { case subjectdigest.FieldAlgorithm: return m.Algorithm() case subjectdigest.FieldValue: return m.Value() } 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 *SubjectDigestMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case subjectdigest.FieldAlgorithm: return m.OldAlgorithm(ctx) case subjectdigest.FieldValue: return m.OldValue(ctx) } return nil, fmt.Errorf("unknown SubjectDigest 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 *SubjectDigestMutation) SetField(name string, value ent.Value) error { switch name { case subjectdigest.FieldAlgorithm: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetAlgorithm(v) return nil case subjectdigest.FieldValue: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetValue(v) return nil } return fmt.Errorf("unknown SubjectDigest field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *SubjectDigestMutation) 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 *SubjectDigestMutation) 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 *SubjectDigestMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown SubjectDigest numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *SubjectDigestMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *SubjectDigestMutation) 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 *SubjectDigestMutation) ClearField(name string) error { return fmt.Errorf("unknown SubjectDigest 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 *SubjectDigestMutation) ResetField(name string) error { switch name { case subjectdigest.FieldAlgorithm: m.ResetAlgorithm() return nil case subjectdigest.FieldValue: m.ResetValue() return nil } return fmt.Errorf("unknown SubjectDigest field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *SubjectDigestMutation) AddedEdges() []string { edges := make([]string, 0, 1) if m.subject != nil { edges = append(edges, subjectdigest.EdgeSubject) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *SubjectDigestMutation) AddedIDs(name string) []ent.Value { switch name { case subjectdigest.EdgeSubject: if id := m.subject; id != nil { return []ent.Value{*id} } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *SubjectDigestMutation) 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 *SubjectDigestMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *SubjectDigestMutation) ClearedEdges() []string { edges := make([]string, 0, 1) if m.clearedsubject { edges = append(edges, subjectdigest.EdgeSubject) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *SubjectDigestMutation) EdgeCleared(name string) bool { switch name { case subjectdigest.EdgeSubject: return m.clearedsubject } 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 *SubjectDigestMutation) ClearEdge(name string) error { switch name { case subjectdigest.EdgeSubject: m.ClearSubject() return nil } return fmt.Errorf("unknown SubjectDigest 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 *SubjectDigestMutation) ResetEdge(name string) error { switch name { case subjectdigest.EdgeSubject: m.ResetSubject() return nil } return fmt.Errorf("unknown SubjectDigest edge %s", name) } // TimestampMutation represents an operation that mutates the Timestamp nodes in the graph. type TimestampMutation struct { config op Op typ string id *uuid.UUID _type *string timestamp *time.Time clearedFields map[string]struct{} signature *uuid.UUID clearedsignature bool done bool oldValue func(context.Context) (*Timestamp, error) predicates []predicate.Timestamp } var _ ent.Mutation = (*TimestampMutation)(nil) // timestampOption allows management of the mutation configuration using functional options. type timestampOption func(*TimestampMutation) // newTimestampMutation creates new mutation for the Timestamp entity. func newTimestampMutation(c config, op Op, opts ...timestampOption) *TimestampMutation { m := &TimestampMutation{ config: c, op: op, typ: TypeTimestamp, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withTimestampID sets the ID field of the mutation. func withTimestampID(id uuid.UUID) timestampOption { return func(m *TimestampMutation) { var ( err error once sync.Once value *Timestamp ) m.oldValue = func(ctx context.Context) (*Timestamp, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Timestamp.Get(ctx, id) } }) return value, err } m.id = &id } } // withTimestamp sets the old Timestamp of the mutation. func withTimestamp(node *Timestamp) timestampOption { return func(m *TimestampMutation) { m.oldValue = func(context.Context) (*Timestamp, 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 TimestampMutation) 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 TimestampMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("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 Timestamp entities. func (m *TimestampMutation) SetID(id uuid.UUID) { 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 *TimestampMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *TimestampMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().Timestamp.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetType sets the "type" field. func (m *TimestampMutation) SetType(s string) { m._type = &s } // GetType returns the value of the "type" field in the mutation. func (m *TimestampMutation) 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 Timestamp entity. // If the Timestamp 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 *TimestampMutation) OldType(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldType is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("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 *TimestampMutation) ResetType() { m._type = nil } // SetTimestamp sets the "timestamp" field. func (m *TimestampMutation) SetTimestamp(t time.Time) { m.timestamp = &t } // Timestamp returns the value of the "timestamp" field in the mutation. func (m *TimestampMutation) Timestamp() (r time.Time, exists bool) { v := m.timestamp if v == nil { return } return *v, true } // OldTimestamp returns the old "timestamp" field's value of the Timestamp entity. // If the Timestamp 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 *TimestampMutation) OldTimestamp(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldTimestamp is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldTimestamp requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldTimestamp: %w", err) } return oldValue.Timestamp, nil } // ResetTimestamp resets all changes to the "timestamp" field. func (m *TimestampMutation) ResetTimestamp() { m.timestamp = nil } // SetSignatureID sets the "signature" edge to the Signature entity by id. func (m *TimestampMutation) SetSignatureID(id uuid.UUID) { m.signature = &id } // ClearSignature clears the "signature" edge to the Signature entity. func (m *TimestampMutation) ClearSignature() { m.clearedsignature = true } // SignatureCleared reports if the "signature" edge to the Signature entity was cleared. func (m *TimestampMutation) SignatureCleared() bool { return m.clearedsignature } // SignatureID returns the "signature" edge ID in the mutation. func (m *TimestampMutation) SignatureID() (id uuid.UUID, exists bool) { if m.signature != nil { return *m.signature, true } return } // SignatureIDs returns the "signature" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use // SignatureID instead. It exists only for internal usage by the builders. func (m *TimestampMutation) SignatureIDs() (ids []uuid.UUID) { if id := m.signature; id != nil { ids = append(ids, *id) } return } // ResetSignature resets all changes to the "signature" edge. func (m *TimestampMutation) ResetSignature() { m.signature = nil m.clearedsignature = false } // Where appends a list predicates to the TimestampMutation builder. func (m *TimestampMutation) Where(ps ...predicate.Timestamp) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the TimestampMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *TimestampMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.Timestamp, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *TimestampMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *TimestampMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (Timestamp). func (m *TimestampMutation) 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 *TimestampMutation) Fields() []string { fields := make([]string, 0, 2) if m._type != nil { fields = append(fields, timestamp.FieldType) } if m.timestamp != nil { fields = append(fields, timestamp.FieldTimestamp) } 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 *TimestampMutation) Field(name string) (ent.Value, bool) { switch name { case timestamp.FieldType: return m.GetType() case timestamp.FieldTimestamp: return m.Timestamp() } 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 *TimestampMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case timestamp.FieldType: return m.OldType(ctx) case timestamp.FieldTimestamp: return m.OldTimestamp(ctx) } return nil, fmt.Errorf("unknown Timestamp 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 *TimestampMutation) SetField(name string, value ent.Value) error { switch name { case timestamp.FieldType: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetType(v) return nil case timestamp.FieldTimestamp: v, ok := value.(time.Time) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetTimestamp(v) return nil } return fmt.Errorf("unknown Timestamp field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *TimestampMutation) 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 *TimestampMutation) 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 *TimestampMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown Timestamp numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *TimestampMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *TimestampMutation) 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 *TimestampMutation) ClearField(name string) error { return fmt.Errorf("unknown Timestamp 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 *TimestampMutation) ResetField(name string) error { switch name { case timestamp.FieldType: m.ResetType() return nil case timestamp.FieldTimestamp: m.ResetTimestamp() return nil } return fmt.Errorf("unknown Timestamp field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *TimestampMutation) AddedEdges() []string { edges := make([]string, 0, 1) if m.signature != nil { edges = append(edges, timestamp.EdgeSignature) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *TimestampMutation) AddedIDs(name string) []ent.Value { switch name { case timestamp.EdgeSignature: if id := m.signature; id != nil { return []ent.Value{*id} } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *TimestampMutation) 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 *TimestampMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *TimestampMutation) ClearedEdges() []string { edges := make([]string, 0, 1) if m.clearedsignature { edges = append(edges, timestamp.EdgeSignature) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *TimestampMutation) EdgeCleared(name string) bool { switch name { case timestamp.EdgeSignature: return m.clearedsignature } 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 *TimestampMutation) ClearEdge(name string) error { switch name { case timestamp.EdgeSignature: m.ClearSignature() return nil } return fmt.Errorf("unknown Timestamp 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 *TimestampMutation) ResetEdge(name string) error { switch name { case timestamp.EdgeSignature: m.ResetSignature() return nil } return fmt.Errorf("unknown Timestamp edge %s", name) } golang-github-in-toto-archivista-0.11.1/ent/payloaddigest.go000066400000000000000000000123331511066247200240170ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" ) // PayloadDigest is the model entity for the PayloadDigest schema. type PayloadDigest struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Algorithm holds the value of the "algorithm" field. Algorithm string `json:"algorithm,omitempty"` // Value holds the value of the "value" field. Value string `json:"value,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the PayloadDigestQuery when eager-loading is set. Edges PayloadDigestEdges `json:"edges"` dsse_payload_digests *uuid.UUID selectValues sql.SelectValues } // PayloadDigestEdges holds the relations/edges for other nodes in the graph. type PayloadDigestEdges struct { // Dsse holds the value of the dsse edge. Dsse *Dsse `json:"dsse,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [1]bool // totalCount holds the count of the edges above. totalCount [1]map[string]int } // DsseOrErr returns the Dsse value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e PayloadDigestEdges) DsseOrErr() (*Dsse, error) { if e.Dsse != nil { return e.Dsse, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: dsse.Label} } return nil, &NotLoadedError{edge: "dsse"} } // scanValues returns the types for scanning values from sql.Rows. func (*PayloadDigest) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case payloaddigest.FieldAlgorithm, payloaddigest.FieldValue: values[i] = new(sql.NullString) case payloaddigest.FieldID: values[i] = new(uuid.UUID) case payloaddigest.ForeignKeys[0]: // dsse_payload_digests values[i] = &sql.NullScanner{S: new(uuid.UUID)} default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the PayloadDigest fields. func (_m *PayloadDigest) assignValues(columns []string, values []any) 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 payloaddigest.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case payloaddigest.FieldAlgorithm: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field algorithm", values[i]) } else if value.Valid { _m.Algorithm = value.String } case payloaddigest.FieldValue: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field value", values[i]) } else if value.Valid { _m.Value = value.String } case payloaddigest.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field dsse_payload_digests", values[i]) } else if value.Valid { _m.dsse_payload_digests = new(uuid.UUID) *_m.dsse_payload_digests = *value.S.(*uuid.UUID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // GetValue returns the ent.Value that was dynamically selected and assigned to the PayloadDigest. // This includes values selected through modifiers, order, etc. func (_m *PayloadDigest) GetValue(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QueryDsse queries the "dsse" edge of the PayloadDigest entity. func (_m *PayloadDigest) QueryDsse() *DsseQuery { return NewPayloadDigestClient(_m.config).QueryDsse(_m) } // Update returns a builder for updating this PayloadDigest. // Note that you need to call PayloadDigest.Unwrap() before calling this method if this PayloadDigest // was returned from a transaction, and the transaction was committed or rolled back. func (_m *PayloadDigest) Update() *PayloadDigestUpdateOne { return NewPayloadDigestClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the PayloadDigest 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 (_m *PayloadDigest) Unwrap() *PayloadDigest { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: PayloadDigest is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *PayloadDigest) String() string { var builder strings.Builder builder.WriteString("PayloadDigest(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("algorithm=") builder.WriteString(_m.Algorithm) builder.WriteString(", ") builder.WriteString("value=") builder.WriteString(_m.Value) builder.WriteByte(')') return builder.String() } // PayloadDigests is a parsable slice of PayloadDigest. type PayloadDigests []*PayloadDigest golang-github-in-toto-archivista-0.11.1/ent/payloaddigest/000077500000000000000000000000001511066247200234665ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/payloaddigest/payloaddigest.go000066400000000000000000000062121511066247200266470ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package payloaddigest import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the payloaddigest type in the database. Label = "payload_digest" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldAlgorithm holds the string denoting the algorithm field in the database. FieldAlgorithm = "algorithm" // FieldValue holds the string denoting the value field in the database. FieldValue = "value" // EdgeDsse holds the string denoting the dsse edge name in mutations. EdgeDsse = "dsse" // Table holds the table name of the payloaddigest in the database. Table = "payload_digests" // DsseTable is the table that holds the dsse relation/edge. DsseTable = "payload_digests" // DsseInverseTable is the table name for the Dsse entity. // It exists in this package in order to avoid circular dependency with the "dsse" package. DsseInverseTable = "dsses" // DsseColumn is the table column denoting the dsse relation/edge. DsseColumn = "dsse_payload_digests" ) // Columns holds all SQL columns for payloaddigest fields. var Columns = []string{ FieldID, FieldAlgorithm, FieldValue, } // ForeignKeys holds the SQL foreign-keys that are owned by the "payload_digests" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "dsse_payload_digests", } // 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 ( // AlgorithmValidator is a validator for the "algorithm" field. It is called by the builders before save. AlgorithmValidator func(string) error // ValueValidator is a validator for the "value" field. It is called by the builders before save. ValueValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the PayloadDigest queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByAlgorithm orders the results by the algorithm field. func ByAlgorithm(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAlgorithm, opts...).ToFunc() } // ByValue orders the results by the value field. func ByValue(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldValue, opts...).ToFunc() } // ByDsseField orders the results by dsse field. func ByDsseField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newDsseStep(), sql.OrderByField(field, opts...)) } } func newDsseStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(DsseInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, DsseTable, DsseColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/payloaddigest/where.go000066400000000000000000000203171511066247200251320ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package payloaddigest import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldLTE(FieldID, id)) } // Algorithm applies equality check predicate on the "algorithm" field. It's identical to AlgorithmEQ. func Algorithm(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldEQ(FieldAlgorithm, v)) } // Value applies equality check predicate on the "value" field. It's identical to ValueEQ. func Value(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldEQ(FieldValue, v)) } // AlgorithmEQ applies the EQ predicate on the "algorithm" field. func AlgorithmEQ(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldEQ(FieldAlgorithm, v)) } // AlgorithmNEQ applies the NEQ predicate on the "algorithm" field. func AlgorithmNEQ(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldNEQ(FieldAlgorithm, v)) } // AlgorithmIn applies the In predicate on the "algorithm" field. func AlgorithmIn(vs ...string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldIn(FieldAlgorithm, vs...)) } // AlgorithmNotIn applies the NotIn predicate on the "algorithm" field. func AlgorithmNotIn(vs ...string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldNotIn(FieldAlgorithm, vs...)) } // AlgorithmGT applies the GT predicate on the "algorithm" field. func AlgorithmGT(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldGT(FieldAlgorithm, v)) } // AlgorithmGTE applies the GTE predicate on the "algorithm" field. func AlgorithmGTE(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldGTE(FieldAlgorithm, v)) } // AlgorithmLT applies the LT predicate on the "algorithm" field. func AlgorithmLT(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldLT(FieldAlgorithm, v)) } // AlgorithmLTE applies the LTE predicate on the "algorithm" field. func AlgorithmLTE(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldLTE(FieldAlgorithm, v)) } // AlgorithmContains applies the Contains predicate on the "algorithm" field. func AlgorithmContains(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldContains(FieldAlgorithm, v)) } // AlgorithmHasPrefix applies the HasPrefix predicate on the "algorithm" field. func AlgorithmHasPrefix(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldHasPrefix(FieldAlgorithm, v)) } // AlgorithmHasSuffix applies the HasSuffix predicate on the "algorithm" field. func AlgorithmHasSuffix(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldHasSuffix(FieldAlgorithm, v)) } // AlgorithmEqualFold applies the EqualFold predicate on the "algorithm" field. func AlgorithmEqualFold(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldEqualFold(FieldAlgorithm, v)) } // AlgorithmContainsFold applies the ContainsFold predicate on the "algorithm" field. func AlgorithmContainsFold(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldContainsFold(FieldAlgorithm, v)) } // ValueEQ applies the EQ predicate on the "value" field. func ValueEQ(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldEQ(FieldValue, v)) } // ValueNEQ applies the NEQ predicate on the "value" field. func ValueNEQ(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldNEQ(FieldValue, v)) } // ValueIn applies the In predicate on the "value" field. func ValueIn(vs ...string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldIn(FieldValue, vs...)) } // ValueNotIn applies the NotIn predicate on the "value" field. func ValueNotIn(vs ...string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldNotIn(FieldValue, vs...)) } // ValueGT applies the GT predicate on the "value" field. func ValueGT(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldGT(FieldValue, v)) } // ValueGTE applies the GTE predicate on the "value" field. func ValueGTE(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldGTE(FieldValue, v)) } // ValueLT applies the LT predicate on the "value" field. func ValueLT(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldLT(FieldValue, v)) } // ValueLTE applies the LTE predicate on the "value" field. func ValueLTE(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldLTE(FieldValue, v)) } // ValueContains applies the Contains predicate on the "value" field. func ValueContains(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldContains(FieldValue, v)) } // ValueHasPrefix applies the HasPrefix predicate on the "value" field. func ValueHasPrefix(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldHasPrefix(FieldValue, v)) } // ValueHasSuffix applies the HasSuffix predicate on the "value" field. func ValueHasSuffix(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldHasSuffix(FieldValue, v)) } // ValueEqualFold applies the EqualFold predicate on the "value" field. func ValueEqualFold(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldEqualFold(FieldValue, v)) } // ValueContainsFold applies the ContainsFold predicate on the "value" field. func ValueContainsFold(v string) predicate.PayloadDigest { return predicate.PayloadDigest(sql.FieldContainsFold(FieldValue, v)) } // HasDsse applies the HasEdge predicate on the "dsse" edge. func HasDsse() predicate.PayloadDigest { return predicate.PayloadDigest(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, DsseTable, DsseColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasDsseWith applies the HasEdge predicate on the "dsse" edge with a given conditions (other predicates). func HasDsseWith(preds ...predicate.Dsse) predicate.PayloadDigest { return predicate.PayloadDigest(func(s *sql.Selector) { step := newDsseStep() 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.PayloadDigest) predicate.PayloadDigest { return predicate.PayloadDigest(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.PayloadDigest) predicate.PayloadDigest { return predicate.PayloadDigest(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.PayloadDigest) predicate.PayloadDigest { return predicate.PayloadDigest(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/payloaddigest_create.go000066400000000000000000000172421511066247200253460ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" ) // PayloadDigestCreate is the builder for creating a PayloadDigest entity. type PayloadDigestCreate struct { config mutation *PayloadDigestMutation hooks []Hook } // SetAlgorithm sets the "algorithm" field. func (_c *PayloadDigestCreate) SetAlgorithm(v string) *PayloadDigestCreate { _c.mutation.SetAlgorithm(v) return _c } // SetValue sets the "value" field. func (_c *PayloadDigestCreate) SetValue(v string) *PayloadDigestCreate { _c.mutation.SetValue(v) return _c } // SetID sets the "id" field. func (_c *PayloadDigestCreate) SetID(v uuid.UUID) *PayloadDigestCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *PayloadDigestCreate) SetNillableID(v *uuid.UUID) *PayloadDigestCreate { if v != nil { _c.SetID(*v) } return _c } // SetDsseID sets the "dsse" edge to the Dsse entity by ID. func (_c *PayloadDigestCreate) SetDsseID(id uuid.UUID) *PayloadDigestCreate { _c.mutation.SetDsseID(id) return _c } // SetNillableDsseID sets the "dsse" edge to the Dsse entity by ID if the given value is not nil. func (_c *PayloadDigestCreate) SetNillableDsseID(id *uuid.UUID) *PayloadDigestCreate { if id != nil { _c = _c.SetDsseID(*id) } return _c } // SetDsse sets the "dsse" edge to the Dsse entity. func (_c *PayloadDigestCreate) SetDsse(v *Dsse) *PayloadDigestCreate { return _c.SetDsseID(v.ID) } // Mutation returns the PayloadDigestMutation object of the builder. func (_c *PayloadDigestCreate) Mutation() *PayloadDigestMutation { return _c.mutation } // Save creates the PayloadDigest in the database. func (_c *PayloadDigestCreate) Save(ctx context.Context) (*PayloadDigest, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *PayloadDigestCreate) SaveX(ctx context.Context) *PayloadDigest { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *PayloadDigestCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *PayloadDigestCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *PayloadDigestCreate) defaults() { if _, ok := _c.mutation.ID(); !ok { v := payloaddigest.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *PayloadDigestCreate) check() error { if _, ok := _c.mutation.Algorithm(); !ok { return &ValidationError{Name: "algorithm", err: errors.New(`ent: missing required field "PayloadDigest.algorithm"`)} } if v, ok := _c.mutation.Algorithm(); ok { if err := payloaddigest.AlgorithmValidator(v); err != nil { return &ValidationError{Name: "algorithm", err: fmt.Errorf(`ent: validator failed for field "PayloadDigest.algorithm": %w`, err)} } } if _, ok := _c.mutation.Value(); !ok { return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "PayloadDigest.value"`)} } if v, ok := _c.mutation.Value(); ok { if err := payloaddigest.ValueValidator(v); err != nil { return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "PayloadDigest.value": %w`, err)} } } return nil } func (_c *PayloadDigestCreate) sqlSave(ctx context.Context) (*PayloadDigest, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *PayloadDigestCreate) createSpec() (*PayloadDigest, *sqlgraph.CreateSpec) { var ( _node = &PayloadDigest{config: _c.config} _spec = sqlgraph.NewCreateSpec(payloaddigest.Table, sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.Algorithm(); ok { _spec.SetField(payloaddigest.FieldAlgorithm, field.TypeString, value) _node.Algorithm = value } if value, ok := _c.mutation.Value(); ok { _spec.SetField(payloaddigest.FieldValue, field.TypeString, value) _node.Value = value } if nodes := _c.mutation.DsseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: payloaddigest.DsseTable, Columns: []string{payloaddigest.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.dsse_payload_digests = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // PayloadDigestCreateBulk is the builder for creating many PayloadDigest entities in bulk. type PayloadDigestCreateBulk struct { config err error builders []*PayloadDigestCreate } // Save creates the PayloadDigest entities in the database. func (_c *PayloadDigestCreateBulk) Save(ctx context.Context) ([]*PayloadDigest, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*PayloadDigest, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*PayloadDigestMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *PayloadDigestCreateBulk) SaveX(ctx context.Context) []*PayloadDigest { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *PayloadDigestCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *PayloadDigestCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/payloaddigest_delete.go000066400000000000000000000045431511066247200253450ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/predicate" ) // PayloadDigestDelete is the builder for deleting a PayloadDigest entity. type PayloadDigestDelete struct { config hooks []Hook mutation *PayloadDigestMutation } // Where appends a list predicates to the PayloadDigestDelete builder. func (_d *PayloadDigestDelete) Where(ps ...predicate.PayloadDigest) *PayloadDigestDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *PayloadDigestDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *PayloadDigestDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *PayloadDigestDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(payloaddigest.Table, sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // PayloadDigestDeleteOne is the builder for deleting a single PayloadDigest entity. type PayloadDigestDeleteOne struct { _d *PayloadDigestDelete } // Where appends a list predicates to the PayloadDigestDelete builder. func (_d *PayloadDigestDeleteOne) Where(ps ...predicate.PayloadDigest) *PayloadDigestDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *PayloadDigestDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{payloaddigest.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *PayloadDigestDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/payloaddigest_query.go000066400000000000000000000440451511066247200252510ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/predicate" ) // PayloadDigestQuery is the builder for querying PayloadDigest entities. type PayloadDigestQuery struct { config ctx *QueryContext order []payloaddigest.OrderOption inters []Interceptor predicates []predicate.PayloadDigest withDsse *DsseQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*PayloadDigest) error // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the PayloadDigestQuery builder. func (_q *PayloadDigestQuery) Where(ps ...predicate.PayloadDigest) *PayloadDigestQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *PayloadDigestQuery) Limit(limit int) *PayloadDigestQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *PayloadDigestQuery) Offset(offset int) *PayloadDigestQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *PayloadDigestQuery) Unique(unique bool) *PayloadDigestQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *PayloadDigestQuery) Order(o ...payloaddigest.OrderOption) *PayloadDigestQuery { _q.order = append(_q.order, o...) return _q } // QueryDsse chains the current query on the "dsse" edge. func (_q *PayloadDigestQuery) QueryDsse() *DsseQuery { query := (&DsseClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(payloaddigest.Table, payloaddigest.FieldID, selector), sqlgraph.To(dsse.Table, dsse.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, payloaddigest.DsseTable, payloaddigest.DsseColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first PayloadDigest entity from the query. // Returns a *NotFoundError when no PayloadDigest was found. func (_q *PayloadDigestQuery) First(ctx context.Context) (*PayloadDigest, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{payloaddigest.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *PayloadDigestQuery) FirstX(ctx context.Context) *PayloadDigest { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first PayloadDigest ID from the query. // Returns a *NotFoundError when no PayloadDigest ID was found. func (_q *PayloadDigestQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{payloaddigest.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *PayloadDigestQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single PayloadDigest entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one PayloadDigest entity is found. // Returns a *NotFoundError when no PayloadDigest entities are found. func (_q *PayloadDigestQuery) Only(ctx context.Context) (*PayloadDigest, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{payloaddigest.Label} default: return nil, &NotSingularError{payloaddigest.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *PayloadDigestQuery) OnlyX(ctx context.Context) *PayloadDigest { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only PayloadDigest ID in the query. // Returns a *NotSingularError when more than one PayloadDigest ID is found. // Returns a *NotFoundError when no entities are found. func (_q *PayloadDigestQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{payloaddigest.Label} default: err = &NotSingularError{payloaddigest.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *PayloadDigestQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of PayloadDigests. func (_q *PayloadDigestQuery) All(ctx context.Context) ([]*PayloadDigest, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*PayloadDigest, *PayloadDigestQuery]() return withInterceptors[[]*PayloadDigest](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *PayloadDigestQuery) AllX(ctx context.Context) []*PayloadDigest { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of PayloadDigest IDs. func (_q *PayloadDigestQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(payloaddigest.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *PayloadDigestQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *PayloadDigestQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*PayloadDigestQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *PayloadDigestQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *PayloadDigestQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *PayloadDigestQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the PayloadDigestQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *PayloadDigestQuery) Clone() *PayloadDigestQuery { if _q == nil { return nil } return &PayloadDigestQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]payloaddigest.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.PayloadDigest{}, _q.predicates...), withDsse: _q.withDsse.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithDsse tells the query-builder to eager-load the nodes that are connected to // the "dsse" edge. The optional arguments are used to configure the query builder of the edge. func (_q *PayloadDigestQuery) WithDsse(opts ...func(*DsseQuery)) *PayloadDigestQuery { query := (&DsseClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withDsse = query return _q } // 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 { // Algorithm string `json:"algorithm,omitempty"` // Count int `json:"count,omitempty"` // } // // client.PayloadDigest.Query(). // GroupBy(payloaddigest.FieldAlgorithm). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *PayloadDigestQuery) GroupBy(field string, fields ...string) *PayloadDigestGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &PayloadDigestGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = payloaddigest.Label grbuild.scan = grbuild.Scan return grbuild } // 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 { // Algorithm string `json:"algorithm,omitempty"` // } // // client.PayloadDigest.Query(). // Select(payloaddigest.FieldAlgorithm). // Scan(ctx, &v) func (_q *PayloadDigestQuery) Select(fields ...string) *PayloadDigestSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &PayloadDigestSelect{PayloadDigestQuery: _q} sbuild.label = payloaddigest.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a PayloadDigestSelect configured with the given aggregations. func (_q *PayloadDigestQuery) Aggregate(fns ...AggregateFunc) *PayloadDigestSelect { return _q.Select().Aggregate(fns...) } func (_q *PayloadDigestQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !payloaddigest.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *PayloadDigestQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*PayloadDigest, error) { var ( nodes = []*PayloadDigest{} withFKs = _q.withFKs _spec = _q.querySpec() loadedTypes = [1]bool{ _q.withDsse != nil, } ) if _q.withDsse != nil { withFKs = true } if withFKs { _spec.Node.Columns = append(_spec.Node.Columns, payloaddigest.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]any, error) { return (*PayloadDigest).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &PayloadDigest{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withDsse; query != nil { if err := _q.loadDsse(ctx, query, nodes, nil, func(n *PayloadDigest, e *Dsse) { n.Edges.Dsse = e }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *PayloadDigestQuery) loadDsse(ctx context.Context, query *DsseQuery, nodes []*PayloadDigest, init func(*PayloadDigest), assign func(*PayloadDigest, *Dsse)) error { ids := make([]uuid.UUID, 0, len(nodes)) nodeids := make(map[uuid.UUID][]*PayloadDigest) for i := range nodes { if nodes[i].dsse_payload_digests == nil { continue } fk := *nodes[i].dsse_payload_digests if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(dsse.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "dsse_payload_digests" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil } func (_q *PayloadDigestQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *PayloadDigestQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(payloaddigest.Table, payloaddigest.Columns, sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, payloaddigest.FieldID) for i := range fields { if fields[i] != payloaddigest.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *PayloadDigestQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(payloaddigest.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = payloaddigest.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // PayloadDigestGroupBy is the group-by builder for PayloadDigest entities. type PayloadDigestGroupBy struct { selector build *PayloadDigestQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *PayloadDigestGroupBy) Aggregate(fns ...AggregateFunc) *PayloadDigestGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *PayloadDigestGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*PayloadDigestQuery, *PayloadDigestGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *PayloadDigestGroupBy) sqlScan(ctx context.Context, root *PayloadDigestQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // PayloadDigestSelect is the builder for selecting fields of PayloadDigest entities. type PayloadDigestSelect struct { *PayloadDigestQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *PayloadDigestSelect) Aggregate(fns ...AggregateFunc) *PayloadDigestSelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *PayloadDigestSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*PayloadDigestQuery, *PayloadDigestSelect](ctx, _s.PayloadDigestQuery, _s, _s.inters, v) } func (_s *PayloadDigestSelect) sqlScan(ctx context.Context, root *PayloadDigestQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/payloaddigest_update.go000066400000000000000000000272301511066247200253630ustar00rootroot00000000000000// Code generated by ent, 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/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/predicate" ) // PayloadDigestUpdate is the builder for updating PayloadDigest entities. type PayloadDigestUpdate struct { config hooks []Hook mutation *PayloadDigestMutation } // Where appends a list predicates to the PayloadDigestUpdate builder. func (_u *PayloadDigestUpdate) Where(ps ...predicate.PayloadDigest) *PayloadDigestUpdate { _u.mutation.Where(ps...) return _u } // SetAlgorithm sets the "algorithm" field. func (_u *PayloadDigestUpdate) SetAlgorithm(v string) *PayloadDigestUpdate { _u.mutation.SetAlgorithm(v) return _u } // SetNillableAlgorithm sets the "algorithm" field if the given value is not nil. func (_u *PayloadDigestUpdate) SetNillableAlgorithm(v *string) *PayloadDigestUpdate { if v != nil { _u.SetAlgorithm(*v) } return _u } // SetValue sets the "value" field. func (_u *PayloadDigestUpdate) SetValue(v string) *PayloadDigestUpdate { _u.mutation.SetValue(v) return _u } // SetNillableValue sets the "value" field if the given value is not nil. func (_u *PayloadDigestUpdate) SetNillableValue(v *string) *PayloadDigestUpdate { if v != nil { _u.SetValue(*v) } return _u } // SetDsseID sets the "dsse" edge to the Dsse entity by ID. func (_u *PayloadDigestUpdate) SetDsseID(id uuid.UUID) *PayloadDigestUpdate { _u.mutation.SetDsseID(id) return _u } // SetNillableDsseID sets the "dsse" edge to the Dsse entity by ID if the given value is not nil. func (_u *PayloadDigestUpdate) SetNillableDsseID(id *uuid.UUID) *PayloadDigestUpdate { if id != nil { _u = _u.SetDsseID(*id) } return _u } // SetDsse sets the "dsse" edge to the Dsse entity. func (_u *PayloadDigestUpdate) SetDsse(v *Dsse) *PayloadDigestUpdate { return _u.SetDsseID(v.ID) } // Mutation returns the PayloadDigestMutation object of the builder. func (_u *PayloadDigestUpdate) Mutation() *PayloadDigestMutation { return _u.mutation } // ClearDsse clears the "dsse" edge to the Dsse entity. func (_u *PayloadDigestUpdate) ClearDsse() *PayloadDigestUpdate { _u.mutation.ClearDsse() return _u } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *PayloadDigestUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *PayloadDigestUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *PayloadDigestUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *PayloadDigestUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *PayloadDigestUpdate) check() error { if v, ok := _u.mutation.Algorithm(); ok { if err := payloaddigest.AlgorithmValidator(v); err != nil { return &ValidationError{Name: "algorithm", err: fmt.Errorf(`ent: validator failed for field "PayloadDigest.algorithm": %w`, err)} } } if v, ok := _u.mutation.Value(); ok { if err := payloaddigest.ValueValidator(v); err != nil { return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "PayloadDigest.value": %w`, err)} } } return nil } func (_u *PayloadDigestUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(payloaddigest.Table, payloaddigest.Columns, sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Algorithm(); ok { _spec.SetField(payloaddigest.FieldAlgorithm, field.TypeString, value) } if value, ok := _u.mutation.Value(); ok { _spec.SetField(payloaddigest.FieldValue, field.TypeString, value) } if _u.mutation.DsseCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: payloaddigest.DsseTable, Columns: []string{payloaddigest.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.DsseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: payloaddigest.DsseTable, Columns: []string{payloaddigest.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{payloaddigest.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // PayloadDigestUpdateOne is the builder for updating a single PayloadDigest entity. type PayloadDigestUpdateOne struct { config fields []string hooks []Hook mutation *PayloadDigestMutation } // SetAlgorithm sets the "algorithm" field. func (_u *PayloadDigestUpdateOne) SetAlgorithm(v string) *PayloadDigestUpdateOne { _u.mutation.SetAlgorithm(v) return _u } // SetNillableAlgorithm sets the "algorithm" field if the given value is not nil. func (_u *PayloadDigestUpdateOne) SetNillableAlgorithm(v *string) *PayloadDigestUpdateOne { if v != nil { _u.SetAlgorithm(*v) } return _u } // SetValue sets the "value" field. func (_u *PayloadDigestUpdateOne) SetValue(v string) *PayloadDigestUpdateOne { _u.mutation.SetValue(v) return _u } // SetNillableValue sets the "value" field if the given value is not nil. func (_u *PayloadDigestUpdateOne) SetNillableValue(v *string) *PayloadDigestUpdateOne { if v != nil { _u.SetValue(*v) } return _u } // SetDsseID sets the "dsse" edge to the Dsse entity by ID. func (_u *PayloadDigestUpdateOne) SetDsseID(id uuid.UUID) *PayloadDigestUpdateOne { _u.mutation.SetDsseID(id) return _u } // SetNillableDsseID sets the "dsse" edge to the Dsse entity by ID if the given value is not nil. func (_u *PayloadDigestUpdateOne) SetNillableDsseID(id *uuid.UUID) *PayloadDigestUpdateOne { if id != nil { _u = _u.SetDsseID(*id) } return _u } // SetDsse sets the "dsse" edge to the Dsse entity. func (_u *PayloadDigestUpdateOne) SetDsse(v *Dsse) *PayloadDigestUpdateOne { return _u.SetDsseID(v.ID) } // Mutation returns the PayloadDigestMutation object of the builder. func (_u *PayloadDigestUpdateOne) Mutation() *PayloadDigestMutation { return _u.mutation } // ClearDsse clears the "dsse" edge to the Dsse entity. func (_u *PayloadDigestUpdateOne) ClearDsse() *PayloadDigestUpdateOne { _u.mutation.ClearDsse() return _u } // Where appends a list predicates to the PayloadDigestUpdate builder. func (_u *PayloadDigestUpdateOne) Where(ps ...predicate.PayloadDigest) *PayloadDigestUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *PayloadDigestUpdateOne) Select(field string, fields ...string) *PayloadDigestUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated PayloadDigest entity. func (_u *PayloadDigestUpdateOne) Save(ctx context.Context) (*PayloadDigest, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *PayloadDigestUpdateOne) SaveX(ctx context.Context) *PayloadDigest { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *PayloadDigestUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *PayloadDigestUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *PayloadDigestUpdateOne) check() error { if v, ok := _u.mutation.Algorithm(); ok { if err := payloaddigest.AlgorithmValidator(v); err != nil { return &ValidationError{Name: "algorithm", err: fmt.Errorf(`ent: validator failed for field "PayloadDigest.algorithm": %w`, err)} } } if v, ok := _u.mutation.Value(); ok { if err := payloaddigest.ValueValidator(v); err != nil { return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "PayloadDigest.value": %w`, err)} } } return nil } func (_u *PayloadDigestUpdateOne) sqlSave(ctx context.Context) (_node *PayloadDigest, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(payloaddigest.Table, payloaddigest.Columns, sqlgraph.NewFieldSpec(payloaddigest.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "PayloadDigest.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, payloaddigest.FieldID) for _, f := range fields { if !payloaddigest.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != payloaddigest.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Algorithm(); ok { _spec.SetField(payloaddigest.FieldAlgorithm, field.TypeString, value) } if value, ok := _u.mutation.Value(); ok { _spec.SetField(payloaddigest.FieldValue, field.TypeString, value) } if _u.mutation.DsseCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: payloaddigest.DsseTable, Columns: []string{payloaddigest.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.DsseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: payloaddigest.DsseTable, Columns: []string{payloaddigest.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &PayloadDigest{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{payloaddigest.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/predicate/000077500000000000000000000000001511066247200225755ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/predicate/predicate.go000066400000000000000000000022051511066247200250630ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package predicate import ( "entgo.io/ent/dialect/sql" ) // Attestation is the predicate function for attestation builders. type Attestation func(*sql.Selector) // AttestationCollection is the predicate function for attestationcollection builders. type AttestationCollection func(*sql.Selector) // AttestationPolicy is the predicate function for attestationpolicy builders. type AttestationPolicy func(*sql.Selector) // Dsse is the predicate function for dsse builders. type Dsse func(*sql.Selector) // PayloadDigest is the predicate function for payloaddigest builders. type PayloadDigest func(*sql.Selector) // Signature is the predicate function for signature builders. type Signature func(*sql.Selector) // Statement is the predicate function for statement builders. type Statement func(*sql.Selector) // Subject is the predicate function for subject builders. type Subject func(*sql.Selector) // SubjectDigest is the predicate function for subjectdigest builders. type SubjectDigest func(*sql.Selector) // Timestamp is the predicate function for timestamp builders. type Timestamp func(*sql.Selector) golang-github-in-toto-archivista-0.11.1/ent/runtime.go000066400000000000000000000213101511066247200226440ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "time" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestation" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/payloaddigest" "github.com/in-toto/archivista/ent/schema" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" "github.com/in-toto/archivista/ent/timestamp" ) // 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() { attestationFields := schema.Attestation{}.Fields() _ = attestationFields // attestationDescType is the schema descriptor for type field. attestationDescType := attestationFields[1].Descriptor() // attestation.TypeValidator is a validator for the "type" field. It is called by the builders before save. attestation.TypeValidator = attestationDescType.Validators[0].(func(string) error) // attestationDescID is the schema descriptor for id field. attestationDescID := attestationFields[0].Descriptor() // attestation.DefaultID holds the default value on creation for the id field. attestation.DefaultID = attestationDescID.Default.(func() uuid.UUID) attestationcollectionFields := schema.AttestationCollection{}.Fields() _ = attestationcollectionFields // attestationcollectionDescName is the schema descriptor for name field. attestationcollectionDescName := attestationcollectionFields[1].Descriptor() // attestationcollection.NameValidator is a validator for the "name" field. It is called by the builders before save. attestationcollection.NameValidator = attestationcollectionDescName.Validators[0].(func(string) error) // attestationcollectionDescID is the schema descriptor for id field. attestationcollectionDescID := attestationcollectionFields[0].Descriptor() // attestationcollection.DefaultID holds the default value on creation for the id field. attestationcollection.DefaultID = attestationcollectionDescID.Default.(func() uuid.UUID) attestationpolicyFields := schema.AttestationPolicy{}.Fields() _ = attestationpolicyFields // attestationpolicyDescName is the schema descriptor for name field. attestationpolicyDescName := attestationpolicyFields[1].Descriptor() // attestationpolicy.NameValidator is a validator for the "name" field. It is called by the builders before save. attestationpolicy.NameValidator = attestationpolicyDescName.Validators[0].(func(string) error) // attestationpolicyDescID is the schema descriptor for id field. attestationpolicyDescID := attestationpolicyFields[0].Descriptor() // attestationpolicy.DefaultID holds the default value on creation for the id field. attestationpolicy.DefaultID = attestationpolicyDescID.Default.(func() uuid.UUID) dsseFields := schema.Dsse{}.Fields() _ = dsseFields // dsseDescCreatedAt is the schema descriptor for created_at field. dsseDescCreatedAt := dsseFields[1].Descriptor() // dsse.DefaultCreatedAt holds the default value on creation for the created_at field. dsse.DefaultCreatedAt = dsseDescCreatedAt.Default.(func() time.Time) // dsseDescGitoidSha256 is the schema descriptor for gitoid_sha256 field. dsseDescGitoidSha256 := dsseFields[2].Descriptor() // dsse.GitoidSha256Validator is a validator for the "gitoid_sha256" field. It is called by the builders before save. dsse.GitoidSha256Validator = dsseDescGitoidSha256.Validators[0].(func(string) error) // dsseDescPayloadType is the schema descriptor for payload_type field. dsseDescPayloadType := dsseFields[3].Descriptor() // dsse.PayloadTypeValidator is a validator for the "payload_type" field. It is called by the builders before save. dsse.PayloadTypeValidator = dsseDescPayloadType.Validators[0].(func(string) error) // dsseDescID is the schema descriptor for id field. dsseDescID := dsseFields[0].Descriptor() // dsse.DefaultID holds the default value on creation for the id field. dsse.DefaultID = dsseDescID.Default.(func() uuid.UUID) payloaddigestFields := schema.PayloadDigest{}.Fields() _ = payloaddigestFields // payloaddigestDescAlgorithm is the schema descriptor for algorithm field. payloaddigestDescAlgorithm := payloaddigestFields[1].Descriptor() // payloaddigest.AlgorithmValidator is a validator for the "algorithm" field. It is called by the builders before save. payloaddigest.AlgorithmValidator = payloaddigestDescAlgorithm.Validators[0].(func(string) error) // payloaddigestDescValue is the schema descriptor for value field. payloaddigestDescValue := payloaddigestFields[2].Descriptor() // payloaddigest.ValueValidator is a validator for the "value" field. It is called by the builders before save. payloaddigest.ValueValidator = payloaddigestDescValue.Validators[0].(func(string) error) // payloaddigestDescID is the schema descriptor for id field. payloaddigestDescID := payloaddigestFields[0].Descriptor() // payloaddigest.DefaultID holds the default value on creation for the id field. payloaddigest.DefaultID = payloaddigestDescID.Default.(func() uuid.UUID) signatureFields := schema.Signature{}.Fields() _ = signatureFields // signatureDescSignature is the schema descriptor for signature field. signatureDescSignature := signatureFields[2].Descriptor() // signature.SignatureValidator is a validator for the "signature" field. It is called by the builders before save. signature.SignatureValidator = signatureDescSignature.Validators[0].(func(string) error) // signatureDescID is the schema descriptor for id field. signatureDescID := signatureFields[0].Descriptor() // signature.DefaultID holds the default value on creation for the id field. signature.DefaultID = signatureDescID.Default.(func() uuid.UUID) statementFields := schema.Statement{}.Fields() _ = statementFields // statementDescPredicate is the schema descriptor for predicate field. statementDescPredicate := statementFields[1].Descriptor() // statement.PredicateValidator is a validator for the "predicate" field. It is called by the builders before save. statement.PredicateValidator = statementDescPredicate.Validators[0].(func(string) error) // statementDescID is the schema descriptor for id field. statementDescID := statementFields[0].Descriptor() // statement.DefaultID holds the default value on creation for the id field. statement.DefaultID = statementDescID.Default.(func() uuid.UUID) subjectFields := schema.Subject{}.Fields() _ = subjectFields // subjectDescCreatedAt is the schema descriptor for created_at field. subjectDescCreatedAt := subjectFields[1].Descriptor() // subject.DefaultCreatedAt holds the default value on creation for the created_at field. subject.DefaultCreatedAt = subjectDescCreatedAt.Default.(func() time.Time) // subjectDescName is the schema descriptor for name field. subjectDescName := subjectFields[2].Descriptor() // subject.NameValidator is a validator for the "name" field. It is called by the builders before save. subject.NameValidator = subjectDescName.Validators[0].(func(string) error) // subjectDescID is the schema descriptor for id field. subjectDescID := subjectFields[0].Descriptor() // subject.DefaultID holds the default value on creation for the id field. subject.DefaultID = subjectDescID.Default.(func() uuid.UUID) subjectdigestFields := schema.SubjectDigest{}.Fields() _ = subjectdigestFields // subjectdigestDescAlgorithm is the schema descriptor for algorithm field. subjectdigestDescAlgorithm := subjectdigestFields[1].Descriptor() // subjectdigest.AlgorithmValidator is a validator for the "algorithm" field. It is called by the builders before save. subjectdigest.AlgorithmValidator = subjectdigestDescAlgorithm.Validators[0].(func(string) error) // subjectdigestDescValue is the schema descriptor for value field. subjectdigestDescValue := subjectdigestFields[2].Descriptor() // subjectdigest.ValueValidator is a validator for the "value" field. It is called by the builders before save. subjectdigest.ValueValidator = subjectdigestDescValue.Validators[0].(func(string) error) // subjectdigestDescID is the schema descriptor for id field. subjectdigestDescID := subjectdigestFields[0].Descriptor() // subjectdigest.DefaultID holds the default value on creation for the id field. subjectdigest.DefaultID = subjectdigestDescID.Default.(func() uuid.UUID) timestampFields := schema.Timestamp{}.Fields() _ = timestampFields // timestampDescID is the schema descriptor for id field. timestampDescID := timestampFields[0].Descriptor() // timestamp.DefaultID holds the default value on creation for the id field. timestamp.DefaultID = timestampDescID.Default.(func() uuid.UUID) } golang-github-in-toto-archivista-0.11.1/ent/runtime/000077500000000000000000000000001511066247200223205ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/runtime/runtime.go000066400000000000000000000005131511066247200243310ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package runtime // The schema-stitching logic is generated in github.com/in-toto/archivista/ent/runtime.go const ( Version = "v0.14.5" // Version of ent codegen. Sum = "h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=" // Sum of ent codegen. ) golang-github-in-toto-archivista-0.11.1/ent/schema/000077500000000000000000000000001511066247200220755ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/schema/attestation.go000066400000000000000000000024541511066247200247700ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package schema import ( "entgo.io/ent" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/google/uuid" ) // Attestation represents an attestation from a witness attestation collection type Attestation struct { ent.Schema } func (Attestation) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.String("type").NotEmpty(), } } func (Attestation) Edges() []ent.Edge { return []ent.Edge{ edge.From("attestation_collection", AttestationCollection.Type).Ref("attestations").Unique().Required(), } } func (Attestation) Indexes() []ent.Index { return []ent.Index{ index.Fields("type"), } } golang-github-in-toto-archivista-0.11.1/ent/schema/attestationcollection.go000066400000000000000000000025511511066247200270420ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package schema import ( "entgo.io/ent" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/google/uuid" ) // AttestationCollection represents a witness attestation collection type AttestationCollection struct { ent.Schema } func (AttestationCollection) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.String("name").NotEmpty(), } } func (AttestationCollection) Edges() []ent.Edge { return []ent.Edge{ edge.To("attestations", Attestation.Type), edge.From("statement", Statement.Type).Ref("attestation_collections").Unique().Required(), } } func (AttestationCollection) Indexes() []ent.Index { return []ent.Index{ index.Fields("name"), } } golang-github-in-toto-archivista-0.11.1/ent/schema/attestationpolicy.go000066400000000000000000000030061511066247200262020ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package schema import ( "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/google/uuid" ) // Attestation represents an attestation from a witness attestation collection type AttestationPolicy struct { ent.Schema } func (AttestationPolicy) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.String("name").NotEmpty(), } } // Edges of the AttestationPolicy. func (AttestationPolicy) Edges() []ent.Edge { return []ent.Edge{ edge.From("statement", Statement.Type). Ref("policy").Unique(), } } func (AttestationPolicy) Indexes() []ent.Index { return []ent.Index{ index.Fields("name"), } } func (AttestationPolicy) Annotations() []schema.Annotation { return []schema.Annotation{ entgql.RelayConnection(), entgql.QueryField(), } } golang-github-in-toto-archivista-0.11.1/ent/schema/dsse.go000066400000000000000000000031411511066247200233610ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package schema import ( "time" "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "github.com/google/uuid" ) // Dsse represents some metadata about an archived DSSE envelope type Dsse struct { ent.Schema } // Fields of the Statement. func (Dsse) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.Time("created_at").Default(time.Now).Immutable().Optional().Nillable().Annotations(entgql.OrderField("CREATED_AT")), field.String("gitoid_sha256").NotEmpty().Unique(), field.String("payload_type").NotEmpty(), } } // Edges of the Statement. func (Dsse) Edges() []ent.Edge { return []ent.Edge{ edge.To("statement", Statement.Type).Unique(), edge.To("signatures", Signature.Type), edge.To("payload_digests", PayloadDigest.Type), } } func (Dsse) Annotations() []schema.Annotation { return []schema.Annotation{ entgql.RelayConnection(), entgql.QueryField(), } } golang-github-in-toto-archivista-0.11.1/ent/schema/payloaddigest.go000066400000000000000000000025461511066247200252640ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package schema import ( "entgo.io/ent" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/google/uuid" ) // PayloadDigest represents the digest of the payload of a DSSE envelope type PayloadDigest struct { ent.Schema } // Fields of the Digest. func (PayloadDigest) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.String("algorithm").NotEmpty(), field.String("value").NotEmpty(), } } // Edges of the Digest. func (PayloadDigest) Edges() []ent.Edge { return []ent.Edge{ edge.From("dsse", Dsse.Type). Ref("payload_digests"). Unique(), } } func (PayloadDigest) Indexes() []ent.Index { return []ent.Index{ index.Fields("value"), } } golang-github-in-toto-archivista-0.11.1/ent/schema/signature.go000066400000000000000000000026511511066247200244310ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package schema import ( "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/google/uuid" ) // Signature represents signatures on a DSSE envelope type Signature struct { ent.Schema } // Fields of the Signature. func (Signature) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.String("key_id"), field.String("signature").NotEmpty().SchemaType(map[string]string{dialect.MySQL: "text"}), } } // Edges of the Signature. func (Signature) Edges() []ent.Edge { return []ent.Edge{ edge.From("dsse", Dsse.Type).Ref("signatures").Unique(), edge.To("timestamps", Timestamp.Type), } } func (Signature) Indexes() []ent.Index { return []ent.Index{ index.Fields("key_id"), } } golang-github-in-toto-archivista-0.11.1/ent/schema/statement.go000066400000000000000000000030201511066247200244230ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package schema import ( "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/google/uuid" ) // Statement represents an in-toto statement from an archived dsse envelope type Statement struct { ent.Schema } // Fields of the Statement. func (Statement) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.String("predicate").NotEmpty(), } } // Edges of the Statement. func (Statement) Edges() []ent.Edge { return []ent.Edge{ edge.To("subjects", Subject.Type).Annotations(entgql.RelayConnection()), edge.To("policy", AttestationPolicy.Type).Unique(), edge.To("attestation_collections", AttestationCollection.Type).Unique(), edge.From("dsse", Dsse.Type).Ref("statement"), } } func (Statement) Indexes() []ent.Index { return []ent.Index{ index.Fields("predicate"), } } golang-github-in-toto-archivista-0.11.1/ent/schema/subject.go000066400000000000000000000032521511066247200240650ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package schema import ( "time" "entgo.io/contrib/entgql" "entgo.io/ent" "entgo.io/ent/schema" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/google/uuid" ) // Subject represents subjects from an in-toto statement. type Subject struct { ent.Schema } // Fields of the Subject. func (Subject) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.Time("created_at").Default(time.Now).Immutable().Optional().Nillable().Annotations(entgql.OrderField("CREATED_AT")), field.String("name").NotEmpty(), } } // Edges of the Subject. func (Subject) Edges() []ent.Edge { return []ent.Edge{ edge.To("subject_digests", SubjectDigest.Type), edge.From("statement", Statement.Type). Ref("subjects").Unique(), } } func (Subject) Indexes() []ent.Index { return []ent.Index{ // Index on the "name" field. index.Fields("name"), } } func (Subject) Annotations() []schema.Annotation { return []schema.Annotation{ entgql.RelayConnection(), entgql.QueryField(), } } golang-github-in-toto-archivista-0.11.1/ent/schema/subjectdigest.go000066400000000000000000000026231511066247200252660ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package schema import ( "entgo.io/ent" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" "github.com/google/uuid" ) // SubjectDigest represents the digests of a subject from an in-toto statement type SubjectDigest struct { ent.Schema } // Fields of the Digest. func (SubjectDigest) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.String("algorithm").NotEmpty(), field.String("value").NotEmpty(), } } // Edges of the Digest. func (SubjectDigest) Edges() []ent.Edge { return []ent.Edge{ edge.From("subject", Subject.Type). Ref("subject_digests"). Unique(), } } func (SubjectDigest) Indexes() []ent.Index { return []ent.Index{ // Index on the "value" field. index.Fields("value"), } } golang-github-in-toto-archivista-0.11.1/ent/schema/timestamp.go000066400000000000000000000021061511066247200244260ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package schema import ( "entgo.io/ent" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "github.com/google/uuid" ) type Timestamp struct { ent.Schema } func (Timestamp) Fields() []ent.Field { return []ent.Field{ field.UUID("id", uuid.UUID{}).Default(uuid.New).Immutable().Unique(), field.String("type"), field.Time("timestamp"), } } func (Timestamp) Edges() []ent.Edge { return []ent.Edge{ edge.From("signature", Signature.Type).Ref("timestamps").Unique(), } } golang-github-in-toto-archivista-0.11.1/ent/schema/uuidgql/000077500000000000000000000000001511066247200235475ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/schema/uuidgql/uuidgql.go000066400000000000000000000020321511066247200255450ustar00rootroot00000000000000// Copyright 2019-present Facebook // // 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. package uuidgql import ( "fmt" "io" "strconv" "github.com/99designs/gqlgen/graphql" "github.com/google/uuid" ) func MarshalUUID(u uuid.UUID) graphql.Marshaler { return graphql.WriterFunc(func(w io.Writer) { _, _ = io.WriteString(w, strconv.Quote(u.String())) }) } func UnmarshalUUID(v interface{}) (u uuid.UUID, err error) { s, ok := v.(string) if !ok { return u, fmt.Errorf("invalid type %T, expect string", v) } return uuid.Parse(s) } golang-github-in-toto-archivista-0.11.1/ent/signature.go000066400000000000000000000145701511066247200231740ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/signature" ) // Signature is the model entity for the Signature schema. type Signature struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // KeyID holds the value of the "key_id" field. KeyID string `json:"key_id,omitempty"` // Signature holds the value of the "signature" field. Signature string `json:"signature,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the SignatureQuery when eager-loading is set. Edges SignatureEdges `json:"edges"` dsse_signatures *uuid.UUID selectValues sql.SelectValues } // SignatureEdges holds the relations/edges for other nodes in the graph. type SignatureEdges struct { // Dsse holds the value of the dsse edge. Dsse *Dsse `json:"dsse,omitempty"` // Timestamps holds the value of the timestamps edge. Timestamps []*Timestamp `json:"timestamps,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [2]bool // totalCount holds the count of the edges above. totalCount [2]map[string]int namedTimestamps map[string][]*Timestamp } // DsseOrErr returns the Dsse value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e SignatureEdges) DsseOrErr() (*Dsse, error) { if e.Dsse != nil { return e.Dsse, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: dsse.Label} } return nil, &NotLoadedError{edge: "dsse"} } // TimestampsOrErr returns the Timestamps value or an error if the edge // was not loaded in eager-loading. func (e SignatureEdges) TimestampsOrErr() ([]*Timestamp, error) { if e.loadedTypes[1] { return e.Timestamps, nil } return nil, &NotLoadedError{edge: "timestamps"} } // scanValues returns the types for scanning values from sql.Rows. func (*Signature) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case signature.FieldKeyID, signature.FieldSignature: values[i] = new(sql.NullString) case signature.FieldID: values[i] = new(uuid.UUID) case signature.ForeignKeys[0]: // dsse_signatures values[i] = &sql.NullScanner{S: new(uuid.UUID)} default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Signature fields. func (_m *Signature) assignValues(columns []string, values []any) 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 signature.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case signature.FieldKeyID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field key_id", values[i]) } else if value.Valid { _m.KeyID = value.String } case signature.FieldSignature: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field signature", values[i]) } else if value.Valid { _m.Signature = value.String } case signature.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field dsse_signatures", values[i]) } else if value.Valid { _m.dsse_signatures = new(uuid.UUID) *_m.dsse_signatures = *value.S.(*uuid.UUID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Signature. // This includes values selected through modifiers, order, etc. func (_m *Signature) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QueryDsse queries the "dsse" edge of the Signature entity. func (_m *Signature) QueryDsse() *DsseQuery { return NewSignatureClient(_m.config).QueryDsse(_m) } // QueryTimestamps queries the "timestamps" edge of the Signature entity. func (_m *Signature) QueryTimestamps() *TimestampQuery { return NewSignatureClient(_m.config).QueryTimestamps(_m) } // Update returns a builder for updating this Signature. // Note that you need to call Signature.Unwrap() before calling this method if this Signature // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Signature) Update() *SignatureUpdateOne { return NewSignatureClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Signature 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 (_m *Signature) Unwrap() *Signature { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Signature is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Signature) String() string { var builder strings.Builder builder.WriteString("Signature(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("key_id=") builder.WriteString(_m.KeyID) builder.WriteString(", ") builder.WriteString("signature=") builder.WriteString(_m.Signature) builder.WriteByte(')') return builder.String() } // NamedTimestamps returns the Timestamps named value or an error if the edge was not // loaded in eager-loading with this name. func (_m *Signature) NamedTimestamps(name string) ([]*Timestamp, error) { if _m.Edges.namedTimestamps == nil { return nil, &NotLoadedError{edge: name} } nodes, ok := _m.Edges.namedTimestamps[name] if !ok { return nil, &NotLoadedError{edge: name} } return nodes, nil } func (_m *Signature) appendNamedTimestamps(name string, edges ...*Timestamp) { if _m.Edges.namedTimestamps == nil { _m.Edges.namedTimestamps = make(map[string][]*Timestamp) } if len(edges) == 0 { _m.Edges.namedTimestamps[name] = []*Timestamp{} } else { _m.Edges.namedTimestamps[name] = append(_m.Edges.namedTimestamps[name], edges...) } } // Signatures is a parsable slice of Signature. type Signatures []*Signature golang-github-in-toto-archivista-0.11.1/ent/signature/000077500000000000000000000000001511066247200226365ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/signature/signature.go000066400000000000000000000103251511066247200251670ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package signature import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the signature type in the database. Label = "signature" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldKeyID holds the string denoting the key_id field in the database. FieldKeyID = "key_id" // FieldSignature holds the string denoting the signature field in the database. FieldSignature = "signature" // EdgeDsse holds the string denoting the dsse edge name in mutations. EdgeDsse = "dsse" // EdgeTimestamps holds the string denoting the timestamps edge name in mutations. EdgeTimestamps = "timestamps" // Table holds the table name of the signature in the database. Table = "signatures" // DsseTable is the table that holds the dsse relation/edge. DsseTable = "signatures" // DsseInverseTable is the table name for the Dsse entity. // It exists in this package in order to avoid circular dependency with the "dsse" package. DsseInverseTable = "dsses" // DsseColumn is the table column denoting the dsse relation/edge. DsseColumn = "dsse_signatures" // TimestampsTable is the table that holds the timestamps relation/edge. TimestampsTable = "timestamps" // TimestampsInverseTable is the table name for the Timestamp entity. // It exists in this package in order to avoid circular dependency with the "timestamp" package. TimestampsInverseTable = "timestamps" // TimestampsColumn is the table column denoting the timestamps relation/edge. TimestampsColumn = "signature_timestamps" ) // Columns holds all SQL columns for signature fields. var Columns = []string{ FieldID, FieldKeyID, FieldSignature, } // ForeignKeys holds the SQL foreign-keys that are owned by the "signatures" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "dsse_signatures", } // 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 ( // SignatureValidator is a validator for the "signature" field. It is called by the builders before save. SignatureValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the Signature queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByKeyID orders the results by the key_id field. func ByKeyID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldKeyID, opts...).ToFunc() } // BySignature orders the results by the signature field. func BySignature(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSignature, opts...).ToFunc() } // ByDsseField orders the results by dsse field. func ByDsseField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newDsseStep(), sql.OrderByField(field, opts...)) } } // ByTimestampsCount orders the results by timestamps count. func ByTimestampsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newTimestampsStep(), opts...) } } // ByTimestamps orders the results by timestamps terms. func ByTimestamps(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newTimestampsStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newDsseStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(DsseInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, DsseTable, DsseColumn), ) } func newTimestampsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(TimestampsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, TimestampsTable, TimestampsColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/signature/where.go000066400000000000000000000211421511066247200242770ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package signature import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.Signature { return predicate.Signature(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.Signature { return predicate.Signature(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.Signature { return predicate.Signature(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.Signature { return predicate.Signature(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.Signature { return predicate.Signature(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.Signature { return predicate.Signature(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.Signature { return predicate.Signature(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.Signature { return predicate.Signature(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.Signature { return predicate.Signature(sql.FieldLTE(FieldID, id)) } // KeyID applies equality check predicate on the "key_id" field. It's identical to KeyIDEQ. func KeyID(v string) predicate.Signature { return predicate.Signature(sql.FieldEQ(FieldKeyID, v)) } // Signature applies equality check predicate on the "signature" field. It's identical to SignatureEQ. func Signature(v string) predicate.Signature { return predicate.Signature(sql.FieldEQ(FieldSignature, v)) } // KeyIDEQ applies the EQ predicate on the "key_id" field. func KeyIDEQ(v string) predicate.Signature { return predicate.Signature(sql.FieldEQ(FieldKeyID, v)) } // KeyIDNEQ applies the NEQ predicate on the "key_id" field. func KeyIDNEQ(v string) predicate.Signature { return predicate.Signature(sql.FieldNEQ(FieldKeyID, v)) } // KeyIDIn applies the In predicate on the "key_id" field. func KeyIDIn(vs ...string) predicate.Signature { return predicate.Signature(sql.FieldIn(FieldKeyID, vs...)) } // KeyIDNotIn applies the NotIn predicate on the "key_id" field. func KeyIDNotIn(vs ...string) predicate.Signature { return predicate.Signature(sql.FieldNotIn(FieldKeyID, vs...)) } // KeyIDGT applies the GT predicate on the "key_id" field. func KeyIDGT(v string) predicate.Signature { return predicate.Signature(sql.FieldGT(FieldKeyID, v)) } // KeyIDGTE applies the GTE predicate on the "key_id" field. func KeyIDGTE(v string) predicate.Signature { return predicate.Signature(sql.FieldGTE(FieldKeyID, v)) } // KeyIDLT applies the LT predicate on the "key_id" field. func KeyIDLT(v string) predicate.Signature { return predicate.Signature(sql.FieldLT(FieldKeyID, v)) } // KeyIDLTE applies the LTE predicate on the "key_id" field. func KeyIDLTE(v string) predicate.Signature { return predicate.Signature(sql.FieldLTE(FieldKeyID, v)) } // KeyIDContains applies the Contains predicate on the "key_id" field. func KeyIDContains(v string) predicate.Signature { return predicate.Signature(sql.FieldContains(FieldKeyID, v)) } // KeyIDHasPrefix applies the HasPrefix predicate on the "key_id" field. func KeyIDHasPrefix(v string) predicate.Signature { return predicate.Signature(sql.FieldHasPrefix(FieldKeyID, v)) } // KeyIDHasSuffix applies the HasSuffix predicate on the "key_id" field. func KeyIDHasSuffix(v string) predicate.Signature { return predicate.Signature(sql.FieldHasSuffix(FieldKeyID, v)) } // KeyIDEqualFold applies the EqualFold predicate on the "key_id" field. func KeyIDEqualFold(v string) predicate.Signature { return predicate.Signature(sql.FieldEqualFold(FieldKeyID, v)) } // KeyIDContainsFold applies the ContainsFold predicate on the "key_id" field. func KeyIDContainsFold(v string) predicate.Signature { return predicate.Signature(sql.FieldContainsFold(FieldKeyID, v)) } // SignatureEQ applies the EQ predicate on the "signature" field. func SignatureEQ(v string) predicate.Signature { return predicate.Signature(sql.FieldEQ(FieldSignature, v)) } // SignatureNEQ applies the NEQ predicate on the "signature" field. func SignatureNEQ(v string) predicate.Signature { return predicate.Signature(sql.FieldNEQ(FieldSignature, v)) } // SignatureIn applies the In predicate on the "signature" field. func SignatureIn(vs ...string) predicate.Signature { return predicate.Signature(sql.FieldIn(FieldSignature, vs...)) } // SignatureNotIn applies the NotIn predicate on the "signature" field. func SignatureNotIn(vs ...string) predicate.Signature { return predicate.Signature(sql.FieldNotIn(FieldSignature, vs...)) } // SignatureGT applies the GT predicate on the "signature" field. func SignatureGT(v string) predicate.Signature { return predicate.Signature(sql.FieldGT(FieldSignature, v)) } // SignatureGTE applies the GTE predicate on the "signature" field. func SignatureGTE(v string) predicate.Signature { return predicate.Signature(sql.FieldGTE(FieldSignature, v)) } // SignatureLT applies the LT predicate on the "signature" field. func SignatureLT(v string) predicate.Signature { return predicate.Signature(sql.FieldLT(FieldSignature, v)) } // SignatureLTE applies the LTE predicate on the "signature" field. func SignatureLTE(v string) predicate.Signature { return predicate.Signature(sql.FieldLTE(FieldSignature, v)) } // SignatureContains applies the Contains predicate on the "signature" field. func SignatureContains(v string) predicate.Signature { return predicate.Signature(sql.FieldContains(FieldSignature, v)) } // SignatureHasPrefix applies the HasPrefix predicate on the "signature" field. func SignatureHasPrefix(v string) predicate.Signature { return predicate.Signature(sql.FieldHasPrefix(FieldSignature, v)) } // SignatureHasSuffix applies the HasSuffix predicate on the "signature" field. func SignatureHasSuffix(v string) predicate.Signature { return predicate.Signature(sql.FieldHasSuffix(FieldSignature, v)) } // SignatureEqualFold applies the EqualFold predicate on the "signature" field. func SignatureEqualFold(v string) predicate.Signature { return predicate.Signature(sql.FieldEqualFold(FieldSignature, v)) } // SignatureContainsFold applies the ContainsFold predicate on the "signature" field. func SignatureContainsFold(v string) predicate.Signature { return predicate.Signature(sql.FieldContainsFold(FieldSignature, v)) } // HasDsse applies the HasEdge predicate on the "dsse" edge. func HasDsse() predicate.Signature { return predicate.Signature(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, DsseTable, DsseColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasDsseWith applies the HasEdge predicate on the "dsse" edge with a given conditions (other predicates). func HasDsseWith(preds ...predicate.Dsse) predicate.Signature { return predicate.Signature(func(s *sql.Selector) { step := newDsseStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) }) } // HasTimestamps applies the HasEdge predicate on the "timestamps" edge. func HasTimestamps() predicate.Signature { return predicate.Signature(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, TimestampsTable, TimestampsColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasTimestampsWith applies the HasEdge predicate on the "timestamps" edge with a given conditions (other predicates). func HasTimestampsWith(preds ...predicate.Timestamp) predicate.Signature { return predicate.Signature(func(s *sql.Selector) { step := newTimestampsStep() 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.Signature) predicate.Signature { return predicate.Signature(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Signature) predicate.Signature { return predicate.Signature(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Signature) predicate.Signature { return predicate.Signature(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/signature_create.go000066400000000000000000000202641511066247200245140ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/timestamp" ) // SignatureCreate is the builder for creating a Signature entity. type SignatureCreate struct { config mutation *SignatureMutation hooks []Hook } // SetKeyID sets the "key_id" field. func (_c *SignatureCreate) SetKeyID(v string) *SignatureCreate { _c.mutation.SetKeyID(v) return _c } // SetSignature sets the "signature" field. func (_c *SignatureCreate) SetSignature(v string) *SignatureCreate { _c.mutation.SetSignature(v) return _c } // SetID sets the "id" field. func (_c *SignatureCreate) SetID(v uuid.UUID) *SignatureCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *SignatureCreate) SetNillableID(v *uuid.UUID) *SignatureCreate { if v != nil { _c.SetID(*v) } return _c } // SetDsseID sets the "dsse" edge to the Dsse entity by ID. func (_c *SignatureCreate) SetDsseID(id uuid.UUID) *SignatureCreate { _c.mutation.SetDsseID(id) return _c } // SetNillableDsseID sets the "dsse" edge to the Dsse entity by ID if the given value is not nil. func (_c *SignatureCreate) SetNillableDsseID(id *uuid.UUID) *SignatureCreate { if id != nil { _c = _c.SetDsseID(*id) } return _c } // SetDsse sets the "dsse" edge to the Dsse entity. func (_c *SignatureCreate) SetDsse(v *Dsse) *SignatureCreate { return _c.SetDsseID(v.ID) } // AddTimestampIDs adds the "timestamps" edge to the Timestamp entity by IDs. func (_c *SignatureCreate) AddTimestampIDs(ids ...uuid.UUID) *SignatureCreate { _c.mutation.AddTimestampIDs(ids...) return _c } // AddTimestamps adds the "timestamps" edges to the Timestamp entity. func (_c *SignatureCreate) AddTimestamps(v ...*Timestamp) *SignatureCreate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _c.AddTimestampIDs(ids...) } // Mutation returns the SignatureMutation object of the builder. func (_c *SignatureCreate) Mutation() *SignatureMutation { return _c.mutation } // Save creates the Signature in the database. func (_c *SignatureCreate) Save(ctx context.Context) (*Signature, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *SignatureCreate) SaveX(ctx context.Context) *Signature { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *SignatureCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *SignatureCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *SignatureCreate) defaults() { if _, ok := _c.mutation.ID(); !ok { v := signature.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *SignatureCreate) check() error { if _, ok := _c.mutation.KeyID(); !ok { return &ValidationError{Name: "key_id", err: errors.New(`ent: missing required field "Signature.key_id"`)} } if _, ok := _c.mutation.Signature(); !ok { return &ValidationError{Name: "signature", err: errors.New(`ent: missing required field "Signature.signature"`)} } if v, ok := _c.mutation.Signature(); ok { if err := signature.SignatureValidator(v); err != nil { return &ValidationError{Name: "signature", err: fmt.Errorf(`ent: validator failed for field "Signature.signature": %w`, err)} } } return nil } func (_c *SignatureCreate) sqlSave(ctx context.Context) (*Signature, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *SignatureCreate) createSpec() (*Signature, *sqlgraph.CreateSpec) { var ( _node = &Signature{config: _c.config} _spec = sqlgraph.NewCreateSpec(signature.Table, sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.KeyID(); ok { _spec.SetField(signature.FieldKeyID, field.TypeString, value) _node.KeyID = value } if value, ok := _c.mutation.Signature(); ok { _spec.SetField(signature.FieldSignature, field.TypeString, value) _node.Signature = value } if nodes := _c.mutation.DsseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: signature.DsseTable, Columns: []string{signature.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.dsse_signatures = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.TimestampsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: signature.TimestampsTable, Columns: []string{signature.TimestampsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // SignatureCreateBulk is the builder for creating many Signature entities in bulk. type SignatureCreateBulk struct { config err error builders []*SignatureCreate } // Save creates the Signature entities in the database. func (_c *SignatureCreateBulk) Save(ctx context.Context) ([]*Signature, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*Signature, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*SignatureMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *SignatureCreateBulk) SaveX(ctx context.Context) []*Signature { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *SignatureCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *SignatureCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/signature_delete.go000066400000000000000000000043771511066247200245220ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/signature" ) // SignatureDelete is the builder for deleting a Signature entity. type SignatureDelete struct { config hooks []Hook mutation *SignatureMutation } // Where appends a list predicates to the SignatureDelete builder. func (_d *SignatureDelete) Where(ps ...predicate.Signature) *SignatureDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *SignatureDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *SignatureDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *SignatureDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(signature.Table, sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // SignatureDeleteOne is the builder for deleting a single Signature entity. type SignatureDeleteOne struct { _d *SignatureDelete } // Where appends a list predicates to the SignatureDelete builder. func (_d *SignatureDeleteOne) Where(ps ...predicate.Signature) *SignatureDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *SignatureDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{signature.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *SignatureDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/signature_query.go000066400000000000000000000517661511066247200244310ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/timestamp" ) // SignatureQuery is the builder for querying Signature entities. type SignatureQuery struct { config ctx *QueryContext order []signature.OrderOption inters []Interceptor predicates []predicate.Signature withDsse *DsseQuery withTimestamps *TimestampQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*Signature) error withNamedTimestamps map[string]*TimestampQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the SignatureQuery builder. func (_q *SignatureQuery) Where(ps ...predicate.Signature) *SignatureQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *SignatureQuery) Limit(limit int) *SignatureQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *SignatureQuery) Offset(offset int) *SignatureQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *SignatureQuery) Unique(unique bool) *SignatureQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *SignatureQuery) Order(o ...signature.OrderOption) *SignatureQuery { _q.order = append(_q.order, o...) return _q } // QueryDsse chains the current query on the "dsse" edge. func (_q *SignatureQuery) QueryDsse() *DsseQuery { query := (&DsseClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(signature.Table, signature.FieldID, selector), sqlgraph.To(dsse.Table, dsse.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, signature.DsseTable, signature.DsseColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryTimestamps chains the current query on the "timestamps" edge. func (_q *SignatureQuery) QueryTimestamps() *TimestampQuery { query := (&TimestampClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(signature.Table, signature.FieldID, selector), sqlgraph.To(timestamp.Table, timestamp.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, signature.TimestampsTable, signature.TimestampsColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first Signature entity from the query. // Returns a *NotFoundError when no Signature was found. func (_q *SignatureQuery) First(ctx context.Context) (*Signature, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{signature.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *SignatureQuery) FirstX(ctx context.Context) *Signature { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first Signature ID from the query. // Returns a *NotFoundError when no Signature ID was found. func (_q *SignatureQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{signature.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *SignatureQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single Signature entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Signature entity is found. // Returns a *NotFoundError when no Signature entities are found. func (_q *SignatureQuery) Only(ctx context.Context) (*Signature, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{signature.Label} default: return nil, &NotSingularError{signature.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *SignatureQuery) OnlyX(ctx context.Context) *Signature { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only Signature ID in the query. // Returns a *NotSingularError when more than one Signature ID is found. // Returns a *NotFoundError when no entities are found. func (_q *SignatureQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{signature.Label} default: err = &NotSingularError{signature.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *SignatureQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of Signatures. func (_q *SignatureQuery) All(ctx context.Context) ([]*Signature, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Signature, *SignatureQuery]() return withInterceptors[[]*Signature](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *SignatureQuery) AllX(ctx context.Context) []*Signature { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of Signature IDs. func (_q *SignatureQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(signature.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *SignatureQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *SignatureQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*SignatureQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *SignatureQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *SignatureQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *SignatureQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the SignatureQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *SignatureQuery) Clone() *SignatureQuery { if _q == nil { return nil } return &SignatureQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]signature.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.Signature{}, _q.predicates...), withDsse: _q.withDsse.Clone(), withTimestamps: _q.withTimestamps.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithDsse tells the query-builder to eager-load the nodes that are connected to // the "dsse" edge. The optional arguments are used to configure the query builder of the edge. func (_q *SignatureQuery) WithDsse(opts ...func(*DsseQuery)) *SignatureQuery { query := (&DsseClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withDsse = query return _q } // WithTimestamps tells the query-builder to eager-load the nodes that are connected to // the "timestamps" edge. The optional arguments are used to configure the query builder of the edge. func (_q *SignatureQuery) WithTimestamps(opts ...func(*TimestampQuery)) *SignatureQuery { query := (&TimestampClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withTimestamps = query return _q } // 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 { // KeyID string `json:"key_id,omitempty"` // Count int `json:"count,omitempty"` // } // // client.Signature.Query(). // GroupBy(signature.FieldKeyID). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *SignatureQuery) GroupBy(field string, fields ...string) *SignatureGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &SignatureGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = signature.Label grbuild.scan = grbuild.Scan return grbuild } // 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 { // KeyID string `json:"key_id,omitempty"` // } // // client.Signature.Query(). // Select(signature.FieldKeyID). // Scan(ctx, &v) func (_q *SignatureQuery) Select(fields ...string) *SignatureSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &SignatureSelect{SignatureQuery: _q} sbuild.label = signature.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a SignatureSelect configured with the given aggregations. func (_q *SignatureQuery) Aggregate(fns ...AggregateFunc) *SignatureSelect { return _q.Select().Aggregate(fns...) } func (_q *SignatureQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !signature.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *SignatureQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Signature, error) { var ( nodes = []*Signature{} withFKs = _q.withFKs _spec = _q.querySpec() loadedTypes = [2]bool{ _q.withDsse != nil, _q.withTimestamps != nil, } ) if _q.withDsse != nil { withFKs = true } if withFKs { _spec.Node.Columns = append(_spec.Node.Columns, signature.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]any, error) { return (*Signature).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &Signature{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withDsse; query != nil { if err := _q.loadDsse(ctx, query, nodes, nil, func(n *Signature, e *Dsse) { n.Edges.Dsse = e }); err != nil { return nil, err } } if query := _q.withTimestamps; query != nil { if err := _q.loadTimestamps(ctx, query, nodes, func(n *Signature) { n.Edges.Timestamps = []*Timestamp{} }, func(n *Signature, e *Timestamp) { n.Edges.Timestamps = append(n.Edges.Timestamps, e) }); err != nil { return nil, err } } for name, query := range _q.withNamedTimestamps { if err := _q.loadTimestamps(ctx, query, nodes, func(n *Signature) { n.appendNamedTimestamps(name) }, func(n *Signature, e *Timestamp) { n.appendNamedTimestamps(name, e) }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *SignatureQuery) loadDsse(ctx context.Context, query *DsseQuery, nodes []*Signature, init func(*Signature), assign func(*Signature, *Dsse)) error { ids := make([]uuid.UUID, 0, len(nodes)) nodeids := make(map[uuid.UUID][]*Signature) for i := range nodes { if nodes[i].dsse_signatures == nil { continue } fk := *nodes[i].dsse_signatures if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(dsse.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "dsse_signatures" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil } func (_q *SignatureQuery) loadTimestamps(ctx context.Context, query *TimestampQuery, nodes []*Signature, init func(*Signature), assign func(*Signature, *Timestamp)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[uuid.UUID]*Signature) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] if init != nil { init(nodes[i]) } } query.withFKs = true query.Where(predicate.Timestamp(func(s *sql.Selector) { s.Where(sql.InValues(s.C(signature.TimestampsColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.signature_timestamps if fk == nil { return fmt.Errorf(`foreign-key "signature_timestamps" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "signature_timestamps" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil } func (_q *SignatureQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *SignatureQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(signature.Table, signature.Columns, sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, signature.FieldID) for i := range fields { if fields[i] != signature.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *SignatureQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(signature.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = signature.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // WithNamedTimestamps tells the query-builder to eager-load the nodes that are connected to the "timestamps" // edge with the given name. The optional arguments are used to configure the query builder of the edge. func (_q *SignatureQuery) WithNamedTimestamps(name string, opts ...func(*TimestampQuery)) *SignatureQuery { query := (&TimestampClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } if _q.withNamedTimestamps == nil { _q.withNamedTimestamps = make(map[string]*TimestampQuery) } _q.withNamedTimestamps[name] = query return _q } // SignatureGroupBy is the group-by builder for Signature entities. type SignatureGroupBy struct { selector build *SignatureQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *SignatureGroupBy) Aggregate(fns ...AggregateFunc) *SignatureGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *SignatureGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*SignatureQuery, *SignatureGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *SignatureGroupBy) sqlScan(ctx context.Context, root *SignatureQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // SignatureSelect is the builder for selecting fields of Signature entities. type SignatureSelect struct { *SignatureQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *SignatureSelect) Aggregate(fns ...AggregateFunc) *SignatureSelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *SignatureSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*SignatureQuery, *SignatureSelect](ctx, _s.SignatureQuery, _s, _s.inters, v) } func (_s *SignatureSelect) sqlScan(ctx context.Context, root *SignatureQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/signature_update.go000066400000000000000000000376111511066247200245370ustar00rootroot00000000000000// Code generated by ent, 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/google/uuid" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/timestamp" ) // SignatureUpdate is the builder for updating Signature entities. type SignatureUpdate struct { config hooks []Hook mutation *SignatureMutation } // Where appends a list predicates to the SignatureUpdate builder. func (_u *SignatureUpdate) Where(ps ...predicate.Signature) *SignatureUpdate { _u.mutation.Where(ps...) return _u } // SetKeyID sets the "key_id" field. func (_u *SignatureUpdate) SetKeyID(v string) *SignatureUpdate { _u.mutation.SetKeyID(v) return _u } // SetNillableKeyID sets the "key_id" field if the given value is not nil. func (_u *SignatureUpdate) SetNillableKeyID(v *string) *SignatureUpdate { if v != nil { _u.SetKeyID(*v) } return _u } // SetSignature sets the "signature" field. func (_u *SignatureUpdate) SetSignature(v string) *SignatureUpdate { _u.mutation.SetSignature(v) return _u } // SetNillableSignature sets the "signature" field if the given value is not nil. func (_u *SignatureUpdate) SetNillableSignature(v *string) *SignatureUpdate { if v != nil { _u.SetSignature(*v) } return _u } // SetDsseID sets the "dsse" edge to the Dsse entity by ID. func (_u *SignatureUpdate) SetDsseID(id uuid.UUID) *SignatureUpdate { _u.mutation.SetDsseID(id) return _u } // SetNillableDsseID sets the "dsse" edge to the Dsse entity by ID if the given value is not nil. func (_u *SignatureUpdate) SetNillableDsseID(id *uuid.UUID) *SignatureUpdate { if id != nil { _u = _u.SetDsseID(*id) } return _u } // SetDsse sets the "dsse" edge to the Dsse entity. func (_u *SignatureUpdate) SetDsse(v *Dsse) *SignatureUpdate { return _u.SetDsseID(v.ID) } // AddTimestampIDs adds the "timestamps" edge to the Timestamp entity by IDs. func (_u *SignatureUpdate) AddTimestampIDs(ids ...uuid.UUID) *SignatureUpdate { _u.mutation.AddTimestampIDs(ids...) return _u } // AddTimestamps adds the "timestamps" edges to the Timestamp entity. func (_u *SignatureUpdate) AddTimestamps(v ...*Timestamp) *SignatureUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddTimestampIDs(ids...) } // Mutation returns the SignatureMutation object of the builder. func (_u *SignatureUpdate) Mutation() *SignatureMutation { return _u.mutation } // ClearDsse clears the "dsse" edge to the Dsse entity. func (_u *SignatureUpdate) ClearDsse() *SignatureUpdate { _u.mutation.ClearDsse() return _u } // ClearTimestamps clears all "timestamps" edges to the Timestamp entity. func (_u *SignatureUpdate) ClearTimestamps() *SignatureUpdate { _u.mutation.ClearTimestamps() return _u } // RemoveTimestampIDs removes the "timestamps" edge to Timestamp entities by IDs. func (_u *SignatureUpdate) RemoveTimestampIDs(ids ...uuid.UUID) *SignatureUpdate { _u.mutation.RemoveTimestampIDs(ids...) return _u } // RemoveTimestamps removes "timestamps" edges to Timestamp entities. func (_u *SignatureUpdate) RemoveTimestamps(v ...*Timestamp) *SignatureUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveTimestampIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *SignatureUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *SignatureUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *SignatureUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *SignatureUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *SignatureUpdate) check() error { if v, ok := _u.mutation.Signature(); ok { if err := signature.SignatureValidator(v); err != nil { return &ValidationError{Name: "signature", err: fmt.Errorf(`ent: validator failed for field "Signature.signature": %w`, err)} } } return nil } func (_u *SignatureUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(signature.Table, signature.Columns, sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.KeyID(); ok { _spec.SetField(signature.FieldKeyID, field.TypeString, value) } if value, ok := _u.mutation.Signature(); ok { _spec.SetField(signature.FieldSignature, field.TypeString, value) } if _u.mutation.DsseCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: signature.DsseTable, Columns: []string{signature.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.DsseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: signature.DsseTable, Columns: []string{signature.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.TimestampsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: signature.TimestampsTable, Columns: []string{signature.TimestampsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedTimestampsIDs(); len(nodes) > 0 && !_u.mutation.TimestampsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: signature.TimestampsTable, Columns: []string{signature.TimestampsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.TimestampsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: signature.TimestampsTable, Columns: []string{signature.TimestampsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{signature.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // SignatureUpdateOne is the builder for updating a single Signature entity. type SignatureUpdateOne struct { config fields []string hooks []Hook mutation *SignatureMutation } // SetKeyID sets the "key_id" field. func (_u *SignatureUpdateOne) SetKeyID(v string) *SignatureUpdateOne { _u.mutation.SetKeyID(v) return _u } // SetNillableKeyID sets the "key_id" field if the given value is not nil. func (_u *SignatureUpdateOne) SetNillableKeyID(v *string) *SignatureUpdateOne { if v != nil { _u.SetKeyID(*v) } return _u } // SetSignature sets the "signature" field. func (_u *SignatureUpdateOne) SetSignature(v string) *SignatureUpdateOne { _u.mutation.SetSignature(v) return _u } // SetNillableSignature sets the "signature" field if the given value is not nil. func (_u *SignatureUpdateOne) SetNillableSignature(v *string) *SignatureUpdateOne { if v != nil { _u.SetSignature(*v) } return _u } // SetDsseID sets the "dsse" edge to the Dsse entity by ID. func (_u *SignatureUpdateOne) SetDsseID(id uuid.UUID) *SignatureUpdateOne { _u.mutation.SetDsseID(id) return _u } // SetNillableDsseID sets the "dsse" edge to the Dsse entity by ID if the given value is not nil. func (_u *SignatureUpdateOne) SetNillableDsseID(id *uuid.UUID) *SignatureUpdateOne { if id != nil { _u = _u.SetDsseID(*id) } return _u } // SetDsse sets the "dsse" edge to the Dsse entity. func (_u *SignatureUpdateOne) SetDsse(v *Dsse) *SignatureUpdateOne { return _u.SetDsseID(v.ID) } // AddTimestampIDs adds the "timestamps" edge to the Timestamp entity by IDs. func (_u *SignatureUpdateOne) AddTimestampIDs(ids ...uuid.UUID) *SignatureUpdateOne { _u.mutation.AddTimestampIDs(ids...) return _u } // AddTimestamps adds the "timestamps" edges to the Timestamp entity. func (_u *SignatureUpdateOne) AddTimestamps(v ...*Timestamp) *SignatureUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddTimestampIDs(ids...) } // Mutation returns the SignatureMutation object of the builder. func (_u *SignatureUpdateOne) Mutation() *SignatureMutation { return _u.mutation } // ClearDsse clears the "dsse" edge to the Dsse entity. func (_u *SignatureUpdateOne) ClearDsse() *SignatureUpdateOne { _u.mutation.ClearDsse() return _u } // ClearTimestamps clears all "timestamps" edges to the Timestamp entity. func (_u *SignatureUpdateOne) ClearTimestamps() *SignatureUpdateOne { _u.mutation.ClearTimestamps() return _u } // RemoveTimestampIDs removes the "timestamps" edge to Timestamp entities by IDs. func (_u *SignatureUpdateOne) RemoveTimestampIDs(ids ...uuid.UUID) *SignatureUpdateOne { _u.mutation.RemoveTimestampIDs(ids...) return _u } // RemoveTimestamps removes "timestamps" edges to Timestamp entities. func (_u *SignatureUpdateOne) RemoveTimestamps(v ...*Timestamp) *SignatureUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveTimestampIDs(ids...) } // Where appends a list predicates to the SignatureUpdate builder. func (_u *SignatureUpdateOne) Where(ps ...predicate.Signature) *SignatureUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *SignatureUpdateOne) Select(field string, fields ...string) *SignatureUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated Signature entity. func (_u *SignatureUpdateOne) Save(ctx context.Context) (*Signature, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *SignatureUpdateOne) SaveX(ctx context.Context) *Signature { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *SignatureUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *SignatureUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *SignatureUpdateOne) check() error { if v, ok := _u.mutation.Signature(); ok { if err := signature.SignatureValidator(v); err != nil { return &ValidationError{Name: "signature", err: fmt.Errorf(`ent: validator failed for field "Signature.signature": %w`, err)} } } return nil } func (_u *SignatureUpdateOne) sqlSave(ctx context.Context) (_node *Signature, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(signature.Table, signature.Columns, sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Signature.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, signature.FieldID) for _, f := range fields { if !signature.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != signature.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.KeyID(); ok { _spec.SetField(signature.FieldKeyID, field.TypeString, value) } if value, ok := _u.mutation.Signature(); ok { _spec.SetField(signature.FieldSignature, field.TypeString, value) } if _u.mutation.DsseCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: signature.DsseTable, Columns: []string{signature.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.DsseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: signature.DsseTable, Columns: []string{signature.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.TimestampsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: signature.TimestampsTable, Columns: []string{signature.TimestampsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedTimestampsIDs(); len(nodes) > 0 && !_u.mutation.TimestampsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: signature.TimestampsTable, Columns: []string{signature.TimestampsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.TimestampsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: signature.TimestampsTable, Columns: []string{signature.TimestampsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &Signature{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{signature.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/statement.go000066400000000000000000000172771511066247200232060ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/statement" ) // Statement is the model entity for the Statement schema. type Statement struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Predicate holds the value of the "predicate" field. Predicate string `json:"predicate,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the StatementQuery when eager-loading is set. Edges StatementEdges `json:"edges"` selectValues sql.SelectValues } // StatementEdges holds the relations/edges for other nodes in the graph. type StatementEdges struct { // Subjects holds the value of the subjects edge. Subjects []*Subject `json:"subjects,omitempty"` // Policy holds the value of the policy edge. Policy *AttestationPolicy `json:"policy,omitempty"` // AttestationCollections holds the value of the attestation_collections edge. AttestationCollections *AttestationCollection `json:"attestation_collections,omitempty"` // Dsse holds the value of the dsse edge. Dsse []*Dsse `json:"dsse,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [4]bool // totalCount holds the count of the edges above. totalCount [4]map[string]int namedSubjects map[string][]*Subject namedDsse map[string][]*Dsse } // SubjectsOrErr returns the Subjects value or an error if the edge // was not loaded in eager-loading. func (e StatementEdges) SubjectsOrErr() ([]*Subject, error) { if e.loadedTypes[0] { return e.Subjects, nil } return nil, &NotLoadedError{edge: "subjects"} } // PolicyOrErr returns the Policy value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e StatementEdges) PolicyOrErr() (*AttestationPolicy, error) { if e.Policy != nil { return e.Policy, nil } else if e.loadedTypes[1] { return nil, &NotFoundError{label: attestationpolicy.Label} } return nil, &NotLoadedError{edge: "policy"} } // AttestationCollectionsOrErr returns the AttestationCollections value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e StatementEdges) AttestationCollectionsOrErr() (*AttestationCollection, error) { if e.AttestationCollections != nil { return e.AttestationCollections, nil } else if e.loadedTypes[2] { return nil, &NotFoundError{label: attestationcollection.Label} } return nil, &NotLoadedError{edge: "attestation_collections"} } // DsseOrErr returns the Dsse value or an error if the edge // was not loaded in eager-loading. func (e StatementEdges) DsseOrErr() ([]*Dsse, error) { if e.loadedTypes[3] { return e.Dsse, nil } return nil, &NotLoadedError{edge: "dsse"} } // scanValues returns the types for scanning values from sql.Rows. func (*Statement) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case statement.FieldPredicate: values[i] = new(sql.NullString) case statement.FieldID: values[i] = new(uuid.UUID) default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Statement fields. func (_m *Statement) assignValues(columns []string, values []any) 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 statement.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case statement.FieldPredicate: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field predicate", values[i]) } else if value.Valid { _m.Predicate = value.String } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Statement. // This includes values selected through modifiers, order, etc. func (_m *Statement) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QuerySubjects queries the "subjects" edge of the Statement entity. func (_m *Statement) QuerySubjects() *SubjectQuery { return NewStatementClient(_m.config).QuerySubjects(_m) } // QueryPolicy queries the "policy" edge of the Statement entity. func (_m *Statement) QueryPolicy() *AttestationPolicyQuery { return NewStatementClient(_m.config).QueryPolicy(_m) } // QueryAttestationCollections queries the "attestation_collections" edge of the Statement entity. func (_m *Statement) QueryAttestationCollections() *AttestationCollectionQuery { return NewStatementClient(_m.config).QueryAttestationCollections(_m) } // QueryDsse queries the "dsse" edge of the Statement entity. func (_m *Statement) QueryDsse() *DsseQuery { return NewStatementClient(_m.config).QueryDsse(_m) } // Update returns a builder for updating this Statement. // Note that you need to call Statement.Unwrap() before calling this method if this Statement // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Statement) Update() *StatementUpdateOne { return NewStatementClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Statement 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 (_m *Statement) Unwrap() *Statement { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Statement is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Statement) String() string { var builder strings.Builder builder.WriteString("Statement(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("predicate=") builder.WriteString(_m.Predicate) builder.WriteByte(')') return builder.String() } // NamedSubjects returns the Subjects named value or an error if the edge was not // loaded in eager-loading with this name. func (_m *Statement) NamedSubjects(name string) ([]*Subject, error) { if _m.Edges.namedSubjects == nil { return nil, &NotLoadedError{edge: name} } nodes, ok := _m.Edges.namedSubjects[name] if !ok { return nil, &NotLoadedError{edge: name} } return nodes, nil } func (_m *Statement) appendNamedSubjects(name string, edges ...*Subject) { if _m.Edges.namedSubjects == nil { _m.Edges.namedSubjects = make(map[string][]*Subject) } if len(edges) == 0 { _m.Edges.namedSubjects[name] = []*Subject{} } else { _m.Edges.namedSubjects[name] = append(_m.Edges.namedSubjects[name], edges...) } } // NamedDsse returns the Dsse named value or an error if the edge was not // loaded in eager-loading with this name. func (_m *Statement) NamedDsse(name string) ([]*Dsse, error) { if _m.Edges.namedDsse == nil { return nil, &NotLoadedError{edge: name} } nodes, ok := _m.Edges.namedDsse[name] if !ok { return nil, &NotLoadedError{edge: name} } return nodes, nil } func (_m *Statement) appendNamedDsse(name string, edges ...*Dsse) { if _m.Edges.namedDsse == nil { _m.Edges.namedDsse = make(map[string][]*Dsse) } if len(edges) == 0 { _m.Edges.namedDsse[name] = []*Dsse{} } else { _m.Edges.namedDsse[name] = append(_m.Edges.namedDsse[name], edges...) } } // Statements is a parsable slice of Statement. type Statements []*Statement golang-github-in-toto-archivista-0.11.1/ent/statement/000077500000000000000000000000001511066247200226415ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/statement/statement.go000066400000000000000000000141601511066247200251760ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package statement import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the statement type in the database. Label = "statement" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldPredicate holds the string denoting the predicate field in the database. FieldPredicate = "predicate" // EdgeSubjects holds the string denoting the subjects edge name in mutations. EdgeSubjects = "subjects" // EdgePolicy holds the string denoting the policy edge name in mutations. EdgePolicy = "policy" // EdgeAttestationCollections holds the string denoting the attestation_collections edge name in mutations. EdgeAttestationCollections = "attestation_collections" // EdgeDsse holds the string denoting the dsse edge name in mutations. EdgeDsse = "dsse" // Table holds the table name of the statement in the database. Table = "statements" // SubjectsTable is the table that holds the subjects relation/edge. SubjectsTable = "subjects" // SubjectsInverseTable is the table name for the Subject entity. // It exists in this package in order to avoid circular dependency with the "subject" package. SubjectsInverseTable = "subjects" // SubjectsColumn is the table column denoting the subjects relation/edge. SubjectsColumn = "statement_subjects" // PolicyTable is the table that holds the policy relation/edge. PolicyTable = "attestation_policies" // PolicyInverseTable is the table name for the AttestationPolicy entity. // It exists in this package in order to avoid circular dependency with the "attestationpolicy" package. PolicyInverseTable = "attestation_policies" // PolicyColumn is the table column denoting the policy relation/edge. PolicyColumn = "statement_policy" // AttestationCollectionsTable is the table that holds the attestation_collections relation/edge. AttestationCollectionsTable = "attestation_collections" // AttestationCollectionsInverseTable is the table name for the AttestationCollection entity. // It exists in this package in order to avoid circular dependency with the "attestationcollection" package. AttestationCollectionsInverseTable = "attestation_collections" // AttestationCollectionsColumn is the table column denoting the attestation_collections relation/edge. AttestationCollectionsColumn = "statement_attestation_collections" // DsseTable is the table that holds the dsse relation/edge. DsseTable = "dsses" // DsseInverseTable is the table name for the Dsse entity. // It exists in this package in order to avoid circular dependency with the "dsse" package. DsseInverseTable = "dsses" // DsseColumn is the table column denoting the dsse relation/edge. DsseColumn = "dsse_statement" ) // Columns holds all SQL columns for statement fields. var Columns = []string{ FieldID, FieldPredicate, } // 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 ( // PredicateValidator is a validator for the "predicate" field. It is called by the builders before save. PredicateValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the Statement queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByPredicate orders the results by the predicate field. func ByPredicate(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPredicate, opts...).ToFunc() } // BySubjectsCount orders the results by subjects count. func BySubjectsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newSubjectsStep(), opts...) } } // BySubjects orders the results by subjects terms. func BySubjects(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSubjectsStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByPolicyField orders the results by policy field. func ByPolicyField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newPolicyStep(), sql.OrderByField(field, opts...)) } } // ByAttestationCollectionsField orders the results by attestation_collections field. func ByAttestationCollectionsField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newAttestationCollectionsStep(), sql.OrderByField(field, opts...)) } } // ByDsseCount orders the results by dsse count. func ByDsseCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newDsseStep(), opts...) } } // ByDsse orders the results by dsse terms. func ByDsse(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newDsseStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newSubjectsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SubjectsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, SubjectsTable, SubjectsColumn), ) } func newPolicyStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(PolicyInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2O, false, PolicyTable, PolicyColumn), ) } func newAttestationCollectionsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(AttestationCollectionsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2O, false, AttestationCollectionsTable, AttestationCollectionsColumn), ) } func newDsseStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(DsseInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, true, DsseTable, DsseColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/statement/where.go000066400000000000000000000172611511066247200243110ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package statement import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.Statement { return predicate.Statement(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.Statement { return predicate.Statement(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.Statement { return predicate.Statement(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.Statement { return predicate.Statement(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.Statement { return predicate.Statement(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.Statement { return predicate.Statement(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.Statement { return predicate.Statement(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.Statement { return predicate.Statement(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.Statement { return predicate.Statement(sql.FieldLTE(FieldID, id)) } // Predicate applies equality check predicate on the "predicate" field. It's identical to PredicateEQ. func Predicate(v string) predicate.Statement { return predicate.Statement(sql.FieldEQ(FieldPredicate, v)) } // PredicateEQ applies the EQ predicate on the "predicate" field. func PredicateEQ(v string) predicate.Statement { return predicate.Statement(sql.FieldEQ(FieldPredicate, v)) } // PredicateNEQ applies the NEQ predicate on the "predicate" field. func PredicateNEQ(v string) predicate.Statement { return predicate.Statement(sql.FieldNEQ(FieldPredicate, v)) } // PredicateIn applies the In predicate on the "predicate" field. func PredicateIn(vs ...string) predicate.Statement { return predicate.Statement(sql.FieldIn(FieldPredicate, vs...)) } // PredicateNotIn applies the NotIn predicate on the "predicate" field. func PredicateNotIn(vs ...string) predicate.Statement { return predicate.Statement(sql.FieldNotIn(FieldPredicate, vs...)) } // PredicateGT applies the GT predicate on the "predicate" field. func PredicateGT(v string) predicate.Statement { return predicate.Statement(sql.FieldGT(FieldPredicate, v)) } // PredicateGTE applies the GTE predicate on the "predicate" field. func PredicateGTE(v string) predicate.Statement { return predicate.Statement(sql.FieldGTE(FieldPredicate, v)) } // PredicateLT applies the LT predicate on the "predicate" field. func PredicateLT(v string) predicate.Statement { return predicate.Statement(sql.FieldLT(FieldPredicate, v)) } // PredicateLTE applies the LTE predicate on the "predicate" field. func PredicateLTE(v string) predicate.Statement { return predicate.Statement(sql.FieldLTE(FieldPredicate, v)) } // PredicateContains applies the Contains predicate on the "predicate" field. func PredicateContains(v string) predicate.Statement { return predicate.Statement(sql.FieldContains(FieldPredicate, v)) } // PredicateHasPrefix applies the HasPrefix predicate on the "predicate" field. func PredicateHasPrefix(v string) predicate.Statement { return predicate.Statement(sql.FieldHasPrefix(FieldPredicate, v)) } // PredicateHasSuffix applies the HasSuffix predicate on the "predicate" field. func PredicateHasSuffix(v string) predicate.Statement { return predicate.Statement(sql.FieldHasSuffix(FieldPredicate, v)) } // PredicateEqualFold applies the EqualFold predicate on the "predicate" field. func PredicateEqualFold(v string) predicate.Statement { return predicate.Statement(sql.FieldEqualFold(FieldPredicate, v)) } // PredicateContainsFold applies the ContainsFold predicate on the "predicate" field. func PredicateContainsFold(v string) predicate.Statement { return predicate.Statement(sql.FieldContainsFold(FieldPredicate, v)) } // HasSubjects applies the HasEdge predicate on the "subjects" edge. func HasSubjects() predicate.Statement { return predicate.Statement(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, SubjectsTable, SubjectsColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasSubjectsWith applies the HasEdge predicate on the "subjects" edge with a given conditions (other predicates). func HasSubjectsWith(preds ...predicate.Subject) predicate.Statement { return predicate.Statement(func(s *sql.Selector) { step := newSubjectsStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) }) } // HasPolicy applies the HasEdge predicate on the "policy" edge. func HasPolicy() predicate.Statement { return predicate.Statement(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2O, false, PolicyTable, PolicyColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasPolicyWith applies the HasEdge predicate on the "policy" edge with a given conditions (other predicates). func HasPolicyWith(preds ...predicate.AttestationPolicy) predicate.Statement { return predicate.Statement(func(s *sql.Selector) { step := newPolicyStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) }) } // HasAttestationCollections applies the HasEdge predicate on the "attestation_collections" edge. func HasAttestationCollections() predicate.Statement { return predicate.Statement(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2O, false, AttestationCollectionsTable, AttestationCollectionsColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasAttestationCollectionsWith applies the HasEdge predicate on the "attestation_collections" edge with a given conditions (other predicates). func HasAttestationCollectionsWith(preds ...predicate.AttestationCollection) predicate.Statement { return predicate.Statement(func(s *sql.Selector) { step := newAttestationCollectionsStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) }) } // HasDsse applies the HasEdge predicate on the "dsse" edge. func HasDsse() predicate.Statement { return predicate.Statement(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, true, DsseTable, DsseColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasDsseWith applies the HasEdge predicate on the "dsse" edge with a given conditions (other predicates). func HasDsseWith(preds ...predicate.Dsse) predicate.Statement { return predicate.Statement(func(s *sql.Selector) { step := newDsseStep() 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.Statement) predicate.Statement { return predicate.Statement(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Statement) predicate.Statement { return predicate.Statement(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Statement) predicate.Statement { return predicate.Statement(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/statement_create.go000066400000000000000000000241321511066247200245150ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" ) // StatementCreate is the builder for creating a Statement entity. type StatementCreate struct { config mutation *StatementMutation hooks []Hook } // SetPredicate sets the "predicate" field. func (_c *StatementCreate) SetPredicate(v string) *StatementCreate { _c.mutation.SetPredicate(v) return _c } // SetID sets the "id" field. func (_c *StatementCreate) SetID(v uuid.UUID) *StatementCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *StatementCreate) SetNillableID(v *uuid.UUID) *StatementCreate { if v != nil { _c.SetID(*v) } return _c } // AddSubjectIDs adds the "subjects" edge to the Subject entity by IDs. func (_c *StatementCreate) AddSubjectIDs(ids ...uuid.UUID) *StatementCreate { _c.mutation.AddSubjectIDs(ids...) return _c } // AddSubjects adds the "subjects" edges to the Subject entity. func (_c *StatementCreate) AddSubjects(v ...*Subject) *StatementCreate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _c.AddSubjectIDs(ids...) } // SetPolicyID sets the "policy" edge to the AttestationPolicy entity by ID. func (_c *StatementCreate) SetPolicyID(id uuid.UUID) *StatementCreate { _c.mutation.SetPolicyID(id) return _c } // SetNillablePolicyID sets the "policy" edge to the AttestationPolicy entity by ID if the given value is not nil. func (_c *StatementCreate) SetNillablePolicyID(id *uuid.UUID) *StatementCreate { if id != nil { _c = _c.SetPolicyID(*id) } return _c } // SetPolicy sets the "policy" edge to the AttestationPolicy entity. func (_c *StatementCreate) SetPolicy(v *AttestationPolicy) *StatementCreate { return _c.SetPolicyID(v.ID) } // SetAttestationCollectionsID sets the "attestation_collections" edge to the AttestationCollection entity by ID. func (_c *StatementCreate) SetAttestationCollectionsID(id uuid.UUID) *StatementCreate { _c.mutation.SetAttestationCollectionsID(id) return _c } // SetNillableAttestationCollectionsID sets the "attestation_collections" edge to the AttestationCollection entity by ID if the given value is not nil. func (_c *StatementCreate) SetNillableAttestationCollectionsID(id *uuid.UUID) *StatementCreate { if id != nil { _c = _c.SetAttestationCollectionsID(*id) } return _c } // SetAttestationCollections sets the "attestation_collections" edge to the AttestationCollection entity. func (_c *StatementCreate) SetAttestationCollections(v *AttestationCollection) *StatementCreate { return _c.SetAttestationCollectionsID(v.ID) } // AddDsseIDs adds the "dsse" edge to the Dsse entity by IDs. func (_c *StatementCreate) AddDsseIDs(ids ...uuid.UUID) *StatementCreate { _c.mutation.AddDsseIDs(ids...) return _c } // AddDsse adds the "dsse" edges to the Dsse entity. func (_c *StatementCreate) AddDsse(v ...*Dsse) *StatementCreate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _c.AddDsseIDs(ids...) } // Mutation returns the StatementMutation object of the builder. func (_c *StatementCreate) Mutation() *StatementMutation { return _c.mutation } // Save creates the Statement in the database. func (_c *StatementCreate) Save(ctx context.Context) (*Statement, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *StatementCreate) SaveX(ctx context.Context) *Statement { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *StatementCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *StatementCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *StatementCreate) defaults() { if _, ok := _c.mutation.ID(); !ok { v := statement.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *StatementCreate) check() error { if _, ok := _c.mutation.Predicate(); !ok { return &ValidationError{Name: "predicate", err: errors.New(`ent: missing required field "Statement.predicate"`)} } if v, ok := _c.mutation.Predicate(); ok { if err := statement.PredicateValidator(v); err != nil { return &ValidationError{Name: "predicate", err: fmt.Errorf(`ent: validator failed for field "Statement.predicate": %w`, err)} } } return nil } func (_c *StatementCreate) sqlSave(ctx context.Context) (*Statement, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *StatementCreate) createSpec() (*Statement, *sqlgraph.CreateSpec) { var ( _node = &Statement{config: _c.config} _spec = sqlgraph.NewCreateSpec(statement.Table, sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.Predicate(); ok { _spec.SetField(statement.FieldPredicate, field.TypeString, value) _node.Predicate = value } if nodes := _c.mutation.SubjectsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: statement.SubjectsTable, Columns: []string{statement.SubjectsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.PolicyIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.PolicyTable, Columns: []string{statement.PolicyColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.AttestationCollectionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.AttestationCollectionsTable, Columns: []string{statement.AttestationCollectionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.DsseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: statement.DsseTable, Columns: []string{statement.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // StatementCreateBulk is the builder for creating many Statement entities in bulk. type StatementCreateBulk struct { config err error builders []*StatementCreate } // Save creates the Statement entities in the database. func (_c *StatementCreateBulk) Save(ctx context.Context) ([]*Statement, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*Statement, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*StatementMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *StatementCreateBulk) SaveX(ctx context.Context) []*Statement { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *StatementCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *StatementCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/statement_delete.go000066400000000000000000000043771511066247200245250ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/statement" ) // StatementDelete is the builder for deleting a Statement entity. type StatementDelete struct { config hooks []Hook mutation *StatementMutation } // Where appends a list predicates to the StatementDelete builder. func (_d *StatementDelete) Where(ps ...predicate.Statement) *StatementDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *StatementDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *StatementDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *StatementDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(statement.Table, sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // StatementDeleteOne is the builder for deleting a single Statement entity. type StatementDeleteOne struct { _d *StatementDelete } // Where appends a list predicates to the StatementDelete builder. func (_d *StatementDeleteOne) Where(ps ...predicate.Statement) *StatementDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *StatementDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{statement.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *StatementDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/statement_query.go000066400000000000000000000661541511066247200244310ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" ) // StatementQuery is the builder for querying Statement entities. type StatementQuery struct { config ctx *QueryContext order []statement.OrderOption inters []Interceptor predicates []predicate.Statement withSubjects *SubjectQuery withPolicy *AttestationPolicyQuery withAttestationCollections *AttestationCollectionQuery withDsse *DsseQuery modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*Statement) error withNamedSubjects map[string]*SubjectQuery withNamedDsse map[string]*DsseQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the StatementQuery builder. func (_q *StatementQuery) Where(ps ...predicate.Statement) *StatementQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *StatementQuery) Limit(limit int) *StatementQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *StatementQuery) Offset(offset int) *StatementQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *StatementQuery) Unique(unique bool) *StatementQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *StatementQuery) Order(o ...statement.OrderOption) *StatementQuery { _q.order = append(_q.order, o...) return _q } // QuerySubjects chains the current query on the "subjects" edge. func (_q *StatementQuery) QuerySubjects() *SubjectQuery { query := (&SubjectClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(statement.Table, statement.FieldID, selector), sqlgraph.To(subject.Table, subject.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, statement.SubjectsTable, statement.SubjectsColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryPolicy chains the current query on the "policy" edge. func (_q *StatementQuery) QueryPolicy() *AttestationPolicyQuery { query := (&AttestationPolicyClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(statement.Table, statement.FieldID, selector), sqlgraph.To(attestationpolicy.Table, attestationpolicy.FieldID), sqlgraph.Edge(sqlgraph.O2O, false, statement.PolicyTable, statement.PolicyColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryAttestationCollections chains the current query on the "attestation_collections" edge. func (_q *StatementQuery) QueryAttestationCollections() *AttestationCollectionQuery { query := (&AttestationCollectionClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(statement.Table, statement.FieldID, selector), sqlgraph.To(attestationcollection.Table, attestationcollection.FieldID), sqlgraph.Edge(sqlgraph.O2O, false, statement.AttestationCollectionsTable, statement.AttestationCollectionsColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryDsse chains the current query on the "dsse" edge. func (_q *StatementQuery) QueryDsse() *DsseQuery { query := (&DsseClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(statement.Table, statement.FieldID, selector), sqlgraph.To(dsse.Table, dsse.FieldID), sqlgraph.Edge(sqlgraph.O2M, true, statement.DsseTable, statement.DsseColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first Statement entity from the query. // Returns a *NotFoundError when no Statement was found. func (_q *StatementQuery) First(ctx context.Context) (*Statement, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{statement.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *StatementQuery) FirstX(ctx context.Context) *Statement { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first Statement ID from the query. // Returns a *NotFoundError when no Statement ID was found. func (_q *StatementQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{statement.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *StatementQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single Statement entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Statement entity is found. // Returns a *NotFoundError when no Statement entities are found. func (_q *StatementQuery) Only(ctx context.Context) (*Statement, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{statement.Label} default: return nil, &NotSingularError{statement.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *StatementQuery) OnlyX(ctx context.Context) *Statement { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only Statement ID in the query. // Returns a *NotSingularError when more than one Statement ID is found. // Returns a *NotFoundError when no entities are found. func (_q *StatementQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{statement.Label} default: err = &NotSingularError{statement.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *StatementQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of Statements. func (_q *StatementQuery) All(ctx context.Context) ([]*Statement, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Statement, *StatementQuery]() return withInterceptors[[]*Statement](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *StatementQuery) AllX(ctx context.Context) []*Statement { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of Statement IDs. func (_q *StatementQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(statement.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *StatementQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *StatementQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*StatementQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *StatementQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *StatementQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *StatementQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the StatementQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *StatementQuery) Clone() *StatementQuery { if _q == nil { return nil } return &StatementQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]statement.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.Statement{}, _q.predicates...), withSubjects: _q.withSubjects.Clone(), withPolicy: _q.withPolicy.Clone(), withAttestationCollections: _q.withAttestationCollections.Clone(), withDsse: _q.withDsse.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithSubjects tells the query-builder to eager-load the nodes that are connected to // the "subjects" edge. The optional arguments are used to configure the query builder of the edge. func (_q *StatementQuery) WithSubjects(opts ...func(*SubjectQuery)) *StatementQuery { query := (&SubjectClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withSubjects = query return _q } // WithPolicy tells the query-builder to eager-load the nodes that are connected to // the "policy" edge. The optional arguments are used to configure the query builder of the edge. func (_q *StatementQuery) WithPolicy(opts ...func(*AttestationPolicyQuery)) *StatementQuery { query := (&AttestationPolicyClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withPolicy = query return _q } // WithAttestationCollections tells the query-builder to eager-load the nodes that are connected to // the "attestation_collections" edge. The optional arguments are used to configure the query builder of the edge. func (_q *StatementQuery) WithAttestationCollections(opts ...func(*AttestationCollectionQuery)) *StatementQuery { query := (&AttestationCollectionClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withAttestationCollections = query return _q } // WithDsse tells the query-builder to eager-load the nodes that are connected to // the "dsse" edge. The optional arguments are used to configure the query builder of the edge. func (_q *StatementQuery) WithDsse(opts ...func(*DsseQuery)) *StatementQuery { query := (&DsseClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withDsse = query return _q } // 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 { // Predicate string `json:"predicate,omitempty"` // Count int `json:"count,omitempty"` // } // // client.Statement.Query(). // GroupBy(statement.FieldPredicate). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *StatementQuery) GroupBy(field string, fields ...string) *StatementGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &StatementGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = statement.Label grbuild.scan = grbuild.Scan return grbuild } // 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 { // Predicate string `json:"predicate,omitempty"` // } // // client.Statement.Query(). // Select(statement.FieldPredicate). // Scan(ctx, &v) func (_q *StatementQuery) Select(fields ...string) *StatementSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &StatementSelect{StatementQuery: _q} sbuild.label = statement.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a StatementSelect configured with the given aggregations. func (_q *StatementQuery) Aggregate(fns ...AggregateFunc) *StatementSelect { return _q.Select().Aggregate(fns...) } func (_q *StatementQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !statement.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *StatementQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Statement, error) { var ( nodes = []*Statement{} _spec = _q.querySpec() loadedTypes = [4]bool{ _q.withSubjects != nil, _q.withPolicy != nil, _q.withAttestationCollections != nil, _q.withDsse != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*Statement).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &Statement{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withSubjects; query != nil { if err := _q.loadSubjects(ctx, query, nodes, func(n *Statement) { n.Edges.Subjects = []*Subject{} }, func(n *Statement, e *Subject) { n.Edges.Subjects = append(n.Edges.Subjects, e) }); err != nil { return nil, err } } if query := _q.withPolicy; query != nil { if err := _q.loadPolicy(ctx, query, nodes, nil, func(n *Statement, e *AttestationPolicy) { n.Edges.Policy = e }); err != nil { return nil, err } } if query := _q.withAttestationCollections; query != nil { if err := _q.loadAttestationCollections(ctx, query, nodes, nil, func(n *Statement, e *AttestationCollection) { n.Edges.AttestationCollections = e }); err != nil { return nil, err } } if query := _q.withDsse; query != nil { if err := _q.loadDsse(ctx, query, nodes, func(n *Statement) { n.Edges.Dsse = []*Dsse{} }, func(n *Statement, e *Dsse) { n.Edges.Dsse = append(n.Edges.Dsse, e) }); err != nil { return nil, err } } for name, query := range _q.withNamedSubjects { if err := _q.loadSubjects(ctx, query, nodes, func(n *Statement) { n.appendNamedSubjects(name) }, func(n *Statement, e *Subject) { n.appendNamedSubjects(name, e) }); err != nil { return nil, err } } for name, query := range _q.withNamedDsse { if err := _q.loadDsse(ctx, query, nodes, func(n *Statement) { n.appendNamedDsse(name) }, func(n *Statement, e *Dsse) { n.appendNamedDsse(name, e) }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *StatementQuery) loadSubjects(ctx context.Context, query *SubjectQuery, nodes []*Statement, init func(*Statement), assign func(*Statement, *Subject)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[uuid.UUID]*Statement) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] if init != nil { init(nodes[i]) } } query.withFKs = true query.Where(predicate.Subject(func(s *sql.Selector) { s.Where(sql.InValues(s.C(statement.SubjectsColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.statement_subjects if fk == nil { return fmt.Errorf(`foreign-key "statement_subjects" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "statement_subjects" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil } func (_q *StatementQuery) loadPolicy(ctx context.Context, query *AttestationPolicyQuery, nodes []*Statement, init func(*Statement), assign func(*Statement, *AttestationPolicy)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[uuid.UUID]*Statement) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] } query.withFKs = true query.Where(predicate.AttestationPolicy(func(s *sql.Selector) { s.Where(sql.InValues(s.C(statement.PolicyColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.statement_policy if fk == nil { return fmt.Errorf(`foreign-key "statement_policy" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "statement_policy" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil } func (_q *StatementQuery) loadAttestationCollections(ctx context.Context, query *AttestationCollectionQuery, nodes []*Statement, init func(*Statement), assign func(*Statement, *AttestationCollection)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[uuid.UUID]*Statement) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] } query.withFKs = true query.Where(predicate.AttestationCollection(func(s *sql.Selector) { s.Where(sql.InValues(s.C(statement.AttestationCollectionsColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.statement_attestation_collections if fk == nil { return fmt.Errorf(`foreign-key "statement_attestation_collections" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "statement_attestation_collections" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil } func (_q *StatementQuery) loadDsse(ctx context.Context, query *DsseQuery, nodes []*Statement, init func(*Statement), assign func(*Statement, *Dsse)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[uuid.UUID]*Statement) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] if init != nil { init(nodes[i]) } } query.withFKs = true query.Where(predicate.Dsse(func(s *sql.Selector) { s.Where(sql.InValues(s.C(statement.DsseColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.dsse_statement if fk == nil { return fmt.Errorf(`foreign-key "dsse_statement" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "dsse_statement" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil } func (_q *StatementQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *StatementQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(statement.Table, statement.Columns, sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, statement.FieldID) for i := range fields { if fields[i] != statement.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *StatementQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(statement.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = statement.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // WithNamedSubjects tells the query-builder to eager-load the nodes that are connected to the "subjects" // edge with the given name. The optional arguments are used to configure the query builder of the edge. func (_q *StatementQuery) WithNamedSubjects(name string, opts ...func(*SubjectQuery)) *StatementQuery { query := (&SubjectClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } if _q.withNamedSubjects == nil { _q.withNamedSubjects = make(map[string]*SubjectQuery) } _q.withNamedSubjects[name] = query return _q } // WithNamedDsse tells the query-builder to eager-load the nodes that are connected to the "dsse" // edge with the given name. The optional arguments are used to configure the query builder of the edge. func (_q *StatementQuery) WithNamedDsse(name string, opts ...func(*DsseQuery)) *StatementQuery { query := (&DsseClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } if _q.withNamedDsse == nil { _q.withNamedDsse = make(map[string]*DsseQuery) } _q.withNamedDsse[name] = query return _q } // StatementGroupBy is the group-by builder for Statement entities. type StatementGroupBy struct { selector build *StatementQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *StatementGroupBy) Aggregate(fns ...AggregateFunc) *StatementGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *StatementGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*StatementQuery, *StatementGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *StatementGroupBy) sqlScan(ctx context.Context, root *StatementQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // StatementSelect is the builder for selecting fields of Statement entities. type StatementSelect struct { *StatementQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *StatementSelect) Aggregate(fns ...AggregateFunc) *StatementSelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *StatementSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*StatementQuery, *StatementSelect](ctx, _s.StatementQuery, _s, _s.inters, v) } func (_s *StatementSelect) sqlScan(ctx context.Context, root *StatementQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/statement_update.go000066400000000000000000000575511511066247200245470ustar00rootroot00000000000000// Code generated by ent, 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/google/uuid" "github.com/in-toto/archivista/ent/attestationcollection" "github.com/in-toto/archivista/ent/attestationpolicy" "github.com/in-toto/archivista/ent/dsse" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" ) // StatementUpdate is the builder for updating Statement entities. type StatementUpdate struct { config hooks []Hook mutation *StatementMutation } // Where appends a list predicates to the StatementUpdate builder. func (_u *StatementUpdate) Where(ps ...predicate.Statement) *StatementUpdate { _u.mutation.Where(ps...) return _u } // SetPredicate sets the "predicate" field. func (_u *StatementUpdate) SetPredicate(v string) *StatementUpdate { _u.mutation.SetPredicate(v) return _u } // SetNillablePredicate sets the "predicate" field if the given value is not nil. func (_u *StatementUpdate) SetNillablePredicate(v *string) *StatementUpdate { if v != nil { _u.SetPredicate(*v) } return _u } // AddSubjectIDs adds the "subjects" edge to the Subject entity by IDs. func (_u *StatementUpdate) AddSubjectIDs(ids ...uuid.UUID) *StatementUpdate { _u.mutation.AddSubjectIDs(ids...) return _u } // AddSubjects adds the "subjects" edges to the Subject entity. func (_u *StatementUpdate) AddSubjects(v ...*Subject) *StatementUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddSubjectIDs(ids...) } // SetPolicyID sets the "policy" edge to the AttestationPolicy entity by ID. func (_u *StatementUpdate) SetPolicyID(id uuid.UUID) *StatementUpdate { _u.mutation.SetPolicyID(id) return _u } // SetNillablePolicyID sets the "policy" edge to the AttestationPolicy entity by ID if the given value is not nil. func (_u *StatementUpdate) SetNillablePolicyID(id *uuid.UUID) *StatementUpdate { if id != nil { _u = _u.SetPolicyID(*id) } return _u } // SetPolicy sets the "policy" edge to the AttestationPolicy entity. func (_u *StatementUpdate) SetPolicy(v *AttestationPolicy) *StatementUpdate { return _u.SetPolicyID(v.ID) } // SetAttestationCollectionsID sets the "attestation_collections" edge to the AttestationCollection entity by ID. func (_u *StatementUpdate) SetAttestationCollectionsID(id uuid.UUID) *StatementUpdate { _u.mutation.SetAttestationCollectionsID(id) return _u } // SetNillableAttestationCollectionsID sets the "attestation_collections" edge to the AttestationCollection entity by ID if the given value is not nil. func (_u *StatementUpdate) SetNillableAttestationCollectionsID(id *uuid.UUID) *StatementUpdate { if id != nil { _u = _u.SetAttestationCollectionsID(*id) } return _u } // SetAttestationCollections sets the "attestation_collections" edge to the AttestationCollection entity. func (_u *StatementUpdate) SetAttestationCollections(v *AttestationCollection) *StatementUpdate { return _u.SetAttestationCollectionsID(v.ID) } // AddDsseIDs adds the "dsse" edge to the Dsse entity by IDs. func (_u *StatementUpdate) AddDsseIDs(ids ...uuid.UUID) *StatementUpdate { _u.mutation.AddDsseIDs(ids...) return _u } // AddDsse adds the "dsse" edges to the Dsse entity. func (_u *StatementUpdate) AddDsse(v ...*Dsse) *StatementUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddDsseIDs(ids...) } // Mutation returns the StatementMutation object of the builder. func (_u *StatementUpdate) Mutation() *StatementMutation { return _u.mutation } // ClearSubjects clears all "subjects" edges to the Subject entity. func (_u *StatementUpdate) ClearSubjects() *StatementUpdate { _u.mutation.ClearSubjects() return _u } // RemoveSubjectIDs removes the "subjects" edge to Subject entities by IDs. func (_u *StatementUpdate) RemoveSubjectIDs(ids ...uuid.UUID) *StatementUpdate { _u.mutation.RemoveSubjectIDs(ids...) return _u } // RemoveSubjects removes "subjects" edges to Subject entities. func (_u *StatementUpdate) RemoveSubjects(v ...*Subject) *StatementUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveSubjectIDs(ids...) } // ClearPolicy clears the "policy" edge to the AttestationPolicy entity. func (_u *StatementUpdate) ClearPolicy() *StatementUpdate { _u.mutation.ClearPolicy() return _u } // ClearAttestationCollections clears the "attestation_collections" edge to the AttestationCollection entity. func (_u *StatementUpdate) ClearAttestationCollections() *StatementUpdate { _u.mutation.ClearAttestationCollections() return _u } // ClearDsse clears all "dsse" edges to the Dsse entity. func (_u *StatementUpdate) ClearDsse() *StatementUpdate { _u.mutation.ClearDsse() return _u } // RemoveDsseIDs removes the "dsse" edge to Dsse entities by IDs. func (_u *StatementUpdate) RemoveDsseIDs(ids ...uuid.UUID) *StatementUpdate { _u.mutation.RemoveDsseIDs(ids...) return _u } // RemoveDsse removes "dsse" edges to Dsse entities. func (_u *StatementUpdate) RemoveDsse(v ...*Dsse) *StatementUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveDsseIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *StatementUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *StatementUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *StatementUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *StatementUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *StatementUpdate) check() error { if v, ok := _u.mutation.Predicate(); ok { if err := statement.PredicateValidator(v); err != nil { return &ValidationError{Name: "predicate", err: fmt.Errorf(`ent: validator failed for field "Statement.predicate": %w`, err)} } } return nil } func (_u *StatementUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(statement.Table, statement.Columns, sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Predicate(); ok { _spec.SetField(statement.FieldPredicate, field.TypeString, value) } if _u.mutation.SubjectsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: statement.SubjectsTable, Columns: []string{statement.SubjectsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedSubjectsIDs(); len(nodes) > 0 && !_u.mutation.SubjectsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: statement.SubjectsTable, Columns: []string{statement.SubjectsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SubjectsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: statement.SubjectsTable, Columns: []string{statement.SubjectsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.PolicyCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.PolicyTable, Columns: []string{statement.PolicyColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.PolicyIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.PolicyTable, Columns: []string{statement.PolicyColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.AttestationCollectionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.AttestationCollectionsTable, Columns: []string{statement.AttestationCollectionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AttestationCollectionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.AttestationCollectionsTable, Columns: []string{statement.AttestationCollectionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.DsseCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: statement.DsseTable, Columns: []string{statement.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedDsseIDs(); len(nodes) > 0 && !_u.mutation.DsseCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: statement.DsseTable, Columns: []string{statement.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.DsseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: statement.DsseTable, Columns: []string{statement.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{statement.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // StatementUpdateOne is the builder for updating a single Statement entity. type StatementUpdateOne struct { config fields []string hooks []Hook mutation *StatementMutation } // SetPredicate sets the "predicate" field. func (_u *StatementUpdateOne) SetPredicate(v string) *StatementUpdateOne { _u.mutation.SetPredicate(v) return _u } // SetNillablePredicate sets the "predicate" field if the given value is not nil. func (_u *StatementUpdateOne) SetNillablePredicate(v *string) *StatementUpdateOne { if v != nil { _u.SetPredicate(*v) } return _u } // AddSubjectIDs adds the "subjects" edge to the Subject entity by IDs. func (_u *StatementUpdateOne) AddSubjectIDs(ids ...uuid.UUID) *StatementUpdateOne { _u.mutation.AddSubjectIDs(ids...) return _u } // AddSubjects adds the "subjects" edges to the Subject entity. func (_u *StatementUpdateOne) AddSubjects(v ...*Subject) *StatementUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddSubjectIDs(ids...) } // SetPolicyID sets the "policy" edge to the AttestationPolicy entity by ID. func (_u *StatementUpdateOne) SetPolicyID(id uuid.UUID) *StatementUpdateOne { _u.mutation.SetPolicyID(id) return _u } // SetNillablePolicyID sets the "policy" edge to the AttestationPolicy entity by ID if the given value is not nil. func (_u *StatementUpdateOne) SetNillablePolicyID(id *uuid.UUID) *StatementUpdateOne { if id != nil { _u = _u.SetPolicyID(*id) } return _u } // SetPolicy sets the "policy" edge to the AttestationPolicy entity. func (_u *StatementUpdateOne) SetPolicy(v *AttestationPolicy) *StatementUpdateOne { return _u.SetPolicyID(v.ID) } // SetAttestationCollectionsID sets the "attestation_collections" edge to the AttestationCollection entity by ID. func (_u *StatementUpdateOne) SetAttestationCollectionsID(id uuid.UUID) *StatementUpdateOne { _u.mutation.SetAttestationCollectionsID(id) return _u } // SetNillableAttestationCollectionsID sets the "attestation_collections" edge to the AttestationCollection entity by ID if the given value is not nil. func (_u *StatementUpdateOne) SetNillableAttestationCollectionsID(id *uuid.UUID) *StatementUpdateOne { if id != nil { _u = _u.SetAttestationCollectionsID(*id) } return _u } // SetAttestationCollections sets the "attestation_collections" edge to the AttestationCollection entity. func (_u *StatementUpdateOne) SetAttestationCollections(v *AttestationCollection) *StatementUpdateOne { return _u.SetAttestationCollectionsID(v.ID) } // AddDsseIDs adds the "dsse" edge to the Dsse entity by IDs. func (_u *StatementUpdateOne) AddDsseIDs(ids ...uuid.UUID) *StatementUpdateOne { _u.mutation.AddDsseIDs(ids...) return _u } // AddDsse adds the "dsse" edges to the Dsse entity. func (_u *StatementUpdateOne) AddDsse(v ...*Dsse) *StatementUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddDsseIDs(ids...) } // Mutation returns the StatementMutation object of the builder. func (_u *StatementUpdateOne) Mutation() *StatementMutation { return _u.mutation } // ClearSubjects clears all "subjects" edges to the Subject entity. func (_u *StatementUpdateOne) ClearSubjects() *StatementUpdateOne { _u.mutation.ClearSubjects() return _u } // RemoveSubjectIDs removes the "subjects" edge to Subject entities by IDs. func (_u *StatementUpdateOne) RemoveSubjectIDs(ids ...uuid.UUID) *StatementUpdateOne { _u.mutation.RemoveSubjectIDs(ids...) return _u } // RemoveSubjects removes "subjects" edges to Subject entities. func (_u *StatementUpdateOne) RemoveSubjects(v ...*Subject) *StatementUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveSubjectIDs(ids...) } // ClearPolicy clears the "policy" edge to the AttestationPolicy entity. func (_u *StatementUpdateOne) ClearPolicy() *StatementUpdateOne { _u.mutation.ClearPolicy() return _u } // ClearAttestationCollections clears the "attestation_collections" edge to the AttestationCollection entity. func (_u *StatementUpdateOne) ClearAttestationCollections() *StatementUpdateOne { _u.mutation.ClearAttestationCollections() return _u } // ClearDsse clears all "dsse" edges to the Dsse entity. func (_u *StatementUpdateOne) ClearDsse() *StatementUpdateOne { _u.mutation.ClearDsse() return _u } // RemoveDsseIDs removes the "dsse" edge to Dsse entities by IDs. func (_u *StatementUpdateOne) RemoveDsseIDs(ids ...uuid.UUID) *StatementUpdateOne { _u.mutation.RemoveDsseIDs(ids...) return _u } // RemoveDsse removes "dsse" edges to Dsse entities. func (_u *StatementUpdateOne) RemoveDsse(v ...*Dsse) *StatementUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveDsseIDs(ids...) } // Where appends a list predicates to the StatementUpdate builder. func (_u *StatementUpdateOne) Where(ps ...predicate.Statement) *StatementUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *StatementUpdateOne) Select(field string, fields ...string) *StatementUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated Statement entity. func (_u *StatementUpdateOne) Save(ctx context.Context) (*Statement, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *StatementUpdateOne) SaveX(ctx context.Context) *Statement { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *StatementUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *StatementUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *StatementUpdateOne) check() error { if v, ok := _u.mutation.Predicate(); ok { if err := statement.PredicateValidator(v); err != nil { return &ValidationError{Name: "predicate", err: fmt.Errorf(`ent: validator failed for field "Statement.predicate": %w`, err)} } } return nil } func (_u *StatementUpdateOne) sqlSave(ctx context.Context) (_node *Statement, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(statement.Table, statement.Columns, sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Statement.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, statement.FieldID) for _, f := range fields { if !statement.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != statement.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Predicate(); ok { _spec.SetField(statement.FieldPredicate, field.TypeString, value) } if _u.mutation.SubjectsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: statement.SubjectsTable, Columns: []string{statement.SubjectsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedSubjectsIDs(); len(nodes) > 0 && !_u.mutation.SubjectsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: statement.SubjectsTable, Columns: []string{statement.SubjectsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SubjectsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: statement.SubjectsTable, Columns: []string{statement.SubjectsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.PolicyCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.PolicyTable, Columns: []string{statement.PolicyColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.PolicyIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.PolicyTable, Columns: []string{statement.PolicyColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationpolicy.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.AttestationCollectionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.AttestationCollectionsTable, Columns: []string{statement.AttestationCollectionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AttestationCollectionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, Inverse: false, Table: statement.AttestationCollectionsTable, Columns: []string{statement.AttestationCollectionsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(attestationcollection.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.DsseCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: statement.DsseTable, Columns: []string{statement.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedDsseIDs(); len(nodes) > 0 && !_u.mutation.DsseCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: statement.DsseTable, Columns: []string{statement.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.DsseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: true, Table: statement.DsseTable, Columns: []string{statement.DsseColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(dsse.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &Statement{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{statement.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/subject.go000066400000000000000000000152161511066247200226300ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" ) // Subject is the model entity for the Subject schema. type Subject struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt *time.Time `json:"created_at,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the SubjectQuery when eager-loading is set. Edges SubjectEdges `json:"edges"` statement_subjects *uuid.UUID selectValues sql.SelectValues } // SubjectEdges holds the relations/edges for other nodes in the graph. type SubjectEdges struct { // SubjectDigests holds the value of the subject_digests edge. SubjectDigests []*SubjectDigest `json:"subject_digests,omitempty"` // Statement holds the value of the statement edge. Statement *Statement `json:"statement,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [2]bool // totalCount holds the count of the edges above. totalCount [2]map[string]int namedSubjectDigests map[string][]*SubjectDigest } // SubjectDigestsOrErr returns the SubjectDigests value or an error if the edge // was not loaded in eager-loading. func (e SubjectEdges) SubjectDigestsOrErr() ([]*SubjectDigest, error) { if e.loadedTypes[0] { return e.SubjectDigests, nil } return nil, &NotLoadedError{edge: "subject_digests"} } // StatementOrErr returns the Statement value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e SubjectEdges) StatementOrErr() (*Statement, error) { if e.Statement != nil { return e.Statement, nil } else if e.loadedTypes[1] { return nil, &NotFoundError{label: statement.Label} } return nil, &NotLoadedError{edge: "statement"} } // scanValues returns the types for scanning values from sql.Rows. func (*Subject) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case subject.FieldName: values[i] = new(sql.NullString) case subject.FieldCreatedAt: values[i] = new(sql.NullTime) case subject.FieldID: values[i] = new(uuid.UUID) case subject.ForeignKeys[0]: // statement_subjects values[i] = &sql.NullScanner{S: new(uuid.UUID)} default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Subject fields. func (_m *Subject) assignValues(columns []string, values []any) 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 subject.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case subject.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = new(time.Time) *_m.CreatedAt = value.Time } case subject.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { _m.Name = value.String } case subject.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field statement_subjects", values[i]) } else if value.Valid { _m.statement_subjects = new(uuid.UUID) *_m.statement_subjects = *value.S.(*uuid.UUID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Subject. // This includes values selected through modifiers, order, etc. func (_m *Subject) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QuerySubjectDigests queries the "subject_digests" edge of the Subject entity. func (_m *Subject) QuerySubjectDigests() *SubjectDigestQuery { return NewSubjectClient(_m.config).QuerySubjectDigests(_m) } // QueryStatement queries the "statement" edge of the Subject entity. func (_m *Subject) QueryStatement() *StatementQuery { return NewSubjectClient(_m.config).QueryStatement(_m) } // Update returns a builder for updating this Subject. // Note that you need to call Subject.Unwrap() before calling this method if this Subject // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Subject) Update() *SubjectUpdateOne { return NewSubjectClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Subject 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 (_m *Subject) Unwrap() *Subject { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Subject is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Subject) String() string { var builder strings.Builder builder.WriteString("Subject(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) if v := _m.CreatedAt; v != nil { builder.WriteString("created_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(_m.Name) builder.WriteByte(')') return builder.String() } // NamedSubjectDigests returns the SubjectDigests named value or an error if the edge was not // loaded in eager-loading with this name. func (_m *Subject) NamedSubjectDigests(name string) ([]*SubjectDigest, error) { if _m.Edges.namedSubjectDigests == nil { return nil, &NotLoadedError{edge: name} } nodes, ok := _m.Edges.namedSubjectDigests[name] if !ok { return nil, &NotLoadedError{edge: name} } return nodes, nil } func (_m *Subject) appendNamedSubjectDigests(name string, edges ...*SubjectDigest) { if _m.Edges.namedSubjectDigests == nil { _m.Edges.namedSubjectDigests = make(map[string][]*SubjectDigest) } if len(edges) == 0 { _m.Edges.namedSubjectDigests[name] = []*SubjectDigest{} } else { _m.Edges.namedSubjectDigests[name] = append(_m.Edges.namedSubjectDigests[name], edges...) } } // Subjects is a parsable slice of Subject. type Subjects []*Subject golang-github-in-toto-archivista-0.11.1/ent/subject/000077500000000000000000000000001511066247200222745ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/subject/subject.go000066400000000000000000000110401511066247200242560ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package subject import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the subject type in the database. Label = "subject" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldName holds the string denoting the name field in the database. FieldName = "name" // EdgeSubjectDigests holds the string denoting the subject_digests edge name in mutations. EdgeSubjectDigests = "subject_digests" // EdgeStatement holds the string denoting the statement edge name in mutations. EdgeStatement = "statement" // Table holds the table name of the subject in the database. Table = "subjects" // SubjectDigestsTable is the table that holds the subject_digests relation/edge. SubjectDigestsTable = "subject_digests" // SubjectDigestsInverseTable is the table name for the SubjectDigest entity. // It exists in this package in order to avoid circular dependency with the "subjectdigest" package. SubjectDigestsInverseTable = "subject_digests" // SubjectDigestsColumn is the table column denoting the subject_digests relation/edge. SubjectDigestsColumn = "subject_subject_digests" // StatementTable is the table that holds the statement relation/edge. StatementTable = "subjects" // StatementInverseTable is the table name for the Statement entity. // It exists in this package in order to avoid circular dependency with the "statement" package. StatementInverseTable = "statements" // StatementColumn is the table column denoting the statement relation/edge. StatementColumn = "statement_subjects" ) // Columns holds all SQL columns for subject fields. var Columns = []string{ FieldID, FieldCreatedAt, FieldName, } // ForeignKeys holds the SQL foreign-keys that are owned by the "subjects" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "statement_subjects", } // 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 ( // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // NameValidator is a validator for the "name" field. It is called by the builders before save. NameValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the Subject queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } // ByName orders the results by the name field. func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() } // BySubjectDigestsCount orders the results by subject_digests count. func BySubjectDigestsCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newSubjectDigestsStep(), opts...) } } // BySubjectDigests orders the results by subject_digests terms. func BySubjectDigests(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSubjectDigestsStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByStatementField orders the results by statement field. func ByStatementField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newStatementStep(), sql.OrderByField(field, opts...)) } } func newSubjectDigestsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SubjectDigestsInverseTable, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, SubjectDigestsTable, SubjectDigestsColumn), ) } func newStatementStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(StatementInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, StatementTable, StatementColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/subject/where.go000066400000000000000000000175301511066247200237430ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package subject import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.Subject { return predicate.Subject(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.Subject { return predicate.Subject(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.Subject { return predicate.Subject(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.Subject { return predicate.Subject(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.Subject { return predicate.Subject(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.Subject { return predicate.Subject(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.Subject { return predicate.Subject(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.Subject { return predicate.Subject(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.Subject { return predicate.Subject(sql.FieldLTE(FieldID, id)) } // CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. func CreatedAt(v time.Time) predicate.Subject { return predicate.Subject(sql.FieldEQ(FieldCreatedAt, v)) } // Name applies equality check predicate on the "name" field. It's identical to NameEQ. func Name(v string) predicate.Subject { return predicate.Subject(sql.FieldEQ(FieldName, v)) } // CreatedAtEQ applies the EQ predicate on the "created_at" field. func CreatedAtEQ(v time.Time) predicate.Subject { return predicate.Subject(sql.FieldEQ(FieldCreatedAt, v)) } // CreatedAtNEQ applies the NEQ predicate on the "created_at" field. func CreatedAtNEQ(v time.Time) predicate.Subject { return predicate.Subject(sql.FieldNEQ(FieldCreatedAt, v)) } // CreatedAtIn applies the In predicate on the "created_at" field. func CreatedAtIn(vs ...time.Time) predicate.Subject { return predicate.Subject(sql.FieldIn(FieldCreatedAt, vs...)) } // CreatedAtNotIn applies the NotIn predicate on the "created_at" field. func CreatedAtNotIn(vs ...time.Time) predicate.Subject { return predicate.Subject(sql.FieldNotIn(FieldCreatedAt, vs...)) } // CreatedAtGT applies the GT predicate on the "created_at" field. func CreatedAtGT(v time.Time) predicate.Subject { return predicate.Subject(sql.FieldGT(FieldCreatedAt, v)) } // CreatedAtGTE applies the GTE predicate on the "created_at" field. func CreatedAtGTE(v time.Time) predicate.Subject { return predicate.Subject(sql.FieldGTE(FieldCreatedAt, v)) } // CreatedAtLT applies the LT predicate on the "created_at" field. func CreatedAtLT(v time.Time) predicate.Subject { return predicate.Subject(sql.FieldLT(FieldCreatedAt, v)) } // CreatedAtLTE applies the LTE predicate on the "created_at" field. func CreatedAtLTE(v time.Time) predicate.Subject { return predicate.Subject(sql.FieldLTE(FieldCreatedAt, v)) } // CreatedAtIsNil applies the IsNil predicate on the "created_at" field. func CreatedAtIsNil() predicate.Subject { return predicate.Subject(sql.FieldIsNull(FieldCreatedAt)) } // CreatedAtNotNil applies the NotNil predicate on the "created_at" field. func CreatedAtNotNil() predicate.Subject { return predicate.Subject(sql.FieldNotNull(FieldCreatedAt)) } // NameEQ applies the EQ predicate on the "name" field. func NameEQ(v string) predicate.Subject { return predicate.Subject(sql.FieldEQ(FieldName, v)) } // NameNEQ applies the NEQ predicate on the "name" field. func NameNEQ(v string) predicate.Subject { return predicate.Subject(sql.FieldNEQ(FieldName, v)) } // NameIn applies the In predicate on the "name" field. func NameIn(vs ...string) predicate.Subject { return predicate.Subject(sql.FieldIn(FieldName, vs...)) } // NameNotIn applies the NotIn predicate on the "name" field. func NameNotIn(vs ...string) predicate.Subject { return predicate.Subject(sql.FieldNotIn(FieldName, vs...)) } // NameGT applies the GT predicate on the "name" field. func NameGT(v string) predicate.Subject { return predicate.Subject(sql.FieldGT(FieldName, v)) } // NameGTE applies the GTE predicate on the "name" field. func NameGTE(v string) predicate.Subject { return predicate.Subject(sql.FieldGTE(FieldName, v)) } // NameLT applies the LT predicate on the "name" field. func NameLT(v string) predicate.Subject { return predicate.Subject(sql.FieldLT(FieldName, v)) } // NameLTE applies the LTE predicate on the "name" field. func NameLTE(v string) predicate.Subject { return predicate.Subject(sql.FieldLTE(FieldName, v)) } // NameContains applies the Contains predicate on the "name" field. func NameContains(v string) predicate.Subject { return predicate.Subject(sql.FieldContains(FieldName, v)) } // NameHasPrefix applies the HasPrefix predicate on the "name" field. func NameHasPrefix(v string) predicate.Subject { return predicate.Subject(sql.FieldHasPrefix(FieldName, v)) } // NameHasSuffix applies the HasSuffix predicate on the "name" field. func NameHasSuffix(v string) predicate.Subject { return predicate.Subject(sql.FieldHasSuffix(FieldName, v)) } // NameEqualFold applies the EqualFold predicate on the "name" field. func NameEqualFold(v string) predicate.Subject { return predicate.Subject(sql.FieldEqualFold(FieldName, v)) } // NameContainsFold applies the ContainsFold predicate on the "name" field. func NameContainsFold(v string) predicate.Subject { return predicate.Subject(sql.FieldContainsFold(FieldName, v)) } // HasSubjectDigests applies the HasEdge predicate on the "subject_digests" edge. func HasSubjectDigests() predicate.Subject { return predicate.Subject(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.O2M, false, SubjectDigestsTable, SubjectDigestsColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasSubjectDigestsWith applies the HasEdge predicate on the "subject_digests" edge with a given conditions (other predicates). func HasSubjectDigestsWith(preds ...predicate.SubjectDigest) predicate.Subject { return predicate.Subject(func(s *sql.Selector) { step := newSubjectDigestsStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) } }) }) } // HasStatement applies the HasEdge predicate on the "statement" edge. func HasStatement() predicate.Subject { return predicate.Subject(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, StatementTable, StatementColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasStatementWith applies the HasEdge predicate on the "statement" edge with a given conditions (other predicates). func HasStatementWith(preds ...predicate.Statement) predicate.Subject { return predicate.Subject(func(s *sql.Selector) { step := newStatementStep() 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.Subject) predicate.Subject { return predicate.Subject(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Subject) predicate.Subject { return predicate.Subject(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Subject) predicate.Subject { return predicate.Subject(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/subject_create.go000066400000000000000000000205551511066247200241550ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "time" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" ) // SubjectCreate is the builder for creating a Subject entity. type SubjectCreate struct { config mutation *SubjectMutation hooks []Hook } // SetCreatedAt sets the "created_at" field. func (_c *SubjectCreate) SetCreatedAt(v time.Time) *SubjectCreate { _c.mutation.SetCreatedAt(v) return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. func (_c *SubjectCreate) SetNillableCreatedAt(v *time.Time) *SubjectCreate { if v != nil { _c.SetCreatedAt(*v) } return _c } // SetName sets the "name" field. func (_c *SubjectCreate) SetName(v string) *SubjectCreate { _c.mutation.SetName(v) return _c } // SetID sets the "id" field. func (_c *SubjectCreate) SetID(v uuid.UUID) *SubjectCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *SubjectCreate) SetNillableID(v *uuid.UUID) *SubjectCreate { if v != nil { _c.SetID(*v) } return _c } // AddSubjectDigestIDs adds the "subject_digests" edge to the SubjectDigest entity by IDs. func (_c *SubjectCreate) AddSubjectDigestIDs(ids ...uuid.UUID) *SubjectCreate { _c.mutation.AddSubjectDigestIDs(ids...) return _c } // AddSubjectDigests adds the "subject_digests" edges to the SubjectDigest entity. func (_c *SubjectCreate) AddSubjectDigests(v ...*SubjectDigest) *SubjectCreate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _c.AddSubjectDigestIDs(ids...) } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_c *SubjectCreate) SetStatementID(id uuid.UUID) *SubjectCreate { _c.mutation.SetStatementID(id) return _c } // SetNillableStatementID sets the "statement" edge to the Statement entity by ID if the given value is not nil. func (_c *SubjectCreate) SetNillableStatementID(id *uuid.UUID) *SubjectCreate { if id != nil { _c = _c.SetStatementID(*id) } return _c } // SetStatement sets the "statement" edge to the Statement entity. func (_c *SubjectCreate) SetStatement(v *Statement) *SubjectCreate { return _c.SetStatementID(v.ID) } // Mutation returns the SubjectMutation object of the builder. func (_c *SubjectCreate) Mutation() *SubjectMutation { return _c.mutation } // Save creates the Subject in the database. func (_c *SubjectCreate) Save(ctx context.Context) (*Subject, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *SubjectCreate) SaveX(ctx context.Context) *Subject { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *SubjectCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *SubjectCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *SubjectCreate) defaults() { if _, ok := _c.mutation.CreatedAt(); !ok { v := subject.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } if _, ok := _c.mutation.ID(); !ok { v := subject.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *SubjectCreate) check() error { if _, ok := _c.mutation.Name(); !ok { return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Subject.name"`)} } if v, ok := _c.mutation.Name(); ok { if err := subject.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Subject.name": %w`, err)} } } return nil } func (_c *SubjectCreate) sqlSave(ctx context.Context) (*Subject, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *SubjectCreate) createSpec() (*Subject, *sqlgraph.CreateSpec) { var ( _node = &Subject{config: _c.config} _spec = sqlgraph.NewCreateSpec(subject.Table, sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(subject.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = &value } if value, ok := _c.mutation.Name(); ok { _spec.SetField(subject.FieldName, field.TypeString, value) _node.Name = value } if nodes := _c.mutation.SubjectDigestsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: subject.SubjectDigestsTable, Columns: []string{subject.SubjectDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges = append(_spec.Edges, edge) } if nodes := _c.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subject.StatementTable, Columns: []string{subject.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.statement_subjects = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // SubjectCreateBulk is the builder for creating many Subject entities in bulk. type SubjectCreateBulk struct { config err error builders []*SubjectCreate } // Save creates the Subject entities in the database. func (_c *SubjectCreateBulk) Save(ctx context.Context) ([]*Subject, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*Subject, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*SubjectMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *SubjectCreateBulk) SaveX(ctx context.Context) []*Subject { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *SubjectCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *SubjectCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/subject_delete.go000066400000000000000000000043151511066247200241500ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/subject" ) // SubjectDelete is the builder for deleting a Subject entity. type SubjectDelete struct { config hooks []Hook mutation *SubjectMutation } // Where appends a list predicates to the SubjectDelete builder. func (_d *SubjectDelete) Where(ps ...predicate.Subject) *SubjectDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *SubjectDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *SubjectDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *SubjectDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(subject.Table, sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // SubjectDeleteOne is the builder for deleting a single Subject entity. type SubjectDeleteOne struct { _d *SubjectDelete } // Where appends a list predicates to the SubjectDelete builder. func (_d *SubjectDeleteOne) Where(ps ...predicate.Subject) *SubjectDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *SubjectDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{subject.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *SubjectDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/subject_query.go000066400000000000000000000521631511066247200240570ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" ) // SubjectQuery is the builder for querying Subject entities. type SubjectQuery struct { config ctx *QueryContext order []subject.OrderOption inters []Interceptor predicates []predicate.Subject withSubjectDigests *SubjectDigestQuery withStatement *StatementQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*Subject) error withNamedSubjectDigests map[string]*SubjectDigestQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the SubjectQuery builder. func (_q *SubjectQuery) Where(ps ...predicate.Subject) *SubjectQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *SubjectQuery) Limit(limit int) *SubjectQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *SubjectQuery) Offset(offset int) *SubjectQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *SubjectQuery) Unique(unique bool) *SubjectQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *SubjectQuery) Order(o ...subject.OrderOption) *SubjectQuery { _q.order = append(_q.order, o...) return _q } // QuerySubjectDigests chains the current query on the "subject_digests" edge. func (_q *SubjectQuery) QuerySubjectDigests() *SubjectDigestQuery { query := (&SubjectDigestClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(subject.Table, subject.FieldID, selector), sqlgraph.To(subjectdigest.Table, subjectdigest.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, subject.SubjectDigestsTable, subject.SubjectDigestsColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryStatement chains the current query on the "statement" edge. func (_q *SubjectQuery) QueryStatement() *StatementQuery { query := (&StatementClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(subject.Table, subject.FieldID, selector), sqlgraph.To(statement.Table, statement.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, subject.StatementTable, subject.StatementColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first Subject entity from the query. // Returns a *NotFoundError when no Subject was found. func (_q *SubjectQuery) First(ctx context.Context) (*Subject, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{subject.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *SubjectQuery) FirstX(ctx context.Context) *Subject { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first Subject ID from the query. // Returns a *NotFoundError when no Subject ID was found. func (_q *SubjectQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{subject.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *SubjectQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single Subject entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Subject entity is found. // Returns a *NotFoundError when no Subject entities are found. func (_q *SubjectQuery) Only(ctx context.Context) (*Subject, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{subject.Label} default: return nil, &NotSingularError{subject.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *SubjectQuery) OnlyX(ctx context.Context) *Subject { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only Subject ID in the query. // Returns a *NotSingularError when more than one Subject ID is found. // Returns a *NotFoundError when no entities are found. func (_q *SubjectQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{subject.Label} default: err = &NotSingularError{subject.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *SubjectQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of Subjects. func (_q *SubjectQuery) All(ctx context.Context) ([]*Subject, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Subject, *SubjectQuery]() return withInterceptors[[]*Subject](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *SubjectQuery) AllX(ctx context.Context) []*Subject { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of Subject IDs. func (_q *SubjectQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(subject.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *SubjectQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *SubjectQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*SubjectQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *SubjectQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *SubjectQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *SubjectQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the SubjectQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *SubjectQuery) Clone() *SubjectQuery { if _q == nil { return nil } return &SubjectQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]subject.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.Subject{}, _q.predicates...), withSubjectDigests: _q.withSubjectDigests.Clone(), withStatement: _q.withStatement.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithSubjectDigests tells the query-builder to eager-load the nodes that are connected to // the "subject_digests" edge. The optional arguments are used to configure the query builder of the edge. func (_q *SubjectQuery) WithSubjectDigests(opts ...func(*SubjectDigestQuery)) *SubjectQuery { query := (&SubjectDigestClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withSubjectDigests = query return _q } // WithStatement tells the query-builder to eager-load the nodes that are connected to // the "statement" edge. The optional arguments are used to configure the query builder of the edge. func (_q *SubjectQuery) WithStatement(opts ...func(*StatementQuery)) *SubjectQuery { query := (&StatementClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withStatement = query return _q } // 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 { // CreatedAt time.Time `json:"created_at,omitempty"` // Count int `json:"count,omitempty"` // } // // client.Subject.Query(). // GroupBy(subject.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *SubjectQuery) GroupBy(field string, fields ...string) *SubjectGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &SubjectGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = subject.Label grbuild.scan = grbuild.Scan return grbuild } // 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 { // CreatedAt time.Time `json:"created_at,omitempty"` // } // // client.Subject.Query(). // Select(subject.FieldCreatedAt). // Scan(ctx, &v) func (_q *SubjectQuery) Select(fields ...string) *SubjectSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &SubjectSelect{SubjectQuery: _q} sbuild.label = subject.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a SubjectSelect configured with the given aggregations. func (_q *SubjectQuery) Aggregate(fns ...AggregateFunc) *SubjectSelect { return _q.Select().Aggregate(fns...) } func (_q *SubjectQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !subject.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *SubjectQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Subject, error) { var ( nodes = []*Subject{} withFKs = _q.withFKs _spec = _q.querySpec() loadedTypes = [2]bool{ _q.withSubjectDigests != nil, _q.withStatement != nil, } ) if _q.withStatement != nil { withFKs = true } if withFKs { _spec.Node.Columns = append(_spec.Node.Columns, subject.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]any, error) { return (*Subject).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &Subject{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withSubjectDigests; query != nil { if err := _q.loadSubjectDigests(ctx, query, nodes, func(n *Subject) { n.Edges.SubjectDigests = []*SubjectDigest{} }, func(n *Subject, e *SubjectDigest) { n.Edges.SubjectDigests = append(n.Edges.SubjectDigests, e) }); err != nil { return nil, err } } if query := _q.withStatement; query != nil { if err := _q.loadStatement(ctx, query, nodes, nil, func(n *Subject, e *Statement) { n.Edges.Statement = e }); err != nil { return nil, err } } for name, query := range _q.withNamedSubjectDigests { if err := _q.loadSubjectDigests(ctx, query, nodes, func(n *Subject) { n.appendNamedSubjectDigests(name) }, func(n *Subject, e *SubjectDigest) { n.appendNamedSubjectDigests(name, e) }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *SubjectQuery) loadSubjectDigests(ctx context.Context, query *SubjectDigestQuery, nodes []*Subject, init func(*Subject), assign func(*Subject, *SubjectDigest)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[uuid.UUID]*Subject) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] if init != nil { init(nodes[i]) } } query.withFKs = true query.Where(predicate.SubjectDigest(func(s *sql.Selector) { s.Where(sql.InValues(s.C(subject.SubjectDigestsColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { fk := n.subject_subject_digests if fk == nil { return fmt.Errorf(`foreign-key "subject_subject_digests" is nil for node %v`, n.ID) } node, ok := nodeids[*fk] if !ok { return fmt.Errorf(`unexpected referenced foreign-key "subject_subject_digests" returned %v for node %v`, *fk, n.ID) } assign(node, n) } return nil } func (_q *SubjectQuery) loadStatement(ctx context.Context, query *StatementQuery, nodes []*Subject, init func(*Subject), assign func(*Subject, *Statement)) error { ids := make([]uuid.UUID, 0, len(nodes)) nodeids := make(map[uuid.UUID][]*Subject) for i := range nodes { if nodes[i].statement_subjects == nil { continue } fk := *nodes[i].statement_subjects if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(statement.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "statement_subjects" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil } func (_q *SubjectQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *SubjectQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(subject.Table, subject.Columns, sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, subject.FieldID) for i := range fields { if fields[i] != subject.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *SubjectQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(subject.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = subject.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // WithNamedSubjectDigests tells the query-builder to eager-load the nodes that are connected to the "subject_digests" // edge with the given name. The optional arguments are used to configure the query builder of the edge. func (_q *SubjectQuery) WithNamedSubjectDigests(name string, opts ...func(*SubjectDigestQuery)) *SubjectQuery { query := (&SubjectDigestClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } if _q.withNamedSubjectDigests == nil { _q.withNamedSubjectDigests = make(map[string]*SubjectDigestQuery) } _q.withNamedSubjectDigests[name] = query return _q } // SubjectGroupBy is the group-by builder for Subject entities. type SubjectGroupBy struct { selector build *SubjectQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *SubjectGroupBy) Aggregate(fns ...AggregateFunc) *SubjectGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *SubjectGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*SubjectQuery, *SubjectGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *SubjectGroupBy) sqlScan(ctx context.Context, root *SubjectQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // SubjectSelect is the builder for selecting fields of Subject entities. type SubjectSelect struct { *SubjectQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *SubjectSelect) Aggregate(fns ...AggregateFunc) *SubjectSelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *SubjectSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*SubjectQuery, *SubjectSelect](ctx, _s.SubjectQuery, _s, _s.inters, v) } func (_s *SubjectSelect) sqlScan(ctx context.Context, root *SubjectQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/subject_update.go000066400000000000000000000366601511066247200242000ustar00rootroot00000000000000// Code generated by ent, 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/google/uuid" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/statement" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" ) // SubjectUpdate is the builder for updating Subject entities. type SubjectUpdate struct { config hooks []Hook mutation *SubjectMutation } // Where appends a list predicates to the SubjectUpdate builder. func (_u *SubjectUpdate) Where(ps ...predicate.Subject) *SubjectUpdate { _u.mutation.Where(ps...) return _u } // SetName sets the "name" field. func (_u *SubjectUpdate) SetName(v string) *SubjectUpdate { _u.mutation.SetName(v) return _u } // SetNillableName sets the "name" field if the given value is not nil. func (_u *SubjectUpdate) SetNillableName(v *string) *SubjectUpdate { if v != nil { _u.SetName(*v) } return _u } // AddSubjectDigestIDs adds the "subject_digests" edge to the SubjectDigest entity by IDs. func (_u *SubjectUpdate) AddSubjectDigestIDs(ids ...uuid.UUID) *SubjectUpdate { _u.mutation.AddSubjectDigestIDs(ids...) return _u } // AddSubjectDigests adds the "subject_digests" edges to the SubjectDigest entity. func (_u *SubjectUpdate) AddSubjectDigests(v ...*SubjectDigest) *SubjectUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddSubjectDigestIDs(ids...) } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_u *SubjectUpdate) SetStatementID(id uuid.UUID) *SubjectUpdate { _u.mutation.SetStatementID(id) return _u } // SetNillableStatementID sets the "statement" edge to the Statement entity by ID if the given value is not nil. func (_u *SubjectUpdate) SetNillableStatementID(id *uuid.UUID) *SubjectUpdate { if id != nil { _u = _u.SetStatementID(*id) } return _u } // SetStatement sets the "statement" edge to the Statement entity. func (_u *SubjectUpdate) SetStatement(v *Statement) *SubjectUpdate { return _u.SetStatementID(v.ID) } // Mutation returns the SubjectMutation object of the builder. func (_u *SubjectUpdate) Mutation() *SubjectMutation { return _u.mutation } // ClearSubjectDigests clears all "subject_digests" edges to the SubjectDigest entity. func (_u *SubjectUpdate) ClearSubjectDigests() *SubjectUpdate { _u.mutation.ClearSubjectDigests() return _u } // RemoveSubjectDigestIDs removes the "subject_digests" edge to SubjectDigest entities by IDs. func (_u *SubjectUpdate) RemoveSubjectDigestIDs(ids ...uuid.UUID) *SubjectUpdate { _u.mutation.RemoveSubjectDigestIDs(ids...) return _u } // RemoveSubjectDigests removes "subject_digests" edges to SubjectDigest entities. func (_u *SubjectUpdate) RemoveSubjectDigests(v ...*SubjectDigest) *SubjectUpdate { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveSubjectDigestIDs(ids...) } // ClearStatement clears the "statement" edge to the Statement entity. func (_u *SubjectUpdate) ClearStatement() *SubjectUpdate { _u.mutation.ClearStatement() return _u } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *SubjectUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *SubjectUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *SubjectUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *SubjectUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *SubjectUpdate) check() error { if v, ok := _u.mutation.Name(); ok { if err := subject.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Subject.name": %w`, err)} } } return nil } func (_u *SubjectUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(subject.Table, subject.Columns, sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if _u.mutation.CreatedAtCleared() { _spec.ClearField(subject.FieldCreatedAt, field.TypeTime) } if value, ok := _u.mutation.Name(); ok { _spec.SetField(subject.FieldName, field.TypeString, value) } if _u.mutation.SubjectDigestsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: subject.SubjectDigestsTable, Columns: []string{subject.SubjectDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedSubjectDigestsIDs(); len(nodes) > 0 && !_u.mutation.SubjectDigestsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: subject.SubjectDigestsTable, Columns: []string{subject.SubjectDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SubjectDigestsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: subject.SubjectDigestsTable, Columns: []string{subject.SubjectDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.StatementCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subject.StatementTable, Columns: []string{subject.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subject.StatementTable, Columns: []string{subject.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{subject.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // SubjectUpdateOne is the builder for updating a single Subject entity. type SubjectUpdateOne struct { config fields []string hooks []Hook mutation *SubjectMutation } // SetName sets the "name" field. func (_u *SubjectUpdateOne) SetName(v string) *SubjectUpdateOne { _u.mutation.SetName(v) return _u } // SetNillableName sets the "name" field if the given value is not nil. func (_u *SubjectUpdateOne) SetNillableName(v *string) *SubjectUpdateOne { if v != nil { _u.SetName(*v) } return _u } // AddSubjectDigestIDs adds the "subject_digests" edge to the SubjectDigest entity by IDs. func (_u *SubjectUpdateOne) AddSubjectDigestIDs(ids ...uuid.UUID) *SubjectUpdateOne { _u.mutation.AddSubjectDigestIDs(ids...) return _u } // AddSubjectDigests adds the "subject_digests" edges to the SubjectDigest entity. func (_u *SubjectUpdateOne) AddSubjectDigests(v ...*SubjectDigest) *SubjectUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddSubjectDigestIDs(ids...) } // SetStatementID sets the "statement" edge to the Statement entity by ID. func (_u *SubjectUpdateOne) SetStatementID(id uuid.UUID) *SubjectUpdateOne { _u.mutation.SetStatementID(id) return _u } // SetNillableStatementID sets the "statement" edge to the Statement entity by ID if the given value is not nil. func (_u *SubjectUpdateOne) SetNillableStatementID(id *uuid.UUID) *SubjectUpdateOne { if id != nil { _u = _u.SetStatementID(*id) } return _u } // SetStatement sets the "statement" edge to the Statement entity. func (_u *SubjectUpdateOne) SetStatement(v *Statement) *SubjectUpdateOne { return _u.SetStatementID(v.ID) } // Mutation returns the SubjectMutation object of the builder. func (_u *SubjectUpdateOne) Mutation() *SubjectMutation { return _u.mutation } // ClearSubjectDigests clears all "subject_digests" edges to the SubjectDigest entity. func (_u *SubjectUpdateOne) ClearSubjectDigests() *SubjectUpdateOne { _u.mutation.ClearSubjectDigests() return _u } // RemoveSubjectDigestIDs removes the "subject_digests" edge to SubjectDigest entities by IDs. func (_u *SubjectUpdateOne) RemoveSubjectDigestIDs(ids ...uuid.UUID) *SubjectUpdateOne { _u.mutation.RemoveSubjectDigestIDs(ids...) return _u } // RemoveSubjectDigests removes "subject_digests" edges to SubjectDigest entities. func (_u *SubjectUpdateOne) RemoveSubjectDigests(v ...*SubjectDigest) *SubjectUpdateOne { ids := make([]uuid.UUID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveSubjectDigestIDs(ids...) } // ClearStatement clears the "statement" edge to the Statement entity. func (_u *SubjectUpdateOne) ClearStatement() *SubjectUpdateOne { _u.mutation.ClearStatement() return _u } // Where appends a list predicates to the SubjectUpdate builder. func (_u *SubjectUpdateOne) Where(ps ...predicate.Subject) *SubjectUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *SubjectUpdateOne) Select(field string, fields ...string) *SubjectUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated Subject entity. func (_u *SubjectUpdateOne) Save(ctx context.Context) (*Subject, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *SubjectUpdateOne) SaveX(ctx context.Context) *Subject { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *SubjectUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *SubjectUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *SubjectUpdateOne) check() error { if v, ok := _u.mutation.Name(); ok { if err := subject.NameValidator(v); err != nil { return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Subject.name": %w`, err)} } } return nil } func (_u *SubjectUpdateOne) sqlSave(ctx context.Context) (_node *Subject, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(subject.Table, subject.Columns, sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Subject.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, subject.FieldID) for _, f := range fields { if !subject.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != subject.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if _u.mutation.CreatedAtCleared() { _spec.ClearField(subject.FieldCreatedAt, field.TypeTime) } if value, ok := _u.mutation.Name(); ok { _spec.SetField(subject.FieldName, field.TypeString, value) } if _u.mutation.SubjectDigestsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: subject.SubjectDigestsTable, Columns: []string{subject.SubjectDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedSubjectDigestsIDs(); len(nodes) > 0 && !_u.mutation.SubjectDigestsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: subject.SubjectDigestsTable, Columns: []string{subject.SubjectDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SubjectDigestsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: subject.SubjectDigestsTable, Columns: []string{subject.SubjectDigestsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.StatementCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subject.StatementTable, Columns: []string{subject.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.StatementIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subject.StatementTable, Columns: []string{subject.StatementColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(statement.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &Subject{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{subject.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/subjectdigest.go000066400000000000000000000124511511066247200240260ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" ) // SubjectDigest is the model entity for the SubjectDigest schema. type SubjectDigest struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Algorithm holds the value of the "algorithm" field. Algorithm string `json:"algorithm,omitempty"` // Value holds the value of the "value" field. Value string `json:"value,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the SubjectDigestQuery when eager-loading is set. Edges SubjectDigestEdges `json:"edges"` subject_subject_digests *uuid.UUID selectValues sql.SelectValues } // SubjectDigestEdges holds the relations/edges for other nodes in the graph. type SubjectDigestEdges struct { // Subject holds the value of the subject edge. Subject *Subject `json:"subject,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [1]bool // totalCount holds the count of the edges above. totalCount [1]map[string]int } // SubjectOrErr returns the Subject value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e SubjectDigestEdges) SubjectOrErr() (*Subject, error) { if e.Subject != nil { return e.Subject, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: subject.Label} } return nil, &NotLoadedError{edge: "subject"} } // scanValues returns the types for scanning values from sql.Rows. func (*SubjectDigest) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case subjectdigest.FieldAlgorithm, subjectdigest.FieldValue: values[i] = new(sql.NullString) case subjectdigest.FieldID: values[i] = new(uuid.UUID) case subjectdigest.ForeignKeys[0]: // subject_subject_digests values[i] = &sql.NullScanner{S: new(uuid.UUID)} default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the SubjectDigest fields. func (_m *SubjectDigest) assignValues(columns []string, values []any) 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 subjectdigest.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case subjectdigest.FieldAlgorithm: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field algorithm", values[i]) } else if value.Valid { _m.Algorithm = value.String } case subjectdigest.FieldValue: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field value", values[i]) } else if value.Valid { _m.Value = value.String } case subjectdigest.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field subject_subject_digests", values[i]) } else if value.Valid { _m.subject_subject_digests = new(uuid.UUID) *_m.subject_subject_digests = *value.S.(*uuid.UUID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // GetValue returns the ent.Value that was dynamically selected and assigned to the SubjectDigest. // This includes values selected through modifiers, order, etc. func (_m *SubjectDigest) GetValue(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QuerySubject queries the "subject" edge of the SubjectDigest entity. func (_m *SubjectDigest) QuerySubject() *SubjectQuery { return NewSubjectDigestClient(_m.config).QuerySubject(_m) } // Update returns a builder for updating this SubjectDigest. // Note that you need to call SubjectDigest.Unwrap() before calling this method if this SubjectDigest // was returned from a transaction, and the transaction was committed or rolled back. func (_m *SubjectDigest) Update() *SubjectDigestUpdateOne { return NewSubjectDigestClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the SubjectDigest 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 (_m *SubjectDigest) Unwrap() *SubjectDigest { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: SubjectDigest is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *SubjectDigest) String() string { var builder strings.Builder builder.WriteString("SubjectDigest(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("algorithm=") builder.WriteString(_m.Algorithm) builder.WriteString(", ") builder.WriteString("value=") builder.WriteString(_m.Value) builder.WriteByte(')') return builder.String() } // SubjectDigests is a parsable slice of SubjectDigest. type SubjectDigests []*SubjectDigest golang-github-in-toto-archivista-0.11.1/ent/subjectdigest/000077500000000000000000000000001511066247200234745ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/subjectdigest/subjectdigest.go000066400000000000000000000063251511066247200266700ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package subjectdigest import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the subjectdigest type in the database. Label = "subject_digest" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldAlgorithm holds the string denoting the algorithm field in the database. FieldAlgorithm = "algorithm" // FieldValue holds the string denoting the value field in the database. FieldValue = "value" // EdgeSubject holds the string denoting the subject edge name in mutations. EdgeSubject = "subject" // Table holds the table name of the subjectdigest in the database. Table = "subject_digests" // SubjectTable is the table that holds the subject relation/edge. SubjectTable = "subject_digests" // SubjectInverseTable is the table name for the Subject entity. // It exists in this package in order to avoid circular dependency with the "subject" package. SubjectInverseTable = "subjects" // SubjectColumn is the table column denoting the subject relation/edge. SubjectColumn = "subject_subject_digests" ) // Columns holds all SQL columns for subjectdigest fields. var Columns = []string{ FieldID, FieldAlgorithm, FieldValue, } // ForeignKeys holds the SQL foreign-keys that are owned by the "subject_digests" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "subject_subject_digests", } // 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 ( // AlgorithmValidator is a validator for the "algorithm" field. It is called by the builders before save. AlgorithmValidator func(string) error // ValueValidator is a validator for the "value" field. It is called by the builders before save. ValueValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the SubjectDigest queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByAlgorithm orders the results by the algorithm field. func ByAlgorithm(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAlgorithm, opts...).ToFunc() } // ByValue orders the results by the value field. func ByValue(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldValue, opts...).ToFunc() } // BySubjectField orders the results by subject field. func BySubjectField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSubjectStep(), sql.OrderByField(field, opts...)) } } func newSubjectStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SubjectInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SubjectTable, SubjectColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/subjectdigest/where.go000066400000000000000000000203551511066247200251420ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package subjectdigest import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldLTE(FieldID, id)) } // Algorithm applies equality check predicate on the "algorithm" field. It's identical to AlgorithmEQ. func Algorithm(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldEQ(FieldAlgorithm, v)) } // Value applies equality check predicate on the "value" field. It's identical to ValueEQ. func Value(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldEQ(FieldValue, v)) } // AlgorithmEQ applies the EQ predicate on the "algorithm" field. func AlgorithmEQ(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldEQ(FieldAlgorithm, v)) } // AlgorithmNEQ applies the NEQ predicate on the "algorithm" field. func AlgorithmNEQ(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldNEQ(FieldAlgorithm, v)) } // AlgorithmIn applies the In predicate on the "algorithm" field. func AlgorithmIn(vs ...string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldIn(FieldAlgorithm, vs...)) } // AlgorithmNotIn applies the NotIn predicate on the "algorithm" field. func AlgorithmNotIn(vs ...string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldNotIn(FieldAlgorithm, vs...)) } // AlgorithmGT applies the GT predicate on the "algorithm" field. func AlgorithmGT(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldGT(FieldAlgorithm, v)) } // AlgorithmGTE applies the GTE predicate on the "algorithm" field. func AlgorithmGTE(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldGTE(FieldAlgorithm, v)) } // AlgorithmLT applies the LT predicate on the "algorithm" field. func AlgorithmLT(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldLT(FieldAlgorithm, v)) } // AlgorithmLTE applies the LTE predicate on the "algorithm" field. func AlgorithmLTE(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldLTE(FieldAlgorithm, v)) } // AlgorithmContains applies the Contains predicate on the "algorithm" field. func AlgorithmContains(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldContains(FieldAlgorithm, v)) } // AlgorithmHasPrefix applies the HasPrefix predicate on the "algorithm" field. func AlgorithmHasPrefix(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldHasPrefix(FieldAlgorithm, v)) } // AlgorithmHasSuffix applies the HasSuffix predicate on the "algorithm" field. func AlgorithmHasSuffix(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldHasSuffix(FieldAlgorithm, v)) } // AlgorithmEqualFold applies the EqualFold predicate on the "algorithm" field. func AlgorithmEqualFold(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldEqualFold(FieldAlgorithm, v)) } // AlgorithmContainsFold applies the ContainsFold predicate on the "algorithm" field. func AlgorithmContainsFold(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldContainsFold(FieldAlgorithm, v)) } // ValueEQ applies the EQ predicate on the "value" field. func ValueEQ(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldEQ(FieldValue, v)) } // ValueNEQ applies the NEQ predicate on the "value" field. func ValueNEQ(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldNEQ(FieldValue, v)) } // ValueIn applies the In predicate on the "value" field. func ValueIn(vs ...string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldIn(FieldValue, vs...)) } // ValueNotIn applies the NotIn predicate on the "value" field. func ValueNotIn(vs ...string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldNotIn(FieldValue, vs...)) } // ValueGT applies the GT predicate on the "value" field. func ValueGT(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldGT(FieldValue, v)) } // ValueGTE applies the GTE predicate on the "value" field. func ValueGTE(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldGTE(FieldValue, v)) } // ValueLT applies the LT predicate on the "value" field. func ValueLT(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldLT(FieldValue, v)) } // ValueLTE applies the LTE predicate on the "value" field. func ValueLTE(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldLTE(FieldValue, v)) } // ValueContains applies the Contains predicate on the "value" field. func ValueContains(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldContains(FieldValue, v)) } // ValueHasPrefix applies the HasPrefix predicate on the "value" field. func ValueHasPrefix(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldHasPrefix(FieldValue, v)) } // ValueHasSuffix applies the HasSuffix predicate on the "value" field. func ValueHasSuffix(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldHasSuffix(FieldValue, v)) } // ValueEqualFold applies the EqualFold predicate on the "value" field. func ValueEqualFold(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldEqualFold(FieldValue, v)) } // ValueContainsFold applies the ContainsFold predicate on the "value" field. func ValueContainsFold(v string) predicate.SubjectDigest { return predicate.SubjectDigest(sql.FieldContainsFold(FieldValue, v)) } // HasSubject applies the HasEdge predicate on the "subject" edge. func HasSubject() predicate.SubjectDigest { return predicate.SubjectDigest(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SubjectTable, SubjectColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasSubjectWith applies the HasEdge predicate on the "subject" edge with a given conditions (other predicates). func HasSubjectWith(preds ...predicate.Subject) predicate.SubjectDigest { return predicate.SubjectDigest(func(s *sql.Selector) { step := newSubjectStep() 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.SubjectDigest) predicate.SubjectDigest { return predicate.SubjectDigest(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.SubjectDigest) predicate.SubjectDigest { return predicate.SubjectDigest(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.SubjectDigest) predicate.SubjectDigest { return predicate.SubjectDigest(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/subjectdigest_create.go000066400000000000000000000173441511066247200253570ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" ) // SubjectDigestCreate is the builder for creating a SubjectDigest entity. type SubjectDigestCreate struct { config mutation *SubjectDigestMutation hooks []Hook } // SetAlgorithm sets the "algorithm" field. func (_c *SubjectDigestCreate) SetAlgorithm(v string) *SubjectDigestCreate { _c.mutation.SetAlgorithm(v) return _c } // SetValue sets the "value" field. func (_c *SubjectDigestCreate) SetValue(v string) *SubjectDigestCreate { _c.mutation.SetValue(v) return _c } // SetID sets the "id" field. func (_c *SubjectDigestCreate) SetID(v uuid.UUID) *SubjectDigestCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *SubjectDigestCreate) SetNillableID(v *uuid.UUID) *SubjectDigestCreate { if v != nil { _c.SetID(*v) } return _c } // SetSubjectID sets the "subject" edge to the Subject entity by ID. func (_c *SubjectDigestCreate) SetSubjectID(id uuid.UUID) *SubjectDigestCreate { _c.mutation.SetSubjectID(id) return _c } // SetNillableSubjectID sets the "subject" edge to the Subject entity by ID if the given value is not nil. func (_c *SubjectDigestCreate) SetNillableSubjectID(id *uuid.UUID) *SubjectDigestCreate { if id != nil { _c = _c.SetSubjectID(*id) } return _c } // SetSubject sets the "subject" edge to the Subject entity. func (_c *SubjectDigestCreate) SetSubject(v *Subject) *SubjectDigestCreate { return _c.SetSubjectID(v.ID) } // Mutation returns the SubjectDigestMutation object of the builder. func (_c *SubjectDigestCreate) Mutation() *SubjectDigestMutation { return _c.mutation } // Save creates the SubjectDigest in the database. func (_c *SubjectDigestCreate) Save(ctx context.Context) (*SubjectDigest, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *SubjectDigestCreate) SaveX(ctx context.Context) *SubjectDigest { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *SubjectDigestCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *SubjectDigestCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *SubjectDigestCreate) defaults() { if _, ok := _c.mutation.ID(); !ok { v := subjectdigest.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *SubjectDigestCreate) check() error { if _, ok := _c.mutation.Algorithm(); !ok { return &ValidationError{Name: "algorithm", err: errors.New(`ent: missing required field "SubjectDigest.algorithm"`)} } if v, ok := _c.mutation.Algorithm(); ok { if err := subjectdigest.AlgorithmValidator(v); err != nil { return &ValidationError{Name: "algorithm", err: fmt.Errorf(`ent: validator failed for field "SubjectDigest.algorithm": %w`, err)} } } if _, ok := _c.mutation.Value(); !ok { return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "SubjectDigest.value"`)} } if v, ok := _c.mutation.Value(); ok { if err := subjectdigest.ValueValidator(v); err != nil { return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "SubjectDigest.value": %w`, err)} } } return nil } func (_c *SubjectDigestCreate) sqlSave(ctx context.Context) (*SubjectDigest, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *SubjectDigestCreate) createSpec() (*SubjectDigest, *sqlgraph.CreateSpec) { var ( _node = &SubjectDigest{config: _c.config} _spec = sqlgraph.NewCreateSpec(subjectdigest.Table, sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.Algorithm(); ok { _spec.SetField(subjectdigest.FieldAlgorithm, field.TypeString, value) _node.Algorithm = value } if value, ok := _c.mutation.Value(); ok { _spec.SetField(subjectdigest.FieldValue, field.TypeString, value) _node.Value = value } if nodes := _c.mutation.SubjectIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subjectdigest.SubjectTable, Columns: []string{subjectdigest.SubjectColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.subject_subject_digests = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // SubjectDigestCreateBulk is the builder for creating many SubjectDigest entities in bulk. type SubjectDigestCreateBulk struct { config err error builders []*SubjectDigestCreate } // Save creates the SubjectDigest entities in the database. func (_c *SubjectDigestCreateBulk) Save(ctx context.Context) ([]*SubjectDigest, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*SubjectDigest, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*SubjectDigestMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *SubjectDigestCreateBulk) SaveX(ctx context.Context) []*SubjectDigest { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *SubjectDigestCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *SubjectDigestCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/subjectdigest_delete.go000066400000000000000000000045431511066247200253530ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/subjectdigest" ) // SubjectDigestDelete is the builder for deleting a SubjectDigest entity. type SubjectDigestDelete struct { config hooks []Hook mutation *SubjectDigestMutation } // Where appends a list predicates to the SubjectDigestDelete builder. func (_d *SubjectDigestDelete) Where(ps ...predicate.SubjectDigest) *SubjectDigestDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *SubjectDigestDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *SubjectDigestDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *SubjectDigestDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(subjectdigest.Table, sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // SubjectDigestDeleteOne is the builder for deleting a single SubjectDigest entity. type SubjectDigestDeleteOne struct { _d *SubjectDigestDelete } // Where appends a list predicates to the SubjectDigestDelete builder. func (_d *SubjectDigestDeleteOne) Where(ps ...predicate.SubjectDigest) *SubjectDigestDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *SubjectDigestDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{subjectdigest.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *SubjectDigestDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/subjectdigest_query.go000066400000000000000000000442201511066247200252520ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" ) // SubjectDigestQuery is the builder for querying SubjectDigest entities. type SubjectDigestQuery struct { config ctx *QueryContext order []subjectdigest.OrderOption inters []Interceptor predicates []predicate.SubjectDigest withSubject *SubjectQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*SubjectDigest) error // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the SubjectDigestQuery builder. func (_q *SubjectDigestQuery) Where(ps ...predicate.SubjectDigest) *SubjectDigestQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *SubjectDigestQuery) Limit(limit int) *SubjectDigestQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *SubjectDigestQuery) Offset(offset int) *SubjectDigestQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *SubjectDigestQuery) Unique(unique bool) *SubjectDigestQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *SubjectDigestQuery) Order(o ...subjectdigest.OrderOption) *SubjectDigestQuery { _q.order = append(_q.order, o...) return _q } // QuerySubject chains the current query on the "subject" edge. func (_q *SubjectDigestQuery) QuerySubject() *SubjectQuery { query := (&SubjectClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(subjectdigest.Table, subjectdigest.FieldID, selector), sqlgraph.To(subject.Table, subject.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, subjectdigest.SubjectTable, subjectdigest.SubjectColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first SubjectDigest entity from the query. // Returns a *NotFoundError when no SubjectDigest was found. func (_q *SubjectDigestQuery) First(ctx context.Context) (*SubjectDigest, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{subjectdigest.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *SubjectDigestQuery) FirstX(ctx context.Context) *SubjectDigest { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first SubjectDigest ID from the query. // Returns a *NotFoundError when no SubjectDigest ID was found. func (_q *SubjectDigestQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{subjectdigest.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *SubjectDigestQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single SubjectDigest entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one SubjectDigest entity is found. // Returns a *NotFoundError when no SubjectDigest entities are found. func (_q *SubjectDigestQuery) Only(ctx context.Context) (*SubjectDigest, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{subjectdigest.Label} default: return nil, &NotSingularError{subjectdigest.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *SubjectDigestQuery) OnlyX(ctx context.Context) *SubjectDigest { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only SubjectDigest ID in the query. // Returns a *NotSingularError when more than one SubjectDigest ID is found. // Returns a *NotFoundError when no entities are found. func (_q *SubjectDigestQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{subjectdigest.Label} default: err = &NotSingularError{subjectdigest.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *SubjectDigestQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of SubjectDigests. func (_q *SubjectDigestQuery) All(ctx context.Context) ([]*SubjectDigest, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*SubjectDigest, *SubjectDigestQuery]() return withInterceptors[[]*SubjectDigest](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *SubjectDigestQuery) AllX(ctx context.Context) []*SubjectDigest { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of SubjectDigest IDs. func (_q *SubjectDigestQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(subjectdigest.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *SubjectDigestQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *SubjectDigestQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*SubjectDigestQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *SubjectDigestQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *SubjectDigestQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *SubjectDigestQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the SubjectDigestQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *SubjectDigestQuery) Clone() *SubjectDigestQuery { if _q == nil { return nil } return &SubjectDigestQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]subjectdigest.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.SubjectDigest{}, _q.predicates...), withSubject: _q.withSubject.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithSubject tells the query-builder to eager-load the nodes that are connected to // the "subject" edge. The optional arguments are used to configure the query builder of the edge. func (_q *SubjectDigestQuery) WithSubject(opts ...func(*SubjectQuery)) *SubjectDigestQuery { query := (&SubjectClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withSubject = query return _q } // 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 { // Algorithm string `json:"algorithm,omitempty"` // Count int `json:"count,omitempty"` // } // // client.SubjectDigest.Query(). // GroupBy(subjectdigest.FieldAlgorithm). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *SubjectDigestQuery) GroupBy(field string, fields ...string) *SubjectDigestGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &SubjectDigestGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = subjectdigest.Label grbuild.scan = grbuild.Scan return grbuild } // 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 { // Algorithm string `json:"algorithm,omitempty"` // } // // client.SubjectDigest.Query(). // Select(subjectdigest.FieldAlgorithm). // Scan(ctx, &v) func (_q *SubjectDigestQuery) Select(fields ...string) *SubjectDigestSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &SubjectDigestSelect{SubjectDigestQuery: _q} sbuild.label = subjectdigest.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a SubjectDigestSelect configured with the given aggregations. func (_q *SubjectDigestQuery) Aggregate(fns ...AggregateFunc) *SubjectDigestSelect { return _q.Select().Aggregate(fns...) } func (_q *SubjectDigestQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !subjectdigest.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *SubjectDigestQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*SubjectDigest, error) { var ( nodes = []*SubjectDigest{} withFKs = _q.withFKs _spec = _q.querySpec() loadedTypes = [1]bool{ _q.withSubject != nil, } ) if _q.withSubject != nil { withFKs = true } if withFKs { _spec.Node.Columns = append(_spec.Node.Columns, subjectdigest.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]any, error) { return (*SubjectDigest).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &SubjectDigest{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withSubject; query != nil { if err := _q.loadSubject(ctx, query, nodes, nil, func(n *SubjectDigest, e *Subject) { n.Edges.Subject = e }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *SubjectDigestQuery) loadSubject(ctx context.Context, query *SubjectQuery, nodes []*SubjectDigest, init func(*SubjectDigest), assign func(*SubjectDigest, *Subject)) error { ids := make([]uuid.UUID, 0, len(nodes)) nodeids := make(map[uuid.UUID][]*SubjectDigest) for i := range nodes { if nodes[i].subject_subject_digests == nil { continue } fk := *nodes[i].subject_subject_digests if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(subject.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "subject_subject_digests" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil } func (_q *SubjectDigestQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *SubjectDigestQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(subjectdigest.Table, subjectdigest.Columns, sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, subjectdigest.FieldID) for i := range fields { if fields[i] != subjectdigest.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *SubjectDigestQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(subjectdigest.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = subjectdigest.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // SubjectDigestGroupBy is the group-by builder for SubjectDigest entities. type SubjectDigestGroupBy struct { selector build *SubjectDigestQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *SubjectDigestGroupBy) Aggregate(fns ...AggregateFunc) *SubjectDigestGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *SubjectDigestGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*SubjectDigestQuery, *SubjectDigestGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *SubjectDigestGroupBy) sqlScan(ctx context.Context, root *SubjectDigestQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // SubjectDigestSelect is the builder for selecting fields of SubjectDigest entities. type SubjectDigestSelect struct { *SubjectDigestQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *SubjectDigestSelect) Aggregate(fns ...AggregateFunc) *SubjectDigestSelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *SubjectDigestSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*SubjectDigestQuery, *SubjectDigestSelect](ctx, _s.SubjectDigestQuery, _s, _s.inters, v) } func (_s *SubjectDigestSelect) sqlScan(ctx context.Context, root *SubjectDigestQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/subjectdigest_update.go000066400000000000000000000275111511066247200253730ustar00rootroot00000000000000// Code generated by ent, 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/google/uuid" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/subject" "github.com/in-toto/archivista/ent/subjectdigest" ) // SubjectDigestUpdate is the builder for updating SubjectDigest entities. type SubjectDigestUpdate struct { config hooks []Hook mutation *SubjectDigestMutation } // Where appends a list predicates to the SubjectDigestUpdate builder. func (_u *SubjectDigestUpdate) Where(ps ...predicate.SubjectDigest) *SubjectDigestUpdate { _u.mutation.Where(ps...) return _u } // SetAlgorithm sets the "algorithm" field. func (_u *SubjectDigestUpdate) SetAlgorithm(v string) *SubjectDigestUpdate { _u.mutation.SetAlgorithm(v) return _u } // SetNillableAlgorithm sets the "algorithm" field if the given value is not nil. func (_u *SubjectDigestUpdate) SetNillableAlgorithm(v *string) *SubjectDigestUpdate { if v != nil { _u.SetAlgorithm(*v) } return _u } // SetValue sets the "value" field. func (_u *SubjectDigestUpdate) SetValue(v string) *SubjectDigestUpdate { _u.mutation.SetValue(v) return _u } // SetNillableValue sets the "value" field if the given value is not nil. func (_u *SubjectDigestUpdate) SetNillableValue(v *string) *SubjectDigestUpdate { if v != nil { _u.SetValue(*v) } return _u } // SetSubjectID sets the "subject" edge to the Subject entity by ID. func (_u *SubjectDigestUpdate) SetSubjectID(id uuid.UUID) *SubjectDigestUpdate { _u.mutation.SetSubjectID(id) return _u } // SetNillableSubjectID sets the "subject" edge to the Subject entity by ID if the given value is not nil. func (_u *SubjectDigestUpdate) SetNillableSubjectID(id *uuid.UUID) *SubjectDigestUpdate { if id != nil { _u = _u.SetSubjectID(*id) } return _u } // SetSubject sets the "subject" edge to the Subject entity. func (_u *SubjectDigestUpdate) SetSubject(v *Subject) *SubjectDigestUpdate { return _u.SetSubjectID(v.ID) } // Mutation returns the SubjectDigestMutation object of the builder. func (_u *SubjectDigestUpdate) Mutation() *SubjectDigestMutation { return _u.mutation } // ClearSubject clears the "subject" edge to the Subject entity. func (_u *SubjectDigestUpdate) ClearSubject() *SubjectDigestUpdate { _u.mutation.ClearSubject() return _u } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *SubjectDigestUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *SubjectDigestUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *SubjectDigestUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *SubjectDigestUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *SubjectDigestUpdate) check() error { if v, ok := _u.mutation.Algorithm(); ok { if err := subjectdigest.AlgorithmValidator(v); err != nil { return &ValidationError{Name: "algorithm", err: fmt.Errorf(`ent: validator failed for field "SubjectDigest.algorithm": %w`, err)} } } if v, ok := _u.mutation.Value(); ok { if err := subjectdigest.ValueValidator(v); err != nil { return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "SubjectDigest.value": %w`, err)} } } return nil } func (_u *SubjectDigestUpdate) sqlSave(ctx context.Context) (_node int, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(subjectdigest.Table, subjectdigest.Columns, sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Algorithm(); ok { _spec.SetField(subjectdigest.FieldAlgorithm, field.TypeString, value) } if value, ok := _u.mutation.Value(); ok { _spec.SetField(subjectdigest.FieldValue, field.TypeString, value) } if _u.mutation.SubjectCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subjectdigest.SubjectTable, Columns: []string{subjectdigest.SubjectColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SubjectIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subjectdigest.SubjectTable, Columns: []string{subjectdigest.SubjectColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{subjectdigest.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // SubjectDigestUpdateOne is the builder for updating a single SubjectDigest entity. type SubjectDigestUpdateOne struct { config fields []string hooks []Hook mutation *SubjectDigestMutation } // SetAlgorithm sets the "algorithm" field. func (_u *SubjectDigestUpdateOne) SetAlgorithm(v string) *SubjectDigestUpdateOne { _u.mutation.SetAlgorithm(v) return _u } // SetNillableAlgorithm sets the "algorithm" field if the given value is not nil. func (_u *SubjectDigestUpdateOne) SetNillableAlgorithm(v *string) *SubjectDigestUpdateOne { if v != nil { _u.SetAlgorithm(*v) } return _u } // SetValue sets the "value" field. func (_u *SubjectDigestUpdateOne) SetValue(v string) *SubjectDigestUpdateOne { _u.mutation.SetValue(v) return _u } // SetNillableValue sets the "value" field if the given value is not nil. func (_u *SubjectDigestUpdateOne) SetNillableValue(v *string) *SubjectDigestUpdateOne { if v != nil { _u.SetValue(*v) } return _u } // SetSubjectID sets the "subject" edge to the Subject entity by ID. func (_u *SubjectDigestUpdateOne) SetSubjectID(id uuid.UUID) *SubjectDigestUpdateOne { _u.mutation.SetSubjectID(id) return _u } // SetNillableSubjectID sets the "subject" edge to the Subject entity by ID if the given value is not nil. func (_u *SubjectDigestUpdateOne) SetNillableSubjectID(id *uuid.UUID) *SubjectDigestUpdateOne { if id != nil { _u = _u.SetSubjectID(*id) } return _u } // SetSubject sets the "subject" edge to the Subject entity. func (_u *SubjectDigestUpdateOne) SetSubject(v *Subject) *SubjectDigestUpdateOne { return _u.SetSubjectID(v.ID) } // Mutation returns the SubjectDigestMutation object of the builder. func (_u *SubjectDigestUpdateOne) Mutation() *SubjectDigestMutation { return _u.mutation } // ClearSubject clears the "subject" edge to the Subject entity. func (_u *SubjectDigestUpdateOne) ClearSubject() *SubjectDigestUpdateOne { _u.mutation.ClearSubject() return _u } // Where appends a list predicates to the SubjectDigestUpdate builder. func (_u *SubjectDigestUpdateOne) Where(ps ...predicate.SubjectDigest) *SubjectDigestUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *SubjectDigestUpdateOne) Select(field string, fields ...string) *SubjectDigestUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated SubjectDigest entity. func (_u *SubjectDigestUpdateOne) Save(ctx context.Context) (*SubjectDigest, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *SubjectDigestUpdateOne) SaveX(ctx context.Context) *SubjectDigest { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *SubjectDigestUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *SubjectDigestUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // check runs all checks and user-defined validators on the builder. func (_u *SubjectDigestUpdateOne) check() error { if v, ok := _u.mutation.Algorithm(); ok { if err := subjectdigest.AlgorithmValidator(v); err != nil { return &ValidationError{Name: "algorithm", err: fmt.Errorf(`ent: validator failed for field "SubjectDigest.algorithm": %w`, err)} } } if v, ok := _u.mutation.Value(); ok { if err := subjectdigest.ValueValidator(v); err != nil { return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "SubjectDigest.value": %w`, err)} } } return nil } func (_u *SubjectDigestUpdateOne) sqlSave(ctx context.Context) (_node *SubjectDigest, err error) { if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(subjectdigest.Table, subjectdigest.Columns, sqlgraph.NewFieldSpec(subjectdigest.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "SubjectDigest.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, subjectdigest.FieldID) for _, f := range fields { if !subjectdigest.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != subjectdigest.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.Algorithm(); ok { _spec.SetField(subjectdigest.FieldAlgorithm, field.TypeString, value) } if value, ok := _u.mutation.Value(); ok { _spec.SetField(subjectdigest.FieldValue, field.TypeString, value) } if _u.mutation.SubjectCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subjectdigest.SubjectTable, Columns: []string{subjectdigest.SubjectColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SubjectIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: subjectdigest.SubjectTable, Columns: []string{subjectdigest.SubjectColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(subject.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &SubjectDigest{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{subjectdigest.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/timestamp.go000066400000000000000000000123101511066247200231640ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/timestamp" ) // Timestamp is the model entity for the Timestamp schema. type Timestamp struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Type holds the value of the "type" field. Type string `json:"type,omitempty"` // Timestamp holds the value of the "timestamp" field. Timestamp time.Time `json:"timestamp,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the TimestampQuery when eager-loading is set. Edges TimestampEdges `json:"edges"` signature_timestamps *uuid.UUID selectValues sql.SelectValues } // TimestampEdges holds the relations/edges for other nodes in the graph. type TimestampEdges struct { // Signature holds the value of the signature edge. Signature *Signature `json:"signature,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [1]bool // totalCount holds the count of the edges above. totalCount [1]map[string]int } // SignatureOrErr returns the Signature value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e TimestampEdges) SignatureOrErr() (*Signature, error) { if e.Signature != nil { return e.Signature, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: signature.Label} } return nil, &NotLoadedError{edge: "signature"} } // scanValues returns the types for scanning values from sql.Rows. func (*Timestamp) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case timestamp.FieldType: values[i] = new(sql.NullString) case timestamp.FieldTimestamp: values[i] = new(sql.NullTime) case timestamp.FieldID: values[i] = new(uuid.UUID) case timestamp.ForeignKeys[0]: // signature_timestamps values[i] = &sql.NullScanner{S: new(uuid.UUID)} default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Timestamp fields. func (_m *Timestamp) assignValues(columns []string, values []any) 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 timestamp.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case timestamp.FieldType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field type", values[i]) } else if value.Valid { _m.Type = value.String } case timestamp.FieldTimestamp: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field timestamp", values[i]) } else if value.Valid { _m.Timestamp = value.Time } case timestamp.ForeignKeys[0]: if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field signature_timestamps", values[i]) } else if value.Valid { _m.signature_timestamps = new(uuid.UUID) *_m.signature_timestamps = *value.S.(*uuid.UUID) } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Timestamp. // This includes values selected through modifiers, order, etc. func (_m *Timestamp) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QuerySignature queries the "signature" edge of the Timestamp entity. func (_m *Timestamp) QuerySignature() *SignatureQuery { return NewTimestampClient(_m.config).QuerySignature(_m) } // Update returns a builder for updating this Timestamp. // Note that you need to call Timestamp.Unwrap() before calling this method if this Timestamp // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Timestamp) Update() *TimestampUpdateOne { return NewTimestampClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Timestamp 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 (_m *Timestamp) Unwrap() *Timestamp { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Timestamp is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Timestamp) String() string { var builder strings.Builder builder.WriteString("Timestamp(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("type=") builder.WriteString(_m.Type) builder.WriteString(", ") builder.WriteString("timestamp=") builder.WriteString(_m.Timestamp.Format(time.ANSIC)) builder.WriteByte(')') return builder.String() } // Timestamps is a parsable slice of Timestamp. type Timestamps []*Timestamp golang-github-in-toto-archivista-0.11.1/ent/timestamp/000077500000000000000000000000001511066247200226405ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/ent/timestamp/timestamp.go000066400000000000000000000056641511066247200252050ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package timestamp import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" ) const ( // Label holds the string label denoting the timestamp type in the database. Label = "timestamp" // 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" // FieldTimestamp holds the string denoting the timestamp field in the database. FieldTimestamp = "timestamp" // EdgeSignature holds the string denoting the signature edge name in mutations. EdgeSignature = "signature" // Table holds the table name of the timestamp in the database. Table = "timestamps" // SignatureTable is the table that holds the signature relation/edge. SignatureTable = "timestamps" // SignatureInverseTable is the table name for the Signature entity. // It exists in this package in order to avoid circular dependency with the "signature" package. SignatureInverseTable = "signatures" // SignatureColumn is the table column denoting the signature relation/edge. SignatureColumn = "signature_timestamps" ) // Columns holds all SQL columns for timestamp fields. var Columns = []string{ FieldID, FieldType, FieldTimestamp, } // ForeignKeys holds the SQL foreign-keys that are owned by the "timestamps" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "signature_timestamps", } // 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 ( // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the Timestamp queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByType orders the results by the type field. func ByType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldType, opts...).ToFunc() } // ByTimestamp orders the results by the timestamp field. func ByTimestamp(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldTimestamp, opts...).ToFunc() } // BySignatureField orders the results by signature field. func BySignatureField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSignatureStep(), sql.OrderByField(field, opts...)) } } func newSignatureStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(SignatureInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SignatureTable, SignatureColumn), ) } golang-github-in-toto-archivista-0.11.1/ent/timestamp/where.go000066400000000000000000000155761511066247200243170ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package timestamp import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" ) // ID filters vertices based on their ID field. func ID(id uuid.UUID) predicate.Timestamp { return predicate.Timestamp(sql.FieldEQ(FieldID, id)) } // IDEQ applies the EQ predicate on the ID field. func IDEQ(id uuid.UUID) predicate.Timestamp { return predicate.Timestamp(sql.FieldEQ(FieldID, id)) } // IDNEQ applies the NEQ predicate on the ID field. func IDNEQ(id uuid.UUID) predicate.Timestamp { return predicate.Timestamp(sql.FieldNEQ(FieldID, id)) } // IDIn applies the In predicate on the ID field. func IDIn(ids ...uuid.UUID) predicate.Timestamp { return predicate.Timestamp(sql.FieldIn(FieldID, ids...)) } // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uuid.UUID) predicate.Timestamp { return predicate.Timestamp(sql.FieldNotIn(FieldID, ids...)) } // IDGT applies the GT predicate on the ID field. func IDGT(id uuid.UUID) predicate.Timestamp { return predicate.Timestamp(sql.FieldGT(FieldID, id)) } // IDGTE applies the GTE predicate on the ID field. func IDGTE(id uuid.UUID) predicate.Timestamp { return predicate.Timestamp(sql.FieldGTE(FieldID, id)) } // IDLT applies the LT predicate on the ID field. func IDLT(id uuid.UUID) predicate.Timestamp { return predicate.Timestamp(sql.FieldLT(FieldID, id)) } // IDLTE applies the LTE predicate on the ID field. func IDLTE(id uuid.UUID) predicate.Timestamp { return predicate.Timestamp(sql.FieldLTE(FieldID, id)) } // Type applies equality check predicate on the "type" field. It's identical to TypeEQ. func Type(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldEQ(FieldType, v)) } // Timestamp applies equality check predicate on the "timestamp" field. It's identical to TimestampEQ. func Timestamp(v time.Time) predicate.Timestamp { return predicate.Timestamp(sql.FieldEQ(FieldTimestamp, v)) } // TypeEQ applies the EQ predicate on the "type" field. func TypeEQ(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldEQ(FieldType, v)) } // TypeNEQ applies the NEQ predicate on the "type" field. func TypeNEQ(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldNEQ(FieldType, v)) } // TypeIn applies the In predicate on the "type" field. func TypeIn(vs ...string) predicate.Timestamp { return predicate.Timestamp(sql.FieldIn(FieldType, vs...)) } // TypeNotIn applies the NotIn predicate on the "type" field. func TypeNotIn(vs ...string) predicate.Timestamp { return predicate.Timestamp(sql.FieldNotIn(FieldType, vs...)) } // TypeGT applies the GT predicate on the "type" field. func TypeGT(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldGT(FieldType, v)) } // TypeGTE applies the GTE predicate on the "type" field. func TypeGTE(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldGTE(FieldType, v)) } // TypeLT applies the LT predicate on the "type" field. func TypeLT(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldLT(FieldType, v)) } // TypeLTE applies the LTE predicate on the "type" field. func TypeLTE(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldLTE(FieldType, v)) } // TypeContains applies the Contains predicate on the "type" field. func TypeContains(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldContains(FieldType, v)) } // TypeHasPrefix applies the HasPrefix predicate on the "type" field. func TypeHasPrefix(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldHasPrefix(FieldType, v)) } // TypeHasSuffix applies the HasSuffix predicate on the "type" field. func TypeHasSuffix(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldHasSuffix(FieldType, v)) } // TypeEqualFold applies the EqualFold predicate on the "type" field. func TypeEqualFold(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldEqualFold(FieldType, v)) } // TypeContainsFold applies the ContainsFold predicate on the "type" field. func TypeContainsFold(v string) predicate.Timestamp { return predicate.Timestamp(sql.FieldContainsFold(FieldType, v)) } // TimestampEQ applies the EQ predicate on the "timestamp" field. func TimestampEQ(v time.Time) predicate.Timestamp { return predicate.Timestamp(sql.FieldEQ(FieldTimestamp, v)) } // TimestampNEQ applies the NEQ predicate on the "timestamp" field. func TimestampNEQ(v time.Time) predicate.Timestamp { return predicate.Timestamp(sql.FieldNEQ(FieldTimestamp, v)) } // TimestampIn applies the In predicate on the "timestamp" field. func TimestampIn(vs ...time.Time) predicate.Timestamp { return predicate.Timestamp(sql.FieldIn(FieldTimestamp, vs...)) } // TimestampNotIn applies the NotIn predicate on the "timestamp" field. func TimestampNotIn(vs ...time.Time) predicate.Timestamp { return predicate.Timestamp(sql.FieldNotIn(FieldTimestamp, vs...)) } // TimestampGT applies the GT predicate on the "timestamp" field. func TimestampGT(v time.Time) predicate.Timestamp { return predicate.Timestamp(sql.FieldGT(FieldTimestamp, v)) } // TimestampGTE applies the GTE predicate on the "timestamp" field. func TimestampGTE(v time.Time) predicate.Timestamp { return predicate.Timestamp(sql.FieldGTE(FieldTimestamp, v)) } // TimestampLT applies the LT predicate on the "timestamp" field. func TimestampLT(v time.Time) predicate.Timestamp { return predicate.Timestamp(sql.FieldLT(FieldTimestamp, v)) } // TimestampLTE applies the LTE predicate on the "timestamp" field. func TimestampLTE(v time.Time) predicate.Timestamp { return predicate.Timestamp(sql.FieldLTE(FieldTimestamp, v)) } // HasSignature applies the HasEdge predicate on the "signature" edge. func HasSignature() predicate.Timestamp { return predicate.Timestamp(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.Edge(sqlgraph.M2O, true, SignatureTable, SignatureColumn), ) sqlgraph.HasNeighbors(s, step) }) } // HasSignatureWith applies the HasEdge predicate on the "signature" edge with a given conditions (other predicates). func HasSignatureWith(preds ...predicate.Signature) predicate.Timestamp { return predicate.Timestamp(func(s *sql.Selector) { step := newSignatureStep() 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.Timestamp) predicate.Timestamp { return predicate.Timestamp(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Timestamp) predicate.Timestamp { return predicate.Timestamp(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Timestamp) predicate.Timestamp { return predicate.Timestamp(sql.NotPredicates(p)) } golang-github-in-toto-archivista-0.11.1/ent/timestamp_create.go000066400000000000000000000161161511066247200245170ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "time" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/timestamp" ) // TimestampCreate is the builder for creating a Timestamp entity. type TimestampCreate struct { config mutation *TimestampMutation hooks []Hook } // SetType sets the "type" field. func (_c *TimestampCreate) SetType(v string) *TimestampCreate { _c.mutation.SetType(v) return _c } // SetTimestamp sets the "timestamp" field. func (_c *TimestampCreate) SetTimestamp(v time.Time) *TimestampCreate { _c.mutation.SetTimestamp(v) return _c } // SetID sets the "id" field. func (_c *TimestampCreate) SetID(v uuid.UUID) *TimestampCreate { _c.mutation.SetID(v) return _c } // SetNillableID sets the "id" field if the given value is not nil. func (_c *TimestampCreate) SetNillableID(v *uuid.UUID) *TimestampCreate { if v != nil { _c.SetID(*v) } return _c } // SetSignatureID sets the "signature" edge to the Signature entity by ID. func (_c *TimestampCreate) SetSignatureID(id uuid.UUID) *TimestampCreate { _c.mutation.SetSignatureID(id) return _c } // SetNillableSignatureID sets the "signature" edge to the Signature entity by ID if the given value is not nil. func (_c *TimestampCreate) SetNillableSignatureID(id *uuid.UUID) *TimestampCreate { if id != nil { _c = _c.SetSignatureID(*id) } return _c } // SetSignature sets the "signature" edge to the Signature entity. func (_c *TimestampCreate) SetSignature(v *Signature) *TimestampCreate { return _c.SetSignatureID(v.ID) } // Mutation returns the TimestampMutation object of the builder. func (_c *TimestampCreate) Mutation() *TimestampMutation { return _c.mutation } // Save creates the Timestamp in the database. func (_c *TimestampCreate) Save(ctx context.Context) (*Timestamp, error) { _c.defaults() return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. func (_c *TimestampCreate) SaveX(ctx context.Context) *Timestamp { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *TimestampCreate) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *TimestampCreate) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. func (_c *TimestampCreate) defaults() { if _, ok := _c.mutation.ID(); !ok { v := timestamp.DefaultID() _c.mutation.SetID(v) } } // check runs all checks and user-defined validators on the builder. func (_c *TimestampCreate) check() error { if _, ok := _c.mutation.GetType(); !ok { return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "Timestamp.type"`)} } if _, ok := _c.mutation.Timestamp(); !ok { return &ValidationError{Name: "timestamp", err: errors.New(`ent: missing required field "Timestamp.timestamp"`)} } return nil } func (_c *TimestampCreate) sqlSave(ctx context.Context) (*Timestamp, error) { if err := _c.check(); err != nil { return nil, err } _node, _spec := _c.createSpec() if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } if _spec.ID.Value != nil { if id, ok := _spec.ID.Value.(*uuid.UUID); ok { _node.ID = *id } else if err := _node.ID.Scan(_spec.ID.Value); err != nil { return nil, err } } _c.mutation.id = &_node.ID _c.mutation.done = true return _node, nil } func (_c *TimestampCreate) createSpec() (*Timestamp, *sqlgraph.CreateSpec) { var ( _node = &Timestamp{config: _c.config} _spec = sqlgraph.NewCreateSpec(timestamp.Table, sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID)) ) if id, ok := _c.mutation.ID(); ok { _node.ID = id _spec.ID.Value = &id } if value, ok := _c.mutation.GetType(); ok { _spec.SetField(timestamp.FieldType, field.TypeString, value) _node.Type = value } if value, ok := _c.mutation.Timestamp(); ok { _spec.SetField(timestamp.FieldTimestamp, field.TypeTime, value) _node.Timestamp = value } if nodes := _c.mutation.SignatureIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: timestamp.SignatureTable, Columns: []string{timestamp.SignatureColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _node.signature_timestamps = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } return _node, _spec } // TimestampCreateBulk is the builder for creating many Timestamp entities in bulk. type TimestampCreateBulk struct { config err error builders []*TimestampCreate } // Save creates the Timestamp entities in the database. func (_c *TimestampCreateBulk) Save(ctx context.Context) ([]*Timestamp, error) { if _c.err != nil { return nil, _c.err } specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) nodes := make([]*Timestamp, len(_c.builders)) mutators := make([]Mutator, len(_c.builders)) for i := range _c.builders { func(i int, root context.Context) { builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*TimestampMutation) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } if err := builder.check(); err != nil { return nil, err } builder.mutation = mutation var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: 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, _c.builders[0].mutation); err != nil { return nil, err } } return nodes, nil } // SaveX is like Save, but panics if an error occurs. func (_c *TimestampCreateBulk) SaveX(ctx context.Context) []*Timestamp { v, err := _c.Save(ctx) if err != nil { panic(err) } return v } // Exec executes the query. func (_c *TimestampCreateBulk) Exec(ctx context.Context) error { _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_c *TimestampCreateBulk) ExecX(ctx context.Context) { if err := _c.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/timestamp_delete.go000066400000000000000000000043771511066247200245240ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/timestamp" ) // TimestampDelete is the builder for deleting a Timestamp entity. type TimestampDelete struct { config hooks []Hook mutation *TimestampMutation } // Where appends a list predicates to the TimestampDelete builder. func (_d *TimestampDelete) Where(ps ...predicate.Timestamp) *TimestampDelete { _d.mutation.Where(ps...) return _d } // Exec executes the deletion query and returns how many vertices were deleted. func (_d *TimestampDelete) Exec(ctx context.Context) (int, error) { return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) } // ExecX is like Exec, but panics if an error occurs. func (_d *TimestampDelete) ExecX(ctx context.Context) int { n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } func (_d *TimestampDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(timestamp.Table, sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID)) if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } _d.mutation.done = true return affected, err } // TimestampDeleteOne is the builder for deleting a single Timestamp entity. type TimestampDeleteOne struct { _d *TimestampDelete } // Where appends a list predicates to the TimestampDelete builder. func (_d *TimestampDeleteOne) Where(ps ...predicate.Timestamp) *TimestampDeleteOne { _d._d.mutation.Where(ps...) return _d } // Exec executes the deletion query. func (_d *TimestampDeleteOne) Exec(ctx context.Context) error { n, err := _d._d.Exec(ctx) switch { case err != nil: return err case n == 0: return &NotFoundError{timestamp.Label} default: return nil } } // ExecX is like Exec, but panics if an error occurs. func (_d *TimestampDeleteOne) ExecX(ctx context.Context) { if err := _d.Exec(ctx); err != nil { panic(err) } } golang-github-in-toto-archivista-0.11.1/ent/timestamp_query.go000066400000000000000000000432151511066247200244210ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "fmt" "math" "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/timestamp" ) // TimestampQuery is the builder for querying Timestamp entities. type TimestampQuery struct { config ctx *QueryContext order []timestamp.OrderOption inters []Interceptor predicates []predicate.Timestamp withSignature *SignatureQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*Timestamp) error // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) } // Where adds a new predicate for the TimestampQuery builder. func (_q *TimestampQuery) Where(ps ...predicate.Timestamp) *TimestampQuery { _q.predicates = append(_q.predicates, ps...) return _q } // Limit the number of records to be returned by this query. func (_q *TimestampQuery) Limit(limit int) *TimestampQuery { _q.ctx.Limit = &limit return _q } // Offset to start from. func (_q *TimestampQuery) Offset(offset int) *TimestampQuery { _q.ctx.Offset = &offset return _q } // 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 (_q *TimestampQuery) Unique(unique bool) *TimestampQuery { _q.ctx.Unique = &unique return _q } // Order specifies how the records should be ordered. func (_q *TimestampQuery) Order(o ...timestamp.OrderOption) *TimestampQuery { _q.order = append(_q.order, o...) return _q } // QuerySignature chains the current query on the "signature" edge. func (_q *TimestampQuery) QuerySignature() *SignatureQuery { query := (&SignatureClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := _q.prepareQuery(ctx); err != nil { return nil, err } selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } step := sqlgraph.NewStep( sqlgraph.From(timestamp.Table, timestamp.FieldID, selector), sqlgraph.To(signature.Table, signature.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, timestamp.SignatureTable, timestamp.SignatureColumn), ) fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // First returns the first Timestamp entity from the query. // Returns a *NotFoundError when no Timestamp was found. func (_q *TimestampQuery) First(ctx context.Context) (*Timestamp, error) { nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } if len(nodes) == 0 { return nil, &NotFoundError{timestamp.Label} } return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (_q *TimestampQuery) FirstX(ctx context.Context) *Timestamp { node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } return node } // FirstID returns the first Timestamp ID from the query. // Returns a *NotFoundError when no Timestamp ID was found. func (_q *TimestampQuery) FirstID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { err = &NotFoundError{timestamp.Label} return } return ids[0], nil } // FirstIDX is like FirstID, but panics if an error occurs. func (_q *TimestampQuery) FirstIDX(ctx context.Context) uuid.UUID { id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } return id } // Only returns a single Timestamp entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Timestamp entity is found. // Returns a *NotFoundError when no Timestamp entities are found. func (_q *TimestampQuery) Only(ctx context.Context) (*Timestamp, error) { nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } switch len(nodes) { case 1: return nodes[0], nil case 0: return nil, &NotFoundError{timestamp.Label} default: return nil, &NotSingularError{timestamp.Label} } } // OnlyX is like Only, but panics if an error occurs. func (_q *TimestampQuery) OnlyX(ctx context.Context) *Timestamp { node, err := _q.Only(ctx) if err != nil { panic(err) } return node } // OnlyID is like Only, but returns the only Timestamp ID in the query. // Returns a *NotSingularError when more than one Timestamp ID is found. // Returns a *NotFoundError when no entities are found. func (_q *TimestampQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error) { var ids []uuid.UUID if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { case 1: id = ids[0] case 0: err = &NotFoundError{timestamp.Label} default: err = &NotSingularError{timestamp.Label} } return } // OnlyIDX is like OnlyID, but panics if an error occurs. func (_q *TimestampQuery) OnlyIDX(ctx context.Context) uuid.UUID { id, err := _q.OnlyID(ctx) if err != nil { panic(err) } return id } // All executes the query and returns a list of Timestamps. func (_q *TimestampQuery) All(ctx context.Context) ([]*Timestamp, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Timestamp, *TimestampQuery]() return withInterceptors[[]*Timestamp](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. func (_q *TimestampQuery) AllX(ctx context.Context) []*Timestamp { nodes, err := _q.All(ctx) if err != nil { panic(err) } return nodes } // IDs executes the query and returns a list of Timestamp IDs. func (_q *TimestampQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { if _q.ctx.Unique == nil && _q.path != nil { _q.Unique(true) } ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) if err = _q.Select(timestamp.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. func (_q *TimestampQuery) IDsX(ctx context.Context) []uuid.UUID { ids, err := _q.IDs(ctx) if err != nil { panic(err) } return ids } // Count returns the count of the given query. func (_q *TimestampQuery) Count(ctx context.Context) (int, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) if err := _q.prepareQuery(ctx); err != nil { return 0, err } return withInterceptors[int](ctx, _q, querierCount[*TimestampQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. func (_q *TimestampQuery) CountX(ctx context.Context) int { count, err := _q.Count(ctx) if err != nil { panic(err) } return count } // Exist returns true if the query has elements in the graph. func (_q *TimestampQuery) Exist(ctx context.Context) (bool, error) { ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) default: return true, nil } } // ExistX is like Exist, but panics if an error occurs. func (_q *TimestampQuery) ExistX(ctx context.Context) bool { exist, err := _q.Exist(ctx) if err != nil { panic(err) } return exist } // Clone returns a duplicate of the TimestampQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. func (_q *TimestampQuery) Clone() *TimestampQuery { if _q == nil { return nil } return &TimestampQuery{ config: _q.config, ctx: _q.ctx.Clone(), order: append([]timestamp.OrderOption{}, _q.order...), inters: append([]Interceptor{}, _q.inters...), predicates: append([]predicate.Timestamp{}, _q.predicates...), withSignature: _q.withSignature.Clone(), // clone intermediate query. sql: _q.sql.Clone(), path: _q.path, } } // WithSignature tells the query-builder to eager-load the nodes that are connected to // the "signature" edge. The optional arguments are used to configure the query builder of the edge. func (_q *TimestampQuery) WithSignature(opts ...func(*SignatureQuery)) *TimestampQuery { query := (&SignatureClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } _q.withSignature = query return _q } // 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.Timestamp.Query(). // GroupBy(timestamp.FieldType). // Aggregate(ent.Count()). // Scan(ctx, &v) func (_q *TimestampQuery) GroupBy(field string, fields ...string) *TimestampGroupBy { _q.ctx.Fields = append([]string{field}, fields...) grbuild := &TimestampGroupBy{build: _q} grbuild.flds = &_q.ctx.Fields grbuild.label = timestamp.Label grbuild.scan = grbuild.Scan return grbuild } // 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.Timestamp.Query(). // Select(timestamp.FieldType). // Scan(ctx, &v) func (_q *TimestampQuery) Select(fields ...string) *TimestampSelect { _q.ctx.Fields = append(_q.ctx.Fields, fields...) sbuild := &TimestampSelect{TimestampQuery: _q} sbuild.label = timestamp.Label sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a TimestampSelect configured with the given aggregations. func (_q *TimestampQuery) Aggregate(fns ...AggregateFunc) *TimestampSelect { return _q.Select().Aggregate(fns...) } func (_q *TimestampQuery) prepareQuery(ctx context.Context) error { for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { if err := trv.Traverse(ctx, _q); err != nil { return err } } } for _, f := range _q.ctx.Fields { if !timestamp.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } if _q.path != nil { prev, err := _q.path(ctx) if err != nil { return err } _q.sql = prev } return nil } func (_q *TimestampQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Timestamp, error) { var ( nodes = []*Timestamp{} withFKs = _q.withFKs _spec = _q.querySpec() loadedTypes = [1]bool{ _q.withSignature != nil, } ) if _q.withSignature != nil { withFKs = true } if withFKs { _spec.Node.Columns = append(_spec.Node.Columns, timestamp.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]any, error) { return (*Timestamp).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { node := &Timestamp{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } for i := range hooks { hooks[i](ctx, _spec) } if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } if query := _q.withSignature; query != nil { if err := _q.loadSignature(ctx, query, nodes, nil, func(n *Timestamp, e *Signature) { n.Edges.Signature = e }); err != nil { return nil, err } } for i := range _q.loadTotal { if err := _q.loadTotal[i](ctx, nodes); err != nil { return nil, err } } return nodes, nil } func (_q *TimestampQuery) loadSignature(ctx context.Context, query *SignatureQuery, nodes []*Timestamp, init func(*Timestamp), assign func(*Timestamp, *Signature)) error { ids := make([]uuid.UUID, 0, len(nodes)) nodeids := make(map[uuid.UUID][]*Timestamp) for i := range nodes { if nodes[i].signature_timestamps == nil { continue } fk := *nodes[i].signature_timestamps if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } nodeids[fk] = append(nodeids[fk], nodes[i]) } if len(ids) == 0 { return nil } query.Where(signature.IDIn(ids...)) neighbors, err := query.All(ctx) if err != nil { return err } for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { return fmt.Errorf(`unexpected foreign-key "signature_timestamps" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) } } return nil } func (_q *TimestampQuery) sqlCount(ctx context.Context) (int, error) { _spec := _q.querySpec() if len(_q.modifiers) > 0 { _spec.Modifiers = _q.modifiers } _spec.Node.Columns = _q.ctx.Fields if len(_q.ctx.Fields) > 0 { _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } return sqlgraph.CountNodes(ctx, _q.driver, _spec) } func (_q *TimestampQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(timestamp.Table, timestamp.Columns, sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID)) _spec.From = _q.sql if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique } else if _q.path != nil { _spec.Unique = true } if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, timestamp.FieldID) for i := range fields { if fields[i] != timestamp.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } } if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } return _spec } func (_q *TimestampQuery) sqlQuery(ctx context.Context) *sql.Selector { builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(timestamp.Table) columns := _q.ctx.Fields if len(columns) == 0 { columns = timestamp.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) if _q.sql != nil { selector = _q.sql selector.Select(selector.Columns(columns...)...) } if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } for _, p := range _q.predicates { p(selector) } for _, p := range _q.order { p(selector) } if offset := _q.ctx.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 := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector } // TimestampGroupBy is the group-by builder for Timestamp entities. type TimestampGroupBy struct { selector build *TimestampQuery } // Aggregate adds the given aggregation functions to the group-by query. func (_g *TimestampGroupBy) Aggregate(fns ...AggregateFunc) *TimestampGroupBy { _g.fns = append(_g.fns, fns...) return _g } // Scan applies the selector query and scans the result into the given value. func (_g *TimestampGroupBy) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) if err := _g.build.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*TimestampQuery, *TimestampGroupBy](ctx, _g.build, _g, _g.build.inters, v) } func (_g *TimestampGroupBy) sqlScan(ctx context.Context, root *TimestampQuery, v any) error { selector := root.sqlQuery(ctx).Select() aggregation := make([]string, 0, len(_g.fns)) for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } // TimestampSelect is the builder for selecting fields of Timestamp entities. type TimestampSelect struct { *TimestampQuery selector } // Aggregate adds the given aggregation functions to the selector query. func (_s *TimestampSelect) Aggregate(fns ...AggregateFunc) *TimestampSelect { _s.fns = append(_s.fns, fns...) return _s } // Scan applies the selector query and scans the result into the given value. func (_s *TimestampSelect) Scan(ctx context.Context, v any) error { ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) if err := _s.prepareQuery(ctx); err != nil { return err } return scanWithInterceptors[*TimestampQuery, *TimestampSelect](ctx, _s.TimestampQuery, _s, _s.inters, v) } func (_s *TimestampSelect) sqlScan(ctx context.Context, root *TimestampQuery, v any) error { selector := root.sqlQuery(ctx) aggregation := make([]string, 0, len(_s.fns)) for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: selector.AppendSelect(aggregation...) } rows := &sql.Rows{} query, args := selector.Query() if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() return sql.ScanSlice(rows, v) } golang-github-in-toto-archivista-0.11.1/ent/timestamp_update.go000066400000000000000000000244161511066247200245400ustar00rootroot00000000000000// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/google/uuid" "github.com/in-toto/archivista/ent/predicate" "github.com/in-toto/archivista/ent/signature" "github.com/in-toto/archivista/ent/timestamp" ) // TimestampUpdate is the builder for updating Timestamp entities. type TimestampUpdate struct { config hooks []Hook mutation *TimestampMutation } // Where appends a list predicates to the TimestampUpdate builder. func (_u *TimestampUpdate) Where(ps ...predicate.Timestamp) *TimestampUpdate { _u.mutation.Where(ps...) return _u } // SetType sets the "type" field. func (_u *TimestampUpdate) SetType(v string) *TimestampUpdate { _u.mutation.SetType(v) return _u } // SetNillableType sets the "type" field if the given value is not nil. func (_u *TimestampUpdate) SetNillableType(v *string) *TimestampUpdate { if v != nil { _u.SetType(*v) } return _u } // SetTimestamp sets the "timestamp" field. func (_u *TimestampUpdate) SetTimestamp(v time.Time) *TimestampUpdate { _u.mutation.SetTimestamp(v) return _u } // SetNillableTimestamp sets the "timestamp" field if the given value is not nil. func (_u *TimestampUpdate) SetNillableTimestamp(v *time.Time) *TimestampUpdate { if v != nil { _u.SetTimestamp(*v) } return _u } // SetSignatureID sets the "signature" edge to the Signature entity by ID. func (_u *TimestampUpdate) SetSignatureID(id uuid.UUID) *TimestampUpdate { _u.mutation.SetSignatureID(id) return _u } // SetNillableSignatureID sets the "signature" edge to the Signature entity by ID if the given value is not nil. func (_u *TimestampUpdate) SetNillableSignatureID(id *uuid.UUID) *TimestampUpdate { if id != nil { _u = _u.SetSignatureID(*id) } return _u } // SetSignature sets the "signature" edge to the Signature entity. func (_u *TimestampUpdate) SetSignature(v *Signature) *TimestampUpdate { return _u.SetSignatureID(v.ID) } // Mutation returns the TimestampMutation object of the builder. func (_u *TimestampUpdate) Mutation() *TimestampMutation { return _u.mutation } // ClearSignature clears the "signature" edge to the Signature entity. func (_u *TimestampUpdate) ClearSignature() *TimestampUpdate { _u.mutation.ClearSignature() return _u } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *TimestampUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *TimestampUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *TimestampUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *TimestampUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } func (_u *TimestampUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(timestamp.Table, timestamp.Columns, sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.GetType(); ok { _spec.SetField(timestamp.FieldType, field.TypeString, value) } if value, ok := _u.mutation.Timestamp(); ok { _spec.SetField(timestamp.FieldTimestamp, field.TypeTime, value) } if _u.mutation.SignatureCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: timestamp.SignatureTable, Columns: []string{timestamp.SignatureColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SignatureIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: timestamp.SignatureTable, Columns: []string{timestamp.SignatureColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{timestamp.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // TimestampUpdateOne is the builder for updating a single Timestamp entity. type TimestampUpdateOne struct { config fields []string hooks []Hook mutation *TimestampMutation } // SetType sets the "type" field. func (_u *TimestampUpdateOne) SetType(v string) *TimestampUpdateOne { _u.mutation.SetType(v) return _u } // SetNillableType sets the "type" field if the given value is not nil. func (_u *TimestampUpdateOne) SetNillableType(v *string) *TimestampUpdateOne { if v != nil { _u.SetType(*v) } return _u } // SetTimestamp sets the "timestamp" field. func (_u *TimestampUpdateOne) SetTimestamp(v time.Time) *TimestampUpdateOne { _u.mutation.SetTimestamp(v) return _u } // SetNillableTimestamp sets the "timestamp" field if the given value is not nil. func (_u *TimestampUpdateOne) SetNillableTimestamp(v *time.Time) *TimestampUpdateOne { if v != nil { _u.SetTimestamp(*v) } return _u } // SetSignatureID sets the "signature" edge to the Signature entity by ID. func (_u *TimestampUpdateOne) SetSignatureID(id uuid.UUID) *TimestampUpdateOne { _u.mutation.SetSignatureID(id) return _u } // SetNillableSignatureID sets the "signature" edge to the Signature entity by ID if the given value is not nil. func (_u *TimestampUpdateOne) SetNillableSignatureID(id *uuid.UUID) *TimestampUpdateOne { if id != nil { _u = _u.SetSignatureID(*id) } return _u } // SetSignature sets the "signature" edge to the Signature entity. func (_u *TimestampUpdateOne) SetSignature(v *Signature) *TimestampUpdateOne { return _u.SetSignatureID(v.ID) } // Mutation returns the TimestampMutation object of the builder. func (_u *TimestampUpdateOne) Mutation() *TimestampMutation { return _u.mutation } // ClearSignature clears the "signature" edge to the Signature entity. func (_u *TimestampUpdateOne) ClearSignature() *TimestampUpdateOne { _u.mutation.ClearSignature() return _u } // Where appends a list predicates to the TimestampUpdate builder. func (_u *TimestampUpdateOne) Where(ps ...predicate.Timestamp) *TimestampUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *TimestampUpdateOne) Select(field string, fields ...string) *TimestampUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated Timestamp entity. func (_u *TimestampUpdateOne) Save(ctx context.Context) (*Timestamp, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *TimestampUpdateOne) SaveX(ctx context.Context) *Timestamp { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *TimestampUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *TimestampUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } func (_u *TimestampUpdateOne) sqlSave(ctx context.Context) (_node *Timestamp, err error) { _spec := sqlgraph.NewUpdateSpec(timestamp.Table, timestamp.Columns, sqlgraph.NewFieldSpec(timestamp.FieldID, field.TypeUUID)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Timestamp.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, timestamp.FieldID) for _, f := range fields { if !timestamp.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != timestamp.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.GetType(); ok { _spec.SetField(timestamp.FieldType, field.TypeString, value) } if value, ok := _u.mutation.Timestamp(); ok { _spec.SetField(timestamp.FieldTimestamp, field.TypeTime, value) } if _u.mutation.SignatureCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: timestamp.SignatureTable, Columns: []string{timestamp.SignatureColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.SignatureIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: timestamp.SignatureTable, Columns: []string{timestamp.SignatureColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(signature.FieldID, field.TypeUUID), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _node = &Timestamp{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{timestamp.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil } golang-github-in-toto-archivista-0.11.1/ent/tx.go000066400000000000000000000170621511066247200216250ustar00rootroot00000000000000// Code generated by ent, 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 // Attestation is the client for interacting with the Attestation builders. Attestation *AttestationClient // AttestationCollection is the client for interacting with the AttestationCollection builders. AttestationCollection *AttestationCollectionClient // AttestationPolicy is the client for interacting with the AttestationPolicy builders. AttestationPolicy *AttestationPolicyClient // Dsse is the client for interacting with the Dsse builders. Dsse *DsseClient // PayloadDigest is the client for interacting with the PayloadDigest builders. PayloadDigest *PayloadDigestClient // Signature is the client for interacting with the Signature builders. Signature *SignatureClient // Statement is the client for interacting with the Statement builders. Statement *StatementClient // Subject is the client for interacting with the Subject builders. Subject *SubjectClient // SubjectDigest is the client for interacting with the SubjectDigest builders. SubjectDigest *SubjectDigestClient // Timestamp is the client for interacting with the Timestamp builders. Timestamp *TimestampClient // lazily loaded. client *Client clientOnce sync.Once // 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 Commit 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(ctx 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() }) txDriver.mu.Lock() hooks := append([]CommitHook(nil), txDriver.onCommit...) txDriver.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) { txDriver := tx.config.driver.(*txDriver) txDriver.mu.Lock() txDriver.onCommit = append(txDriver.onCommit, f) txDriver.mu.Unlock() } type ( // Rollbacker is the interface that wraps the Rollback 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(ctx 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() }) txDriver.mu.Lock() hooks := append([]RollbackHook(nil), txDriver.onRollback...) txDriver.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) { txDriver := tx.config.driver.(*txDriver) txDriver.mu.Lock() txDriver.onRollback = append(txDriver.onRollback, f) txDriver.mu.Unlock() } // 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.Attestation = NewAttestationClient(tx.config) tx.AttestationCollection = NewAttestationCollectionClient(tx.config) tx.AttestationPolicy = NewAttestationPolicyClient(tx.config) tx.Dsse = NewDsseClient(tx.config) tx.PayloadDigest = NewPayloadDigestClient(tx.config) tx.Signature = NewSignatureClient(tx.config) tx.Statement = NewStatementClient(tx.config) tx.Subject = NewSubjectClient(tx.config) tx.SubjectDigest = NewSubjectDigestClient(tx.config) tx.Timestamp = NewTimestampClient(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: Attestation.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 // completion hooks. mu sync.Mutex onCommit []CommitHook onRollback []RollbackHook } // 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 any) error { return tx.tx.Exec(ctx, query, args, v) } // Query calls tx.Query. func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error { return tx.tx.Query(ctx, query, args, v) } var _ dialect.Driver = (*txDriver)(nil) golang-github-in-toto-archivista-0.11.1/entrypoint-dev.sh000066400000000000000000000032361511066247200233760ustar00rootroot00000000000000#!/bin/bash # Copyright 2023 The Archivista Contributors # # 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. env if [[ -z $ARCHIVISTA_SQL_STORE_BACKEND ]]; then SQL_TYPE="MYSQL" else SQL_TYPE=$(echo "$ARCHIVISTA_SQL_STORE_BACKEND" | tr '[:lower:]' '[:upper:]') fi case $SQL_TYPE in MYSQL) if [[ -z $ARCHIVISTA_SQL_STORE_CONNECTION_STRING ]]; then ARCHIVISTA_SQL_STORE_CONNECTION_STRING="root:example@db/testify" fi echo "Running migrations for MySQL" atlas migrate apply --dir "file:///src/ent/migrate/migrations/mysql" --url "mysql://$ARCHIVISTA_SQL_STORE_CONNECTION_STRING" atlas_rc=$? ;; PSQL) echo "Running migrations for Postgres" atlas migrate apply --dir "file:///src/ent/migrate/migrations/pgsql" --url "$ARCHIVISTA_SQL_STORE_CONNECTION_STRING" atlas_rc=$? ;; *) echo "Unknown SQL backend: $ARCHIVISTA_SQL_STORE_BACKEND" exit 1 ;; esac if [[ $atlas_rc -ne 0 ]]; then echo "Failed to apply migrations" exit 1 fi CompileDaemon -log-prefix=false -build="go build -buildvcs=false -o /out/archivista ./cmd/archivista" -command="/out/archivista" golang-github-in-toto-archivista-0.11.1/entrypoint.sh000066400000000000000000000037031511066247200226210ustar00rootroot00000000000000#!/bin/bash # Copyright 2023 The Archivista Contributors # # 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. ARCHIVISTA_ENABLE_SQL_STORE=$(echo ${ARCHIVISTA_ENABLE_SQL_STORE} | tr '[:lower:]' '[:upper:]') if [ "${ARCHIVISTA_ENABLE_SQL_STORE}" = "FALSE" ]; then echo "Skipping migrations" else if [[ -z $ARCHIVISTA_SQL_STORE_BACKEND ]]; then SQL_TYPE="MYSQL" else SQL_TYPE=$(echo "$ARCHIVISTA_SQL_STORE_BACKEND" | tr '[:lower:]' '[:upper:]') fi case $SQL_TYPE in MYSQL*) if [[ -z $ARCHIVISTA_SQL_STORE_CONNECTION_STRING ]]; then ARCHIVISTA_SQL_STORE_CONNECTION_STRING="root:example@db/testify" fi echo "Running migrations for MySQL" DB_URL="mysql://${ARCHIVISTA_SQL_STORE_CONNECTION_STRING}" if [[ "$SQL_TYPE" == *_RDS_IAM ]]; then DB_URL=$(/bin/archivistactl iam "${SQL_TYPE}" "${DB_URL}") fi atlas migrate apply --dir "file:///archivista/migrations/mysql" --url "${DB_URL}" atlas_rc=$? ;; PSQL*) echo "Running migrations for Postgres" DB_URL="${ARCHIVISTA_SQL_STORE_CONNECTION_STRING}" if [[ "$SQL_TYPE" == *_RDS_IAM ]]; then DB_URL=$(/bin/archivistactl iam "${SQL_TYPE}" "${DB_URL}") fi atlas migrate apply --dir "file:///archivista/migrations/pgsql" --url "${DB_URL}" atlas_rc=$? ;; *) echo "Unknown SQL backend: $ARCHIVISTA_SQL_STORE_BACKEND" exit 1 ;; esac if [[ $atlas_rc -ne 0 ]]; then echo "Failed to apply migrations" exit 1 fi fi /bin/archivista golang-github-in-toto-archivista-0.11.1/gen.go000066400000000000000000000013301511066247200211440ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package archivista //go:generate go run -mod=mod ./ent/entc.go //go:generate go run -mod=mod github.com/99designs/gqlgen golang-github-in-toto-archivista-0.11.1/generated.go000066400000000000000000014416151511066247200223500ustar00rootroot00000000000000// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. package archivista import ( "bytes" "context" "embed" "errors" "fmt" "strconv" "sync" "sync/atomic" "time" "entgo.io/contrib/entgql" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/introspection" "github.com/google/uuid" "github.com/in-toto/archivista/ent" "github.com/in-toto/archivista/ent/schema/uuidgql" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" ) // region ************************** generated!.gotpl ************************** // NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { return &executableSchema{ schema: cfg.Schema, resolvers: cfg.Resolvers, directives: cfg.Directives, complexity: cfg.Complexity, } } type Config struct { Schema *ast.Schema Resolvers ResolverRoot Directives DirectiveRoot Complexity ComplexityRoot } type ResolverRoot interface { Query() QueryResolver } type DirectiveRoot struct { } type ComplexityRoot struct { Attestation struct { AttestationCollection func(childComplexity int) int ID func(childComplexity int) int Type func(childComplexity int) int } AttestationCollection struct { Attestations func(childComplexity int) int ID func(childComplexity int) int Name func(childComplexity int) int Statement func(childComplexity int) int } AttestationPolicy struct { ID func(childComplexity int) int Name func(childComplexity int) int Statement func(childComplexity int) int } AttestationPolicyConnection struct { Edges func(childComplexity int) int PageInfo func(childComplexity int) int TotalCount func(childComplexity int) int } AttestationPolicyEdge struct { Cursor func(childComplexity int) int Node func(childComplexity int) int } Dsse struct { CreatedAt func(childComplexity int) int GitoidSha256 func(childComplexity int) int ID func(childComplexity int) int PayloadDigests func(childComplexity int) int PayloadType func(childComplexity int) int Signatures func(childComplexity int) int Statement func(childComplexity int) int } DsseConnection struct { Edges func(childComplexity int) int PageInfo func(childComplexity int) int TotalCount func(childComplexity int) int } DsseEdge struct { Cursor func(childComplexity int) int Node func(childComplexity int) int } PageInfo struct { EndCursor func(childComplexity int) int HasNextPage func(childComplexity int) int HasPreviousPage func(childComplexity int) int StartCursor func(childComplexity int) int } PayloadDigest struct { Algorithm func(childComplexity int) int Dsse func(childComplexity int) int ID func(childComplexity int) int Value func(childComplexity int) int } Query struct { AttestationPolicies func(childComplexity int, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, where *ent.AttestationPolicyWhereInput) int Dsses func(childComplexity int, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, orderBy *ent.DsseOrder, where *ent.DsseWhereInput) int Node func(childComplexity int, id uuid.UUID) int Nodes func(childComplexity int, ids []uuid.UUID) int Subjects func(childComplexity int, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, orderBy *ent.SubjectOrder, where *ent.SubjectWhereInput) int } Signature struct { Dsse func(childComplexity int) int ID func(childComplexity int) int KeyID func(childComplexity int) int Signature func(childComplexity int) int Timestamps func(childComplexity int) int } Statement struct { AttestationCollections func(childComplexity int) int Dsse func(childComplexity int) int ID func(childComplexity int) int Policy func(childComplexity int) int Predicate func(childComplexity int) int Subjects func(childComplexity int, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, orderBy *ent.SubjectOrder, where *ent.SubjectWhereInput) int } Subject struct { CreatedAt func(childComplexity int) int ID func(childComplexity int) int Name func(childComplexity int) int Statement func(childComplexity int) int SubjectDigests func(childComplexity int) int } SubjectConnection struct { Edges func(childComplexity int) int PageInfo func(childComplexity int) int TotalCount func(childComplexity int) int } SubjectDigest struct { Algorithm func(childComplexity int) int ID func(childComplexity int) int Subject func(childComplexity int) int Value func(childComplexity int) int } SubjectEdge struct { Cursor func(childComplexity int) int Node func(childComplexity int) int } Timestamp struct { ID func(childComplexity int) int Signature func(childComplexity int) int Timestamp func(childComplexity int) int Type func(childComplexity int) int } } type QueryResolver interface { Node(ctx context.Context, id uuid.UUID) (ent.Noder, error) Nodes(ctx context.Context, ids []uuid.UUID) ([]ent.Noder, error) AttestationPolicies(ctx context.Context, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, where *ent.AttestationPolicyWhereInput) (*ent.AttestationPolicyConnection, error) Dsses(ctx context.Context, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, orderBy *ent.DsseOrder, where *ent.DsseWhereInput) (*ent.DsseConnection, error) Subjects(ctx context.Context, after *entgql.Cursor[uuid.UUID], first *int, before *entgql.Cursor[uuid.UUID], last *int, orderBy *ent.SubjectOrder, where *ent.SubjectWhereInput) (*ent.SubjectConnection, error) } type executableSchema struct { schema *ast.Schema resolvers ResolverRoot directives DirectiveRoot complexity ComplexityRoot } func (e *executableSchema) Schema() *ast.Schema { if e.schema != nil { return e.schema } return parsedSchema } func (e *executableSchema) Complexity(ctx context.Context, typeName, field string, childComplexity int, rawArgs map[string]any) (int, bool) { ec := executionContext{nil, e, 0, 0, nil} _ = ec switch typeName + "." + field { case "Attestation.attestationCollection": if e.complexity.Attestation.AttestationCollection == nil { break } return e.complexity.Attestation.AttestationCollection(childComplexity), true case "Attestation.id": if e.complexity.Attestation.ID == nil { break } return e.complexity.Attestation.ID(childComplexity), true case "Attestation.type": if e.complexity.Attestation.Type == nil { break } return e.complexity.Attestation.Type(childComplexity), true case "AttestationCollection.attestations": if e.complexity.AttestationCollection.Attestations == nil { break } return e.complexity.AttestationCollection.Attestations(childComplexity), true case "AttestationCollection.id": if e.complexity.AttestationCollection.ID == nil { break } return e.complexity.AttestationCollection.ID(childComplexity), true case "AttestationCollection.name": if e.complexity.AttestationCollection.Name == nil { break } return e.complexity.AttestationCollection.Name(childComplexity), true case "AttestationCollection.statement": if e.complexity.AttestationCollection.Statement == nil { break } return e.complexity.AttestationCollection.Statement(childComplexity), true case "AttestationPolicy.id": if e.complexity.AttestationPolicy.ID == nil { break } return e.complexity.AttestationPolicy.ID(childComplexity), true case "AttestationPolicy.name": if e.complexity.AttestationPolicy.Name == nil { break } return e.complexity.AttestationPolicy.Name(childComplexity), true case "AttestationPolicy.statement": if e.complexity.AttestationPolicy.Statement == nil { break } return e.complexity.AttestationPolicy.Statement(childComplexity), true case "AttestationPolicyConnection.edges": if e.complexity.AttestationPolicyConnection.Edges == nil { break } return e.complexity.AttestationPolicyConnection.Edges(childComplexity), true case "AttestationPolicyConnection.pageInfo": if e.complexity.AttestationPolicyConnection.PageInfo == nil { break } return e.complexity.AttestationPolicyConnection.PageInfo(childComplexity), true case "AttestationPolicyConnection.totalCount": if e.complexity.AttestationPolicyConnection.TotalCount == nil { break } return e.complexity.AttestationPolicyConnection.TotalCount(childComplexity), true case "AttestationPolicyEdge.cursor": if e.complexity.AttestationPolicyEdge.Cursor == nil { break } return e.complexity.AttestationPolicyEdge.Cursor(childComplexity), true case "AttestationPolicyEdge.node": if e.complexity.AttestationPolicyEdge.Node == nil { break } return e.complexity.AttestationPolicyEdge.Node(childComplexity), true case "Dsse.createdAt": if e.complexity.Dsse.CreatedAt == nil { break } return e.complexity.Dsse.CreatedAt(childComplexity), true case "Dsse.gitoidSha256": if e.complexity.Dsse.GitoidSha256 == nil { break } return e.complexity.Dsse.GitoidSha256(childComplexity), true case "Dsse.id": if e.complexity.Dsse.ID == nil { break } return e.complexity.Dsse.ID(childComplexity), true case "Dsse.payloadDigests": if e.complexity.Dsse.PayloadDigests == nil { break } return e.complexity.Dsse.PayloadDigests(childComplexity), true case "Dsse.payloadType": if e.complexity.Dsse.PayloadType == nil { break } return e.complexity.Dsse.PayloadType(childComplexity), true case "Dsse.signatures": if e.complexity.Dsse.Signatures == nil { break } return e.complexity.Dsse.Signatures(childComplexity), true case "Dsse.statement": if e.complexity.Dsse.Statement == nil { break } return e.complexity.Dsse.Statement(childComplexity), true case "DsseConnection.edges": if e.complexity.DsseConnection.Edges == nil { break } return e.complexity.DsseConnection.Edges(childComplexity), true case "DsseConnection.pageInfo": if e.complexity.DsseConnection.PageInfo == nil { break } return e.complexity.DsseConnection.PageInfo(childComplexity), true case "DsseConnection.totalCount": if e.complexity.DsseConnection.TotalCount == nil { break } return e.complexity.DsseConnection.TotalCount(childComplexity), true case "DsseEdge.cursor": if e.complexity.DsseEdge.Cursor == nil { break } return e.complexity.DsseEdge.Cursor(childComplexity), true case "DsseEdge.node": if e.complexity.DsseEdge.Node == nil { break } return e.complexity.DsseEdge.Node(childComplexity), true case "PageInfo.endCursor": if e.complexity.PageInfo.EndCursor == nil { break } return e.complexity.PageInfo.EndCursor(childComplexity), true case "PageInfo.hasNextPage": if e.complexity.PageInfo.HasNextPage == nil { break } return e.complexity.PageInfo.HasNextPage(childComplexity), true case "PageInfo.hasPreviousPage": if e.complexity.PageInfo.HasPreviousPage == nil { break } return e.complexity.PageInfo.HasPreviousPage(childComplexity), true case "PageInfo.startCursor": if e.complexity.PageInfo.StartCursor == nil { break } return e.complexity.PageInfo.StartCursor(childComplexity), true case "PayloadDigest.algorithm": if e.complexity.PayloadDigest.Algorithm == nil { break } return e.complexity.PayloadDigest.Algorithm(childComplexity), true case "PayloadDigest.dsse": if e.complexity.PayloadDigest.Dsse == nil { break } return e.complexity.PayloadDigest.Dsse(childComplexity), true case "PayloadDigest.id": if e.complexity.PayloadDigest.ID == nil { break } return e.complexity.PayloadDigest.ID(childComplexity), true case "PayloadDigest.value": if e.complexity.PayloadDigest.Value == nil { break } return e.complexity.PayloadDigest.Value(childComplexity), true case "Query.attestationPolicies": if e.complexity.Query.AttestationPolicies == nil { break } args, err := ec.field_Query_attestationPolicies_args(ctx, rawArgs) if err != nil { return 0, false } return e.complexity.Query.AttestationPolicies(childComplexity, args["after"].(*entgql.Cursor[uuid.UUID]), args["first"].(*int), args["before"].(*entgql.Cursor[uuid.UUID]), args["last"].(*int), args["where"].(*ent.AttestationPolicyWhereInput)), true case "Query.dsses": if e.complexity.Query.Dsses == nil { break } args, err := ec.field_Query_dsses_args(ctx, rawArgs) if err != nil { return 0, false } return e.complexity.Query.Dsses(childComplexity, args["after"].(*entgql.Cursor[uuid.UUID]), args["first"].(*int), args["before"].(*entgql.Cursor[uuid.UUID]), args["last"].(*int), args["orderBy"].(*ent.DsseOrder), args["where"].(*ent.DsseWhereInput)), true case "Query.node": if e.complexity.Query.Node == nil { break } args, err := ec.field_Query_node_args(ctx, rawArgs) if err != nil { return 0, false } return e.complexity.Query.Node(childComplexity, args["id"].(uuid.UUID)), true case "Query.nodes": if e.complexity.Query.Nodes == nil { break } args, err := ec.field_Query_nodes_args(ctx, rawArgs) if err != nil { return 0, false } return e.complexity.Query.Nodes(childComplexity, args["ids"].([]uuid.UUID)), true case "Query.subjects": if e.complexity.Query.Subjects == nil { break } args, err := ec.field_Query_subjects_args(ctx, rawArgs) if err != nil { return 0, false } return e.complexity.Query.Subjects(childComplexity, args["after"].(*entgql.Cursor[uuid.UUID]), args["first"].(*int), args["before"].(*entgql.Cursor[uuid.UUID]), args["last"].(*int), args["orderBy"].(*ent.SubjectOrder), args["where"].(*ent.SubjectWhereInput)), true case "Signature.dsse": if e.complexity.Signature.Dsse == nil { break } return e.complexity.Signature.Dsse(childComplexity), true case "Signature.id": if e.complexity.Signature.ID == nil { break } return e.complexity.Signature.ID(childComplexity), true case "Signature.keyID": if e.complexity.Signature.KeyID == nil { break } return e.complexity.Signature.KeyID(childComplexity), true case "Signature.signature": if e.complexity.Signature.Signature == nil { break } return e.complexity.Signature.Signature(childComplexity), true case "Signature.timestamps": if e.complexity.Signature.Timestamps == nil { break } return e.complexity.Signature.Timestamps(childComplexity), true case "Statement.attestationCollections": if e.complexity.Statement.AttestationCollections == nil { break } return e.complexity.Statement.AttestationCollections(childComplexity), true case "Statement.dsse": if e.complexity.Statement.Dsse == nil { break } return e.complexity.Statement.Dsse(childComplexity), true case "Statement.id": if e.complexity.Statement.ID == nil { break } return e.complexity.Statement.ID(childComplexity), true case "Statement.policy": if e.complexity.Statement.Policy == nil { break } return e.complexity.Statement.Policy(childComplexity), true case "Statement.predicate": if e.complexity.Statement.Predicate == nil { break } return e.complexity.Statement.Predicate(childComplexity), true case "Statement.subjects": if e.complexity.Statement.Subjects == nil { break } args, err := ec.field_Statement_subjects_args(ctx, rawArgs) if err != nil { return 0, false } return e.complexity.Statement.Subjects(childComplexity, args["after"].(*entgql.Cursor[uuid.UUID]), args["first"].(*int), args["before"].(*entgql.Cursor[uuid.UUID]), args["last"].(*int), args["orderBy"].(*ent.SubjectOrder), args["where"].(*ent.SubjectWhereInput)), true case "Subject.createdAt": if e.complexity.Subject.CreatedAt == nil { break } return e.complexity.Subject.CreatedAt(childComplexity), true case "Subject.id": if e.complexity.Subject.ID == nil { break } return e.complexity.Subject.ID(childComplexity), true case "Subject.name": if e.complexity.Subject.Name == nil { break } return e.complexity.Subject.Name(childComplexity), true case "Subject.statement": if e.complexity.Subject.Statement == nil { break } return e.complexity.Subject.Statement(childComplexity), true case "Subject.subjectDigests": if e.complexity.Subject.SubjectDigests == nil { break } return e.complexity.Subject.SubjectDigests(childComplexity), true case "SubjectConnection.edges": if e.complexity.SubjectConnection.Edges == nil { break } return e.complexity.SubjectConnection.Edges(childComplexity), true case "SubjectConnection.pageInfo": if e.complexity.SubjectConnection.PageInfo == nil { break } return e.complexity.SubjectConnection.PageInfo(childComplexity), true case "SubjectConnection.totalCount": if e.complexity.SubjectConnection.TotalCount == nil { break } return e.complexity.SubjectConnection.TotalCount(childComplexity), true case "SubjectDigest.algorithm": if e.complexity.SubjectDigest.Algorithm == nil { break } return e.complexity.SubjectDigest.Algorithm(childComplexity), true case "SubjectDigest.id": if e.complexity.SubjectDigest.ID == nil { break } return e.complexity.SubjectDigest.ID(childComplexity), true case "SubjectDigest.subject": if e.complexity.SubjectDigest.Subject == nil { break } return e.complexity.SubjectDigest.Subject(childComplexity), true case "SubjectDigest.value": if e.complexity.SubjectDigest.Value == nil { break } return e.complexity.SubjectDigest.Value(childComplexity), true case "SubjectEdge.cursor": if e.complexity.SubjectEdge.Cursor == nil { break } return e.complexity.SubjectEdge.Cursor(childComplexity), true case "SubjectEdge.node": if e.complexity.SubjectEdge.Node == nil { break } return e.complexity.SubjectEdge.Node(childComplexity), true case "Timestamp.id": if e.complexity.Timestamp.ID == nil { break } return e.complexity.Timestamp.ID(childComplexity), true case "Timestamp.signature": if e.complexity.Timestamp.Signature == nil { break } return e.complexity.Timestamp.Signature(childComplexity), true case "Timestamp.timestamp": if e.complexity.Timestamp.Timestamp == nil { break } return e.complexity.Timestamp.Timestamp(childComplexity), true case "Timestamp.type": if e.complexity.Timestamp.Type == nil { break } return e.complexity.Timestamp.Type(childComplexity), true } return 0, false } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { opCtx := graphql.GetOperationContext(ctx) ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputAttestationCollectionWhereInput, ec.unmarshalInputAttestationPolicyWhereInput, ec.unmarshalInputAttestationWhereInput, ec.unmarshalInputDsseOrder, ec.unmarshalInputDsseWhereInput, ec.unmarshalInputPayloadDigestWhereInput, ec.unmarshalInputSignatureWhereInput, ec.unmarshalInputStatementWhereInput, ec.unmarshalInputSubjectDigestWhereInput, ec.unmarshalInputSubjectOrder, ec.unmarshalInputSubjectWhereInput, ec.unmarshalInputTimestampWhereInput, ) first := true switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response var data graphql.Marshaler if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults atomic.AddInt32(&ec.pendingDeferred, -1) data = result.Result response.Path = result.Path response.Label = result.Label response.Errors = result.Errors } else { return nil } } var buf bytes.Buffer data.MarshalGQL(&buf) response.Data = buf.Bytes() if atomic.LoadInt32(&ec.deferred) > 0 { hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 response.HasNext = &hasNext } return &response } default: return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) } } type executionContext struct { *graphql.OperationContext *executableSchema deferred int32 pendingDeferred int32 deferredResults chan graphql.DeferredResult } func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { atomic.AddInt32(&ec.pendingDeferred, 1) go func() { ctx := graphql.WithFreshResponseContext(dg.Context) dg.FieldSet.Dispatch(ctx) ds := graphql.DeferredResult{ Path: dg.Path, Label: dg.Label, Result: dg.FieldSet, Errors: graphql.GetErrors(ctx), } // null fields should bubble up if dg.FieldSet.Invalids > 0 { ds.Result = graphql.Null } ec.deferredResults <- ds }() } func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") } return introspection.WrapSchema(ec.Schema()), nil } func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") } return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil } //go:embed "archivista.graphql" "ent.graphql" var sourcesFS embed.FS func sourceData(filename string) string { data, err := sourcesFS.ReadFile(filename) if err != nil { panic(fmt.Sprintf("codegen problem: %s not available", filename)) } return string(data) } var sources = []*ast.Source{ {Name: "archivista.graphql", Input: sourceData("archivista.graphql"), BuiltIn: false}, {Name: "ent.graphql", Input: sourceData("ent.graphql"), BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) // endregion ************************** generated!.gotpl ************************** // region ***************************** args.gotpl ***************************** func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "name", ec.unmarshalNString2string) if err != nil { return nil, err } args["name"] = arg0 return args, nil } func (ec *executionContext) field_Query_attestationPolicies_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) if err != nil { return nil, err } args["after"] = arg0 arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) if err != nil { return nil, err } args["first"] = arg1 arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) if err != nil { return nil, err } args["before"] = arg2 arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) if err != nil { return nil, err } args["last"] = arg3 arg4, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOAttestationPolicyWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyWhereInput) if err != nil { return nil, err } args["where"] = arg4 return args, nil } func (ec *executionContext) field_Query_dsses_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) if err != nil { return nil, err } args["after"] = arg0 arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) if err != nil { return nil, err } args["first"] = arg1 arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) if err != nil { return nil, err } args["before"] = arg2 arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) if err != nil { return nil, err } args["last"] = arg3 arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalODsseOrder2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseOrder) if err != nil { return nil, err } args["orderBy"] = arg4 arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalODsseWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInput) if err != nil { return nil, err } args["where"] = arg5 return args, nil } func (ec *executionContext) field_Query_node_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "id", ec.unmarshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID) if err != nil { return nil, err } args["id"] = arg0 return args, nil } func (ec *executionContext) field_Query_nodes_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "ids", ec.unmarshalNID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ) if err != nil { return nil, err } args["ids"] = arg0 return args, nil } func (ec *executionContext) field_Query_subjects_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) if err != nil { return nil, err } args["after"] = arg0 arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) if err != nil { return nil, err } args["first"] = arg1 arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) if err != nil { return nil, err } args["before"] = arg2 arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) if err != nil { return nil, err } args["last"] = arg3 arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOSubjectOrder2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectOrder) if err != nil { return nil, err } args["orderBy"] = arg4 arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOSubjectWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInput) if err != nil { return nil, err } args["where"] = arg5 return args, nil } func (ec *executionContext) field_Statement_subjects_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) if err != nil { return nil, err } args["after"] = arg0 arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) if err != nil { return nil, err } args["first"] = arg1 arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) if err != nil { return nil, err } args["before"] = arg2 arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) if err != nil { return nil, err } args["last"] = arg3 arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOSubjectOrder2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectOrder) if err != nil { return nil, err } args["orderBy"] = arg4 arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOSubjectWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInput) if err != nil { return nil, err } args["where"] = arg5 return args, nil } func (ec *executionContext) field___Directive_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2ᚖbool) if err != nil { return nil, err } args["includeDeprecated"] = arg0 return args, nil } func (ec *executionContext) field___Field_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2ᚖbool) if err != nil { return nil, err } args["includeDeprecated"] = arg0 return args, nil } func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2bool) if err != nil { return nil, err } args["includeDeprecated"] = arg0 return args, nil } func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} arg0, err := graphql.ProcessArgField(ctx, rawArgs, "includeDeprecated", ec.unmarshalOBoolean2bool) if err != nil { return nil, err } args["includeDeprecated"] = arg0 return args, nil } // endregion ***************************** args.gotpl ***************************** // region ************************** directives.gotpl ************************** // endregion ************************** directives.gotpl ************************** // region **************************** field.gotpl ***************************** func (ec *executionContext) _Attestation_id(ctx context.Context, field graphql.CollectedField, obj *ent.Attestation) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Attestation_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Attestation_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Attestation", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _Attestation_type(ctx context.Context, field graphql.CollectedField, obj *ent.Attestation) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Attestation_type(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Attestation_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Attestation", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _Attestation_attestationCollection(ctx context.Context, field graphql.CollectedField, obj *ent.Attestation) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Attestation_attestationCollection(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.AttestationCollection(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*ent.AttestationCollection) fc.Result = res return ec.marshalNAttestationCollection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Attestation_attestationCollection(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Attestation", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_AttestationCollection_id(ctx, field) case "name": return ec.fieldContext_AttestationCollection_name(ctx, field) case "attestations": return ec.fieldContext_AttestationCollection_attestations(ctx, field) case "statement": return ec.fieldContext_AttestationCollection_statement(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type AttestationCollection", field.Name) }, } return fc, nil } func (ec *executionContext) _AttestationCollection_id(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationCollection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationCollection_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationCollection_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationCollection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _AttestationCollection_name(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationCollection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationCollection_name(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationCollection_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationCollection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _AttestationCollection_attestations(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationCollection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationCollection_attestations(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Attestations(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]*ent.Attestation) fc.Result = res return ec.marshalOAttestation2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationCollection_attestations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationCollection", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Attestation_id(ctx, field) case "type": return ec.fieldContext_Attestation_type(ctx, field) case "attestationCollection": return ec.fieldContext_Attestation_attestationCollection(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Attestation", field.Name) }, } return fc, nil } func (ec *executionContext) _AttestationCollection_statement(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationCollection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationCollection_statement(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Statement(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*ent.Statement) fc.Result = res return ec.marshalNStatement2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatement(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationCollection_statement(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationCollection", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Statement_id(ctx, field) case "predicate": return ec.fieldContext_Statement_predicate(ctx, field) case "subjects": return ec.fieldContext_Statement_subjects(ctx, field) case "policy": return ec.fieldContext_Statement_policy(ctx, field) case "attestationCollections": return ec.fieldContext_Statement_attestationCollections(ctx, field) case "dsse": return ec.fieldContext_Statement_dsse(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Statement", field.Name) }, } return fc, nil } func (ec *executionContext) _AttestationPolicy_id(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationPolicy) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationPolicy_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationPolicy_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationPolicy", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _AttestationPolicy_name(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationPolicy) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationPolicy_name(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationPolicy_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationPolicy", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _AttestationPolicy_statement(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationPolicy) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationPolicy_statement(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Statement(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.Statement) fc.Result = res return ec.marshalOStatement2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatement(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationPolicy_statement(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationPolicy", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Statement_id(ctx, field) case "predicate": return ec.fieldContext_Statement_predicate(ctx, field) case "subjects": return ec.fieldContext_Statement_subjects(ctx, field) case "policy": return ec.fieldContext_Statement_policy(ctx, field) case "attestationCollections": return ec.fieldContext_Statement_attestationCollections(ctx, field) case "dsse": return ec.fieldContext_Statement_dsse(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Statement", field.Name) }, } return fc, nil } func (ec *executionContext) _AttestationPolicyConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationPolicyConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationPolicyConnection_edges(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Edges, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]*ent.AttestationPolicyEdge) fc.Result = res return ec.marshalOAttestationPolicyEdge2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyEdge(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationPolicyConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationPolicyConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "node": return ec.fieldContext_AttestationPolicyEdge_node(ctx, field) case "cursor": return ec.fieldContext_AttestationPolicyEdge_cursor(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type AttestationPolicyEdge", field.Name) }, } return fc, nil } func (ec *executionContext) _AttestationPolicyConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationPolicyConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationPolicyConnection_pageInfo(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.PageInfo, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(entgql.PageInfo[uuid.UUID]) fc.Result = res return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationPolicyConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationPolicyConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "hasNextPage": return ec.fieldContext_PageInfo_hasNextPage(ctx, field) case "hasPreviousPage": return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) case "startCursor": return ec.fieldContext_PageInfo_startCursor(ctx, field) case "endCursor": return ec.fieldContext_PageInfo_endCursor(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } func (ec *executionContext) _AttestationPolicyConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationPolicyConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationPolicyConnection_totalCount(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.TotalCount, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationPolicyConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationPolicyConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } func (ec *executionContext) _AttestationPolicyEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationPolicyEdge) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationPolicyEdge_node(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Node, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.AttestationPolicy) fc.Result = res return ec.marshalOAttestationPolicy2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicy(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationPolicyEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationPolicyEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_AttestationPolicy_id(ctx, field) case "name": return ec.fieldContext_AttestationPolicy_name(ctx, field) case "statement": return ec.fieldContext_AttestationPolicy_statement(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type AttestationPolicy", field.Name) }, } return fc, nil } func (ec *executionContext) _AttestationPolicyEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.AttestationPolicyEdge) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AttestationPolicyEdge_cursor(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Cursor, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(entgql.Cursor[uuid.UUID]) fc.Result = res return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_AttestationPolicyEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AttestationPolicyEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } func (ec *executionContext) _Dsse_id(ctx context.Context, field graphql.CollectedField, obj *ent.Dsse) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Dsse_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Dsse_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Dsse", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _Dsse_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Dsse) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Dsse_createdAt(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedAt, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*time.Time) fc.Result = res return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Dsse_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Dsse", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } func (ec *executionContext) _Dsse_gitoidSha256(ctx context.Context, field graphql.CollectedField, obj *ent.Dsse) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Dsse_gitoidSha256(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.GitoidSha256, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Dsse_gitoidSha256(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Dsse", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _Dsse_payloadType(ctx context.Context, field graphql.CollectedField, obj *ent.Dsse) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Dsse_payloadType(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.PayloadType, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Dsse_payloadType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Dsse", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _Dsse_statement(ctx context.Context, field graphql.CollectedField, obj *ent.Dsse) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Dsse_statement(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Statement(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.Statement) fc.Result = res return ec.marshalOStatement2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatement(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Dsse_statement(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Dsse", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Statement_id(ctx, field) case "predicate": return ec.fieldContext_Statement_predicate(ctx, field) case "subjects": return ec.fieldContext_Statement_subjects(ctx, field) case "policy": return ec.fieldContext_Statement_policy(ctx, field) case "attestationCollections": return ec.fieldContext_Statement_attestationCollections(ctx, field) case "dsse": return ec.fieldContext_Statement_dsse(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Statement", field.Name) }, } return fc, nil } func (ec *executionContext) _Dsse_signatures(ctx context.Context, field graphql.CollectedField, obj *ent.Dsse) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Dsse_signatures(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Signatures(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]*ent.Signature) fc.Result = res return ec.marshalOSignature2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Dsse_signatures(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Dsse", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Signature_id(ctx, field) case "keyID": return ec.fieldContext_Signature_keyID(ctx, field) case "signature": return ec.fieldContext_Signature_signature(ctx, field) case "dsse": return ec.fieldContext_Signature_dsse(ctx, field) case "timestamps": return ec.fieldContext_Signature_timestamps(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Signature", field.Name) }, } return fc, nil } func (ec *executionContext) _Dsse_payloadDigests(ctx context.Context, field graphql.CollectedField, obj *ent.Dsse) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Dsse_payloadDigests(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.PayloadDigests(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]*ent.PayloadDigest) fc.Result = res return ec.marshalOPayloadDigest2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Dsse_payloadDigests(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Dsse", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_PayloadDigest_id(ctx, field) case "algorithm": return ec.fieldContext_PayloadDigest_algorithm(ctx, field) case "value": return ec.fieldContext_PayloadDigest_value(ctx, field) case "dsse": return ec.fieldContext_PayloadDigest_dsse(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type PayloadDigest", field.Name) }, } return fc, nil } func (ec *executionContext) _DsseConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.DsseConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DsseConnection_edges(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Edges, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]*ent.DsseEdge) fc.Result = res return ec.marshalODsseEdge2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseEdge(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_DsseConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "DsseConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "node": return ec.fieldContext_DsseEdge_node(ctx, field) case "cursor": return ec.fieldContext_DsseEdge_cursor(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type DsseEdge", field.Name) }, } return fc, nil } func (ec *executionContext) _DsseConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.DsseConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DsseConnection_pageInfo(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.PageInfo, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(entgql.PageInfo[uuid.UUID]) fc.Result = res return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_DsseConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "DsseConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "hasNextPage": return ec.fieldContext_PageInfo_hasNextPage(ctx, field) case "hasPreviousPage": return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) case "startCursor": return ec.fieldContext_PageInfo_startCursor(ctx, field) case "endCursor": return ec.fieldContext_PageInfo_endCursor(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } func (ec *executionContext) _DsseConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.DsseConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DsseConnection_totalCount(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.TotalCount, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_DsseConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "DsseConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } func (ec *executionContext) _DsseEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.DsseEdge) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DsseEdge_node(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Node, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.Dsse) fc.Result = res return ec.marshalODsse2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsse(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_DsseEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "DsseEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Dsse_id(ctx, field) case "createdAt": return ec.fieldContext_Dsse_createdAt(ctx, field) case "gitoidSha256": return ec.fieldContext_Dsse_gitoidSha256(ctx, field) case "payloadType": return ec.fieldContext_Dsse_payloadType(ctx, field) case "statement": return ec.fieldContext_Dsse_statement(ctx, field) case "signatures": return ec.fieldContext_Dsse_signatures(ctx, field) case "payloadDigests": return ec.fieldContext_Dsse_payloadDigests(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Dsse", field.Name) }, } return fc, nil } func (ec *executionContext) _DsseEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.DsseEdge) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DsseEdge_cursor(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Cursor, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(entgql.Cursor[uuid.UUID]) fc.Result = res return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_DsseEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "DsseEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[uuid.UUID]) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PageInfo_hasNextPage(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.HasNextPage, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_PageInfo_hasNextPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PageInfo", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[uuid.UUID]) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.HasPreviousPage, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_PageInfo_hasPreviousPage(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PageInfo", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[uuid.UUID]) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PageInfo_startCursor(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.StartCursor, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*entgql.Cursor[uuid.UUID]) fc.Result = res return ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_PageInfo_startCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PageInfo", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *entgql.PageInfo[uuid.UUID]) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PageInfo_endCursor(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.EndCursor, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*entgql.Cursor[uuid.UUID]) fc.Result = res return ec.marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_PageInfo_endCursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PageInfo", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } func (ec *executionContext) _PayloadDigest_id(ctx context.Context, field graphql.CollectedField, obj *ent.PayloadDigest) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PayloadDigest_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_PayloadDigest_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PayloadDigest", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _PayloadDigest_algorithm(ctx context.Context, field graphql.CollectedField, obj *ent.PayloadDigest) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PayloadDigest_algorithm(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Algorithm, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_PayloadDigest_algorithm(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PayloadDigest", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _PayloadDigest_value(ctx context.Context, field graphql.CollectedField, obj *ent.PayloadDigest) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PayloadDigest_value(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Value, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_PayloadDigest_value(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PayloadDigest", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _PayloadDigest_dsse(ctx context.Context, field graphql.CollectedField, obj *ent.PayloadDigest) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PayloadDigest_dsse(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Dsse(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.Dsse) fc.Result = res return ec.marshalODsse2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsse(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_PayloadDigest_dsse(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "PayloadDigest", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Dsse_id(ctx, field) case "createdAt": return ec.fieldContext_Dsse_createdAt(ctx, field) case "gitoidSha256": return ec.fieldContext_Dsse_gitoidSha256(ctx, field) case "payloadType": return ec.fieldContext_Dsse_payloadType(ctx, field) case "statement": return ec.fieldContext_Dsse_statement(ctx, field) case "signatures": return ec.fieldContext_Dsse_signatures(ctx, field) case "payloadDigests": return ec.fieldContext_Dsse_payloadDigests(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Dsse", field.Name) }, } return fc, nil } func (ec *executionContext) _Query_node(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_node(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Node(rctx, fc.Args["id"].(uuid.UUID)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(ent.Noder) fc.Result = res return ec.marshalONode2githubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐNoder(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_node(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field_Query_node_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) _Query_nodes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_nodes(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Nodes(rctx, fc.Args["ids"].([]uuid.UUID)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]ent.Noder) fc.Result = res return ec.marshalNNode2ᚕgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐNoder(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field_Query_nodes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) _Query_attestationPolicies(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_attestationPolicies(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().AttestationPolicies(rctx, fc.Args["after"].(*entgql.Cursor[uuid.UUID]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[uuid.UUID]), fc.Args["last"].(*int), fc.Args["where"].(*ent.AttestationPolicyWhereInput)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*ent.AttestationPolicyConnection) fc.Result = res return ec.marshalNAttestationPolicyConnection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyConnection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_attestationPolicies(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "edges": return ec.fieldContext_AttestationPolicyConnection_edges(ctx, field) case "pageInfo": return ec.fieldContext_AttestationPolicyConnection_pageInfo(ctx, field) case "totalCount": return ec.fieldContext_AttestationPolicyConnection_totalCount(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type AttestationPolicyConnection", field.Name) }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field_Query_attestationPolicies_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) _Query_dsses(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_dsses(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Dsses(rctx, fc.Args["after"].(*entgql.Cursor[uuid.UUID]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[uuid.UUID]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.DsseOrder), fc.Args["where"].(*ent.DsseWhereInput)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*ent.DsseConnection) fc.Result = res return ec.marshalNDsseConnection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseConnection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_dsses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "edges": return ec.fieldContext_DsseConnection_edges(ctx, field) case "pageInfo": return ec.fieldContext_DsseConnection_pageInfo(ctx, field) case "totalCount": return ec.fieldContext_DsseConnection_totalCount(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type DsseConnection", field.Name) }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field_Query_dsses_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) _Query_subjects(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_subjects(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Subjects(rctx, fc.Args["after"].(*entgql.Cursor[uuid.UUID]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[uuid.UUID]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.SubjectOrder), fc.Args["where"].(*ent.SubjectWhereInput)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*ent.SubjectConnection) fc.Result = res return ec.marshalNSubjectConnection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectConnection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query_subjects(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "edges": return ec.fieldContext_SubjectConnection_edges(ctx, field) case "pageInfo": return ec.fieldContext_SubjectConnection_pageInfo(ctx, field) case "totalCount": return ec.fieldContext_SubjectConnection_totalCount(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type SubjectConnection", field.Name) }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field_Query_subjects_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(fc.Args["name"].(string)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*introspection.Type) fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query___schema(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*introspection.Schema) fc.Result = res return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "description": return ec.fieldContext___Schema_description(ctx, field) case "types": return ec.fieldContext___Schema_types(ctx, field) case "queryType": return ec.fieldContext___Schema_queryType(ctx, field) case "mutationType": return ec.fieldContext___Schema_mutationType(ctx, field) case "subscriptionType": return ec.fieldContext___Schema_subscriptionType(ctx, field) case "directives": return ec.fieldContext___Schema_directives(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) }, } return fc, nil } func (ec *executionContext) _Signature_id(ctx context.Context, field graphql.CollectedField, obj *ent.Signature) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Signature_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signature_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Signature", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _Signature_keyID(ctx context.Context, field graphql.CollectedField, obj *ent.Signature) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Signature_keyID(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.KeyID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signature_keyID(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Signature", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _Signature_signature(ctx context.Context, field graphql.CollectedField, obj *ent.Signature) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Signature_signature(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Signature, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signature_signature(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Signature", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _Signature_dsse(ctx context.Context, field graphql.CollectedField, obj *ent.Signature) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Signature_dsse(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Dsse(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.Dsse) fc.Result = res return ec.marshalODsse2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsse(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signature_dsse(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Signature", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Dsse_id(ctx, field) case "createdAt": return ec.fieldContext_Dsse_createdAt(ctx, field) case "gitoidSha256": return ec.fieldContext_Dsse_gitoidSha256(ctx, field) case "payloadType": return ec.fieldContext_Dsse_payloadType(ctx, field) case "statement": return ec.fieldContext_Dsse_statement(ctx, field) case "signatures": return ec.fieldContext_Dsse_signatures(ctx, field) case "payloadDigests": return ec.fieldContext_Dsse_payloadDigests(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Dsse", field.Name) }, } return fc, nil } func (ec *executionContext) _Signature_timestamps(ctx context.Context, field graphql.CollectedField, obj *ent.Signature) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Signature_timestamps(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Timestamps(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]*ent.Timestamp) fc.Result = res return ec.marshalOTimestamp2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Signature_timestamps(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Signature", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Timestamp_id(ctx, field) case "type": return ec.fieldContext_Timestamp_type(ctx, field) case "timestamp": return ec.fieldContext_Timestamp_timestamp(ctx, field) case "signature": return ec.fieldContext_Timestamp_signature(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Timestamp", field.Name) }, } return fc, nil } func (ec *executionContext) _Statement_id(ctx context.Context, field graphql.CollectedField, obj *ent.Statement) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Statement_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Statement_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Statement", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _Statement_predicate(ctx context.Context, field graphql.CollectedField, obj *ent.Statement) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Statement_predicate(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Predicate, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Statement_predicate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Statement", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _Statement_subjects(ctx context.Context, field graphql.CollectedField, obj *ent.Statement) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Statement_subjects(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Subjects(ctx, fc.Args["after"].(*entgql.Cursor[uuid.UUID]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[uuid.UUID]), fc.Args["last"].(*int), fc.Args["orderBy"].(*ent.SubjectOrder), fc.Args["where"].(*ent.SubjectWhereInput)) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*ent.SubjectConnection) fc.Result = res return ec.marshalNSubjectConnection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectConnection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Statement_subjects(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Statement", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "edges": return ec.fieldContext_SubjectConnection_edges(ctx, field) case "pageInfo": return ec.fieldContext_SubjectConnection_pageInfo(ctx, field) case "totalCount": return ec.fieldContext_SubjectConnection_totalCount(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type SubjectConnection", field.Name) }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field_Statement_subjects_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) _Statement_policy(ctx context.Context, field graphql.CollectedField, obj *ent.Statement) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Statement_policy(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Policy(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.AttestationPolicy) fc.Result = res return ec.marshalOAttestationPolicy2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicy(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Statement_policy(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Statement", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_AttestationPolicy_id(ctx, field) case "name": return ec.fieldContext_AttestationPolicy_name(ctx, field) case "statement": return ec.fieldContext_AttestationPolicy_statement(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type AttestationPolicy", field.Name) }, } return fc, nil } func (ec *executionContext) _Statement_attestationCollections(ctx context.Context, field graphql.CollectedField, obj *ent.Statement) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Statement_attestationCollections(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.AttestationCollections(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.AttestationCollection) fc.Result = res return ec.marshalOAttestationCollection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollection(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Statement_attestationCollections(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Statement", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_AttestationCollection_id(ctx, field) case "name": return ec.fieldContext_AttestationCollection_name(ctx, field) case "attestations": return ec.fieldContext_AttestationCollection_attestations(ctx, field) case "statement": return ec.fieldContext_AttestationCollection_statement(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type AttestationCollection", field.Name) }, } return fc, nil } func (ec *executionContext) _Statement_dsse(ctx context.Context, field graphql.CollectedField, obj *ent.Statement) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Statement_dsse(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Dsse(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]*ent.Dsse) fc.Result = res return ec.marshalODsse2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Statement_dsse(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Statement", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Dsse_id(ctx, field) case "createdAt": return ec.fieldContext_Dsse_createdAt(ctx, field) case "gitoidSha256": return ec.fieldContext_Dsse_gitoidSha256(ctx, field) case "payloadType": return ec.fieldContext_Dsse_payloadType(ctx, field) case "statement": return ec.fieldContext_Dsse_statement(ctx, field) case "signatures": return ec.fieldContext_Dsse_signatures(ctx, field) case "payloadDigests": return ec.fieldContext_Dsse_payloadDigests(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Dsse", field.Name) }, } return fc, nil } func (ec *executionContext) _Subject_id(ctx context.Context, field graphql.CollectedField, obj *ent.Subject) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Subject_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Subject_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Subject", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _Subject_createdAt(ctx context.Context, field graphql.CollectedField, obj *ent.Subject) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Subject_createdAt(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedAt, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*time.Time) fc.Result = res return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Subject_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Subject", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } func (ec *executionContext) _Subject_name(ctx context.Context, field graphql.CollectedField, obj *ent.Subject) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Subject_name(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Subject_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Subject", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _Subject_subjectDigests(ctx context.Context, field graphql.CollectedField, obj *ent.Subject) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Subject_subjectDigests(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.SubjectDigests(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]*ent.SubjectDigest) fc.Result = res return ec.marshalOSubjectDigest2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Subject_subjectDigests(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Subject", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_SubjectDigest_id(ctx, field) case "algorithm": return ec.fieldContext_SubjectDigest_algorithm(ctx, field) case "value": return ec.fieldContext_SubjectDigest_value(ctx, field) case "subject": return ec.fieldContext_SubjectDigest_subject(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type SubjectDigest", field.Name) }, } return fc, nil } func (ec *executionContext) _Subject_statement(ctx context.Context, field graphql.CollectedField, obj *ent.Subject) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Subject_statement(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Statement(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.Statement) fc.Result = res return ec.marshalOStatement2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatement(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Subject_statement(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Subject", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Statement_id(ctx, field) case "predicate": return ec.fieldContext_Statement_predicate(ctx, field) case "subjects": return ec.fieldContext_Statement_subjects(ctx, field) case "policy": return ec.fieldContext_Statement_policy(ctx, field) case "attestationCollections": return ec.fieldContext_Statement_attestationCollections(ctx, field) case "dsse": return ec.fieldContext_Statement_dsse(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Statement", field.Name) }, } return fc, nil } func (ec *executionContext) _SubjectConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.SubjectConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SubjectConnection_edges(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Edges, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]*ent.SubjectEdge) fc.Result = res return ec.marshalOSubjectEdge2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectEdge(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SubjectConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SubjectConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "node": return ec.fieldContext_SubjectEdge_node(ctx, field) case "cursor": return ec.fieldContext_SubjectEdge_cursor(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type SubjectEdge", field.Name) }, } return fc, nil } func (ec *executionContext) _SubjectConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.SubjectConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SubjectConnection_pageInfo(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.PageInfo, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(entgql.PageInfo[uuid.UUID]) fc.Result = res return ec.marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SubjectConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SubjectConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "hasNextPage": return ec.fieldContext_PageInfo_hasNextPage(ctx, field) case "hasPreviousPage": return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) case "startCursor": return ec.fieldContext_PageInfo_startCursor(ctx, field) case "endCursor": return ec.fieldContext_PageInfo_endCursor(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) }, } return fc, nil } func (ec *executionContext) _SubjectConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *ent.SubjectConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SubjectConnection_totalCount(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.TotalCount, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(int) fc.Result = res return ec.marshalNInt2int(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SubjectConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SubjectConnection", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } func (ec *executionContext) _SubjectDigest_id(ctx context.Context, field graphql.CollectedField, obj *ent.SubjectDigest) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SubjectDigest_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SubjectDigest_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SubjectDigest", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _SubjectDigest_algorithm(ctx context.Context, field graphql.CollectedField, obj *ent.SubjectDigest) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SubjectDigest_algorithm(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Algorithm, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SubjectDigest_algorithm(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SubjectDigest", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _SubjectDigest_value(ctx context.Context, field graphql.CollectedField, obj *ent.SubjectDigest) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SubjectDigest_value(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Value, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SubjectDigest_value(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SubjectDigest", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _SubjectDigest_subject(ctx context.Context, field graphql.CollectedField, obj *ent.SubjectDigest) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SubjectDigest_subject(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Subject(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.Subject) fc.Result = res return ec.marshalOSubject2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubject(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SubjectDigest_subject(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SubjectDigest", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Subject_id(ctx, field) case "createdAt": return ec.fieldContext_Subject_createdAt(ctx, field) case "name": return ec.fieldContext_Subject_name(ctx, field) case "subjectDigests": return ec.fieldContext_Subject_subjectDigests(ctx, field) case "statement": return ec.fieldContext_Subject_statement(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Subject", field.Name) }, } return fc, nil } func (ec *executionContext) _SubjectEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.SubjectEdge) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SubjectEdge_node(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Node, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.Subject) fc.Result = res return ec.marshalOSubject2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubject(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SubjectEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SubjectEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Subject_id(ctx, field) case "createdAt": return ec.fieldContext_Subject_createdAt(ctx, field) case "name": return ec.fieldContext_Subject_name(ctx, field) case "subjectDigests": return ec.fieldContext_Subject_subjectDigests(ctx, field) case "statement": return ec.fieldContext_Subject_statement(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Subject", field.Name) }, } return fc, nil } func (ec *executionContext) _SubjectEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.SubjectEdge) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SubjectEdge_cursor(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Cursor, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(entgql.Cursor[uuid.UUID]) fc.Result = res return ec.marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_SubjectEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SubjectEdge", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Cursor does not have child fields") }, } return fc, nil } func (ec *executionContext) _Timestamp_id(ctx context.Context, field graphql.CollectedField, obj *ent.Timestamp) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Timestamp_id(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(uuid.UUID) fc.Result = res return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Timestamp_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Timestamp", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } func (ec *executionContext) _Timestamp_type(ctx context.Context, field graphql.CollectedField, obj *ent.Timestamp) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Timestamp_type(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Timestamp_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Timestamp", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) _Timestamp_timestamp(ctx context.Context, field graphql.CollectedField, obj *ent.Timestamp) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Timestamp_timestamp(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Timestamp, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(time.Time) fc.Result = res return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Timestamp_timestamp(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Timestamp", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } func (ec *executionContext) _Timestamp_signature(ctx context.Context, field graphql.CollectedField, obj *ent.Timestamp) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Timestamp_signature(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Signature(ctx) }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*ent.Signature) fc.Result = res return ec.marshalOSignature2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignature(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Timestamp_signature(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Timestamp", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": return ec.fieldContext_Signature_id(ctx, field) case "keyID": return ec.fieldContext_Signature_keyID(ctx, field) case "signature": return ec.fieldContext_Signature_signature(ctx, field) case "dsse": return ec.fieldContext_Signature_dsse(ctx, field) case "timestamps": return ec.fieldContext_Signature_timestamps(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Signature", field.Name) }, } return fc, nil } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Directive_name(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Directive_description(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.IsRepeatable, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Directive_locations(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]string) fc.Result = res return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type __DirectiveLocation does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Directive_args(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": return ec.fieldContext___InputValue_name(ctx, field) case "description": return ec.fieldContext___InputValue_description(ctx, field) case "type": return ec.fieldContext___InputValue_type(ctx, field) case "defaultValue": return ec.fieldContext___InputValue_defaultValue(ctx, field) case "isDeprecated": return ec.fieldContext___InputValue_isDeprecated(ctx, field) case "deprecationReason": return ec.fieldContext___InputValue_deprecationReason(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field___Directive_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___EnumValue_name(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___EnumValue_description(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Field_name(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Field_description(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Field_args(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.InputValue) fc.Result = res return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": return ec.fieldContext___InputValue_name(ctx, field) case "description": return ec.fieldContext___InputValue_description(ctx, field) case "type": return ec.fieldContext___InputValue_type(ctx, field) case "defaultValue": return ec.fieldContext___InputValue_defaultValue(ctx, field) case "isDeprecated": return ec.fieldContext___InputValue_isDeprecated(ctx, field) case "deprecationReason": return ec.fieldContext___InputValue_deprecationReason(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field___Field_args_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Field_type(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___InputValue_name(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___InputValue_description(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___InputValue_type(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___InputValue_isDeprecated(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(bool) fc.Result = res return ec.marshalNBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___InputValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { fc, err := ec.fieldContext___InputValue_deprecationReason(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Schema_description(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Schema_types(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Type) fc.Result = res return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Schema_queryType(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(*introspection.Type) fc.Result = res return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Schema_mutationType(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*introspection.Type) fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*introspection.Type) fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Schema_directives(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.([]introspection.Directive) fc.Result = res return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": return ec.fieldContext___Directive_name(ctx, field) case "description": return ec.fieldContext___Directive_description(ctx, field) case "isRepeatable": return ec.fieldContext___Directive_isRepeatable(ctx, field) case "locations": return ec.fieldContext___Directive_locations(ctx, field) case "args": return ec.fieldContext___Directive_args(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) }, } return fc, nil } func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_kind(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } return graphql.Null } res := resTmp.(string) fc.Result = res return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type __TypeKind does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_name(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_description(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.SpecifiedByURL(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*string) fc.Result = res return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_fields(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]introspection.Field) fc.Result = res return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": return ec.fieldContext___Field_name(ctx, field) case "description": return ec.fieldContext___Field_description(ctx, field) case "args": return ec.fieldContext___Field_args(ctx, field) case "type": return ec.fieldContext___Field_type(ctx, field) case "isDeprecated": return ec.fieldContext___Field_isDeprecated(ctx, field) case "deprecationReason": return ec.fieldContext___Field_deprecationReason(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_interfaces(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]introspection.Type) fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]introspection.Type) fc.Result = res return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_enumValues(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]introspection.EnumValue) fc.Result = res return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": return ec.fieldContext___EnumValue_name(ctx, field) case "description": return ec.fieldContext___EnumValue_description(ctx, field) case "isDeprecated": return ec.fieldContext___EnumValue_isDeprecated(ctx, field) case "deprecationReason": return ec.fieldContext___EnumValue_deprecationReason(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) }, } defer func() { if r := recover(); r != nil { err = ec.Recover(ctx, r) ec.Error(ctx, err) } }() ctx = graphql.WithFieldContext(ctx, fc) if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_inputFields(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.([]introspection.InputValue) fc.Result = res return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": return ec.fieldContext___InputValue_name(ctx, field) case "description": return ec.fieldContext___InputValue_description(ctx, field) case "type": return ec.fieldContext___InputValue_type(ctx, field) case "defaultValue": return ec.fieldContext___InputValue_defaultValue(ctx, field) case "isDeprecated": return ec.fieldContext___InputValue_isDeprecated(ctx, field) case "deprecationReason": return ec.fieldContext___InputValue_deprecationReason(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } return fc, nil } func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_ofType(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(*introspection.Type) fc.Result = res return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "kind": return ec.fieldContext___Type_kind(ctx, field) case "name": return ec.fieldContext___Type_name(ctx, field) case "description": return ec.fieldContext___Type_description(ctx, field) case "specifiedByURL": return ec.fieldContext___Type_specifiedByURL(ctx, field) case "fields": return ec.fieldContext___Type_fields(ctx, field) case "interfaces": return ec.fieldContext___Type_interfaces(ctx, field) case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) case "inputFields": return ec.fieldContext___Type_inputFields(ctx, field) case "ofType": return ec.fieldContext___Type_ofType(ctx, field) case "isOneOf": return ec.fieldContext___Type_isOneOf(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } return fc, nil } func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Type_isOneOf(ctx, field) if err != nil { return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children return obj.IsOneOf(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { return graphql.Null } res := resTmp.(bool) fc.Result = res return ec.marshalOBoolean2bool(ctx, field.Selections, res) } func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } // endregion **************************** field.gotpl ***************************** // region **************************** input.gotpl ***************************** func (ec *executionContext) unmarshalInputAttestationCollectionWhereInput(ctx context.Context, obj any) (ent.AttestationCollectionWhereInput, error) { var it ent.AttestationCollectionWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "hasAttestations", "hasAttestationsWith", "hasStatement", "hasStatementWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalOAttestationCollectionWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollectionWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalOAttestationCollectionWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollectionWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalOAttestationCollectionWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollectionWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "name": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Name = data case "nameNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameNEQ = data case "nameIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.NameIn = data case "nameNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.NameNotIn = data case "nameGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameGT = data case "nameGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameGTE = data case "nameLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameLT = data case "nameLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameLTE = data case "nameContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameContains = data case "nameHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameHasPrefix = data case "nameHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameHasSuffix = data case "nameEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameEqualFold = data case "nameContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameContainsFold = data case "hasAttestations": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAttestations")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasAttestations = data case "hasAttestationsWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAttestationsWith")) data, err := ec.unmarshalOAttestationWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasAttestationsWith = data case "hasStatement": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasStatement")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasStatement = data case "hasStatementWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasStatementWith")) data, err := ec.unmarshalOStatementWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasStatementWith = data } } return it, nil } func (ec *executionContext) unmarshalInputAttestationPolicyWhereInput(ctx context.Context, obj any) (ent.AttestationPolicyWhereInput, error) { var it ent.AttestationPolicyWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "hasStatement", "hasStatementWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalOAttestationPolicyWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalOAttestationPolicyWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalOAttestationPolicyWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "name": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Name = data case "nameNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameNEQ = data case "nameIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.NameIn = data case "nameNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.NameNotIn = data case "nameGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameGT = data case "nameGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameGTE = data case "nameLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameLT = data case "nameLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameLTE = data case "nameContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameContains = data case "nameHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameHasPrefix = data case "nameHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameHasSuffix = data case "nameEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameEqualFold = data case "nameContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameContainsFold = data case "hasStatement": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasStatement")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasStatement = data case "hasStatementWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasStatementWith")) data, err := ec.unmarshalOStatementWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasStatementWith = data } } return it, nil } func (ec *executionContext) unmarshalInputAttestationWhereInput(ctx context.Context, obj any) (ent.AttestationWhereInput, error) { var it ent.AttestationWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "type", "typeNEQ", "typeIn", "typeNotIn", "typeGT", "typeGTE", "typeLT", "typeLTE", "typeContains", "typeHasPrefix", "typeHasSuffix", "typeEqualFold", "typeContainsFold", "hasAttestationCollection", "hasAttestationCollectionWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalOAttestationWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalOAttestationWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalOAttestationWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "type": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Type = data case "typeNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeNEQ = data case "typeIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.TypeIn = data case "typeNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.TypeNotIn = data case "typeGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeGT = data case "typeGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeGTE = data case "typeLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeLT = data case "typeLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeLTE = data case "typeContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeContains = data case "typeHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeHasPrefix = data case "typeHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeHasSuffix = data case "typeEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeEqualFold = data case "typeContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeContainsFold = data case "hasAttestationCollection": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAttestationCollection")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasAttestationCollection = data case "hasAttestationCollectionWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAttestationCollectionWith")) data, err := ec.unmarshalOAttestationCollectionWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollectionWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasAttestationCollectionWith = data } } return it, nil } func (ec *executionContext) unmarshalInputDsseOrder(ctx context.Context, obj any) (ent.DsseOrder, error) { var it ent.DsseOrder asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } if _, present := asMap["direction"]; !present { asMap["direction"] = "ASC" } fieldsInOrder := [...]string{"direction", "field"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "direction": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) if err != nil { return it, err } it.Direction = data case "field": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) data, err := ec.unmarshalNDsseOrderField2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseOrderField(ctx, v) if err != nil { return it, err } it.Field = data } } return it, nil } func (ec *executionContext) unmarshalInputDsseWhereInput(ctx context.Context, obj any) (ent.DsseWhereInput, error) { var it ent.DsseWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "gitoidSha256", "gitoidSha256NEQ", "gitoidSha256In", "gitoidSha256NotIn", "gitoidSha256GT", "gitoidSha256GTE", "gitoidSha256LT", "gitoidSha256LTE", "gitoidSha256Contains", "gitoidSha256HasPrefix", "gitoidSha256HasSuffix", "gitoidSha256EqualFold", "gitoidSha256ContainsFold", "payloadType", "payloadTypeNEQ", "payloadTypeIn", "payloadTypeNotIn", "payloadTypeGT", "payloadTypeGTE", "payloadTypeLT", "payloadTypeLTE", "payloadTypeContains", "payloadTypeHasPrefix", "payloadTypeHasSuffix", "payloadTypeEqualFold", "payloadTypeContainsFold", "hasStatement", "hasStatementWith", "hasSignatures", "hasSignaturesWith", "hasPayloadDigests", "hasPayloadDigestsWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalODsseWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalODsseWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalODsseWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "createdAt": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAt = data case "createdAtNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtNEQ = data case "createdAtIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } it.CreatedAtIn = data case "createdAtNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } it.CreatedAtNotIn = data case "createdAtGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtGT = data case "createdAtGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtGTE = data case "createdAtLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtLT = data case "createdAtLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtLTE = data case "createdAtIsNil": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } it.CreatedAtIsNil = data case "createdAtNotNil": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } it.CreatedAtNotNil = data case "gitoidSha256": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256 = data case "gitoidSha256NEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256NEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256NEQ = data case "gitoidSha256In": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256In")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.GitoidSha256In = data case "gitoidSha256NotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256NotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.GitoidSha256NotIn = data case "gitoidSha256GT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256GT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256GT = data case "gitoidSha256GTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256GTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256GTE = data case "gitoidSha256LT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256LT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256LT = data case "gitoidSha256LTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256LTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256LTE = data case "gitoidSha256Contains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256Contains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256Contains = data case "gitoidSha256HasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256HasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256HasPrefix = data case "gitoidSha256HasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256HasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256HasSuffix = data case "gitoidSha256EqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256EqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256EqualFold = data case "gitoidSha256ContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gitoidSha256ContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.GitoidSha256ContainsFold = data case "payloadType": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadType")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadType = data case "payloadTypeNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeNEQ = data case "payloadTypeIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.PayloadTypeIn = data case "payloadTypeNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.PayloadTypeNotIn = data case "payloadTypeGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeGT = data case "payloadTypeGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeGTE = data case "payloadTypeLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeLT = data case "payloadTypeLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeLTE = data case "payloadTypeContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeContains = data case "payloadTypeHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeHasPrefix = data case "payloadTypeHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeHasSuffix = data case "payloadTypeEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeEqualFold = data case "payloadTypeContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("payloadTypeContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PayloadTypeContainsFold = data case "hasStatement": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasStatement")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasStatement = data case "hasStatementWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasStatementWith")) data, err := ec.unmarshalOStatementWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasStatementWith = data case "hasSignatures": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSignatures")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasSignatures = data case "hasSignaturesWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSignaturesWith")) data, err := ec.unmarshalOSignatureWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasSignaturesWith = data case "hasPayloadDigests": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPayloadDigests")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasPayloadDigests = data case "hasPayloadDigestsWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPayloadDigestsWith")) data, err := ec.unmarshalOPayloadDigestWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasPayloadDigestsWith = data } } return it, nil } func (ec *executionContext) unmarshalInputPayloadDigestWhereInput(ctx context.Context, obj any) (ent.PayloadDigestWhereInput, error) { var it ent.PayloadDigestWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "algorithm", "algorithmNEQ", "algorithmIn", "algorithmNotIn", "algorithmGT", "algorithmGTE", "algorithmLT", "algorithmLTE", "algorithmContains", "algorithmHasPrefix", "algorithmHasSuffix", "algorithmEqualFold", "algorithmContainsFold", "value", "valueNEQ", "valueIn", "valueNotIn", "valueGT", "valueGTE", "valueLT", "valueLTE", "valueContains", "valueHasPrefix", "valueHasSuffix", "valueEqualFold", "valueContainsFold", "hasDsse", "hasDsseWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalOPayloadDigestWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalOPayloadDigestWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalOPayloadDigestWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "algorithm": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithm")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Algorithm = data case "algorithmNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmNEQ = data case "algorithmIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.AlgorithmIn = data case "algorithmNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.AlgorithmNotIn = data case "algorithmGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmGT = data case "algorithmGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmGTE = data case "algorithmLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmLT = data case "algorithmLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmLTE = data case "algorithmContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmContains = data case "algorithmHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmHasPrefix = data case "algorithmHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmHasSuffix = data case "algorithmEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmEqualFold = data case "algorithmContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmContainsFold = data case "value": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Value = data case "valueNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueNEQ = data case "valueIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.ValueIn = data case "valueNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.ValueNotIn = data case "valueGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueGT = data case "valueGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueGTE = data case "valueLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueLT = data case "valueLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueLTE = data case "valueContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueContains = data case "valueHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueHasPrefix = data case "valueHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueHasSuffix = data case "valueEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueEqualFold = data case "valueContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueContainsFold = data case "hasDsse": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasDsse")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasDsse = data case "hasDsseWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasDsseWith")) data, err := ec.unmarshalODsseWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasDsseWith = data } } return it, nil } func (ec *executionContext) unmarshalInputSignatureWhereInput(ctx context.Context, obj any) (ent.SignatureWhereInput, error) { var it ent.SignatureWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "keyID", "keyIDNEQ", "keyIDIn", "keyIDNotIn", "keyIDGT", "keyIDGTE", "keyIDLT", "keyIDLTE", "keyIDContains", "keyIDHasPrefix", "keyIDHasSuffix", "keyIDEqualFold", "keyIDContainsFold", "signature", "signatureNEQ", "signatureIn", "signatureNotIn", "signatureGT", "signatureGTE", "signatureLT", "signatureLTE", "signatureContains", "signatureHasPrefix", "signatureHasSuffix", "signatureEqualFold", "signatureContainsFold", "hasDsse", "hasDsseWith", "hasTimestamps", "hasTimestampsWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalOSignatureWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalOSignatureWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalOSignatureWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "keyID": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyID")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyID = data case "keyIDNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDNEQ = data case "keyIDIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.KeyIDIn = data case "keyIDNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.KeyIDNotIn = data case "keyIDGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDGT = data case "keyIDGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDGTE = data case "keyIDLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDLT = data case "keyIDLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDLTE = data case "keyIDContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDContains = data case "keyIDHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDHasPrefix = data case "keyIDHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDHasSuffix = data case "keyIDEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDEqualFold = data case "keyIDContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyIDContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.KeyIDContainsFold = data case "signature": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signature")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Signature = data case "signatureNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureNEQ = data case "signatureIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.SignatureIn = data case "signatureNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.SignatureNotIn = data case "signatureGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureGT = data case "signatureGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureGTE = data case "signatureLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureLT = data case "signatureLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureLTE = data case "signatureContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureContains = data case "signatureHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureHasPrefix = data case "signatureHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureHasSuffix = data case "signatureEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureEqualFold = data case "signatureContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("signatureContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.SignatureContainsFold = data case "hasDsse": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasDsse")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasDsse = data case "hasDsseWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasDsseWith")) data, err := ec.unmarshalODsseWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasDsseWith = data case "hasTimestamps": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTimestamps")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasTimestamps = data case "hasTimestampsWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasTimestampsWith")) data, err := ec.unmarshalOTimestampWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasTimestampsWith = data } } return it, nil } func (ec *executionContext) unmarshalInputStatementWhereInput(ctx context.Context, obj any) (ent.StatementWhereInput, error) { var it ent.StatementWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "predicate", "predicateNEQ", "predicateIn", "predicateNotIn", "predicateGT", "predicateGTE", "predicateLT", "predicateLTE", "predicateContains", "predicateHasPrefix", "predicateHasSuffix", "predicateEqualFold", "predicateContainsFold", "hasSubjects", "hasSubjectsWith", "hasPolicy", "hasPolicyWith", "hasAttestationCollections", "hasAttestationCollectionsWith", "hasDsse", "hasDsseWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalOStatementWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalOStatementWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalOStatementWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "predicate": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicate")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Predicate = data case "predicateNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateNEQ = data case "predicateIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.PredicateIn = data case "predicateNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.PredicateNotIn = data case "predicateGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateGT = data case "predicateGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateGTE = data case "predicateLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateLT = data case "predicateLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateLTE = data case "predicateContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateContains = data case "predicateHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateHasPrefix = data case "predicateHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateHasSuffix = data case "predicateEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateEqualFold = data case "predicateContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("predicateContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.PredicateContainsFold = data case "hasSubjects": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubjects")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasSubjects = data case "hasSubjectsWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubjectsWith")) data, err := ec.unmarshalOSubjectWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasSubjectsWith = data case "hasPolicy": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPolicy")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasPolicy = data case "hasPolicyWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasPolicyWith")) data, err := ec.unmarshalOAttestationPolicyWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasPolicyWith = data case "hasAttestationCollections": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAttestationCollections")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasAttestationCollections = data case "hasAttestationCollectionsWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAttestationCollectionsWith")) data, err := ec.unmarshalOAttestationCollectionWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollectionWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasAttestationCollectionsWith = data case "hasDsse": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasDsse")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasDsse = data case "hasDsseWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasDsseWith")) data, err := ec.unmarshalODsseWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasDsseWith = data } } return it, nil } func (ec *executionContext) unmarshalInputSubjectDigestWhereInput(ctx context.Context, obj any) (ent.SubjectDigestWhereInput, error) { var it ent.SubjectDigestWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "algorithm", "algorithmNEQ", "algorithmIn", "algorithmNotIn", "algorithmGT", "algorithmGTE", "algorithmLT", "algorithmLTE", "algorithmContains", "algorithmHasPrefix", "algorithmHasSuffix", "algorithmEqualFold", "algorithmContainsFold", "value", "valueNEQ", "valueIn", "valueNotIn", "valueGT", "valueGTE", "valueLT", "valueLTE", "valueContains", "valueHasPrefix", "valueHasSuffix", "valueEqualFold", "valueContainsFold", "hasSubject", "hasSubjectWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalOSubjectDigestWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalOSubjectDigestWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalOSubjectDigestWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "algorithm": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithm")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Algorithm = data case "algorithmNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmNEQ = data case "algorithmIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.AlgorithmIn = data case "algorithmNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.AlgorithmNotIn = data case "algorithmGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmGT = data case "algorithmGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmGTE = data case "algorithmLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmLT = data case "algorithmLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmLTE = data case "algorithmContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmContains = data case "algorithmHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmHasPrefix = data case "algorithmHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmHasSuffix = data case "algorithmEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmEqualFold = data case "algorithmContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("algorithmContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.AlgorithmContainsFold = data case "value": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Value = data case "valueNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueNEQ = data case "valueIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.ValueIn = data case "valueNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.ValueNotIn = data case "valueGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueGT = data case "valueGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueGTE = data case "valueLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueLT = data case "valueLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueLTE = data case "valueContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueContains = data case "valueHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueHasPrefix = data case "valueHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueHasSuffix = data case "valueEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueEqualFold = data case "valueContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("valueContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.ValueContainsFold = data case "hasSubject": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubject")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasSubject = data case "hasSubjectWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubjectWith")) data, err := ec.unmarshalOSubjectWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasSubjectWith = data } } return it, nil } func (ec *executionContext) unmarshalInputSubjectOrder(ctx context.Context, obj any) (ent.SubjectOrder, error) { var it ent.SubjectOrder asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } if _, present := asMap["direction"]; !present { asMap["direction"] = "ASC" } fieldsInOrder := [...]string{"direction", "field"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "direction": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) data, err := ec.unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx, v) if err != nil { return it, err } it.Direction = data case "field": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) data, err := ec.unmarshalNSubjectOrderField2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectOrderField(ctx, v) if err != nil { return it, err } it.Field = data } } return it, nil } func (ec *executionContext) unmarshalInputSubjectWhereInput(ctx context.Context, obj any) (ent.SubjectWhereInput, error) { var it ent.SubjectWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "hasSubjectDigests", "hasSubjectDigestsWith", "hasStatement", "hasStatementWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalOSubjectWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalOSubjectWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalOSubjectWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "createdAt": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAt")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAt = data case "createdAtNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNEQ")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtNEQ = data case "createdAtIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIn")) data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } it.CreatedAtIn = data case "createdAtNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotIn")) data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } it.CreatedAtNotIn = data case "createdAtGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtGT = data case "createdAtGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtGTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtGTE = data case "createdAtLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtLT = data case "createdAtLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtLTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.CreatedAtLTE = data case "createdAtIsNil": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtIsNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } it.CreatedAtIsNil = data case "createdAtNotNil": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createdAtNotNil")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } it.CreatedAtNotNil = data case "name": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Name = data case "nameNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameNEQ = data case "nameIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.NameIn = data case "nameNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.NameNotIn = data case "nameGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameGT = data case "nameGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameGTE = data case "nameLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameLT = data case "nameLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameLTE = data case "nameContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameContains = data case "nameHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameHasPrefix = data case "nameHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameHasSuffix = data case "nameEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameEqualFold = data case "nameContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nameContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.NameContainsFold = data case "hasSubjectDigests": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubjectDigests")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasSubjectDigests = data case "hasSubjectDigestsWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSubjectDigestsWith")) data, err := ec.unmarshalOSubjectDigestWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasSubjectDigestsWith = data case "hasStatement": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasStatement")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasStatement = data case "hasStatementWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasStatementWith")) data, err := ec.unmarshalOStatementWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasStatementWith = data } } return it, nil } func (ec *executionContext) unmarshalInputTimestampWhereInput(ctx context.Context, obj any) (ent.TimestampWhereInput, error) { var it ent.TimestampWhereInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "type", "typeNEQ", "typeIn", "typeNotIn", "typeGT", "typeGTE", "typeLT", "typeLTE", "typeContains", "typeHasPrefix", "typeHasSuffix", "typeEqualFold", "typeContainsFold", "timestamp", "timestampNEQ", "timestampIn", "timestampNotIn", "timestampGT", "timestampGTE", "timestampLT", "timestampLTE", "hasSignature", "hasSignatureWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { case "not": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("not")) data, err := ec.unmarshalOTimestampWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampWhereInput(ctx, v) if err != nil { return it, err } it.Not = data case "and": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("and")) data, err := ec.unmarshalOTimestampWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampWhereInputᚄ(ctx, v) if err != nil { return it, err } it.And = data case "or": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("or")) data, err := ec.unmarshalOTimestampWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampWhereInputᚄ(ctx, v) if err != nil { return it, err } it.Or = data case "id": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.ID = data case "idNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNEQ")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDNEQ = data case "idIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDIn = data case "idNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idNotIn")) data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v) if err != nil { return it, err } it.IDNotIn = data case "idGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGT = data case "idGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idGTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDGTE = data case "idLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLT")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLT = data case "idLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idLTE")) data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v) if err != nil { return it, err } it.IDLTE = data case "type": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Type = data case "typeNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeNEQ")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeNEQ = data case "typeIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.TypeIn = data case "typeNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeNotIn")) data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) if err != nil { return it, err } it.TypeNotIn = data case "typeGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeGT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeGT = data case "typeGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeGTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeGTE = data case "typeLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeLT")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeLT = data case "typeLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeLTE")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeLTE = data case "typeContains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeContains")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeContains = data case "typeHasPrefix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeHasPrefix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeHasPrefix = data case "typeHasSuffix": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeHasSuffix")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeHasSuffix = data case "typeEqualFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeEqualFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeEqualFold = data case "typeContainsFold": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("typeContainsFold")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.TypeContainsFold = data case "timestamp": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("timestamp")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.Timestamp = data case "timestampNEQ": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("timestampNEQ")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.TimestampNEQ = data case "timestampIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("timestampIn")) data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } it.TimestampIn = data case "timestampNotIn": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("timestampNotIn")) data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) if err != nil { return it, err } it.TimestampNotIn = data case "timestampGT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("timestampGT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.TimestampGT = data case "timestampGTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("timestampGTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.TimestampGTE = data case "timestampLT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("timestampLT")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.TimestampLT = data case "timestampLTE": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("timestampLTE")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } it.TimestampLTE = data case "hasSignature": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSignature")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } it.HasSignature = data case "hasSignatureWith": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasSignatureWith")) data, err := ec.unmarshalOSignatureWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureWhereInputᚄ(ctx, v) if err != nil { return it, err } it.HasSignatureWith = data } } return it, nil } // endregion **************************** input.gotpl ***************************** // region ************************** interface.gotpl *************************** func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj ent.Noder) graphql.Marshaler { switch obj := (obj).(type) { case nil: return graphql.Null case *ent.Timestamp: if obj == nil { return graphql.Null } return ec._Timestamp(ctx, sel, obj) case *ent.SubjectDigest: if obj == nil { return graphql.Null } return ec._SubjectDigest(ctx, sel, obj) case *ent.Subject: if obj == nil { return graphql.Null } return ec._Subject(ctx, sel, obj) case *ent.Statement: if obj == nil { return graphql.Null } return ec._Statement(ctx, sel, obj) case *ent.Signature: if obj == nil { return graphql.Null } return ec._Signature(ctx, sel, obj) case *ent.PayloadDigest: if obj == nil { return graphql.Null } return ec._PayloadDigest(ctx, sel, obj) case *ent.Dsse: if obj == nil { return graphql.Null } return ec._Dsse(ctx, sel, obj) case *ent.AttestationPolicy: if obj == nil { return graphql.Null } return ec._AttestationPolicy(ctx, sel, obj) case *ent.AttestationCollection: if obj == nil { return graphql.Null } return ec._AttestationCollection(ctx, sel, obj) case *ent.Attestation: if obj == nil { return graphql.Null } return ec._Attestation(ctx, sel, obj) default: panic(fmt.Errorf("unexpected type %T", obj)) } } // endregion ************************** interface.gotpl *************************** // region **************************** object.gotpl **************************** var attestationImplementors = []string{"Attestation", "Node"} func (ec *executionContext) _Attestation(ctx context.Context, sel ast.SelectionSet, obj *ent.Attestation) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, attestationImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Attestation") case "id": out.Values[i] = ec._Attestation_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "type": out.Values[i] = ec._Attestation_type(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "attestationCollection": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Attestation_attestationCollection(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var attestationCollectionImplementors = []string{"AttestationCollection", "Node"} func (ec *executionContext) _AttestationCollection(ctx context.Context, sel ast.SelectionSet, obj *ent.AttestationCollection) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, attestationCollectionImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("AttestationCollection") case "id": out.Values[i] = ec._AttestationCollection_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "name": out.Values[i] = ec._AttestationCollection_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "attestations": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._AttestationCollection_attestations(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "statement": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._AttestationCollection_statement(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var attestationPolicyImplementors = []string{"AttestationPolicy", "Node"} func (ec *executionContext) _AttestationPolicy(ctx context.Context, sel ast.SelectionSet, obj *ent.AttestationPolicy) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, attestationPolicyImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("AttestationPolicy") case "id": out.Values[i] = ec._AttestationPolicy_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "name": out.Values[i] = ec._AttestationPolicy_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "statement": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._AttestationPolicy_statement(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var attestationPolicyConnectionImplementors = []string{"AttestationPolicyConnection"} func (ec *executionContext) _AttestationPolicyConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.AttestationPolicyConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, attestationPolicyConnectionImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("AttestationPolicyConnection") case "edges": out.Values[i] = ec._AttestationPolicyConnection_edges(ctx, field, obj) case "pageInfo": out.Values[i] = ec._AttestationPolicyConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": out.Values[i] = ec._AttestationPolicyConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var attestationPolicyEdgeImplementors = []string{"AttestationPolicyEdge"} func (ec *executionContext) _AttestationPolicyEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.AttestationPolicyEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, attestationPolicyEdgeImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("AttestationPolicyEdge") case "node": out.Values[i] = ec._AttestationPolicyEdge_node(ctx, field, obj) case "cursor": out.Values[i] = ec._AttestationPolicyEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var dsseImplementors = []string{"Dsse", "Node"} func (ec *executionContext) _Dsse(ctx context.Context, sel ast.SelectionSet, obj *ent.Dsse) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, dsseImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Dsse") case "id": out.Values[i] = ec._Dsse_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "createdAt": out.Values[i] = ec._Dsse_createdAt(ctx, field, obj) case "gitoidSha256": out.Values[i] = ec._Dsse_gitoidSha256(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "payloadType": out.Values[i] = ec._Dsse_payloadType(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "statement": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Dsse_statement(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "signatures": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Dsse_signatures(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "payloadDigests": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Dsse_payloadDigests(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var dsseConnectionImplementors = []string{"DsseConnection"} func (ec *executionContext) _DsseConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.DsseConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, dsseConnectionImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("DsseConnection") case "edges": out.Values[i] = ec._DsseConnection_edges(ctx, field, obj) case "pageInfo": out.Values[i] = ec._DsseConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": out.Values[i] = ec._DsseConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var dsseEdgeImplementors = []string{"DsseEdge"} func (ec *executionContext) _DsseEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.DsseEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, dsseEdgeImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("DsseEdge") case "node": out.Values[i] = ec._DsseEdge_node(ctx, field, obj) case "cursor": out.Values[i] = ec._DsseEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var pageInfoImplementors = []string{"PageInfo"} func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *entgql.PageInfo[uuid.UUID]) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, pageInfoImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("PageInfo") case "hasNextPage": out.Values[i] = ec._PageInfo_hasNextPage(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "hasPreviousPage": out.Values[i] = ec._PageInfo_hasPreviousPage(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "startCursor": out.Values[i] = ec._PageInfo_startCursor(ctx, field, obj) case "endCursor": out.Values[i] = ec._PageInfo_endCursor(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var payloadDigestImplementors = []string{"PayloadDigest", "Node"} func (ec *executionContext) _PayloadDigest(ctx context.Context, sel ast.SelectionSet, obj *ent.PayloadDigest) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, payloadDigestImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("PayloadDigest") case "id": out.Values[i] = ec._PayloadDigest_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "algorithm": out.Values[i] = ec._PayloadDigest_algorithm(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "value": out.Values[i] = ec._PayloadDigest_value(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "dsse": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._PayloadDigest_dsse(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ Object: "Query", }) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, Field: field, }) switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Query") case "node": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Query_node(ctx, field) return res } rrm := func(ctx context.Context) graphql.Marshaler { return ec.OperationContext.RootResolverMiddleware(ctx, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "nodes": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Query_nodes(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } return res } rrm := func(ctx context.Context) graphql.Marshaler { return ec.OperationContext.RootResolverMiddleware(ctx, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "attestationPolicies": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Query_attestationPolicies(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } return res } rrm := func(ctx context.Context) graphql.Marshaler { return ec.OperationContext.RootResolverMiddleware(ctx, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "dsses": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Query_dsses(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } return res } rrm := func(ctx context.Context) graphql.Marshaler { return ec.OperationContext.RootResolverMiddleware(ctx, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "subjects": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Query_subjects(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } return res } rrm := func(ctx context.Context) graphql.Marshaler { return ec.OperationContext.RootResolverMiddleware(ctx, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Query___type(ctx, field) }) case "__schema": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Query___schema(ctx, field) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var signatureImplementors = []string{"Signature", "Node"} func (ec *executionContext) _Signature(ctx context.Context, sel ast.SelectionSet, obj *ent.Signature) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, signatureImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Signature") case "id": out.Values[i] = ec._Signature_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "keyID": out.Values[i] = ec._Signature_keyID(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "signature": out.Values[i] = ec._Signature_signature(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "dsse": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Signature_dsse(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "timestamps": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Signature_timestamps(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var statementImplementors = []string{"Statement", "Node"} func (ec *executionContext) _Statement(ctx context.Context, sel ast.SelectionSet, obj *ent.Statement) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, statementImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Statement") case "id": out.Values[i] = ec._Statement_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "predicate": out.Values[i] = ec._Statement_predicate(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "subjects": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Statement_subjects(ctx, field, obj) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "policy": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Statement_policy(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "attestationCollections": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Statement_attestationCollections(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "dsse": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Statement_dsse(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var subjectImplementors = []string{"Subject", "Node"} func (ec *executionContext) _Subject(ctx context.Context, sel ast.SelectionSet, obj *ent.Subject) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, subjectImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Subject") case "id": out.Values[i] = ec._Subject_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "createdAt": out.Values[i] = ec._Subject_createdAt(ctx, field, obj) case "name": out.Values[i] = ec._Subject_name(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "subjectDigests": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Subject_subjectDigests(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "statement": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Subject_statement(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var subjectConnectionImplementors = []string{"SubjectConnection"} func (ec *executionContext) _SubjectConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.SubjectConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, subjectConnectionImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("SubjectConnection") case "edges": out.Values[i] = ec._SubjectConnection_edges(ctx, field, obj) case "pageInfo": out.Values[i] = ec._SubjectConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "totalCount": out.Values[i] = ec._SubjectConnection_totalCount(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var subjectDigestImplementors = []string{"SubjectDigest", "Node"} func (ec *executionContext) _SubjectDigest(ctx context.Context, sel ast.SelectionSet, obj *ent.SubjectDigest) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, subjectDigestImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("SubjectDigest") case "id": out.Values[i] = ec._SubjectDigest_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "algorithm": out.Values[i] = ec._SubjectDigest_algorithm(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "value": out.Values[i] = ec._SubjectDigest_value(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "subject": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._SubjectDigest_subject(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var subjectEdgeImplementors = []string{"SubjectEdge"} func (ec *executionContext) _SubjectEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.SubjectEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, subjectEdgeImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("SubjectEdge") case "node": out.Values[i] = ec._SubjectEdge_node(ctx, field, obj) case "cursor": out.Values[i] = ec._SubjectEdge_cursor(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var timestampImplementors = []string{"Timestamp", "Node"} func (ec *executionContext) _Timestamp(ctx context.Context, sel ast.SelectionSet, obj *ent.Timestamp) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, timestampImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("Timestamp") case "id": out.Values[i] = ec._Timestamp_id(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "type": out.Values[i] = ec._Timestamp_type(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "timestamp": out.Values[i] = ec._Timestamp_timestamp(ctx, field, obj) if out.Values[i] == graphql.Null { atomic.AddUint32(&out.Invalids, 1) } case "signature": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) } }() res = ec._Timestamp_signature(ctx, field, obj) return res } if field.Deferrable != nil { dfs, ok := deferred[field.Deferrable.Label] di := 0 if ok { dfs.AddField(field) di = len(dfs.Values) - 1 } else { dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) deferred[field.Deferrable.Label] = dfs } dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, dfs) }) // don't run the out.Concurrently() call below out.Values[i] = graphql.Null continue } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__Directive") case "name": out.Values[i] = ec.___Directive_name(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "description": out.Values[i] = ec.___Directive_description(ctx, field, obj) case "isRepeatable": out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "locations": out.Values[i] = ec.___Directive_locations(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "args": out.Values[i] = ec.___Directive_args(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var __EnumValueImplementors = []string{"__EnumValue"} func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__EnumValue") case "name": out.Values[i] = ec.___EnumValue_name(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "description": out.Values[i] = ec.___EnumValue_description(ctx, field, obj) case "isDeprecated": out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "deprecationReason": out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var __FieldImplementors = []string{"__Field"} func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__Field") case "name": out.Values[i] = ec.___Field_name(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "description": out.Values[i] = ec.___Field_description(ctx, field, obj) case "args": out.Values[i] = ec.___Field_args(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "type": out.Values[i] = ec.___Field_type(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "isDeprecated": out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "deprecationReason": out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var __InputValueImplementors = []string{"__InputValue"} func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__InputValue") case "name": out.Values[i] = ec.___InputValue_name(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "description": out.Values[i] = ec.___InputValue_description(ctx, field, obj) case "type": out.Values[i] = ec.___InputValue_type(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "defaultValue": out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) case "isDeprecated": out.Values[i] = ec.___InputValue_isDeprecated(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "deprecationReason": out.Values[i] = ec.___InputValue_deprecationReason(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var __SchemaImplementors = []string{"__Schema"} func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__Schema") case "description": out.Values[i] = ec.___Schema_description(ctx, field, obj) case "types": out.Values[i] = ec.___Schema_types(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "queryType": out.Values[i] = ec.___Schema_queryType(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "mutationType": out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) case "subscriptionType": out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) case "directives": out.Values[i] = ec.___Schema_directives(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } var __TypeImplementors = []string{"__Type"} func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("__Type") case "kind": out.Values[i] = ec.___Type_kind(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } case "name": out.Values[i] = ec.___Type_name(ctx, field, obj) case "description": out.Values[i] = ec.___Type_description(ctx, field, obj) case "specifiedByURL": out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) case "fields": out.Values[i] = ec.___Type_fields(ctx, field, obj) case "interfaces": out.Values[i] = ec.___Type_interfaces(ctx, field, obj) case "possibleTypes": out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) case "enumValues": out.Values[i] = ec.___Type_enumValues(ctx, field, obj) case "inputFields": out.Values[i] = ec.___Type_inputFields(ctx, field, obj) case "ofType": out.Values[i] = ec.___Type_ofType(ctx, field, obj) case "isOneOf": out.Values[i] = ec.___Type_isOneOf(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } } out.Dispatch(ctx) if out.Invalids > 0 { return graphql.Null } atomic.AddInt32(&ec.deferred, int32(len(deferred))) for label, dfs := range deferred { ec.processDeferredGroup(graphql.DeferredGroup{ Label: label, Path: graphql.GetPath(ctx), FieldSet: dfs, Context: ctx, }) } return out } // endregion **************************** object.gotpl **************************** // region ***************************** type.gotpl ***************************** func (ec *executionContext) marshalNAttestation2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestation(ctx context.Context, sel ast.SelectionSet, v *ent.Attestation) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._Attestation(ctx, sel, v) } func (ec *executionContext) marshalNAttestationCollection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollection(ctx context.Context, sel ast.SelectionSet, v *ent.AttestationCollection) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._AttestationCollection(ctx, sel, v) } func (ec *executionContext) unmarshalNAttestationCollectionWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollectionWhereInput(ctx context.Context, v any) (*ent.AttestationCollectionWhereInput, error) { res, err := ec.unmarshalInputAttestationCollectionWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNAttestationPolicyConnection2githubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyConnection(ctx context.Context, sel ast.SelectionSet, v ent.AttestationPolicyConnection) graphql.Marshaler { return ec._AttestationPolicyConnection(ctx, sel, &v) } func (ec *executionContext) marshalNAttestationPolicyConnection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyConnection(ctx context.Context, sel ast.SelectionSet, v *ent.AttestationPolicyConnection) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._AttestationPolicyConnection(ctx, sel, v) } func (ec *executionContext) unmarshalNAttestationPolicyWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyWhereInput(ctx context.Context, v any) (*ent.AttestationPolicyWhereInput, error) { res, err := ec.unmarshalInputAttestationPolicyWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalNAttestationWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationWhereInput(ctx context.Context, v any) (*ent.AttestationWhereInput, error) { res, err := ec.unmarshalInputAttestationWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v any) (bool, error) { res, err := graphql.UnmarshalBoolean(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { _ = sel res := graphql.MarshalBoolean(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } } return res } func (ec *executionContext) unmarshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, v any) (entgql.Cursor[uuid.UUID], error) { var res entgql.Cursor[uuid.UUID] err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNCursor2entgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, sel ast.SelectionSet, v entgql.Cursor[uuid.UUID]) graphql.Marshaler { return v } func (ec *executionContext) marshalNDsse2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsse(ctx context.Context, sel ast.SelectionSet, v *ent.Dsse) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._Dsse(ctx, sel, v) } func (ec *executionContext) marshalNDsseConnection2githubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseConnection(ctx context.Context, sel ast.SelectionSet, v ent.DsseConnection) graphql.Marshaler { return ec._DsseConnection(ctx, sel, &v) } func (ec *executionContext) marshalNDsseConnection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseConnection(ctx context.Context, sel ast.SelectionSet, v *ent.DsseConnection) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._DsseConnection(ctx, sel, v) } func (ec *executionContext) unmarshalNDsseOrderField2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseOrderField(ctx context.Context, v any) (*ent.DsseOrderField, error) { var res = new(ent.DsseOrderField) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNDsseOrderField2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.DsseOrderField) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return v } func (ec *executionContext) unmarshalNDsseWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInput(ctx context.Context, v any) (*ent.DsseWhereInput, error) { res, err := ec.unmarshalInputDsseWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx context.Context, v any) (uuid.UUID, error) { res, err := uuidgql.UnmarshalUUID(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx context.Context, sel ast.SelectionSet, v uuid.UUID) graphql.Marshaler { _ = sel res := uuidgql.MarshalUUID(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } } return res } func (ec *executionContext) unmarshalNID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx context.Context, v any) ([]uuid.UUID, error) { var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]uuid.UUID, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) marshalNID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx context.Context, sel ast.SelectionSet, v []uuid.UUID) graphql.Marshaler { ret := make(graphql.Array, len(v)) for i := range v { ret[i] = ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, sel, v[i]) } for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v any) (int, error) { res, err := graphql.UnmarshalInt(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { _ = sel res := graphql.MarshalInt(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } } return res } func (ec *executionContext) marshalNNode2ᚕgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐNoder(ctx context.Context, sel ast.SelectionSet, v []ent.Noder) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalONode2githubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐNoder(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() return ret } func (ec *executionContext) unmarshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx context.Context, v any) (entgql.OrderDirection, error) { var res entgql.OrderDirection err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNOrderDirection2entgoᚗioᚋcontribᚋentgqlᚐOrderDirection(ctx context.Context, sel ast.SelectionSet, v entgql.OrderDirection) graphql.Marshaler { return v } func (ec *executionContext) marshalNPageInfo2entgoᚗioᚋcontribᚋentgqlᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v entgql.PageInfo[uuid.UUID]) graphql.Marshaler { return ec._PageInfo(ctx, sel, &v) } func (ec *executionContext) marshalNPayloadDigest2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigest(ctx context.Context, sel ast.SelectionSet, v *ent.PayloadDigest) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._PayloadDigest(ctx, sel, v) } func (ec *executionContext) unmarshalNPayloadDigestWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestWhereInput(ctx context.Context, v any) (*ent.PayloadDigestWhereInput, error) { res, err := ec.unmarshalInputPayloadDigestWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNSignature2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignature(ctx context.Context, sel ast.SelectionSet, v *ent.Signature) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._Signature(ctx, sel, v) } func (ec *executionContext) unmarshalNSignatureWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureWhereInput(ctx context.Context, v any) (*ent.SignatureWhereInput, error) { res, err := ec.unmarshalInputSignatureWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNStatement2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatement(ctx context.Context, sel ast.SelectionSet, v *ent.Statement) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._Statement(ctx, sel, v) } func (ec *executionContext) unmarshalNStatementWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInput(ctx context.Context, v any) (*ent.StatementWhereInput, error) { res, err := ec.unmarshalInputStatementWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v any) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { _ = sel res := graphql.MarshalString(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } } return res } func (ec *executionContext) marshalNSubjectConnection2githubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectConnection(ctx context.Context, sel ast.SelectionSet, v ent.SubjectConnection) graphql.Marshaler { return ec._SubjectConnection(ctx, sel, &v) } func (ec *executionContext) marshalNSubjectConnection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectConnection(ctx context.Context, sel ast.SelectionSet, v *ent.SubjectConnection) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._SubjectConnection(ctx, sel, v) } func (ec *executionContext) marshalNSubjectDigest2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigest(ctx context.Context, sel ast.SelectionSet, v *ent.SubjectDigest) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._SubjectDigest(ctx, sel, v) } func (ec *executionContext) unmarshalNSubjectDigestWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestWhereInput(ctx context.Context, v any) (*ent.SubjectDigestWhereInput, error) { res, err := ec.unmarshalInputSubjectDigestWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalNSubjectOrderField2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectOrderField(ctx context.Context, v any) (*ent.SubjectOrderField, error) { var res = new(ent.SubjectOrderField) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNSubjectOrderField2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectOrderField(ctx context.Context, sel ast.SelectionSet, v *ent.SubjectOrderField) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return v } func (ec *executionContext) unmarshalNSubjectWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInput(ctx context.Context, v any) (*ent.SubjectWhereInput, error) { res, err := ec.unmarshalInputSubjectWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v any) (time.Time, error) { res, err := graphql.UnmarshalTime(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { _ = sel res := graphql.MarshalTime(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } } return res } func (ec *executionContext) marshalNTimestamp2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestamp(ctx context.Context, sel ast.SelectionSet, v *ent.Timestamp) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec._Timestamp(ctx, sel, v) } func (ec *executionContext) unmarshalNTimestampWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampWhereInput(ctx context.Context, v any) (*ent.TimestampWhereInput, error) { res, err := ec.unmarshalInputTimestampWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { return ec.___Directive(ctx, sel, &v) } func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v any) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { _ = sel res := graphql.MarshalString(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } } return res } func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]string, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { return ec.___EnumValue(ctx, sel, &v) } func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { return ec.___Field(ctx, sel, &v) } func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { return ec.___InputValue(ctx, sel, &v) } func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { return ec.___Type(ctx, sel, &v) } func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } return ec.___Type(ctx, sel, v) } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v any) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { _ = sel res := graphql.MarshalString(v) if res == graphql.Null { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } } return res } func (ec *executionContext) marshalOAttestation2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Attestation) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalNAttestation2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestation(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalOAttestationCollection2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollection(ctx context.Context, sel ast.SelectionSet, v *ent.AttestationCollection) graphql.Marshaler { if v == nil { return graphql.Null } return ec._AttestationCollection(ctx, sel, v) } func (ec *executionContext) unmarshalOAttestationCollectionWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollectionWhereInputᚄ(ctx context.Context, v any) ([]*ent.AttestationCollectionWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.AttestationCollectionWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNAttestationCollectionWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollectionWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalOAttestationCollectionWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationCollectionWhereInput(ctx context.Context, v any) (*ent.AttestationCollectionWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputAttestationCollectionWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOAttestationPolicy2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicy(ctx context.Context, sel ast.SelectionSet, v *ent.AttestationPolicy) graphql.Marshaler { if v == nil { return graphql.Null } return ec._AttestationPolicy(ctx, sel, v) } func (ec *executionContext) marshalOAttestationPolicyEdge2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.AttestationPolicyEdge) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalOAttestationPolicyEdge2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyEdge(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() return ret } func (ec *executionContext) marshalOAttestationPolicyEdge2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyEdge(ctx context.Context, sel ast.SelectionSet, v *ent.AttestationPolicyEdge) graphql.Marshaler { if v == nil { return graphql.Null } return ec._AttestationPolicyEdge(ctx, sel, v) } func (ec *executionContext) unmarshalOAttestationPolicyWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyWhereInputᚄ(ctx context.Context, v any) ([]*ent.AttestationPolicyWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.AttestationPolicyWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNAttestationPolicyWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalOAttestationPolicyWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationPolicyWhereInput(ctx context.Context, v any) (*ent.AttestationPolicyWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputAttestationPolicyWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalOAttestationWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationWhereInputᚄ(ctx context.Context, v any) ([]*ent.AttestationWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.AttestationWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNAttestationWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalOAttestationWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐAttestationWhereInput(ctx context.Context, v any) (*ent.AttestationWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputAttestationWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v any) (bool, error) { res, err := graphql.UnmarshalBoolean(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { _ = sel _ = ctx res := graphql.MarshalBoolean(v) return res } func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v any) (*bool, error) { if v == nil { return nil, nil } res, err := graphql.UnmarshalBoolean(v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { if v == nil { return graphql.Null } _ = sel _ = ctx res := graphql.MarshalBoolean(*v) return res } func (ec *executionContext) unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, v any) (*entgql.Cursor[uuid.UUID], error) { if v == nil { return nil, nil } var res = new(entgql.Cursor[uuid.UUID]) err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor(ctx context.Context, sel ast.SelectionSet, v *entgql.Cursor[uuid.UUID]) graphql.Marshaler { if v == nil { return graphql.Null } return v } func (ec *executionContext) marshalODsse2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Dsse) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalNDsse2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsse(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalODsse2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsse(ctx context.Context, sel ast.SelectionSet, v *ent.Dsse) graphql.Marshaler { if v == nil { return graphql.Null } return ec._Dsse(ctx, sel, v) } func (ec *executionContext) marshalODsseEdge2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.DsseEdge) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalODsseEdge2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseEdge(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() return ret } func (ec *executionContext) marshalODsseEdge2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseEdge(ctx context.Context, sel ast.SelectionSet, v *ent.DsseEdge) graphql.Marshaler { if v == nil { return graphql.Null } return ec._DsseEdge(ctx, sel, v) } func (ec *executionContext) unmarshalODsseOrder2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseOrder(ctx context.Context, v any) (*ent.DsseOrder, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputDsseOrder(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalODsseWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInputᚄ(ctx context.Context, v any) ([]*ent.DsseWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.DsseWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNDsseWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalODsseWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐDsseWhereInput(ctx context.Context, v any) (*ent.DsseWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputDsseWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx context.Context, v any) ([]uuid.UUID, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]uuid.UUID, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) marshalOID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx context.Context, sel ast.SelectionSet, v []uuid.UUID) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) for i := range v { ret[i] = ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, sel, v[i]) } for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) unmarshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx context.Context, v any) (*uuid.UUID, error) { if v == nil { return nil, nil } res, err := uuidgql.UnmarshalUUID(v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx context.Context, sel ast.SelectionSet, v *uuid.UUID) graphql.Marshaler { if v == nil { return graphql.Null } _ = sel _ = ctx res := uuidgql.MarshalUUID(*v) return res } func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v any) (*int, error) { if v == nil { return nil, nil } res, err := graphql.UnmarshalInt(v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { if v == nil { return graphql.Null } _ = sel _ = ctx res := graphql.MarshalInt(*v) return res } func (ec *executionContext) marshalONode2githubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐNoder(ctx context.Context, sel ast.SelectionSet, v ent.Noder) graphql.Marshaler { if v == nil { return graphql.Null } return ec._Node(ctx, sel, v) } func (ec *executionContext) marshalOPayloadDigest2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.PayloadDigest) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalNPayloadDigest2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigest(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) unmarshalOPayloadDigestWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestWhereInputᚄ(ctx context.Context, v any) ([]*ent.PayloadDigestWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.PayloadDigestWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNPayloadDigestWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalOPayloadDigestWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐPayloadDigestWhereInput(ctx context.Context, v any) (*ent.PayloadDigestWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputPayloadDigestWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOSignature2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Signature) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalNSignature2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignature(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalOSignature2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignature(ctx context.Context, sel ast.SelectionSet, v *ent.Signature) graphql.Marshaler { if v == nil { return graphql.Null } return ec._Signature(ctx, sel, v) } func (ec *executionContext) unmarshalOSignatureWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureWhereInputᚄ(ctx context.Context, v any) ([]*ent.SignatureWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.SignatureWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNSignatureWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalOSignatureWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSignatureWhereInput(ctx context.Context, v any) (*ent.SignatureWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputSignatureWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOStatement2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatement(ctx context.Context, sel ast.SelectionSet, v *ent.Statement) graphql.Marshaler { if v == nil { return graphql.Null } return ec._Statement(ctx, sel, v) } func (ec *executionContext) unmarshalOStatementWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInputᚄ(ctx context.Context, v any) ([]*ent.StatementWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.StatementWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNStatementWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalOStatementWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐStatementWhereInput(ctx context.Context, v any) (*ent.StatementWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputStatementWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v any) ([]string, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]string, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) for i := range v { ret[i] = ec.marshalNString2string(ctx, sel, v[i]) } for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v any) (*string, error) { if v == nil { return nil, nil } res, err := graphql.UnmarshalString(v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { if v == nil { return graphql.Null } _ = sel _ = ctx res := graphql.MarshalString(*v) return res } func (ec *executionContext) marshalOSubject2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubject(ctx context.Context, sel ast.SelectionSet, v *ent.Subject) graphql.Marshaler { if v == nil { return graphql.Null } return ec._Subject(ctx, sel, v) } func (ec *executionContext) marshalOSubjectDigest2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.SubjectDigest) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalNSubjectDigest2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigest(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) unmarshalOSubjectDigestWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestWhereInputᚄ(ctx context.Context, v any) ([]*ent.SubjectDigestWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.SubjectDigestWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNSubjectDigestWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalOSubjectDigestWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectDigestWhereInput(ctx context.Context, v any) (*ent.SubjectDigestWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputSubjectDigestWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOSubjectEdge2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectEdge(ctx context.Context, sel ast.SelectionSet, v []*ent.SubjectEdge) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalOSubjectEdge2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectEdge(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() return ret } func (ec *executionContext) marshalOSubjectEdge2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectEdge(ctx context.Context, sel ast.SelectionSet, v *ent.SubjectEdge) graphql.Marshaler { if v == nil { return graphql.Null } return ec._SubjectEdge(ctx, sel, v) } func (ec *executionContext) unmarshalOSubjectOrder2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectOrder(ctx context.Context, v any) (*ent.SubjectOrder, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputSubjectOrder(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalOSubjectWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInputᚄ(ctx context.Context, v any) ([]*ent.SubjectWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.SubjectWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNSubjectWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalOSubjectWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐSubjectWhereInput(ctx context.Context, v any) (*ent.SubjectWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputSubjectWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx context.Context, v any) ([]time.Time, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]time.Time, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNTime2timeᚐTime(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) marshalOTime2ᚕtimeᚐTimeᚄ(ctx context.Context, sel ast.SelectionSet, v []time.Time) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) for i := range v { ret[i] = ec.marshalNTime2timeᚐTime(ctx, sel, v[i]) } for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) unmarshalOTime2ᚖtimeᚐTime(ctx context.Context, v any) (*time.Time, error) { if v == nil { return nil, nil } res, err := graphql.UnmarshalTime(v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalOTime2ᚖtimeᚐTime(ctx context.Context, sel ast.SelectionSet, v *time.Time) graphql.Marshaler { if v == nil { return graphql.Null } _ = sel _ = ctx res := graphql.MarshalTime(*v) return res } func (ec *executionContext) marshalOTimestamp2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Timestamp) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalNTimestamp2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestamp(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) unmarshalOTimestampWhereInput2ᚕᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampWhereInputᚄ(ctx context.Context, v any) ([]*ent.TimestampWhereInput, error) { if v == nil { return nil, nil } var vSlice []any vSlice = graphql.CoerceList(v) var err error res := make([]*ent.TimestampWhereInput, len(vSlice)) for i := range vSlice { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) res[i], err = ec.unmarshalNTimestampWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampWhereInput(ctx, vSlice[i]) if err != nil { return nil, err } } return res, nil } func (ec *executionContext) unmarshalOTimestampWhereInput2ᚖgithubᚗcomᚋinᚑtotoᚋarchivistaᚋentᚐTimestampWhereInput(ctx context.Context, v any) (*ent.TimestampWhereInput, error) { if v == nil { return nil, nil } res, err := ec.unmarshalInputTimestampWhereInput(ctx, v) return &res, graphql.ErrorOnPath(ctx, err) } func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { if v == nil { return graphql.Null } return ec.___Schema(ctx, sel, v) } func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { if v == nil { return graphql.Null } ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 if !isLen1 { wg.Add(len(v)) } for i := range v { i := i fc := &graphql.FieldContext{ Index: &i, Result: &v[i], } ctx := graphql.WithFieldContext(ctx, fc) f := func(i int) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) ret = nil } }() if !isLen1 { defer wg.Done() } ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) } if isLen1 { f(i) } else { go f(i) } } wg.Wait() for _, e := range ret { if e == graphql.Null { return graphql.Null } } return ret } func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { if v == nil { return graphql.Null } return ec.___Type(ctx, sel, v) } // endregion ***************************** type.gotpl ***************************** golang-github-in-toto-archivista-0.11.1/go.mod000066400000000000000000000166451511066247200211710ustar00rootroot00000000000000module github.com/in-toto/archivista go 1.24.0 toolchain go1.24.2 require ( ariga.io/sqlcomment v0.1.0 entgo.io/contrib v0.7.0 entgo.io/ent v0.14.5 github.com/99designs/gqlgen v0.17.81 github.com/antonfisher/nested-logrus-formatter v1.3.1 github.com/aws/aws-sdk-go-v2 v1.39.4 github.com/aws/aws-sdk-go-v2/config v1.31.15 github.com/aws/aws-sdk-go-v2/feature/rds/auth v1.6.11 github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7 github.com/edwarnicke/gitoid v0.0.0-20220710194850-1be5bfda1f9d github.com/go-sql-driver/mysql v1.9.3 github.com/google/uuid v1.6.0 github.com/gorilla/handlers v1.5.2 github.com/gorilla/mux v1.8.1 github.com/hashicorp/go-multierror v1.1.1 github.com/in-toto/go-witness v0.9.1 github.com/jackc/pgx/v5 v5.7.6 github.com/jkjell/go-db-credential-refresh/store/awsrds v0.0.0-20251027212758-4cea655064ca github.com/kelseyhightower/envconfig v1.4.0 github.com/lib/pq v1.10.9 github.com/minio/minio-go/v7 v7.0.95 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.10.1 github.com/stretchr/testify v1.11.1 github.com/swaggo/http-swagger/v2 v2.0.2 github.com/swaggo/swag v1.16.6 github.com/vektah/gqlparser/v2 v2.5.30 gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.14.3 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgproto3/v2 v2.3.3 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgtype v1.14.4 // indirect github.com/jackc/pgx/v4 v4.18.3 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect ) require ( ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect github.com/KyleBanks/depth v1.2.1 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/agnivade/levenshtein v1.2.1 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/aws/aws-sdk-go-v2/credentials v1.18.19 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.11 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.11 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.11 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.2 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.11 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.29.8 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.3 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.38.9 // indirect github.com/aws/smithy-go v1.23.1 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar v1.3.4 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-ini/ini v1.67.0 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/inflect v0.21.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/spec v0.21.0 // indirect github.com/go-openapi/swag v0.23.1 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.5 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/gorilla/websocket v1.5.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl/v2 v2.20.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/invopop/jsonschema v0.12.0 // indirect github.com/jkjell/go-db-credential-refresh v1.2.2 github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/cpuid/v2 v2.2.11 // indirect github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-sqlite3 v1.14.24 // indirect github.com/miekg/dns v1.1.58 // indirect github.com/minio/crc64nvme v1.0.2 // indirect github.com/minio/md5-simd v1.1.2 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/open-policy-agent/opa v1.4.2 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.22.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.62.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.13.2-0.20241226121412-a5dc8ff20d0a // indirect github.com/rs/xid v1.6.0 // indirect github.com/sigstore/fulcio v1.6.6 // indirect github.com/sosodev/duration v1.3.1 // indirect github.com/spf13/pflag v1.0.9 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/swaggo/files/v2 v2.0.0 // indirect github.com/tchap/go-patricia/v2 v2.3.2 // indirect github.com/tinylib/msgp v1.3.0 // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/yashtewari/glob-intersection v0.2.0 // indirect github.com/zclconf/go-cty v1.14.4 // indirect github.com/zclconf/go-cty-yaml v1.1.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/otel v1.36.0 // indirect go.opentelemetry.io/otel/metric v1.36.0 // indirect go.opentelemetry.io/otel/sdk v1.36.0 // indirect go.opentelemetry.io/otel/trace v1.36.0 // indirect go.step.sm/crypto v0.61.0 // indirect golang.org/x/crypto v0.42.0 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect golang.org/x/mod v0.28.0 // indirect golang.org/x/net v0.44.0 // indirect golang.org/x/sync v0.17.0 // indirect golang.org/x/sys v0.36.0 // indirect golang.org/x/text v0.29.0 // indirect golang.org/x/tools v0.37.0 // indirect google.golang.org/protobuf v1.36.10 // indirect gopkg.in/inf.v0 v0.9.1 // indirect k8s.io/apimachinery v0.30.14 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) golang-github-in-toto-archivista-0.11.1/go.sum000066400000000000000000001747141511066247200212200ustar00rootroot00000000000000ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9 h1:E0wvcUXTkgyN4wy4LGtNzMNGMytJN8afmIWXJVMi4cc= ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9/go.mod h1:Oe1xWPuu5q9LzyrWfbZmEZxFYeu4BHTyzfjeW2aZp/w= ariga.io/sqlcomment v0.1.0 h1:8kQPlVe3sXpTloEFlpX5dhFAXB28i6rwq9ktqqnPx70= ariga.io/sqlcomment v0.1.0/go.mod h1:NT1IZMfBTQl1MUU5wgVONmnDqFRqtZrdDRgAXfc1g5k= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= entgo.io/contrib v0.7.0 h1:4Ghx8O0rqSMmca3FIJ6QyZbQAoLvdzWqLMl1MbHFEEw= entgo.io/contrib v0.7.0/go.mod h1:zbPSUrbn+6dfyv8S9HWEvn1MyGpO95ik2lUNgaqWTt4= entgo.io/ent v0.14.5 h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4= entgo.io/ent v0.14.5/go.mod h1:zTzLmWtPvGpmSwtkaayM2cm5m819NdM7z7tYPq3vN0U= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/gqlgen v0.17.81 h1:kCkN/xVyRb5rEQpuwOHRTYq83i0IuTQg9vdIiwEerTs= github.com/99designs/gqlgen v0.17.81/go.mod h1:vgNcZlLwemsUhYim4dC1pvFP5FX0pr2Y+uYUoHFb1ig= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4= github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/ProtonMail/go-crypto v1.1.5 h1:eoAQfK2dwL+tFSFpr7TbOaPNUbPiJj4fLYwwGE1FQO4= github.com/ProtonMail/go-crypto v1.1.5/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo= github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= github.com/antonfisher/nested-logrus-formatter v1.3.1 h1:NFJIr+pzwv5QLHTPyKz9UMEoHck02Q9L0FP13b/xSbQ= github.com/antonfisher/nested-logrus-formatter v1.3.1/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/aws/aws-sdk-go-v2 v1.39.4 h1:qTsQKcdQPHnfGYBBs+Btl8QwxJeoWcOcPcixK90mRhg= github.com/aws/aws-sdk-go-v2 v1.39.4/go.mod h1:yWSxrnioGUZ4WVv9TgMrNUeLV3PFESn/v+6T/Su8gnM= github.com/aws/aws-sdk-go-v2/config v1.31.15 h1:gE3M4xuNXfC/9bG4hyowGm/35uQTi7bUKeYs5e/6uvU= github.com/aws/aws-sdk-go-v2/config v1.31.15/go.mod h1:HvnvGJoE2I95KAIW8kkWVPJ4XhdrlvwJpV6pEzFQa8o= github.com/aws/aws-sdk-go-v2/credentials v1.18.19 h1:Jc1zzwkSY1QbkEcLujwqRTXOdvW8ppND3jRBb/VhBQc= github.com/aws/aws-sdk-go-v2/credentials v1.18.19/go.mod h1:DIfQ9fAk5H0pGtnqfqkbSIzky82qYnGvh06ASQXXg6A= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.11 h1:X7X4YKb+c0rkI6d4uJ5tEMxXgCZ+jZ/D6mvkno8c8Uw= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.11/go.mod h1:EqM6vPZQsZHYvC4Cai35UDg/f5NCEU+vp0WfbVqVcZc= github.com/aws/aws-sdk-go-v2/feature/rds/auth v1.6.11 h1:JQ+ZgIMTg7FExJaijXZnIx1Gixu4KS0X/3erXOq7M6w= github.com/aws/aws-sdk-go-v2/feature/rds/auth v1.6.11/go.mod h1:jiQxVP2JDLduIuLpaDqMLPcJRp0UWnDBsTjkVabNaE8= github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.11 h1:7AANQZkF3ihM8fbdftpjhken0TP9sBzFbV/Ze/Y4HXA= github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.11/go.mod h1:NTF4QCGkm6fzVwncpkFQqoquQyOolcyXfbpC98urj+c= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.11 h1:ShdtWUZT37LCAA4Mw2kJAJtzaszfSHFb5n25sdcv4YE= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.11/go.mod h1:7bUb2sSr2MZ3M/N+VyETLTQtInemHXb/Fl3s8CLzm0Y= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.2 h1:xtuxji5CS0JknaXoACOunXOYOQzgfTvGAc9s2QdCJA4= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.2/go.mod h1:zxwi0DIR0rcRcgdbl7E2MSOvxDyyXGBlScvBkARFaLQ= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.11 h1:GpMf3z2KJa4RnJ0ew3Hac+hRFYLZ9DDjfgXjuW+pB54= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.11/go.mod h1:6MZP3ZI4QQsgUCFTwMZA2V0sEriNQ8k2hmoHF3qjimQ= github.com/aws/aws-sdk-go-v2/service/kms v1.38.3 h1:RivOtUH3eEu6SWnUMFHKAW4MqDOzWn1vGQ3S38Y5QMg= github.com/aws/aws-sdk-go-v2/service/kms v1.38.3/go.mod h1:cQn6tAF77Di6m4huxovNM7NVAozWTZLsDRp9t8Z/WYk= github.com/aws/aws-sdk-go-v2/service/sso v1.29.8 h1:M5nimZmugcZUO9wG7iVtROxPhiqyZX6ejS1lxlDPbTU= github.com/aws/aws-sdk-go-v2/service/sso v1.29.8/go.mod h1:mbef/pgKhtKRwrigPPs7SSSKZgytzP8PQ6P6JAAdqyM= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.3 h1:S5GuJZpYxE0lKeMHKn+BRTz6PTFpgThyJ+5mYfux7BM= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.3/go.mod h1:X4OF+BTd7HIb3L+tc4UlWHVrpgwZZIVENU15pRDVTI0= github.com/aws/aws-sdk-go-v2/service/sts v1.38.9 h1:Ekml5vGg6sHSZLZJQJagefnVe6PmqC2oiRkBq4F7fU0= github.com/aws/aws-sdk-go-v2/service/sts v1.38.9/go.mod h1:/e15V+o1zFHWdH3u7lpI3rVBcxszktIKuHKCY2/py+k= github.com/aws/smithy-go v1.23.1 h1:sLvcH6dfAFwGkHLZ7dGiYF7aK6mg4CgKA/iDKjLDt9M= github.com/aws/smithy-go v1.23.1/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0= github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/bytecodealliance/wasmtime-go/v3 v3.0.2 h1:3uZCA/BLTIu+DqCfguByNMJa2HVHpXvjfy0Dy7g6fuA= github.com/bytecodealliance/wasmtime-go/v3 v3.0.2/go.mod h1:RnUjnIXxEJcL6BgCvNyzCCRzZcxCgsZCi+RNlvYor5Q= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/cyphar/filepath-securejoin v0.3.6 h1:4d9N5ykBnSp5Xn2JkhocYDkOpURL/18CYMpo6xB9uWM= github.com/cyphar/filepath-securejoin v0.3.6/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgraph-io/badger/v4 v4.7.0 h1:Q+J8HApYAY7UMpL8d9owqiB+odzEc0zn/aqOD9jhc6Y= github.com/dgraph-io/badger/v4 v4.7.0/go.mod h1:He7TzG3YBy3j4f5baj5B7Zl2XyfNe5bl4Udl0aPemVA= github.com/dgraph-io/ristretto/v2 v2.2.0 h1:bkY3XzJcXoMuELV8F+vS8kzNgicwQFAaGINAEJdWGOM= github.com/dgraph-io/ristretto/v2 v2.2.0/go.mod h1:RZrm63UmcBAaYWC1DotLYBmTvgkrs0+XhBd7Npn7/zI= github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7cNTs5R6Hk4V2lcmLz2NsG2VnInyNo= github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/digitorus/pkcs7 v0.0.0-20230713084857-e76b763bdc49/go.mod h1:SKVExuS+vpu2l9IoOc0RwqE7NYnb0JlcFHFnEJkVDzc= github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 h1:ge14PCmCvPjpMQMIAH7uKg0lrtNSOdpYsRXlwk3QbaE= github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352/go.mod h1:SKVExuS+vpu2l9IoOc0RwqE7NYnb0JlcFHFnEJkVDzc= github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7 h1:lxmTCgmHE1GUYL7P0MlNa00M67axePTq+9nBSGddR8I= github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7/go.mod h1:GvWntX9qiTlOud0WkQ6ewFm0LPy5JUR1Xo0Ngbd1w6Y= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/edwarnicke/gitoid v0.0.0-20220710194850-1be5bfda1f9d h1:4l+Uq5zFWSagXgGFaKRRVWJrnlzeathyagWgYUltCgY= github.com/edwarnicke/gitoid v0.0.0-20220710194850-1be5bfda1f9d/go.mod h1:WxWwA3EYuCQjlR5EBUX3uaTS8bh9BOa7BcqVREHQ0uQ= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= 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/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/foxcpp/go-mockdns v1.1.0 h1:jI0rD8M0wuYAxL7r/ynTrCQQq0BVqfB99Vgk7DlmewI= github.com/foxcpp/go-mockdns v1.1.0/go.mod h1:IhLeSFGed3mJIAXPH2aiRQB+kqz7oqu8ld2qVbOu7Wk= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM= github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU= github.com/go-git/go-git/v5 v5.13.2 h1:7O7xvsK7K+rZPKW6AQR1YyNhfywkv7B8/FsP3ki6Zv0= github.com/go-git/go-git/v5 v5.13.2/go.mod h1:hWdW5P4YZRjmpGHwRH2v3zkWcNl6HeXaXQEMGb3NJ9A= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/inflect v0.21.0 h1:FoBjBTQEcbg2cJUWX6uwL9OyIW8eqc9k4KhN4lfbeYk= github.com/go-openapi/inflect v0.21.0/go.mod h1:INezMuUu7SJQc2AyR3WO0DqqYUJSj8Kb4hBd7WtjlAw= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU= github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0= github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= 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/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 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.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/google/flatbuffers v25.2.10+incompatible h1:F3vclr7C3HpB1k9mxCGRMXq6FdUalZ6H/pNX4FP1v0Q= github.com/google/flatbuffers v25.2.10+incompatible/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.5.0/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.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 h1:e9Rjr40Z98/clHv5Yg79Is0NtosR5LXRvdr7o/6NwbA= github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1/go.mod h1:tIxuGz/9mpox++sgp9fJjHO0+q1X9/UOWd798aAm22M= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl/v2 v2.20.1 h1:M6hgdyz7HYt1UN9e61j+qKJBqR3orTWbI1HKBJEdxtc= github.com/hashicorp/hcl/v2 v2.20.1/go.mod h1:TZDqQ4kNKCbh1iJp99FdPiUaVDDUPivbqxZulxDYqL4= github.com/in-toto/go-witness v0.9.1 h1:tT14ysHhnTcMLjLsp9k6GNGyKxfmr0WmTrJKREnhVGE= github.com/in-toto/go-witness v0.9.1/go.mod h1:9baHJG15esrfao4R3J42mWhQf3yMeKUeioCdQM+i9ek= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI= github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= github.com/jackc/pgconn v1.14.3 h1:bVoTr12EGANZz66nZPkMInAV/KHD2TxH9npjXXgiB3w= github.com/jackc/pgconn v1.14.3/go.mod h1:RZbme4uasqzybK2RK5c65VsHxoyaml09lx3tXOcO/VM= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag= github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= github.com/jackc/pgtype v1.14.4 h1:fKuNiCumbKTAIxQwXfB/nsrnkEI6bPJrrSiMKgbJ2j8= github.com/jackc/pgtype v1.14.4/go.mod h1:aKeozOde08iifGosdJpz9MBZonJOUJxqNpPBcMJTlVA= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= github.com/jackc/pgx/v4 v4.18.3 h1:dE2/TrEsGX3RBprb3qryqSV9Y60iZN1C6i8IrmW9/BA= github.com/jackc/pgx/v4 v4.18.3/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= github.com/jackc/pgx/v5 v5.7.6 h1:rWQc5FwZSPX58r1OQmkuaNicxdmExaEz5A2DO2hUuTk= github.com/jackc/pgx/v5 v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jellydator/ttlcache/v3 v3.3.0 h1:BdoC9cE81qXfrxeb9eoJi9dWrdhSuwXMAnHTbnBm4Wc= github.com/jellydator/ttlcache/v3 v3.3.0/go.mod h1:bj2/e0l4jRnQdrnSTaGTsh4GSXvMjQcy41i7th0GVGw= github.com/jkjell/go-db-credential-refresh v1.2.2 h1:pk4gjDvEYBsDmCBhCWGNF3D+QCByeClH4jurhCilMuk= github.com/jkjell/go-db-credential-refresh v1.2.2/go.mod h1:9sHagl37WUfJlfLZDmaw5D9yzrOspOebuxQDmzVqzGc= github.com/jkjell/go-db-credential-refresh/store/awsrds v0.0.0-20251027212758-4cea655064ca h1:lq/UvCF6pBL1rl1on2+hqjeSyA7zWkIt/oXkNOGRA4g= github.com/jkjell/go-db-credential-refresh/store/awsrds v0.0.0-20251027212758-4cea655064ca/go.mod h1:zFmVv4ode7R/Y3+DLaCQ42RT1BQ5Hf4yulJZw7KuuQk= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= 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/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU= github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4= github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPkBY= github.com/minio/crc64nvme v1.0.2 h1:6uO1UxGAD+kwqWWp7mBFsi5gAse66C4NXO8cmcVculg= github.com/minio/crc64nvme v1.0.2/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.0.95 h1:ywOUPg+PebTMTzn9VDsoFJy32ZuARN9zhB+K3IYEvYU= github.com/minio/minio-go/v7 v7.0.95/go.mod h1:wOOX3uxS334vImCNRVyIDdXX9OsXDm89ToynKgqUKlo= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c h1:cqn374mizHuIWj+OSJCajGr/phAmuMug9qIX3l9CflE= github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/open-policy-agent/opa v1.4.2 h1:ag4upP7zMsa4WE2p1pwAFeG4Pn3mNwfAx9DLhhJfbjU= github.com/open-policy-agent/opa v1.4.2/go.mod h1:DNzZPKqKh4U0n0ANxcCVlw8lCSv2c+h5G/3QvSYdWZ8= github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4= github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io= github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.13.2-0.20241226121412-a5dc8ff20d0a h1:w3tdWGKbLGBPtR/8/oO74W6hmz0qE5q0z9aqSAewaaM= github.com/rogpeppe/go-internal v1.13.2-0.20241226121412-a5dc8ff20d0a/go.mod h1:S8kfXMp+yh77OxPD4fdM6YUknrZpQxLhvxzS4gDHENY= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/sigstore/fulcio v1.6.6 h1:XaMYX6TNT+8n7Npe8D94nyZ7/ERjEsNGFC+REdi/wzw= github.com/sigstore/fulcio v1.6.6/go.mod h1:BhQ22lwaebDgIxVBEYOOqLRcN5+xOV+C9bh/GUXRhOk= 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.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY= github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M= github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.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.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/swaggo/files/v2 v2.0.0 h1:hmAt8Dkynw7Ssz46F6pn8ok6YmGZqHSVLZ+HQM7i0kw= github.com/swaggo/files/v2 v2.0.0/go.mod h1:24kk2Y9NYEJ5lHuCra6iVwkMjIekMCaFq/0JQj66kyM= github.com/swaggo/http-swagger/v2 v2.0.2 h1:FKCdLsl+sFCx60KFsyM0rDarwiUSZ8DqbfSyIKC9OBg= github.com/swaggo/http-swagger/v2 v2.0.2/go.mod h1:r7/GBkAWIfK6E/OLnE8fXnviHiDeAHmgIyooa4xm3AQ= github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI= github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg= github.com/tchap/go-patricia/v2 v2.3.2 h1:xTHFutuitO2zqKAQ5rCROYgUb7Or/+IC3fts9/Yc7nM= github.com/tchap/go-patricia/v2 v2.3.2/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k= github.com/tinylib/msgp v1.3.0 h1:ULuf7GPooDaIlbyvgAxBV/FI7ynli6LZ1/nVUNu+0ww= github.com/tinylib/msgp v1.3.0/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0= github.com/vektah/gqlparser/v2 v2.5.30 h1:EqLwGAFLIzt1wpx1IPpY67DwUujF1OfzgEyDsLrN6kE= github.com/vektah/gqlparser/v2 v2.5.30/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo= github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= 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/yashtewari/glob-intersection v0.2.0 h1:8iuHdN88yYuCzCdjt0gDe+6bAhUwBeEWqThExu54RFg= github.com/yashtewari/glob-intersection v0.2.0/go.mod h1:LK7pIC3piUjovexikBbJ26Yml7g8xa5bsjfx2v1fwok= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY34Wul7O/MSKey3txpPYyCqVO5ZyceuQJEI= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= github.com/zclconf/go-cty-yaml v1.1.0 h1:nP+jp0qPHv2IhUVqmQSzjvqAWcObN0KBkUl2rWBdig0= github.com/zclconf/go-cty-yaml v1.1.0/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg= go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0fikVry1IsiUnXjf7QFvoNN3Xw= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 h1:m639+BofXTvcY1q8CGs4ItwQarYtJPOWmVobfM1HpVI= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0/go.mod h1:LjReUci/F4BUyv+y4dwnq3h/26iNOeC3wAIqgvTIZVo= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 h1:xJ2qHD0C1BeYVTLLR9sX12+Qb95kfeD/byKj6Ky1pXg= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0/go.mod h1:u5BF1xyjstDowA1R5QAO9JHzqK+ublenEW/dyqTjBVk= go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE= go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs= go.opentelemetry.io/otel/sdk v1.36.0 h1:b6SYIuLRs88ztox4EyrvRti80uXIFy+Sqzoh9kFULbs= go.opentelemetry.io/otel/sdk v1.36.0/go.mod h1:+lC+mTgD+MUWfjJubi2vvXWcVxyr9rmlshZni72pXeY= go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w= go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA= go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= go.step.sm/crypto v0.61.0 h1:rW7He7LCzhOFn9JIf/XzgTjt4Djpf1KhdXHfbXUVFpY= go.step.sm/crypto v0.61.0/go.mod h1:rYubsWIX9j9xzi/aXXr2eFSzoTN3sklTAxJYucBqZaY= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI= golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/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.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/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U= golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/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-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/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-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 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-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-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ= golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/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-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-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE= golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb h1:ITgPrl429bc6+2ZraNSzMDk3I95nmQln2fuPstKwFDE= google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e h1:UdXH7Kzbj+Vzastr5nVfccbmFsmYNygVLSPk1pEfDoY= google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e/go.mod h1:085qFyf2+XaZlRdCgKNCIZ3afY2p4HHZdoIRpId8F4A= google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e h1:ztQaXfzEXTmCBvbtWYRhJxW+0iJcz2qXfd38/e9l7bA= google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.71.3 h1:iEhneYTxOruJyZAxdAv8Y0iRZvsc5M6KoW7UA0/7jn0= google.golang.org/grpc v1.71.3/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= 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.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/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= k8s.io/apimachinery v0.30.14 h1:2OvEYwWoWeb25+xzFGP/8gChu+MfRNv24BlCQdnfGzQ= k8s.io/apimachinery v0.30.14/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= golang-github-in-toto-archivista-0.11.1/gqlgen.yml000066400000000000000000000025771511066247200220620ustar00rootroot00000000000000# Copyright 2022 The Archivista Contributors # # 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. schema: - archivista.graphql - ent.graphql resolver: # Tell gqlgen to generate resolvers next to the schema file. layout: follow-schema dir: . # gqlgen will search for any type names in the schema in the generated # ent package. If they match it will use them, otherwise it will new ones. autobind: - github.com/in-toto/archivista/ent models: ID: model: - github.com/in-toto/archivista/ent/schema/uuidgql.UUID Uint64: model: - github.com/99designs/gqlgen/graphql.Uint64 UUID: model: - github.com/in-toto/archivista/ent/schema/uuidgql.UUID # Node: # model: # # ent.Noder is the new interface generated by the Node template. # - github.com/in-toto/archivista/ent.Noder # Subject: # model: # - github.com/in-toto/archivista/ent.Subject golang-github-in-toto-archivista-0.11.1/pkg/000077500000000000000000000000001511066247200206305ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/api/000077500000000000000000000000001511066247200214015ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/api/download.go000066400000000000000000000063151511066247200235440ustar00rootroot00000000000000// Copyright 2023-2024 The Archivista Contributors // // 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. package api import ( "bytes" "context" "encoding/json" "errors" "io" "net/http" "net/url" "github.com/in-toto/go-witness/dsse" ) func DownloadReadCloser(ctx context.Context, baseURL string, gitoid string, requestOptions ...RequestOption) (io.ReadCloser, error) { return DownloadReadCloserWithHTTPClient(ctx, &http.Client{}, baseURL, gitoid, requestOptions...) } func DownloadReadCloserWithHTTPClient(ctx context.Context, client *http.Client, baseURL string, gitoid string, requestOptions ...RequestOption) (io.ReadCloser, error) { downloadURL, err := url.JoinPath(baseURL, "download", gitoid) if err != nil { return nil, err } req, err := http.NewRequestWithContext(ctx, http.MethodGet, downloadURL, nil) if err != nil { return nil, err } req = applyRequestOptions(req, requestOptions...) req.Header.Set("Content-Type", "application/json") resp, err := client.Do(req) if err != nil { return nil, err } if resp.StatusCode != http.StatusOK { // NOTE: attempt to read body on error and // only close if an error occurs defer resp.Body.Close() errMsg, err := io.ReadAll(resp.Body) if err != nil { return nil, err } return nil, errors.New(string(errMsg)) } return resp.Body, nil } func Download(ctx context.Context, baseURL string, gitoid string, requestOptions ...RequestOption) (dsse.Envelope, error) { buf := &bytes.Buffer{} if err := DownloadWithWriter(ctx, baseURL, gitoid, buf, requestOptions...); err != nil { return dsse.Envelope{}, err } env := dsse.Envelope{} dec := json.NewDecoder(buf) if err := dec.Decode(&env); err != nil { return env, err } return env, nil } func DownloadWithWriter(ctx context.Context, baseURL string, gitoid string, dst io.Writer, requestOptions ...RequestOption) error { return DownloadWithWriterWithHTTPClient(ctx, &http.Client{}, baseURL, gitoid, dst, requestOptions...) } func DownloadWithWriterWithHTTPClient(ctx context.Context, client *http.Client, baseURL string, gitoid string, dst io.Writer, requestOptions ...RequestOption) error { downloadUrl, err := url.JoinPath(baseURL, "download", gitoid) if err != nil { return err } req, err := http.NewRequestWithContext(ctx, http.MethodGet, downloadUrl, nil) if err != nil { return err } req = applyRequestOptions(req, requestOptions...) req.Header.Set("Content-Type", "application/json") hc := &http.Client{} resp, err := hc.Do(req) if err != nil { return err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { errMsg, err := io.ReadAll(resp.Body) if err != nil { return err } return errors.New(string(errMsg)) } _, err = io.Copy(dst, resp.Body) return err } golang-github-in-toto-archivista-0.11.1/pkg/api/download_test.go000066400000000000000000000076161511066247200246100ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package api_test import ( "context" "encoding/json" "io" "net/http" "net/http/httptest" "os" "path" "testing" "github.com/in-toto/archivista/pkg/api" "github.com/in-toto/go-witness/dsse" "github.com/stretchr/testify/suite" ) // Test Suite: UT APIDownload type UTAPIDownloadSuite struct { suite.Suite } func TestAPIDownloadSuite(t *testing.T) { suite.Run(t, new(UTAPIDownloadSuite)) } func (ut *UTAPIDownloadSuite) Test_Download() { testEnvelope, err := os.ReadFile("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } expectedEnvelop := dsse.Envelope{} err = json.Unmarshal(testEnvelope, &expectedEnvelop) if err != nil { ut.FailNow(err.Error()) } testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err = w.Write(testEnvelope) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() // test api.Download happy flow resp, err := api.Download(ctx, testServer.URL, "gitoid_test") if err != nil { ut.FailNow(err.Error()) } ut.Equal(expectedEnvelop, resp) } func (ut *UTAPIDownloadSuite) Test_Download_DecodeFailure() { testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`invalid`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() // test api.Download happy flow resp, err := api.Download(ctx, testServer.URL, "gitoid_test") ut.Error(err) ut.Equal(dsse.Envelope{}, resp) } func (ut *UTAPIDownloadSuite) Test_DownloadWithReader() { // mock server expected := `{"body":"body"}` testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(expected)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() // context ctx := context.TODO() // temporary file tempDir := os.TempDir() dst, err := os.Create(path.Join(tempDir, "test")) if err != nil { ut.FailNow(err.Error()) } err = api.DownloadWithWriter(ctx, testServer.URL, "gitoid", dst) if err != nil { ut.FailNow(err.Error()) } // validate result result, err := os.ReadFile(path.Join(tempDir, "test")) if err != nil { ut.FailNow(err.Error()) } ut.Equal(expected, string(result)) } func (ut *UTAPIDownloadSuite) Test_DownloadWithWriter_NoServer() { // context ctx := context.TODO() // dst as stdout var dst io.Writer = os.Stdout err := api.DownloadWithWriter(ctx, "http://invalid-archivista", "gitoid_test", dst) ut.Error(err) } func (ut *UTAPIDownloadSuite) Test_DownloadWithWriter_BadStatusCode() { // mock server testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusInternalServerError) _, err := w.Write([]byte(`Internal Server Error`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() // dst as stdout var dst io.Writer = os.Stdout // context ctx := context.TODO() err := api.DownloadWithWriter(ctx, testServer.URL, "gitoid_test", dst) ut.ErrorContains(err, "Internal Server Error") } golang-github-in-toto-archivista-0.11.1/pkg/api/graphql.go000066400000000000000000000062251511066247200233730ustar00rootroot00000000000000// Copyright 2023-2024 The Archivista Contributors // // 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. package api import ( "bytes" "context" "encoding/json" "errors" "fmt" "io" "net/http" "net/url" ) const RetrieveSubjectsQuery = `query($gitoid: String!) { subjects( where: { hasStatementWith:{ hasDsseWith:{ gitoidSha256: $gitoid } } } ) { edges { node{ name subjectDigests{ algorithm value } } } } }` const SearchQuery = `query($algo: String!, $digest: String!) { dsses( where: { hasStatementWith: { hasSubjectsWith: { hasSubjectDigestsWith: { value: $digest, algorithm: $algo } } } } ) { edges { node { gitoidSha256 statement { attestationCollections { name attestations { type } } } } } } }` func GraphQlQuery[TRes any, TVars any](ctx context.Context, baseUrl, query string, vars TVars, requestOptions ...RequestOption) (TRes, error) { var response TRes queryUrl, err := url.JoinPath(baseUrl, "query") if err != nil { return response, err } requestBody := GraphQLRequestBodyGeneric[TVars]{ Query: query, Variables: vars, } reqBody, err := json.Marshal(requestBody) if err != nil { return response, err } req, err := http.NewRequestWithContext(ctx, http.MethodPost, queryUrl, bytes.NewReader(reqBody)) if err != nil { return response, err } req = applyRequestOptions(req, requestOptions...) req.Header.Set("Content-Type", "application/json") hc := &http.Client{} res, err := hc.Do(req) if err != nil { return response, err } defer res.Body.Close() if res.StatusCode != http.StatusOK { errMsg, err := io.ReadAll(res.Body) if err != nil { return response, err } return response, errors.New(string(errMsg)) } dec := json.NewDecoder(res.Body) gqlRes := GraphQLResponseGeneric[TRes]{} if err := dec.Decode(&gqlRes); err != nil { return response, err } if len(gqlRes.Errors) > 0 { return response, fmt.Errorf("graph ql query failed: %v", gqlRes.Errors) } return gqlRes.Data, nil } // Deprecated: Use GraphQlQuery with the WithHeaders RequestOption func GraphQlQueryWithHeaders[TRes any, TVars any](ctx context.Context, baseUrl, query string, vars TVars, headers map[string]string, requestOptions ...RequestOption) (TRes, error) { h := http.Header{} for k, v := range headers { h.Set(k, v) } requestOptions = append(requestOptions, WithHeaders(h)) return GraphQlQuery[TRes](ctx, baseUrl, query, vars, requestOptions...) } golang-github-in-toto-archivista-0.11.1/pkg/api/graphql_test.go000066400000000000000000000100231511066247200244210ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package api_test import ( "context" "net/http" "net/http/httptest" "testing" "github.com/in-toto/archivista/pkg/api" "github.com/stretchr/testify/suite" ) // Test Suite: UT APIStore type UTAPIGraphQLSuite struct { suite.Suite } func TestAPIGraphQLSuite(t *testing.T) { suite.Run(t, new(UTAPIGraphQLSuite)) } func (ut *UTAPIGraphQLSuite) Test_Store() { testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`{"data": {"data": "test"}}`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() type testSubjectVar struct { Gitoid string `json:"gitoid"` } type testSubjectResult struct { Data string `json:"data"` } result, err := api.GraphQlQuery[testSubjectResult](ctx, testServer.URL, `query`, testSubjectVar{Gitoid: "test_Gitoid"}) ut.NoError(err) ut.Equal(testSubjectResult{Data: "test"}, result) } func (ut *UTAPIGraphQLSuite) Test_Store_NoServer() { ctx := context.TODO() type testSubjectVar struct { Gitoid string `json:"gitoid"` } type testSubjectResult struct { Data string `json:"data"` } result, err := api.GraphQlQuery[testSubjectResult](ctx, "http://invalid-archivista", `query`, testSubjectVar{Gitoid: "test_Gitoid"}) ut.Error(err) ut.Equal(testSubjectResult{Data: ""}, result) } func (ut *UTAPIGraphQLSuite) Test_Store_BadStatusCode_NoMsg() { testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusInternalServerError) }, ), ) defer testServer.Close() ctx := context.TODO() type testSubjectVar struct { Gitoid string `json:"gitoid"` } type testSubjectResult struct { Data string `json:"data"` } result, err := api.GraphQlQuery[testSubjectResult](ctx, testServer.URL, `query`, testSubjectVar{Gitoid: "test_Gitoid"}) ut.Error(err) ut.Equal(testSubjectResult{Data: ""}, result) } func (ut *UTAPIGraphQLSuite) Test_Store_InvalidData() { testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(``)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() type testSubjectVar struct { Gitoid string `json:"gitoid"` } type testSubjectResult struct { Data string `json:"data"` } result, err := api.GraphQlQuery[testSubjectResult](ctx, testServer.URL, `query`, testSubjectVar{Gitoid: "test_Gitoid"}) ut.Error(err) ut.Equal(testSubjectResult{Data: ""}, result) } func (ut *UTAPIGraphQLSuite) Test_Store_QLReponseWithErrors() { testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`{"data": {"data": "test"}, "errors": [{"message": "test_error"}]}}`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() type testSubjectVar struct { Gitoid string `json:"gitoid"` } type testSubjectResult struct { Data string `json:"data"` Errors string `json:"errors"` } result, err := api.GraphQlQuery[testSubjectResult](ctx, testServer.URL, `query`, testSubjectVar{Gitoid: "test_Gitoid"}) ut.Error(err) ut.EqualError(err, "graph ql query failed: [{test_error}]") ut.Equal(testSubjectResult{Data: ""}, result) } golang-github-in-toto-archivista-0.11.1/pkg/api/options.go000066400000000000000000000022731511066247200234270ustar00rootroot00000000000000// Copyright 2025 The Archivista Contributors // // 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. package api import "net/http" type RequestOption func(*requestOptions) type requestOptions struct { additionalHeaders http.Header } func WithHeaders(h http.Header) RequestOption { return func(ro *requestOptions) { if h != nil { ro.additionalHeaders = h.Clone() } } } func applyRequestOptions(req *http.Request, requestOpts ...RequestOption) *http.Request { if req == nil { return nil } opts := &requestOptions{} for _, opt := range requestOpts { if opt == nil { continue } opt(opts) } if opts.additionalHeaders != nil { req.Header = opts.additionalHeaders } return req } golang-github-in-toto-archivista-0.11.1/pkg/api/structs.go000066400000000000000000000041301511066247200234350ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package api type GraphQLError struct { Message string `json:"message"` } type GraphQLResponseGeneric[T any] struct { Data T `json:"data,omitempty"` Errors []GraphQLError `json:"errors,omitempty"` } type GraphQLRequestBodyGeneric[TVars any] struct { Query string `json:"query"` Variables TVars `json:"variables,omitempty"` } type RetrieveSubjectVars struct { Gitoid string `json:"gitoid"` } type SearchVars struct { Algorithm string `json:"algo"` Digest string `json:"digest"` } type RetrieveSubjectResults struct { Subjects Subjects `json:"subjects"` } type Subjects struct { Edges []SubjectEdge `json:"edges"` } type SubjectEdge struct { Node SubjectNode `json:"node"` } type SubjectNode struct { Name string `json:"name"` SubjectDigests []SubjectDigest `json:"subjectDigests"` } type SubjectDigest struct { Algorithm string `json:"algorithm"` Value string `json:"value"` } type SearchResults struct { Dsses DSSES `json:"dsses"` } type DSSES struct { Edges []SearchEdge `json:"edges"` } type SearchEdge struct { Node SearchNode `json:"node"` } type SearchNode struct { GitoidSha256 string `json:"gitoidSha256"` Statement Statement `json:"statement"` } type Statement struct { AttestationCollection AttestationCollection `json:"attestationCollections"` } type AttestationCollection struct { Name string `json:"name"` Attestations []Attestation `json:"attestations"` } type Attestation struct { Type string `json:"type"` } golang-github-in-toto-archivista-0.11.1/pkg/api/upload.go000066400000000000000000000052331511066247200232170ustar00rootroot00000000000000// Copyright 2023-2024 The Archivista Contributors // // 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. package api import ( "bytes" "context" "encoding/json" "errors" "io" "net/http" "net/url" "github.com/in-toto/go-witness/dsse" ) type UploadResponse struct { Gitoid string `json:"gitoid"` } // Deprecated: Use UploadResponse instead. It will be removed in version >= v0.6.0 type StoreResponse = UploadResponse // Deprecated: Use Store instead. It will be removed in version >= v0.6.0 func Upload(ctx context.Context, baseURL string, envelope dsse.Envelope, requestOptions ...RequestOption) (UploadResponse, error) { return Store(ctx, baseURL, envelope, requestOptions...) } func Store(ctx context.Context, baseURL string, envelope dsse.Envelope, requestOptions ...RequestOption) (StoreResponse, error) { buf := &bytes.Buffer{} enc := json.NewEncoder(buf) if err := enc.Encode(envelope); err != nil { return StoreResponse{}, err } return StoreWithReader(ctx, baseURL, buf, requestOptions...) } func StoreWithReader(ctx context.Context, baseURL string, r io.Reader, requestOptions ...RequestOption) (StoreResponse, error) { return StoreWithReaderWithHTTPClient(ctx, &http.Client{}, baseURL, r, requestOptions...) } func StoreWithReaderWithHTTPClient(ctx context.Context, client *http.Client, baseURL string, r io.Reader, requestOptions ...RequestOption) (StoreResponse, error) { uploadPath, err := url.JoinPath(baseURL, "upload") if err != nil { return UploadResponse{}, err } req, err := http.NewRequestWithContext(ctx, "POST", uploadPath, r) if err != nil { return UploadResponse{}, err } req = applyRequestOptions(req, requestOptions...) req.Header.Set("Content-Type", "application/json") hc := &http.Client{} resp, err := hc.Do(req) if err != nil { return UploadResponse{}, err } defer resp.Body.Close() bodyBytes, err := io.ReadAll(resp.Body) if err != nil { return UploadResponse{}, err } if resp.StatusCode != http.StatusOK { return UploadResponse{}, errors.New(string(bodyBytes)) } uploadResp := UploadResponse{} if err := json.Unmarshal(bodyBytes, &uploadResp); err != nil { return UploadResponse{}, err } return uploadResp, nil } golang-github-in-toto-archivista-0.11.1/pkg/api/upload_test.go000066400000000000000000000113311511066247200242520ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package api_test import ( "context" "encoding/json" "net/http" "net/http/httptest" "os" "testing" "github.com/in-toto/archivista/pkg/api" "github.com/in-toto/go-witness/dsse" "github.com/stretchr/testify/suite" ) // Test Suite: UT APIStore type UTAPIStoreSuite struct { suite.Suite } func TestAPIStoreSuite(t *testing.T) { suite.Run(t, new(UTAPIStoreSuite)) } func (ut *UTAPIStoreSuite) Test_Store() { testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`{"gitoid":"test"}`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() // load test valid test file and parse the dsse envelop attFile, err := os.ReadFile("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } attEnvelop := &dsse.Envelope{} err = json.Unmarshal(attFile, &attEnvelop) if err != nil { ut.FailNow(err.Error()) } // test api.Store happy flow resp, err := api.Store(ctx, testServer.URL, *attEnvelop) if err != nil { ut.FailNow(err.Error()) } ut.Equal(resp, api.StoreResponse{Gitoid: "test"}) } func (ut *UTAPIStoreSuite) Test_StoreWithReader() { // mock server testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`{"gitoid":"test"}`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() // io.Reader file attIo, err := os.Open("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } // context ctx := context.TODO() resp, err := api.StoreWithReader(ctx, testServer.URL, attIo) if err != nil { ut.FailNow(err.Error()) } ut.Equal(resp, api.StoreResponse{Gitoid: "test"}) } func (ut *UTAPIStoreSuite) Test_StoreWithReader_NoServer() { // io.Reader file attIo, err := os.Open("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } // context ctx := context.TODO() resp, err := api.StoreWithReader(ctx, "http://invalid-archivista", attIo) ut.Error(err) ut.Equal(resp, api.StoreResponse{}) } func (ut *UTAPIStoreSuite) Test_StoreWithReader_InvalidResponseBody() { // mock server testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`{"invalid":"invalid"}`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() // io.Reader file attIo, err := os.Open("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } // context ctx := context.TODO() resp, err := api.StoreWithReader(ctx, testServer.URL, attIo) if err != nil { ut.FailNow(err.Error()) } ut.Equal(resp, api.StoreResponse{}) } func (ut *UTAPIStoreSuite) Test_StoreWithReader_BadStatusCode() { // mock server testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusInternalServerError) _, err := w.Write([]byte(`Internal Server Error`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() // io.Reader file attIo, err := os.Open("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } // context ctx := context.TODO() resp, err := api.StoreWithReader(ctx, testServer.URL, attIo) ut.ErrorContains(err, "Internal Server Error") ut.Equal(resp, api.StoreResponse{}) } func (ut *UTAPIStoreSuite) Test_StoreWithReader_BadJSONBody() { // mock server testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) }, ), ) defer testServer.Close() // io.Reader file attIo, err := os.Open("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } // context ctx := context.TODO() resp, err := api.StoreWithReader(ctx, testServer.URL, attIo) ut.ErrorContains(err, "unexpected end of JSON input") ut.Equal(resp, api.StoreResponse{}) } golang-github-in-toto-archivista-0.11.1/pkg/artifactstore/000077500000000000000000000000001511066247200235025ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/artifactstore/artifactstore.go000066400000000000000000000127351511066247200267130ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package artifactstore import ( "crypto" "errors" "fmt" "os" "strings" "github.com/in-toto/go-witness/cryptoutil" "gopkg.in/yaml.v3" ) // Config represents the available artifacts within the store type Config struct { Artifacts map[string]Artifact `json:"artifacts"` } // Artifact represents an artifact and it's available versions in the store type Artifact struct { Versions map[string]Version `json:"versions"` } // Version represents a version of an Artifact (ex v0.2.0) with the available Distributions of version type Version struct { Distributions map[string]Distribution `json:"distributions"` Description string `json:"description"` } // Distribution is a specific distribution of a Version of an Artifact(ex linux-amd64) type Distribution struct { FileLocation string `json:"-"` SHA256Digest string `json:"sha256digest"` } // Store is an artifact store served from Archivista type Store struct { config Config } type Option func(*Store) error // WithConfig creates a Store with the provided config func WithConfig(config Config) Option { return func(as *Store) error { as.config = config return nil } } // WithConfigFile creates a Store with a config loaded from a yaml file on disk func WithConfigFile(configPath string) Option { return func(as *Store) error { configBytes, err := os.ReadFile(configPath) if err != nil { return err } config := Config{} if err := yaml.Unmarshal(configBytes, &config); err != nil { return err } return WithConfig(config)(as) } } // New creates a new Store with the provided options func New(opts ...Option) (Store, error) { as := Store{} errs := make([]error, 0) for _, opt := range opts { if err := opt(&as); err != nil { errs = append(errs, err) } } if len(errs) > 0 { return Store{}, errors.Join(errs...) } if err := verifyConfig(as); err != nil { return Store{}, err } return as, nil } // verifyConfig ensures that each file exists on disk and that the sha256sum of the // files on disk match those of the config func verifyConfig(as Store) error { errs := make([]error, 0) for artifactName, artifact := range as.config.Artifacts { for versionString, version := range artifact.Versions { for distroString, distro := range version.Distributions { if _, err := os.Stat(distro.FileLocation); err != nil { errs = append(errs, fmt.Errorf("%v version %v-%v does not exist on disk: %w", artifactName, versionString, distroString, err)) continue } digestSet, err := cryptoutil.CalculateDigestSetFromFile(distro.FileLocation, []cryptoutil.DigestValue{{Hash: crypto.SHA256}}) if err != nil { errs = append(errs, fmt.Errorf("could not calculate sha256 digest for %v version %v-%v: %w", artifactName, versionString, distroString, err)) } sha256Digest := digestSet[cryptoutil.DigestValue{Hash: crypto.SHA256, GitOID: false}] if !strings.EqualFold(sha256Digest, distro.SHA256Digest) { errs = append(errs, fmt.Errorf("sha256 digest of %v version %v-%v does not match config: got %v, expected %v", artifactName, versionString, distroString, sha256Digest, distro.SHA256Digest)) } } } } if len(errs) > 0 { return errors.Join(errs...) } return nil } // Artifacts returns a copy of all the Store's Artifacts func (as Store) Artifacts() map[string]Artifact { out := make(map[string]Artifact) for artifactString, artifact := range as.config.Artifacts { out[artifactString] = artifact } return out } // Versions returns all of the available Versions for an Artifact. func (as Store) Versions(artifact string) (map[string]Version, bool) { out := make(map[string]Version) a, ok := as.config.Artifacts[artifact] if !ok { return out, false } for verString, version := range a.Versions { out[verString] = version } return out, ok } // Version returns a specific Version for an artifact, if it exists func (as Store) Version(artifact, version string) (Version, bool) { a, ok := as.config.Artifacts[artifact] if !ok { return Version{}, false } v, ok := a.Versions[version] return v, ok } // Distributions returns all of the available Distributions for a specified Version of an Artifact func (as Store) Distributions(artifact, version string) (map[string]Distribution, bool) { out := make(map[string]Distribution) a, ok := as.config.Artifacts[artifact] if !ok { return out, false } vers, ok := a.Versions[version] if !ok { return out, ok } for distroString, distro := range vers.Distributions { out[distroString] = distro } return out, true } // Distribution returns the entry for a specific distribution for a specific version func (as Store) Distribution(artifact, version, distribution string) (Distribution, bool) { a, ok := as.config.Artifacts[artifact] if !ok { return Distribution{}, false } vers, ok := a.Versions[version] if !ok { return Distribution{}, false } distro, ok := vers.Distributions[distribution] return distro, ok } golang-github-in-toto-archivista-0.11.1/pkg/artifactstore/artifactstore_test.go000066400000000000000000000060021511066247200277400ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package artifactstore import ( "os" "path/filepath" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func createTestConfigFile(t *testing.T, workingDir, version, distroFilePath, distroDigest string) string { testConfig := `artifacts: witness: versions: ` + version + `: description: test distributions: linux: filelocation: ` + distroFilePath + ` sha256digest: ` + distroDigest testConfigFilePath := filepath.Join(workingDir, "config.yaml") testConfigFile, err := os.Create(testConfigFilePath) require.NoError(t, err) _, err = testConfigFile.WriteString(testConfig) require.NoError(t, err) require.NoError(t, testConfigFile.Close()) return testConfigFilePath } func TestStore(t *testing.T) { workingDir := t.TempDir() testDistroFilePath := filepath.Join(workingDir, "test") testDistroDigest := "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" testVersion := "v0.1.0" testDistroFile, err := os.Create(testDistroFilePath) require.NoError(t, err) _, err = testDistroFile.Write([]byte("test")) require.NoError(t, err) require.NoError(t, testDistroFile.Close()) t.Run("all good", func(t *testing.T) { testArtifactName := "witness" testDistroName := "linux" testConfigFilePath := createTestConfigFile(t, workingDir, testVersion, testDistroFilePath, testDistroDigest) as, err := New(WithConfigFile(testConfigFilePath)) require.NoError(t, err) artifacts := as.Artifacts() assert.Len(t, artifacts, 1) versions, ok := as.Versions(testArtifactName) assert.True(t, ok) assert.Len(t, versions, 1) version, ok := as.Version(testArtifactName, testVersion) assert.True(t, ok) assert.Len(t, version.Distributions, 1) testDistro, ok := as.Distribution(testArtifactName, testVersion, testDistroName) assert.True(t, ok) assert.Equal(t, testDistro.FileLocation, testDistroFilePath) assert.Equal(t, testDistro.SHA256Digest, testDistroDigest) }) t.Run("wrong file path", func(t *testing.T) { testConfigFilePath := createTestConfigFile(t, workingDir, testVersion, "garbage", testDistroDigest) _, err := New(WithConfigFile(testConfigFilePath)) assert.Error(t, err) }) t.Run("wrong file digest", func(t *testing.T) { testConfigFilePath := createTestConfigFile(t, workingDir, testVersion, testDistroFilePath, "garbage") _, err := New(WithConfigFile(testConfigFilePath)) assert.Error(t, err) }) } golang-github-in-toto-archivista-0.11.1/pkg/config/000077500000000000000000000000001511066247200220755ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/config/config.go000066400000000000000000000146351511066247200237020ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package config import ( "errors" "os" "strings" "time" "github.com/kelseyhightower/envconfig" "github.com/sirupsen/logrus" ) type Config struct { ListenOn string `default:"tcp://127.0.0.1:8082" desc:"URL endpoint for Archivista to listen on" split_words:"true"` ReadTimeout int `default:"120" desc:"HTTP read timeout in seconds" split_words:"true"` WriteTimeout int `default:"120" desc:"HTTP write timeout in seconds" split_words:"true"` LogLevel string `default:"INFO" desc:"Log level" split_words:"true"` CORSAllowOrigins []string `default:"" desc:"Comma separated list of origins to allow CORS requests from" split_words:"true"` EnableTLS bool `default:"FALSE" desc:"Enables TLS on the Archivista server" split_words:"true"` TLSCert string `default:"" desc:"Path to the file containing the TLS Certificate" split_words:"true"` TLSKey string `default:"" desc:"Path to the file containing the TLS Key" split_words:"true"` EnableSPIFFE bool `default:"TRUE" desc:"*** Enable SPIFFE support" split_words:"true"` SPIFFEAddress string `default:"unix:///tmp/spire-agent/public/api.sock" desc:"SPIFFE server address" split_words:"true"` SPIFFETrustedServerId string `default:"" desc:"Trusted SPIFFE server ID; defaults to any" split_words:"true"` EnableSQLStore bool `default:"TRUE" desc:"*** Enable SQL Metadata store. If disabled, GraphQL will also be disabled ***" split_words:"true"` SQLStoreConnectionString string `default:"root:example@tcp(db)/testify" desc:"SQL store connection string" split_words:"true"` SQLStoreBackend string `default:"MYSQL" desc:"SQL backend to use. Options are MYSQL, PSQL" split_words:"true"` SQLStoreMaxIdleConnections int `default:"10" desc:"Maximum number of connections in the idle connection pool" split_words:"true"` SQLStoreMaxOpenConnections int `default:"100" desc:"Maximum number of open connections to the database" split_words:"true"` SQLStoreConnectionMaxLifetime time.Duration `default:"3m" desc:"Maximum amount of time a connection may be reused" split_words:"true"` StorageBackend string `default:"" desc:"Backend to use for attestation storage. Options are FILE, BLOB, or empty string for disabled." split_words:"true"` FileServeOn string `default:"" desc:"What address to serve files on. Only valid when using FILE storage backend." split_words:"true"` FileDir string `default:"/tmp/archivista/" desc:"Directory to store and serve files. Only valid when using FILE storage backend." split_words:"true"` BlobStoreEndpoint string `default:"127.0.0.1:9000" desc:"URL endpoint for blob storage. Only valid when using BLOB storage backend." split_words:"true"` BlobStoreCredentialType string `default:"ACCESS_KEY" desc:"Blob store credential type. Options are IAM or ACCESS_KEY" split_words:"true"` BlobStoreAccessKeyId string `default:"" desc:"Blob store access key id. Only valid when using BLOB storage backend." split_words:"true"` BlobStoreSecretAccessKeyId string `default:"" desc:"Blob store secret access key id. Only valid when using BLOB storage backend." split_words:"true"` BlobStoreUseTLS bool `default:"TRUE" desc:"Use TLS for BLOB storage backend. Only valid when using BLOB storage backend." split_words:"true"` BlobStoreBucketName string `default:"" desc:"Bucket to use for storage. Only valid when using BLOB storage backend." split_words:"true"` EnableGraphql bool `default:"TRUE" desc:"*** Enable GraphQL Endpoint. If GraphQL is disabled, Archivista will be unable to be used by Witness to verify policies" split_words:"true"` GraphqlWebClientEnable bool `default:"TRUE" desc:"Enable GraphiQL, the GraphQL web client" split_words:"true"` EnableArtifactStore bool `default:"FALSE" desc:"*** Enable Artifact Store Endpoints" split_words:"true"` ArtifactStoreConfig string `default:"/tmp/artifacts/config.yaml" desc:"Location of the config describing available artifacts" split_words:"true"` Publisher []string `default:"" desc:"Publisher to use. Options are DAPR, RSTUF or empty string for disabled." split_words:"true"` PublisherDaprHost string `default:"http://127.0.0.1" desc:"Host for Dapr" split_words:"true"` PublisherDaprPort string `default:"3500" desc:"Port for Dapr" split_words:"true"` PublisherDaprURL string `default:"" desc:"URL for Dapr" split_words:"true"` PublisherDaprComponentName string `default:"archivista" desc:"Dapr pubsub component name" split_words:"true"` PublisherDaprTopic string `default:"attestations" desc:"Dapr pubsub topic" split_words:"true"` PublisherRstufHost string `default:"http://127.0.0.1" desc:"Host for RSTUF" split_words:"true"` } // Process reads config from env func (c *Config) Process() error { if err := envconfig.Usage("archivista", c); err != nil { return err } // Check if old env variables starting with ARCHIVIST_ are being used // TODO: Remove this in a future release usingDeprecatedEnv := false usingNewEnv := false for _, e := range os.Environ() { if strings.HasPrefix(e, "ARCHIVIST_") { usingDeprecatedEnv = true logrus.Warnf("Using deprecated environment variable %s. Please use ARCHIVISTA_ instead.", e) } if strings.HasPrefix(e, "ARCHIVISTA_") { usingNewEnv = true } } // check if both are being used and error if so if usingDeprecatedEnv && usingNewEnv { err := errors.New("both deprecated and new environment variables are being used. Please use only the new environment variables") return err } if usingDeprecatedEnv { err := envconfig.Process("archivist", c) if err != nil { return err } } if usingNewEnv { err := envconfig.Process("archivista", c) if err != nil { return err } } return nil } golang-github-in-toto-archivista-0.11.1/pkg/config/config_test.go000066400000000000000000000120041511066247200247250ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package config import ( "bytes" "os" "testing" "github.com/sirupsen/logrus" "github.com/stretchr/testify/require" ) func TestConfig_Process(t *testing.T) { // Set up test environment variables os.Setenv("ARCHIVISTA_LISTEN_ON", "tcp://0.0.0.0:8082") os.Setenv("ARCHIVISTA_READ_TIMEOUT", "300") os.Setenv("ARCHIVISTA_WRITE_TIMEOUT", "300") os.Setenv("ARCHIVISTA_LOG_LEVEL", "DEBUG") os.Setenv("ARCHIVISTA_CORS_ALLOW_ORIGINS", "http://localhost,https://example.com") os.Setenv("ARCHIVISTA_ENABLE_SPIFFE", "FALSE") os.Setenv("ARCHIVISTA_SQL_STORE_CONNECTION_STRING", "root:password@tcp(localhost:3306)/testify") os.Setenv("ARCHIVISTA_STORAGE_BACKEND", "BLOB") os.Setenv("ARCHIVISTA_BLOB_STORE_ENDPOINT", "https://s3.example.com") os.Setenv("ARCHIVISTA_BLOB_STORE_ACCESS_KEY_ID", "ACCESSKEYID") os.Setenv("ARCHIVISTA_BLOB_STORE_SECRET_ACCESS_KEY_ID", "SECRETACCESSKEYID") os.Setenv("ARCHIVISTA_BLOB_STORE_BUCKET_NAME", "mybucket") os.Setenv("ARCHIVISTA_GRAPHQL_WEB_CLIENT_ENABLE", "FALSE") // Create a Config struct and call Process() c := &Config{} err := c.Process() require.NoError(t, err) // Check that the expected values were read from environment variables require.Equal(t, "tcp://0.0.0.0:8082", c.ListenOn) require.Equal(t, 300, c.ReadTimeout) require.Equal(t, 300, c.WriteTimeout) require.Equal(t, "DEBUG", c.LogLevel) require.Equal(t, []string{"http://localhost", "https://example.com"}, c.CORSAllowOrigins) require.False(t, c.EnableSPIFFE) require.Equal(t, "root:password@tcp(localhost:3306)/testify", c.SQLStoreConnectionString) require.Equal(t, "BLOB", c.StorageBackend) require.Equal(t, "https://s3.example.com", c.BlobStoreEndpoint) require.Equal(t, "ACCESSKEYID", c.BlobStoreAccessKeyId) require.Equal(t, "SECRETACCESSKEYID", c.BlobStoreSecretAccessKeyId) require.Equal(t, "mybucket", c.BlobStoreBucketName) require.False(t, c.GraphqlWebClientEnable) // Clean up environment variables os.Unsetenv("ARCHIVISTA_LISTEN_ON") os.Unsetenv("ARCHIVISTA_READ_TIMEOUT") os.Unsetenv("ARCHIVISTA_WRITE_TIMEOUT") os.Unsetenv("ARCHIVISTA_LOG_LEVEL") os.Unsetenv("ARCHIVISTA_CORS_ALLOW_ORIGINS") os.Unsetenv("ARCHIVISTA_ENABLE_SPIFFE") os.Unsetenv("ARCHIVISTA_SQL_STORE_CONNECTION_STRING") os.Unsetenv("ARCHIVISTA_STORAGE_BACKEND") os.Unsetenv("ARCHIVISTA_FILE_SERVE_ON") os.Unsetenv("ARCHIVISTA_FILE_DIR") os.Unsetenv("ARCHIVISTA_BLOB_STORE_ENDPOINT") os.Unsetenv("ARCHIVISTA_BLOB_STORE_ACCESS_KEY_ID") os.Unsetenv("ARCHIVISTA_BLOB_STORE_SECRET_ACCESS_KEY_ID") os.Unsetenv("ARCHIVISTA_BLOB_STORE_BUCKET_NAME") os.Unsetenv("ARCHIVISTA_ENABLE_GRAPHQL") os.Unsetenv("ARCHIVISTA_GRAPHQL_WEB_CLIENT_ENABLE") } func TestConfig_DeprecationAndPrecedence(t *testing.T) { // Set up test environment variables os.Setenv("ARCHIVIST_LISTEN_ON", "tcp://0.0.0.0:8082") os.Setenv("ARCHIVIST_LOG_LEVEL", "DEBUG") os.Setenv("ARCHIVIST_CORS_ALLOW_ORIGINS", "http://localhost:8080") // os.Setenv("ARCHIVISTA_LOG_LEVEL", "INFO") // os.Setenv("ARCHIVISTA_CORS_ALLOW_ORIGINS", "http://localhost,https://example.com") // Set up log output capturing var output bytes.Buffer logrus.SetOutput(&output) defer func() { logrus.SetOutput(os.Stderr) }() // Create a Config struct and call Process() c := &Config{} err := c.Process() require.NoError(t, err) //check that the non deprecated environment variables work // Check that the deprecated variables work require.Equal(t, "tcp://0.0.0.0:8082", c.ListenOn) require.Equal(t, "DEBUG", c.LogLevel) require.Equal(t, []string{"http://localhost:8080"}, c.CORSAllowOrigins) // Check that the appropriate error is returned if both old and new prefixes are used os.Setenv("ARCHIVIST_LISTEN_ON", "tcp://0.0.0.0:8083") os.Setenv("ARCHIVISTA_LISTEN_ON", "tcp://0.0.0.0:8084") c = &Config{} err = c.Process() require.Error(t, err) require.Equal(t, "both deprecated and new environment variables are being used. Please use only the new environment variables", err.Error()) // Check that the deprecated environment variables were logged require.Contains(t, output.String(), "Using deprecated environment variable ARCHIVIST_LOG_LEVEL") require.Contains(t, output.String(), "Using deprecated environment variable ARCHIVIST_CORS_ALLOW_ORIGINS") // Clean up environment variables os.Unsetenv("ARCHIVIST_LISTEN_ON") os.Unsetenv("ARCHIVIST_LOG_LEVEL") os.Unsetenv("ARCHIVISTA_LOG_LEVEL") os.Unsetenv("ARCHIVIST_CORS_ALLOW_ORIGINS") os.Unsetenv("ARCHIVISTA_CORS_ALLOW_ORIGINS") os.Unsetenv("ARCHIVISTA_LISTEN_ON") } golang-github-in-toto-archivista-0.11.1/pkg/http-client/000077500000000000000000000000001511066247200230635ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/http-client/client.go000066400000000000000000000170451511066247200246770ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package httpclient import ( "bytes" "context" "encoding/json" "errors" "fmt" "io" "net/http" "net/url" "github.com/in-toto/archivista/pkg/api" "github.com/in-toto/go-witness/dsse" ) type ArchivistaClient struct { BaseURL string GraphQLURL string requestHeaders http.Header *http.Client } type Option func(*ArchivistaClient) func WithHeaders(h http.Header) Option { return func(ac *ArchivistaClient) { if h != nil { ac.requestHeaders = h.Clone() } } } func (ac *ArchivistaClient) requestOptions() []api.RequestOption { opts := []api.RequestOption{} if ac.requestHeaders != nil { opts = append(opts, api.WithHeaders(ac.requestHeaders)) } return opts } type HttpClienter interface { DownloadDSSE(ctx context.Context, gitoid string) (dsse.Envelope, error) DownloadReadCloser(ctx context.Context, gitoid string) (io.ReadCloser, error) DownloadWithWriter(ctx context.Context, gitoid string, dst io.Writer) error Store(ctx context.Context, envelope dsse.Envelope) (api.UploadResponse, error) StoreWithReader(ctx context.Context, r io.Reader) (api.UploadResponse, error) GraphQLRetrieveSubjectResults(ctx context.Context, gitoid string) (api.RetrieveSubjectResults, error) GraphQLRetrieveSearchResults(ctx context.Context, algo string, digest string) (api.SearchResults, error) GraphQLQueryIface(ctx context.Context, query string, variables interface{}) (*GraphQLResponseInterface, error) GraphQLQueryToDst(ctx context.Context, query string, variables interface{}, dst interface{}) error GraphQLQueryReadCloser(ctx context.Context, query string, variables interface{}) (io.ReadCloser, error) } func CreateArchivistaClient(httpClient *http.Client, baseURL string, opts ...Option) (*ArchivistaClient, error) { client := &ArchivistaClient{ BaseURL: baseURL, Client: http.DefaultClient, } if httpClient != nil { client.Client = httpClient } for _, opt := range opts { opt(client) } var err error client.GraphQLURL, err = url.JoinPath(client.BaseURL, "query") if err != nil { return nil, err } return client, nil } func (ac *ArchivistaClient) DownloadDSSE(ctx context.Context, gitoid string) (dsse.Envelope, error) { reader, err := api.DownloadReadCloserWithHTTPClient(ctx, ac.Client, ac.BaseURL, gitoid, ac.requestOptions()...) if err != nil { return dsse.Envelope{}, err } env := dsse.Envelope{} if err := json.NewDecoder(reader).Decode(&env); err != nil { return dsse.Envelope{}, err } return env, nil } func (ac *ArchivistaClient) DownloadReadCloser(ctx context.Context, gitoid string) (io.ReadCloser, error) { return api.DownloadReadCloserWithHTTPClient(ctx, ac.Client, ac.BaseURL, gitoid, ac.requestOptions()...) } func (ac *ArchivistaClient) DownloadWithWriter(ctx context.Context, gitoid string, dst io.Writer) error { return api.DownloadWithWriterWithHTTPClient(ctx, ac.Client, ac.BaseURL, gitoid, dst, ac.requestOptions()...) } func (ac *ArchivistaClient) Store(ctx context.Context, envelope dsse.Envelope) (api.UploadResponse, error) { return api.Store(ctx, ac.BaseURL, envelope, ac.requestOptions()...) } func (ac *ArchivistaClient) StoreWithReader(ctx context.Context, r io.Reader) (api.UploadResponse, error) { return api.StoreWithReader(ctx, ac.BaseURL, r, ac.requestOptions()...) } type GraphQLRequestBodyInterface struct { Query string `json:"query"` Variables interface{} `json:"variables,omitempty"` } type GraphQLResponseInterface struct { Data interface{} Errors []api.GraphQLError `json:"errors,omitempty"` } // GraphQLRetrieveSubjectResults retrieves the subjects for a given gitoid. func (ac *ArchivistaClient) GraphQLRetrieveSubjectResults( ctx context.Context, gitoid string, ) (api.RetrieveSubjectResults, error) { return api.GraphQlQuery[api.RetrieveSubjectResults]( ctx, ac.BaseURL, api.RetrieveSubjectsQuery, api.RetrieveSubjectVars{Gitoid: gitoid}, ac.requestOptions()..., ) } // GraphQLRetrieveSearchResults retrieves the search results for a given algorithm and digest. func (ac *ArchivistaClient) GraphQLRetrieveSearchResults( ctx context.Context, algo string, digest string, ) (api.SearchResults, error) { return api.GraphQlQuery[api.SearchResults]( ctx, ac.BaseURL, api.SearchQuery, api.SearchVars{Algorithm: algo, Digest: digest}, ac.requestOptions()..., ) } // GraphQLQueryIface executes a GraphQL query against the Archivista API and returns the response as an interface. // // Parameters: // - ctx: The context to control the query's lifecycle, such as cancellations or deadlines. // - query: A string representing the GraphQL query to be executed. // - variables: A map or struct containing variables to parameterize the query. // // Returns: // - A pointer to a GraphQLResponseInterface containing the query's result or errors. // - An error if the query execution or response parsing fails. // // Example: // // response, err := client.GraphQLQueryIface(ctx, query, variables) // if err != nil { // log.Fatalf("GraphQL query failed: %v", err) // } // fmt.Printf("Response data: %+v\n", response.Data) func (ac *ArchivistaClient) GraphQLQueryIface( ctx context.Context, query string, variables interface{}, ) (*GraphQLResponseInterface, error) { reader, err := ac.GraphQLQueryReadCloser(ctx, query, variables) if err != nil { return nil, err } defer reader.Close() gqlRes := GraphQLResponseInterface{} dec := json.NewDecoder(reader) if err := dec.Decode(&gqlRes); err != nil { return nil, err } if len(gqlRes.Errors) > 0 { return nil, fmt.Errorf("graph ql query failed: %v", gqlRes.Errors) } return &gqlRes, nil } // GraphQLQueryToDst executes a GraphQL query against the Archivista API and unmarshals the response into a destination object. func (ac *ArchivistaClient) GraphQLQueryToDst(ctx context.Context, query string, variables interface{}, dst interface{}) error { reader, err := ac.GraphQLQueryReadCloser(ctx, query, variables) if err != nil { return err } defer reader.Close() dec := json.NewDecoder(reader) if err := dec.Decode(&dst); err != nil { return err } return nil } // GraphQLQueryReadCloser executes a GraphQL query against the Archivista API and returns the response as an io.ReadCloser. func (ac *ArchivistaClient) GraphQLQueryReadCloser( ctx context.Context, query string, variables interface{}, ) (io.ReadCloser, error) { requestBodyMap := GraphQLRequestBodyInterface{ Query: query, Variables: variables, } requestBodyJSON, err := json.Marshal(requestBodyMap) if err != nil { return nil, err } req, err := http.NewRequestWithContext(ctx, http.MethodPost, ac.GraphQLURL, bytes.NewReader(requestBodyJSON)) if err != nil { return nil, err } if ac.requestHeaders != nil { req.Header = ac.requestHeaders } req.Header.Set("Content-Type", "application/json") res, err := ac.Do(req) if err != nil { return nil, err } if res.StatusCode != http.StatusOK { defer res.Body.Close() errMsg, err := io.ReadAll(res.Body) if err != nil { return nil, err } return nil, errors.New(string(errMsg)) } return res.Body, nil } golang-github-in-toto-archivista-0.11.1/pkg/http-client/client_test.go000066400000000000000000000202131511066247200257250ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package httpclient_test import ( "bytes" "context" "encoding/json" "net/http" "net/http/httptest" "os" "testing" "github.com/in-toto/archivista/pkg/api" httpclient "github.com/in-toto/archivista/pkg/http-client" "github.com/in-toto/go-witness/dsse" "github.com/stretchr/testify/suite" ) // Test Suite: UT HTTPClientDownloadSuite type UTHTTPClientDownloadSuite struct { suite.Suite } func TestHTTPClientAPIDownloadSuite(t *testing.T) { suite.Run(t, new(UTHTTPClientDownloadSuite)) } func (ut *UTHTTPClientDownloadSuite) Test_DownloadDSSE() { testEnvelope, err := os.ReadFile("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } expectedEnvelop := dsse.Envelope{} err = json.Unmarshal(testEnvelope, &expectedEnvelop) if err != nil { ut.FailNow(err.Error()) } testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err = w.Write(testEnvelope) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() client, err := httpclient.CreateArchivistaClient(http.DefaultClient, testServer.URL) if err != nil { ut.FailNow(err.Error()) } resp, err := client.DownloadDSSE(ctx, "gitoid_test") if err != nil { ut.FailNow(err.Error()) } ut.Equal(expectedEnvelop, resp) } func (ut *UTHTTPClientDownloadSuite) Test_DownloadReadCloser() { testEnvelope, err := os.ReadFile("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } expectedEnvelop := dsse.Envelope{} err = json.Unmarshal(testEnvelope, &expectedEnvelop) if err != nil { ut.FailNow(err.Error()) } testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err = w.Write(testEnvelope) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() client, err := httpclient.CreateArchivistaClient(http.DefaultClient, testServer.URL) if err != nil { ut.FailNow(err.Error()) } readCloser, err := client.DownloadReadCloser(ctx, "gitoid_test") if err != nil { ut.FailNow(err.Error()) } env := dsse.Envelope{} if err := json.NewDecoder(readCloser).Decode(&env); err != nil { ut.FailNow(err.Error()) } ut.Equal(expectedEnvelop, env) } func (ut *UTHTTPClientDownloadSuite) Test_DownloadWithWriter() { testEnvelope, err := os.ReadFile("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } expectedEnvelop := dsse.Envelope{} err = json.Unmarshal(testEnvelope, &expectedEnvelop) if err != nil { ut.FailNow(err.Error()) } testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err = w.Write(testEnvelope) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() client, err := httpclient.CreateArchivistaClient(http.DefaultClient, testServer.URL) if err != nil { ut.FailNow(err.Error()) } buf := bytes.NewBuffer(nil) if err := client.DownloadWithWriter(ctx, "gitoid_test", buf); err != nil { ut.FailNow(err.Error()) } env := dsse.Envelope{} if err := json.NewDecoder(buf).Decode(&env); err != nil { ut.FailNow(err.Error()) } ut.Equal(expectedEnvelop, env) } // Test Suite: UT HTTPClientStore type UTHTTPClientStoreSuite struct { suite.Suite } func TestAPIStoreSuite(t *testing.T) { suite.Run(t, new(UTHTTPClientStoreSuite)) } func (ut *UTHTTPClientStoreSuite) Test_Store() { testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`{"gitoid":"test"}`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() attFile, err := os.ReadFile("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } attEnvelop := dsse.Envelope{} err = json.Unmarshal(attFile, &attEnvelop) if err != nil { ut.FailNow(err.Error()) } client, err := httpclient.CreateArchivistaClient(http.DefaultClient, testServer.URL) if err != nil { ut.FailNow(err.Error()) } resp, err := client.Store(ctx, attEnvelop) if err != nil { ut.FailNow(err.Error()) } ut.Equal(resp, api.UploadResponse{Gitoid: "test"}) } func (ut *UTHTTPClientStoreSuite) Test_StoreWithReader() { testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, err := w.Write([]byte(`{"gitoid":"test"}`)) if err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() attIo, err := os.Open("../../test/package.attestation.json") if err != nil { ut.FailNow(err.Error()) } ctx := context.TODO() client, err := httpclient.CreateArchivistaClient(http.DefaultClient, testServer.URL) if err != nil { ut.FailNow(err.Error()) } resp, err := client.StoreWithReader(ctx, attIo) if err != nil { ut.FailNow(err.Error()) } ut.Equal(resp, api.UploadResponse{Gitoid: "test"}) } // Test Suite: UT HTTPClientStore type UTHTTPClientGraphQLSuite struct { suite.Suite } func TestAPIGraphQLSuite(t *testing.T) { suite.Run(t, new(UTHTTPClientGraphQLSuite)) } func (ut *UTHTTPClientGraphQLSuite) Test_GraphQLRetrieveSubjectResults() { expected := api.GraphQLResponseGeneric[api.RetrieveSubjectResults]{ Data: api.RetrieveSubjectResults{ Subjects: api.Subjects{ Edges: []api.SubjectEdge{ { Node: api.SubjectNode{ Name: "test_Gitoid", SubjectDigests: []api.SubjectDigest{ { Algorithm: "test_Gitoid", Value: "test_Gitoid", }, }, }, }, }, }, }, Errors: []api.GraphQLError{}, } testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) if err := json.NewEncoder(w).Encode(expected); err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() client, err := httpclient.CreateArchivistaClient(http.DefaultClient, testServer.URL) if err != nil { ut.FailNow(err.Error()) } actual, err := client.GraphQLRetrieveSubjectResults(ctx, "test_Gitoid") ut.NoError(err) ut.Equal(expected.Data, actual) } func (ut *UTHTTPClientGraphQLSuite) Test_GraphQLSearchResults() { expected := api.GraphQLResponseGeneric[api.SearchResults]{ Data: api.SearchResults{ Dsses: api.DSSES{ Edges: []api.SearchEdge{ { Node: api.SearchNode{ GitoidSha256: "test_Gitoid", Statement: api.Statement{ AttestationCollection: api.AttestationCollection{ Name: "test_Gitoid", Attestations: []api.Attestation{ { Type: "test", }, }, }, }, }, }, }, }, }, Errors: []api.GraphQLError{}, } testServer := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) if err := json.NewEncoder(w).Encode(expected); err != nil { ut.FailNow(err.Error()) } }, ), ) defer testServer.Close() ctx := context.TODO() client, err := httpclient.CreateArchivistaClient(http.DefaultClient, testServer.URL) if err != nil { ut.FailNow(err.Error()) } actual, err := client.GraphQLRetrieveSearchResults(ctx, "test_Gitoid", "test_Gitoid") ut.NoError(err) ut.Equal(expected.Data, actual) } golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/000077500000000000000000000000001511066247200237755ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/attestationcollection/000077500000000000000000000000001511066247200304105ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/attestationcollection/parser_registry.go000066400000000000000000000022031511066247200341600ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package attestationcollection import ( "context" "encoding/json" "github.com/in-toto/archivista/ent" "log" ) var registeredParsers map[string]AttestationParser func init() { registeredParsers = make(map[string]AttestationParser) } func Register(attestationType string, parser AttestationParser) { registeredParsers[attestationType] = parser log.Printf("parser registered: %s", attestationType) } type AttestationParser func(ctx context.Context, tx *ent.Tx, attestation *ent.Attestation, attestationType string, message json.RawMessage) error parser_registry_test.go000066400000000000000000000025051511066247200351450ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/attestationcollection// Copyright 2024 The Archivista Contributors // // 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. package attestationcollection import ( "context" "encoding/json" "testing" "github.com/in-toto/archivista/ent" "github.com/stretchr/testify/assert" ) func TestRegister(t *testing.T) { // Define a mock parser function mockParser := func(ctx context.Context, tx *ent.Tx, attestation *ent.Attestation, attestationType string, message json.RawMessage) error { return nil } // Register the mock parser Register("mockType", mockParser) // Check if the parser is registered registeredParser, exists := registeredParsers["mockType"] var typedParser AttestationParser = mockParser assert.True(t, exists, "Parser should be registered") assert.IsType(t, typedParser, registeredParser, "Registered parser should match the mock parser") } golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/attestationcollection/parserstorer.go000066400000000000000000000047561511066247200335060ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package attestationcollection import ( "context" "encoding/json" "github.com/google/uuid" "github.com/in-toto/archivista/ent" "github.com/in-toto/archivista/pkg/metadatastorage" "github.com/in-toto/go-witness/attestation" "github.com/in-toto/go-witness/log" ) const ( Predicate = "https://witness.testifysec.com/attestation-collection/v0.1" ) // attestation.Collection from go-witness will try to parse each of the attestations by calling their factory functions, // which require the attestations to be registered in the go-witness library. We don't really care about the actual attestation // data for the purposes here, so just leave it as a raw message. type ParsedCollection struct { attestation.Collection Attestations []struct { Type string `json:"type"` Attestation json.RawMessage `json:"attestation"` } `json:"attestations"` } func Parse(data []byte) (metadatastorage.Storer, error) { parsedCollection := ParsedCollection{} if err := json.Unmarshal(data, &parsedCollection); err != nil { return parsedCollection, err } return parsedCollection, nil } func (parsedCollection ParsedCollection) Store(ctx context.Context, tx *ent.Tx, stmtID uuid.UUID) error { collection, err := tx.AttestationCollection.Create(). SetStatementID(stmtID). SetName(parsedCollection.Name). Save(ctx) if err != nil { return err } for _, a := range parsedCollection.Attestations { newAttestation, err := tx.Attestation.Create(). SetAttestationCollectionID(collection.ID). SetType(a.Type). Save(ctx) if err != nil { return err } // we parse if a parser is available. otherwise, we ignore it if no parser is available. if parser, exists := registeredParsers[a.Type]; exists { if err := parser(ctx, tx, newAttestation, a.Type, a.Attestation); err != nil { log.Errorf("failed to parse attestation of type %s: %w", a.Type, err) return err } } } return nil } golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/parser.go000066400000000000000000000015261511066247200256240ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package metadatastorage import ( "context" "github.com/google/uuid" "github.com/in-toto/archivista/ent" ) type ParserFunc func([]byte) (Storer, error) type Storer interface { Store(ctx context.Context, tx *ent.Tx, stmtID uuid.UUID) error } golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/parserregistry/000077500000000000000000000000001511066247200270625ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/parserregistry/registry.go000066400000000000000000000020241511066247200312570ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package parserregistry import ( "github.com/in-toto/archivista/pkg/metadatastorage" "github.com/in-toto/archivista/pkg/metadatastorage/attestationcollection" ) var ( parsersByPredicate = map[string]metadatastorage.ParserFunc{ attestationcollection.Predicate: attestationcollection.Parse, } ) func ParserForPredicate(predicate string) (metadatastorage.ParserFunc, bool) { pf, ok := parsersByPredicate[predicate] return pf, ok } golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/sqlstore/000077500000000000000000000000001511066247200256515ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/sqlstore/client.go000066400000000000000000000076151511066247200274670ustar00rootroot00000000000000// Copyright 2023 The Archivista Contributors // // 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. package sqlstore import ( "database/sql" "fmt" "strings" "time" "ariga.io/sqlcomment" "entgo.io/ent/dialect" entsql "entgo.io/ent/dialect/sql" "github.com/in-toto/archivista/ent" "github.com/jkjell/go-db-credential-refresh/driver" "github.com/jkjell/go-db-credential-refresh/store/static" ) type ClientOption func(*clientOptions) type clientOptions struct { maxIdleConns int maxOpenConns int connMaxLifetime time.Duration } // Configures a client with the specified max idle connections. Default is 10 connections func ClientWithMaxIdleConns(maxIdleConns int) ClientOption { return func(co *clientOptions) { co.maxIdleConns = maxIdleConns } } // Configures a client with the specified max open connections. Default is 100 connections func ClientWithMaxOpenConns(maxOpenConns int) ClientOption { return func(co *clientOptions) { co.maxOpenConns = maxOpenConns } } // Congiures a client with the specified max connection lifetime. Default is 3 minutes func ClientWithConnMaxLifetime(connMaxLifetime time.Duration) ClientOption { return func(co *clientOptions) { co.connMaxLifetime = connMaxLifetime } } // NewEntClient creates an ent client for use in the sqlmetadata store. // Valid backends are MYSQL and PSQL. func NewEntClient(sqlBackend string, connectionString string, opts ...ClientOption) (*ent.Client, error) { clientOpts := &clientOptions{ maxIdleConns: 10, maxOpenConns: 100, connMaxLifetime: 3 * time.Minute, } for _, opt := range opts { opt(clientOpts) } var s driver.Store var dc *driver.Config var entDialect, driverName, user, password string upperSqlBackend := strings.ToUpper(sqlBackend) if strings.HasPrefix(upperSqlBackend, "MYSQL") { var err error dc, user, password, err = ConfigFromMySQL(connectionString) if err != nil { return nil, fmt.Errorf("could not get driver config from mysql connection string: %w", err) } entDialect = dialect.MySQL driverName = "mysql" } else if strings.HasPrefix(upperSqlBackend, "PSQL") { var err error dc, user, password, err = ConfigFromPostgres(connectionString) if err != nil { return nil, fmt.Errorf("could not get driver config from postgres connection string: %w", err) } entDialect = dialect.Postgres driverName = "pgx" } else { return nil, fmt.Errorf("unknown sql backend: %s", sqlBackend) } // if upperSqlBackend ends with _RDS_IAM, then use awsrds store if strings.HasSuffix(upperSqlBackend, "_RDS_IAM") { var err error s, err = AWSRDSStoreFromDriverConfig(dc, user) if err != nil { return nil, fmt.Errorf("could not create credentials refresh store: %w", err) } } else { s = static.NewStaticStore(user, password) dc.Retries = 0 // no retries for static credentials } c, err := driver.NewConnector(s, driverName, dc) if err != nil { return nil, fmt.Errorf("could not create connector: %w", err) } db := sql.OpenDB(c) db.SetMaxIdleConns(clientOpts.maxIdleConns) db.SetMaxOpenConns(clientOpts.maxOpenConns) db.SetConnMaxLifetime(clientOpts.connMaxLifetime) drv := entsql.OpenDB(entDialect, db) sqlcommentDrv := sqlcomment.NewDriver(drv, sqlcomment.WithDriverVerTag(), sqlcomment.WithTags(sqlcomment.Tags{ sqlcomment.KeyApplication: "archivista", sqlcomment.KeyFramework: "net/http", }), ) client := ent.NewClient(ent.Driver(sqlcommentDrv)) return client, nil } golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/sqlstore/iam.go000066400000000000000000000054571511066247200267610ustar00rootroot00000000000000// Copyright 2025 The Archivista Contributors // // 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. package sqlstore import ( "context" "fmt" "strings" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" "github.com/jkjell/go-db-credential-refresh/driver" _ "github.com/lib/pq" ) type AWSConfigAPI interface { // LoadDefaultConfig loads the default AWS configuration. LoadDefaultConfig(ctx context.Context, opts ...func(*config.LoadOptions) error) (aws.Config, error) } type AWSConfig struct{} func (c *AWSConfig) LoadDefaultConfig(ctx context.Context, opts ...func(*config.LoadOptions) error) (aws.Config, error) { return config.LoadDefaultConfig(ctx, opts...) } var AwsConfigAPI AWSConfigAPI = &AWSConfig{} // RewriteConnectionStringForIAM rewrites the connection string to use AWS RDS IAM authentication // It supports both MYSQL_RDS_IAM and PSQL_RDS_IAM backends func RewriteConnectionStringForIAM(sqlBackend string, connectionString string, dryRun bool) (string, error) { var dc *driver.Config var user string upperSqlBackend := strings.ToUpper(sqlBackend) if strings.HasPrefix(upperSqlBackend, "MYSQL") { var err error dc, user, _, err = ConfigFromMySQL(connectionString) if err != nil { return "", fmt.Errorf("could not get driver config from mysql connection string: %w", err) } // for mysql, we need to add some query parameters dc.Opts["tls"] = "true" dc.Opts["allowCleartextPasswords"] = "true" } else if strings.HasPrefix(upperSqlBackend, "PSQL") { var err error dc, user, _, err = ConfigFromPostgres(connectionString) if err != nil { return "", fmt.Errorf("could not get driver config from mysql connection string: %w", err) } } else { return "", fmt.Errorf("unsupported sql backend: %s", sqlBackend) } s, err := AWSRDSStoreFromDriverConfig(dc, user) if err != nil { return "", fmt.Errorf("could not create credentials refresh store: %w", err) } creds, err := s.Get(context.Background()) if err != nil { return "", fmt.Errorf("could not get refreshed credentials: %w", err) } if creds == nil { return "", fmt.Errorf("refreshed credentials are nil") } var password string if dryRun { password = "authtoken" } else { password = creds.GetPassword() } return dc.Formatter(creds.GetUsername(), password, dc.Host, dc.Port, dc.DB, dc.Opts), nil } golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/sqlstore/iam_test.go000066400000000000000000000242161511066247200300120ustar00rootroot00000000000000// Copyright 2025 The Archivista Contributors // // 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. package sqlstore import ( "context" "errors" "fmt" "net/url" "strings" "testing" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/credentials" "github.com/go-sql-driver/mysql" "github.com/stretchr/testify/suite" ) const ( mysqlConnStr = "user:password@tcp(host:3306)/dbname" postgresConnStr = "postgresql://user:password@host:5432/dbname" ) type RewriteConnectionStringForIAMSuite struct { suite.Suite } func TestRewriteConnectionStringForIAM(t *testing.T) { suite.Run(t, new(RewriteConnectionStringForIAMSuite)) } type mockAWSConfigAPI struct { cfg aws.Config err error } func (m *mockAWSConfigAPI) LoadDefaultConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error) (aws.Config, error) { return m.cfg, m.err } func (s *RewriteConnectionStringForIAMSuite) TestUnsupportedSqlBackend() { AwsConfigAPI = nil _, err := RewriteConnectionStringForIAM("unsupported", "connstr", false) s.Require().Error(err) } // An example token for PSQL that is returned will look like this: // user:host:3306?Action=connect&DBUser=user&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=foo%2F20251028%2Fus-east-1%2Frds-db%2Faws4_request&X-Amz-Date=20251028T171846Z&X-Amz-Expires=900&X-Amz-Security-Token=baz&X-Amz-SignedHeaders=host&X-Amz-Signature=e39c63e53919a3d1cdb96211af8d0a83b7afdd637b5d6788ad9014add900489e@tcp(host:3306)/dbname?allowCleartextPasswords=true&parseTime=true&tls=true // // The details of the token that we care about are: // The token starts with `host:3306` // // And has these predictable query parameters: // Action=connect // DBUser=user // X-Amz-Credential=foo/20251028/us-east-1/rds-db/aws4_request // X-Amz-Expires=900 // X-Amz-Security-Token=baz // // The other components are variable, based on the time or AWS SDK implementation details func validateMySqlAuthToken(s *RewriteConnectionStringForIAMSuite, connStr string, opts ...string) { parsedConnStr, err := mysql.ParseDSN(connStr) s.Require().NoError(err) s.Equal("user", parsedConnStr.User) s.Equal("tcp", parsedConnStr.Net) s.Equal("host:3306", parsedConnStr.Addr) s.Equal("dbname", parsedConnStr.DBName) // allowCleartextPasswords=true&parseTime=true&tls=true s.True(parsedConnStr.AllowCleartextPasswords) s.Equal("true", parsedConnStr.TLSConfig) s.True(parsedConnStr.ParseTime) for _, opt := range opts { kv := strings.Split(opt, "=") s.Require().Len(kv, 2, "expected opt %s to be in key=value format", opt) val, ok := parsedConnStr.Params[kv[0]] s.Require().True(ok, "expected param %s to be present", opt) s.Equal(kv[1], val, "expected param %s to be true", opt) } token := parsedConnStr.Passwd s.NotEmpty(token) s.True(strings.HasPrefix(token, "host:3306")) parsedToken, err := url.Parse(token) s.Require().NoError(err) params := parsedToken.Query() s.Equal("connect", params.Get("Action")) s.Equal("user", params.Get("DBUser")) s.True(strings.HasPrefix(params.Get("X-Amz-Credential"), "foo")) s.Contains(params.Get("X-Amz-Credential"), "us-east-1") s.Equal("baz", params.Get("X-Amz-Security-Token")) } func (s *RewriteConnectionStringForIAMSuite) TestMySqlSuccess() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{ Region: "us-east-1", Credentials: credentials.NewStaticCredentialsProvider("foo", "bar", "baz"), }, } connStr, err := RewriteConnectionStringForIAM("mysql_rds_iam", mysqlConnStr, false) s.Require().NoError(err) validateMySqlAuthToken(s, connStr) } func (s *RewriteConnectionStringForIAMSuite) TestMySqlNoPasswordSuccess() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{ Region: "us-east-1", Credentials: credentials.NewStaticCredentialsProvider("foo", "bar", "baz"), }, } connStr, err := RewriteConnectionStringForIAM("mysql_rds_iam", "user@tcp(host:3306)/dbname", false) s.Require().NoError(err) validateMySqlAuthToken(s, connStr) } func (s *RewriteConnectionStringForIAMSuite) TestMySqlWithParamsSuccess() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{ Region: "us-east-1", Credentials: credentials.NewStaticCredentialsProvider("foo", "bar", "baz"), }, } connStr, err := RewriteConnectionStringForIAM("mysql_rds_iam", fmt.Sprintf("%s?foo=bar", mysqlConnStr), false) s.Require().NoError(err) validateMySqlAuthToken(s, connStr, "foo=bar") } func (s *RewriteConnectionStringForIAMSuite) TestMySqlOverrideParamsSuccess() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{ Region: "us-east-1", Credentials: credentials.NewStaticCredentialsProvider("foo", "bar", "baz"), }, } connStr, err := RewriteConnectionStringForIAM("mysql_rds_iam", fmt.Sprintf("%s?allowCleartextPasswords=false&foo=baz&tls=false", mysqlConnStr), false) s.Require().NoError(err) validateMySqlAuthToken(s, connStr, "foo=baz") } // An example token for PSQL that is returned will look like this: // user:host:5432?Action=connect&DBUser=user&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=foo%2F20251028%2Fus-east-1%2Frds-db%2Faws4_request&X-Amz-Date=20251028T171846Z&X-Amz-Expires=900&X-Amz-Security-Token=baz&X-Amz-SignedHeaders=host&X-Amz-Signature=e39c63e53919a3d1cdb96211af8d0a83b7afdd637b5d6788ad9014add900489e@tcp(host:3306)/dbname?allowCleartextPasswords=true&parseTime=true&tls=true // // The details of the token that we care about are: // The token starts with `host:5432` // // And has these predictable query parameters: // Action=connect // DBUser=user // X-Amz-Credential=foo/20251028/us-east-1/rds-db/aws4_request // X-Amz-Expires=900 // X-Amz-Security-Token=baz // // The other components are variable, based on the time or AWS SDK implementation details func validatePostgresAuthToken(s *RewriteConnectionStringForIAMSuite, connStr string, opts ...string) { parsedConnStr, err := url.Parse(connStr) s.Require().NoError(err) s.Equal("postgres", parsedConnStr.Scheme) s.Equal("user", parsedConnStr.User.Username()) s.Equal("host", parsedConnStr.Hostname()) s.Equal("5432", parsedConnStr.Port()) s.Equal("/dbname", parsedConnStr.Path) queryParams := parsedConnStr.Query() for _, opt := range opts { kv := strings.Split(opt, "=") s.Require().Len(kv, 2, "expected opt %s to be in key=value format", opt) val := queryParams.Get(kv[0]) s.Equal(kv[1], val, "expected param %s to be true", opt) } token, set := parsedConnStr.User.Password() s.Require().True(set) s.NotEmpty(token) s.True(strings.HasPrefix(token, "host:5432")) parsedToken, err := url.Parse(token) s.Require().NoError(err) params := parsedToken.Query() s.Equal("connect", params.Get("Action")) s.Equal("user", params.Get("DBUser")) s.True(strings.HasPrefix(params.Get("X-Amz-Credential"), "foo")) s.Contains(params.Get("X-Amz-Credential"), "us-east-1") s.Equal("baz", params.Get("X-Amz-Security-Token")) } func (s *RewriteConnectionStringForIAMSuite) TestPostgresSuccess() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{ Region: "us-east-1", Credentials: credentials.NewStaticCredentialsProvider("foo", "bar", "baz"), }, } connStr, err := RewriteConnectionStringForIAM("psql_rds_iam", postgresConnStr, false) s.Require().NoError(err) validatePostgresAuthToken(s, connStr) } func (s *RewriteConnectionStringForIAMSuite) TestPostgresNoPasswordSuccess() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{ Region: "us-east-1", Credentials: credentials.NewStaticCredentialsProvider("foo", "bar", "baz"), }, } connStr, err := RewriteConnectionStringForIAM("psql_rds_iam", "postgresql://user@host:5432/dbname", false) s.Require().NoError(err) validatePostgresAuthToken(s, connStr) } func (s *RewriteConnectionStringForIAMSuite) TestPostgresWithParamsSuccess() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{ Region: "us-east-1", Credentials: credentials.NewStaticCredentialsProvider("foo", "bar", "baz"), }, } connStr, err := RewriteConnectionStringForIAM("psql_rds_iam", fmt.Sprintf("%s?foo=bar", postgresConnStr), false) s.Require().NoError(err) validatePostgresAuthToken(s, connStr, "foo=bar") //s.Equal("postgresql://user:authtoken@host:5432/dbname?foo=bar", connStr) } func (s *RewriteConnectionStringForIAMSuite) TestLoadConfigError() { AwsConfigAPI = &mockAWSConfigAPI{ err: errors.New("some error"), } _, err := RewriteConnectionStringForIAM("mysql_rds_iam", mysqlConnStr, false) s.Require().Error(err) s.Contains(err.Error(), "loading AWS config") } func (s *RewriteConnectionStringForIAMSuite) TestBuildAuthTokenError() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{Region: "us-east-1"}, } _, err := RewriteConnectionStringForIAM("mysql_rds_iam", mysqlConnStr, false) s.Require().Error(err) s.Contains(err.Error(), "could not create credentials refresh store") } func (s *RewriteConnectionStringForIAMSuite) TestMySqlNoUser() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{Region: "us-east-1"}, } _, err := RewriteConnectionStringForIAM("mysql_rds_iam", ":password@tcp(host:3306)/dbname", false) s.Require().Error(err) s.Contains(err.Error(), "onnection string is missing a user") } func (s *RewriteConnectionStringForIAMSuite) TestPostgresNoUser() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{Region: "us-east-1"}, } _, err := RewriteConnectionStringForIAM("psql_rds_iam", "postgresql://:password@host:5432/dbname", false) s.Require().Error(err) s.Contains(err.Error(), "onnection string is missing a user") } func (s *RewriteConnectionStringForIAMSuite) TestUrlParseError() { AwsConfigAPI = &mockAWSConfigAPI{ cfg: aws.Config{Region: "us-east-1"}, } _, err := RewriteConnectionStringForIAM("mysql_rds_iam", "://invalid-url", false) s.Require().Error(err) s.Contains(err.Error(), "parsing connection string") } golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/sqlstore/store.go000066400000000000000000000224501511066247200273370ustar00rootroot00000000000000// Copyright 2022-2024 The Archivista Contributors // // 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. package sqlstore import ( "context" "crypto" "encoding/base64" "encoding/json" "fmt" "strings" "time" "github.com/digitorus/timestamp" "github.com/in-toto/archivista/ent" "github.com/in-toto/archivista/pkg/metadatastorage" "github.com/in-toto/archivista/pkg/metadatastorage/parserregistry" "github.com/in-toto/go-witness/cryptoutil" "github.com/in-toto/go-witness/dsse" "github.com/in-toto/go-witness/intoto" "github.com/in-toto/go-witness/policy" "github.com/sirupsen/logrus" ) // mysql has a limit of 65536 parameters in a single query. each subject has ~2 parameters [statment id and name], // so we can theoretically jam 65535/2 subjects in a single batch. but we probably want some breathing room just in case. const subjectBatchSize = 30000 // mysql has a limit of 65536 parameters in a single query. each subject has ~3 parameters [subject id, algo, value], // so we can theoretically jam 65535/3 subjects in a single batch. but we probably want some breathing room just in case. const subjectDigestBatchSize = 20000 // constant for Policy PayloadType const policyPayloadType = "https://witness.testifysec.com/policy/" type Store struct { client *ent.Client } func New(ctx context.Context, client *ent.Client) (*Store, <-chan error, error) { errCh := make(chan error) go func() { <-ctx.Done() err := client.Close() if err != nil { logrus.Errorf("error closing database: %+v", err) } close(errCh) }() if err := client.Schema.Create(ctx); err != nil { logrus.Fatalf("failed creating schema resources: %v", err) } return &Store{ client: client, }, errCh, nil } func (s *Store) withTx(ctx context.Context, fn func(tx *ent.Tx) error) error { tx, err := s.client.Tx(ctx) if err != nil { return err } if err := fn(tx); err != nil { if err := tx.Rollback(); err != nil { return fmt.Errorf("unable to rollback transaction: %w", err) } return err } if err := tx.Commit(); err != nil { return fmt.Errorf("unable to commit transaction: %w", err) } return nil } func (s *Store) storeAttestation(ctx context.Context, envelope *dsse.Envelope, gitoid string) error { payloadDigestSet, err := cryptoutil.CalculateDigestSetFromBytes(envelope.Payload, []cryptoutil.DigestValue{{Hash: crypto.SHA256}}) if err != nil { return err } payload := &intoto.Statement{} if err := json.Unmarshal(envelope.Payload, payload); err != nil { return err } predicateParser, ok := parserregistry.ParserForPredicate(payload.PredicateType) var predicateStorer metadatastorage.Storer if ok { predicateStorer, err = predicateParser(payload.Predicate) if err != nil { return fmt.Errorf("unable to parse intoto statements predicate: %w", err) } } err = s.withTx(ctx, func(tx *ent.Tx) error { dsse, err := tx.Dsse.Create(). SetPayloadType(envelope.PayloadType). SetGitoidSha256(gitoid). Save(ctx) if err != nil { return err } for _, sig := range envelope.Signatures { storedSig, err := tx.Signature.Create(). SetKeyID(sig.KeyID). SetSignature(base64.StdEncoding.EncodeToString(sig.Signature)). SetDsse(dsse). Save(ctx) if err != nil { return err } for _, timestamp := range sig.Timestamps { timestampedTime, err := timeFromTimestamp(timestamp) if err != nil { return err } _, err = tx.Timestamp.Create(). SetSignature(storedSig). SetTimestamp(timestampedTime). SetType(string(timestamp.Type)). Save(ctx) if err != nil { return err } } } for hashFn, digest := range payloadDigestSet { hashName, err := cryptoutil.HashToString(hashFn.Hash) if err != nil { return err } if _, err := tx.PayloadDigest.Create(). SetDsse(dsse). SetAlgorithm(hashName). SetValue(digest). Save(ctx); err != nil { return err } } stmt, err := tx.Statement.Create(). SetPredicate(payload.PredicateType). AddDsse(dsse). Save(ctx) if err != nil { return err } bulkSubject := make([]*ent.SubjectCreate, 0) for _, subject := range payload.Subject { bulkSubject = append(bulkSubject, tx.Subject.Create(). SetName(subject.Name). SetStatement(stmt), ) } subjects, err := batch(ctx, subjectBatchSize, bulkSubject, func(digests ...*ent.SubjectCreate) saver[*ent.Subject] { return tx.Subject.CreateBulk(digests...) }) if err != nil { return err } bulkSubjectDigests := make([]*ent.SubjectDigestCreate, 0) for i, subject := range payload.Subject { for algorithm, value := range subject.Digest { bulkSubjectDigests = append(bulkSubjectDigests, tx.SubjectDigest.Create(). SetAlgorithm(algorithm). SetValue(value). SetSubject(subjects[i]), ) } } if _, err := batch(ctx, subjectDigestBatchSize, bulkSubjectDigests, func(digests ...*ent.SubjectDigestCreate) saver[*ent.SubjectDigest] { return tx.SubjectDigest.CreateBulk(digests...) }); err != nil { return err } if predicateStorer != nil { if err := predicateStorer.Store(ctx, tx, stmt.ID); err != nil { return err } } return nil }) if err != nil { logrus.Errorf("unable to store metadata: %+v", err) return err } return nil } func (s *Store) storePolicy(ctx context.Context, envelope *dsse.Envelope, gitoid string) error { payloadDigestSet, err := cryptoutil.CalculateDigestSetFromBytes(envelope.Payload, []cryptoutil.DigestValue{{Hash: crypto.SHA256}}) if err != nil { return err } payload := &policy.Policy{} if err := json.Unmarshal(envelope.Payload, payload); err != nil { return err } custom := make(map[string]any) custom["gitoid"] = gitoid err = s.withTx(ctx, func(tx *ent.Tx) error { dsse, err := tx.Dsse.Create(). SetPayloadType(envelope.PayloadType). SetGitoidSha256(gitoid). Save(ctx) if err != nil { return err } // stores the envelope signatures for _, sig := range envelope.Signatures { storedSig, err := tx.Signature.Create(). SetKeyID(sig.KeyID). SetSignature(base64.StdEncoding.EncodeToString(sig.Signature)). SetDsse(dsse). Save(ctx) if err != nil { return err } for _, timestamp := range sig.Timestamps { timestampedTime, err := timeFromTimestamp(timestamp) if err != nil { return err } _, err = tx.Timestamp.Create(). SetSignature(storedSig). SetTimestamp(timestampedTime). SetType(string(timestamp.Type)). Save(ctx) if err != nil { return err } } } // stores the payload digests for hashFn, digest := range payloadDigestSet { hashName, err := cryptoutil.HashToString(hashFn.Hash) if err != nil { return err } if _, err := tx.PayloadDigest.Create(). SetDsse(dsse). SetAlgorithm(hashName). SetValue(digest). Save(ctx); err != nil { return err } } stmt, err := tx.Statement.Create(). SetPredicate(envelope.PayloadType). AddDsse(dsse). Save(ctx) if err != nil { return err } // stores the subject if _, err := tx.Subject.Create(). SetName(gitoid). SetStatement(stmt). Save(ctx); err != nil { return err } if _, err := tx.AttestationPolicy.Create(). SetStatement(stmt). SetName(gitoid). Save(ctx); err != nil { return err } return nil }) if err != nil { logrus.Errorf("unable to store metadata: %+v", err) return err } return nil } func (s *Store) Store(ctx context.Context, gitoid string, obj []byte) error { envelope := &dsse.Envelope{} if err := json.Unmarshal(obj, envelope); err != nil { return err } // check if the payload is a policy or an attestation if strings.Contains(envelope.PayloadType, policyPayloadType) { if err := s.storePolicy(ctx, envelope, gitoid); err != nil { return err } } else { if err := s.storeAttestation(ctx, envelope, gitoid); err != nil { return err } } return nil } func (s *Store) GetClient() *ent.Client { return s.client } type saver[T any] interface { Save(context.Context) ([]T, error) } func batch[TCreate any, TResult any](ctx context.Context, batchSize int, create []TCreate, saveFn func(...TCreate) saver[TResult]) ([]TResult, error) { results := make([]TResult, 0, len(create)) for i := 0; i < len(create); i += batchSize { var batch []TCreate if i+batchSize > len(create) { batch = create[i:] } else { batch = create[i : i+batchSize] } batchSaver := saveFn(batch...) batchResults, err := batchSaver.Save(ctx) if err != nil { return nil, err } results = append(results, batchResults...) } return results, nil } func timeFromTimestamp(ts dsse.SignatureTimestamp) (time.Time, error) { switch ts.Type { case dsse.TimestampRFC3161: tspResponse, err := timestamp.Parse(ts.Data) if err != nil { return time.Time{}, nil } return tspResponse.Time, nil default: return time.Time{}, fmt.Errorf("unknown timestamp type: %v", ts.Type) } } golang-github-in-toto-archivista-0.11.1/pkg/metadatastorage/sqlstore/utils.go000066400000000000000000000060331511066247200273420ustar00rootroot00000000000000// Copyright 2025 The Archivista Contributors // // 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. package sqlstore import ( "context" "fmt" "strconv" "strings" "github.com/go-sql-driver/mysql" "github.com/jackc/pgx/v5" "github.com/jkjell/go-db-credential-refresh/driver" "github.com/jkjell/go-db-credential-refresh/store/awsrds" ) func ConfigFromPostgres(connectionString string) (c *driver.Config, user, password string, err error) { dc := driver.Config{ Retries: 3, } dc.Formatter = driver.PgFormatter dbConfig, err := pgx.ParseConfig(connectionString) if err != nil { return nil, "", "", fmt.Errorf("could not parse postgresql connection string: %w", err) } dc.Host = dbConfig.Host dc.Port = int(dbConfig.Port) dc.DB = dbConfig.Database dc.Opts = dbConfig.RuntimeParams if dc.Opts == nil { dc.Opts = make(map[string]string) } // ParseConfig truncates sslmode param if dbConfig.TLSConfig == nil { dc.Opts["sslmode"] = "disable" } if dbConfig.User == "" { return nil, "", "", fmt.Errorf("connection string is missing a user") } return &dc, dbConfig.User, dbConfig.Password, nil } func ConfigFromMySQL(connectionString string) (c *driver.Config, user, password string, err error) { dc := driver.Config{ Retries: 3, } dc.Formatter = driver.MysqlFormatter dbConfig, err := mysql.ParseDSN(connectionString) if err != nil { return nil, "", "", fmt.Errorf("parsing connection string: %w", err) } addr := strings.Split(dbConfig.Addr, ":") dc.Host = addr[0] port, err := strconv.Atoi(addr[1]) if err != nil { return nil, "", "", fmt.Errorf("could not parse mysql port: %w", err) } dc.Port = port dc.DB = dbConfig.DBName dc.Opts = dbConfig.Params // this tells the go-sql-driver to parse times from mysql to go's time.Time // see https://github.com/go-sql-driver/mysql#timetime-support for details if dc.Opts == nil { dc.Opts = make(map[string]string) } dc.Opts["parseTime"] = "true" if dbConfig.User == "" { return nil, "", "", fmt.Errorf("connection string is missing a user") } return &dc, dbConfig.User, dbConfig.Passwd, nil } func AWSRDSStoreFromDriverConfig(dc *driver.Config, user string) (driver.Store, error) { awsConfig, err := AwsConfigAPI.LoadDefaultConfig(context.Background()) if err != nil { return nil, fmt.Errorf("problem loading AWS config: %w", err) } rdsEndpoint := fmt.Sprintf("%s:%d", dc.Host, dc.Port) config := awsrds.Config{ Credentials: awsConfig.Credentials, Endpoint: rdsEndpoint, User: user, Region: awsConfig.Region, } return awsrds.NewStore(&config) } golang-github-in-toto-archivista-0.11.1/pkg/objectstorage/000077500000000000000000000000001511066247200234635ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/objectstorage/blobstore/000077500000000000000000000000001511066247200254565ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/objectstorage/blobstore/minio.go000066400000000000000000000045041511066247200271230ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package blobstore import ( "bytes" "context" "fmt" "github.com/minio/minio-go/v7" "io" "github.com/minio/minio-go/v7/pkg/credentials" ) type Store struct { client *minio.Client bucket string location string } // PutBlob stores the attestation blob into the backend store func (store *Store) PutBlob(ctx context.Context, idx string, obj []byte) error { opt := minio.PutObjectOptions{} size := int64(len(obj)) n, err := store.client.PutObject(ctx, store.bucket, idx, bytes.NewReader(obj), size, opt) if err != nil { return fmt.Errorf("failed to put blob: %v", err) } else if n.Size != size { return fmt.Errorf("failed to upload full blob: size %d != uploaded size %d", size, n.Size) } return nil } // New returns a reader/writer for storing/retrieving attestations func New(ctx context.Context, endpoint string, creds *credentials.Credentials, bucketName string, useTLS bool) (*Store, <-chan error, error) { errCh := make(chan error) go func() { <-ctx.Done() close(errCh) }() c, err := minio.New(endpoint, &minio.Options{ Creds: creds, Secure: useTLS, }) if err != nil { return nil, errCh, err } exists, err := c.BucketExists(ctx, bucketName) if !exists || err != nil { return nil, errCh, fmt.Errorf("failed to find bucket exists: %v", err) } loc, err := c.GetBucketLocation(ctx, bucketName) if err != nil { return nil, errCh, err } return &Store{ client: c, location: loc, bucket: bucketName, }, errCh, nil } func (s *Store) Get(ctx context.Context, gitoid string) (io.ReadCloser, error) { return s.client.GetObject(ctx, s.bucket, gitoid, minio.GetObjectOptions{}) } func (s *Store) Store(ctx context.Context, gitoid string, payload []byte) error { return s.PutBlob(ctx, gitoid, payload) } golang-github-in-toto-archivista-0.11.1/pkg/objectstorage/filestore/000077500000000000000000000000001511066247200254575ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/objectstorage/filestore/file.go000066400000000000000000000036171511066247200267340ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package filestore import ( "context" "io" "log" "net/http" "os" "path/filepath" "time" "github.com/gorilla/handlers" ) type Store struct { prefix string } func New(ctx context.Context, directory string, address string) (*Store, <-chan error, error) { errCh := make(chan error) go func() { server := &http.Server{ Addr: address, Handler: handlers.CompressHandler(http.FileServer(http.Dir(directory))), ReadTimeout: 5 * time.Second, WriteTimeout: 10 * time.Second, } if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed { log.Fatalf("Could not listen on %s: %v\n", address, err) } <-ctx.Done() if err := server.Shutdown(context.Background()); err != nil { log.Fatalf("Server Shutdown Failed:%+v", err) } close(errCh) }() return &Store{ prefix: directory, }, errCh, nil } func (s *Store) Get(ctx context.Context, gitoid string) (io.ReadCloser, error) { if filepath.IsLocal(gitoid) { return os.Open(filepath.Join(s.prefix, gitoid+".json")) } else { return nil, filepath.ErrBadPattern } } func (s *Store) Store(ctx context.Context, gitoid string, payload []byte) error { if filepath.IsLocal(gitoid) { return os.WriteFile(filepath.Join(s.prefix, gitoid+".json"), payload, 0o600) } else { return filepath.ErrBadPattern } } golang-github-in-toto-archivista-0.11.1/pkg/objectstorage/filestore/file_test.go000066400000000000000000000050211511066247200277620ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package filestore_test import ( "context" "io" "os" "path/filepath" "testing" "github.com/in-toto/archivista/pkg/objectstorage/filestore" "github.com/stretchr/testify/suite" ) // Test Suite: UT FileStoreSuite type UTFileStoreSuite struct { suite.Suite tempDir string payload []byte } func TestUTFileStoreSuite(t *testing.T) { suite.Run(t, new(UTFileStoreSuite)) } func (ut *UTFileStoreSuite) SetupTest() { // Create a temporary directory for testing tempDir, err := os.MkdirTemp("", "filestore_test") if err != nil { ut.FailNow(err.Error()) } ut.tempDir = tempDir ut.payload = []byte("test payload") } func (ut *UTFileStoreSuite) TearDownTest() { os.RemoveAll(ut.tempDir) } func (ut *UTFileStoreSuite) Test_Get() { store, _, err := filestore.New(context.Background(), ut.tempDir, ":50025") if err != nil { ut.FailNow(err.Error()) } // Define a test payload payload := []byte("test payload") // Store the payload err = store.Store(context.Background(), "test_gitoid", payload) if err != nil { ut.FailNow(err.Error()) } // Attempt storing at malicious payload location err = store.Store(context.Background(), "../../test_gitoid", payload) if err != nil && err != filepath.ErrBadPattern { ut.FailNowf("Failed to detect bad path: %v", err.Error()) } // Retrieve the payload reader, err := store.Get(context.Background(), "test_gitoid") if err != nil { ut.FailNowf("Failed to retrieve payload: %v", err.Error()) } defer reader.Close() // Read the payload from the reader retrievedPayload, err := io.ReadAll(reader) if err != nil { ut.FailNowf("Failed to read payload: %v", err.Error()) } // Compare the retrieved payload with the original payload ut.Equal(string(retrievedPayload), string(payload)) // Attempt to retrieve non-local payload _, err = store.Get(context.Background(), "/etc/passwd") if err != nil && err != filepath.ErrBadPattern { ut.FailNowf("Failed to detect bad path: %v", err.Error()) } } golang-github-in-toto-archivista-0.11.1/pkg/publisherstore/000077500000000000000000000000001511066247200237025ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/publisherstore/dapr/000077500000000000000000000000001511066247200246305ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/publisherstore/dapr/http.go000066400000000000000000000044311511066247200261400ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package dapr import ( "bytes" "context" "encoding/json" "fmt" "net/http" "time" "github.com/in-toto/archivista/pkg/config" "github.com/sirupsen/logrus" ) type DaprHttp struct { Client *http.Client Host string HttpPort string PubsubComponentName string PubsubTopic string Url string } type daprPayload struct { Gitoid string Payload []byte } type Publisher interface { Publish(ctx context.Context, gitoid string, payload []byte) error } func (d *DaprHttp) Publish(ctx context.Context, gitoid string, payload []byte) error { if d.Client == nil { d.Client = &http.Client{ Timeout: 15 * time.Second, } } if d.Url == "" { d.Url = d.Host + ":" + d.HttpPort + "/v1.0/publish/" + d.PubsubComponentName + "/" + d.PubsubTopic } dp := daprPayload{ Gitoid: gitoid, Payload: payload, } // Marshal the message to JSON msgBytes, err := json.Marshal(dp) if err != nil { logrus.Error(err.Error()) return err } res, err := d.Client.Post(d.Url, "application/json", bytes.NewReader(msgBytes)) if err != nil { logrus.Error(err.Error()) return err } if res.StatusCode != http.StatusNoContent { logrus.Printf("failed to publish message: %s", res.Body) return fmt.Errorf("failed to publish message: %s", res.Body) } defer res.Body.Close() return nil } func NewPublisher(config *config.Config) Publisher { daprPublisher := &DaprHttp{ Host: config.PublisherDaprHost, HttpPort: config.PublisherDaprPort, PubsubComponentName: config.PublisherDaprComponentName, PubsubTopic: config.PublisherDaprTopic, Url: config.PublisherDaprURL, } return daprPublisher } golang-github-in-toto-archivista-0.11.1/pkg/publisherstore/publisherstore.go000066400000000000000000000027371511066247200273140ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package publisherstore import ( "context" "strings" "github.com/in-toto/archivista/pkg/config" "github.com/in-toto/archivista/pkg/publisherstore/dapr" "github.com/in-toto/archivista/pkg/publisherstore/rstuf" "github.com/sirupsen/logrus" ) type Publisher interface { Publish(ctx context.Context, gitoid string, payload []byte) error } func New(config *config.Config) []Publisher { var publisherStore []Publisher for _, pubType := range config.Publisher { pubType = strings.ToUpper(pubType) // Normalize the input switch pubType { case "DAPR": publisherStore = append(publisherStore, dapr.NewPublisher(config)) logrus.Info("Using publisher: DAPR") case "RSTUF": publisherStore = append(publisherStore, rstuf.NewPublisher(config)) logrus.Info("Using publisher: RSTUF") default: logrus.Errorf("unsupported publisher type: %s", pubType) } } return publisherStore } golang-github-in-toto-archivista-0.11.1/pkg/publisherstore/rstuf/000077500000000000000000000000001511066247200250455ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/publisherstore/rstuf/rstuf.go000066400000000000000000000063251511066247200265450ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package rstuf import ( "bytes" "context" "crypto/sha256" "encoding/hex" "encoding/json" "fmt" "io" "net/http" "net/http/httputil" "github.com/in-toto/archivista/pkg/config" "github.com/sirupsen/logrus" ) type RSTUF struct { Host string } type Publisher interface { Publish(ctx context.Context, gitoid string, payload []byte) error } func (r *RSTUF) parseRSTUFPayload(gitoid string, payload []byte) ([]byte, error) { objHash := sha256.Sum256(payload) // custom := make(map[string]any) // custom["gitoid"] = gitoid artifacts := []Artifact{ { Path: gitoid, Info: ArtifactInfo{ Length: len(payload), Hashes: Hashes{ Sha256: hex.EncodeToString(objHash[:]), }, // Custom: custom, }, }, } artifactPayload := ArtifactPayload{ Artifacts: artifacts, AddTaskIDToCustom: false, PublishTargets: true, } payloadBytes, err := json.Marshal(artifactPayload) if err != nil { return nil, fmt.Errorf("error marshaling payload: %v", err) } return payloadBytes, nil } func (r *RSTUF) Publish(ctx context.Context, gitoid string, payload []byte) error { // this publisher allows integration with the RSTUF project to store // the attestation and policy in the TUF metadata. // this TUF metadata can be used to build truste when distributing the // attestations and policies. // Convert payload to JSON url := r.Host + "/api/v1/artifacts" payloadBytes, err := r.parseRSTUFPayload(gitoid, payload) if err != nil { return fmt.Errorf("error parsing payload: %v", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(payloadBytes)) if err != nil { return fmt.Errorf("error creating request: %v", err) } req.Header.Set("Content-Type", "application/json") // Add any additional headers or authentication if needed client := &http.Client{} resp, err := client.Do(req) if err != nil { logrus.Errorf("error making request: %v", err) } defer resp.Body.Close() if resp.StatusCode != http.StatusAccepted { logb, _ := httputil.DumpResponse(resp, true) logrus.Errorf("error body from RSTUF: %v", string(logb)) return fmt.Errorf("error response from RSTUF: %v", err) } // Handle the response as needed body, err := io.ReadAll(resp.Body) if err != nil { logrus.Errorf("error reading response body: %v", err) } response := Response{} err = json.Unmarshal(body, &response) if err != nil { logrus.Errorf("error unmarshaling response: %v", err) } logrus.Debugf("RSTUF task id: %v", response.Data.TaskId) // TODO: monitor RSTUF task id for completion return nil } func NewPublisher(config *config.Config) Publisher { return &RSTUF{ Host: config.PublisherRstufHost, } } golang-github-in-toto-archivista-0.11.1/pkg/publisherstore/rstuf/structs.go000066400000000000000000000030401511066247200271000ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package rstuf // Hashes represents the Hashes structure type Hashes struct { Sha256 string `json:"sha256"` } // ArtifactInfo represents the ArtifactInfo structure type ArtifactInfo struct { Length int `json:"length"` Hashes Hashes `json:"hashes"` Custom map[string]any `json:"custom,omitempty"` } // Artifact represents the Artifact structure type Artifact struct { Path string `json:"path"` Info ArtifactInfo `json:"info"` } // ArtifactPayload represents the payload structure type ArtifactPayload struct { Artifacts []Artifact `json:"artifacts"` AddTaskIDToCustom bool `json:"add_task_id_to_custom"` PublishTargets bool `json:"publish_targets"` } type ArtifactsResponse struct { Artifacts []string `json:"artifacts"` TaskId string `json:"task_id"` LastUpdate string `json:"last_update"` Message string `json:"message"` } type Response struct { Data ArtifactsResponse `json:"data"` } golang-github-in-toto-archivista-0.11.1/pkg/server/000077500000000000000000000000001511066247200221365ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/pkg/server/server.go000066400000000000000000000347621511066247200240070ustar00rootroot00000000000000// Copyright 2022-2024 The Archivista Contributors // // 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. package server import ( "bytes" "context" "encoding/json" "errors" "fmt" "io" "net/http" "os" "path/filepath" "strconv" "strings" "entgo.io/contrib/entgql" "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/99designs/gqlgen/graphql/playground" "github.com/edwarnicke/gitoid" "github.com/gorilla/mux" "github.com/in-toto/archivista" _ "github.com/in-toto/archivista/docs" "github.com/in-toto/archivista/ent" "github.com/in-toto/archivista/pkg/api" "github.com/in-toto/archivista/pkg/artifactstore" "github.com/in-toto/archivista/pkg/config" "github.com/in-toto/archivista/pkg/publisherstore" "github.com/sirupsen/logrus" httpSwagger "github.com/swaggo/http-swagger/v2" ) type Server struct { metadataStore Storer objectStore StorerGetter artifactStore artifactstore.Store router *mux.Router sqlClient *ent.Client publisherStore []publisherstore.Publisher } type Storer interface { Store(context.Context, string, []byte) error } type Getter interface { Get(context.Context, string) (io.ReadCloser, error) } type StorerGetter interface { Storer Getter } type Option func(*Server) func WithMetadataStore(metadataStore Storer) Option { return func(s *Server) { s.metadataStore = metadataStore } } func WithObjectStore(objectStore StorerGetter) Option { return func(s *Server) { s.objectStore = objectStore } } func WithEntSqlClient(sqlClient *ent.Client) Option { return func(s *Server) { s.sqlClient = sqlClient } } func WithArtifactStore(wds artifactstore.Store) Option { return func(s *Server) { s.artifactStore = wds } } func WithPublishers(pub []publisherstore.Publisher) Option { return func(s *Server) { s.publisherStore = pub } } func New(cfg *config.Config, opts ...Option) (Server, error) { r := mux.NewRouter() s := Server{ router: r, } for _, opt := range opts { opt(&s) } // TODO: remove from future version (v0.6.0) endpoint with version r.HandleFunc("/download/{gitoid}", s.DownloadHandler) r.HandleFunc("/upload", s.UploadHandler) if cfg.EnableSQLStore && cfg.EnableGraphql { r.Handle("/query", s.Query(s.sqlClient)) r.Handle("/v1/query", s.Query(s.sqlClient)) } r.HandleFunc("/v1/download/{gitoid}", s.DownloadHandler) r.HandleFunc("/v1/upload", s.UploadHandler) if cfg.EnableSQLStore && cfg.EnableGraphql && cfg.GraphqlWebClientEnable { r.Handle("/", playground.Handler("Archivista", "/v1/query"), ) } if cfg.EnableArtifactStore { r.HandleFunc("/v1/artifacts", s.AllArtifactsHandler) r.HandleFunc("/v1/artifacts/{name}", s.ArtifactAllVersionsHandler) r.HandleFunc("/v1/artifacts/{name}/{version}", s.ArtifactVersionHandler) r.HandleFunc("/v1/download/artifact/{name}/{version}/{distribution}", s.DownloadArtifactHandler) } r.PathPrefix("/swagger/").Handler(httpSwagger.WrapHandler) return s, nil } // @title Archivista API // @description Archivista API // @version v1 // @contact.name Archivista Contributors // @contact.url https://github.com/in-toto/archivista/issues/new // @license Apache 2 // @license.url https://opensource.org/licenses/Apache-2 // InitRoutes initializes the HTTP API routes for the server func (s *Server) Router() *mux.Router { return s.router } // @Summary Upload // @Description stores an attestation // @Produce json // @Success 200 {object} api.StoreResponse // @Tags attestation // @Router /v1/upload [post] func (s *Server) Upload(ctx context.Context, r io.Reader) (api.UploadResponse, error) { payload, err := io.ReadAll(r) if err != nil { return api.UploadResponse{}, err } gid, err := gitoid.New(bytes.NewReader(payload), gitoid.WithContentLength(int64(len(payload))), gitoid.WithSha256()) if err != nil { logrus.Errorf("failed to generate gitoid: %v", err) return api.UploadResponse{}, err } if s.objectStore != nil { if err := s.objectStore.Store(ctx, gid.String(), payload); err != nil { logrus.Errorf("received error from object store: %+v", err) return api.UploadResponse{}, err } } if s.metadataStore != nil { if err := s.metadataStore.Store(ctx, gid.String(), payload); err != nil { logrus.Errorf("received error from metadata store: %+v", err) return api.UploadResponse{}, err } } if s.publisherStore != nil { for _, publisher := range s.publisherStore { // TODO: Make publish asynchrouns and use goroutine if err := publisher.Publish(ctx, gid.String(), payload); err != nil { logrus.Errorf("received error from publisher: %+v", err) } } } return api.UploadResponse{Gitoid: gid.String()}, nil } // @Summary Upload // @Description stores an attestation // @Produce json // @Success 200 {object} api.StoreResponse // @Router /upload [post] // @Deprecated func (s *Server) UploadHandler(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { http.Error(w, fmt.Sprintf("%s is an unsupported method", r.Method), http.StatusBadRequest) return } defer r.Body.Close() resp, err := s.Upload(r.Context(), r.Body) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } encoder := json.NewEncoder(w) if err := encoder.Encode(resp); err != nil { logrus.Errorf("failed to copy storeresponse to response: %+v", err) w.WriteHeader(http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") } // @Summary Download // @Description download an attestation // @Produce json // @Param gitoid path string true "gitoid" // @Success 200 {object} dsse.Envelope // @Failure 500 {object} string // @Failure 404 {object} nil // @Failure 400 {object} string // @Tags attestation // @Router /v1/download/{gitoid} [get] func (s *Server) Download(ctx context.Context, gitoid string) (io.ReadCloser, error) { if s.objectStore == nil { return nil, errors.New("object store unavailable") } objReader, err := s.objectStore.Get(ctx, gitoid) if err != nil { logrus.Errorf("failed to get object: %+v", err) } return objReader, err } // @Summary Download // @Description download an attestation // @Produce json // @Param gitoid path string true "gitoid" // @Success 200 {object} dsse.Envelope // @Failure 500 {object} string // @Failure 404 {object} nil // @Failure 400 {object} string // @Deprecated // @Router /download/{gitoid} [get] func (s *Server) DownloadHandler(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { http.Error(w, fmt.Sprintf("%s is an unsupported method", r.Method), http.StatusBadRequest) return } vars := mux.Vars(r) if vars == nil { http.Error(w, "gitoid parameter is required", http.StatusBadRequest) return } if len(strings.TrimSpace(vars["gitoid"])) == 0 { http.Error(w, "gitoid parameter is required", http.StatusBadRequest) return } attestationReader, err := s.Download(r.Context(), vars["gitoid"]) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } defer attestationReader.Close() if _, err := io.Copy(w, attestationReader); err != nil { logrus.Errorf("failed to copy attestation to response: %+v", err) w.WriteHeader(http.StatusNotFound) return } w.Header().Set("Content-Type", "application/json") } // @Summary Query GraphQL // @Description GraphQL query // @Produce json // @Success 200 {object} archivista.Resolver // @Tags graphql // @Router /v1/query [post] func (s *Server) Query(sqlclient *ent.Client) *handler.Server { srv := handler.New(archivista.NewSchema(sqlclient)) srv.AddTransport(transport.GET{}) srv.AddTransport(transport.POST{}) srv.Use(entgql.Transactioner{TxOpener: sqlclient}) return srv } // @Summary List all Artifacts // @Description retrieves details about all available Artifacts // @Produce json // @Success 200 {object} map[string]artifactstore.Artifact // @Failure 500 {object} string // @Failure 400 {object} string // @Tags Artifacts // @Router /v1/artifacts [get] func (s *Server) AllArtifactsHandler(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { http.Error(w, fmt.Sprintf("%s is an unsupported method", r.Method), http.StatusBadRequest) return } allArtifacts := s.artifactStore.Artifacts() allArtifactsJson, err := json.Marshal(allArtifacts) if err != nil { http.Error(w, fmt.Errorf("could not marshal artifact versions: %w", err).Error(), http.StatusInternalServerError) return } if _, err := io.Copy(w, bytes.NewReader(allArtifactsJson)); err != nil { http.Error(w, fmt.Errorf("could not send json response: %w", err).Error(), http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") } // @Summary List Artifact Versions // @Description retrieves details about all available versions of a specified artifact // @Produce json // @Param name path string true "artifact name" // @Success 200 {object} map[string]artifactstore.Version // @Failure 500 {object} string // @Failure 400 {object} string // @Tags Artifacts // @Router /v1/artifacts/{name} [get] func (s *Server) ArtifactAllVersionsHandler(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { http.Error(w, fmt.Sprintf("%s is an unsupported method", r.Method), http.StatusBadRequest) return } vars := mux.Vars(r) if vars == nil { http.Error(w, "name parameter is required", http.StatusBadRequest) return } artifactName := vars["name"] if len(artifactName) == 0 { http.Error(w, "name parameter is required", http.StatusBadRequest) return } artifactVersions, ok := s.artifactStore.Versions(artifactName) if !ok { http.Error(w, "artifact not found", http.StatusNotFound) return } artifactVersionsJson, err := json.Marshal(artifactVersions) if err != nil { http.Error(w, fmt.Errorf("could not marshal artifact versions: %w", err).Error(), http.StatusInternalServerError) return } if _, err := io.Copy(w, bytes.NewReader(artifactVersionsJson)); err != nil { http.Error(w, fmt.Errorf("could not send json response: %w", err).Error(), http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") } // @Summary Artifact Version Details // @Description retrieves details about a specified version of an artifact // @Produce json // @Param name path string true "artifact name" // @Param version path string true "version of artifact" // @Success 200 {object} artifactstore.Version // @Failure 500 {objecpec} string // @Failure 404 {object} nil // @Failure 400 {object} string // @Tags Artifacts // @Router /v1/artifacts/{name}/{version} [get] func (s *Server) ArtifactVersionHandler(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { http.Error(w, fmt.Sprintf("%s is an unsupported method", r.Method), http.StatusBadRequest) return } vars := mux.Vars(r) if vars == nil { http.Error(w, "name and version parameters are required", http.StatusBadRequest) return } artifactString := vars["name"] if len(artifactString) == 0 { http.Error(w, "name parameter is required", http.StatusBadRequest) return } versionString := vars["version"] if len(versionString) == 0 { http.Error(w, "version parameter is required", http.StatusBadRequest) return } version, ok := s.artifactStore.Version(artifactString, versionString) if !ok { http.Error(w, "version not found", http.StatusNotFound) return } versionJson, err := json.Marshal(version) if err != nil { http.Error(w, fmt.Errorf("could not marshal artifact distros: %w", err).Error(), http.StatusInternalServerError) return } if _, err := io.Copy(w, bytes.NewReader(versionJson)); err != nil { http.Error(w, fmt.Errorf("could not send json response: %w", err).Error(), http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") } // @Summary Download Artifact // @Description downloads a specified distribution of an artifact // @Produce octet-stream // @Param name path string true "name of artifact" // @Param version path string true "version of artifact to download" // @Param distribution path string true "distribution of artifact to download" // @Success 200 {file} octet-stream // @Failure 500 {object} string // @Failure 404 {object} nil // @Failure 400 {object} string // @Tags Artifacts // @Router /v1/download/artifact/{name}/{version}/{distribution} [get] func (s *Server) DownloadArtifactHandler(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { http.Error(w, fmt.Sprintf("%s is an unsupported method", r.Method), http.StatusBadRequest) return } vars := mux.Vars(r) if vars == nil { http.Error(w, "version and distribution parameter is required", http.StatusBadRequest) return } artifactString := vars["name"] if len(artifactString) == 0 { http.Error(w, "name parameter is required", http.StatusBadRequest) return } versionString := vars["version"] if len(versionString) == 0 { http.Error(w, "version parameter is required", http.StatusBadRequest) return } distroString := vars["distribution"] if len(distroString) == 0 { http.Error(w, "distribution parameter is required", http.StatusBadRequest) return } distro, ok := s.artifactStore.Distribution(artifactString, versionString, distroString) if !ok { http.Error(w, "distribution of artifact not found", http.StatusNotFound) return } file, err := os.Open(distro.FileLocation) if err != nil { http.Error(w, "could not read distribution file", http.StatusBadRequest) return } defer func() { if err := file.Close(); err != nil { logrus.Errorf("failed to close artifact distribution file %s: %+v", distro.FileLocation, err) } }() fileInfo, err := file.Stat() if err != nil { http.Error(w, "could not stat distribution file", http.StatusBadRequest) return } fileName := filepath.Base(distro.FileLocation) w.Header().Set("Content-Type", "application/octet-stream") w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%v", fileName)) w.Header().Set("Content-Length", strconv.FormatInt(fileInfo.Size(), 10)) if _, err := io.Copy(w, file); err != nil { http.Error(w, fmt.Errorf("could not send artifact distribution: %w", err).Error(), http.StatusInternalServerError) return } } golang-github-in-toto-archivista-0.11.1/pkg/server/server_test.go000066400000000000000000000363041511066247200250400ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. package server import ( "bytes" "context" "errors" "io" "net/http" "net/http/httptest" "os" "path/filepath" "strings" "testing" "github.com/gorilla/mux" "github.com/in-toto/archivista/pkg/api" "github.com/in-toto/archivista/pkg/artifactstore" "github.com/in-toto/archivista/pkg/config" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) // Mock StorerMock type StorerMock struct { mock.Mock Storer } func (m *StorerMock) Store(context.Context, string, []byte) error { args := m.Called() return args.Error(0) } type StorerGetterMock struct { mock.Mock StorerGetter } // Mock StorerGetter func (m *StorerGetterMock) Store(context.Context, string, []byte) error { args := m.Called() return args.Error(0) } func (m *StorerGetterMock) Get(context.Context, string) (io.ReadCloser, error) { args := m.Called() stringReader := strings.NewReader("testData") stringReadCloser := io.NopCloser(stringReader) return stringReadCloser, args.Error(0) } // Mock ResponseRecorderMock type ResponseRecorderMock struct { mock.Mock Code int HeaderMap http.Header Body *bytes.Buffer Flushed bool } func (m *ResponseRecorderMock) Write([]byte) (int, error) { args := m.Called() return args.Int(0), args.Error(1) } func (rw *ResponseRecorderMock) Header() http.Header { return http.Header{} } func (rw *ResponseRecorderMock) WriteHeader(code int) { rw.Code = code } func (rw *ResponseRecorderMock) WriteString(str string) (int, error) { return 0, nil } // Define test Suite type UTServerSuite struct { suite.Suite mockedStorer *StorerMock mockedStorerGetter *StorerGetterMock mockedResposeRecorder *ResponseRecorderMock testServer Server } func TestUTServerSuite(t *testing.T) { suite.Run(t, new(UTServerSuite)) } func (ut *UTServerSuite) SetupTest() { ut.mockedStorer = new(StorerMock) ut.mockedStorerGetter = new(StorerGetterMock) ut.mockedResposeRecorder = new(ResponseRecorderMock) ut.testServer = Server{ metadataStore: ut.mockedStorer, objectStore: ut.mockedStorerGetter, artifactStore: ut.testArtifactStore(), } } func (ut *UTServerSuite) Test_New() { cfg := new(config.Config) cfg.EnableGraphql = true cfg.GraphqlWebClientEnable = true cfg.EnableSQLStore = true var err error ut.testServer, err = New(cfg, WithMetadataStore(ut.mockedStorer), WithObjectStore(ut.mockedStorerGetter)) ut.NoError(err) ut.NotNil(ut.testServer) router := ut.testServer.Router() ut.NotNil(router) allPaths := []string{} err = router.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error { pathTemplate, err := route.GetPathTemplate() if err != nil { ut.FailNow(err.Error()) } allPaths = append(allPaths, pathTemplate) return nil }) if err != nil { ut.FailNow(err.Error()) } ut.Contains(allPaths, "/download/{gitoid}") ut.Contains(allPaths, "/upload") ut.Contains(allPaths, "/query") ut.Contains(allPaths, "/v1/download/{gitoid}") ut.Contains(allPaths, "/v1/upload") ut.Contains(allPaths, "/v1/query") ut.Contains(allPaths, "/") ut.Contains(allPaths, "/swagger/") } func (ut *UTServerSuite) Test_New_EnableGraphQL_False() { cfg := new(config.Config) cfg.EnableGraphql = false cfg.GraphqlWebClientEnable = true cfg.EnableSQLStore = true var err error ut.testServer, err = New(cfg, WithMetadataStore(ut.mockedStorer), WithObjectStore(ut.mockedStorerGetter)) ut.NoError(err) ut.NotNil(ut.testServer) router := ut.testServer.Router() ut.NotNil(router) allPaths := []string{} err = router.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error { pathTemplate, err := route.GetPathTemplate() if err != nil { ut.FailNow(err.Error()) } allPaths = append(allPaths, pathTemplate) return nil }) if err != nil { ut.FailNow(err.Error()) } ut.Contains(allPaths, "/download/{gitoid}") ut.Contains(allPaths, "/upload") ut.NotContains(allPaths, "/query") ut.Contains(allPaths, "/v1/download/{gitoid}") ut.Contains(allPaths, "/v1/upload") ut.NotContains(allPaths, "/v1/query") ut.Contains(allPaths, "/swagger/") } func (ut *UTServerSuite) Test_New_GraphqlWebClientEnable_False() { cfg := new(config.Config) cfg.EnableGraphql = true cfg.GraphqlWebClientEnable = false cfg.EnableSQLStore = true var err error ut.testServer, err = New(cfg, WithMetadataStore(ut.mockedStorer), WithObjectStore(ut.mockedStorerGetter)) ut.NoError(err) ut.NotNil(ut.testServer) router := ut.testServer.Router() ut.NotNil(router) allPaths := []string{} err = router.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error { pathTemplate, err := route.GetPathTemplate() if err != nil { ut.FailNow(err.Error()) } allPaths = append(allPaths, pathTemplate) return nil }) if err != nil { ut.FailNow(err.Error()) } ut.Contains(allPaths, "/download/{gitoid}") ut.Contains(allPaths, "/upload") ut.Contains(allPaths, "/query") ut.Contains(allPaths, "/v1/download/{gitoid}") ut.Contains(allPaths, "/v1/upload") ut.Contains(allPaths, "/v1/query") ut.NotContains(allPaths, "/") ut.Contains(allPaths, "/swagger/") } func (ut *UTServerSuite) Test_Upload() { ctx := context.TODO() r := strings.NewReader("fakeTestData") ut.mockedStorerGetter.On("Store").Return(nil) // mock Get() to return nil ut.mockedStorer.On("Store").Return(nil) // mock Store() to return nil resp, err := ut.testServer.Upload(ctx, r) ut.NoError(err) ut.NotEqual("", resp.Gitoid) } func (ut *UTServerSuite) Test_Upload_NoObjectStorage() { ctx := context.TODO() r := strings.NewReader("fakeTestData") ut.testServer.objectStore = nil ut.mockedStorer.On("Store").Return(nil) // mock Store() to return nil resp, err := ut.testServer.Upload(ctx, r) ut.NoError(err) ut.NotEqual("", resp.Gitoid) } func (ut *UTServerSuite) Test_Upload_FailedObjectStorage() { ctx := context.TODO() r := strings.NewReader("fakeTestData") ut.mockedStorerGetter.On("Store").Return(errors.New("Bad S3")) // mock Get() to return err ut.mockedStorer.On("Store").Return(nil) // mock Store() to return nil resp, err := ut.testServer.Upload(ctx, r) ut.ErrorContains(err, "Bad S3") ut.Equal(api.UploadResponse{}, resp) } func (ut *UTServerSuite) Test_Upload_FailedMetadatStprage() { ctx := context.TODO() r := strings.NewReader("fakeTestData") ut.mockedStorerGetter.On("Store").Return(nil) // mock Get() to return nil ut.mockedStorer.On("Store").Return(errors.New("Bad SQL")) // mock Store() to return err resp, err := ut.testServer.Upload(ctx, r) ut.ErrorContains(err, "Bad SQL") ut.Equal(api.UploadResponse{}, resp) } func (ut *UTServerSuite) Test_UploadHandler() { w := httptest.NewRecorder() requestBody := []byte("fakePayload") request := httptest.NewRequest(http.MethodPost, "/v1/upload", bytes.NewBuffer(requestBody)) ut.mockedStorerGetter.On("Store").Return(nil) // mock Get() to return nil ut.mockedStorer.On("Store").Return(nil) // mock Store() to return nil ut.testServer.UploadHandler(w, request) ut.Equal(http.StatusOK, w.Code) } func (ut *UTServerSuite) Test_UploadHandler_WrongMethod() { w := httptest.NewRecorder() requestBody := []byte("fakePayload") request := httptest.NewRequest(http.MethodGet, "/upload", bytes.NewBuffer(requestBody)) ut.mockedStorerGetter.On("Store").Return(nil) // mock Get() to return nil ut.mockedStorer.On("Store").Return(nil) // mock Store() to return nil ut.testServer.UploadHandler(w, request) ut.Equal(http.StatusBadRequest, w.Code) ut.Contains(w.Body.String(), "is an unsupported method") } func (ut *UTServerSuite) Test_UploadHandler_FailureUpload() { w := httptest.NewRecorder() requestBody := []byte("fakePayload") request := httptest.NewRequest(http.MethodPost, "/upload", bytes.NewBuffer(requestBody)) ut.mockedStorerGetter.On("Store").Return(errors.New("BAD S3")) // mock Get() to return nil ut.mockedStorer.On("Store").Return(nil) // mock Store() to return nil ut.testServer.UploadHandler(w, request) ut.Equal(http.StatusInternalServerError, w.Code) ut.Contains(w.Body.String(), "BAD S3") } func (ut *UTServerSuite) Test_Download() { ctx := context.TODO() ut.mockedStorerGetter.On("Get").Return(nil) // mock Get() to return nil resp, err := ut.testServer.Download(ctx, "fakeGitoid") ut.NoError(err) data, _ := io.ReadAll(resp) ut.Equal("testData", string(data)) } func (ut *UTServerSuite) Test_Download_NoObjectStorage() { ctx := context.TODO() ut.testServer.objectStore = nil _, err := ut.testServer.Download(ctx, "fakeGitoid") ut.ErrorContains(err, "object store unavailable") } func (ut *UTServerSuite) Test_Download_ObjectStorageError() { ctx := context.TODO() ut.mockedStorerGetter.On("Get").Return(errors.New("BAD S3")) // mock Get() to return nil _, err := ut.testServer.Download(ctx, "fakeGitoid") ut.ErrorContains(err, "BAD S3") } func (ut *UTServerSuite) Test_DownloadHandler() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/download", nil) request = mux.SetURLVars(request, map[string]string{"gitoid": "fakeGitoid"}) ut.mockedStorerGetter.On("Get").Return(nil) // mock Get() to return nil ut.testServer.DownloadHandler(w, request) ut.Equal(http.StatusOK, w.Code) ut.Equal("testData", w.Body.String()) } func (ut *UTServerSuite) Test_DownloadHandler_BadMethod() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodPost, "/v1/download", nil) request = mux.SetURLVars(request, map[string]string{"gitoid": "fakeGitoid"}) ut.mockedStorerGetter.On("Get").Return(nil) // mock Get() to return nil ut.testServer.DownloadHandler(w, request) ut.Equal(http.StatusBadRequest, w.Code) ut.Contains(w.Body.String(), "POST is an unsupported method") } func (ut *UTServerSuite) Test_DownloadHandler_MissingGitOID() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/download", nil) ut.mockedStorerGetter.On("Get").Return(nil) // mock Get() to return nil ut.testServer.DownloadHandler(w, request) ut.Equal(http.StatusBadRequest, w.Code) ut.Contains(w.Body.String(), "gitoid parameter is required") } func (ut *UTServerSuite) Test_DownloadHandler_GitOIDEmpty() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/download", nil) request = mux.SetURLVars(request, map[string]string{"gitoid": ""}) ut.mockedStorerGetter.On("Get").Return(nil) // mock Get() to return nil ut.testServer.DownloadHandler(w, request) ut.Equal(http.StatusBadRequest, w.Code) ut.Contains(w.Body.String(), "gitoid parameter is required") } func (ut *UTServerSuite) Test_DownloadHandler_ObjectStorageFailed() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/download", nil) request = mux.SetURLVars(request, map[string]string{"gitoid": "fakeGitoid"}) ut.mockedStorerGetter.On("Get").Return(errors.New("BAD S3")) // mock Get() to return nil ut.testServer.DownloadHandler(w, request) ut.Equal(http.StatusInternalServerError, w.Code) ut.Contains(w.Body.String(), "BAD S3") } func (ut *UTServerSuite) Test_DownloadHandler_NotFound() { request := httptest.NewRequest(http.MethodGet, "/v1/download", nil) request = mux.SetURLVars(request, map[string]string{"gitoid": "fakeGitoid"}) ut.mockedStorerGetter.On("Get").Return(nil) // mock Get() to return nil ut.mockedResposeRecorder.On("Write").Return(404, errors.New("Not Found")) ut.testServer.DownloadHandler(ut.mockedResposeRecorder, request) ut.Equal(http.StatusNotFound, ut.mockedResposeRecorder.Code) ut.Nil(ut.mockedResposeRecorder.Body) } func (ut *UTServerSuite) Test_AllArtifactsHandler() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/artifacts", nil) ut.testServer.AllArtifactsHandler(w, request) ut.Equal(http.StatusOK, w.Code) ut.Contains(w.Body.String(), "witness") ut.Contains(w.Body.String(), "v0.1.0") ut.Contains(w.Body.String(), "linux-x64") } func (ut *UTServerSuite) Test_ArtifactAllVersionsHandler() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/artifacts/witness", nil) request = mux.SetURLVars(request, map[string]string{"name": "witness"}) ut.testServer.ArtifactAllVersionsHandler(w, request) ut.Equal(http.StatusOK, w.Code) ut.Contains(w.Body.String(), "v0.1.0") ut.Contains(w.Body.String(), "linux-x64") } func (ut *UTServerSuite) Test_ArtifactVersionHandler() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/artifacts/witness/v0.1.0", nil) request = mux.SetURLVars(request, map[string]string{"name": "witness", "version": "v0.1.0"}) ut.testServer.ArtifactVersionHandler(w, request) ut.Equal(http.StatusOK, w.Code) ut.Contains(w.Body.String(), "linux-x64") } func (ut *UTServerSuite) Test_ArtifactVersionHandler_NotFound() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/artifacts/witness/v0.3.0", nil) request = mux.SetURLVars(request, map[string]string{"name": "witness", "version": "v0.3.0"}) ut.testServer.ArtifactVersionHandler(w, request) ut.Equal(http.StatusNotFound, w.Code) ut.Contains(w.Body.String(), "version not found") } func (ut *UTServerSuite) Test_DownloadArtifactHandler() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/download/artifact/witness/v0.1.0/linux-x64", nil) request = mux.SetURLVars(request, map[string]string{"name": "witness", "version": "v0.1.0", "distribution": "linux-x64"}) ut.testServer.DownloadArtifactHandler(w, request) ut.Equal(http.StatusOK, w.Code) ut.Contains(w.Body.String(), "test") } func (ut *UTServerSuite) Test_DownloadArtifactHandler_NotFound() { w := httptest.NewRecorder() request := httptest.NewRequest(http.MethodGet, "/v1/download/artifact/witness/v0.1.0/linux-arm", nil) request = mux.SetURLVars(request, map[string]string{"name": "witness", "version": "v0.1.0", "distribution": "linux-arm"}) ut.testServer.DownloadArtifactHandler(w, request) ut.Equal(http.StatusNotFound, w.Code) ut.Contains(w.Body.String(), "distribution of artifact not found") } func (ut *UTServerSuite) testArtifactStore() artifactstore.Store { testDir := ut.T().TempDir() testDistroFilePath := filepath.Join(testDir, "witness-v0.1.0-linux-x64") ut.NoError(os.WriteFile(testDistroFilePath, []byte("test"), 0644)) config := artifactstore.Config{ Artifacts: map[string]artifactstore.Artifact{ "witness": { Versions: map[string]artifactstore.Version{ "v0.1.0": { Description: "some description", Distributions: map[string]artifactstore.Distribution{ "linux-x64": { SHA256Digest: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", FileLocation: testDistroFilePath, }, }, }, }, }, }, } wds, err := artifactstore.New(artifactstore.WithConfig(config)) ut.NoError(err) return wds } golang-github-in-toto-archivista-0.11.1/pkg/server/services.go000066400000000000000000000143371511066247200243200ustar00rootroot00000000000000// Copyright 2024 The Archivista Contributors // // 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. // A note: this follows a pattern followed by network service mesh. // The pattern was copied from the Network Service Mesh Project // and modified for use here. The original code was published under the // Apache License V2. package server import ( "context" "fmt" "strings" "time" "github.com/in-toto/archivista/pkg/artifactstore" "github.com/in-toto/archivista/pkg/config" "github.com/in-toto/archivista/pkg/metadatastorage/sqlstore" "github.com/in-toto/archivista/pkg/objectstorage/blobstore" "github.com/in-toto/archivista/pkg/objectstorage/filestore" "github.com/in-toto/archivista/pkg/publisherstore" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/sirupsen/logrus" ) // Service is the interface for the Archivista service type Service interface { Setup() (Server, error) GetConfig() *config.Config GetFileStoreCh() chan error GetSQLStoreCh() chan error } // ArchivistaService is the implementation of the Archivista service type ArchivistaService struct { Ctx context.Context // context for the service Cfg *config.Config // configuration for the service (if none it uses environment variables) fileStoreCh <-chan error sqlStoreCh <-chan error } // Setup Archivista Service func (a *ArchivistaService) Setup() (*Server, error) { var ( level logrus.Level err error sqlStore *sqlstore.Store fileStore StorerGetter publisherStore []publisherstore.Publisher ) serverOpts := make([]Option, 0) startTime := time.Now() now := time.Now() if a.Cfg == nil { logrus.Infof("executing: get config from environment (time since start: %s)", time.Since(startTime)) a.Cfg = new(config.Config) if err := a.Cfg.Process(); err != nil { logrus.Fatal(err) } level, err = logrus.ParseLevel(a.Cfg.LogLevel) if err != nil { logrus.Fatalf("invalid log level %s", a.Cfg.LogLevel) } logrus.WithField("duration", time.Since(now)).Infof("completed phase: get config from environment") } else { logrus.Infof("executing: load given config (time since start: %s)", time.Since(startTime)) level, err = logrus.ParseLevel(a.Cfg.LogLevel) if err != nil { logrus.Fatalf("invalid log level %s", a.Cfg.LogLevel) } logrus.WithField("duration", time.Since(now)).Infof("completed phase: load given config") } logrus.SetLevel(level) // ******************************************************************************** logrus.Infof("executing phase: initializing storage clients (time since start: %s)", time.Since(startTime)) // ******************************************************************************** now = time.Now() fileStore, a.fileStoreCh, err = a.initObjectStore() if err != nil { logrus.Fatalf("could not create object store: %+v", err) } serverOpts = append(serverOpts, WithObjectStore(fileStore)) if a.Cfg.EnableSQLStore { entClient, err := sqlstore.NewEntClient( a.Cfg.SQLStoreBackend, a.Cfg.SQLStoreConnectionString, sqlstore.ClientWithMaxIdleConns(a.Cfg.SQLStoreMaxIdleConnections), sqlstore.ClientWithMaxOpenConns(a.Cfg.SQLStoreMaxOpenConnections), sqlstore.ClientWithConnMaxLifetime(a.Cfg.SQLStoreConnectionMaxLifetime), ) if err != nil { logrus.Fatalf("could not create ent client: %+v", err) } // Continue with the existing setup code for the SQLStore sqlStore, a.sqlStoreCh, err = sqlstore.New(context.Background(), entClient) if err != nil { logrus.Fatalf("error initializing new SQLStore: %+v", err) } serverOpts = append(serverOpts, WithMetadataStore(sqlStore)) // Add SQL client for ent sqlClient := sqlStore.GetClient() serverOpts = append(serverOpts, WithEntSqlClient(sqlClient)) } else { sqlStoreChan := make(chan error) a.sqlStoreCh = sqlStoreChan go func() { <-a.Ctx.Done() close(sqlStoreChan) }() } // initialize the artifact store if a.Cfg.EnableArtifactStore { wds, err := artifactstore.New(artifactstore.WithConfigFile(a.Cfg.ArtifactStoreConfig)) if err != nil { logrus.Fatalf("could not create the artifact store: %+v", err) } serverOpts = append(serverOpts, WithArtifactStore(wds)) } if a.Cfg.Publisher != nil { publisherStore = publisherstore.New(a.Cfg) serverOpts = append(serverOpts, WithPublishers(publisherStore)) } // Create the Archivista server with all options server, err := New(a.Cfg, serverOpts...) if err != nil { logrus.Fatalf("could not create archivista server: %+v", err) } logrus.WithField("duration", time.Since(now)).Infof("completed phase: initializing storage clients") return &server, nil } // GetFileStoreCh returns the file store channel func (a *ArchivistaService) GetFileStoreCh() <-chan error { return a.fileStoreCh } // GetSQLStoreCh returns the SQL store channel func (a *ArchivistaService) GetSQLStoreCh() <-chan error { return a.sqlStoreCh } func (a *ArchivistaService) initObjectStore() (StorerGetter, <-chan error, error) { switch strings.ToUpper(a.Cfg.StorageBackend) { case "FILE": return filestore.New(a.Ctx, a.Cfg.FileDir, a.Cfg.FileServeOn) case "BLOB": var creds *credentials.Credentials switch a.Cfg.BlobStoreCredentialType { case "IAM": creds = credentials.NewIAM("") case "ACCESS_KEY": creds = credentials.NewStaticV4(a.Cfg.BlobStoreAccessKeyId, a.Cfg.BlobStoreSecretAccessKeyId, "") default: logrus.Fatalf("invalid blob store credential type: %s", a.Cfg.BlobStoreCredentialType) } return blobstore.New( a.Ctx, a.Cfg.BlobStoreEndpoint, creds, a.Cfg.BlobStoreBucketName, a.Cfg.BlobStoreUseTLS, ) case "": errCh := make(chan error) go func() { <-a.Ctx.Done() close(errCh) }() return nil, errCh, nil default: return nil, nil, fmt.Errorf("unknown storage backend: %s", a.Cfg.StorageBackend) } } golang-github-in-toto-archivista-0.11.1/resolver.go000066400000000000000000000021441511066247200222400ustar00rootroot00000000000000// Copyright 2022 The Archivista Contributors // // 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. package archivista // This file will not be regenerated automatically. // // It serves as dependency injection for your app, add any dependencies you require here. import ( "github.com/99designs/gqlgen/graphql" "github.com/in-toto/archivista/ent" ) // Resolver is the resolver root. type Resolver struct{ client *ent.Client } // NewSchema creates a graphql executable schema. func NewSchema(client *ent.Client) graphql.ExecutableSchema { return NewExecutableSchema(Config{ Resolvers: &Resolver{client}, }) } golang-github-in-toto-archivista-0.11.1/test/000077500000000000000000000000001511066247200210265ustar00rootroot00000000000000golang-github-in-toto-archivista-0.11.1/test/build.attestation.json000066400000000000000000000311251511066247200253600ustar00rootroot00000000000000{"payload":"eyJfdHlwZSI6Imh0dHBzOi8vaW4tdG90by5pby9TdGF0ZW1lbnQvdjAuMSIsInN1YmplY3QiOlt7Im5hbWUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9wcm9kdWN0L3YwLjEvZmlsZTp0ZXN0YXBwIiwiZGlnZXN0Ijp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTo4NWUzYTAyM2M5N2M4YWFkYWNlMmQ4Yzk1OTUzNWFiZmZiZjRlMTc1IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiNDIzZGE0Y2ZmMTk4YmJmZmJlMzIyMGVkOTUxMGQzMmJhOTY2OThlNGIxZjY1NDU1MjUyMWQxZjU0MWFiYjZkYyJ9fSx7Im5hbWUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9naXQvdjAuMS9jb21taXRoYXNoOmJlMjAxMDBhZjYwMmM3ODBkZWVlZjUwYzU0ZjUzMzg2NjJjZTkxN2MiLCJkaWdlc3QiOnsic2hhMSI6ImJlMjAxMDBhZjYwMmM3ODBkZWVlZjUwYzU0ZjUzMzg2NjJjZTkxN2MifX0seyJuYW1lIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvZ2l0L3YwLjEvYXV0aG9yZW1haWw6c255ay1ib3RAc255ay5pbyIsImRpZ2VzdCI6eyJzaGEyNTYiOiJlZTQ4MzY5YmU2MDcyYzFhNDliYTUxOWIyZWVmOTI3MjIzNWIwZDkyNWE2ZTdhMzM4ZjdmZmMxMmEyY2E1MzhlIn19LHsibmFtZSI6Imh0dHBzOi8vd2l0bmVzcy5kZXYvYXR0ZXN0YXRpb25zL2dpdC92MC4xL2NvbW1pdHRlcmVtYWlsOm1zd2lmdEBtc3dpZnQuZGV2IiwiZGlnZXN0Ijp7InNoYTI1NiI6IjQwODQwNGU3YTY2YjQ3MWU1NjMwZTgwMWM5M2FmNjZmYjljYjAxNzcxOTgyYWU5MGI2Zjc1NWUxMDQyODE4ODcifX0seyJuYW1lIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvZ2l0L3YwLjEvcGFyZW50aGFzaDphYTM1YzFmNGIxZDQxYzg3ZTEzOWMyZDMzM2YwOTExN2ZkMGRhZjRmIiwiZGlnZXN0Ijp7InNoYTI1NiI6IjBiYzEzNmY1NTA5ZTk2ZmM4YWEyOTBmMTc1NDI4ZDY0M2EwZTY1ZDhlNmI2MTU4NmFkNjBlOWVjOTgzYTMzNzAifX1dLCJwcmVkaWNhdGVUeXBlIjoiaHR0cHM6Ly93aXRuZXNzLnRlc3RpZnlzZWMuY29tL2F0dGVzdGF0aW9uLWNvbGxlY3Rpb24vdjAuMSIsInByZWRpY2F0ZSI6eyJuYW1lIjoiYnVpbGQiLCJhdHRlc3RhdGlvbnMiOlt7InR5cGUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9lbnZpcm9ubWVudC92MC4xIiwiYXR0ZXN0YXRpb24iOnsib3MiOiJkYXJ3aW4iLCJob3N0bmFtZSI6Ik1pa2hhaWxzLU1hY0Jvb2stUHJvLTIubG9jYWwiLCJ1c2VybmFtZSI6Im1zd2lmdCIsInZhcmlhYmxlcyI6eyJDT0xPUlRFUk0iOiJ0cnVlY29sb3IiLCJDT01NQU5EX01PREUiOiJ1bml4MjAwMyIsIkdJVF9BU0tQQVNTIjoiL0FwcGxpY2F0aW9ucy9WaXN1YWwgU3R1ZGlvIENvZGUuYXBwL0NvbnRlbnRzL1Jlc291cmNlcy9hcHAvZXh0ZW5zaW9ucy9naXQvZGlzdC9hc2twYXNzLnNoIiwiR1BHX1RUWSI6Ii9kZXYvdHR5czAwOCIsIkhPTUUiOiIvVXNlcnMvbXN3aWZ0IiwiSE9NRUJSRVdfQ0VMTEFSIjoiL29wdC9ob21lYnJldy9DZWxsYXIiLCJIT01FQlJFV19QUkVGSVgiOiIvb3B0L2hvbWVicmV3IiwiSE9NRUJSRVdfUkVQT1NJVE9SWSI6Ii9vcHQvaG9tZWJyZXciLCJJTkZPUEFUSCI6Ii9vcHQvaG9tZWJyZXcvc2hhcmUvaW5mbzovb3B0L2hvbWVicmV3L3NoYXJlL2luZm86IiwiTEFORyI6ImVuX1VTLlVURi04IiwiTE9HTkFNRSI6Im1zd2lmdCIsIkxhdW5jaEluc3RhbmNlSUQiOiJFQjJBN0EwOC1GRjMwLTRBRkMtOTNCQy1GM0I0MjdDRjE4MTQiLCJNQU5QQVRIIjoiL29wdC9ob21lYnJldy9zaGFyZS9tYW46L3Vzci9zaGFyZS9tYW46L3Vzci9sb2NhbC9zaGFyZS9tYW46L29wdC9ob21lYnJldy9zaGFyZS9tYW46OiIsIk1hbGxvY05hbm9ab25lIjoiMCIsIk9SSUdJTkFMX1hER19DVVJSRU5UX0RFU0tUT1AiOiJ1bmRlZmluZWQiLCJQOUtfU1NIIjoiMCIsIlA5S19UVFkiOiJvbGQiLCJQQVRIIjoiL1VzZXJzL21zd2lmdC9nb29nbGUtY2xvdWQtc2RrL2Jpbjovb3B0L2hvbWVicmV3L2Jpbjovb3B0L2hvbWVicmV3L3NiaW46L3Vzci9sb2NhbC9iaW46L1N5c3RlbS9DcnlwdGV4ZXMvQXBwL3Vzci9iaW46L3Vzci9iaW46L2JpbjovdXNyL3NiaW46L3NiaW46L3Zhci9ydW4vY29tLmFwcGxlLnNlY3VyaXR5LmNyeXB0ZXhkL2NvZGV4LnN5c3RlbS9ib290c3RyYXAvdXNyL2xvY2FsL2JpbjovdmFyL3J1bi9jb20uYXBwbGUuc2VjdXJpdHkuY3J5cHRleGQvY29kZXguc3lzdGVtL2Jvb3RzdHJhcC91c3IvYmluOi92YXIvcnVuL2NvbS5hcHBsZS5zZWN1cml0eS5jcnlwdGV4ZC9jb2RleC5zeXN0ZW0vYm9vdHN0cmFwL3Vzci9hcHBsZWludGVybmFsL2JpbjovVXNlcnMvbXN3aWZ0L2dvb2dsZS1jbG91ZC1zZGsvYmluOi9vcHQvaG9tZWJyZXcvYmluOi9vcHQvaG9tZWJyZXcvc2JpbjovVXNlcnMvbXN3aWZ0L2dvL2JpbjovVXNlcnMvbXN3aWZ0L2dvL2JpbiIsIlBXRCI6Ii9Vc2Vycy9tc3dpZnQvV29ya3NwYWNlcy93aXRuZXNzL3Rlc3QiLCJTRUNVUklUWVNFU1NJT05JRCI6IjE4NmM5IiwiU0hFTEwiOiIvYmluL3pzaCIsIlNITFZMIjoiMiIsIlNTSF9BVVRIX1NPQ0siOiIvVXNlcnMvbXN3aWZ0Ly5nbnVwZy9TLmdwZy1hZ2VudC5zc2giLCJURVJNIjoieHRlcm0tMjU2Y29sb3IiLCJURVJNX1BST0dSQU0iOiJ2c2NvZGUiLCJURVJNX1BST0dSQU1fVkVSU0lPTiI6IjEuODIuMCIsIlRNUERJUiI6Ii92YXIvZm9sZGVycy82ay9mcnFsczI3bjJ6djR6NTFqNTVubmt4ZncwMDAwZ24vVC8iLCJVU0VSIjoibXN3aWZ0IiwiVVNFUl9aRE9URElSIjoiL1VzZXJzL21zd2lmdCIsIlVTRV9HS0VfR0NMT1VEX0FVVEhfUExVR0lOIjoiVHJ1ZSIsIlZTQ09ERV9HSVRfQVNLUEFTU19FWFRSQV9BUkdTIjoiLS1tcy1lbmFibGUtZWxlY3Ryb24tcnVuLWFzLW5vZGUiLCJWU0NPREVfR0lUX0FTS1BBU1NfTUFJTiI6Ii9BcHBsaWNhdGlvbnMvVmlzdWFsIFN0dWRpbyBDb2RlLmFwcC9Db250ZW50cy9SZXNvdXJjZXMvYXBwL2V4dGVuc2lvbnMvZ2l0L2Rpc3QvYXNrcGFzcy1tYWluLmpzIiwiVlNDT0RFX0dJVF9BU0tQQVNTX05PREUiOiIvQXBwbGljYXRpb25zL1Zpc3VhbCBTdHVkaW8gQ29kZS5hcHAvQ29udGVudHMvRnJhbWV3b3Jrcy9Db2RlIEhlbHBlciAoUGx1Z2luKS5hcHAvQ29udGVudHMvTWFjT1MvQ29kZSBIZWxwZXIgKFBsdWdpbikiLCJWU0NPREVfR0lUX0lQQ19IQU5ETEUiOiIvdmFyL2ZvbGRlcnMvNmsvZnJxbHMyN24yenY0ejUxajU1bm5reGZ3MDAwMGduL1QvdnNjb2RlLWdpdC0xMTg5NTBkNzIzLnNvY2siLCJWU0NPREVfSU5KRUNUSU9OIjoiMSIsIlhQQ19GTEFHUyI6IjB4MCIsIlhQQ19TRVJWSUNFX05BTUUiOiIwIiwiWkRPVERJUiI6Ii9Vc2Vycy9tc3dpZnQiLCJfIjoiLi4vYmluL3dpdG5lc3MiLCJfUDlLX1RUWSI6Ii9kZXYvdHR5czAwOCIsIl9fQ0ZCdW5kbGVJZGVudGlmaWVyIjoiY29tLm1pY3Jvc29mdC5WU0NvZGUiLCJfX0NGX1VTRVJfVEVYVF9FTkNPRElORyI6IjB4MUY1OjB4MDoweDAifX0sInN0YXJ0dGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDcuMzI2MjUtMDU6MDAiLCJlbmR0aW1lIjoiMjAyMy0wOS0yNlQxNzoyMzo0Ny4zMjc1NDEtMDU6MDAifSx7InR5cGUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9naXQvdjAuMSIsImF0dGVzdGF0aW9uIjp7ImNvbW1pdGhhc2giOiJiZTIwMTAwYWY2MDJjNzgwZGVlZWY1MGM1NGY1MzM4NjYyY2U5MTdjIiwiYXV0aG9yIjoic255ay1ib3QiLCJhdXRob3JlbWFpbCI6InNueWstYm90QHNueWsuaW8iLCJjb21taXR0ZXJuYW1lIjoiTWlraGFpbCBTd2lmdCIsImNvbW1pdHRlcmVtYWlsIjoibXN3aWZ0QG1zd2lmdC5kZXYiLCJjb21taXRkYXRlIjoiMjAyMy0wNy0xOCAxNjoxMDowNiArMDAwMCArMDAwMCIsImNvbW1pdG1lc3NhZ2UiOiJmaXg6IGRldi9Eb2NrZXJmaWxlLmdvLWJ1aWxkZXIgdG8gcmVkdWNlIHZ1bG5lcmFiaWxpdGllc1xuXG5UaGUgZm9sbG93aW5nIHZ1bG5lcmFiaWxpdGllcyBhcmUgZml4ZWQgd2l0aCBhbiB1cGdyYWRlOlxuLSBodHRwczovL3NueWsuaW8vdnVsbi9TTllLLURFQklBTjExLUFQUi0zMjYxMTA1XG4tIGh0dHBzOi8vc255ay5pby92dWxuL1NOWUstREVCSUFOMTEtT1BFTlNTTC0zMzY4NzM1XG4tIGh0dHBzOi8vc255ay5pby92dWxuL1NOWUstREVCSUFOMTEtT1BFTlNTTC01MjkxNzczXG4tIGh0dHBzOi8vc255ay5pby92dWxuL1NOWUstREVCSUFOMTEtT1BFTlNTTC01MjkxNzc3XG4tIGh0dHBzOi8vc255ay5pby92dWxuL1NOWUstREVCSUFOMTEtT1BFTlNTTC01NjYxNTY2Iiwic3RhdHVzIjp7Ii52c2NvZGUvbGF1bmNoLmpzb24iOnsic3RhZ2luZyI6InVudHJhY2tlZCIsIndvcmt0cmVlIjoidW50cmFja2VkIn0sInRlc3QvdGVzdC55YW1sIjp7InN0YWdpbmciOiJ1bm1vZGlmaWVkIiwid29ya3RyZWUiOiJtb2RpZmllZCJ9fSwiY29tbWl0ZGlnZXN0Ijp7InNoYTEiOiJiZTIwMTAwYWY2MDJjNzgwZGVlZWY1MGM1NGY1MzM4NjYyY2U5MTdjIn0sInBhcmVudGhhc2hlcyI6WyJhYTM1YzFmNGIxZDQxYzg3ZTEzOWMyZDMzM2YwOTExN2ZkMGRhZjRmIl0sInRyZWVoYXNoIjoiOWUwNzY1YjY1NzlhYzdjMTRhNDA2MGFiZGJjYzFkMDliYTUwODA0ZCIsInJlZnMiOlsicmVmcy9oZWFkcy9tYWluIiwicmVmcy9yZW1vdGVzL29yaWdpbi9tYWluIl19LCJzdGFydHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjQ3LjMyNzU1NC0wNTowMCIsImVuZHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjQ3Ljg3NjQzMy0wNTowMCJ9LHsidHlwZSI6Imh0dHBzOi8vd2l0bmVzcy5kZXYvYXR0ZXN0YXRpb25zL21hdGVyaWFsL3YwLjEiLCJhdHRlc3RhdGlvbiI6eyIuZ2l0aWdub3JlIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTplYTEyNmQ4Yjk0Y2YxYTZkZWE1ZDk1MmExNTgwYjlmMTQxY2RhYjdlIiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiZWJmM2E3M2E0MmVkMjAxMmRiMGJlMmI5ZTc3ZjllNTNkNzNhMGEwYWUyMjA4MWE1ZmM1ZGYyMzI2ZjlhZmJhYiJ9LCJidWlsZC5hdHRlc3RhdGlvbi5qc29uIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTplNjlkZTI5YmIyZDFkNjQzNGI4YjI5YWU3NzVhZDhjMmU0OGM1MzkxIiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiZTNiMGM0NDI5OGZjMWMxNDlhZmJmNGM4OTk2ZmI5MjQyN2FlNDFlNDY0OWI5MzRjYTQ5NTk5MWI3ODUyYjg1NSJ9LCJjb21tb24uc2giOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjNjMzI4ZmI3ZjMxZDFjNDM0M2VmNzk3NTU2MTkyMDVhMTU2OTdhNjAiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiI2OGY0OWI0NzVlNzA4ZjUxZmQ3ZjI3Njg3MTFmZWUyZTZjODU4ZTk0YTQ0ZmRmOGE2YzViZjMzYjZhOTc2MTYyIn0sImZhaWxrZXkucGVtIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTo3YzVlYzQzYjc4YTM4ODI4ZDY5YTNhNTc3YzVlZTYzOGZlN2E0Mzc1IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiMDkzZjBmOGM1OTIyYTJmNjZjZmI0NzM3YTUwMDdiMTk3YjM2ZjAxOWE0N2QxMWEwMGE5NTc3YWQ4ZmUyODhhOSJ9LCJtYWluLmdvIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTpkZTMzMWY5ODk5MmY5MzI2YjYyZTJiZDcyZDdmNGVmODFkZjkxYjQ2IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiMzEwZTVjZTI2N2E2NGRkMGNjYzYzNDFhNmYwNDNkNWE3ZDU5ZDU3YWNiMTBmMzFmYzExYzJmNTRjOTQ4NTRkMyJ9LCJwb2xpY3ktc2lnbmVkLmpzb24iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjkxYjIyNWUxY2YwZDI4MzUyYWFiM2M4ZDU0MDBlYzQ2MzVhMTdiOGUiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiJjYWZiNDgzZmUzNTg4YjllNzNjMzJmZDM4MmZiNDY3OTNhZjkwMjE5MGI2ZTljODIyODYyMTRkMmNjNmFjYjg0In0sInBvbGljeS5qc29uIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMToyNDMzNDQyMjAxMDQxZjQ2NmY5MjFmNWJhNzQyODUxZjVkMGRhY2E0IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiY2M3ZDU1YzgzZDQ2YTY2YzlkNmI2MTJmZGQ2MTUxNmM5ZTJkYmQxMzMwMTE5NDEyZmFkNDFmOWNlZWE3ZTg0ZiJ9LCJ0ZXN0LW9jaS5zaCI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6Zjg0OTM4ODJjNTA3NGU3ZGI4MWViMDYyZTRmOGFkNzdjNWFiOTZjNCIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjFmYjA2ZjJmZGY2Mzc4ZmMxOWM3M2E2ZDA2ZDNjYWFlNzkwYjMyYmM4MjMxYmM2OWUzODUzZGI0ZjI3YmY1MDMifSwidGVzdC5zaCI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6OGFhZmNkZWVkOGMyNzY4NGEzNmU0YmViNjNhMjBkMDk0M2MwZWM3MiIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjkzNGYzNmYzYTliMzlhOWExMzY4NjQzNWMzNWMxMDkwY2QyZGI5YmJkMGZjOTYzNDg4MTUyOTIzMDU5MTBmZTMifSwidGVzdC55YW1sIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTo4M2I3NjlmY2M3MDU1YWY2ZWVhZDg0MzI0M2E2YjExYTFhNzY1ZmQ1IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiNDhjNzQ5MmE0OGM3YjhlYzhmMWFlYzUwODEwNzEzZTI0MzcxMzFkYTkzYjI5ZjkxYzdhZTFhYjk4YzVkNWE0MCJ9LCJ0ZXN0a2V5LnBlbSI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6ZmFjZWRjZDc4MmY4MDY1MzQzZmQ5N2JjYzFkZjlkYWJhMGY5MGNjYSIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjE3OTAyZDI5MjVhOWU5NDQ0MTVhZjczN2VhMGNkZmQ5NmEzZWZiYmVjYzMxZjU5YmRiODUzNTcyNGExMjU2ZmMifSwidGVzdGtleTIucGVtIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTpkMmM5MTlmNDNjY2FjZWFiNzdlNWRiYzcxYzFiODU3OTRjODYyYzkwIiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiM2E2ZjM5ZDc2MWZkMGU5YWE0NDE3YzUwYTA3ZjlmNGQ3YjI5YjFhYzQzMGEwMTY4N2I2ODQwMGMyYjk2ODgwMyJ9LCJ0ZXN0cHViLnBlbSI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6OWI0YmVhOTA4Y2Q3ZmMyMzFjNDllYzhkYjRlNWJkZGJjODE0MDMxZiIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6ImI5N2YwZmI0MGJiNzQ5ZjVlNmE1NWU1ODhlODAwZmZlYTNmMWVjNjM2NjVhZjgxOTlhZWJhNDQ3MmFiNDUzMjcifSwidGVzdHB1YjIucGVtIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMToxZGMzZjhjODYyNGQ5OGE2OWJhNDc3Yzc5ZmEyZWI1Yzg3NDA4Y2I3IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiNWU4YzU3ZGY4YWU1OGZlOWEyOWIyOWY5OTkzZTJmYzNiMjViZDc1ZWIyNzU0ZjM1Mzg4MGJhZDRiOWViZmRiMyJ9fSwic3RhcnR0aW1lIjoiMjAyMy0wOS0yNlQxNzoyMzo0Ny44NzY0NTUtMDU6MDAiLCJlbmR0aW1lIjoiMjAyMy0wOS0yNlQxNzoyMzo0Ny44NzY5MDMtMDU6MDAifSx7InR5cGUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9jb21tYW5kLXJ1bi92MC4xIiwiYXR0ZXN0YXRpb24iOnsiY21kIjpbImdvIiwiYnVpbGQiLCItbz10ZXN0YXBwIiwiLiJdLCJleGl0Y29kZSI6MH0sInN0YXJ0dGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDcuODc2OTEyLTA1OjAwIiwiZW5kdGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDguMDczOTE3LTA1OjAwIn0seyJ0eXBlIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvcHJvZHVjdC92MC4xIiwiYXR0ZXN0YXRpb24iOnsidGVzdGFwcCI6eyJtaW1lX3R5cGUiOiJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iLCJkaWdlc3QiOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjg1ZTNhMDIzYzk3YzhhYWRhY2UyZDhjOTU5NTM1YWJmZmJmNGUxNzUiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiI0MjNkYTRjZmYxOThiYmZmYmUzMjIwZWQ5NTEwZDMyYmE5NjY5OGU0YjFmNjU0NTUyNTIxZDFmNTQxYWJiNmRjIn19fSwic3RhcnR0aW1lIjoiMjAyMy0wOS0yNlQxNzoyMzo0OC4wNzQwMTQtMDU6MDAiLCJlbmR0aW1lIjoiMjAyMy0wOS0yNlQxNzoyMzo0OC4wNzg0MzMtMDU6MDAifV19fQ==","payloadType":"application/vnd.in-toto+json","signatures":[{"keyid":"ae2dcc989ea9c109a36e8eba5c4bc16d8fafcfe8e1a614164670d50aedacd647","sig":"ahsjnNBEVNqo5/umfwQzWiVAvLx4yk3z6Xh+fsaWyxhmGD1syhOhMOkXapmVvEuscm6la9a/edQKNXXg02ghCw=="}]} golang-github-in-toto-archivista-0.11.1/test/deploy-services.sh000077500000000000000000000037651511066247200245150ustar00rootroot00000000000000#!/usr/bin/env bash # Copyright 2023 The Archivista Contributors # # 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. set -e DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" checkprograms() { local result=0 for prog in "$@" do if ! command -v "$prog" > /dev/null; then print "$prog is required to run this script. please ensure it is installed and in your PATH\n" result=1 fi done return $result } waitForArchivista() { echo "Waiting for archivista to be ready..." for attempt in $(seq 1 6); do sleep 10 local archivistastate archivistastate=$(docker compose -f "$DIR/../compose.yml" ps archivista --format json | jq -r '.State') if [ "$archivistastate" == "running" ]; then break fi if [[ attempt -eq 6 ]]; then echo "timed out waiting for archivista" docker compose logs exit 1 fi done } if ! checkprograms docker jq ; then exit 1 fi startMySQL() { echo "Test mysql..." docker compose -f "$DIR/../compose.yml" up --build -d waitForArchivista } startPgSQL(){ echo "Test psql..." docker compose -f "$DIR/../compose.yml" -f "$DIR/../compose-psql.yml" up --build -d waitForArchivista } stopServices() { docker compose -f "$DIR/../compose.yml" -f "$DIR/../compose-psql.yml" down -v } case $1 in start-mysql) startMySQL waitForArchivista ;; start-pgsql) startPgSQL waitForArchivista ;; stop) stopServices ;; *) echo "Wrong option. Use $0 start-mysql|start-pgsql|stop" ;; esac golang-github-in-toto-archivista-0.11.1/test/fail.attestation.json000066400000000000000000000322611511066247200251760ustar00rootroot00000000000000{"payload":"eyJfdHlwZSI6Imh0dHBzOi8vaW4tdG90by5pby9TdGF0ZW1lbnQvdjAuMSIsInN1YmplY3QiOlt7Im5hbWUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9naXQvdjAuMS9wYXJlbnRoYXNoOmFhMzVjMWY0YjFkNDFjODdlMTM5YzJkMzMzZjA5MTE3ZmQwZGFmNGYiLCJkaWdlc3QiOnsic2hhMjU2IjoiMGJjMTM2ZjU1MDllOTZmYzhhYTI5MGYxNzU0MjhkNjQzYTBlNjVkOGU2YjYxNTg2YWQ2MGU5ZWM5ODNhMzM3MCJ9fSx7Im5hbWUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9naXQvdjAuMS9jb21taXRoYXNoOmJlMjAxMDBhZjYwMmM3ODBkZWVlZjUwYzU0ZjUzMzg2NjJjZTkxN2MiLCJkaWdlc3QiOnsic2hhMSI6ImJlMjAxMDBhZjYwMmM3ODBkZWVlZjUwYzU0ZjUzMzg2NjJjZTkxN2MifX0seyJuYW1lIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvZ2l0L3YwLjEvYXV0aG9yZW1haWw6c255ay1ib3RAc255ay5pbyIsImRpZ2VzdCI6eyJzaGEyNTYiOiJlZTQ4MzY5YmU2MDcyYzFhNDliYTUxOWIyZWVmOTI3MjIzNWIwZDkyNWE2ZTdhMzM4ZjdmZmMxMmEyY2E1MzhlIn19LHsibmFtZSI6Imh0dHBzOi8vd2l0bmVzcy5kZXYvYXR0ZXN0YXRpb25zL2dpdC92MC4xL2NvbW1pdHRlcmVtYWlsOm1zd2lmdEBtc3dpZnQuZGV2IiwiZGlnZXN0Ijp7InNoYTI1NiI6IjQwODQwNGU3YTY2YjQ3MWU1NjMwZTgwMWM5M2FmNjZmYjljYjAxNzcxOTgyYWU5MGI2Zjc1NWUxMDQyODE4ODcifX1dLCJwcmVkaWNhdGVUeXBlIjoiaHR0cHM6Ly93aXRuZXNzLnRlc3RpZnlzZWMuY29tL2F0dGVzdGF0aW9uLWNvbGxlY3Rpb24vdjAuMSIsInByZWRpY2F0ZSI6eyJuYW1lIjoiYnVpbGQiLCJhdHRlc3RhdGlvbnMiOlt7InR5cGUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9lbnZpcm9ubWVudC92MC4xIiwiYXR0ZXN0YXRpb24iOnsib3MiOiJkYXJ3aW4iLCJob3N0bmFtZSI6Ik1pa2hhaWxzLU1hY0Jvb2stUHJvLTIubG9jYWwiLCJ1c2VybmFtZSI6Im1zd2lmdCIsInZhcmlhYmxlcyI6eyJDT0xPUlRFUk0iOiJ0cnVlY29sb3IiLCJDT01NQU5EX01PREUiOiJ1bml4MjAwMyIsIkdJVF9BU0tQQVNTIjoiL0FwcGxpY2F0aW9ucy9WaXN1YWwgU3R1ZGlvIENvZGUuYXBwL0NvbnRlbnRzL1Jlc291cmNlcy9hcHAvZXh0ZW5zaW9ucy9naXQvZGlzdC9hc2twYXNzLnNoIiwiR1BHX1RUWSI6Ii9kZXYvdHR5czAwOCIsIkhPTUUiOiIvVXNlcnMvbXN3aWZ0IiwiSE9NRUJSRVdfQ0VMTEFSIjoiL29wdC9ob21lYnJldy9DZWxsYXIiLCJIT01FQlJFV19QUkVGSVgiOiIvb3B0L2hvbWVicmV3IiwiSE9NRUJSRVdfUkVQT1NJVE9SWSI6Ii9vcHQvaG9tZWJyZXciLCJJTkZPUEFUSCI6Ii9vcHQvaG9tZWJyZXcvc2hhcmUvaW5mbzovb3B0L2hvbWVicmV3L3NoYXJlL2luZm86IiwiTEFORyI6ImVuX1VTLlVURi04IiwiTE9HTkFNRSI6Im1zd2lmdCIsIkxhdW5jaEluc3RhbmNlSUQiOiJFQjJBN0EwOC1GRjMwLTRBRkMtOTNCQy1GM0I0MjdDRjE4MTQiLCJNQU5QQVRIIjoiL29wdC9ob21lYnJldy9zaGFyZS9tYW46L3Vzci9zaGFyZS9tYW46L3Vzci9sb2NhbC9zaGFyZS9tYW46L29wdC9ob21lYnJldy9zaGFyZS9tYW46OiIsIk1hbGxvY05hbm9ab25lIjoiMCIsIk9SSUdJTkFMX1hER19DVVJSRU5UX0RFU0tUT1AiOiJ1bmRlZmluZWQiLCJQOUtfU1NIIjoiMCIsIlA5S19UVFkiOiJvbGQiLCJQQVRIIjoiL1VzZXJzL21zd2lmdC9nb29nbGUtY2xvdWQtc2RrL2Jpbjovb3B0L2hvbWVicmV3L2Jpbjovb3B0L2hvbWVicmV3L3NiaW46L3Vzci9sb2NhbC9iaW46L1N5c3RlbS9DcnlwdGV4ZXMvQXBwL3Vzci9iaW46L3Vzci9iaW46L2JpbjovdXNyL3NiaW46L3NiaW46L3Zhci9ydW4vY29tLmFwcGxlLnNlY3VyaXR5LmNyeXB0ZXhkL2NvZGV4LnN5c3RlbS9ib290c3RyYXAvdXNyL2xvY2FsL2JpbjovdmFyL3J1bi9jb20uYXBwbGUuc2VjdXJpdHkuY3J5cHRleGQvY29kZXguc3lzdGVtL2Jvb3RzdHJhcC91c3IvYmluOi92YXIvcnVuL2NvbS5hcHBsZS5zZWN1cml0eS5jcnlwdGV4ZC9jb2RleC5zeXN0ZW0vYm9vdHN0cmFwL3Vzci9hcHBsZWludGVybmFsL2JpbjovVXNlcnMvbXN3aWZ0L2dvb2dsZS1jbG91ZC1zZGsvYmluOi9vcHQvaG9tZWJyZXcvYmluOi9vcHQvaG9tZWJyZXcvc2JpbjovVXNlcnMvbXN3aWZ0L2dvL2JpbjovVXNlcnMvbXN3aWZ0L2dvL2JpbiIsIlBXRCI6Ii9Vc2Vycy9tc3dpZnQvV29ya3NwYWNlcy93aXRuZXNzL3Rlc3QiLCJTRUNVUklUWVNFU1NJT05JRCI6IjE4NmM5IiwiU0hFTEwiOiIvYmluL3pzaCIsIlNITFZMIjoiMiIsIlNTSF9BVVRIX1NPQ0siOiIvVXNlcnMvbXN3aWZ0Ly5nbnVwZy9TLmdwZy1hZ2VudC5zc2giLCJURVJNIjoieHRlcm0tMjU2Y29sb3IiLCJURVJNX1BST0dSQU0iOiJ2c2NvZGUiLCJURVJNX1BST0dSQU1fVkVSU0lPTiI6IjEuODIuMCIsIlRNUERJUiI6Ii92YXIvZm9sZGVycy82ay9mcnFsczI3bjJ6djR6NTFqNTVubmt4ZncwMDAwZ24vVC8iLCJVU0VSIjoibXN3aWZ0IiwiVVNFUl9aRE9URElSIjoiL1VzZXJzL21zd2lmdCIsIlVTRV9HS0VfR0NMT1VEX0FVVEhfUExVR0lOIjoiVHJ1ZSIsIlZTQ09ERV9HSVRfQVNLUEFTU19FWFRSQV9BUkdTIjoiLS1tcy1lbmFibGUtZWxlY3Ryb24tcnVuLWFzLW5vZGUiLCJWU0NPREVfR0lUX0FTS1BBU1NfTUFJTiI6Ii9BcHBsaWNhdGlvbnMvVmlzdWFsIFN0dWRpbyBDb2RlLmFwcC9Db250ZW50cy9SZXNvdXJjZXMvYXBwL2V4dGVuc2lvbnMvZ2l0L2Rpc3QvYXNrcGFzcy1tYWluLmpzIiwiVlNDT0RFX0dJVF9BU0tQQVNTX05PREUiOiIvQXBwbGljYXRpb25zL1Zpc3VhbCBTdHVkaW8gQ29kZS5hcHAvQ29udGVudHMvRnJhbWV3b3Jrcy9Db2RlIEhlbHBlciAoUGx1Z2luKS5hcHAvQ29udGVudHMvTWFjT1MvQ29kZSBIZWxwZXIgKFBsdWdpbikiLCJWU0NPREVfR0lUX0lQQ19IQU5ETEUiOiIvdmFyL2ZvbGRlcnMvNmsvZnJxbHMyN24yenY0ejUxajU1bm5reGZ3MDAwMGduL1QvdnNjb2RlLWdpdC0xMTg5NTBkNzIzLnNvY2siLCJWU0NPREVfSU5KRUNUSU9OIjoiMSIsIlhQQ19GTEFHUyI6IjB4MCIsIlhQQ19TRVJWSUNFX05BTUUiOiIwIiwiWkRPVERJUiI6Ii9Vc2Vycy9tc3dpZnQiLCJfIjoiLi4vYmluL3dpdG5lc3MiLCJfUDlLX1RUWSI6Ii9kZXYvdHR5czAwOCIsIl9fQ0ZCdW5kbGVJZGVudGlmaWVyIjoiY29tLm1pY3Jvc29mdC5WU0NvZGUiLCJfX0NGX1VTRVJfVEVYVF9FTkNPRElORyI6IjB4MUY1OjB4MDoweDAifX0sInN0YXJ0dGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDguNzg1OTQxLTA1OjAwIiwiZW5kdGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDguNzg3MzQyLTA1OjAwIn0seyJ0eXBlIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvZ2l0L3YwLjEiLCJhdHRlc3RhdGlvbiI6eyJjb21taXRoYXNoIjoiYmUyMDEwMGFmNjAyYzc4MGRlZWVmNTBjNTRmNTMzODY2MmNlOTE3YyIsImF1dGhvciI6InNueWstYm90IiwiYXV0aG9yZW1haWwiOiJzbnlrLWJvdEBzbnlrLmlvIiwiY29tbWl0dGVybmFtZSI6Ik1pa2hhaWwgU3dpZnQiLCJjb21taXR0ZXJlbWFpbCI6Im1zd2lmdEBtc3dpZnQuZGV2IiwiY29tbWl0ZGF0ZSI6IjIwMjMtMDctMTggMTY6MTA6MDYgKzAwMDAgKzAwMDAiLCJjb21taXRtZXNzYWdlIjoiZml4OiBkZXYvRG9ja2VyZmlsZS5nby1idWlsZGVyIHRvIHJlZHVjZSB2dWxuZXJhYmlsaXRpZXNcblxuVGhlIGZvbGxvd2luZyB2dWxuZXJhYmlsaXRpZXMgYXJlIGZpeGVkIHdpdGggYW4gdXBncmFkZTpcbi0gaHR0cHM6Ly9zbnlrLmlvL3Z1bG4vU05ZSy1ERUJJQU4xMS1BUFItMzI2MTEwNVxuLSBodHRwczovL3NueWsuaW8vdnVsbi9TTllLLURFQklBTjExLU9QRU5TU0wtMzM2ODczNVxuLSBodHRwczovL3NueWsuaW8vdnVsbi9TTllLLURFQklBTjExLU9QRU5TU0wtNTI5MTc3M1xuLSBodHRwczovL3NueWsuaW8vdnVsbi9TTllLLURFQklBTjExLU9QRU5TU0wtNTI5MTc3N1xuLSBodHRwczovL3NueWsuaW8vdnVsbi9TTllLLURFQklBTjExLU9QRU5TU0wtNTY2MTU2NiIsInN0YXR1cyI6eyIudnNjb2RlL2xhdW5jaC5qc29uIjp7InN0YWdpbmciOiJ1bnRyYWNrZWQiLCJ3b3JrdHJlZSI6InVudHJhY2tlZCJ9LCJ0ZXN0L3Rlc3QueWFtbCI6eyJzdGFnaW5nIjoidW5tb2RpZmllZCIsIndvcmt0cmVlIjoibW9kaWZpZWQifX0sImNvbW1pdGRpZ2VzdCI6eyJzaGExIjoiYmUyMDEwMGFmNjAyYzc4MGRlZWVmNTBjNTRmNTMzODY2MmNlOTE3YyJ9LCJwYXJlbnRoYXNoZXMiOlsiYWEzNWMxZjRiMWQ0MWM4N2UxMzljMmQzMzNmMDkxMTdmZDBkYWY0ZiJdLCJ0cmVlaGFzaCI6IjllMDc2NWI2NTc5YWM3YzE0YTQwNjBhYmRiY2MxZDA5YmE1MDgwNGQiLCJyZWZzIjpbInJlZnMvaGVhZHMvbWFpbiIsInJlZnMvcmVtb3Rlcy9vcmlnaW4vbWFpbiJdfSwic3RhcnR0aW1lIjoiMjAyMy0wOS0yNlQxNzoyMzo0OC43ODczNTctMDU6MDAiLCJlbmR0aW1lIjoiMjAyMy0wOS0yNlQxNzoyMzo0OS4zODI3OTYtMDU6MDAifSx7InR5cGUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9tYXRlcmlhbC92MC4xIiwiYXR0ZXN0YXRpb24iOnsiLmdpdGlnbm9yZSI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6ZWExMjZkOGI5NGNmMWE2ZGVhNWQ5NTJhMTU4MGI5ZjE0MWNkYWI3ZSIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6ImViZjNhNzNhNDJlZDIwMTJkYjBiZTJiOWU3N2Y5ZTUzZDczYTBhMGFlMjIwODFhNWZjNWRmMjMyNmY5YWZiYWIifSwiYnVpbGQuYXR0ZXN0YXRpb24uanNvbiI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6Nzc2NTc2NTVhNGVhYTEzNWMwOWY5MmY3MjNlMTI0MzZiNjM3ODFkMSIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6ImVjMGNiZmMxMThiOTE1ZGQ2MWRjOGE5NGQ5YjQ4N2FjZDk1OTZkNjFlODcyZDZlZjM3NzA1Y2Y2N2MxYTBlODIifSwiY29tbW9uLnNoIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTozYzMyOGZiN2YzMWQxYzQzNDNlZjc5NzU1NjE5MjA1YTE1Njk3YTYwIiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiNjhmNDliNDc1ZTcwOGY1MWZkN2YyNzY4NzExZmVlMmU2Yzg1OGU5NGE0NGZkZjhhNmM1YmYzM2I2YTk3NjE2MiJ9LCJmYWlsLmF0dGVzdGF0aW9uLmpzb24iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOmU2OWRlMjliYjJkMWQ2NDM0YjhiMjlhZTc3NWFkOGMyZTQ4YzUzOTEiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiJlM2IwYzQ0Mjk4ZmMxYzE0OWFmYmY0Yzg5OTZmYjkyNDI3YWU0MWU0NjQ5YjkzNGNhNDk1OTkxYjc4NTJiODU1In0sImZhaWxrZXkucGVtIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTo3YzVlYzQzYjc4YTM4ODI4ZDY5YTNhNTc3YzVlZTYzOGZlN2E0Mzc1IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiMDkzZjBmOGM1OTIyYTJmNjZjZmI0NzM3YTUwMDdiMTk3YjM2ZjAxOWE0N2QxMWEwMGE5NTc3YWQ4ZmUyODhhOSJ9LCJtYWluLmdvIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTpkZTMzMWY5ODk5MmY5MzI2YjYyZTJiZDcyZDdmNGVmODFkZjkxYjQ2IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiMzEwZTVjZTI2N2E2NGRkMGNjYzYzNDFhNmYwNDNkNWE3ZDU5ZDU3YWNiMTBmMzFmYzExYzJmNTRjOTQ4NTRkMyJ9LCJwYWNrYWdlLmF0dGVzdGF0aW9uLmpzb24iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOmNiMmIyNzRmYTdhODE3OWExODcxODk1OWM0NzFhMTQwMzBjOTJlZjEiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiI2MzAwZDAzMWRlZTM4NDQ5MjMxODhlYTcyOWYxMzlkZGRiNDU3Mzg1Nzc3NDNjOWJiY2E4OTJjNDM3NzkxMWY2In0sInBvbGljeS1zaWduZWQuanNvbiI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6OTFiMjI1ZTFjZjBkMjgzNTJhYWIzYzhkNTQwMGVjNDYzNWExN2I4ZSIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6ImNhZmI0ODNmZTM1ODhiOWU3M2MzMmZkMzgyZmI0Njc5M2FmOTAyMTkwYjZlOWM4MjI4NjIxNGQyY2M2YWNiODQifSwicG9saWN5Lmpzb24iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjI0MzM0NDIyMDEwNDFmNDY2ZjkyMWY1YmE3NDI4NTFmNWQwZGFjYTQiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiJjYzdkNTVjODNkNDZhNjZjOWQ2YjYxMmZkZDYxNTE2YzllMmRiZDEzMzAxMTk0MTJmYWQ0MWY5Y2VlYTdlODRmIn0sInRlc3Qtb2NpLnNoIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTpmODQ5Mzg4MmM1MDc0ZTdkYjgxZWIwNjJlNGY4YWQ3N2M1YWI5NmM0IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiMWZiMDZmMmZkZjYzNzhmYzE5YzczYTZkMDZkM2NhYWU3OTBiMzJiYzgyMzFiYzY5ZTM4NTNkYjRmMjdiZjUwMyJ9LCJ0ZXN0LnNoIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTo4YWFmY2RlZWQ4YzI3Njg0YTM2ZTRiZWI2M2EyMGQwOTQzYzBlYzcyIiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiOTM0ZjM2ZjNhOWIzOWE5YTEzNjg2NDM1YzM1YzEwOTBjZDJkYjliYmQwZmM5NjM0ODgxNTI5MjMwNTkxMGZlMyJ9LCJ0ZXN0LnlhbWwiOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjgzYjc2OWZjYzcwNTVhZjZlZWFkODQzMjQzYTZiMTFhMWE3NjVmZDUiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiI0OGM3NDkyYTQ4YzdiOGVjOGYxYWVjNTA4MTA3MTNlMjQzNzEzMWRhOTNiMjlmOTFjN2FlMWFiOThjNWQ1YTQwIn0sInRlc3RhcHAiOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjg1ZTNhMDIzYzk3YzhhYWRhY2UyZDhjOTU5NTM1YWJmZmJmNGUxNzUiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiI0MjNkYTRjZmYxOThiYmZmYmUzMjIwZWQ5NTEwZDMyYmE5NjY5OGU0YjFmNjU0NTUyNTIxZDFmNTQxYWJiNmRjIn0sInRlc3RhcHAudGFyLnRneiI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6MDI2NmMxMjQzZjFiMWQ0NmNlY2ZhNjcxZGEyYTRlOGQxZTRmOTdlNSIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6ImQwM2RkODI3ZDcxZGZhYjc1NzhmYWYwNDkyOTRjNTVhZDE0MGE1OTZiZWNlNWU2OGJjNDA2YWM5MjY1YmUxZWUifSwidGVzdGtleS5wZW0iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOmZhY2VkY2Q3ODJmODA2NTM0M2ZkOTdiY2MxZGY5ZGFiYTBmOTBjY2EiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiIxNzkwMmQyOTI1YTllOTQ0NDE1YWY3MzdlYTBjZGZkOTZhM2VmYmJlY2MzMWY1OWJkYjg1MzU3MjRhMTI1NmZjIn0sInRlc3RrZXkyLnBlbSI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6ZDJjOTE5ZjQzY2NhY2VhYjc3ZTVkYmM3MWMxYjg1Nzk0Yzg2MmM5MCIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjNhNmYzOWQ3NjFmZDBlOWFhNDQxN2M1MGEwN2Y5ZjRkN2IyOWIxYWM0MzBhMDE2ODdiNjg0MDBjMmI5Njg4MDMifSwidGVzdHB1Yi5wZW0iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjliNGJlYTkwOGNkN2ZjMjMxYzQ5ZWM4ZGI0ZTViZGRiYzgxNDAzMWYiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiJiOTdmMGZiNDBiYjc0OWY1ZTZhNTVlNTg4ZTgwMGZmZWEzZjFlYzYzNjY1YWY4MTk5YWViYTQ0NzJhYjQ1MzI3In0sInRlc3RwdWIyLnBlbSI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6MWRjM2Y4Yzg2MjRkOThhNjliYTQ3N2M3OWZhMmViNWM4NzQwOGNiNyIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjVlOGM1N2RmOGFlNThmZTlhMjliMjlmOTk5M2UyZmMzYjI1YmQ3NWViMjc1NGYzNTM4ODBiYWQ0YjllYmZkYjMifX0sInN0YXJ0dGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDkuMzgyODIxLTA1OjAwIiwiZW5kdGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDkuMzg4MjctMDU6MDAifSx7InR5cGUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9jb21tYW5kLXJ1bi92MC4xIiwiYXR0ZXN0YXRpb24iOnsiY21kIjpbImdvIiwiYnVpbGQiLCItbz10ZXN0YXBwIiwiLiJdLCJleGl0Y29kZSI6MH0sInN0YXJ0dGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDkuMzg4MjkzLTA1OjAwIiwiZW5kdGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDkuNDUyNzk3LTA1OjAwIn0seyJ0eXBlIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvcHJvZHVjdC92MC4xIiwiYXR0ZXN0YXRpb24iOnt9LCJzdGFydHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjQ5LjQ1MjkwMi0wNTowMCIsImVuZHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjQ5LjQ1OTIwMy0wNTowMCJ9XX19","payloadType":"application/vnd.in-toto+json","signatures":[{"keyid":"6316cb923d1b8412880e49fb0245c0e5f5536674d1c2cc3e948476fdc9830453","sig":"MEUCIQDk6DSWysKt6vYZi66xoxNWJmJG+9M+t9mLGzjoVEp0xAIgSRjEKFaJzqYqVOq6TZE07gyobZVJH4RB8nqVdS8sQBU="}]} golang-github-in-toto-archivista-0.11.1/test/invalid_payload.attestation.json000066400000000000000000000004061511066247200274160ustar00rootroot00000000000000{"payload": "e30K", "payloadType": "application/vnd.in-toto+json", "signatures": [{"keyid": "ae2dcc989ea9c109a36e8eba5c4bc16d8fafcfe8e1a614164670d50aedacd647", "sig": "ahsjnNBEVNqo5/umfwQzWiVAvLx4yk3z6Xh+fsaWyxhmGD1syhOhMOkXapmVvEuscm6la9a/edQKNXXg02ghCw==" }]} golang-github-in-toto-archivista-0.11.1/test/package.attestation.json000066400000000000000000000351751511066247200256650ustar00rootroot00000000000000{"payload":"eyJfdHlwZSI6Imh0dHBzOi8vaW4tdG90by5pby9TdGF0ZW1lbnQvdjAuMSIsInN1YmplY3QiOlt7Im5hbWUiOiJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9naXQvdjAuMS9jb21taXR0ZXJlbWFpbDptc3dpZnRAbXN3aWZ0LmRldiIsImRpZ2VzdCI6eyJzaGEyNTYiOiI0MDg0MDRlN2E2NmI0NzFlNTYzMGU4MDFjOTNhZjY2ZmI5Y2IwMTc3MTk4MmFlOTBiNmY3NTVlMTA0MjgxODg3In19LHsibmFtZSI6Imh0dHBzOi8vd2l0bmVzcy5kZXYvYXR0ZXN0YXRpb25zL2dpdC92MC4xL3BhcmVudGhhc2g6YWEzNWMxZjRiMWQ0MWM4N2UxMzljMmQzMzNmMDkxMTdmZDBkYWY0ZiIsImRpZ2VzdCI6eyJzaGEyNTYiOiIwYmMxMzZmNTUwOWU5NmZjOGFhMjkwZjE3NTQyOGQ2NDNhMGU2NWQ4ZTZiNjE1ODZhZDYwZTllYzk4M2EzMzcwIn19LHsibmFtZSI6Imh0dHBzOi8vd2l0bmVzcy5kZXYvYXR0ZXN0YXRpb25zL3Byb2R1Y3QvdjAuMS9maWxlOnRlc3RhcHAudGFyLnRneiIsImRpZ2VzdCI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6Mzk5NGY2NmYzN2UxNWNlODFlYzExZGY4NTJkNWVlOWQ1NWYwOGMwMSIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjEwY2JmMGYzZDg3MDkzNDkyMTI3NmY2NjlhYjcwNzk4MzExM2Y5Mjk3ODRkODc3ZjExOTJmNDNjNTgxZjIwNzAifX0seyJuYW1lIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvZ2l0L3YwLjEvY29tbWl0aGFzaDpiZTIwMTAwYWY2MDJjNzgwZGVlZWY1MGM1NGY1MzM4NjYyY2U5MTdjIiwiZGlnZXN0Ijp7InNoYTEiOiJiZTIwMTAwYWY2MDJjNzgwZGVlZWY1MGM1NGY1MzM4NjYyY2U5MTdjIn19LHsibmFtZSI6Imh0dHBzOi8vd2l0bmVzcy5kZXYvYXR0ZXN0YXRpb25zL2dpdC92MC4xL2F1dGhvcmVtYWlsOnNueWstYm90QHNueWsuaW8iLCJkaWdlc3QiOnsic2hhMjU2IjoiZWU0ODM2OWJlNjA3MmMxYTQ5YmE1MTliMmVlZjkyNzIyMzViMGQ5MjVhNmU3YTMzOGY3ZmZjMTJhMmNhNTM4ZSJ9fV0sInByZWRpY2F0ZVR5cGUiOiJodHRwczovL3dpdG5lc3MudGVzdGlmeXNlYy5jb20vYXR0ZXN0YXRpb24tY29sbGVjdGlvbi92MC4xIiwicHJlZGljYXRlIjp7Im5hbWUiOiJwYWNrYWdlIiwiYXR0ZXN0YXRpb25zIjpbeyJ0eXBlIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvZW52aXJvbm1lbnQvdjAuMSIsImF0dGVzdGF0aW9uIjp7Im9zIjoiZGFyd2luIiwiaG9zdG5hbWUiOiJNaWtoYWlscy1NYWNCb29rLVByby0yLmxvY2FsIiwidXNlcm5hbWUiOiJtc3dpZnQiLCJ2YXJpYWJsZXMiOnsiQ09MT1JURVJNIjoidHJ1ZWNvbG9yIiwiQ09NTUFORF9NT0RFIjoidW5peDIwMDMiLCJHSVRfQVNLUEFTUyI6Ii9BcHBsaWNhdGlvbnMvVmlzdWFsIFN0dWRpbyBDb2RlLmFwcC9Db250ZW50cy9SZXNvdXJjZXMvYXBwL2V4dGVuc2lvbnMvZ2l0L2Rpc3QvYXNrcGFzcy5zaCIsIkdQR19UVFkiOiIvZGV2L3R0eXMwMDgiLCJIT01FIjoiL1VzZXJzL21zd2lmdCIsIkhPTUVCUkVXX0NFTExBUiI6Ii9vcHQvaG9tZWJyZXcvQ2VsbGFyIiwiSE9NRUJSRVdfUFJFRklYIjoiL29wdC9ob21lYnJldyIsIkhPTUVCUkVXX1JFUE9TSVRPUlkiOiIvb3B0L2hvbWVicmV3IiwiSU5GT1BBVEgiOiIvb3B0L2hvbWVicmV3L3NoYXJlL2luZm86L29wdC9ob21lYnJldy9zaGFyZS9pbmZvOiIsIkxBTkciOiJlbl9VUy5VVEYtOCIsIkxPR05BTUUiOiJtc3dpZnQiLCJMYXVuY2hJbnN0YW5jZUlEIjoiRUIyQTdBMDgtRkYzMC00QUZDLTkzQkMtRjNCNDI3Q0YxODE0IiwiTUFOUEFUSCI6Ii9vcHQvaG9tZWJyZXcvc2hhcmUvbWFuOi91c3Ivc2hhcmUvbWFuOi91c3IvbG9jYWwvc2hhcmUvbWFuOi9vcHQvaG9tZWJyZXcvc2hhcmUvbWFuOjoiLCJNYWxsb2NOYW5vWm9uZSI6IjAiLCJPUklHSU5BTF9YREdfQ1VSUkVOVF9ERVNLVE9QIjoidW5kZWZpbmVkIiwiUDlLX1NTSCI6IjAiLCJQOUtfVFRZIjoib2xkIiwiUEFUSCI6Ii9Vc2Vycy9tc3dpZnQvZ29vZ2xlLWNsb3VkLXNkay9iaW46L29wdC9ob21lYnJldy9iaW46L29wdC9ob21lYnJldy9zYmluOi91c3IvbG9jYWwvYmluOi9TeXN0ZW0vQ3J5cHRleGVzL0FwcC91c3IvYmluOi91c3IvYmluOi9iaW46L3Vzci9zYmluOi9zYmluOi92YXIvcnVuL2NvbS5hcHBsZS5zZWN1cml0eS5jcnlwdGV4ZC9jb2RleC5zeXN0ZW0vYm9vdHN0cmFwL3Vzci9sb2NhbC9iaW46L3Zhci9ydW4vY29tLmFwcGxlLnNlY3VyaXR5LmNyeXB0ZXhkL2NvZGV4LnN5c3RlbS9ib290c3RyYXAvdXNyL2JpbjovdmFyL3J1bi9jb20uYXBwbGUuc2VjdXJpdHkuY3J5cHRleGQvY29kZXguc3lzdGVtL2Jvb3RzdHJhcC91c3IvYXBwbGVpbnRlcm5hbC9iaW46L1VzZXJzL21zd2lmdC9nb29nbGUtY2xvdWQtc2RrL2Jpbjovb3B0L2hvbWVicmV3L2Jpbjovb3B0L2hvbWVicmV3L3NiaW46L1VzZXJzL21zd2lmdC9nby9iaW46L1VzZXJzL21zd2lmdC9nby9iaW4iLCJQV0QiOiIvVXNlcnMvbXN3aWZ0L1dvcmtzcGFjZXMvd2l0bmVzcy90ZXN0IiwiU0VDVVJJVFlTRVNTSU9OSUQiOiIxODZjOSIsIlNIRUxMIjoiL2Jpbi96c2giLCJTSExWTCI6IjIiLCJTU0hfQVVUSF9TT0NLIjoiL1VzZXJzL21zd2lmdC8uZ251cGcvUy5ncGctYWdlbnQuc3NoIiwiVEVSTSI6Inh0ZXJtLTI1NmNvbG9yIiwiVEVSTV9QUk9HUkFNIjoidnNjb2RlIiwiVEVSTV9QUk9HUkFNX1ZFUlNJT04iOiIxLjgyLjAiLCJUTVBESVIiOiIvdmFyL2ZvbGRlcnMvNmsvZnJxbHMyN24yenY0ejUxajU1bm5reGZ3MDAwMGduL1QvIiwiVVNFUiI6Im1zd2lmdCIsIlVTRVJfWkRPVERJUiI6Ii9Vc2Vycy9tc3dpZnQiLCJVU0VfR0tFX0dDTE9VRF9BVVRIX1BMVUdJTiI6IlRydWUiLCJWU0NPREVfR0lUX0FTS1BBU1NfRVhUUkFfQVJHUyI6Ii0tbXMtZW5hYmxlLWVsZWN0cm9uLXJ1bi1hcy1ub2RlIiwiVlNDT0RFX0dJVF9BU0tQQVNTX01BSU4iOiIvQXBwbGljYXRpb25zL1Zpc3VhbCBTdHVkaW8gQ29kZS5hcHAvQ29udGVudHMvUmVzb3VyY2VzL2FwcC9leHRlbnNpb25zL2dpdC9kaXN0L2Fza3Bhc3MtbWFpbi5qcyIsIlZTQ09ERV9HSVRfQVNLUEFTU19OT0RFIjoiL0FwcGxpY2F0aW9ucy9WaXN1YWwgU3R1ZGlvIENvZGUuYXBwL0NvbnRlbnRzL0ZyYW1ld29ya3MvQ29kZSBIZWxwZXIgKFBsdWdpbikuYXBwL0NvbnRlbnRzL01hY09TL0NvZGUgSGVscGVyIChQbHVnaW4pIiwiVlNDT0RFX0dJVF9JUENfSEFORExFIjoiL3Zhci9mb2xkZXJzLzZrL2ZycWxzMjduMnp2NHo1MWo1NW5ua3hmdzAwMDBnbi9UL3ZzY29kZS1naXQtMTE4OTUwZDcyMy5zb2NrIiwiVlNDT0RFX0lOSkVDVElPTiI6IjEiLCJYUENfRkxBR1MiOiIweDAiLCJYUENfU0VSVklDRV9OQU1FIjoiMCIsIlpET1RESVIiOiIvVXNlcnMvbXN3aWZ0IiwiXyI6Ii4uL2Jpbi93aXRuZXNzIiwiX1A5S19UVFkiOiIvZGV2L3R0eXMwMDgiLCJfX0NGQnVuZGxlSWRlbnRpZmllciI6ImNvbS5taWNyb3NvZnQuVlNDb2RlIiwiX19DRl9VU0VSX1RFWFRfRU5DT0RJTkciOiIweDFGNToweDA6MHgwIn19LCJzdGFydHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjQ5LjQ3MTM1OS0wNTowMCIsImVuZHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjQ5LjQ3MzU4My0wNTowMCJ9LHsidHlwZSI6Imh0dHBzOi8vd2l0bmVzcy5kZXYvYXR0ZXN0YXRpb25zL2dpdC92MC4xIiwiYXR0ZXN0YXRpb24iOnsiY29tbWl0aGFzaCI6ImJlMjAxMDBhZjYwMmM3ODBkZWVlZjUwYzU0ZjUzMzg2NjJjZTkxN2MiLCJhdXRob3IiOiJzbnlrLWJvdCIsImF1dGhvcmVtYWlsIjoic255ay1ib3RAc255ay5pbyIsImNvbW1pdHRlcm5hbWUiOiJNaWtoYWlsIFN3aWZ0IiwiY29tbWl0dGVyZW1haWwiOiJtc3dpZnRAbXN3aWZ0LmRldiIsImNvbW1pdGRhdGUiOiIyMDIzLTA3LTE4IDE2OjEwOjA2ICswMDAwICswMDAwIiwiY29tbWl0bWVzc2FnZSI6ImZpeDogZGV2L0RvY2tlcmZpbGUuZ28tYnVpbGRlciB0byByZWR1Y2UgdnVsbmVyYWJpbGl0aWVzXG5cblRoZSBmb2xsb3dpbmcgdnVsbmVyYWJpbGl0aWVzIGFyZSBmaXhlZCB3aXRoIGFuIHVwZ3JhZGU6XG4tIGh0dHBzOi8vc255ay5pby92dWxuL1NOWUstREVCSUFOMTEtQVBSLTMyNjExMDVcbi0gaHR0cHM6Ly9zbnlrLmlvL3Z1bG4vU05ZSy1ERUJJQU4xMS1PUEVOU1NMLTMzNjg3MzVcbi0gaHR0cHM6Ly9zbnlrLmlvL3Z1bG4vU05ZSy1ERUJJQU4xMS1PUEVOU1NMLTUyOTE3NzNcbi0gaHR0cHM6Ly9zbnlrLmlvL3Z1bG4vU05ZSy1ERUJJQU4xMS1PUEVOU1NMLTUyOTE3Nzdcbi0gaHR0cHM6Ly9zbnlrLmlvL3Z1bG4vU05ZSy1ERUJJQU4xMS1PUEVOU1NMLTU2NjE1NjYiLCJzdGF0dXMiOnsiLnZzY29kZS9sYXVuY2guanNvbiI6eyJzdGFnaW5nIjoidW50cmFja2VkIiwid29ya3RyZWUiOiJ1bnRyYWNrZWQifSwidGVzdC90ZXN0LnlhbWwiOnsic3RhZ2luZyI6InVubW9kaWZpZWQiLCJ3b3JrdHJlZSI6Im1vZGlmaWVkIn19LCJjb21taXRkaWdlc3QiOnsic2hhMSI6ImJlMjAxMDBhZjYwMmM3ODBkZWVlZjUwYzU0ZjUzMzg2NjJjZTkxN2MifSwicGFyZW50aGFzaGVzIjpbImFhMzVjMWY0YjFkNDFjODdlMTM5YzJkMzMzZjA5MTE3ZmQwZGFmNGYiXSwidHJlZWhhc2giOiI5ZTA3NjViNjU3OWFjN2MxNGE0MDYwYWJkYmNjMWQwOWJhNTA4MDRkIiwicmVmcyI6WyJyZWZzL2hlYWRzL21haW4iLCJyZWZzL3JlbW90ZXMvb3JpZ2luL21haW4iXX0sInN0YXJ0dGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NDkuNDczNTk1LTA1OjAwIiwiZW5kdGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NTAuMDU1NTM1LTA1OjAwIn0seyJ0eXBlIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvbWF0ZXJpYWwvdjAuMSIsImF0dGVzdGF0aW9uIjp7Ii5naXRpZ25vcmUiOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOmVhMTI2ZDhiOTRjZjFhNmRlYTVkOTUyYTE1ODBiOWYxNDFjZGFiN2UiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiJlYmYzYTczYTQyZWQyMDEyZGIwYmUyYjllNzdmOWU1M2Q3M2EwYTBhZTIyMDgxYTVmYzVkZjIzMjZmOWFmYmFiIn0sImJ1aWxkLmF0dGVzdGF0aW9uLmpzb24iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjc3NjU3NjU1YTRlYWExMzVjMDlmOTJmNzIzZTEyNDM2YjYzNzgxZDEiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiJlYzBjYmZjMTE4YjkxNWRkNjFkYzhhOTRkOWI0ODdhY2Q5NTk2ZDYxZTg3MmQ2ZWYzNzcwNWNmNjdjMWEwZTgyIn0sImNvbW1vbi5zaCI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6M2MzMjhmYjdmMzFkMWM0MzQzZWY3OTc1NTYxOTIwNWExNTY5N2E2MCIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjY4ZjQ5YjQ3NWU3MDhmNTFmZDdmMjc2ODcxMWZlZTJlNmM4NThlOTRhNDRmZGY4YTZjNWJmMzNiNmE5NzYxNjIifSwiZmFpbC5hdHRlc3RhdGlvbi5qc29uIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMToxZTBhZGI3ODU0MDI3ZTljZTQ1OGI3YTVhYTc3ODgwYzQ2NjhjMTFkIiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiMDVkNGMxYjJkYTBhMjllYWMwZTM3NGNlYzU3MGRhMzNkY2YwMGUyNTkyMzQ4ZjllMGUwZTBjNjA2ZDE1MDk2MCJ9LCJmYWlsa2V5LnBlbSI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6N2M1ZWM0M2I3OGEzODgyOGQ2OWEzYTU3N2M1ZWU2MzhmZTdhNDM3NSIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjA5M2YwZjhjNTkyMmEyZjY2Y2ZiNDczN2E1MDA3YjE5N2IzNmYwMTlhNDdkMTFhMDBhOTU3N2FkOGZlMjg4YTkifSwibWFpbi5nbyI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6ZGUzMzFmOTg5OTJmOTMyNmI2MmUyYmQ3MmQ3ZjRlZjgxZGY5MWI0NiIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjMxMGU1Y2UyNjdhNjRkZDBjY2M2MzQxYTZmMDQzZDVhN2Q1OWQ1N2FjYjEwZjMxZmMxMWMyZjU0Yzk0ODU0ZDMifSwicGFja2FnZS5hdHRlc3RhdGlvbi5qc29uIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTplNjlkZTI5YmIyZDFkNjQzNGI4YjI5YWU3NzVhZDhjMmU0OGM1MzkxIiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiZTNiMGM0NDI5OGZjMWMxNDlhZmJmNGM4OTk2ZmI5MjQyN2FlNDFlNDY0OWI5MzRjYTQ5NTk5MWI3ODUyYjg1NSJ9LCJwb2xpY3ktc2lnbmVkLmpzb24iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjkxYjIyNWUxY2YwZDI4MzUyYWFiM2M4ZDU0MDBlYzQ2MzVhMTdiOGUiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiJjYWZiNDgzZmUzNTg4YjllNzNjMzJmZDM4MmZiNDY3OTNhZjkwMjE5MGI2ZTljODIyODYyMTRkMmNjNmFjYjg0In0sInBvbGljeS5qc29uIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMToyNDMzNDQyMjAxMDQxZjQ2NmY5MjFmNWJhNzQyODUxZjVkMGRhY2E0IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiY2M3ZDU1YzgzZDQ2YTY2YzlkNmI2MTJmZGQ2MTUxNmM5ZTJkYmQxMzMwMTE5NDEyZmFkNDFmOWNlZWE3ZTg0ZiJ9LCJ0ZXN0LW9jaS5zaCI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6Zjg0OTM4ODJjNTA3NGU3ZGI4MWViMDYyZTRmOGFkNzdjNWFiOTZjNCIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjFmYjA2ZjJmZGY2Mzc4ZmMxOWM3M2E2ZDA2ZDNjYWFlNzkwYjMyYmM4MjMxYmM2OWUzODUzZGI0ZjI3YmY1MDMifSwidGVzdC5zaCI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6OGFhZmNkZWVkOGMyNzY4NGEzNmU0YmViNjNhMjBkMDk0M2MwZWM3MiIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjkzNGYzNmYzYTliMzlhOWExMzY4NjQzNWMzNWMxMDkwY2QyZGI5YmJkMGZjOTYzNDg4MTUyOTIzMDU5MTBmZTMifSwidGVzdC55YW1sIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTo4M2I3NjlmY2M3MDU1YWY2ZWVhZDg0MzI0M2E2YjExYTFhNzY1ZmQ1IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiNDhjNzQ5MmE0OGM3YjhlYzhmMWFlYzUwODEwNzEzZTI0MzcxMzFkYTkzYjI5ZjkxYzdhZTFhYjk4YzVkNWE0MCJ9LCJ0ZXN0YXBwIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTo4NWUzYTAyM2M5N2M4YWFkYWNlMmQ4Yzk1OTUzNWFiZmZiZjRlMTc1IiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiNDIzZGE0Y2ZmMTk4YmJmZmJlMzIyMGVkOTUxMGQzMmJhOTY2OThlNGIxZjY1NDU1MjUyMWQxZjU0MWFiYjZkYyJ9LCJ0ZXN0YXBwLnRhci50Z3oiOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjAyNjZjMTI0M2YxYjFkNDZjZWNmYTY3MWRhMmE0ZThkMWU0Zjk3ZTUiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiJkMDNkZDgyN2Q3MWRmYWI3NTc4ZmFmMDQ5Mjk0YzU1YWQxNDBhNTk2YmVjZTVlNjhiYzQwNmFjOTI2NWJlMWVlIn0sInRlc3RrZXkucGVtIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTpmYWNlZGNkNzgyZjgwNjUzNDNmZDk3YmNjMWRmOWRhYmEwZjkwY2NhIiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiMTc5MDJkMjkyNWE5ZTk0NDQxNWFmNzM3ZWEwY2RmZDk2YTNlZmJiZWNjMzFmNTliZGI4NTM1NzI0YTEyNTZmYyJ9LCJ0ZXN0a2V5Mi5wZW0iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOmQyYzkxOWY0M2NjYWNlYWI3N2U1ZGJjNzFjMWI4NTc5NGM4NjJjOTAiLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiIzYTZmMzlkNzYxZmQwZTlhYTQ0MTdjNTBhMDdmOWY0ZDdiMjliMWFjNDMwYTAxNjg3YjY4NDAwYzJiOTY4ODAzIn0sInRlc3RwdWIucGVtIjp7ImdpdG9pZDpzaGExIjoiZ2l0b2lkOmJsb2I6c2hhMTo5YjRiZWE5MDhjZDdmYzIzMWM0OWVjOGRiNGU1YmRkYmM4MTQwMzFmIiwiZ2l0b2lkOnNoYTI1NiI6ImdpdG9pZDpibG9iOnNoYTI1Njo0NzNhMGY0YzNiZThhOTM2ODFhMjY3ZTNiMWU5YTdkY2RhMTE4NTQzNmZlMTQxZjc3NDkxMjBhMzAzNzIxODEzIiwic2hhMjU2IjoiYjk3ZjBmYjQwYmI3NDlmNWU2YTU1ZTU4OGU4MDBmZmVhM2YxZWM2MzY2NWFmODE5OWFlYmE0NDcyYWI0NTMyNyJ9LCJ0ZXN0cHViMi5wZW0iOnsiZ2l0b2lkOnNoYTEiOiJnaXRvaWQ6YmxvYjpzaGExOjFkYzNmOGM4NjI0ZDk4YTY5YmE0NzdjNzlmYTJlYjVjODc0MDhjYjciLCJnaXRvaWQ6c2hhMjU2IjoiZ2l0b2lkOmJsb2I6c2hhMjU2OjQ3M2EwZjRjM2JlOGE5MzY4MWEyNjdlM2IxZTlhN2RjZGExMTg1NDM2ZmUxNDFmNzc0OTEyMGEzMDM3MjE4MTMiLCJzaGEyNTYiOiI1ZThjNTdkZjhhZTU4ZmU5YTI5YjI5Zjk5OTNlMmZjM2IyNWJkNzVlYjI3NTRmMzUzODgwYmFkNGI5ZWJmZGIzIn19LCJzdGFydHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjUwLjA1NTU2NC0wNTowMCIsImVuZHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjUwLjA2MTA5LTA1OjAwIn0seyJ0eXBlIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvY29tbWFuZC1ydW4vdjAuMSIsImF0dGVzdGF0aW9uIjp7ImNtZCI6WyJ0YXIiLCJjemYiLCIuL3Rlc3RhcHAudGFyLnRneiIsIi4vdGVzdGFwcCJdLCJleGl0Y29kZSI6MH0sInN0YXJ0dGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NTAuMDYxMTExLTA1OjAwIiwiZW5kdGltZSI6IjIwMjMtMDktMjZUMTc6MjM6NTAuMTM0MzYzLTA1OjAwIn0seyJ0eXBlIjoiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvcHJvZHVjdC92MC4xIiwiYXR0ZXN0YXRpb24iOnsidGVzdGFwcC50YXIudGd6Ijp7Im1pbWVfdHlwZSI6ImFwcGxpY2F0aW9uL3gtZ3ppcCIsImRpZ2VzdCI6eyJnaXRvaWQ6c2hhMSI6ImdpdG9pZDpibG9iOnNoYTE6Mzk5NGY2NmYzN2UxNWNlODFlYzExZGY4NTJkNWVlOWQ1NWYwOGMwMSIsImdpdG9pZDpzaGEyNTYiOiJnaXRvaWQ6YmxvYjpzaGEyNTY6NDczYTBmNGMzYmU4YTkzNjgxYTI2N2UzYjFlOWE3ZGNkYTExODU0MzZmZTE0MWY3NzQ5MTIwYTMwMzcyMTgxMyIsInNoYTI1NiI6IjEwY2JmMGYzZDg3MDkzNDkyMTI3NmY2NjlhYjcwNzk4MzExM2Y5Mjk3ODRkODc3ZjExOTJmNDNjNTgxZjIwNzAifX19LCJzdGFydHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjUwLjEzNDQzOC0wNTowMCIsImVuZHRpbWUiOiIyMDIzLTA5LTI2VDE3OjIzOjUwLjE0MjEzLTA1OjAwIn1dfX0=","payloadType":"application/vnd.in-toto+json","signatures":[{"keyid":"5e8c57df8ae58fe9a29b29f9993e2fc3b25bd75eb2754f353880bad4b9ebfdb3","sig":"G6gthh/6Z4pPpnz7CEgYNqCZh99LVYhQXgEdxk7bfvOaU14xXdv4zPmsCeufOwo1S+F/pxxptzTCN6d1sQwXhLNbhUXoa0Md/P+fUQ56i1WaqM57y7VQ2lOIaQBuLMaOnY07f52a/o8f40Rg29462+ccI+QFnf8/z63J/VgFu+DSlopDaa/3dPZ74oamENh34eWSThT+KjlU2v1XKYNDFVNt+S8hdINrkAFqeFdCNdpYH9hafaYutRH55Vx6ftm4o/aXTnnsjgS2moylzJN7CeIhaXoLS8oNHhYEss7UGSWlRrOZSgG/vepu4j6cdSXsoL7xoLPZB99RBNmRyfp/Fp1JfTFBeVQHBP5CaWIRgB1o/+aOYT32/Kt/FTlKetsr38Ft7Qx9P8pfXeUwn04+JcizjOoSMk1X/8TspUgHkcsa90FKx4Y+O0le9XR2AgtIo7qrgU4zKOjN0qm/PPfG0cudRdn5XA6RBvJRhJFa5uTrwpee54G2WvsrqZsuAI0hC/V8QMhZghDnpF9lYuxxEqenplJs/JfEcF/ih3n9S7N9gEter+g92DkaacV1VGqegHmmC9HIwelDoe/jVWv5byUghDPmzR7dRnAsCoK80d1gpmgcr/q0ELu/Wd/qlc7GFfbpNKeGFHL3WnqlF3nJgvx03574MIF5eCctIZNzF4o="}]} golang-github-in-toto-archivista-0.11.1/test/policy-signed.json000066400000000000000000000116031511066247200244700ustar00rootroot00000000000000{"payload":"ewogICJleHBpcmVzIjogIjIwMjUtMTItMTdUMjM6NTc6NDAtMDU6MDAiLAogICJyZXBvc2l0b3JpZXMiOiB7CiAgICAiZ2l0IjogWwogICAgICAiZ2l0aHViLmNvbS9rYWlyb2FyYXVqby93aXRuZXNzLmdpdCIsCiAgICAgICJnaXRodWIuY29tL2luLXRvdG8vd2l0bmVzcy5naXQiCiAgICBdCiAgfSwKICAic3RlcHMiOiB7CiAgICAiYnVpbGQiOiB7CiAgICAgICJuYW1lIjogImJ1aWxkIiwKICAgICAgImF0dGVzdGF0aW9ucyI6IFsKICAgICAgICB7CiAgICAgICAgICAidHlwZSI6ICJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9tYXRlcmlhbC92MC4xIiwKICAgICAgICAgICJyZWdvcG9saWNpZXMiOiBbXQogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgInR5cGUiOiAiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvY29tbWFuZC1ydW4vdjAuMSIsCiAgICAgICAgICAicmVnb3BvbGljaWVzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgIm5hbWUiOiAiZXhwZWN0ZWQgY29tbWFuZCIsCiAgICAgICAgICAgICAgIm1vZHVsZSI6ICJjR0ZqYTJGblpTQmpiMjF0WVc1a2NuVnVMbU50WkFvS1pHVnVlVnR0YzJkZElIc0tDV2x1Y0hWMExtTnRaQ0FoUFNCYkltZHZJaXdnSW1KMWFXeGtJaXdnSWkxdlBYUmxjM1JoY0hBaUxDQWlMaUpkQ2dsdGMyY2dPajBnSW5WdVpYaHdaV04wWldRZ1kyMWtJZ3A5Q2c9PSIKICAgICAgICAgICAgfQogICAgICAgICAgXQogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgInR5cGUiOiAiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvcHJvZHVjdC92MC4xIiwKICAgICAgICAgICJyZWdvcG9saWNpZXMiOiBbXQogICAgICAgIH0KICAgICAgXSwKICAgICAgImZ1bmN0aW9uYXJpZXMiOiBbCiAgICAgICAgewogICAgICAgICAgInR5cGUiOiAicHVibGlja2V5IiwKICAgICAgICAgICJwdWJsaWNrZXlpZCI6ICJhZTJkY2M5ODllYTljMTA5YTM2ZThlYmE1YzRiYzE2ZDhmYWZjZmU4ZTFhNjE0MTY0NjcwZDUwYWVkYWNkNjQ3IgogICAgICAgIH0KICAgICAgXQogICAgfSwKICAgICJwYWNrYWdlIjogewogICAgICAibmFtZSI6ICJwYWNrYWdlIiwKICAgICAgImF0dGVzdGF0aW9ucyI6IFsKICAgICAgICB7CiAgICAgICAgICAidHlwZSI6ICJodHRwczovL3dpdG5lc3MuZGV2L2F0dGVzdGF0aW9ucy9tYXRlcmlhbC92MC4xIiwKICAgICAgICAgICJyZWdvcG9saWNpZXMiOiBbXQogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgInR5cGUiOiAiaHR0cHM6Ly93aXRuZXNzLmRldi9hdHRlc3RhdGlvbnMvY29tbWFuZC1ydW4vdjAuMSIsCiAgICAgICAgICAicmVnb3BvbGljaWVzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgIm5hbWUiOiAiZXhwZWN0ZWQgY29tbWFuZCIsCiAgICAgICAgICAgICAgIm1vZHVsZSI6ICJjR0ZqYTJGblpTQmpiMjF0WVc1a2NuVnVMbU50WkFvS1pHVnVlVnR0YzJkZElIc0tDV2x1Y0hWMExtTnRaQ0FoUFNCYkluUmhjaUlzSUNKamVtWWlMQ0FpTGk5MFpYTjBZWEJ3TG5SaGNpNTBaM29pTENBaUxpOTBaWE4wWVhCd0lsMEtDVzF6WnlBNlBTQWlkVzVsZUhCbFkzUmxaQ0JqYldRaUNuMEsiCiAgICAgICAgICAgIH0KICAgICAgICAgIF0KICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICJ0eXBlIjogImh0dHBzOi8vd2l0bmVzcy5kZXYvYXR0ZXN0YXRpb25zL3Byb2R1Y3QvdjAuMSIsCiAgICAgICAgICAicmVnb3BvbGljaWVzIjogW10KICAgICAgICB9CiAgICAgIF0sCiAgICAgICJmdW5jdGlvbmFyaWVzIjogWwogICAgICAgIHsKICAgICAgICAgICJ0eXBlIjogInB1YmxpY2tleSIsCiAgICAgICAgICAicHVibGlja2V5aWQiOiAiNWU4YzU3ZGY4YWU1OGZlOWEyOWIyOWY5OTkzZTJmYzNiMjViZDc1ZWIyNzU0ZjM1Mzg4MGJhZDRiOWViZmRiMyIKICAgICAgICB9CiAgICAgIF0KICAgIH0KICB9LAogICJwdWJsaWNrZXlzIjogewogICAgImFlMmRjYzk4OWVhOWMxMDlhMzZlOGViYTVjNGJjMTZkOGZhZmNmZThlMWE2MTQxNjQ2NzBkNTBhZWRhY2Q2NDciOiB7CiAgICAgICJrZXlpZCI6ICJhZTJkY2M5ODllYTljMTA5YTM2ZThlYmE1YzRiYzE2ZDhmYWZjZmU4ZTFhNjE0MTY0NjcwZDUwYWVkYWNkNjQ3IiwKICAgICAgImtleSI6ICJMUzB0TFMxQ1JVZEpUaUJRVlVKTVNVTWdTMFZaTFMwdExTMEtUVU52ZDBKUldVUkxNbFozUVhsRlFXWXlPVzlRVURoVloyaENlVWM0TlRKMVFtUlBlSEpLUzB0dU4wMU5OV2hVWWxBNVpYTm5UMW92YXpBOUNpMHRMUzB0UlU1RUlGQlZRa3hKUXlCTFJWa3RMUzB0TFFvPSIKICAgIH0sCiAgICAiNWU4YzU3ZGY4YWU1OGZlOWEyOWIyOWY5OTkzZTJmYzNiMjViZDc1ZWIyNzU0ZjM1Mzg4MGJhZDRiOWViZmRiMyI6IHsKICAgICAgImtleWlkIjogIjVlOGM1N2RmOGFlNThmZTlhMjliMjlmOTk5M2UyZmMzYjI1YmQ3NWViMjc1NGYzNTM4ODBiYWQ0YjllYmZkYjMiLAogICAgICAia2V5IjogIkxTMHRMUzFDUlVkSlRpQlFWVUpNU1VNZ1MwVlpMUzB0TFMwS1RVbEpRMGxxUVU1Q1oydHhhR3RwUnpsM01FSkJVVVZHUVVGUFEwRm5PRUZOU1VsRFEyZExRMEZuUlVGdlJUWjZURGR2TUc1alkzWkxiakJKVkZORVVBcFNXVUZoVG5SNlpsWXpPVkphVVZoMWFUVnBUWGxqVFdGelUzSldSMlkzYkVoS1RGUjJZV1pyUVdOTVUzaHVZM1JUZFdkYWQzcHJNbG80YTJGakswRmtDa3N4VjJjd2VtdEJkMlZvY2pKelZWWjFjV1k1ZDBaUVRVZHVlV1ZKVVhKUVRuaHRZMWhHYm5wNVdqWjNaVFJ4UW5CVlFtaHJkR1phY1dJNWJtMDVjVVVLVkRBNFNtSnZVa2RWZGxwSGFteDNja2xvWm1KWVIyUlRZbkEyY0cxWFFVVnFOVWRXT1VkMGJHc3dUV2c0WW1Gck5VeGlkM2h5WlVZelZYWmhVRTFzU3dwV1ZXZHNORFZGWVZZeFdWcFJXakkzTm1GVlNTdHBXaXRuTW5oMVFqbHlUR2Q1YTA0dlVsWk1TVWg1VkRBeVMweEJZWG81SzB4T05rVmhhRVF6V0hGSUNrcHRVbFZKWm1zeVEwVmxaVEJpVUhKSUwwYzJaMjFIUlZveFExZExMM2RNUTJoc01rVnBPVTVNWW5Vdk1qSXpaU3QwVFZwbWMxTXZVMFJyUjFobFEzVUtSM0JUVXpnckszVnlZa3BGWm5reVpFcHNVaXRpT0dsQ016VjBibGRTT1ZoTlVUUnpWME13YW5CSVFXNTNSbTFaT1hOUVRUTXdlRWwyUW5KNlRFbFJkd3BISzFGRFRYQmhSRmxETUdoWGFrSnpiMDlXVDB4cGJuSkNTREZYU0dWbVRFZFdkV1JtUTJZNGQxcFhOelVyUm5wUFJIUmhNRzVsV0VSWVdWUkNVMkZGQ21WRGIyTkdVU3RMVFRKc2FEaGxUakZJYjFwalRrWjJUemhoVEN0dFdrTlFTVEZYT1RVd01UbHplVkZtVFdncmVraExlRE5aVjNWblpqTnZiakF5Y0hRS1NHVjZUbFpqUVRZclZrUTJXbkpwTkdWcFpFa3JhbkJqYW1kT2VrMTZiblJ6U1dRNFJGcFVkV1ZQUlhWSGRVWkZZMU1yVGxGbk5uaHRSelF6VkhSdE5ncHdWbXd6YWtGaWRFVkJiRXd6ZVVwUGFURjRiMU0xWm0xMmJGTlBUbFZFYm1oWWNreExOa3BYVG5oNllVMDRSbEJGVm5kemJYUkxjWGRvYVM4NFRrNHJDbXBDVFhwcVJFdGFRbWRxT1hGdWVrSlhTSGRPTld4alEwRjNSVUZCVVQwOUNpMHRMUzB0UlU1RUlGQlZRa3hKUXlCTFJWa3RMUzB0TFFvPSIKICAgIH0KICB9Cn0=","payloadType":"https://witness.testifysec.com/policy/v0.1","signatures":[{"keyid":"ae2dcc989ea9c109a36e8eba5c4bc16d8fafcfe8e1a614164670d50aedacd647","sig":"azCV12o2L3AABWc/kZhF6dAb5kRYct3S0rJcOzU8OVvPaIqRhjmPeafS2Z0h6J0Lyh9WjAAlxvuy1qBFllA1CA=="}]}