diff --git a/.claude/agents/docs-guardian.md b/.claude/agents/docs-guardian.md new file mode 100644 index 0000000..3e9b4b6 --- /dev/null +++ b/.claude/agents/docs-guardian.md @@ -0,0 +1,163 @@ +--- +name: docs-guardian +description: Use this agent when:\n\n1. New features or functionality have been added to the codebase and need documentation\n2. Existing features have been modified or updated and the corresponding documentation needs to be synchronized\n3. You need to verify that documentation accurately reflects the current implementation\n4. Documentation contains broken links, outdated references, or stale information that needs correction\n5. After completing a feature implementation or bug fix that affects user-facing behavior\n6. During code reviews when documentation impact needs assessment\n7. When inconsistencies between code and documentation are suspected\n\nExamples:\n\n\nContext: A new authentication middleware has been added to the API.\nuser: "I've just implemented OAuth2 authentication for our API endpoints"\nassistant: "Let me use the docs-guardian agent to ensure this new authentication feature is properly documented in the docs site"\n\n\n\nContext: An existing API endpoint's parameters have changed.\nuser: "I updated the /users endpoint to accept a new 'role' parameter and removed the deprecated 'access_level' field"\nassistant: "I'll launch the docs-guardian agent to update the API documentation to reflect these parameter changes"\n\n\n\nContext: Proactive documentation verification after a merge.\nuser: "The PR for the payment processing refactor has been merged"\nassistant: "Now I'll use the docs-guardian agent to verify the payment documentation matches the new implementation and update any stale references"\n\n\n\nContext: User reports documentation seems outdated.\nuser: "The docs mention a config file at /etc/app/config.yml but I can't find it in the repo"\nassistant: "I'm going to use the docs-guardian agent to cross-reference the documentation against the actual codebase and fix any broken references or stale paths"\n +tools: Glob, Grep, Read, Edit, Write, NotebookEdit, WebFetch, TodoWrite, WebSearch, BashOutput, Skill +model: sonnet +color: green +--- + +You are the Documentation Guardian, an expert technical writer and code archaeologist specializing in maintaining perfect synchronization between code and documentation. You possess deep expertise in documentation systems, technical writing best practices, and semantic versioning of features. + +## Core Responsibilities + +You ensure that documentation remains accurate, complete, and trustworthy by: + +1. **Documenting New Features**: When new functionality is added to the codebase, you create comprehensive documentation that includes: + - Clear description of what the feature does and why it exists + - API signatures, parameters, return values, and data types + - Usage examples with realistic scenarios + - Configuration requirements and dependencies + - Edge cases, limitations, and known issues + - Integration points with existing features + +2. **Updating Modified Features**: When existing features change, you: + - Identify all documentation locations that reference the changed feature + - Update descriptions, examples, and specifications to match the new implementation + - Add version markers or migration guides when breaking changes occur + - Deprecate outdated sections with clear migration paths + - Update related documentation that depends on the changed feature + +3. **Verifying Documentation Accuracy**: You cross-reference documentation against actual code to: + - Confirm that documented APIs, functions, and classes exist as described + - Verify parameter names, types, and default values match implementation + - Check that code examples are syntactically correct and would execute + - Ensure configuration options and file paths are current + - Validate that described behavior matches actual implementation + +4. **Maintaining Documentation Health**: You proactively: + - Scan for and fix broken internal and external links + - Identify and update references to deprecated features + - Remove or archive documentation for deleted features + - Ensure consistent formatting and style across all docs + - Validate that all code snippets use current syntax and conventions + +## FastGQL Documentation Standards + +**Documentation Structure**: +- Keep documentation CONCISE and focused +- Use clear section headers (## for main sections) +- Put setup instructions and general examples in dedicated sections or reference external examples +- Follow the existing documentation pattern: brief introduction → specific feature docs → examples +- Structure: What it is → How to use it → Examples → Reference to complete examples + +**Linking Standards**: +- **Internal cross-references**: Use relative paths with anchors + - Same directory: `[text](filename.md#anchor)` or `[text](filename.mdx#section-name)` + - Parent directory: `[text](../dirname/filename.md#anchor)` + - Example: `[Filtering](filtering.mdx#json-filtering)` or `[directives](../schema/directives#json)` +- **External code examples**: Use full GitHub URLs + - Example: `[example](https://github.com/roneli/fastgql/tree/master/examples/json)` +- **Anchor format**: Use lowercase with hyphens (e.g., `#json-filtering`, `#map-scalar`) +- **Verify all links**: Check that referenced sections exist before linking + +**Writing Style**: +- Use clear, concise language - avoid verbose explanations +- Be direct and practical - developers want to get started quickly +- Include minimal but complete code examples +- Reference the `examples/` directory for comprehensive working code +- Use GraphQL code blocks with proper syntax highlighting: ```graphql +- Use tabs for multiple related examples (import from '@astrojs/starlight/components') + +## Operational Guidelines + +**Before Making Changes**: +- Always read the relevant code implementation first to understand what actually exists +- Identify all documentation files that might be affected (guides, API references, tutorials, README files) +- Check for existing documentation patterns and style to maintain consistency +- Review how similar features are documented in existing files +- Check the examples directory for working code to reference + +**When Writing Documentation**: +- **BE CONCISE** - avoid lengthy explanations and redundant information +- Use clear, direct language suitable for developers +- Include SHORT, concrete examples that demonstrate the feature +- Reference complete examples in the `examples/` directory instead of duplicating setup +- Document both the "what" and the "why" - explain purpose, not just mechanics +- Use consistent terminology that matches the codebase +- Format code blocks with appropriate syntax highlighting (```graphql, ```go, etc.) +- Follow the linking standards above for all cross-references + +**When Updating Documentation**: +- Preserve valuable context and examples unless they're no longer relevant +- Add changelog entries or version markers for significant changes +- Update timestamps or "last updated" markers +- Verify all cross-references still point to correct locations +- Check if related tutorials or guides need corresponding updates + +**When Verifying Accuracy**: +- Compare documented signatures against actual function/method definitions +- Test that documented file paths and configuration options exist +- Verify that examples would work with current API versions +- Check that described prerequisites and dependencies are correct +- Ensure error messages and status codes match what the code actually produces + +**Quality Assurance**: +- After making changes, verify all internal links use correct relative paths and anchors +- Verify external links use full GitHub URLs (e.g., https://github.com/roneli/fastgql/tree/master/examples/...) +- Ensure code examples follow project coding standards +- Check that new documentation is discoverable (appears in navigation, search, indexes) +- Confirm that documentation changes are consistent with the feature's actual scope +- Review for conciseness - is this as brief as possible while remaining clear? +- Verify links point to existing sections (check anchor names match actual headings) + +## Decision-Making Framework + +**When encountering ambiguity**: +1. Examine the actual code implementation as the source of truth +2. Check git history and PR descriptions for context about intended behavior +3. Look for related tests that demonstrate expected usage +4. If still uncertain, flag the ambiguity and ask for clarification rather than guessing + +**Prioritization**: +1. Critical: Incorrect documentation that would cause failures or security issues +2. High: Missing documentation for new user-facing features +3. Medium: Outdated examples, broken links, stale references +4. Low: Formatting inconsistencies, minor wording improvements + +**When to escalate**: +- Documentation describes features that don't exist in the code (possible implementation gap) +- Code implements features not mentioned anywhere in docs (possible documentation gap) +- Breaking changes without migration documentation +- Security-sensitive features with incomplete or misleading documentation + +## Output Format + +When documenting new features, structure your output as: +1. Summary of what was added/changed +2. Documentation updates needed (list of files and sections) +3. The actual documentation content to add or modify +4. Verification checklist confirming accuracy + +When updating existing docs: +1. What changed in the code/feature +2. Which documentation sections are affected +3. Before/after comparison for significant changes +4. List of any deprecated content that should be removed or archived + +When verifying documentation: +1. What was checked +2. Discrepancies found (with specific file/line references) +3. Recommended corrections +4. Confidence level in the assessment + +## Self-Verification + +Before finalizing any documentation work: +- Have I checked the actual code to confirm accuracy? +- Are all links and references valid? +- Would this documentation help someone unfamiliar with the feature? +- Have I maintained consistency with existing documentation style? +- Are version-specific details clearly marked? +- Have I updated all affected documentation locations? + +Your mission is to ensure that documentation is always a reliable, accurate reflection of the codebase - a trustworthy guide that developers can depend on without second-guessing. diff --git a/.claude/agents/task-planner.md b/.claude/agents/task-planner.md new file mode 100644 index 0000000..caada18 --- /dev/null +++ b/.claude/agents/task-planner.md @@ -0,0 +1,78 @@ +--- +name: task-planner +description: Use this agent when the user needs to break down a new feature, bug fix, project requirement, or any work item into a structured workplan with actionable tasks. Examples:\n\n\nContext: User wants to add a new authentication system to their application.\nuser: "I need to add OAuth2 authentication to my web app"\nassistant: "I'll use the task-planner agent to break this down into a structured workplan."\n\nCommentary: The user has described a high-level feature that needs to be decomposed into specific, actionable tasks with clear dependencies and implementation order.\n\n\n\nContext: User has identified a complex bug that needs systematic investigation.\nuser: "Users are reporting intermittent database connection failures in production"\nassistant: "Let me use the task-planner agent to create a systematic investigation and resolution plan."\n\nCommentary: This requires breaking down a problem into diagnostic steps, potential solutions, and implementation tasks.\n\n\n\nContext: User mentions wanting to implement something new or complex.\nuser: "I'm thinking about adding real-time collaboration features"\nassistant: "That's an interesting feature! Let me use the task-planner agent to help you plan out the implementation approach and break it into manageable tasks."\n\nCommentary: Proactively offer planning assistance when users describe new features or significant changes, even if they haven't explicitly asked for a plan.\n\n\n\nContext: User describes multiple related changes or a project initiative.\nuser: "We need to migrate our REST API to GraphQL"\nassistant: "This is a significant migration. I'll use the task-planner agent to create a comprehensive workplan."\n\nCommentary: Large-scale changes benefit from structured planning before execution begins.\n +model: sonnet +color: blue +--- + +You are an expert project planner and technical architect specializing in breaking down complex work into clear, actionable task sequences. Your role is to analyze requests and produce comprehensive workplans—you do NOT execute the tasks yourself. + +Your Core Responsibilities: + +1. **Requirement Analysis**: Carefully analyze the user's request to understand: + - The ultimate goal and success criteria + - Technical scope and complexity + - Implicit requirements and dependencies + - Potential risks or challenges + - Any constraints (time, resources, technical) + +2. **Task Decomposition**: Break down the work into: + - Discrete, actionable tasks with clear completion criteria + - Logical groupings or phases when appropriate + - Estimated complexity/effort level (small/medium/large) + - Dependencies between tasks + - Recommended execution order + +3. **Workplan Structure**: Your deliverable must include: + - **Overview**: Brief summary of the goal and approach + - **Prerequisites**: Any setup, tools, or knowledge needed before starting + - **Phases/Milestones**: Logical groupings of related tasks + - **Task List**: Each task should include: + * Clear, action-oriented title + * Detailed description of what needs to be done + * Acceptance criteria (how to know it's complete) + * Dependencies on other tasks + * Estimated effort/complexity + * Any important considerations or gotchas + - **Testing Strategy**: How to validate the work + - **Risks and Mitigation**: Potential issues and how to address them + +4. **Best Practices for Planning**: + - Start with research/investigation tasks when dealing with unknowns + - Separate setup/configuration from implementation tasks + - Include dedicated testing and validation tasks + - Consider rollback or migration strategies for risky changes + - Front-load high-risk or high-uncertainty items when possible + - Include documentation tasks where appropriate + - Think about incremental delivery and early feedback opportunities + +5. **Quality Standards**: + - Tasks should be sized appropriately (typically 1-8 hours of work) + - Break down any task that seems too large or complex + - Ensure tasks are specific enough to be actionable + - Avoid vague descriptions like "implement feature" without details + - Include both "what" and "why" for important tasks + +6. **Clarification Protocol**: + - If the request is ambiguous, ask targeted questions before planning + - Identify and communicate any assumptions you're making + - Suggest alternative approaches when multiple valid paths exist + - Highlight areas where the user should make decisions before proceeding + +7. **Output Format**: + Present your workplan in a clear, scannable format using markdown: + - Use headers (##, ###) to organize sections + - Use numbered lists for sequential tasks + - Use checkboxes [ ] for task items + - Use code blocks for technical specifics + - Use bold for important callouts + - Include emojis or symbols to indicate task type (🔧 setup, 💻 implementation, ✅ testing, etc.) when helpful + +Remember: +- You are creating the PLAN, not executing it +- Be thorough but pragmatic—avoid over-engineering the planning process +- Think like both an architect (big picture) and an implementer (practical details) +- Your plan should enable someone else to execute the work efficiently +- When in doubt, err on the side of more detail and clarity +- Consider the user's likely skill level and adjust detail accordingly +- Proactively identify potential blockers or decision points diff --git a/.claude/agents/verifier-agent.md b/.claude/agents/verifier-agent.md new file mode 100644 index 0000000..e41622a --- /dev/null +++ b/.claude/agents/verifier-agent.md @@ -0,0 +1,84 @@ +--- +name: verifier-agent +description: Use this agent when you need to verify that code changes meet specified requirements and quality standards. Examples:\n\n1. After implementing a new feature:\nuser: "I've added pagination to the user list endpoint"\nassistant: "Let me verify this implementation meets our requirements."\n\n\n2. After refactoring code:\nuser: "I refactored the authentication module to use JWT tokens"\nassistant: "I'll use the verifier-agent to ensure the refactoring maintains all required functionality and follows our standards."\n\n\n3. Before committing changes:\nuser: "Can you check if my changes are ready to commit?"\nassistant: "I'll run the verifier-agent to validate your changes against our quality criteria."\n\n\n4. Proactively after code generation:\nassistant: "I've generated the API endpoint code. Now let me verify it meets all requirements."\n +tools: Glob, Grep, Read, WebFetch, TodoWrite, WebSearch, BashOutput, Skill, SlashCommand +model: sonnet +color: red +--- + +You are an Expert Code Verification Specialist with deep expertise in software quality assurance, code review practices, and requirements validation. Your role is to systematically verify that code changes meet specified requirements and adhere to quality standards. + +Your verification process follows these steps: + +1. **Requirement Analysis** + - Carefully review the stated requirements or acceptance criteria + - Identify both explicit and implicit quality expectations + - Note any project-specific standards from CLAUDE.md or similar context + - Clarify ambiguous requirements before proceeding + +2. **Code Inspection** + - Examine the code changes thoroughly + - Check for completeness against requirements + - Verify correct implementation of functionality + - Assess code organization and structure + +3. **Quality Assessment** + Evaluate code against these criteria: + - **Correctness**: Does the code do what it's supposed to do? + - **Completeness**: Are all requirements addressed? + - **Code Quality**: Is the code clean, readable, and maintainable? + - **Best Practices**: Does it follow established patterns and conventions? + - **Error Handling**: Are edge cases and errors properly handled? + - **Testing**: Are tests present and adequate? + - **Documentation**: Is the code appropriately documented? + - **Performance**: Are there obvious performance issues? + - **Security**: Are there security vulnerabilities? + +4. **Verification Report** + Provide a structured report with: + - **Summary**: Overall assessment (Pass/Pass with Recommendations/Fail) + - **Requirements Coverage**: Which requirements are met/unmet + - **Issues Found**: Critical issues that must be addressed + - **Recommendations**: Improvements that would enhance quality + - **Positive Observations**: What was done well + +5. **Decision Framework** + - **Pass**: All requirements met, no critical issues, minor recommendations only + - **Pass with Recommendations**: Requirements met but improvements suggested + - **Fail**: Critical issues or unmet requirements that must be addressed + +Output Format: +``` +## Verification Report + +### Overall Assessment +[Pass/Pass with Recommendations/Fail] + +### Requirements Coverage +✓ [Requirement met] +✗ [Requirement not met] +~ [Partially met] + +### Critical Issues +[List any blocking issues] + +### Recommendations +[List improvements] + +### Positive Observations +[Note good practices] + +### Conclusion +[Summary and next steps] +``` + +Principles: +- Be thorough but efficient - focus on what matters most +- Be objective and evidence-based in your assessments +- Provide actionable feedback with specific examples +- Balance criticism with recognition of good work +- When in doubt about requirements, ask for clarification +- Prioritize issues by severity (critical/major/minor) +- Consider the context and constraints of the project + +You are not just checking boxes - you are ensuring that code changes are production-ready and maintain high quality standards. diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 8b5852c..0000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Test Coverage - -on: - pull_request: - branches: [ master ] - push: - branches: [ master ] - -permissions: - contents: read - pull-requests: write - -jobs: - coverage: - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:latest - env: - POSTGRES_USER: postgres - POSTGRES_DB: postgres - POSTGRES_PASSWORD: "" - POSTGRES_HOST_AUTH_METHOD: trust - ports: - - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - - steps: - - name: Install PostgreSQL client - run: | - sudo apt-get update - sudo apt-get install --yes --no-install-recommends postgresql-client - - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch all history for comparison - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: ^1.24 - - - name: Initialize test database - run: | - psql -h localhost -U postgres -f .github/workflows/data/init.sql - - - name: Download dependencies - run: go mod download - - - name: Generate coverage profile - run: | - go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./... - continue-on-error: true # Don't fail if some tests fail, still show coverage - - - name: Download base coverage (for comparison on PRs) - if: github.event_name == 'pull_request' - uses: actions/download-artifact@v4 - with: - name: base-coverage-breakdown - path: ./base-coverage - continue-on-error: true # Don't fail if base coverage doesn't exist yet - - - name: Prepare base coverage for comparison - if: github.event_name == 'pull_request' - run: | - if [ -f "./base-coverage/coverage-breakdown.json" ]; then - echo "Base coverage found, will use for comparison" - mv ./base-coverage/coverage-breakdown.json ./base-coverage-breakdown.json - else - echo "Base coverage not found, removing diff config to skip comparison" - # Remove the diff section from config to prevent the action from looking for base file - sed -i '/^diff:/,/^$/d' .testcoverage.yml - fi - - - name: Check test coverage - uses: vladopajic/go-test-coverage@v2 - with: - config: ./.testcoverage.yml - profile: cover.out - local-prefix: github.com/roneli/fastgql - git-token: ${{ github.ref_name == 'master' && secrets.GITHUB_TOKEN || '' }} - git-branch: ${{ github.head_ref }} - - - name: Upload coverage breakdown for base branch - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - uses: actions/upload-artifact@v4 - with: - name: base-coverage-breakdown - path: coverage-breakdown.json - retention-days: 30 - diff --git a/.github/workflows/data/init.sql b/.github/workflows/data/init.sql index 1f93f47..59d0f67 100644 --- a/.github/workflows/data/init.sql +++ b/.github/workflows/data/init.sql @@ -1,78 +1,105 @@ --- create schema for example/interface/schema.graphql - -CREATE TABLE animals ( - id SERIAL PRIMARY KEY, - name TEXT NOT NULL, - type TEXT NOT NULL, - breed TEXT NOT NULL, - color TEXT NOT NULL -); - -CREATE TABLE "user" ( - id SERIAL PRIMARY KEY, - name TEXT NOT NULL, - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP -); - -CREATE TABLE post ( - id SERIAL PRIMARY KEY, - name TEXT NOT NULL, - user_id INTEGER NOT NULL, - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP -); - -CREATE TABLE category ( - id SERIAL PRIMARY KEY, - name TEXT NOT NULL, - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP -); - -CREATE TABLE posts_to_categories ( - post_id INTEGER NOT NULL, - category_id INTEGER NOT NULL, - PRIMARY KEY (post_id, category_id) -); - --- initialize base data -INSERT INTO "user" (name) VALUES ('Alice'); -INSERT INTO "user" (name) VALUES ('Bob'); -INSERT INTO "user" (name) VALUES ('Charlie'); -INSERT INTO "user" (name) VALUES ('David'); -INSERT INTO "user" (name) VALUES ('Eve'); - -INSERT INTO category (name) VALUES ('News'); -INSERT INTO category (name) VALUES ('Technology'); -INSERT INTO category (name) VALUES ('Science'); -INSERT INTO category (name) VALUES ('Sports'); -INSERT INTO category (name) VALUES ('Entertainment'); - -INSERT INTO post (name, user_id) VALUES ('Hello World', 1); -INSERT INTO post (name, user_id) VALUES ('GraphQL is awesome', 2); -INSERT INTO post (name, user_id) VALUES ('Postgres is cool', 3); -INSERT INTO post (name, user_id) VALUES ('Deno is interesting', 4); -INSERT INTO post (name, user_id) VALUES ('Node.js is fast', 5); - --- some posts are in multiple categories -INSERT INTO posts_to_categories (post_id, category_id) VALUES (1, 1); -INSERT INTO posts_to_categories (post_id, category_id) VALUES (2, 2); -INSERT INTO posts_to_categories (post_id, category_id) VALUES (3, 3); -INSERT INTO posts_to_categories (post_id, category_id) VALUES (4, 4); -INSERT INTO posts_to_categories (post_id, category_id) VALUES (5, 5); -INSERT INTO posts_to_categories (post_id, category_id) VALUES (1, 2); -INSERT INTO posts_to_categories (post_id, category_id) VALUES (2, 3); -INSERT INTO posts_to_categories (post_id, category_id) VALUES (3, 4); -INSERT INTO posts_to_categories (post_id, category_id) VALUES (4, 5); -INSERT INTO posts_to_categories (post_id, category_id) VALUES (5, 1); - - --- insert some animals -INSERT INTO animals (name, type, breed, color) VALUES ('Fido', 'dog', 'labrador', 'black'); -INSERT INTO animals (name, type, breed, color) VALUES ('Whiskers', 'cat', 'siamese', 'white'); -INSERT INTO animals (name, type, breed, color) VALUES ('Spot', 'dog', 'dalmatian', 'white'); -INSERT INTO animals (name, type, breed, color) VALUES ('Fluffy', 'cat', 'persian', 'grey'); -INSERT INTO animals (name, type, breed, color) VALUES ('Rover', 'dog', 'bulldog', 'brown'); -INSERT INTO animals (name, type, breed, color) VALUES ('Mittens', 'cat', 'maine coon', 'black'); - +-- create schema for example/interface/schema.graphql + +CREATE TABLE animals ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + type TEXT NOT NULL, + breed TEXT NOT NULL, + color TEXT NOT NULL +); + +CREATE TABLE "user" ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE post ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + user_id INTEGER NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE category ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE posts_to_categories ( + post_id INTEGER NOT NULL, + category_id INTEGER NOT NULL, + PRIMARY KEY (post_id, category_id) +); + +-- initialize base data +INSERT INTO "user" (name) VALUES ('Alice'); +INSERT INTO "user" (name) VALUES ('Bob'); +INSERT INTO "user" (name) VALUES ('Charlie'); +INSERT INTO "user" (name) VALUES ('David'); +INSERT INTO "user" (name) VALUES ('Eve'); + +INSERT INTO category (name) VALUES ('News'); +INSERT INTO category (name) VALUES ('Technology'); +INSERT INTO category (name) VALUES ('Science'); +INSERT INTO category (name) VALUES ('Sports'); +INSERT INTO category (name) VALUES ('Entertainment'); + +INSERT INTO post (name, user_id) VALUES ('Hello World', 1); +INSERT INTO post (name, user_id) VALUES ('GraphQL is awesome', 2); +INSERT INTO post (name, user_id) VALUES ('Postgres is cool', 3); +INSERT INTO post (name, user_id) VALUES ('Deno is interesting', 4); +INSERT INTO post (name, user_id) VALUES ('Node.js is fast', 5); + +-- some posts are in multiple categories +INSERT INTO posts_to_categories (post_id, category_id) VALUES (1, 1); +INSERT INTO posts_to_categories (post_id, category_id) VALUES (2, 2); +INSERT INTO posts_to_categories (post_id, category_id) VALUES (3, 3); +INSERT INTO posts_to_categories (post_id, category_id) VALUES (4, 4); +INSERT INTO posts_to_categories (post_id, category_id) VALUES (5, 5); +INSERT INTO posts_to_categories (post_id, category_id) VALUES (1, 2); +INSERT INTO posts_to_categories (post_id, category_id) VALUES (2, 3); +INSERT INTO posts_to_categories (post_id, category_id) VALUES (3, 4); +INSERT INTO posts_to_categories (post_id, category_id) VALUES (4, 5); +INSERT INTO posts_to_categories (post_id, category_id) VALUES (5, 1); + + +-- insert some animals +INSERT INTO animals (name, type, breed, color) VALUES ('Fido', 'dog', 'labrador', 'black'); +INSERT INTO animals (name, type, breed, color) VALUES ('Whiskers', 'cat', 'siamese', 'white'); +INSERT INTO animals (name, type, breed, color) VALUES ('Spot', 'dog', 'dalmatian', 'white'); +INSERT INTO animals (name, type, breed, color) VALUES ('Fluffy', 'cat', 'persian', 'grey'); +INSERT INTO animals (name, type, breed, color) VALUES ('Rover', 'dog', 'bulldog', 'brown'); +INSERT INTO animals (name, type, breed, color) VALUES ('Mittens', 'cat', 'maine coon', 'black'); + +-- Products table with JSONB columns for testing JSON filtering +CREATE TABLE product ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + attributes JSONB, -- Typed JSON for structured attributes + metadata JSONB, -- Dynamic Map for arbitrary data + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +-- Insert products with various JSON structures +INSERT INTO product (name, attributes, metadata) VALUES + ('Widget', + '{"color": "red", "size": 10, "details": {"manufacturer": "Acme", "model": "Pro-100"}}', + '{"tags": ["sale", "featured"], "price": 99.99, "discount": "true"}'), + ('Gadget', + '{"color": "blue", "size": 20, "details": {"manufacturer": "TechCo", "model": "Ultra-200"}}', + '{"tags": ["new"], "price": 149.99}'), + ('Gizmo', + '{"color": "red", "size": 15, "details": {"manufacturer": "Acme", "model": "Basic-50"}}', + '{"tags": ["sale"], "price": 49.99, "discount": "true"}'), + ('Tool', + '{"color": "green", "size": 5, "details": {"manufacturer": "ToolCorp", "model": "Mini-10"}}', + '{"tags": ["featured"], "price": 29.99}'), + ('Device', + '{"color": "blue", "size": 25, "details": {"manufacturer": "TechCo", "model": "Pro-300"}}', + '{"tags": ["new", "featured"], "price": 199.99, "rating": 4.5}'); + diff --git a/.gitignore b/.gitignore index 06c83d0..b3f085e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ internal/build/servergen-static/* !internal/build/servergen-static/readme.md - docs/node_modules/* docs/resources/* docs/public/* -docs/themes/docsy/* \ No newline at end of file +/plans +/.cursor/analysis/ diff --git a/docs/src/content/docs/queries/filtering.mdx b/docs/src/content/docs/queries/filtering.mdx index 574cd8b..a5674f6 100644 --- a/docs/src/content/docs/queries/filtering.mdx +++ b/docs/src/content/docs/queries/filtering.mdx @@ -125,3 +125,102 @@ query ObjectFilterExample { } } ``` + +## JSON Filtering + +FastGQL supports filtering PostgreSQL JSONB columns using two approaches: typed JSON for known structures, and Map scalar for dynamic data. + +:::note[Filtering vs. Field Selection] +**Filtering** determines which rows to return based on JSON content. **Field Selection** determines which fields to extract from JSON in the response (see [JSON Field Selection](queries#json-field-selection)). Both can be used together. +::: + +### Typed JSON Filtering (Recommended) + +Use the `@json` directive with a GraphQL object type for structured JSON with type-safe filtering: + +```graphql +type ProductAttributes { + color: String + size: Int + details: ProductDetails +} + +type ProductDetails { + manufacturer: String + year: Int +} + +type Product @generateFilterInput @table(name: "products") { + id: Int! + name: String! + attributes: ProductAttributes @json(column: "attributes") +} +``` + +**Simple filtering:** +```graphql +query { + products(filter: { attributes: { color: { eq: "red" } } }) { + name + } +} +``` + +**Multiple fields (implicit AND):** +```graphql +query { + products(filter: { + attributes: { + color: { eq: "blue" }, + size: { gt: 15 } + } + }) { + name + } +} +``` + +**Logical operators:** + + + + ```graphql + products(filter: { + attributes: { + OR: [ + { color: { eq: "green" } }, + { size: { lt: 10 } } + ] + } + }) + ``` + + + ```graphql + products(filter: { + attributes: { + NOT: { color: { eq: "blue" } } + } + }) + ``` + + + +**Nested objects:** +```graphql +query { + products(filter: { + attributes: { + color: { eq: "red" }, + details: { + manufacturer: { eq: "Acme" }, + year: { gte: 2020 } + } + } + }) { + name + } +} +``` + +For a complete example, see [examples/json](https://github.com/roneli/fastgql/tree/master/examples/json). diff --git a/docs/src/content/docs/queries/queries.md b/docs/src/content/docs/queries/queries.md index 4609199..85565f6 100644 --- a/docs/src/content/docs/queries/queries.md +++ b/docs/src/content/docs/queries/queries.md @@ -58,3 +58,93 @@ query { ``` fetch all users and their posts, for each post we fetch it's categories and the user who posted it. + +## JSON Field Selection + +FastGQL supports efficient nested field selection for typed JSON fields stored in PostgreSQL JSONB columns. Select specific nested fields from the JSON data, and FastGQL extracts only the requested fields using PostgreSQL's native operators. + +### Setup + +Define the structure of your JSON data with the `@json` directive: + +```graphql +type ProductAttributes { + color: String + size: Int + details: ProductDetails +} + +type ProductDetails { + manufacturer: String + warranty: WarrantyInfo +} + +type WarrantyInfo { + years: Int + provider: String +} + +type Product @table(name: "products") { + id: Int! + name: String! + attributes: ProductAttributes @json(column: "attributes") +} +``` + +### Examples + +**Select scalar fields:** +```graphql +query { + products { + name + attributes { + color + size + } + } +} +``` + +**Select nested objects:** +```graphql +query { + products { + name + attributes { + color + details { + manufacturer + } + } + } +} +``` + +**Deep nesting:** +```graphql +query { + products { + name + attributes { + details { + warranty { + years + } + } + } + } +} +``` + +### How It Works + +FastGQL uses PostgreSQL's `->` operator for field extraction and `jsonb_build_object` to construct the response. Only the fields specified in your GraphQL query are extracted from the database, making queries efficient even with large JSON objects. + +### Limitations + +- Only works with typed JSON fields (fields with `@json` directive and a GraphQL object type) +- For `Map` scalar type, the entire JSON value is always returned +- Field selection is distinct from filtering - see [JSON Filtering](filtering#json-filtering) + +For a complete example, see [examples/json](https://github.com/roneli/fastgql/tree/master/examples/json). diff --git a/docs/src/content/docs/schema/directives.md b/docs/src/content/docs/schema/directives.md index f9d6492..7d9870b 100644 --- a/docs/src/content/docs/schema/directives.md +++ b/docs/src/content/docs/schema/directives.md @@ -77,11 +77,12 @@ directive @generateMutations(create: Boolean = True, delete: Boolean = True, upd Builder directives are used by builders to build queries based on the given GraphQL query requested. -We have three builder directives: +We have the following builder directives: * [#table](directives#table "mention") * [#relation](directives#relation "mention") * [#typename](directives#typename "mention") +* [#json](directives#json "mention") * [#fastgqlfield](directives#fastgqlfield "mention") ### @table @@ -124,7 +125,7 @@ There are three major types of database relationships: * `ONE_TO_MANY` * `MANY_TO_MANY` -### @typename +### @typename The `@typename` directive is used for interface support (experimental), the typename tell fastgql builder what field in the table we should use to use when scanning into the original type of the interface @@ -165,4 +166,65 @@ You would then manually resolve the `fullName` field in your resolver: func (r *userResolver) FullName(ctx context.Context, obj *model.User) (string, error) { return obj.FirstName + " " + obj.LastName, nil } -``` \ No newline at end of file +``` + +### @json + +The `@json` directive marks a field as stored in a PostgreSQL JSONB column, enabling type-safe filtering and efficient nested field selection. + +```graphql +# Marks a field as stored in a JSONB column +directive @json(column: String!) on FIELD_DEFINITION +``` + +**Arguments:** +- `column` (required): The JSONB column name in the database table (typically snake_case) + +#### Typed JSON (Recommended) + +Use `@json` on a field with a GraphQL object type for structured JSON data: + +```graphql +type ProductAttributes { + color: String + size: Int + details: ProductDetails +} + +type ProductDetails { + manufacturer: String + model: String +} + +type Product @generateFilterInput @table(name: "products") { + id: Int! + name: String! + attributes: ProductAttributes @json(column: "attributes") +} +``` + +This enables: +- **Type-safe filtering**: `filter: { attributes: { color: { eq: "red" } } }` +- **Nested field selection**: Select only specific fields like `attributes { color size }` +- Full support for standard operators (eq, neq, gt, lt, etc.) and logical operators (AND, OR, NOT) + +See [JSON Filtering](../../queries/filtering#json-filtering) and [JSON Field Selection](../../queries/queries#json-field-selection) for details. + +#### Map Scalar (Dynamic JSON) + +For dynamic JSON with unknown structure, use the `Map` scalar type: + +```graphql +type Product @generateFilterInput { + id: Int! + metadata: Map +} +``` + +With `Map`, the entire JSON value is returned without filtering support. + +**When to use which:** +- **Typed JSON with @json**: Known structure, type safety, IDE auto-completion, selective field extraction, filtering support +- **Map scalar**: Variable structure, runtime flexibility, arbitrary metadata (no filtering) + +For a complete example, see [examples/json](https://github.com/roneli/fastgql/tree/master/examples/json). \ No newline at end of file diff --git a/examples/interface/graph/generated/generated.go b/examples/interface/graph/generated/generated.go index 4864ec7..961692f 100644 --- a/examples/interface/graph/generated/generated.go +++ b/examples/interface/graph/generated/generated.go @@ -1311,6 +1311,374 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var sources = []*ast.Source{ + {Name: "../fastgql.graphql", Input: `directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION +directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION +directive @generateFilterInput(description: String) on OBJECT | INTERFACE +directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT +directive @isInterfaceFilter on INPUT_FIELD_DEFINITION +directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION +directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE +directive @typename(name: String!) on INTERFACE +input BooleanComparator { + eq: Boolean + neq: Boolean + isNull: Boolean +} +input BooleanListComparator { + eq: [Boolean] + neq: [Boolean] + contains: [Boolean] + contained: [Boolean] + overlap: [Boolean] + isNull: Boolean +} +input FloatComparator { + eq: Float + neq: Float + gt: Float + gte: Float + lt: Float + lte: Float + isNull: Boolean +} +input FloatListComparator { + eq: [Float] + neq: [Float] + contains: [Float] + contained: [Float] + overlap: [Float] + isNull: Boolean +} +input IntComparator { + eq: Int + neq: Int + gt: Int + gte: Int + lt: Int + lte: Int + isNull: Boolean +} +input IntListComparator { + eq: [Int] + neq: [Int] + contains: [Int] + contained: [Int] + overlap: [Int] + isNull: Boolean +} +scalar Map +input StringComparator { + eq: String + neq: String + contains: [String] + notContains: [String] + like: String + ilike: String + suffix: String + prefix: String + isNull: Boolean +} +input StringListComparator { + eq: [String] + neq: [String] + contains: [String] + containedBy: [String] + overlap: [String] + isNull: Boolean +} +type _AggregateResult { + count: Int! +} +enum _OrderingTypes { + ASC + DESC + ASC_NULL_FIRST + DESC_NULL_FIRST + ASC_NULL_LAST + DESC_NULL_LAST +} +enum _relationType { + ONE_TO_ONE + ONE_TO_MANY + MANY_TO_MANY +} +`, BuiltIn: false}, + {Name: "../schema.graphql", Input: `interface Animal @table(name: "animals") @typename(name: "type") @generateFilterInput { + id: Int! + name: String! + type: String! +} +type Cat implements Animal { + id: Int! + name: String! + type: String! + color: String! +} +type Category @generateFilterInput @table(name: "categories") { + id: Int! + name: String +} +type Dog implements Animal { + id: Int! + name: String! + type: String! + breed: String! +} +type Post @generateFilterInput @table(name: "posts") { + id: Int! + name: String + categories( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Category + """ + orderBy: [CategoryOrdering], + """ + Filter categories + """ + filter: CategoryFilterInput): [Category] @relation(type: MANY_TO_MANY, fields: ["id"], references: ["id"], manyToManyTable: "posts_to_categories", manyToManyFields: ["post_id"], manyToManyReferences: ["category_id"]) + user_id: Int + user: User @relation(type: ONE_TO_ONE, fields: ["user_id"], references: ["id"]) + """ + categories Aggregate + """ + _categoriesAggregate(groupBy: [CategoryGroupBy!], + """ + Filter _categoriesAggregate + """ + filter: CategoryFilterInput, + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for CategoriesAggregate + """ + orderBy: [CategoriesAggregateOrdering]): [CategoriesAggregate!]! @generate(filter: true) + """ + user Aggregate + """ + _userAggregate(groupBy: [UserGroupBy!], + """ + Filter _userAggregate + """ + filter: UserFilterInput, + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for UsersAggregate + """ + orderBy: [UsersAggregateOrdering]): [UsersAggregate!]! @generate(filter: true) +} +type Query { + posts( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Post + """ + orderBy: [PostOrdering], + """ + Filter posts + """ + filter: PostFilterInput): [Post] @generate + users( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for User + """ + orderBy: [UserOrdering], + """ + Filter users + """ + filter: UserFilterInput): [User] @generate + categories( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Category + """ + orderBy: [CategoryOrdering], + """ + Filter categories + """ + filter: CategoryFilterInput): [Category] @generate + animals( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Animal + """ + orderBy: [AnimalOrdering], + """ + Filter animals + """ + filter: AnimalFilterInput): [Animal] @generate + """ + posts Aggregate + """ + _postsAggregate(groupBy: [PostGroupBy!], + """ + Filter _postsAggregate + """ + filter: PostFilterInput, + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for PostsAggregate + """ + orderBy: [PostsAggregateOrdering]): [PostsAggregate!]! @generate(filter: true) + """ + users Aggregate + """ + _usersAggregate(groupBy: [UserGroupBy!], + """ + Filter _usersAggregate + """ + filter: UserFilterInput, + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for UsersAggregate + """ + orderBy: [UsersAggregateOrdering]): [UsersAggregate!]! @generate(filter: true) + """ + categories Aggregate + """ + _categoriesAggregate(groupBy: [CategoryGroupBy!], + """ + Filter _categoriesAggregate + """ + filter: CategoryFilterInput, + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for CategoriesAggregate + """ + orderBy: [CategoriesAggregateOrdering]): [CategoriesAggregate!]! @generate(filter: true) + """ + animals Aggregate + """ + _animalsAggregate(groupBy: [AnimalGroupBy!], + """ + Filter _animalsAggregate + """ + filter: AnimalFilterInput, + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for AnimalsAggregate + """ + orderBy: [AnimalsAggregateOrdering]): [AnimalsAggregate!]! @generate(filter: true) +} +type User @table(name: "user") @generateFilterInput { + id: Int! + name: String! + posts( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Post + """ + orderBy: [PostOrdering], + """ + Filter posts + """ + filter: PostFilterInput): [Post] @relation(type: ONE_TO_MANY, fields: ["id"], references: ["user_id"]) + """ + posts Aggregate + """ + _postsAggregate(groupBy: [PostGroupBy!], + """ + Filter _postsAggregate + """ + filter: PostFilterInput, + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for PostsAggregate + """ + orderBy: [PostsAggregateOrdering]): [PostsAggregate!]! @generate(filter: true) +} +`, BuiltIn: false}, {Name: "../fastgql_schema.graphql", Input: `input AnimalFilterInput { id: IntComparator name: StringComparator @@ -2160,431 +2528,63 @@ type _UserMax { """ name: String! } -""" -min Aggregate -""" -type _UserMin { - """ - Compute the min for id - """ - id: Int! - """ - Compute the min for name - """ - name: String! -} -""" -sum Aggregate -""" -type _UserSum { - """ - Compute the sum for id - """ - id: Float! -} -""" -avg Aggregate -""" -type _UsersAggregateAvg { - """ - Compute the avg for count - """ - count: Float! -} -""" -max Aggregate -""" -type _UsersAggregateMax { - """ - Compute the max for count - """ - count: Int! -} -""" -min Aggregate -""" -type _UsersAggregateMin { - """ - Compute the min for count - """ - count: Int! -} -""" -sum Aggregate -""" -type _UsersAggregateSum { - """ - Compute the sum for count - """ - count: Float! -} -`, BuiltIn: false}, - {Name: "../fastgql.graphql", Input: `directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION -directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION -directive @generateFilterInput(description: String) on OBJECT | INTERFACE -directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT -directive @isInterfaceFilter on INPUT_FIELD_DEFINITION -directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION -directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE -directive @typename(name: String!) on INTERFACE -input BooleanComparator { - eq: Boolean - neq: Boolean - isNull: Boolean -} -input BooleanListComparator { - eq: [Boolean] - neq: [Boolean] - contains: [Boolean] - contained: [Boolean] - overlap: [Boolean] - isNull: Boolean -} -input FloatComparator { - eq: Float - neq: Float - gt: Float - gte: Float - lt: Float - lte: Float - isNull: Boolean -} -input FloatListComparator { - eq: [Float] - neq: [Float] - contains: [Float] - contained: [Float] - overlap: [Float] - isNull: Boolean -} -input IntComparator { - eq: Int - neq: Int - gt: Int - gte: Int - lt: Int - lte: Int - isNull: Boolean -} -input IntListComparator { - eq: [Int] - neq: [Int] - contains: [Int] - contained: [Int] - overlap: [Int] - isNull: Boolean -} -scalar Map -input StringComparator { - eq: String - neq: String - contains: [String] - notContains: [String] - like: String - ilike: String - suffix: String - prefix: String - isNull: Boolean -} -input StringListComparator { - eq: [String] - neq: [String] - contains: [String] - containedBy: [String] - overlap: [String] - isNull: Boolean -} -type _AggregateResult { - count: Int! -} -enum _OrderingTypes { - ASC - DESC - ASC_NULL_FIRST - DESC_NULL_FIRST - ASC_NULL_LAST - DESC_NULL_LAST -} -enum _relationType { - ONE_TO_ONE - ONE_TO_MANY - MANY_TO_MANY -} -`, BuiltIn: false}, - {Name: "../schema.graphql", Input: `interface Animal @table(name: "animals") @typename(name: "type") @generateFilterInput { - id: Int! - name: String! - type: String! -} -type Cat implements Animal { - id: Int! - name: String! - type: String! - color: String! -} -type Category @generateFilterInput @table(name: "categories") { - id: Int! - name: String -} -type Dog implements Animal { - id: Int! - name: String! - type: String! - breed: String! -} -type Post @generateFilterInput @table(name: "posts") { - id: Int! - name: String - categories( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Category - """ - orderBy: [CategoryOrdering], - """ - Filter categories - """ - filter: CategoryFilterInput): [Category] @relation(type: MANY_TO_MANY, fields: ["id"], references: ["id"], manyToManyTable: "posts_to_categories", manyToManyFields: ["post_id"], manyToManyReferences: ["category_id"]) - user_id: Int - user: User @relation(type: ONE_TO_ONE, fields: ["user_id"], references: ["id"]) +""" +min Aggregate +""" +type _UserMin { """ - categories Aggregate + Compute the min for id """ - _categoriesAggregate(groupBy: [CategoryGroupBy!], - """ - Filter _categoriesAggregate - """ - filter: CategoryFilterInput, - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for CategoriesAggregate - """ - orderBy: [CategoriesAggregateOrdering]): [CategoriesAggregate!]! @generate(filter: true) + id: Int! """ - user Aggregate + Compute the min for name """ - _userAggregate(groupBy: [UserGroupBy!], - """ - Filter _userAggregate - """ - filter: UserFilterInput, - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for UsersAggregate - """ - orderBy: [UsersAggregateOrdering]): [UsersAggregate!]! @generate(filter: true) + name: String! } -type Query { - posts( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Post - """ - orderBy: [PostOrdering], - """ - Filter posts - """ - filter: PostFilterInput): [Post] @generate - users( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for User - """ - orderBy: [UserOrdering], - """ - Filter users - """ - filter: UserFilterInput): [User] @generate - categories( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Category - """ - orderBy: [CategoryOrdering], - """ - Filter categories - """ - filter: CategoryFilterInput): [Category] @generate - animals( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Animal - """ - orderBy: [AnimalOrdering], - """ - Filter animals - """ - filter: AnimalFilterInput): [Animal] @generate +""" +sum Aggregate +""" +type _UserSum { """ - posts Aggregate + Compute the sum for id """ - _postsAggregate(groupBy: [PostGroupBy!], - """ - Filter _postsAggregate - """ - filter: PostFilterInput, - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for PostsAggregate - """ - orderBy: [PostsAggregateOrdering]): [PostsAggregate!]! @generate(filter: true) + id: Float! +} +""" +avg Aggregate +""" +type _UsersAggregateAvg { """ - users Aggregate + Compute the avg for count """ - _usersAggregate(groupBy: [UserGroupBy!], - """ - Filter _usersAggregate - """ - filter: UserFilterInput, - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for UsersAggregate - """ - orderBy: [UsersAggregateOrdering]): [UsersAggregate!]! @generate(filter: true) + count: Float! +} +""" +max Aggregate +""" +type _UsersAggregateMax { """ - categories Aggregate + Compute the max for count """ - _categoriesAggregate(groupBy: [CategoryGroupBy!], - """ - Filter _categoriesAggregate - """ - filter: CategoryFilterInput, - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for CategoriesAggregate - """ - orderBy: [CategoriesAggregateOrdering]): [CategoriesAggregate!]! @generate(filter: true) + count: Int! +} +""" +min Aggregate +""" +type _UsersAggregateMin { """ - animals Aggregate + Compute the min for count """ - _animalsAggregate(groupBy: [AnimalGroupBy!], - """ - Filter _animalsAggregate - """ - filter: AnimalFilterInput, - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for AnimalsAggregate - """ - orderBy: [AnimalsAggregateOrdering]): [AnimalsAggregate!]! @generate(filter: true) + count: Int! } -type User @table(name: "user") @generateFilterInput { - id: Int! - name: String! - posts( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Post - """ - orderBy: [PostOrdering], - """ - Filter posts - """ - filter: PostFilterInput): [Post] @relation(type: ONE_TO_MANY, fields: ["id"], references: ["user_id"]) +""" +sum Aggregate +""" +type _UsersAggregateSum { """ - posts Aggregate + Compute the sum for count """ - _postsAggregate(groupBy: [PostGroupBy!], - """ - Filter _postsAggregate - """ - filter: PostFilterInput, - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for PostsAggregate - """ - orderBy: [PostsAggregateOrdering]): [PostsAggregate!]! @generate(filter: true) + count: Float! } `, BuiltIn: false}, } diff --git a/examples/json/README.md b/examples/json/README.md new file mode 100644 index 0000000..246670a --- /dev/null +++ b/examples/json/README.md @@ -0,0 +1,162 @@ +# JSON Field Selection Example + +This example demonstrates how to use the `@json` directive to select nested JSON fields from JSONB columns in PostgreSQL. + +## Setup + +1. **Start PostgreSQL** (if not already running): + ```bash + docker run -d --name postgres-json-example \ + -e POSTGRES_PASSWORD=postgres \ + -e POSTGRES_DB=postgres \ + -p 5432:5432 \ + postgres:15 + ``` + +2. **Initialize the database**: + ```bash + psql -h localhost -U postgres -d postgres -f init.sql + ``` + + Or if using a password: + ```bash + PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -f init.sql + ``` + +3. **Generate GraphQL code**: + ```bash + cd examples/json + go generate + ``` + +4. **Run the server**: + ```bash + go run server.go + ``` + + Or with custom connection string: + ```bash + PG_CONN_STR="postgresql://localhost/postgres?user=postgres&password=postgres" go run server.go + ``` + +5. **Open GraphQL Playground**: + Navigate to http://localhost:8080/ + +## Test Queries + +### Simple Scalar Selection +```graphql +query { + products { + name + attributes { + color + size + } + } +} +``` + +### Nested Object Selection +```graphql +query { + products { + name + attributes { + color + details { + manufacturer + model + } + } + } +} +``` + +### Deep Nesting (3 levels) +```graphql +query { + products { + name + attributes { + details { + warranty { + years + provider + } + } + } + } +} +``` + +### Three-Level Nesting with Dimensions +```graphql +query { + products { + name + attributes { + specs { + dimensions { + width + height + depth + } + } + } + } +} +``` + +### Mixed Scalar and Nested +```graphql +query { + products { + name + attributes { + color + size + details { + manufacturer + } + specs { + weight + } + } + } +} +``` + +### Complex Nested Object with All Fields +```graphql +query { + products { + name + attributes { + details { + manufacturer + model + warranty { + years + provider + } + } + } + } +} +``` + +## Expected Results + +- **Product 1**: Simple attributes (color, size) +- **Product 2**: Attributes with nested details (manufacturer, model) +- **Product 3**: Deep nesting with warranty info +- **Product 4**: Three-level nesting with dimensions +- **Product 5**: Complex nested structure with all fields + +## Notes + +- The `@json` directive tells FastGQL that the field is stored in a JSONB column +- Nested field selection uses efficient PostgreSQL `->` operators +- The generated SQL uses `jsonb_build_object` to construct the response matching the GraphQL query structure + diff --git a/examples/json/gqlgen.yml b/examples/json/gqlgen.yml new file mode 100644 index 0000000..e5594de --- /dev/null +++ b/examples/json/gqlgen.yml @@ -0,0 +1,50 @@ +# Where are all the schema files located? globs are supported eg src/**/*.graphqls +schema: + - graph/*.graphql +# Where should the generated servergen code go? +exec: + filename: graph/generated/generated.go + package: generated +# Uncomment to enable federation +# federation: +# filename: graph/generated/federation.go +# package: generated +# Where should any generated models go? +model: + filename: graph/model/models_gen.go + package: model +# Where should the resolver implementations go? +resolver: + layout: follow-schema + dir: graph + package: graph +# Optional: turn on use `gqlgen:"fieldName"` tags in your models +# struct_tag: json +# Optional: turn on to use []Thing instead of []*Thing +# omit_slice_element_pointers: false +# Optional: set to speed up generation time by not performing a final validation pass. +# skip_validation: true +# gqlgen will search for any type names in the schema in these go packages +# if they match it will use them, otherwise it will generate them. +autobind: + - "github.com/roneli/fastgql/examples/interface/graph/model" +# This section declares type mapping between the GraphQL and go type systems +# +# The first line in each type will be used as defaults for resolver arguments and +# modelgen, the others will be allowed when binding to fields. Configure them to +# your liking +models: + Id: + model: + - github.com/99designs/gqlgen/graphql.Id + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + Int: + model: + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + + +omit_interface_checks : true \ No newline at end of file diff --git a/examples/json/graph/.graphqlconfig b/examples/json/graph/.graphqlconfig new file mode 100644 index 0000000..76817e6 --- /dev/null +++ b/examples/json/graph/.graphqlconfig @@ -0,0 +1,16 @@ +{ + "name": "GraphQL Schema", + "includes": ["*"], + "excludes": ["augmented_schema.graphql"], + "extensions": { + "endpoints": { + "Default GraphQL Endpoint": { + "url": "http://localhost:8080/graphql", + "headers": { + "user-agent": "JS GraphQL" + }, + "introspect": false + } + } + } +} \ No newline at end of file diff --git a/examples/json/graph/fastgql.graphql b/examples/json/graph/fastgql.graphql new file mode 100644 index 0000000..4c8934f --- /dev/null +++ b/examples/json/graph/fastgql.graphql @@ -0,0 +1,140 @@ +# ================== schema generation fastgql directives ================== + +# Generate Resolver directive tells fastgql to generate an automatic resolver for a given field +# @generateResolver can only be defined on Query and Mutation fields. +# adding pagination, ordering, aggregate, filter to false will disable the generation of the corresponding arguments +# for filter to work @generateFilterInput must be defined on the object, if its missing you will get an error +# recursive will generate pagination, filtering, ordering and aggregate for all the relations of the object, +# this will modify the object itself and add arguments to the object fields. +directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION + +# Generate mutations for an object +directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT + +# Generate filter input on an object +directive @generateFilterInput(description: String) repeatable on OBJECT | INTERFACE + +directive @isInterfaceFilter on INPUT_FIELD_DEFINITION + +# ================== Directives supported by fastgql for Querying ================== + +# Table directive is defined on OBJECTS, if no table directive is defined defaults are assumed +# i.e , "postgres", "" +directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE + +# Relation directive defines relations cross tables and dialects +directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION + +# This will make the field skipped in select, this is useful for fields that are not columns in the database, and you want to resolve it manually +directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION + +# Typename is the field name that will be used to resolve the type of the interface, +# default model is the default model that will be used to resolve the interface if none is found. +directive @typename(name: String!) on INTERFACE + +# JSON directive marks a field as stored in a JSONB column +directive @json(column: String!) on FIELD_DEFINITION + +# =================== Default Scalar types supported by fastgql =================== +scalar Map +# ================== Default Filter input types supported by fastgql ================== + +input IDComparator { + eq: ID + neq: ID + isNull: Boolean +} + +enum _relationType { + ONE_TO_ONE + ONE_TO_MANY + MANY_TO_MANY +} + +enum _OrderingTypes { + ASC + DESC + ASC_NULL_FIRST + DESC_NULL_FIRST + ASC_NULL_LAST + DESC_NULL_LAST +} + +type _AggregateResult { + count: Int! +} + +input StringComparator { + eq: String + neq: String + contains: [String] + notContains: [String] + like: String + ilike: String + suffix: String + prefix: String + isNull: Boolean +} + +input StringListComparator { + eq: [String] + neq: [String] + contains: [String] + containedBy: [String] + overlap: [String] + isNull: Boolean +} + +input IntComparator { + eq: Int + neq: Int + gt: Int + gte: Int + lt: Int + lte: Int + isNull: Boolean +} + +input IntListComparator { + eq: [Int] + neq: [Int] + contains: [Int] + contained: [Int] + overlap: [Int] + isNull: Boolean +} + +input FloatComparator { + eq: Float + neq: Float + gt: Float + gte: Float + lt: Float + lte: Float + isNull: Boolean +} + +input FloatListComparator { + eq: [Float] + neq: [Float] + contains: [Float] + contained: [Float] + overlap: [Float] + isNull: Boolean +} + + +input BooleanComparator { + eq: Boolean + neq: Boolean + isNull: Boolean +} + +input BooleanListComparator { + eq: [Boolean] + neq: [Boolean] + contains: [Boolean] + contained: [Boolean] + overlap: [Boolean] + isNull: Boolean +} diff --git a/examples/json/graph/generated/.gitkeep b/examples/json/graph/generated/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/json/graph/generated/generated.go b/examples/json/graph/generated/generated.go new file mode 100644 index 0000000..6f8f90c --- /dev/null +++ b/examples/json/graph/generated/generated.go @@ -0,0 +1,6782 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package generated + +import ( + "bytes" + "context" + "errors" + "fmt" + "strconv" + "sync" + "sync/atomic" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + model1 "github.com/roneli/fastgql/examples/interface/graph/model" + "github.com/roneli/fastgql/examples/json/graph/model" + 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 { + FastgqlField func(ctx context.Context, obj any, next graphql.Resolver, skipSelect *bool) (res any, err error) + Typename func(ctx context.Context, obj any, next graphql.Resolver, name string) (res any, err error) +} + +type ComplexityRoot struct { + Dimensions struct { + Depth func(childComplexity int) int + Height func(childComplexity int) int + Width func(childComplexity int) int + } + + Product struct { + Attributes func(childComplexity int) int + ID func(childComplexity int) int + Name func(childComplexity int) int + } + + ProductAttributes struct { + Color func(childComplexity int) int + Details func(childComplexity int) int + Size func(childComplexity int) int + Specs func(childComplexity int) int + Tags func(childComplexity int) int + } + + ProductDetails struct { + Manufacturer func(childComplexity int) int + Model func(childComplexity int) int + Warranty func(childComplexity int) int + } + + ProductsAggregate struct { + Avg func(childComplexity int) int + Count func(childComplexity int) int + Group func(childComplexity int) int + Max func(childComplexity int) int + Min func(childComplexity int) int + Sum func(childComplexity int) int + } + + Query struct { + Products func(childComplexity int, limit *int, offset *int, orderBy []*model.ProductOrdering, filter *model.ProductFilterInput) int + ProductsAggregate func(childComplexity int, groupBy []model.ProductGroupBy, filter *model.ProductFilterInput) int + } + + Specs struct { + Dimensions func(childComplexity int) int + Weight func(childComplexity int) int + } + + WarrantyInfo struct { + Provider func(childComplexity int) int + Years func(childComplexity int) int + } + + _AggregateResult struct { + Count func(childComplexity int) int + } + + _ProductAvg struct { + ID func(childComplexity int) int + } + + _ProductMax struct { + ID func(childComplexity int) int + Name func(childComplexity int) int + } + + _ProductMin struct { + ID func(childComplexity int) int + Name func(childComplexity int) int + } + + _ProductSum struct { + ID func(childComplexity int) int + } +} + +type QueryResolver interface { + Products(ctx context.Context, limit *int, offset *int, orderBy []*model.ProductOrdering, filter *model.ProductFilterInput) ([]*model.Product, error) + ProductsAggregate(ctx context.Context, groupBy []model.ProductGroupBy, filter *model.ProductFilterInput) ([]*model.ProductsAggregate, 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 "Dimensions.depth": + if e.complexity.Dimensions.Depth == nil { + break + } + + return e.complexity.Dimensions.Depth(childComplexity), true + case "Dimensions.height": + if e.complexity.Dimensions.Height == nil { + break + } + + return e.complexity.Dimensions.Height(childComplexity), true + case "Dimensions.width": + if e.complexity.Dimensions.Width == nil { + break + } + + return e.complexity.Dimensions.Width(childComplexity), true + + case "Product.attributes": + if e.complexity.Product.Attributes == nil { + break + } + + return e.complexity.Product.Attributes(childComplexity), true + case "Product.id": + if e.complexity.Product.ID == nil { + break + } + + return e.complexity.Product.ID(childComplexity), true + case "Product.name": + if e.complexity.Product.Name == nil { + break + } + + return e.complexity.Product.Name(childComplexity), true + + case "ProductAttributes.color": + if e.complexity.ProductAttributes.Color == nil { + break + } + + return e.complexity.ProductAttributes.Color(childComplexity), true + case "ProductAttributes.details": + if e.complexity.ProductAttributes.Details == nil { + break + } + + return e.complexity.ProductAttributes.Details(childComplexity), true + case "ProductAttributes.size": + if e.complexity.ProductAttributes.Size == nil { + break + } + + return e.complexity.ProductAttributes.Size(childComplexity), true + case "ProductAttributes.specs": + if e.complexity.ProductAttributes.Specs == nil { + break + } + + return e.complexity.ProductAttributes.Specs(childComplexity), true + case "ProductAttributes.tags": + if e.complexity.ProductAttributes.Tags == nil { + break + } + + return e.complexity.ProductAttributes.Tags(childComplexity), true + + case "ProductDetails.manufacturer": + if e.complexity.ProductDetails.Manufacturer == nil { + break + } + + return e.complexity.ProductDetails.Manufacturer(childComplexity), true + case "ProductDetails.model": + if e.complexity.ProductDetails.Model == nil { + break + } + + return e.complexity.ProductDetails.Model(childComplexity), true + case "ProductDetails.warranty": + if e.complexity.ProductDetails.Warranty == nil { + break + } + + return e.complexity.ProductDetails.Warranty(childComplexity), true + + case "ProductsAggregate.avg": + if e.complexity.ProductsAggregate.Avg == nil { + break + } + + return e.complexity.ProductsAggregate.Avg(childComplexity), true + case "ProductsAggregate.count": + if e.complexity.ProductsAggregate.Count == nil { + break + } + + return e.complexity.ProductsAggregate.Count(childComplexity), true + case "ProductsAggregate.group": + if e.complexity.ProductsAggregate.Group == nil { + break + } + + return e.complexity.ProductsAggregate.Group(childComplexity), true + case "ProductsAggregate.max": + if e.complexity.ProductsAggregate.Max == nil { + break + } + + return e.complexity.ProductsAggregate.Max(childComplexity), true + case "ProductsAggregate.min": + if e.complexity.ProductsAggregate.Min == nil { + break + } + + return e.complexity.ProductsAggregate.Min(childComplexity), true + case "ProductsAggregate.sum": + if e.complexity.ProductsAggregate.Sum == nil { + break + } + + return e.complexity.ProductsAggregate.Sum(childComplexity), true + + case "Query.products": + if e.complexity.Query.Products == nil { + break + } + + args, err := ec.field_Query_products_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Products(childComplexity, args["limit"].(*int), args["offset"].(*int), args["orderBy"].([]*model.ProductOrdering), args["filter"].(*model.ProductFilterInput)), true + case "Query._productsAggregate": + if e.complexity.Query.ProductsAggregate == nil { + break + } + + args, err := ec.field_Query__productsAggregate_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.ProductsAggregate(childComplexity, args["groupBy"].([]model.ProductGroupBy), args["filter"].(*model.ProductFilterInput)), true + + case "Specs.dimensions": + if e.complexity.Specs.Dimensions == nil { + break + } + + return e.complexity.Specs.Dimensions(childComplexity), true + case "Specs.weight": + if e.complexity.Specs.Weight == nil { + break + } + + return e.complexity.Specs.Weight(childComplexity), true + + case "WarrantyInfo.provider": + if e.complexity.WarrantyInfo.Provider == nil { + break + } + + return e.complexity.WarrantyInfo.Provider(childComplexity), true + case "WarrantyInfo.years": + if e.complexity.WarrantyInfo.Years == nil { + break + } + + return e.complexity.WarrantyInfo.Years(childComplexity), true + + case "_AggregateResult.count": + if e.complexity._AggregateResult.Count == nil { + break + } + + return e.complexity._AggregateResult.Count(childComplexity), true + + case "_ProductAvg.id": + if e.complexity._ProductAvg.ID == nil { + break + } + + return e.complexity._ProductAvg.ID(childComplexity), true + + case "_ProductMax.id": + if e.complexity._ProductMax.ID == nil { + break + } + + return e.complexity._ProductMax.ID(childComplexity), true + case "_ProductMax.name": + if e.complexity._ProductMax.Name == nil { + break + } + + return e.complexity._ProductMax.Name(childComplexity), true + + case "_ProductMin.id": + if e.complexity._ProductMin.ID == nil { + break + } + + return e.complexity._ProductMin.ID(childComplexity), true + case "_ProductMin.name": + if e.complexity._ProductMin.Name == nil { + break + } + + return e.complexity._ProductMin.Name(childComplexity), true + + case "_ProductSum.id": + if e.complexity._ProductSum.ID == nil { + break + } + + return e.complexity._ProductSum.ID(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.unmarshalInputBooleanComparator, + ec.unmarshalInputBooleanListComparator, + ec.unmarshalInputDimensionsFilterInput, + ec.unmarshalInputFloatComparator, + ec.unmarshalInputFloatListComparator, + ec.unmarshalInputIDComparator, + ec.unmarshalInputIntComparator, + ec.unmarshalInputIntListComparator, + ec.unmarshalInputProductAttributesFilterInput, + ec.unmarshalInputProductDetailsFilterInput, + ec.unmarshalInputProductFilterInput, + ec.unmarshalInputProductOrdering, + ec.unmarshalInputSpecsFilterInput, + ec.unmarshalInputStringComparator, + ec.unmarshalInputStringListComparator, + ec.unmarshalInputWarrantyInfoFilterInput, + ) + 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 +} + +var sources = []*ast.Source{ + {Name: "../fastgql.graphql", Input: `directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION +directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION +directive @generateFilterInput(description: String) on OBJECT | INTERFACE +directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT +directive @isInterfaceFilter on INPUT_FIELD_DEFINITION +directive @json(column: String!) on FIELD_DEFINITION +directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION +directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE +directive @typename(name: String!) on INTERFACE +input BooleanComparator { + eq: Boolean + neq: Boolean + isNull: Boolean +} +input BooleanListComparator { + eq: [Boolean] + neq: [Boolean] + contains: [Boolean] + contained: [Boolean] + overlap: [Boolean] + isNull: Boolean +} +input FloatComparator { + eq: Float + neq: Float + gt: Float + gte: Float + lt: Float + lte: Float + isNull: Boolean +} +input FloatListComparator { + eq: [Float] + neq: [Float] + contains: [Float] + contained: [Float] + overlap: [Float] + isNull: Boolean +} +input IDComparator { + eq: ID + neq: ID + isNull: Boolean +} +input IntComparator { + eq: Int + neq: Int + gt: Int + gte: Int + lt: Int + lte: Int + isNull: Boolean +} +input IntListComparator { + eq: [Int] + neq: [Int] + contains: [Int] + contained: [Int] + overlap: [Int] + isNull: Boolean +} +scalar Map +input StringComparator { + eq: String + neq: String + contains: [String] + notContains: [String] + like: String + ilike: String + suffix: String + prefix: String + isNull: Boolean +} +input StringListComparator { + eq: [String] + neq: [String] + contains: [String] + containedBy: [String] + overlap: [String] + isNull: Boolean +} +type _AggregateResult { + count: Int! +} +enum _OrderingTypes { + ASC + DESC + ASC_NULL_FIRST + DESC_NULL_FIRST + ASC_NULL_LAST + DESC_NULL_LAST +} +enum _relationType { + ONE_TO_ONE + ONE_TO_MANY + MANY_TO_MANY +} +`, BuiltIn: false}, + {Name: "../schema.graphql", Input: `type Dimensions { + width: Float + height: Float + depth: Float +} +type Product @generateFilterInput @table(name: "products", schema: "app") { + id: Int! + name: String! + attributes: ProductAttributes @json(column: "attributes") +} +type ProductAttributes { + color: String + size: Int + tags: [String] + details: ProductDetails + specs: Specs +} +type ProductDetails { + manufacturer: String + model: String + warranty: WarrantyInfo +} +type Query { + products( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Product + """ + orderBy: [ProductOrdering], + """ + Filter products + """ + filter: ProductFilterInput): [Product] @generate + """ + products Aggregate + """ + _productsAggregate(groupBy: [ProductGroupBy!], + """ + Filter _productsAggregate + """ + filter: ProductFilterInput): [ProductsAggregate!]! @generate(filter: true) +} +type Specs { + weight: Float + dimensions: Dimensions +} +type WarrantyInfo { + years: Int + provider: String +} +`, BuiltIn: false}, + {Name: "../fastgql_schema.graphql", Input: `""" +Filter input for JSON type Dimensions +""" +input DimensionsFilterInput { + width: FloatComparator + height: FloatComparator + depth: FloatComparator + """ + Logical AND of FilterInput + """ + AND: [DimensionsFilterInput] + """ + Logical OR of FilterInput + """ + OR: [DimensionsFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: DimensionsFilterInput +} +""" +Filter input for JSON type ProductAttributes +""" +input ProductAttributesFilterInput { + color: StringComparator + size: IntComparator + tags: StringListComparator + details: ProductDetailsFilterInput + specs: SpecsFilterInput + """ + Logical AND of FilterInput + """ + AND: [ProductAttributesFilterInput] + """ + Logical OR of FilterInput + """ + OR: [ProductAttributesFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: ProductAttributesFilterInput +} +""" +Filter input for JSON type ProductDetails +""" +input ProductDetailsFilterInput { + manufacturer: StringComparator + model: StringComparator + warranty: WarrantyInfoFilterInput + """ + Logical AND of FilterInput + """ + AND: [ProductDetailsFilterInput] + """ + Logical OR of FilterInput + """ + OR: [ProductDetailsFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: ProductDetailsFilterInput +} +input ProductFilterInput { + id: IntComparator + name: StringComparator + attributes: ProductAttributesFilterInput + """ + Logical AND of FilterInput + """ + AND: [ProductFilterInput] + """ + Logical OR of FilterInput + """ + OR: [ProductFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: ProductFilterInput +} +""" +Group by Product +""" +enum ProductGroupBy { + """ + Group by id + """ + ID + """ + Group by name + """ + NAME +} +""" +Ordering for Product +""" +input ProductOrdering { + """ + Order Product by id + """ + id: _OrderingTypes + """ + Order Product by name + """ + name: _OrderingTypes +} +""" +Aggregate Product +""" +type ProductsAggregate { + """ + Group + """ + group: Map + """ + Count results + """ + count: Int! + """ + Max Aggregate + """ + max: _ProductMax! + """ + Min Aggregate + """ + min: _ProductMin! + """ + Avg Aggregate + """ + avg: _ProductAvg! + """ + Sum Aggregate + """ + sum: _ProductSum! +} +""" +Filter input for JSON type Specs +""" +input SpecsFilterInput { + weight: FloatComparator + dimensions: DimensionsFilterInput + """ + Logical AND of FilterInput + """ + AND: [SpecsFilterInput] + """ + Logical OR of FilterInput + """ + OR: [SpecsFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: SpecsFilterInput +} +""" +Filter input for JSON type WarrantyInfo +""" +input WarrantyInfoFilterInput { + years: IntComparator + provider: StringComparator + """ + Logical AND of FilterInput + """ + AND: [WarrantyInfoFilterInput] + """ + Logical OR of FilterInput + """ + OR: [WarrantyInfoFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: WarrantyInfoFilterInput +} +""" +avg Aggregate +""" +type _ProductAvg { + """ + Compute the avg for id + """ + id: Float! +} +""" +max Aggregate +""" +type _ProductMax { + """ + Compute the max for id + """ + id: Int! + """ + Compute the max for name + """ + name: String! +} +""" +min Aggregate +""" +type _ProductMin { + """ + Compute the min for id + """ + id: Int! + """ + Compute the min for name + """ + name: String! +} +""" +sum Aggregate +""" +type _ProductSum { + """ + Compute the sum for id + """ + id: Float! +} +`, BuiltIn: false}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) dir_fastgqlField_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, "skipSelect", ec.unmarshalOBoolean2ᚖbool) + if err != nil { + return nil, err + } + args["skipSelect"] = arg0 + return args, nil +} + +func (ec *executionContext) dir_typename_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___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__productsAggregate_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, "groupBy", ec.unmarshalOProductGroupBy2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductGroupByᚄ) + if err != nil { + return nil, err + } + args["groupBy"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "filter", ec.unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductFilterInput) + if err != nil { + return nil, err + } + args["filter"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_products_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, "limit", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["limit"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "offset", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["offset"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOProductOrdering2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductOrdering) + if err != nil { + return nil, err + } + args["orderBy"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "filter", ec.unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductFilterInput) + if err != nil { + return nil, err + } + args["filter"] = arg3 + 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) _Dimensions_width(ctx context.Context, field graphql.CollectedField, obj *model.Dimensions) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Dimensions_width, + func(ctx context.Context) (any, error) { + return obj.Width, nil + }, + nil, + ec.marshalOFloat2ᚖfloat64, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Dimensions_width(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Dimensions", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Float does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Dimensions_height(ctx context.Context, field graphql.CollectedField, obj *model.Dimensions) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Dimensions_height, + func(ctx context.Context) (any, error) { + return obj.Height, nil + }, + nil, + ec.marshalOFloat2ᚖfloat64, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Dimensions_height(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Dimensions", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Float does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Dimensions_depth(ctx context.Context, field graphql.CollectedField, obj *model.Dimensions) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Dimensions_depth, + func(ctx context.Context) (any, error) { + return obj.Depth, nil + }, + nil, + ec.marshalOFloat2ᚖfloat64, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Dimensions_depth(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Dimensions", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Float does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Product_id(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Product_id, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + ec.marshalNInt2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Product_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Product", + 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) _Product_name(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Product_name, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Product_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Product", + 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) _Product_attributes(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Product_attributes, + func(ctx context.Context) (any, error) { + return obj.Attributes, nil + }, + nil, + ec.marshalOProductAttributes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAttributes, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Product_attributes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Product", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "color": + return ec.fieldContext_ProductAttributes_color(ctx, field) + case "size": + return ec.fieldContext_ProductAttributes_size(ctx, field) + case "tags": + return ec.fieldContext_ProductAttributes_tags(ctx, field) + case "details": + return ec.fieldContext_ProductAttributes_details(ctx, field) + case "specs": + return ec.fieldContext_ProductAttributes_specs(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ProductAttributes", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ProductAttributes_color(ctx context.Context, field graphql.CollectedField, obj *model.ProductAttributes) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductAttributes_color, + func(ctx context.Context) (any, error) { + return obj.Color, nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ProductAttributes_color(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductAttributes", + 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) _ProductAttributes_size(ctx context.Context, field graphql.CollectedField, obj *model.ProductAttributes) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductAttributes_size, + func(ctx context.Context) (any, error) { + return obj.Size, nil + }, + nil, + ec.marshalOInt2ᚖint, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ProductAttributes_size(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductAttributes", + 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) _ProductAttributes_tags(ctx context.Context, field graphql.CollectedField, obj *model.ProductAttributes) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductAttributes_tags, + func(ctx context.Context) (any, error) { + return obj.Tags, nil + }, + nil, + ec.marshalOString2ᚕᚖstring, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ProductAttributes_tags(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductAttributes", + 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) _ProductAttributes_details(ctx context.Context, field graphql.CollectedField, obj *model.ProductAttributes) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductAttributes_details, + func(ctx context.Context) (any, error) { + return obj.Details, nil + }, + nil, + ec.marshalOProductDetails2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductDetails, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ProductAttributes_details(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductAttributes", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "manufacturer": + return ec.fieldContext_ProductDetails_manufacturer(ctx, field) + case "model": + return ec.fieldContext_ProductDetails_model(ctx, field) + case "warranty": + return ec.fieldContext_ProductDetails_warranty(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ProductDetails", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ProductAttributes_specs(ctx context.Context, field graphql.CollectedField, obj *model.ProductAttributes) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductAttributes_specs, + func(ctx context.Context) (any, error) { + return obj.Specs, nil + }, + nil, + ec.marshalOSpecs2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐSpecs, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ProductAttributes_specs(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductAttributes", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "weight": + return ec.fieldContext_Specs_weight(ctx, field) + case "dimensions": + return ec.fieldContext_Specs_dimensions(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Specs", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ProductDetails_manufacturer(ctx context.Context, field graphql.CollectedField, obj *model.ProductDetails) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductDetails_manufacturer, + func(ctx context.Context) (any, error) { + return obj.Manufacturer, nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ProductDetails_manufacturer(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductDetails", + 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) _ProductDetails_model(ctx context.Context, field graphql.CollectedField, obj *model.ProductDetails) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductDetails_model, + func(ctx context.Context) (any, error) { + return obj.Model, nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ProductDetails_model(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductDetails", + 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) _ProductDetails_warranty(ctx context.Context, field graphql.CollectedField, obj *model.ProductDetails) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductDetails_warranty, + func(ctx context.Context) (any, error) { + return obj.Warranty, nil + }, + nil, + ec.marshalOWarrantyInfo2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐWarrantyInfo, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ProductDetails_warranty(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductDetails", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "years": + return ec.fieldContext_WarrantyInfo_years(ctx, field) + case "provider": + return ec.fieldContext_WarrantyInfo_provider(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type WarrantyInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ProductsAggregate_group(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductsAggregate_group, + func(ctx context.Context) (any, error) { + return obj.Group, nil + }, + nil, + ec.marshalOMap2map, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ProductsAggregate_group(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductsAggregate", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Map does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ProductsAggregate_count(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductsAggregate_count, + func(ctx context.Context) (any, error) { + return obj.Count, nil + }, + nil, + ec.marshalNInt2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_ProductsAggregate_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductsAggregate", + 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) _ProductsAggregate_max(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductsAggregate_max, + func(ctx context.Context) (any, error) { + return obj.Max, nil + }, + nil, + ec.marshalN_ProductMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductMax, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_ProductsAggregate_max(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductsAggregate", + 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__ProductMax_id(ctx, field) + case "name": + return ec.fieldContext__ProductMax_name(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _ProductMax", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ProductsAggregate_min(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductsAggregate_min, + func(ctx context.Context) (any, error) { + return obj.Min, nil + }, + nil, + ec.marshalN_ProductMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductMin, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_ProductsAggregate_min(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductsAggregate", + 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__ProductMin_id(ctx, field) + case "name": + return ec.fieldContext__ProductMin_name(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _ProductMin", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ProductsAggregate_avg(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductsAggregate_avg, + func(ctx context.Context) (any, error) { + return obj.Avg, nil + }, + nil, + ec.marshalN_ProductAvg2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAvg, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_ProductsAggregate_avg(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductsAggregate", + 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__ProductAvg_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _ProductAvg", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _ProductsAggregate_sum(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ProductsAggregate_sum, + func(ctx context.Context) (any, error) { + return obj.Sum, nil + }, + nil, + ec.marshalN_ProductSum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductSum, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_ProductsAggregate_sum(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ProductsAggregate", + 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__ProductSum_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _ProductSum", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_products(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Query_products, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Products(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.ProductOrdering), fc.Args["filter"].(*model.ProductFilterInput)) + }, + nil, + ec.marshalOProduct2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProduct, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Query_products(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 "id": + return ec.fieldContext_Product_id(ctx, field) + case "name": + return ec.fieldContext_Product_name(ctx, field) + case "attributes": + return ec.fieldContext_Product_attributes(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Product", 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_products_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query__productsAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Query__productsAggregate, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().ProductsAggregate(ctx, fc.Args["groupBy"].([]model.ProductGroupBy), fc.Args["filter"].(*model.ProductFilterInput)) + }, + nil, + ec.marshalNProductsAggregate2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductsAggregateᚄ, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_Query__productsAggregate(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 "group": + return ec.fieldContext_ProductsAggregate_group(ctx, field) + case "count": + return ec.fieldContext_ProductsAggregate_count(ctx, field) + case "max": + return ec.fieldContext_ProductsAggregate_max(ctx, field) + case "min": + return ec.fieldContext_ProductsAggregate_min(ctx, field) + case "avg": + return ec.fieldContext_ProductsAggregate_avg(ctx, field) + case "sum": + return ec.fieldContext_ProductsAggregate_sum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ProductsAggregate", 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__productsAggregate_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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Query___type, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.introspectType(fc.Args["name"].(string)) + }, + nil, + ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Query___schema, + func(ctx context.Context) (any, error) { + return ec.introspectSchema() + }, + nil, + ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema, + true, + false, + ) +} + +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) _Specs_weight(ctx context.Context, field graphql.CollectedField, obj *model.Specs) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Specs_weight, + func(ctx context.Context) (any, error) { + return obj.Weight, nil + }, + nil, + ec.marshalOFloat2ᚖfloat64, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Specs_weight(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Specs", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Float does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Specs_dimensions(ctx context.Context, field graphql.CollectedField, obj *model.Specs) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_Specs_dimensions, + func(ctx context.Context) (any, error) { + return obj.Dimensions, nil + }, + nil, + ec.marshalODimensions2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐDimensions, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_Specs_dimensions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Specs", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "width": + return ec.fieldContext_Dimensions_width(ctx, field) + case "height": + return ec.fieldContext_Dimensions_height(ctx, field) + case "depth": + return ec.fieldContext_Dimensions_depth(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Dimensions", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _WarrantyInfo_years(ctx context.Context, field graphql.CollectedField, obj *model.WarrantyInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WarrantyInfo_years, + func(ctx context.Context) (any, error) { + return obj.Years, nil + }, + nil, + ec.marshalOInt2ᚖint, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_WarrantyInfo_years(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WarrantyInfo", + 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) _WarrantyInfo_provider(ctx context.Context, field graphql.CollectedField, obj *model.WarrantyInfo) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_WarrantyInfo_provider, + func(ctx context.Context) (any, error) { + return obj.Provider, nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_WarrantyInfo_provider(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "WarrantyInfo", + 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) __AggregateResult_count(ctx context.Context, field graphql.CollectedField, obj *model1.AggregateResult) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext__AggregateResult_count, + func(ctx context.Context) (any, error) { + return obj.Count, nil + }, + nil, + ec.marshalNInt2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext__AggregateResult_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_AggregateResult", + 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) __ProductAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.ProductAvg) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext__ProductAvg_id, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + ec.marshalNFloat2float64, + true, + true, + ) +} + +func (ec *executionContext) fieldContext__ProductAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_ProductAvg", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Float does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) __ProductMax_id(ctx context.Context, field graphql.CollectedField, obj *model.ProductMax) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext__ProductMax_id, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + ec.marshalNInt2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext__ProductMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_ProductMax", + 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) __ProductMax_name(ctx context.Context, field graphql.CollectedField, obj *model.ProductMax) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext__ProductMax_name, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +func (ec *executionContext) fieldContext__ProductMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_ProductMax", + 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) __ProductMin_id(ctx context.Context, field graphql.CollectedField, obj *model.ProductMin) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext__ProductMin_id, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + ec.marshalNInt2int, + true, + true, + ) +} + +func (ec *executionContext) fieldContext__ProductMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_ProductMin", + 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) __ProductMin_name(ctx context.Context, field graphql.CollectedField, obj *model.ProductMin) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext__ProductMin_name, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +func (ec *executionContext) fieldContext__ProductMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_ProductMin", + 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) __ProductSum_id(ctx context.Context, field graphql.CollectedField, obj *model.ProductSum) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext__ProductSum_id, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + ec.marshalNFloat2float64, + true, + true, + ) +} + +func (ec *executionContext) fieldContext__ProductSum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_ProductSum", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Float does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Directive_name, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Directive_description, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Directive_isRepeatable, + func(ctx context.Context) (any, error) { + return obj.IsRepeatable, nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Directive_locations, + func(ctx context.Context) (any, error) { + return obj.Locations, nil + }, + nil, + ec.marshalN__DirectiveLocation2ᚕstringᚄ, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Directive_args, + func(ctx context.Context) (any, error) { + return obj.Args, nil + }, + nil, + ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___EnumValue_name, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___EnumValue_description, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___EnumValue_isDeprecated, + func(ctx context.Context) (any, error) { + return obj.IsDeprecated(), nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___EnumValue_deprecationReason, + func(ctx context.Context) (any, error) { + return obj.DeprecationReason(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Field_name, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Field_description, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Field_args, + func(ctx context.Context) (any, error) { + return obj.Args, nil + }, + nil, + ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Field_type, + func(ctx context.Context) (any, error) { + return obj.Type, nil + }, + nil, + ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Field_isDeprecated, + func(ctx context.Context) (any, error) { + return obj.IsDeprecated(), nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Field_deprecationReason, + func(ctx context.Context) (any, error) { + return obj.DeprecationReason(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_name, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_description, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_type, + func(ctx context.Context) (any, error) { + return obj.Type, nil + }, + nil, + ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_defaultValue, + func(ctx context.Context) (any, error) { + return obj.DefaultValue, nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_isDeprecated, + func(ctx context.Context) (any, error) { + return obj.IsDeprecated(), nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_deprecationReason, + func(ctx context.Context) (any, error) { + return obj.DeprecationReason(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_description, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_types, + func(ctx context.Context) (any, error) { + return obj.Types(), nil + }, + nil, + ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_queryType, + func(ctx context.Context) (any, error) { + return obj.QueryType(), nil + }, + nil, + ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_mutationType, + func(ctx context.Context) (any, error) { + return obj.MutationType(), nil + }, + nil, + ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_subscriptionType, + func(ctx context.Context) (any, error) { + return obj.SubscriptionType(), nil + }, + nil, + ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_directives, + func(ctx context.Context) (any, error) { + return obj.Directives(), nil + }, + nil, + ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_kind, + func(ctx context.Context) (any, error) { + return obj.Kind(), nil + }, + nil, + ec.marshalN__TypeKind2string, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_name, + func(ctx context.Context) (any, error) { + return obj.Name(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_description, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_specifiedByURL, + func(ctx context.Context) (any, error) { + return obj.SpecifiedByURL(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_fields, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }, + nil, + ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_interfaces, + func(ctx context.Context) (any, error) { + return obj.Interfaces(), nil + }, + nil, + ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_possibleTypes, + func(ctx context.Context) (any, error) { + return obj.PossibleTypes(), nil + }, + nil, + ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_enumValues, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }, + nil, + ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_inputFields, + func(ctx context.Context) (any, error) { + return obj.InputFields(), nil + }, + nil, + ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_ofType, + func(ctx context.Context) (any, error) { + return obj.OfType(), nil + }, + nil, + ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_isOneOf, + func(ctx context.Context) (any, error) { + return obj.IsOneOf(), nil + }, + nil, + ec.marshalOBoolean2bool, + true, + false, + ) +} + +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) unmarshalInputBooleanComparator(ctx context.Context, obj any) (model1.BooleanComparator, error) { + var it model1.BooleanComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBooleanListComparator(ctx context.Context, obj any) (model1.BooleanListComparator, error) { + var it model1.BooleanListComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "contains", "contained", "overlap", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "contains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Contains = data + case "contained": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contained")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Contained = data + case "overlap": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("overlap")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Overlap = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputDimensionsFilterInput(ctx context.Context, obj any) (model.DimensionsFilterInput, error) { + var it model.DimensionsFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"width", "height", "depth", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "width": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("width")) + data, err := ec.unmarshalOFloatComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐFloatComparator(ctx, v) + if err != nil { + return it, err + } + it.Width = data + case "height": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("height")) + data, err := ec.unmarshalOFloatComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐFloatComparator(ctx, v) + if err != nil { + return it, err + } + it.Height = data + case "depth": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("depth")) + data, err := ec.unmarshalOFloatComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐFloatComparator(ctx, v) + if err != nil { + return it, err + } + it.Depth = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalODimensionsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐDimensionsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalODimensionsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐDimensionsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalODimensionsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐDimensionsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputFloatComparator(ctx context.Context, obj any) (model1.FloatComparator, error) { + var it model1.FloatComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "gt", "gte", "lt", "lte", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "gt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gt")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Gt = data + case "gte": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gte")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Gte = data + case "lt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lt")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Lt = data + case "lte": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lte")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Lte = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputFloatListComparator(ctx context.Context, obj any) (model1.FloatListComparator, error) { + var it model1.FloatListComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "contains", "contained", "overlap", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "contains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Contains = data + case "contained": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contained")) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Contained = data + case "overlap": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("overlap")) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Overlap = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputIDComparator(ctx context.Context, obj any) (model.IDComparator, error) { + var it model.IDComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputIntComparator(ctx context.Context, obj any) (model1.IntComparator, error) { + var it model1.IntComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "gt", "gte", "lt", "lte", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "gt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gt")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Gt = data + case "gte": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gte")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Gte = data + case "lt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lt")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Lt = data + case "lte": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lte")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Lte = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputIntListComparator(ctx context.Context, obj any) (model1.IntListComparator, error) { + var it model1.IntListComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "contains", "contained", "overlap", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "contains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + if err != nil { + return it, err + } + it.Contains = data + case "contained": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contained")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + if err != nil { + return it, err + } + it.Contained = data + case "overlap": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("overlap")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + if err != nil { + return it, err + } + it.Overlap = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputProductAttributesFilterInput(ctx context.Context, obj any) (model.ProductAttributesFilterInput, error) { + var it model.ProductAttributesFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"color", "size", "tags", "details", "specs", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "color": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("color")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Color = data + case "size": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐIntComparator(ctx, v) + if err != nil { + return it, err + } + it.Size = data + case "tags": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tags")) + data, err := ec.unmarshalOStringListComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐStringListComparator(ctx, v) + if err != nil { + return it, err + } + it.Tags = data + case "details": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("details")) + data, err := ec.unmarshalOProductDetailsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Details = data + case "specs": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("specs")) + data, err := ec.unmarshalOSpecsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐSpecsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Specs = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOProductAttributesFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOProductAttributesFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOProductAttributesFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputProductDetailsFilterInput(ctx context.Context, obj any) (model.ProductDetailsFilterInput, error) { + var it model.ProductDetailsFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"manufacturer", "model", "warranty", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "manufacturer": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("manufacturer")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Manufacturer = data + case "model": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("model")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Model = data + case "warranty": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("warranty")) + data, err := ec.unmarshalOWarrantyInfoFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐWarrantyInfoFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Warranty = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOProductDetailsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOProductDetailsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOProductDetailsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputProductFilterInput(ctx context.Context, obj any) (model.ProductFilterInput, error) { + var it model.ProductFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name", "attributes", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐIntComparator(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "attributes": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("attributes")) + data, err := ec.unmarshalOProductAttributesFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Attributes = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOProductFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOProductFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputProductOrdering(ctx context.Context, obj any) (model.ProductOrdering, error) { + var it model.ProductOrdering + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputSpecsFilterInput(ctx context.Context, obj any) (model.SpecsFilterInput, error) { + var it model.SpecsFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"weight", "dimensions", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "weight": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("weight")) + data, err := ec.unmarshalOFloatComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐFloatComparator(ctx, v) + if err != nil { + return it, err + } + it.Weight = data + case "dimensions": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dimensions")) + data, err := ec.unmarshalODimensionsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐDimensionsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Dimensions = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOSpecsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐSpecsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOSpecsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐSpecsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOSpecsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐSpecsFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputStringComparator(ctx context.Context, obj any) (model1.StringComparator, error) { + var it model1.StringComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "contains", "notContains", "like", "ilike", "suffix", "prefix", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "contains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) + data, err := ec.unmarshalOString2ᚕᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Contains = data + case "notContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("notContains")) + data, err := ec.unmarshalOString2ᚕᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NotContains = data + case "like": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("like")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Like = data + case "ilike": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ilike")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Ilike = data + case "suffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("suffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Suffix = data + case "prefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("prefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Prefix = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputStringListComparator(ctx context.Context, obj any) (model1.StringListComparator, error) { + var it model1.StringListComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "contains", "containedBy", "overlap", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOString2ᚕᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOString2ᚕᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "contains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) + data, err := ec.unmarshalOString2ᚕᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Contains = data + case "containedBy": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("containedBy")) + data, err := ec.unmarshalOString2ᚕᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContainedBy = data + case "overlap": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("overlap")) + data, err := ec.unmarshalOString2ᚕᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Overlap = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputWarrantyInfoFilterInput(ctx context.Context, obj any) (model.WarrantyInfoFilterInput, error) { + var it model.WarrantyInfoFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"years", "provider", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "years": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("years")) + data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐIntComparator(ctx, v) + if err != nil { + return it, err + } + it.Years = data + case "provider": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("provider")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Provider = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOWarrantyInfoFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐWarrantyInfoFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOWarrantyInfoFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐWarrantyInfoFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOWarrantyInfoFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐWarrantyInfoFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var dimensionsImplementors = []string{"Dimensions"} + +func (ec *executionContext) _Dimensions(ctx context.Context, sel ast.SelectionSet, obj *model.Dimensions) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, dimensionsImplementors) + + 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("Dimensions") + case "width": + out.Values[i] = ec._Dimensions_width(ctx, field, obj) + case "height": + out.Values[i] = ec._Dimensions_height(ctx, field, obj) + case "depth": + out.Values[i] = ec._Dimensions_depth(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 productImplementors = []string{"Product"} + +func (ec *executionContext) _Product(ctx context.Context, sel ast.SelectionSet, obj *model.Product) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, productImplementors) + + 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("Product") + case "id": + out.Values[i] = ec._Product_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._Product_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "attributes": + out.Values[i] = ec._Product_attributes(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 productAttributesImplementors = []string{"ProductAttributes"} + +func (ec *executionContext) _ProductAttributes(ctx context.Context, sel ast.SelectionSet, obj *model.ProductAttributes) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, productAttributesImplementors) + + 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("ProductAttributes") + case "color": + out.Values[i] = ec._ProductAttributes_color(ctx, field, obj) + case "size": + out.Values[i] = ec._ProductAttributes_size(ctx, field, obj) + case "tags": + out.Values[i] = ec._ProductAttributes_tags(ctx, field, obj) + case "details": + out.Values[i] = ec._ProductAttributes_details(ctx, field, obj) + case "specs": + out.Values[i] = ec._ProductAttributes_specs(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 productDetailsImplementors = []string{"ProductDetails"} + +func (ec *executionContext) _ProductDetails(ctx context.Context, sel ast.SelectionSet, obj *model.ProductDetails) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, productDetailsImplementors) + + 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("ProductDetails") + case "manufacturer": + out.Values[i] = ec._ProductDetails_manufacturer(ctx, field, obj) + case "model": + out.Values[i] = ec._ProductDetails_model(ctx, field, obj) + case "warranty": + out.Values[i] = ec._ProductDetails_warranty(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 productsAggregateImplementors = []string{"ProductsAggregate"} + +func (ec *executionContext) _ProductsAggregate(ctx context.Context, sel ast.SelectionSet, obj *model.ProductsAggregate) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, productsAggregateImplementors) + + 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("ProductsAggregate") + case "group": + out.Values[i] = ec._ProductsAggregate_group(ctx, field, obj) + case "count": + out.Values[i] = ec._ProductsAggregate_count(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "max": + out.Values[i] = ec._ProductsAggregate_max(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "min": + out.Values[i] = ec._ProductsAggregate_min(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "avg": + out.Values[i] = ec._ProductsAggregate_avg(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "sum": + out.Values[i] = ec._ProductsAggregate_sum(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 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 "products": + 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_products(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 "_productsAggregate": + 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__productsAggregate(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 specsImplementors = []string{"Specs"} + +func (ec *executionContext) _Specs(ctx context.Context, sel ast.SelectionSet, obj *model.Specs) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, specsImplementors) + + 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("Specs") + case "weight": + out.Values[i] = ec._Specs_weight(ctx, field, obj) + case "dimensions": + out.Values[i] = ec._Specs_dimensions(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 warrantyInfoImplementors = []string{"WarrantyInfo"} + +func (ec *executionContext) _WarrantyInfo(ctx context.Context, sel ast.SelectionSet, obj *model.WarrantyInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, warrantyInfoImplementors) + + 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("WarrantyInfo") + case "years": + out.Values[i] = ec._WarrantyInfo_years(ctx, field, obj) + case "provider": + out.Values[i] = ec._WarrantyInfo_provider(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 _AggregateResultImplementors = []string{"_AggregateResult"} + +func (ec *executionContext) __AggregateResult(ctx context.Context, sel ast.SelectionSet, obj *model1.AggregateResult) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _AggregateResultImplementors) + + 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("_AggregateResult") + case "count": + out.Values[i] = ec.__AggregateResult_count(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 _ProductAvgImplementors = []string{"_ProductAvg"} + +func (ec *executionContext) __ProductAvg(ctx context.Context, sel ast.SelectionSet, obj *model.ProductAvg) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ProductAvgImplementors) + + 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("_ProductAvg") + case "id": + out.Values[i] = ec.__ProductAvg_id(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 _ProductMaxImplementors = []string{"_ProductMax"} + +func (ec *executionContext) __ProductMax(ctx context.Context, sel ast.SelectionSet, obj *model.ProductMax) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ProductMaxImplementors) + + 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("_ProductMax") + case "id": + out.Values[i] = ec.__ProductMax_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.__ProductMax_name(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 _ProductMinImplementors = []string{"_ProductMin"} + +func (ec *executionContext) __ProductMin(ctx context.Context, sel ast.SelectionSet, obj *model.ProductMin) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ProductMinImplementors) + + 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("_ProductMin") + case "id": + out.Values[i] = ec.__ProductMin_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.__ProductMin_name(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 _ProductSumImplementors = []string{"_ProductSum"} + +func (ec *executionContext) __ProductSum(ctx context.Context, sel ast.SelectionSet, obj *model.ProductSum) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ProductSumImplementors) + + 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("_ProductSum") + case "id": + out.Values[i] = ec.__ProductSum_id(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 __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) 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)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v any) (float64, error) { + res, err := graphql.UnmarshalFloatContext(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { + _ = sel + res := graphql.MarshalFloatContext(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return graphql.WrapContextMarshaler(ctx, res) +} + +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)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNProductGroupBy2githubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductGroupBy(ctx context.Context, v any) (model.ProductGroupBy, error) { + var res model.ProductGroupBy + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNProductGroupBy2githubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductGroupBy(ctx context.Context, sel ast.SelectionSet, v model.ProductGroupBy) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNProductsAggregate2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductsAggregateᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ProductsAggregate) 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.marshalNProductsAggregate2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductsAggregate(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) marshalNProductsAggregate2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductsAggregate(ctx context.Context, sel ast.SelectionSet, v *model.ProductsAggregate) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._ProductsAggregate(ctx, sel, v) +} + +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)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNString2ᚕ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.unmarshalNString2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + 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) marshalN_ProductAvg2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAvg(ctx context.Context, sel ast.SelectionSet, v *model.ProductAvg) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.__ProductAvg(ctx, sel, v) +} + +func (ec *executionContext) marshalN_ProductMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductMax(ctx context.Context, sel ast.SelectionSet, v *model.ProductMax) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.__ProductMax(ctx, sel, v) +} + +func (ec *executionContext) marshalN_ProductMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductMin(ctx context.Context, sel ast.SelectionSet, v *model.ProductMin) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.__ProductMin(ctx, sel, v) +} + +func (ec *executionContext) marshalN_ProductSum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductSum(ctx context.Context, sel ast.SelectionSet, v *model.ProductSum) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.__ProductSum(ctx, sel, v) +} + +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)) { + graphql.AddErrorf(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)) { + graphql.AddErrorf(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)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalN_relationType2githubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐRelationType(ctx context.Context, v any) (model1.RelationType, error) { + var res model1.RelationType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN_relationType2githubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐRelationType(ctx context.Context, sel ast.SelectionSet, v model1.RelationType) graphql.Marshaler { + return v +} + +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 + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*bool, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOBoolean2ᚖbool(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOBoolean2ᚕᚖbool(ctx context.Context, sel ast.SelectionSet, v []*bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalOBoolean2ᚖbool(ctx, sel, v[i]) + } + + return ret +} + +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) marshalODimensions2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐDimensions(ctx context.Context, sel ast.SelectionSet, v *model.Dimensions) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Dimensions(ctx, sel, v) +} + +func (ec *executionContext) unmarshalODimensionsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐDimensionsFilterInput(ctx context.Context, v any) ([]*model.DimensionsFilterInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.DimensionsFilterInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalODimensionsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐDimensionsFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalODimensionsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐDimensionsFilterInput(ctx context.Context, v any) (*model.DimensionsFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputDimensionsFilterInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOFloat2ᚕᚖfloat64(ctx context.Context, v any) ([]*float64, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*float64, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOFloat2ᚖfloat64(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOFloat2ᚕᚖfloat64(ctx context.Context, sel ast.SelectionSet, v []*float64) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalOFloat2ᚖfloat64(ctx, sel, v[i]) + } + + return ret +} + +func (ec *executionContext) unmarshalOFloat2ᚖfloat64(ctx context.Context, v any) (*float64, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalFloatContext(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOFloat2ᚖfloat64(ctx context.Context, sel ast.SelectionSet, v *float64) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + res := graphql.MarshalFloatContext(*v) + return graphql.WrapContextMarshaler(ctx, res) +} + +func (ec *executionContext) unmarshalOFloatComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐFloatComparator(ctx context.Context, v any) (*model1.FloatComparator, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputFloatComparator(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOID2ᚖstring(ctx context.Context, v any) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalID(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOID2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalID(*v) + return res +} + +func (ec *executionContext) unmarshalOInt2ᚕᚖint(ctx context.Context, v any) ([]*int, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*int, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOInt2ᚖint(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOInt2ᚕᚖint(ctx context.Context, sel ast.SelectionSet, v []*int) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalOInt2ᚖint(ctx, sel, v[i]) + } + + return ret +} + +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) unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐIntComparator(ctx context.Context, v any) (*model1.IntComparator, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputIntComparator(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOMap2map(ctx context.Context, v any) (map[string]any, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalMap(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOMap2map(ctx context.Context, sel ast.SelectionSet, v map[string]any) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalMap(v) + return res +} + +func (ec *executionContext) marshalOProduct2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProduct(ctx context.Context, sel ast.SelectionSet, v []*model.Product) 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.marshalOProduct2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProduct(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOProduct2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProduct(ctx context.Context, sel ast.SelectionSet, v *model.Product) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Product(ctx, sel, v) +} + +func (ec *executionContext) marshalOProductAttributes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAttributes(ctx context.Context, sel ast.SelectionSet, v *model.ProductAttributes) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ProductAttributes(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOProductAttributesFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx context.Context, v any) ([]*model.ProductAttributesFilterInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.ProductAttributesFilterInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOProductAttributesFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOProductAttributesFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx context.Context, v any) (*model.ProductAttributesFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputProductAttributesFilterInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOProductDetails2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductDetails(ctx context.Context, sel ast.SelectionSet, v *model.ProductDetails) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ProductDetails(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOProductDetailsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx context.Context, v any) ([]*model.ProductDetailsFilterInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.ProductDetailsFilterInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOProductDetailsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOProductDetailsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx context.Context, v any) (*model.ProductDetailsFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputProductDetailsFilterInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOProductFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductFilterInput(ctx context.Context, v any) ([]*model.ProductFilterInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.ProductFilterInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductFilterInput(ctx context.Context, v any) (*model.ProductFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputProductFilterInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOProductGroupBy2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductGroupByᚄ(ctx context.Context, v any) ([]model.ProductGroupBy, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]model.ProductGroupBy, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNProductGroupBy2githubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductGroupBy(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOProductGroupBy2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductGroupByᚄ(ctx context.Context, sel ast.SelectionSet, v []model.ProductGroupBy) 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.marshalNProductGroupBy2githubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductGroupBy(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) unmarshalOProductOrdering2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductOrdering(ctx context.Context, v any) ([]*model.ProductOrdering, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.ProductOrdering, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOProductOrdering2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductOrdering(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOProductOrdering2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐProductOrdering(ctx context.Context, v any) (*model.ProductOrdering, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputProductOrdering(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOSpecs2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐSpecs(ctx context.Context, sel ast.SelectionSet, v *model.Specs) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Specs(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOSpecsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐSpecsFilterInput(ctx context.Context, v any) ([]*model.SpecsFilterInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.SpecsFilterInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOSpecsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐSpecsFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOSpecsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐSpecsFilterInput(ctx context.Context, v any) (*model.SpecsFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputSpecsFilterInput(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.unmarshalOString2ᚖstring(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.marshalOString2ᚖstring(ctx, sel, v[i]) + } + + 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) unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐStringComparator(ctx context.Context, v any) (*model1.StringComparator, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputStringComparator(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOStringListComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐStringListComparator(ctx context.Context, v any) (*model1.StringListComparator, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputStringListComparator(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOWarrantyInfo2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐWarrantyInfo(ctx context.Context, sel ast.SelectionSet, v *model.WarrantyInfo) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._WarrantyInfo(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOWarrantyInfoFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐWarrantyInfoFilterInput(ctx context.Context, v any) ([]*model.WarrantyInfoFilterInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.WarrantyInfoFilterInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOWarrantyInfoFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐWarrantyInfoFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOWarrantyInfoFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋjsonᚋgraphᚋmodelᚐWarrantyInfoFilterInput(ctx context.Context, v any) (*model.WarrantyInfoFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputWarrantyInfoFilterInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐOrderingTypes(ctx context.Context, v any) (*model1.OrderingTypes, error) { + if v == nil { + return nil, nil + } + var res = new(model1.OrderingTypes) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋexamplesᚋinterfaceᚋgraphᚋmodelᚐOrderingTypes(ctx context.Context, sel ast.SelectionSet, v *model1.OrderingTypes) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +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 ***************************** diff --git a/examples/json/graph/gqlgen.yml b/examples/json/graph/gqlgen.yml new file mode 100644 index 0000000..ea438dc --- /dev/null +++ b/examples/json/graph/gqlgen.yml @@ -0,0 +1,22 @@ +schema: + - schema.graphql + - ../../../pkg/schema/fastgql.graphql + +exec: + filename: graph/generated/generated.go + package: generated + +model: + filename: graph/model/models_gen.go + package: model + +resolver: + layout: follow-schema + dir: graph + package: graph + filename: graph/schema.resolvers.go + type: Resolver + +autobind: + - "github.com/roneli/fastgql/examples/json/graph/model" + diff --git a/examples/json/graph/model/.gitkeep b/examples/json/graph/model/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/json/graph/model/models_gen.go b/examples/json/graph/model/models_gen.go new file mode 100644 index 0000000..6d31954 --- /dev/null +++ b/examples/json/graph/model/models_gen.go @@ -0,0 +1,241 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package model + +import ( + "bytes" + "fmt" + "io" + "strconv" + + "github.com/roneli/fastgql/examples/interface/graph/model" +) + +type Dimensions struct { + Width *float64 `json:"width,omitempty" db:"width"` + Height *float64 `json:"height,omitempty" db:"height"` + Depth *float64 `json:"depth,omitempty" db:"depth"` +} + +// Filter input for JSON type Dimensions +type DimensionsFilterInput struct { + Width *model.FloatComparator `json:"width,omitempty" db:"width"` + Height *model.FloatComparator `json:"height,omitempty" db:"height"` + Depth *model.FloatComparator `json:"depth,omitempty" db:"depth"` + // Logical AND of FilterInput + And []*DimensionsFilterInput `json:"AND,omitempty" db:"and"` + // Logical OR of FilterInput + Or []*DimensionsFilterInput `json:"OR,omitempty" db:"or"` + // Logical NOT of FilterInput + Not *DimensionsFilterInput `json:"NOT,omitempty" db:"not"` +} + +type IDComparator struct { + Eq *string `json:"eq,omitempty" db:"eq"` + Neq *string `json:"neq,omitempty" db:"neq"` + IsNull *bool `json:"isNull,omitempty" db:"is_null"` +} + +type Product struct { + ID int `json:"id" db:"id"` + Name string `json:"name" db:"name"` + Attributes *ProductAttributes `json:"attributes,omitempty" db:"attributes"` +} + +type ProductAttributes struct { + Color *string `json:"color,omitempty" db:"color"` + Size *int `json:"size,omitempty" db:"size"` + Tags []*string `json:"tags,omitempty" db:"tags"` + Details *ProductDetails `json:"details,omitempty" db:"details"` + Specs *Specs `json:"specs,omitempty" db:"specs"` +} + +// Filter input for JSON type ProductAttributes +type ProductAttributesFilterInput struct { + Color *model.StringComparator `json:"color,omitempty" db:"color"` + Size *model.IntComparator `json:"size,omitempty" db:"size"` + Tags *model.StringListComparator `json:"tags,omitempty" db:"tags"` + Details *ProductDetailsFilterInput `json:"details,omitempty" db:"details"` + Specs *SpecsFilterInput `json:"specs,omitempty" db:"specs"` + // Logical AND of FilterInput + And []*ProductAttributesFilterInput `json:"AND,omitempty" db:"and"` + // Logical OR of FilterInput + Or []*ProductAttributesFilterInput `json:"OR,omitempty" db:"or"` + // Logical NOT of FilterInput + Not *ProductAttributesFilterInput `json:"NOT,omitempty" db:"not"` +} + +type ProductDetails struct { + Manufacturer *string `json:"manufacturer,omitempty" db:"manufacturer"` + Model *string `json:"model,omitempty" db:"model"` + Warranty *WarrantyInfo `json:"warranty,omitempty" db:"warranty"` +} + +// Filter input for JSON type ProductDetails +type ProductDetailsFilterInput struct { + Manufacturer *model.StringComparator `json:"manufacturer,omitempty" db:"manufacturer"` + Model *model.StringComparator `json:"model,omitempty" db:"model"` + Warranty *WarrantyInfoFilterInput `json:"warranty,omitempty" db:"warranty"` + // Logical AND of FilterInput + And []*ProductDetailsFilterInput `json:"AND,omitempty" db:"and"` + // Logical OR of FilterInput + Or []*ProductDetailsFilterInput `json:"OR,omitempty" db:"or"` + // Logical NOT of FilterInput + Not *ProductDetailsFilterInput `json:"NOT,omitempty" db:"not"` +} + +type ProductFilterInput struct { + ID *model.IntComparator `json:"id,omitempty" db:"id"` + Name *model.StringComparator `json:"name,omitempty" db:"name"` + Attributes *ProductAttributesFilterInput `json:"attributes,omitempty" db:"attributes"` + // Logical AND of FilterInput + And []*ProductFilterInput `json:"AND,omitempty" db:"and"` + // Logical OR of FilterInput + Or []*ProductFilterInput `json:"OR,omitempty" db:"or"` + // Logical NOT of FilterInput + Not *ProductFilterInput `json:"NOT,omitempty" db:"not"` +} + +// Ordering for Product +type ProductOrdering struct { + // Order Product by id + ID *model.OrderingTypes `json:"id,omitempty" db:"id"` + // Order Product by name + Name *model.OrderingTypes `json:"name,omitempty" db:"name"` +} + +// Aggregate Product +type ProductsAggregate struct { + // Group + Group map[string]any `json:"group,omitempty" db:"group"` + // Count results + Count int `json:"count" db:"count"` + // Max Aggregate + Max *ProductMax `json:"max" db:"max"` + // Min Aggregate + Min *ProductMin `json:"min" db:"min"` + // Avg Aggregate + Avg *ProductAvg `json:"avg" db:"avg"` + // Sum Aggregate + Sum *ProductSum `json:"sum" db:"sum"` +} + +type Specs struct { + Weight *float64 `json:"weight,omitempty" db:"weight"` + Dimensions *Dimensions `json:"dimensions,omitempty" db:"dimensions"` +} + +// Filter input for JSON type Specs +type SpecsFilterInput struct { + Weight *model.FloatComparator `json:"weight,omitempty" db:"weight"` + Dimensions *DimensionsFilterInput `json:"dimensions,omitempty" db:"dimensions"` + // Logical AND of FilterInput + And []*SpecsFilterInput `json:"AND,omitempty" db:"and"` + // Logical OR of FilterInput + Or []*SpecsFilterInput `json:"OR,omitempty" db:"or"` + // Logical NOT of FilterInput + Not *SpecsFilterInput `json:"NOT,omitempty" db:"not"` +} + +type WarrantyInfo struct { + Years *int `json:"years,omitempty" db:"years"` + Provider *string `json:"provider,omitempty" db:"provider"` +} + +// Filter input for JSON type WarrantyInfo +type WarrantyInfoFilterInput struct { + Years *model.IntComparator `json:"years,omitempty" db:"years"` + Provider *model.StringComparator `json:"provider,omitempty" db:"provider"` + // Logical AND of FilterInput + And []*WarrantyInfoFilterInput `json:"AND,omitempty" db:"and"` + // Logical OR of FilterInput + Or []*WarrantyInfoFilterInput `json:"OR,omitempty" db:"or"` + // Logical NOT of FilterInput + Not *WarrantyInfoFilterInput `json:"NOT,omitempty" db:"not"` +} + +// avg Aggregate +type ProductAvg struct { + // Compute the avg for id + ID float64 `json:"id" db:"id"` +} + +// max Aggregate +type ProductMax struct { + // Compute the max for id + ID int `json:"id" db:"id"` + // Compute the max for name + Name string `json:"name" db:"name"` +} + +// min Aggregate +type ProductMin struct { + // Compute the min for id + ID int `json:"id" db:"id"` + // Compute the min for name + Name string `json:"name" db:"name"` +} + +// sum Aggregate +type ProductSum struct { + // Compute the sum for id + ID float64 `json:"id" db:"id"` +} + +// Group by Product +type ProductGroupBy string + +const ( + // Group by id + ProductGroupByID ProductGroupBy = "ID" + // Group by name + ProductGroupByName ProductGroupBy = "NAME" +) + +var AllProductGroupBy = []ProductGroupBy{ + ProductGroupByID, + ProductGroupByName, +} + +func (e ProductGroupBy) IsValid() bool { + switch e { + case ProductGroupByID, ProductGroupByName: + return true + } + return false +} + +func (e ProductGroupBy) String() string { + return string(e) +} + +func (e *ProductGroupBy) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ProductGroupBy(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ProductGroupBy", str) + } + return nil +} + +func (e ProductGroupBy) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *ProductGroupBy) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e ProductGroupBy) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} diff --git a/examples/json/graph/resolver.go b/examples/json/graph/resolver.go new file mode 100644 index 0000000..7c22825 --- /dev/null +++ b/examples/json/graph/resolver.go @@ -0,0 +1,13 @@ +package graph + +import ( + "github.com/roneli/fastgql/pkg/execution" +) + +// 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 unknown + +type Resolver struct { + Executor execution.Executor +} diff --git a/examples/json/graph/schema.graphql b/examples/json/graph/schema.graphql new file mode 100644 index 0000000..ad1702b --- /dev/null +++ b/examples/json/graph/schema.graphql @@ -0,0 +1,44 @@ +# Example schema demonstrating JSON field selection with @json directive + +type ProductDetails { + manufacturer: String + model: String + warranty: WarrantyInfo +} + +type WarrantyInfo { + years: Int + provider: String +} + +type Specs { + weight: Float + dimensions: Dimensions +} + +type Dimensions { + width: Float + height: Float + depth: Float +} + +type ProductAttributes { + color: String + size: Int + tags: [String] + details: ProductDetails + specs: Specs +} + +type Product @generateFilterInput @table(name: "products", schema: "app") { + id: Int! + name: String! + # Typed JSON field - supports nested field selection and filtering + attributes: ProductAttributes @json(column: "attributes") +} + +type Query { + products: [Product] @generate +} + +# =================== Default Scalar types supported by fastgql ================== diff --git a/examples/json/graph/schema.resolvers.go b/examples/json/graph/schema.resolvers.go new file mode 100644 index 0000000..7f4863d --- /dev/null +++ b/examples/json/graph/schema.resolvers.go @@ -0,0 +1,36 @@ +package graph + +// 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.84 + +import ( + "context" + + "github.com/roneli/fastgql/examples/json/graph/generated" + "github.com/roneli/fastgql/examples/json/graph/model" +) + +// Products is the resolver for the products field. +func (r *queryResolver) Products(ctx context.Context, limit *int, offset *int, orderBy []*model.ProductOrdering, filter *model.ProductFilterInput) ([]*model.Product, error) { + var data []*model.Product + if err := r.Executor.Query(ctx, &data); err != nil { + return nil, err + } + return data, nil +} + +// ProductsAggregate is the resolver for the _productsAggregate field. +func (r *queryResolver) ProductsAggregate(ctx context.Context, groupBy []model.ProductGroupBy, filter *model.ProductFilterInput) ([]*model.ProductsAggregate, error) { + var data []*model.ProductsAggregate + if err := r.Executor.Query(ctx, &data); err != nil { + return nil, err + } + return data, nil +} + +// Query returns generated.QueryResolver implementation. +func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} } + +type queryResolver struct{ *Resolver } diff --git a/examples/json/init.sql b/examples/json/init.sql new file mode 100644 index 0000000..a891df3 --- /dev/null +++ b/examples/json/init.sql @@ -0,0 +1,70 @@ +-- Database initialization script for JSON field selection example +-- Run this script to set up the database schema and test data + +-- Create schema +CREATE SCHEMA IF NOT EXISTS app; + +-- Create products table with JSONB columns +CREATE TABLE IF NOT EXISTS app.products ( + id SERIAL PRIMARY KEY, + name VARCHAR(255) NOT NULL, + attributes JSONB, + metadata JSONB +); + +-- Create indexes for JSONB columns (optional but recommended for performance) +CREATE INDEX IF NOT EXISTS idx_products_attributes ON app.products USING GIN (attributes); +CREATE INDEX IF NOT EXISTS idx_products_metadata ON app.products USING GIN (metadata); + +-- Insert test data covering all complex JSON field selection scenarios + +-- Simple case: basic attributes +INSERT INTO app.products (id, name, attributes, metadata) VALUES +(1, 'Product 1', + '{"color": "red", "size": 10}'::jsonb, + '{"type": "premium", "price": 100}'::jsonb); + +-- Nested object: with details +INSERT INTO app.products (id, name, attributes, metadata) VALUES +(2, 'Product 2', + '{"color": "blue", "size": 20, "details": {"manufacturer": "Acme Corp", "model": "X-2000"}}'::jsonb, + '{"type": "standard", "price": 50}'::jsonb); + +-- Deep nesting: with warranty info +INSERT INTO app.products (id, name, attributes, metadata) VALUES +(3, 'Product 3', + '{"color": "green", "size": 15, "details": {"manufacturer": "Tech Inc", "model": "Y-3000", "warranty": {"years": 3, "provider": "TechCare"}}}'::jsonb, + '{"type": "premium", "price": 200}'::jsonb); + +-- Three-level nesting: with specs and dimensions +INSERT INTO app.products (id, name, attributes, metadata) VALUES +(4, 'Product 4', + '{"color": "black", "size": 25, "specs": {"weight": 2.5, "dimensions": {"width": 10.0, "height": 20.0, "depth": 5.0}}}'::jsonb, + '{"type": "premium", "price": 300}'::jsonb); + +-- Complex: all fields including nested objects +INSERT INTO app.products (id, name, attributes, metadata) VALUES +(5, 'Product 5', + '{"color": "white", "size": 30, "tags": ["new", "featured"], "details": {"manufacturer": "MegaCorp", "model": "Z-4000", "warranty": {"years": 5, "provider": "MegaCare"}}, "specs": {"weight": 3.0, "dimensions": {"width": 15.0, "height": 25.0, "depth": 8.0}}}'::jsonb, + '{"type": "premium", "price": 500, "featured": true}'::jsonb); + +-- Example queries you can test in GraphQL playground: +-- +-- 1. Simple scalar selection: +-- query { products { name, attributes { color, size } } } +-- +-- 2. Nested object selection: +-- query { products { name, attributes { color, details { manufacturer, model } } } } +-- +-- 3. Deep nesting (3 levels): +-- query { products { name, attributes { details { warranty { years, provider } } } } } +-- +-- 4. Three-level nesting with dimensions: +-- query { products { name, attributes { specs { dimensions { width, height, depth } } } } } +-- +-- 5. Mixed scalar and nested: +-- query { products { name, attributes { color, size, details { manufacturer }, specs { weight } } } } +-- +-- 6. Complex nested object with all fields: +-- query { products { name, attributes { details { manufacturer, model, warranty { years, provider } } } } } + diff --git a/examples/json/server.go b/examples/json/server.go new file mode 100644 index 0000000..571210b --- /dev/null +++ b/examples/json/server.go @@ -0,0 +1,59 @@ +//go:generate go run github.com/roneli/fastgql generate -c gqlgen.yml +package main + +import ( + "context" + "net/http" + "os" + + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/jackc/pgx/v5/pgxpool" + "github.com/roneli/fastgql/examples/json/graph" + "github.com/roneli/fastgql/examples/json/graph/generated" + "github.com/roneli/fastgql/pkg/execution" + "github.com/roneli/fastgql/pkg/execution/builders" + "github.com/roneli/fastgql/pkg/execution/builders/sql" + "github.com/roneli/fastgql/pkg/log/adapters" + "github.com/rs/zerolog/log" +) + +const defaultPort = "8080" + +const defaultPGConnection = "postgresql://localhost/postgres?user=postgres" + +func main() { + port := os.Getenv("PORT") + if port == "" { + port = defaultPort + } + pgConnectionString := os.Getenv("PG_CONN_STR") + if pgConnectionString == "" { + pgConnectionString = defaultPGConnection + } + + pool, err := pgxpool.New(context.Background(), pgConnectionString) + if err != nil { + panic(err) + } + defer pool.Close() + + resolver := &graph.Resolver{} + executableSchema := generated.NewExecutableSchema(generated.Config{Resolvers: resolver}) + + // Create config and executor + cfg := &builders.Config{Schema: executableSchema.Schema(), Logger: adapters.NewZerologAdapter(log.Logger)} + multiExec := execution.NewMultiExecutor(executableSchema.Schema(), "postgres") + multiExec.Register("postgres", sql.NewExecutor(pool, cfg)) + resolver.Executor = multiExec + + srv := handler.NewDefaultServer(executableSchema) + + http.Handle("/", playground.Handler("GraphQL playground", "/query")) + http.Handle("/query", srv) + + log.Printf("connect to http://localhost:%s/ for GraphQL playground", port) + if err := http.ListenAndServe(":"+port, nil); err != nil { + log.Error().Err(err).Msg("failed to start server") + } +} diff --git a/examples/mutations/graph/generated/generated.go b/examples/mutations/graph/generated/generated.go index 4ed09cf..bdb7ee2 100644 --- a/examples/mutations/graph/generated/generated.go +++ b/examples/mutations/graph/generated/generated.go @@ -817,248 +817,6 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var sources = []*ast.Source{ - {Name: "../fastgql.graphql", Input: `directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION -directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION -directive @generateFilterInput(description: String) on OBJECT | INTERFACE -directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT -directive @isInterfaceFilter on INPUT_FIELD_DEFINITION -directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION -directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE -directive @typename(name: String!) on INTERFACE -input BooleanComparator { - eq: Boolean - neq: Boolean - isNull: Boolean -} -input BooleanListComparator { - eq: [Boolean] - neq: [Boolean] - contains: [Boolean] - contained: [Boolean] - overlap: [Boolean] - isNull: Boolean -} -input FloatComparator { - eq: Float - neq: Float - gt: Float - gte: Float - lt: Float - lte: Float - isNull: Boolean -} -input FloatListComparator { - eq: [Float] - neq: [Float] - contains: [Float] - contained: [Float] - overlap: [Float] - isNull: Boolean -} -input IntComparator { - eq: Int - neq: Int - gt: Int - gte: Int - lt: Int - lte: Int - isNull: Boolean -} -input IntListComparator { - eq: [Int] - neq: [Int] - contains: [Int] - contained: [Int] - overlap: [Int] - isNull: Boolean -} -scalar Map -input StringComparator { - eq: String - neq: String - contains: [String] - notContains: [String] - like: String - ilike: String - suffix: String - prefix: String - isNull: Boolean -} -input StringListComparator { - eq: [String] - neq: [String] - contains: [String] - containedBy: [String] - overlap: [String] - isNull: Boolean -} -type _AggregateResult { - count: Int! -} -enum _OrderingTypes { - ASC - DESC - ASC_NULL_FIRST - DESC_NULL_FIRST - ASC_NULL_LAST - DESC_NULL_LAST -} -enum _relationType { - ONE_TO_ONE - ONE_TO_MANY - MANY_TO_MANY -} -`, BuiltIn: false}, - {Name: "../schema.graphql", Input: `type Category @generateFilterInput @table(name: "categories") { - id: Int! - name: String -} -type Post @generateFilterInput @table(name: "posts") @generateMutations { - id: Int! - name: String - categories( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Category - """ - orderBy: [CategoryOrdering], - """ - Filter categories - """ - filter: CategoryFilterInput): [Category] @relation(type: MANY_TO_MANY, fields: ["id"], references: ["id"], manyToManyTable: "posts_to_categories", manyToManyFields: ["post_id"], manyToManyReferences: ["category_id"]) - user_id: Int - user: User @relation(type: ONE_TO_ONE, fields: ["user_id"], references: ["id"]) - """ - categories Aggregate - """ - _categoriesAggregate(groupBy: [CategoryGroupBy!], - """ - Filter _categoriesAggregate - """ - filter: CategoryFilterInput): [CategoriesAggregate!]! @generate(filter: true) - """ - user Aggregate - """ - _userAggregate(groupBy: [UserGroupBy!], - """ - Filter _userAggregate - """ - filter: UserFilterInput): [UsersAggregate!]! @generate(filter: true) -} -type Query { - posts( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Post - """ - orderBy: [PostOrdering], - """ - Filter posts - """ - filter: PostFilterInput): [Post] @generate - users( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for User - """ - orderBy: [UserOrdering], - """ - Filter users - """ - filter: UserFilterInput): [User] @generate - categories( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Category - """ - orderBy: [CategoryOrdering], - """ - Filter categories - """ - filter: CategoryFilterInput): [Category] @generate - """ - posts Aggregate - """ - _postsAggregate(groupBy: [PostGroupBy!], - """ - Filter _postsAggregate - """ - filter: PostFilterInput): [PostsAggregate!]! @generate(filter: true) - """ - users Aggregate - """ - _usersAggregate(groupBy: [UserGroupBy!], - """ - Filter _usersAggregate - """ - filter: UserFilterInput): [UsersAggregate!]! @generate(filter: true) - """ - categories Aggregate - """ - _categoriesAggregate(groupBy: [CategoryGroupBy!], - """ - Filter _categoriesAggregate - """ - filter: CategoryFilterInput): [CategoriesAggregate!]! @generate(filter: true) -} -type User @table(name: "user") @generateFilterInput { - id: Int! - name: String! - posts( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Post - """ - orderBy: [PostOrdering], - """ - Filter posts - """ - filter: PostFilterInput): [Post] @relation(type: ONE_TO_MANY, fields: ["id"], references: ["user_id"]) - """ - posts Aggregate - """ - _postsAggregate(groupBy: [PostGroupBy!], - """ - Filter _postsAggregate - """ - filter: PostFilterInput): [PostsAggregate!]! @generate(filter: true) -} -`, BuiltIn: false}, {Name: "../fastgql_schema.graphql", Input: `""" Aggregate Category """ @@ -1487,6 +1245,248 @@ input UpdatePostInput { name: String user_id: Int } +`, BuiltIn: false}, + {Name: "../fastgql.graphql", Input: `directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION +directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION +directive @generateFilterInput(description: String) on OBJECT | INTERFACE +directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT +directive @isInterfaceFilter on INPUT_FIELD_DEFINITION +directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION +directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE +directive @typename(name: String!) on INTERFACE +input BooleanComparator { + eq: Boolean + neq: Boolean + isNull: Boolean +} +input BooleanListComparator { + eq: [Boolean] + neq: [Boolean] + contains: [Boolean] + contained: [Boolean] + overlap: [Boolean] + isNull: Boolean +} +input FloatComparator { + eq: Float + neq: Float + gt: Float + gte: Float + lt: Float + lte: Float + isNull: Boolean +} +input FloatListComparator { + eq: [Float] + neq: [Float] + contains: [Float] + contained: [Float] + overlap: [Float] + isNull: Boolean +} +input IntComparator { + eq: Int + neq: Int + gt: Int + gte: Int + lt: Int + lte: Int + isNull: Boolean +} +input IntListComparator { + eq: [Int] + neq: [Int] + contains: [Int] + contained: [Int] + overlap: [Int] + isNull: Boolean +} +scalar Map +input StringComparator { + eq: String + neq: String + contains: [String] + notContains: [String] + like: String + ilike: String + suffix: String + prefix: String + isNull: Boolean +} +input StringListComparator { + eq: [String] + neq: [String] + contains: [String] + containedBy: [String] + overlap: [String] + isNull: Boolean +} +type _AggregateResult { + count: Int! +} +enum _OrderingTypes { + ASC + DESC + ASC_NULL_FIRST + DESC_NULL_FIRST + ASC_NULL_LAST + DESC_NULL_LAST +} +enum _relationType { + ONE_TO_ONE + ONE_TO_MANY + MANY_TO_MANY +} +`, BuiltIn: false}, + {Name: "../schema.graphql", Input: `type Category @generateFilterInput @table(name: "categories") { + id: Int! + name: String +} +type Post @generateFilterInput @table(name: "posts") @generateMutations { + id: Int! + name: String + categories( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Category + """ + orderBy: [CategoryOrdering], + """ + Filter categories + """ + filter: CategoryFilterInput): [Category] @relation(type: MANY_TO_MANY, fields: ["id"], references: ["id"], manyToManyTable: "posts_to_categories", manyToManyFields: ["post_id"], manyToManyReferences: ["category_id"]) + user_id: Int + user: User @relation(type: ONE_TO_ONE, fields: ["user_id"], references: ["id"]) + """ + categories Aggregate + """ + _categoriesAggregate(groupBy: [CategoryGroupBy!], + """ + Filter _categoriesAggregate + """ + filter: CategoryFilterInput): [CategoriesAggregate!]! @generate(filter: true) + """ + user Aggregate + """ + _userAggregate(groupBy: [UserGroupBy!], + """ + Filter _userAggregate + """ + filter: UserFilterInput): [UsersAggregate!]! @generate(filter: true) +} +type Query { + posts( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Post + """ + orderBy: [PostOrdering], + """ + Filter posts + """ + filter: PostFilterInput): [Post] @generate + users( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for User + """ + orderBy: [UserOrdering], + """ + Filter users + """ + filter: UserFilterInput): [User] @generate + categories( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Category + """ + orderBy: [CategoryOrdering], + """ + Filter categories + """ + filter: CategoryFilterInput): [Category] @generate + """ + posts Aggregate + """ + _postsAggregate(groupBy: [PostGroupBy!], + """ + Filter _postsAggregate + """ + filter: PostFilterInput): [PostsAggregate!]! @generate(filter: true) + """ + users Aggregate + """ + _usersAggregate(groupBy: [UserGroupBy!], + """ + Filter _usersAggregate + """ + filter: UserFilterInput): [UsersAggregate!]! @generate(filter: true) + """ + categories Aggregate + """ + _categoriesAggregate(groupBy: [CategoryGroupBy!], + """ + Filter _categoriesAggregate + """ + filter: CategoryFilterInput): [CategoriesAggregate!]! @generate(filter: true) +} +type User @table(name: "user") @generateFilterInput { + id: Int! + name: String! + posts( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Post + """ + orderBy: [PostOrdering], + """ + Filter posts + """ + filter: PostFilterInput): [Post] @relation(type: ONE_TO_MANY, fields: ["id"], references: ["user_id"]) + """ + posts Aggregate + """ + _postsAggregate(groupBy: [PostGroupBy!], + """ + Filter _postsAggregate + """ + filter: PostFilterInput): [PostsAggregate!]! @generate(filter: true) +} `, BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) diff --git a/examples/simple/graph/generated/generated.go b/examples/simple/graph/generated/generated.go index cd6eb6d..f02bbae 100644 --- a/examples/simple/graph/generated/generated.go +++ b/examples/simple/graph/generated/generated.go @@ -900,98 +900,6 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var sources = []*ast.Source{ - {Name: "../fastgql.graphql", Input: `directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION -directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION -directive @generateFilterInput(description: String) on OBJECT | INTERFACE -directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT -directive @isInterfaceFilter on INPUT_FIELD_DEFINITION -directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION -directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE -directive @typename(name: String!) on INTERFACE -input BooleanComparator { - eq: Boolean - neq: Boolean - isNull: Boolean -} -input BooleanListComparator { - eq: [Boolean] - neq: [Boolean] - contains: [Boolean] - contained: [Boolean] - overlap: [Boolean] - isNull: Boolean -} -input FloatComparator { - eq: Float - neq: Float - gt: Float - gte: Float - lt: Float - lte: Float - isNull: Boolean -} -input FloatListComparator { - eq: [Float] - neq: [Float] - contains: [Float] - contained: [Float] - overlap: [Float] - isNull: Boolean -} -input IntComparator { - eq: Int - neq: Int - gt: Int - gte: Int - lt: Int - lte: Int - isNull: Boolean -} -input IntListComparator { - eq: [Int] - neq: [Int] - contains: [Int] - contained: [Int] - overlap: [Int] - isNull: Boolean -} -scalar Map -input StringComparator { - eq: String - neq: String - contains: [String] - notContains: [String] - like: String - ilike: String - suffix: String - prefix: String - isNull: Boolean -} -input StringListComparator { - eq: [String] - neq: [String] - contains: [String] - containedBy: [String] - overlap: [String] - isNull: Boolean -} -type _AggregateResult { - count: Int! -} -enum _OrderingTypes { - ASC - DESC - ASC_NULL_FIRST - DESC_NULL_FIRST - ASC_NULL_LAST - DESC_NULL_LAST -} -enum _relationType { - ONE_TO_ONE - ONE_TO_MANY - MANY_TO_MANY -} -`, BuiltIn: false}, {Name: "../schema.graphql", Input: `type Category @generateFilterInput @table(name: "categories") { id: Int! name: String @@ -1763,6 +1671,98 @@ type _UsersAggregateSum { """ count: Float! } +`, BuiltIn: false}, + {Name: "../fastgql.graphql", Input: `directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION +directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION +directive @generateFilterInput(description: String) on OBJECT | INTERFACE +directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT +directive @isInterfaceFilter on INPUT_FIELD_DEFINITION +directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION +directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE +directive @typename(name: String!) on INTERFACE +input BooleanComparator { + eq: Boolean + neq: Boolean + isNull: Boolean +} +input BooleanListComparator { + eq: [Boolean] + neq: [Boolean] + contains: [Boolean] + contained: [Boolean] + overlap: [Boolean] + isNull: Boolean +} +input FloatComparator { + eq: Float + neq: Float + gt: Float + gte: Float + lt: Float + lte: Float + isNull: Boolean +} +input FloatListComparator { + eq: [Float] + neq: [Float] + contains: [Float] + contained: [Float] + overlap: [Float] + isNull: Boolean +} +input IntComparator { + eq: Int + neq: Int + gt: Int + gte: Int + lt: Int + lte: Int + isNull: Boolean +} +input IntListComparator { + eq: [Int] + neq: [Int] + contains: [Int] + contained: [Int] + overlap: [Int] + isNull: Boolean +} +scalar Map +input StringComparator { + eq: String + neq: String + contains: [String] + notContains: [String] + like: String + ilike: String + suffix: String + prefix: String + isNull: Boolean +} +input StringListComparator { + eq: [String] + neq: [String] + contains: [String] + containedBy: [String] + overlap: [String] + isNull: Boolean +} +type _AggregateResult { + count: Int! +} +enum _OrderingTypes { + ASC + DESC + ASC_NULL_FIRST + DESC_NULL_FIRST + ASC_NULL_LAST + DESC_NULL_LAST +} +enum _relationType { + ONE_TO_ONE + ONE_TO_MANY + MANY_TO_MANY +} `, BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) diff --git a/pkg/execution/__test__/graph/common.graphql b/pkg/execution/__test__/graph/common.graphql index 053a1c9..4c8934f 100644 --- a/pkg/execution/__test__/graph/common.graphql +++ b/pkg/execution/__test__/graph/common.graphql @@ -1,131 +1,140 @@ -# ================== schema generation fastgql directives ================== - -# Generate Resolver directive tells fastgql to generate an automatic resolver for a given field -# @generateResolver can only be defined on Query and Mutation fields. -# adding pagination, ordering, aggregate, filter to false will disable the generation of the corresponding arguments -# for filter to work @generateFilterInput must be defined on the object, if its missing you will get an error -# recursive will generate pagination, filtering, ordering and aggregate for all the relations of the object, -# this will modify the object itself and add arguments to the object fields. -directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION - -# Generate mutations for an object -directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT - -# Generate filter input on an object -directive @generateFilterInput(description: String) repeatable on OBJECT | INTERFACE - -directive @isInterfaceFilter on INPUT_FIELD_DEFINITION - -# ================== Directives supported by fastgql for Querying ================== - -# Table directive is defined on OBJECTS, if no table directive is defined defaults are assumed -# i.e , "postgres", "" -directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE - -# Relation directive defines relations cross tables and dialects -directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION - -# This will make the field skipped in select, this is useful for fields that are not columns in the database, and you want to resolve it manually -directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION - -# Typename is the field name that will be used to resolve the type of the interface, -# default model is the default model that will be used to resolve the interface if none is found. -directive @typename(name: String!) on INTERFACE - -# =================== Default Scalar types supported by fastgql =================== -scalar Map -# ================== Default Filter input types supported by fastgql ================== - -enum _relationType { - ONE_TO_ONE - ONE_TO_MANY - MANY_TO_MANY -} - -enum _OrderingTypes { - ASC - DESC - ASC_NULL_FIRST - DESC_NULL_FIRST - ASC_NULL_LAST - DESC_NULL_LAST -} - -type _AggregateResult { - count: Int! -} - -input StringComparator { - eq: String - neq: String - contains: [String] - notContains: [String] - like: String - ilike: String - suffix: String - prefix: String - isNull: Boolean -} - -input StringListComparator { - eq: [String] - neq: [String] - contains: [String] - containedBy: [String] - overlap: [String] - isNull: Boolean -} - -input IntComparator { - eq: Int - neq: Int - gt: Int - gte: Int - lt: Int - lte: Int - isNull: Boolean -} - -input IntListComparator { - eq: [Int] - neq: [Int] - contains: [Int] - contained: [Int] - overlap: [Int] - isNull: Boolean -} - -input FloatComparator { - eq: Float - neq: Float - gt: Float - gte: Float - lt: Float - lte: Float - isNull: Boolean -} - -input FloatListComparator { - eq: [Float] - neq: [Float] - contains: [Float] - contained: [Float] - overlap: [Float] - isNull: Boolean -} - - -input BooleanComparator { - eq: Boolean - neq: Boolean - isNull: Boolean -} - -input BooleanListComparator { - eq: [Boolean] - neq: [Boolean] - contains: [Boolean] - contained: [Boolean] - overlap: [Boolean] - isNull: Boolean -} \ No newline at end of file +# ================== schema generation fastgql directives ================== + +# Generate Resolver directive tells fastgql to generate an automatic resolver for a given field +# @generateResolver can only be defined on Query and Mutation fields. +# adding pagination, ordering, aggregate, filter to false will disable the generation of the corresponding arguments +# for filter to work @generateFilterInput must be defined on the object, if its missing you will get an error +# recursive will generate pagination, filtering, ordering and aggregate for all the relations of the object, +# this will modify the object itself and add arguments to the object fields. +directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION + +# Generate mutations for an object +directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT + +# Generate filter input on an object +directive @generateFilterInput(description: String) repeatable on OBJECT | INTERFACE + +directive @isInterfaceFilter on INPUT_FIELD_DEFINITION + +# ================== Directives supported by fastgql for Querying ================== + +# Table directive is defined on OBJECTS, if no table directive is defined defaults are assumed +# i.e , "postgres", "" +directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE + +# Relation directive defines relations cross tables and dialects +directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION + +# This will make the field skipped in select, this is useful for fields that are not columns in the database, and you want to resolve it manually +directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION + +# Typename is the field name that will be used to resolve the type of the interface, +# default model is the default model that will be used to resolve the interface if none is found. +directive @typename(name: String!) on INTERFACE + +# JSON directive marks a field as stored in a JSONB column +directive @json(column: String!) on FIELD_DEFINITION + +# =================== Default Scalar types supported by fastgql =================== +scalar Map +# ================== Default Filter input types supported by fastgql ================== + +input IDComparator { + eq: ID + neq: ID + isNull: Boolean +} + +enum _relationType { + ONE_TO_ONE + ONE_TO_MANY + MANY_TO_MANY +} + +enum _OrderingTypes { + ASC + DESC + ASC_NULL_FIRST + DESC_NULL_FIRST + ASC_NULL_LAST + DESC_NULL_LAST +} + +type _AggregateResult { + count: Int! +} + +input StringComparator { + eq: String + neq: String + contains: [String] + notContains: [String] + like: String + ilike: String + suffix: String + prefix: String + isNull: Boolean +} + +input StringListComparator { + eq: [String] + neq: [String] + contains: [String] + containedBy: [String] + overlap: [String] + isNull: Boolean +} + +input IntComparator { + eq: Int + neq: Int + gt: Int + gte: Int + lt: Int + lte: Int + isNull: Boolean +} + +input IntListComparator { + eq: [Int] + neq: [Int] + contains: [Int] + contained: [Int] + overlap: [Int] + isNull: Boolean +} + +input FloatComparator { + eq: Float + neq: Float + gt: Float + gte: Float + lt: Float + lte: Float + isNull: Boolean +} + +input FloatListComparator { + eq: [Float] + neq: [Float] + contains: [Float] + contained: [Float] + overlap: [Float] + isNull: Boolean +} + + +input BooleanComparator { + eq: Boolean + neq: Boolean + isNull: Boolean +} + +input BooleanListComparator { + eq: [Boolean] + neq: [Boolean] + contains: [Boolean] + contained: [Boolean] + overlap: [Boolean] + isNull: Boolean +} diff --git a/pkg/execution/__test__/graph/generated/generated.go b/pkg/execution/__test__/graph/generated/generated.go index b5ed005..22b2e2d 100644 --- a/pkg/execution/__test__/graph/generated/generated.go +++ b/pkg/execution/__test__/graph/generated/generated.go @@ -44,6 +44,7 @@ type ResolverRoot interface { type DirectiveRoot struct { FastgqlField func(ctx context.Context, obj any, next graphql.Resolver, skipSelect *bool) (res any, err error) + Json func(ctx context.Context, obj any, next graphql.Resolver, column string) (res any, err error) Typename func(ctx context.Context, obj any, next graphql.Resolver, name string) (res any, err error) } @@ -115,6 +116,33 @@ type ComplexityRoot struct { RowsAffected func(childComplexity int) int } + Product struct { + Attributes func(childComplexity int) int + ID func(childComplexity int) int + Metadata func(childComplexity int) int + Name func(childComplexity int) int + } + + ProductAttributes struct { + Color func(childComplexity int) int + Details func(childComplexity int) int + Size func(childComplexity int) int + } + + ProductDetails struct { + Manufacturer func(childComplexity int) int + Model func(childComplexity int) int + } + + ProductsAggregate struct { + Avg func(childComplexity int) int + Count func(childComplexity int) int + Group func(childComplexity int) int + Max func(childComplexity int) int + Min func(childComplexity int) int + Sum func(childComplexity int) int + } + Query struct { Animals func(childComplexity int, limit *int, offset *int, orderBy []*model.AnimalOrdering, filter *model.AnimalFilterInput) int AnimalsAggregate func(childComplexity int, groupBy []model.AnimalGroupBy, filter *model.AnimalFilterInput) int @@ -122,6 +150,8 @@ type ComplexityRoot struct { CategoriesAggregate func(childComplexity int, groupBy []model.CategoryGroupBy, filter *model.CategoryFilterInput) int Posts func(childComplexity int, limit *int, offset *int, orderBy []*model.PostOrdering, filter *model.PostFilterInput) int PostsAggregate func(childComplexity int, groupBy []model.PostGroupBy, filter *model.PostFilterInput) int + Products func(childComplexity int, limit *int, offset *int, orderBy []*model.ProductOrdering, filter *model.ProductFilterInput) int + ProductsAggregate func(childComplexity int, groupBy []model.ProductGroupBy, filter *model.ProductFilterInput) int Users func(childComplexity int, limit *int, offset *int, orderBy []*model.UserOrdering, filter *model.UserFilterInput) int UsersAggregate func(childComplexity int, groupBy []model.UserGroupBy, filter *model.UserFilterInput) int } @@ -206,6 +236,24 @@ type ComplexityRoot struct { UserID func(childComplexity int) int } + _ProductAvg struct { + ID func(childComplexity int) int + } + + _ProductMax struct { + ID func(childComplexity int) int + Name func(childComplexity int) int + } + + _ProductMin struct { + ID func(childComplexity int) int + Name func(childComplexity int) int + } + + _ProductSum struct { + ID func(childComplexity int) int + } + _UserAvg struct { ID func(childComplexity int) int } @@ -235,10 +283,12 @@ type QueryResolver interface { Users(ctx context.Context, limit *int, offset *int, orderBy []*model.UserOrdering, filter *model.UserFilterInput) ([]*model.User, error) Categories(ctx context.Context, limit *int, offset *int, orderBy []*model.CategoryOrdering, filter *model.CategoryFilterInput) ([]*model.Category, error) Animals(ctx context.Context, limit *int, offset *int, orderBy []*model.AnimalOrdering, filter *model.AnimalFilterInput) ([]model.Animal, error) + Products(ctx context.Context, limit *int, offset *int, orderBy []*model.ProductOrdering, filter *model.ProductFilterInput) ([]*model.Product, error) PostsAggregate(ctx context.Context, groupBy []model.PostGroupBy, filter *model.PostFilterInput) ([]model.PostsAggregate, error) UsersAggregate(ctx context.Context, groupBy []model.UserGroupBy, filter *model.UserFilterInput) ([]model.UsersAggregate, error) CategoriesAggregate(ctx context.Context, groupBy []model.CategoryGroupBy, filter *model.CategoryFilterInput) ([]model.CategoriesAggregate, error) AnimalsAggregate(ctx context.Context, groupBy []model.AnimalGroupBy, filter *model.AnimalFilterInput) ([]model.AnimalsAggregate, error) + ProductsAggregate(ctx context.Context, groupBy []model.ProductGroupBy, filter *model.ProductFilterInput) ([]model.ProductsAggregate, error) } type executableSchema struct { @@ -539,6 +589,100 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.PostsPayload.RowsAffected(childComplexity), true + case "Product.attributes": + if e.complexity.Product.Attributes == nil { + break + } + + return e.complexity.Product.Attributes(childComplexity), true + case "Product.id": + if e.complexity.Product.ID == nil { + break + } + + return e.complexity.Product.ID(childComplexity), true + case "Product.metadata": + if e.complexity.Product.Metadata == nil { + break + } + + return e.complexity.Product.Metadata(childComplexity), true + case "Product.name": + if e.complexity.Product.Name == nil { + break + } + + return e.complexity.Product.Name(childComplexity), true + + case "ProductAttributes.color": + if e.complexity.ProductAttributes.Color == nil { + break + } + + return e.complexity.ProductAttributes.Color(childComplexity), true + case "ProductAttributes.details": + if e.complexity.ProductAttributes.Details == nil { + break + } + + return e.complexity.ProductAttributes.Details(childComplexity), true + case "ProductAttributes.size": + if e.complexity.ProductAttributes.Size == nil { + break + } + + return e.complexity.ProductAttributes.Size(childComplexity), true + + case "ProductDetails.manufacturer": + if e.complexity.ProductDetails.Manufacturer == nil { + break + } + + return e.complexity.ProductDetails.Manufacturer(childComplexity), true + case "ProductDetails.model": + if e.complexity.ProductDetails.Model == nil { + break + } + + return e.complexity.ProductDetails.Model(childComplexity), true + + case "ProductsAggregate.avg": + if e.complexity.ProductsAggregate.Avg == nil { + break + } + + return e.complexity.ProductsAggregate.Avg(childComplexity), true + case "ProductsAggregate.count": + if e.complexity.ProductsAggregate.Count == nil { + break + } + + return e.complexity.ProductsAggregate.Count(childComplexity), true + case "ProductsAggregate.group": + if e.complexity.ProductsAggregate.Group == nil { + break + } + + return e.complexity.ProductsAggregate.Group(childComplexity), true + case "ProductsAggregate.max": + if e.complexity.ProductsAggregate.Max == nil { + break + } + + return e.complexity.ProductsAggregate.Max(childComplexity), true + case "ProductsAggregate.min": + if e.complexity.ProductsAggregate.Min == nil { + break + } + + return e.complexity.ProductsAggregate.Min(childComplexity), true + case "ProductsAggregate.sum": + if e.complexity.ProductsAggregate.Sum == nil { + break + } + + return e.complexity.ProductsAggregate.Sum(childComplexity), true + case "Query.animals": if e.complexity.Query.Animals == nil { break @@ -605,6 +749,28 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin } return e.complexity.Query.PostsAggregate(childComplexity, args["groupBy"].([]model.PostGroupBy), args["filter"].(*model.PostFilterInput)), true + case "Query.products": + if e.complexity.Query.Products == nil { + break + } + + args, err := ec.field_Query_products_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Products(childComplexity, args["limit"].(*int), args["offset"].(*int), args["orderBy"].([]*model.ProductOrdering), args["filter"].(*model.ProductFilterInput)), true + case "Query._productsAggregate": + if e.complexity.Query.ProductsAggregate == nil { + break + } + + args, err := ec.field_Query__productsAggregate_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.ProductsAggregate(childComplexity, args["groupBy"].([]model.ProductGroupBy), args["filter"].(*model.ProductFilterInput)), true case "Query.users": if e.complexity.Query.Users == nil { break @@ -863,6 +1029,46 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity._PostSum.UserID(childComplexity), true + case "_ProductAvg.id": + if e.complexity._ProductAvg.ID == nil { + break + } + + return e.complexity._ProductAvg.ID(childComplexity), true + + case "_ProductMax.id": + if e.complexity._ProductMax.ID == nil { + break + } + + return e.complexity._ProductMax.ID(childComplexity), true + case "_ProductMax.name": + if e.complexity._ProductMax.Name == nil { + break + } + + return e.complexity._ProductMax.Name(childComplexity), true + + case "_ProductMin.id": + if e.complexity._ProductMin.ID == nil { + break + } + + return e.complexity._ProductMin.ID(childComplexity), true + case "_ProductMin.name": + if e.complexity._ProductMin.Name == nil { + break + } + + return e.complexity._ProductMin.Name(childComplexity), true + + case "_ProductSum.id": + if e.complexity._ProductSum.ID == nil { + break + } + + return e.complexity._ProductSum.ID(childComplexity), true + case "_UserAvg.id": if e.complexity._UserAvg.ID == nil { break @@ -922,10 +1128,17 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputDogFilterInput, ec.unmarshalInputFloatComparator, ec.unmarshalInputFloatListComparator, + ec.unmarshalInputIDComparator, ec.unmarshalInputIntComparator, ec.unmarshalInputIntListComparator, + ec.unmarshalInputMapComparator, + ec.unmarshalInputMapPathCondition, ec.unmarshalInputPostFilterInput, ec.unmarshalInputPostOrdering, + ec.unmarshalInputProductAttributesFilterInput, + ec.unmarshalInputProductDetailsFilterInput, + ec.unmarshalInputProductFilterInput, + ec.unmarshalInputProductOrdering, ec.unmarshalInputStringComparator, ec.unmarshalInputStringListComparator, ec.unmarshalInputUpdatePostInput, @@ -1028,107 +1241,339 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er } var sources = []*ast.Source{ - {Name: "../fastgql_schema.graphql", Input: `input AnimalFilterInput { - id: IntComparator - name: StringComparator - type: StringComparator - cat: CatFilterInput @isInterfaceFilter - dog: DogFilterInput @isInterfaceFilter - """ - Logical AND of FilterInput - """ - AND: [AnimalFilterInput] - """ - Logical OR of FilterInput - """ - OR: [AnimalFilterInput] - """ - Logical NOT of FilterInput - """ - NOT: AnimalFilterInput + {Name: "../schema.graphql", Input: `interface Animal @table(name: "animals") @typename(name: "type") @generateFilterInput { + id: Int! + name: String! + type: String! } -""" -Group by Animal -""" -enum AnimalGroupBy { - """ - Group by id - """ - ID - """ - Group by name - """ - NAME - """ - Group by type - """ - TYPE +type Cat implements Animal { + id: Int! + name: String! + type: String! + color: String! } -""" -Ordering for Animal -""" -input AnimalOrdering { - """ - Order Animal by id - """ - id: _OrderingTypes - """ - Order Animal by name - """ - name: _OrderingTypes - """ - Order Animal by type - """ - type: _OrderingTypes +type Category @generateFilterInput @table(name: "category") { + id: Int! + name: String } -""" -Aggregate Animal -""" -type AnimalsAggregate { - """ - Group - """ - group: Map - """ - Count results - """ - count: Int! - """ - Max Aggregate - """ - max: _AnimalMax! - """ - Min Aggregate - """ - min: _AnimalMin! - """ - Avg Aggregate - """ - avg: _AnimalAvg! - """ - Sum Aggregate - """ - sum: _AnimalSum! +type Dog implements Animal { + id: Int! + name: String! + type: String! + breed: String! } -input CatFilterInput { - id: IntComparator - name: StringComparator - type: StringComparator - color: StringComparator - """ - Logical AND of FilterInput - """ - AND: [CatFilterInput] +type Post @generateFilterInput @table(name: "post") @generateMutations { + id: Int! + name: String + categories( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Category + """ + orderBy: [CategoryOrdering], + """ + Filter categories + """ + filter: CategoryFilterInput): [Category] @relation(type: MANY_TO_MANY, fields: ["id"], references: ["id"], manyToManyTable: "posts_to_categories", manyToManyFields: ["post_id"], manyToManyReferences: ["category_id"]) + user_id: Int + user: User @relation(type: ONE_TO_ONE, fields: ["user_id"], references: ["id"]) """ - Logical OR of FilterInput + categories Aggregate """ - OR: [CatFilterInput] + _categoriesAggregate(groupBy: [CategoryGroupBy!], + """ + Filter _categoriesAggregate + """ + filter: CategoryFilterInput): [CategoriesAggregate!]! @generate(filter: true) """ - Logical NOT of FilterInput + user Aggregate """ - NOT: CatFilterInput + _userAggregate(groupBy: [UserGroupBy!], + """ + Filter _userAggregate + """ + filter: UserFilterInput): [UsersAggregate!]! @generate(filter: true) } -""" +type Product @generateFilterInput @table(name: "product") { + id: Int! + name: String! + attributes: ProductAttributes @json(column: "attributes") + metadata: Map +} +type ProductAttributes { + color: String + size: Int + details: ProductDetails +} +type ProductDetails { + manufacturer: String + model: String +} +type Query { + posts( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Post + """ + orderBy: [PostOrdering], + """ + Filter posts + """ + filter: PostFilterInput): [Post] @generate + users( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for User + """ + orderBy: [UserOrdering], + """ + Filter users + """ + filter: UserFilterInput): [User] @generate + categories( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Category + """ + orderBy: [CategoryOrdering], + """ + Filter categories + """ + filter: CategoryFilterInput): [Category] @generate + animals( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Animal + """ + orderBy: [AnimalOrdering], + """ + Filter animals + """ + filter: AnimalFilterInput): [Animal] @generate + products( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Product + """ + orderBy: [ProductOrdering], + """ + Filter products + """ + filter: ProductFilterInput): [Product] @generate + """ + posts Aggregate + """ + _postsAggregate(groupBy: [PostGroupBy!], + """ + Filter _postsAggregate + """ + filter: PostFilterInput): [PostsAggregate!]! @generate(filter: true) + """ + users Aggregate + """ + _usersAggregate(groupBy: [UserGroupBy!], + """ + Filter _usersAggregate + """ + filter: UserFilterInput): [UsersAggregate!]! @generate(filter: true) + """ + categories Aggregate + """ + _categoriesAggregate(groupBy: [CategoryGroupBy!], + """ + Filter _categoriesAggregate + """ + filter: CategoryFilterInput): [CategoriesAggregate!]! @generate(filter: true) + """ + animals Aggregate + """ + _animalsAggregate(groupBy: [AnimalGroupBy!], + """ + Filter _animalsAggregate + """ + filter: AnimalFilterInput): [AnimalsAggregate!]! @generate(filter: true) + """ + products Aggregate + """ + _productsAggregate(groupBy: [ProductGroupBy!], + """ + Filter _productsAggregate + """ + filter: ProductFilterInput): [ProductsAggregate!]! @generate(filter: true) +} +type User @table(name: "user") @generateFilterInput { + id: Int! + name: String! + posts( + """ + Limit + """ + limit: Int = 100, + """ + Offset + """ + offset: Int = 0, + """ + Ordering for Post + """ + orderBy: [PostOrdering], + """ + Filter posts + """ + filter: PostFilterInput): [Post] @relation(type: ONE_TO_MANY, fields: ["id"], references: ["user_id"]) + """ + posts Aggregate + """ + _postsAggregate(groupBy: [PostGroupBy!], + """ + Filter _postsAggregate + """ + filter: PostFilterInput): [PostsAggregate!]! @generate(filter: true) +} +`, BuiltIn: false}, + {Name: "../fastgql_schema.graphql", Input: `input AnimalFilterInput { + id: IntComparator + name: StringComparator + type: StringComparator + cat: CatFilterInput @isInterfaceFilter + dog: DogFilterInput @isInterfaceFilter + """ + Logical AND of FilterInput + """ + AND: [AnimalFilterInput] + """ + Logical OR of FilterInput + """ + OR: [AnimalFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: AnimalFilterInput +} +""" +Group by Animal +""" +enum AnimalGroupBy { + """ + Group by id + """ + ID + """ + Group by name + """ + NAME + """ + Group by type + """ + TYPE +} +""" +Ordering for Animal +""" +input AnimalOrdering { + """ + Order Animal by id + """ + id: _OrderingTypes + """ + Order Animal by name + """ + name: _OrderingTypes + """ + Order Animal by type + """ + type: _OrderingTypes +} +""" +Aggregate Animal +""" +type AnimalsAggregate { + """ + Group + """ + group: Map + """ + Count results + """ + count: Int! + """ + Max Aggregate + """ + max: _AnimalMax! + """ + Min Aggregate + """ + min: _AnimalMin! + """ + Avg Aggregate + """ + avg: _AnimalAvg! + """ + Sum Aggregate + """ + sum: _AnimalSum! +} +input CatFilterInput { + id: IntComparator + name: StringComparator + type: StringComparator + color: StringComparator + """ + Logical AND of FilterInput + """ + AND: [CatFilterInput] + """ + Logical OR of FilterInput + """ + OR: [CatFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: CatFilterInput +} +""" Aggregate Category """ type CategoriesAggregate { @@ -1338,8 +1783,128 @@ type PostsPayload { rows_affected: Int! posts: [Post] } -input UserFilterInput { - id: IntComparator +""" +Filter input for JSON type ProductAttributes +""" +input ProductAttributesFilterInput { + color: StringComparator + size: IntComparator + details: ProductDetailsFilterInput + """ + Logical AND of FilterInput + """ + AND: [ProductAttributesFilterInput] + """ + Logical OR of FilterInput + """ + OR: [ProductAttributesFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: ProductAttributesFilterInput +} +""" +Filter input for JSON type ProductDetails +""" +input ProductDetailsFilterInput { + manufacturer: StringComparator + model: StringComparator + """ + Logical AND of FilterInput + """ + AND: [ProductDetailsFilterInput] + """ + Logical OR of FilterInput + """ + OR: [ProductDetailsFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: ProductDetailsFilterInput +} +input ProductFilterInput { + id: IntComparator + name: StringComparator + attributes: ProductAttributesFilterInput + metadata: MapComparator + """ + Logical AND of FilterInput + """ + AND: [ProductFilterInput] + """ + Logical OR of FilterInput + """ + OR: [ProductFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: ProductFilterInput +} +""" +Group by Product +""" +enum ProductGroupBy { + """ + Group by id + """ + ID + """ + Group by name + """ + NAME + """ + Group by metadata + """ + METADATA +} +""" +Ordering for Product +""" +input ProductOrdering { + """ + Order Product by id + """ + id: _OrderingTypes + """ + Order Product by name + """ + name: _OrderingTypes + """ + Order Product by metadata + """ + metadata: _OrderingTypes +} +""" +Aggregate Product +""" +type ProductsAggregate { + """ + Group + """ + group: Map + """ + Count results + """ + count: Int! + """ + Max Aggregate + """ + max: _ProductMax! + """ + Min Aggregate + """ + min: _ProductMin! + """ + Avg Aggregate + """ + avg: _ProductAvg! + """ + Sum Aggregate + """ + sum: _ProductSum! +} +input UserFilterInput { + id: IntComparator name: StringComparator posts: PostFilterInput """ @@ -1569,6 +2134,50 @@ type _PostSum { """ avg Aggregate """ +type _ProductAvg { + """ + Compute the avg for id + """ + id: Float! +} +""" +max Aggregate +""" +type _ProductMax { + """ + Compute the max for id + """ + id: Int! + """ + Compute the max for name + """ + name: String! +} +""" +min Aggregate +""" +type _ProductMin { + """ + Compute the min for id + """ + id: Int! + """ + Compute the min for name + """ + name: String! +} +""" +sum Aggregate +""" +type _ProductSum { + """ + Compute the sum for id + """ + id: Float! +} +""" +avg Aggregate +""" type _UserAvg { """ Compute the avg for id @@ -1632,6 +2241,7 @@ directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering directive @generateFilterInput(description: String) on OBJECT | INTERFACE directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT directive @isInterfaceFilter on INPUT_FIELD_DEFINITION +directive @json(column: String!) on FIELD_DEFINITION directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE directive @typename(name: String!) on INTERFACE @@ -1665,6 +2275,11 @@ input FloatListComparator { overlap: [Float] isNull: Boolean } +input IDComparator { + eq: ID + neq: ID + isNull: Boolean +} input IntComparator { eq: Int neq: Int @@ -1683,6 +2298,23 @@ input IntListComparator { isNull: Boolean } scalar Map +input MapComparator { + contains: Map + where: [MapPathCondition!] + whereAny: [MapPathCondition!] + isNull: Boolean +} +input MapPathCondition { + path: String! + eq: String + neq: String + gt: Float + gte: Float + lt: Float + lte: Float + like: String + isNull: Boolean +} input StringComparator { eq: String neq: String @@ -1719,236 +2351,55 @@ enum _relationType { MANY_TO_MANY } `, BuiltIn: false}, - {Name: "../schema.graphql", Input: `interface Animal @table(name: "animals") @typename(name: "type") @generateFilterInput { - id: Int! - name: String! - type: String! } -type Cat implements Animal { - id: Int! - name: String! - type: String! - color: String! +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) dir_fastgqlField_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, "skipSelect", ec.unmarshalOBoolean2ᚖbool) + if err != nil { + return nil, err + } + args["skipSelect"] = arg0 + return args, nil } -type Category @generateFilterInput @table(name: "category") { - id: Int! - name: String + +func (ec *executionContext) dir_json_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, "column", ec.unmarshalNString2string) + if err != nil { + return nil, err + } + args["column"] = arg0 + return args, nil } -type Dog implements Animal { - id: Int! - name: String! - type: String! - breed: String! + +func (ec *executionContext) dir_typename_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 } -type Post @generateFilterInput @table(name: "post") @generateMutations { - id: Int! - name: String - categories( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Category - """ - orderBy: [CategoryOrdering], - """ - Filter categories - """ - filter: CategoryFilterInput): [Category] @relation(type: MANY_TO_MANY, fields: ["id"], references: ["id"], manyToManyTable: "posts_to_categories", manyToManyFields: ["post_id"], manyToManyReferences: ["category_id"]) - user_id: Int - user: User @relation(type: ONE_TO_ONE, fields: ["user_id"], references: ["id"]) - """ - categories Aggregate - """ - _categoriesAggregate(groupBy: [CategoryGroupBy!], - """ - Filter _categoriesAggregate - """ - filter: CategoryFilterInput): [CategoriesAggregate!]! @generate(filter: true) - """ - user Aggregate - """ - _userAggregate(groupBy: [UserGroupBy!], - """ - Filter _userAggregate - """ - filter: UserFilterInput): [UsersAggregate!]! @generate(filter: true) -} -type Query { - posts( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Post - """ - orderBy: [PostOrdering], - """ - Filter posts - """ - filter: PostFilterInput): [Post] @generate - users( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for User - """ - orderBy: [UserOrdering], - """ - Filter users - """ - filter: UserFilterInput): [User] @generate - categories( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Category - """ - orderBy: [CategoryOrdering], - """ - Filter categories - """ - filter: CategoryFilterInput): [Category] @generate - animals( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Animal - """ - orderBy: [AnimalOrdering], - """ - Filter animals - """ - filter: AnimalFilterInput): [Animal] @generate - """ - posts Aggregate - """ - _postsAggregate(groupBy: [PostGroupBy!], - """ - Filter _postsAggregate - """ - filter: PostFilterInput): [PostsAggregate!]! @generate(filter: true) - """ - users Aggregate - """ - _usersAggregate(groupBy: [UserGroupBy!], - """ - Filter _usersAggregate - """ - filter: UserFilterInput): [UsersAggregate!]! @generate(filter: true) - """ - categories Aggregate - """ - _categoriesAggregate(groupBy: [CategoryGroupBy!], - """ - Filter _categoriesAggregate - """ - filter: CategoryFilterInput): [CategoriesAggregate!]! @generate(filter: true) - """ - animals Aggregate - """ - _animalsAggregate(groupBy: [AnimalGroupBy!], - """ - Filter _animalsAggregate - """ - filter: AnimalFilterInput): [AnimalsAggregate!]! @generate(filter: true) -} -type User @table(name: "user") @generateFilterInput { - id: Int! - name: String! - posts( - """ - Limit - """ - limit: Int = 100, - """ - Offset - """ - offset: Int = 0, - """ - Ordering for Post - """ - orderBy: [PostOrdering], - """ - Filter posts - """ - filter: PostFilterInput): [Post] @relation(type: ONE_TO_MANY, fields: ["id"], references: ["user_id"]) - """ - posts Aggregate - """ - _postsAggregate(groupBy: [PostGroupBy!], - """ - Filter _postsAggregate - """ - filter: PostFilterInput): [PostsAggregate!]! @generate(filter: true) -} -`, BuiltIn: false}, -} -var parsedSchema = gqlparser.MustLoadSchema(sources...) - -// endregion ************************** generated!.gotpl ************************** - -// region ***************************** args.gotpl ***************************** - -func (ec *executionContext) dir_fastgqlField_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, "skipSelect", ec.unmarshalOBoolean2ᚖbool) - if err != nil { - return nil, err - } - args["skipSelect"] = arg0 - return args, nil -} - -func (ec *executionContext) dir_typename_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_Mutation_createPosts_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, "inputs", ec.unmarshalNCreatePostInput2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCreatePostInputᚄ) - if err != nil { - return nil, err - } - args["inputs"] = arg0 - return args, nil + +func (ec *executionContext) field_Mutation_createPosts_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, "inputs", ec.unmarshalNCreatePostInput2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCreatePostInputᚄ) + if err != nil { + return nil, err + } + args["inputs"] = arg0 + return args, nil } func (ec *executionContext) field_Mutation_deletePosts_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { @@ -2100,6 +2551,22 @@ func (ec *executionContext) field_Query__postsAggregate_args(ctx context.Context return args, nil } +func (ec *executionContext) field_Query__productsAggregate_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, "groupBy", ec.unmarshalOProductGroupBy2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductGroupByᚄ) + if err != nil { + return nil, err + } + args["groupBy"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "filter", ec.unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductFilterInput) + if err != nil { + return nil, err + } + args["filter"] = arg1 + return args, nil +} + func (ec *executionContext) field_Query__usersAggregate_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -2194,6 +2661,32 @@ func (ec *executionContext) field_Query_posts_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Query_products_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, "limit", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["limit"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "offset", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["offset"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOProductOrdering2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductOrdering) + if err != nil { + return nil, err + } + args["orderBy"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "filter", ec.unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductFilterInput) + if err != nil { + return nil, err + } + args["filter"] = arg3 + return args, nil +} + func (ec *executionContext) field_Query_users_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -3693,538 +4186,336 @@ func (ec *executionContext) fieldContext_PostsPayload_posts(_ context.Context, f return fc, nil } -func (ec *executionContext) _Query_posts(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Product_id(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_posts, + ec.fieldContext_Product_id, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Posts(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.PostOrdering), fc.Args["filter"].(*model.PostFilterInput)) + return obj.ID, nil }, nil, - ec.marshalOPost2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPost, + ec.marshalNInt2int, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Query_posts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Product_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Product", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Post_id(ctx, field) - case "name": - return ec.fieldContext_Post_name(ctx, field) - case "categories": - return ec.fieldContext_Post_categories(ctx, field) - case "user_id": - return ec.fieldContext_Post_user_id(ctx, field) - case "user": - return ec.fieldContext_Post_user(ctx, field) - case "_categoriesAggregate": - return ec.fieldContext_Post__categoriesAggregate(ctx, field) - case "_userAggregate": - return ec.fieldContext_Post__userAggregate(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Post", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } - 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_posts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_users(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Product_name(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_users, + ec.fieldContext_Product_name, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Users(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.UserOrdering), fc.Args["filter"].(*model.UserFilterInput)) + return obj.Name, nil }, nil, - ec.marshalOUser2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUser, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext_Query_users(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Product_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Product", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_User_id(ctx, field) - case "name": - return ec.fieldContext_User_name(ctx, field) - case "posts": - return ec.fieldContext_User_posts(ctx, field) - case "_postsAggregate": - return ec.fieldContext_User__postsAggregate(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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_users_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_categories(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Product_attributes(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_categories, + ec.fieldContext_Product_attributes, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Categories(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.CategoryOrdering), fc.Args["filter"].(*model.CategoryFilterInput)) + return obj.Attributes, nil }, - nil, - ec.marshalOCategory2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategory, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + column, err := ec.unmarshalNString2string(ctx, "attributes") + if err != nil { + var zeroVal *model.ProductAttributes + return zeroVal, err + } + if ec.directives.Json == nil { + var zeroVal *model.ProductAttributes + return zeroVal, errors.New("directive json is not implemented") + } + return ec.directives.Json(ctx, obj, directive0, column) + } + + next = directive1 + return next + }, + ec.marshalOProductAttributes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAttributes, true, false, ) } -func (ec *executionContext) fieldContext_Query_categories(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Product_attributes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Product", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Category_id(ctx, field) - case "name": - return ec.fieldContext_Category_name(ctx, field) + case "color": + return ec.fieldContext_ProductAttributes_color(ctx, field) + case "size": + return ec.fieldContext_ProductAttributes_size(ctx, field) + case "details": + return ec.fieldContext_ProductAttributes_details(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Category", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ProductAttributes", 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_categories_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_animals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Product_metadata(ctx context.Context, field graphql.CollectedField, obj *model.Product) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query_animals, + ec.fieldContext_Product_metadata, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().Animals(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.AnimalOrdering), fc.Args["filter"].(*model.AnimalFilterInput)) + return obj.Metadata, nil }, nil, - ec.marshalOAnimal2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimal, + ec.marshalOMap2map, true, false, ) } -func (ec *executionContext) fieldContext_Query_animals(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Product_metadata(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Product", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + return nil, errors.New("field of type Map does not have child fields") }, } - 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_animals_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query__postsAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _ProductAttributes_color(ctx context.Context, field graphql.CollectedField, obj *model.ProductAttributes) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query__postsAggregate, + ec.fieldContext_ProductAttributes_color, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().PostsAggregate(ctx, fc.Args["groupBy"].([]model.PostGroupBy), fc.Args["filter"].(*model.PostFilterInput)) + return obj.Color, nil }, nil, - ec.marshalNPostsAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostsAggregateᚄ, - true, + ec.marshalOString2ᚖstring, true, + false, ) } -func (ec *executionContext) fieldContext_Query__postsAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductAttributes_color(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "ProductAttributes", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "group": - return ec.fieldContext_PostsAggregate_group(ctx, field) - case "count": - return ec.fieldContext_PostsAggregate_count(ctx, field) - case "max": - return ec.fieldContext_PostsAggregate_max(ctx, field) - case "min": - return ec.fieldContext_PostsAggregate_min(ctx, field) - case "avg": - return ec.fieldContext_PostsAggregate_avg(ctx, field) - case "sum": - return ec.fieldContext_PostsAggregate_sum(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type PostsAggregate", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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__postsAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query__usersAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _ProductAttributes_size(ctx context.Context, field graphql.CollectedField, obj *model.ProductAttributes) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query__usersAggregate, + ec.fieldContext_ProductAttributes_size, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().UsersAggregate(ctx, fc.Args["groupBy"].([]model.UserGroupBy), fc.Args["filter"].(*model.UserFilterInput)) + return obj.Size, nil }, nil, - ec.marshalNUsersAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUsersAggregateᚄ, - true, + ec.marshalOInt2ᚖint, true, + false, ) } -func (ec *executionContext) fieldContext_Query__usersAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductAttributes_size(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "ProductAttributes", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "group": - return ec.fieldContext_UsersAggregate_group(ctx, field) - case "count": - return ec.fieldContext_UsersAggregate_count(ctx, field) - case "max": - return ec.fieldContext_UsersAggregate_max(ctx, field) - case "min": - return ec.fieldContext_UsersAggregate_min(ctx, field) - case "avg": - return ec.fieldContext_UsersAggregate_avg(ctx, field) - case "sum": - return ec.fieldContext_UsersAggregate_sum(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type UsersAggregate", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } - 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__usersAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query__categoriesAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _ProductAttributes_details(ctx context.Context, field graphql.CollectedField, obj *model.ProductAttributes) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query__categoriesAggregate, + ec.fieldContext_ProductAttributes_details, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().CategoriesAggregate(ctx, fc.Args["groupBy"].([]model.CategoryGroupBy), fc.Args["filter"].(*model.CategoryFilterInput)) + return obj.Details, nil }, nil, - ec.marshalNCategoriesAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoriesAggregateᚄ, - true, + ec.marshalOProductDetails2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductDetails, true, + false, ) } -func (ec *executionContext) fieldContext_Query__categoriesAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductAttributes_details(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "ProductAttributes", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "group": - return ec.fieldContext_CategoriesAggregate_group(ctx, field) - case "count": - return ec.fieldContext_CategoriesAggregate_count(ctx, field) - case "max": - return ec.fieldContext_CategoriesAggregate_max(ctx, field) - case "min": - return ec.fieldContext_CategoriesAggregate_min(ctx, field) - case "avg": - return ec.fieldContext_CategoriesAggregate_avg(ctx, field) - case "sum": - return ec.fieldContext_CategoriesAggregate_sum(ctx, field) + case "manufacturer": + return ec.fieldContext_ProductDetails_manufacturer(ctx, field) + case "model": + return ec.fieldContext_ProductDetails_model(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type CategoriesAggregate", field.Name) + return nil, fmt.Errorf("no field named %q was found under type ProductDetails", 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__categoriesAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query__animalsAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _ProductDetails_manufacturer(ctx context.Context, field graphql.CollectedField, obj *model.ProductDetails) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query__animalsAggregate, + ec.fieldContext_ProductDetails_manufacturer, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.resolvers.Query().AnimalsAggregate(ctx, fc.Args["groupBy"].([]model.AnimalGroupBy), fc.Args["filter"].(*model.AnimalFilterInput)) + return obj.Manufacturer, nil }, nil, - ec.marshalNAnimalsAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimalsAggregateᚄ, - true, + ec.marshalOString2ᚖstring, true, + false, ) } -func (ec *executionContext) fieldContext_Query__animalsAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductDetails_manufacturer(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "ProductDetails", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "group": - return ec.fieldContext_AnimalsAggregate_group(ctx, field) - case "count": - return ec.fieldContext_AnimalsAggregate_count(ctx, field) - case "max": - return ec.fieldContext_AnimalsAggregate_max(ctx, field) - case "min": - return ec.fieldContext_AnimalsAggregate_min(ctx, field) - case "avg": - return ec.fieldContext_AnimalsAggregate_avg(ctx, field) - case "sum": - return ec.fieldContext_AnimalsAggregate_sum(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type AnimalsAggregate", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - 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__animalsAggregate_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) { +func (ec *executionContext) _ProductDetails_model(ctx context.Context, field graphql.CollectedField, obj *model.ProductDetails) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query___type, + ec.fieldContext_ProductDetails_model, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return ec.introspectType(fc.Args["name"].(string)) + return obj.Model, nil }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + ec.marshalOString2ᚖstring, true, false, ) } -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductDetails_model(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "ProductDetails", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type String does not have child fields") }, } - 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) { +func (ec *executionContext) _ProductsAggregate_group(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_Query___schema, + ec.fieldContext_ProductsAggregate_group, func(ctx context.Context) (any, error) { - return ec.introspectSchema() + return obj.Group, nil }, nil, - ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema, + ec.marshalOMap2map, true, false, ) } -func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductsAggregate_group(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "ProductsAggregate", Field: field, - IsMethod: true, + IsMethod: false, 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 nil, errors.New("field of type Map does not have child fields") }, } return fc, nil } -func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { +func (ec *executionContext) _ProductsAggregate_count(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_id, + ec.fieldContext_ProductsAggregate_count, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Count, nil }, nil, ec.marshalNInt2int, @@ -4233,9 +4524,9 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte ) } -func (ec *executionContext) fieldContext_User_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductsAggregate_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "ProductsAggregate", Field: field, IsMethod: false, IsResolver: false, @@ -4246,695 +4537,977 @@ func (ec *executionContext) fieldContext_User_id(_ context.Context, field graphq return fc, nil } -func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { +func (ec *executionContext) _ProductsAggregate_max(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_name, + ec.fieldContext_ProductsAggregate_max, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.Max, nil }, nil, - ec.marshalNString2string, + ec.marshalN_ProductMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductMax, true, true, ) } -func (ec *executionContext) fieldContext_User_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductsAggregate_max(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "ProductsAggregate", 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") + switch field.Name { + case "id": + return ec.fieldContext__ProductMax_id(ctx, field) + case "name": + return ec.fieldContext__ProductMax_name(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _ProductMax", field.Name) }, } return fc, nil } -func (ec *executionContext) _User_posts(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { +func (ec *executionContext) _ProductsAggregate_min(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User_posts, + ec.fieldContext_ProductsAggregate_min, func(ctx context.Context) (any, error) { - return obj.Posts, nil + return obj.Min, nil }, nil, - ec.marshalOPost2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPost, + ec.marshalN_ProductMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductMin, + true, true, - false, ) } -func (ec *executionContext) fieldContext_User_posts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductsAggregate_min(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "ProductsAggregate", 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_Post_id(ctx, field) + return ec.fieldContext__ProductMin_id(ctx, field) case "name": - return ec.fieldContext_Post_name(ctx, field) - case "categories": - return ec.fieldContext_Post_categories(ctx, field) - case "user_id": - return ec.fieldContext_Post_user_id(ctx, field) - case "user": - return ec.fieldContext_Post_user(ctx, field) - case "_categoriesAggregate": - return ec.fieldContext_Post__categoriesAggregate(ctx, field) - case "_userAggregate": - return ec.fieldContext_Post__userAggregate(ctx, field) + return ec.fieldContext__ProductMin_name(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Post", field.Name) + return nil, fmt.Errorf("no field named %q was found under type _ProductMin", 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_User_posts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _User__postsAggregate(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { +func (ec *executionContext) _ProductsAggregate_avg(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_User__postsAggregate, + ec.fieldContext_ProductsAggregate_avg, func(ctx context.Context) (any, error) { - return obj.PostsAggregate, nil + return obj.Avg, nil }, nil, - ec.marshalNPostsAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostsAggregateᚄ, + ec.marshalN_ProductAvg2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAvg, true, true, ) } -func (ec *executionContext) fieldContext_User__postsAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductsAggregate_avg(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "User", + Object: "ProductsAggregate", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "group": - return ec.fieldContext_PostsAggregate_group(ctx, field) - case "count": - return ec.fieldContext_PostsAggregate_count(ctx, field) - case "max": - return ec.fieldContext_PostsAggregate_max(ctx, field) - case "min": - return ec.fieldContext_PostsAggregate_min(ctx, field) - case "avg": - return ec.fieldContext_PostsAggregate_avg(ctx, field) - case "sum": - return ec.fieldContext_PostsAggregate_sum(ctx, field) + case "id": + return ec.fieldContext__ProductAvg_id(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type PostsAggregate", field.Name) + return nil, fmt.Errorf("no field named %q was found under type _ProductAvg", 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_User__postsAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _UsersAggregate_group(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { +func (ec *executionContext) _ProductsAggregate_sum(ctx context.Context, field graphql.CollectedField, obj *model.ProductsAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UsersAggregate_group, + ec.fieldContext_ProductsAggregate_sum, func(ctx context.Context) (any, error) { - return obj.Group, nil + return obj.Sum, nil }, nil, - ec.marshalOMap2map, + ec.marshalN_ProductSum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductSum, + true, true, - false, ) } -func (ec *executionContext) fieldContext_UsersAggregate_group(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ProductsAggregate_sum(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UsersAggregate", + Object: "ProductsAggregate", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Map does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext__ProductSum_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _ProductSum", field.Name) }, } return fc, nil } -func (ec *executionContext) _UsersAggregate_count(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_posts(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UsersAggregate_count, + ec.fieldContext_Query_posts, func(ctx context.Context) (any, error) { - return obj.Count, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Posts(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.PostOrdering), fc.Args["filter"].(*model.PostFilterInput)) }, nil, - ec.marshalNInt2int, - true, + ec.marshalOPost2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPost, true, + false, ) } -func (ec *executionContext) fieldContext_UsersAggregate_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_posts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UsersAggregate", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Post_id(ctx, field) + case "name": + return ec.fieldContext_Post_name(ctx, field) + case "categories": + return ec.fieldContext_Post_categories(ctx, field) + case "user_id": + return ec.fieldContext_Post_user_id(ctx, field) + case "user": + return ec.fieldContext_Post_user(ctx, field) + case "_categoriesAggregate": + return ec.fieldContext_Post__categoriesAggregate(ctx, field) + case "_userAggregate": + return ec.fieldContext_Post__userAggregate(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Post", 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_posts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _UsersAggregate_max(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_users(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UsersAggregate_max, + ec.fieldContext_Query_users, func(ctx context.Context) (any, error) { - return obj.Max, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Users(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.UserOrdering), fc.Args["filter"].(*model.UserFilterInput)) }, nil, - ec.marshalN_UserMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserMax, - true, + ec.marshalOUser2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUser, true, + false, ) } -func (ec *executionContext) fieldContext_UsersAggregate_max(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_users(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UsersAggregate", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext__UserMax_id(ctx, field) + return ec.fieldContext_User_id(ctx, field) case "name": - return ec.fieldContext__UserMax_name(ctx, field) + return ec.fieldContext_User_name(ctx, field) + case "posts": + return ec.fieldContext_User_posts(ctx, field) + case "_postsAggregate": + return ec.fieldContext_User__postsAggregate(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type _UserMax", field.Name) + return nil, fmt.Errorf("no field named %q was found under type User", 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_users_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _UsersAggregate_min(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_categories(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UsersAggregate_min, + ec.fieldContext_Query_categories, func(ctx context.Context) (any, error) { - return obj.Min, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Categories(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.CategoryOrdering), fc.Args["filter"].(*model.CategoryFilterInput)) }, nil, - ec.marshalN_UserMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserMin, - true, + ec.marshalOCategory2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategory, true, + false, ) } -func (ec *executionContext) fieldContext_UsersAggregate_min(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_categories(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UsersAggregate", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext__UserMin_id(ctx, field) + return ec.fieldContext_Category_id(ctx, field) case "name": - return ec.fieldContext__UserMin_name(ctx, field) + return ec.fieldContext_Category_name(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type _UserMin", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Category", 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_categories_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _UsersAggregate_avg(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_animals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UsersAggregate_avg, + ec.fieldContext_Query_animals, func(ctx context.Context) (any, error) { - return obj.Avg, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Animals(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.AnimalOrdering), fc.Args["filter"].(*model.AnimalFilterInput)) }, nil, - ec.marshalN_UserAvg2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserAvg, - true, + ec.marshalOAnimal2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimal, true, + false, ) } -func (ec *executionContext) fieldContext_UsersAggregate_avg(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_animals(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UsersAggregate", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext__UserAvg_id(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type _UserAvg", field.Name) + 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_animals_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) _UsersAggregate_sum(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_products(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext_UsersAggregate_sum, + ec.fieldContext_Query_products, func(ctx context.Context) (any, error) { - return obj.Sum, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().Products(ctx, fc.Args["limit"].(*int), fc.Args["offset"].(*int), fc.Args["orderBy"].([]*model.ProductOrdering), fc.Args["filter"].(*model.ProductFilterInput)) }, nil, - ec.marshalN_UserSum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserSum, - true, + ec.marshalOProduct2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProduct, true, + false, ) } -func (ec *executionContext) fieldContext_UsersAggregate_sum(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_products(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "UsersAggregate", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext__UserSum_id(ctx, field) + return ec.fieldContext_Product_id(ctx, field) + case "name": + return ec.fieldContext_Product_name(ctx, field) + case "attributes": + return ec.fieldContext_Product_attributes(ctx, field) + case "metadata": + return ec.fieldContext_Product_metadata(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type _UserSum", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Product", 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_products_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) __AggregateResult_count(ctx context.Context, field graphql.CollectedField, obj *model.AggregateResult) (ret graphql.Marshaler) { +func (ec *executionContext) _Query__postsAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__AggregateResult_count, + ec.fieldContext_Query__postsAggregate, func(ctx context.Context) (any, error) { - return obj.Count, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().PostsAggregate(ctx, fc.Args["groupBy"].([]model.PostGroupBy), fc.Args["filter"].(*model.PostFilterInput)) }, nil, - ec.marshalNInt2int, + ec.marshalNPostsAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostsAggregateᚄ, true, true, ) } -func (ec *executionContext) fieldContext__AggregateResult_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query__postsAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_AggregateResult", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "group": + return ec.fieldContext_PostsAggregate_group(ctx, field) + case "count": + return ec.fieldContext_PostsAggregate_count(ctx, field) + case "max": + return ec.fieldContext_PostsAggregate_max(ctx, field) + case "min": + return ec.fieldContext_PostsAggregate_min(ctx, field) + case "avg": + return ec.fieldContext_PostsAggregate_avg(ctx, field) + case "sum": + return ec.fieldContext_PostsAggregate_sum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PostsAggregate", 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__postsAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) __AnimalAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.AnimalAvg) (ret graphql.Marshaler) { +func (ec *executionContext) _Query__usersAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__AnimalAvg_id, + ec.fieldContext_Query__usersAggregate, func(ctx context.Context) (any, error) { - return obj.ID, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().UsersAggregate(ctx, fc.Args["groupBy"].([]model.UserGroupBy), fc.Args["filter"].(*model.UserFilterInput)) }, nil, - ec.marshalNFloat2float64, + ec.marshalNUsersAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUsersAggregateᚄ, true, true, ) } -func (ec *executionContext) fieldContext__AnimalAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query__usersAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_AnimalAvg", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Float does not have child fields") + switch field.Name { + case "group": + return ec.fieldContext_UsersAggregate_group(ctx, field) + case "count": + return ec.fieldContext_UsersAggregate_count(ctx, field) + case "max": + return ec.fieldContext_UsersAggregate_max(ctx, field) + case "min": + return ec.fieldContext_UsersAggregate_min(ctx, field) + case "avg": + return ec.fieldContext_UsersAggregate_avg(ctx, field) + case "sum": + return ec.fieldContext_UsersAggregate_sum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UsersAggregate", 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__usersAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) __AnimalMax_id(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMax) (ret graphql.Marshaler) { +func (ec *executionContext) _Query__categoriesAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__AnimalMax_id, + ec.fieldContext_Query__categoriesAggregate, func(ctx context.Context) (any, error) { - return obj.ID, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().CategoriesAggregate(ctx, fc.Args["groupBy"].([]model.CategoryGroupBy), fc.Args["filter"].(*model.CategoryFilterInput)) }, nil, - ec.marshalNInt2int, + ec.marshalNCategoriesAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoriesAggregateᚄ, true, true, ) } -func (ec *executionContext) fieldContext__AnimalMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query__categoriesAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_AnimalMax", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + switch field.Name { + case "group": + return ec.fieldContext_CategoriesAggregate_group(ctx, field) + case "count": + return ec.fieldContext_CategoriesAggregate_count(ctx, field) + case "max": + return ec.fieldContext_CategoriesAggregate_max(ctx, field) + case "min": + return ec.fieldContext_CategoriesAggregate_min(ctx, field) + case "avg": + return ec.fieldContext_CategoriesAggregate_avg(ctx, field) + case "sum": + return ec.fieldContext_CategoriesAggregate_sum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CategoriesAggregate", 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__categoriesAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) __AnimalMax_name(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMax) (ret graphql.Marshaler) { +func (ec *executionContext) _Query__animalsAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__AnimalMax_name, + ec.fieldContext_Query__animalsAggregate, func(ctx context.Context) (any, error) { - return obj.Name, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().AnimalsAggregate(ctx, fc.Args["groupBy"].([]model.AnimalGroupBy), fc.Args["filter"].(*model.AnimalFilterInput)) }, nil, - ec.marshalNString2string, + ec.marshalNAnimalsAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimalsAggregateᚄ, true, true, ) } -func (ec *executionContext) fieldContext__AnimalMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query__animalsAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_AnimalMax", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "group": + return ec.fieldContext_AnimalsAggregate_group(ctx, field) + case "count": + return ec.fieldContext_AnimalsAggregate_count(ctx, field) + case "max": + return ec.fieldContext_AnimalsAggregate_max(ctx, field) + case "min": + return ec.fieldContext_AnimalsAggregate_min(ctx, field) + case "avg": + return ec.fieldContext_AnimalsAggregate_avg(ctx, field) + case "sum": + return ec.fieldContext_AnimalsAggregate_sum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AnimalsAggregate", 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__animalsAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) __AnimalMax_type(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMax) (ret graphql.Marshaler) { +func (ec *executionContext) _Query__productsAggregate(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__AnimalMax_type, + ec.fieldContext_Query__productsAggregate, func(ctx context.Context) (any, error) { - return obj.Type, nil + fc := graphql.GetFieldContext(ctx) + return ec.resolvers.Query().ProductsAggregate(ctx, fc.Args["groupBy"].([]model.ProductGroupBy), fc.Args["filter"].(*model.ProductFilterInput)) }, nil, - ec.marshalNString2string, + ec.marshalNProductsAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductsAggregateᚄ, true, true, ) } -func (ec *executionContext) fieldContext__AnimalMax_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query__productsAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_AnimalMax", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "group": + return ec.fieldContext_ProductsAggregate_group(ctx, field) + case "count": + return ec.fieldContext_ProductsAggregate_count(ctx, field) + case "max": + return ec.fieldContext_ProductsAggregate_max(ctx, field) + case "min": + return ec.fieldContext_ProductsAggregate_min(ctx, field) + case "avg": + return ec.fieldContext_ProductsAggregate_avg(ctx, field) + case "sum": + return ec.fieldContext_ProductsAggregate_sum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ProductsAggregate", 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__productsAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) __AnimalMin_id(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMin) (ret graphql.Marshaler) { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__AnimalMin_id, + ec.fieldContext_Query___type, func(ctx context.Context) (any, error) { - return obj.ID, nil + fc := graphql.GetFieldContext(ctx) + return ec.introspectType(fc.Args["name"].(string)) }, nil, - ec.marshalNInt2int, - true, + ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, true, + false, ) } -func (ec *executionContext) fieldContext__AnimalMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_AnimalMin", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, 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") + 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) __AnimalMin_name(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMin) (ret graphql.Marshaler) { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__AnimalMin_name, + ec.fieldContext_Query___schema, func(ctx context.Context) (any, error) { - return obj.Name, nil + return ec.introspectSchema() }, nil, - ec.marshalNString2string, - true, + ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema, true, + false, ) } -func (ec *executionContext) fieldContext__AnimalMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_AnimalMin", + Object: "Query", Field: field, - IsMethod: false, + 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") + 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) __AnimalMin_type(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMin) (ret graphql.Marshaler) { +func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__AnimalMin_type, + ec.fieldContext_User_id, func(ctx context.Context) (any, error) { - return obj.Type, nil + return obj.ID, nil }, nil, - ec.marshalNString2string, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext__AnimalMin_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_AnimalMin", + Object: "User", 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 nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) __AnimalSum_id(ctx context.Context, field graphql.CollectedField, obj *model.AnimalSum) (ret graphql.Marshaler) { +func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__AnimalSum_id, + ec.fieldContext_User_name, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Name, nil }, nil, - ec.marshalNFloat2float64, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext__AnimalSum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_AnimalSum", + Object: "User", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Float does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) __CategoryAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.CategoryAvg) (ret graphql.Marshaler) { +func (ec *executionContext) _User_posts(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__CategoryAvg_id, + ec.fieldContext_User_posts, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Posts, nil }, nil, - ec.marshalNFloat2float64, - true, + ec.marshalOPost2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPost, true, + false, ) } -func (ec *executionContext) fieldContext__CategoryAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_posts(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_CategoryAvg", + Object: "User", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Float does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext_Post_id(ctx, field) + case "name": + return ec.fieldContext_Post_name(ctx, field) + case "categories": + return ec.fieldContext_Post_categories(ctx, field) + case "user_id": + return ec.fieldContext_Post_user_id(ctx, field) + case "user": + return ec.fieldContext_Post_user(ctx, field) + case "_categoriesAggregate": + return ec.fieldContext_Post__categoriesAggregate(ctx, field) + case "_userAggregate": + return ec.fieldContext_Post__userAggregate(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Post", 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_User_posts_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) __CategoryMax_id(ctx context.Context, field graphql.CollectedField, obj *model.CategoryMax) (ret graphql.Marshaler) { +func (ec *executionContext) _User__postsAggregate(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__CategoryMax_id, + ec.fieldContext_User__postsAggregate, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.PostsAggregate, nil }, nil, - ec.marshalNInt2int, + ec.marshalNPostsAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostsAggregateᚄ, true, true, ) } -func (ec *executionContext) fieldContext__CategoryMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User__postsAggregate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_CategoryMax", + Object: "User", 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") + switch field.Name { + case "group": + return ec.fieldContext_PostsAggregate_group(ctx, field) + case "count": + return ec.fieldContext_PostsAggregate_count(ctx, field) + case "max": + return ec.fieldContext_PostsAggregate_max(ctx, field) + case "min": + return ec.fieldContext_PostsAggregate_min(ctx, field) + case "avg": + return ec.fieldContext_PostsAggregate_avg(ctx, field) + case "sum": + return ec.fieldContext_PostsAggregate_sum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PostsAggregate", 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_User__postsAggregate_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) __CategoryMax_name(ctx context.Context, field graphql.CollectedField, obj *model.CategoryMax) (ret graphql.Marshaler) { +func (ec *executionContext) _UsersAggregate_group(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__CategoryMax_name, + ec.fieldContext_UsersAggregate_group, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.Group, nil }, nil, - ec.marshalNString2string, - true, + ec.marshalOMap2map, true, + false, ) } -func (ec *executionContext) fieldContext__CategoryMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UsersAggregate_group(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_CategoryMax", + Object: "UsersAggregate", 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 nil, errors.New("field of type Map does not have child fields") }, } return fc, nil } -func (ec *executionContext) __CategoryMin_id(ctx context.Context, field graphql.CollectedField, obj *model.CategoryMin) (ret graphql.Marshaler) { +func (ec *executionContext) _UsersAggregate_count(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__CategoryMin_id, + ec.fieldContext_UsersAggregate_count, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Count, nil }, nil, ec.marshalNInt2int, @@ -4943,9 +5516,9 @@ func (ec *executionContext) __CategoryMin_id(ctx context.Context, field graphql. ) } -func (ec *executionContext) fieldContext__CategoryMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UsersAggregate_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_CategoryMin", + Object: "UsersAggregate", Field: field, IsMethod: false, IsResolver: false, @@ -4956,130 +5529,150 @@ func (ec *executionContext) fieldContext__CategoryMin_id(_ context.Context, fiel return fc, nil } -func (ec *executionContext) __CategoryMin_name(ctx context.Context, field graphql.CollectedField, obj *model.CategoryMin) (ret graphql.Marshaler) { +func (ec *executionContext) _UsersAggregate_max(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__CategoryMin_name, + ec.fieldContext_UsersAggregate_max, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.Max, nil }, nil, - ec.marshalNString2string, + ec.marshalN_UserMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserMax, true, true, ) } -func (ec *executionContext) fieldContext__CategoryMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UsersAggregate_max(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_CategoryMin", + Object: "UsersAggregate", 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") + switch field.Name { + case "id": + return ec.fieldContext__UserMax_id(ctx, field) + case "name": + return ec.fieldContext__UserMax_name(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _UserMax", field.Name) }, } return fc, nil } -func (ec *executionContext) __CategorySum_id(ctx context.Context, field graphql.CollectedField, obj *model.CategorySum) (ret graphql.Marshaler) { +func (ec *executionContext) _UsersAggregate_min(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__CategorySum_id, + ec.fieldContext_UsersAggregate_min, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Min, nil }, nil, - ec.marshalNFloat2float64, + ec.marshalN_UserMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserMin, true, true, ) } -func (ec *executionContext) fieldContext__CategorySum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UsersAggregate_min(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_CategorySum", + Object: "UsersAggregate", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Float does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext__UserMin_id(ctx, field) + case "name": + return ec.fieldContext__UserMin_name(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _UserMin", field.Name) }, } return fc, nil } -func (ec *executionContext) __PostAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.PostAvg) (ret graphql.Marshaler) { +func (ec *executionContext) _UsersAggregate_avg(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostAvg_id, + ec.fieldContext_UsersAggregate_avg, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Avg, nil }, nil, - ec.marshalNFloat2float64, + ec.marshalN_UserAvg2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserAvg, true, true, ) } -func (ec *executionContext) fieldContext__PostAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UsersAggregate_avg(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostAvg", + Object: "UsersAggregate", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Float does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext__UserAvg_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _UserAvg", field.Name) }, } return fc, nil } -func (ec *executionContext) __PostAvg_user_id(ctx context.Context, field graphql.CollectedField, obj *model.PostAvg) (ret graphql.Marshaler) { +func (ec *executionContext) _UsersAggregate_sum(ctx context.Context, field graphql.CollectedField, obj *model.UsersAggregate) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostAvg_user_id, + ec.fieldContext_UsersAggregate_sum, func(ctx context.Context) (any, error) { - return obj.UserID, nil + return obj.Sum, nil }, nil, - ec.marshalNFloat2float64, + ec.marshalN_UserSum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserSum, true, true, ) } -func (ec *executionContext) fieldContext__PostAvg_user_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UsersAggregate_sum(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostAvg", + Object: "UsersAggregate", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Float does not have child fields") + switch field.Name { + case "id": + return ec.fieldContext__UserSum_id(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type _UserSum", field.Name) }, } return fc, nil } -func (ec *executionContext) __PostMax_id(ctx context.Context, field graphql.CollectedField, obj *model.PostMax) (ret graphql.Marshaler) { +func (ec *executionContext) __AggregateResult_count(ctx context.Context, field graphql.CollectedField, obj *model.AggregateResult) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostMax_id, + ec.fieldContext__AggregateResult_count, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Count, nil }, nil, ec.marshalNInt2int, @@ -5088,9 +5681,9 @@ func (ec *executionContext) __PostMax_id(ctx context.Context, field graphql.Coll ) } -func (ec *executionContext) fieldContext__PostMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__AggregateResult_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostMax", + Object: "_AggregateResult", Field: field, IsMethod: false, IsResolver: false, @@ -5101,43 +5694,43 @@ func (ec *executionContext) fieldContext__PostMax_id(_ context.Context, field gr return fc, nil } -func (ec *executionContext) __PostMax_name(ctx context.Context, field graphql.CollectedField, obj *model.PostMax) (ret graphql.Marshaler) { +func (ec *executionContext) __AnimalAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.AnimalAvg) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostMax_name, + ec.fieldContext__AnimalAvg_id, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.ID, nil }, nil, - ec.marshalNString2string, + ec.marshalNFloat2float64, true, true, ) } -func (ec *executionContext) fieldContext__PostMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__AnimalAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostMax", + Object: "_AnimalAvg", 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 nil, errors.New("field of type Float does not have child fields") }, } return fc, nil } -func (ec *executionContext) __PostMax_user_id(ctx context.Context, field graphql.CollectedField, obj *model.PostMax) (ret graphql.Marshaler) { +func (ec *executionContext) __AnimalMax_id(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostMax_user_id, + ec.fieldContext__AnimalMax_id, func(ctx context.Context) (any, error) { - return obj.UserID, nil + return obj.ID, nil }, nil, ec.marshalNInt2int, @@ -5146,9 +5739,9 @@ func (ec *executionContext) __PostMax_user_id(ctx context.Context, field graphql ) } -func (ec *executionContext) fieldContext__PostMax_user_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__AnimalMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostMax", + Object: "_AnimalMax", Field: field, IsMethod: false, IsResolver: false, @@ -5159,43 +5752,43 @@ func (ec *executionContext) fieldContext__PostMax_user_id(_ context.Context, fie return fc, nil } -func (ec *executionContext) __PostMin_id(ctx context.Context, field graphql.CollectedField, obj *model.PostMin) (ret graphql.Marshaler) { +func (ec *executionContext) __AnimalMax_name(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostMin_id, + ec.fieldContext__AnimalMax_name, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Name, nil }, nil, - ec.marshalNInt2int, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext__PostMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__AnimalMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostMin", + Object: "_AnimalMax", 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) __PostMin_name(ctx context.Context, field graphql.CollectedField, obj *model.PostMin) (ret graphql.Marshaler) { +func (ec *executionContext) __AnimalMax_type(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostMin_name, + ec.fieldContext__AnimalMax_type, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.Type, nil }, nil, ec.marshalNString2string, @@ -5204,9 +5797,9 @@ func (ec *executionContext) __PostMin_name(ctx context.Context, field graphql.Co ) } -func (ec *executionContext) fieldContext__PostMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__AnimalMax_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostMin", + Object: "_AnimalMax", Field: field, IsMethod: false, IsResolver: false, @@ -5217,14 +5810,14 @@ func (ec *executionContext) fieldContext__PostMin_name(_ context.Context, field return fc, nil } -func (ec *executionContext) __PostMin_user_id(ctx context.Context, field graphql.CollectedField, obj *model.PostMin) (ret graphql.Marshaler) { +func (ec *executionContext) __AnimalMin_id(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostMin_user_id, + ec.fieldContext__AnimalMin_id, func(ctx context.Context) (any, error) { - return obj.UserID, nil + return obj.ID, nil }, nil, ec.marshalNInt2int, @@ -5233,9 +5826,9 @@ func (ec *executionContext) __PostMin_user_id(ctx context.Context, field graphql ) } -func (ec *executionContext) fieldContext__PostMin_user_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__AnimalMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostMin", + Object: "_AnimalMin", Field: field, IsMethod: false, IsResolver: false, @@ -5246,43 +5839,72 @@ func (ec *executionContext) fieldContext__PostMin_user_id(_ context.Context, fie return fc, nil } -func (ec *executionContext) __PostSum_id(ctx context.Context, field graphql.CollectedField, obj *model.PostSum) (ret graphql.Marshaler) { +func (ec *executionContext) __AnimalMin_name(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostSum_id, + ec.fieldContext__AnimalMin_name, func(ctx context.Context) (any, error) { - return obj.ID, nil + return obj.Name, nil }, nil, - ec.marshalNFloat2float64, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext__PostSum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__AnimalMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostSum", + Object: "_AnimalMin", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Float does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) __PostSum_user_id(ctx context.Context, field graphql.CollectedField, obj *model.PostSum) (ret graphql.Marshaler) { +func (ec *executionContext) __AnimalMin_type(ctx context.Context, field graphql.CollectedField, obj *model.AnimalMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__PostSum_user_id, + ec.fieldContext__AnimalMin_type, func(ctx context.Context) (any, error) { - return obj.UserID, nil + return obj.Type, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +func (ec *executionContext) fieldContext__AnimalMin_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "_AnimalMin", + 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) __AnimalSum_id(ctx context.Context, field graphql.CollectedField, obj *model.AnimalSum) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext__AnimalSum_id, + func(ctx context.Context) (any, error) { + return obj.ID, nil }, nil, ec.marshalNFloat2float64, @@ -5291,9 +5913,9 @@ func (ec *executionContext) __PostSum_user_id(ctx context.Context, field graphql ) } -func (ec *executionContext) fieldContext__PostSum_user_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__AnimalSum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_PostSum", + Object: "_AnimalSum", Field: field, IsMethod: false, IsResolver: false, @@ -5304,12 +5926,12 @@ func (ec *executionContext) fieldContext__PostSum_user_id(_ context.Context, fie return fc, nil } -func (ec *executionContext) __UserAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.UserAvg) (ret graphql.Marshaler) { +func (ec *executionContext) __CategoryAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.CategoryAvg) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__UserAvg_id, + ec.fieldContext__CategoryAvg_id, func(ctx context.Context) (any, error) { return obj.ID, nil }, @@ -5320,9 +5942,9 @@ func (ec *executionContext) __UserAvg_id(ctx context.Context, field graphql.Coll ) } -func (ec *executionContext) fieldContext__UserAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__CategoryAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_UserAvg", + Object: "_CategoryAvg", Field: field, IsMethod: false, IsResolver: false, @@ -5333,12 +5955,12 @@ func (ec *executionContext) fieldContext__UserAvg_id(_ context.Context, field gr return fc, nil } -func (ec *executionContext) __UserMax_id(ctx context.Context, field graphql.CollectedField, obj *model.UserMax) (ret graphql.Marshaler) { +func (ec *executionContext) __CategoryMax_id(ctx context.Context, field graphql.CollectedField, obj *model.CategoryMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__UserMax_id, + ec.fieldContext__CategoryMax_id, func(ctx context.Context) (any, error) { return obj.ID, nil }, @@ -5349,9 +5971,9 @@ func (ec *executionContext) __UserMax_id(ctx context.Context, field graphql.Coll ) } -func (ec *executionContext) fieldContext__UserMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__CategoryMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_UserMax", + Object: "_CategoryMax", Field: field, IsMethod: false, IsResolver: false, @@ -5362,12 +5984,12 @@ func (ec *executionContext) fieldContext__UserMax_id(_ context.Context, field gr return fc, nil } -func (ec *executionContext) __UserMax_name(ctx context.Context, field graphql.CollectedField, obj *model.UserMax) (ret graphql.Marshaler) { +func (ec *executionContext) __CategoryMax_name(ctx context.Context, field graphql.CollectedField, obj *model.CategoryMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__UserMax_name, + ec.fieldContext__CategoryMax_name, func(ctx context.Context) (any, error) { return obj.Name, nil }, @@ -5378,9 +6000,9 @@ func (ec *executionContext) __UserMax_name(ctx context.Context, field graphql.Co ) } -func (ec *executionContext) fieldContext__UserMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__CategoryMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_UserMax", + Object: "_CategoryMax", Field: field, IsMethod: false, IsResolver: false, @@ -5391,12 +6013,12 @@ func (ec *executionContext) fieldContext__UserMax_name(_ context.Context, field return fc, nil } -func (ec *executionContext) __UserMin_id(ctx context.Context, field graphql.CollectedField, obj *model.UserMin) (ret graphql.Marshaler) { +func (ec *executionContext) __CategoryMin_id(ctx context.Context, field graphql.CollectedField, obj *model.CategoryMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__UserMin_id, + ec.fieldContext__CategoryMin_id, func(ctx context.Context) (any, error) { return obj.ID, nil }, @@ -5407,9 +6029,9 @@ func (ec *executionContext) __UserMin_id(ctx context.Context, field graphql.Coll ) } -func (ec *executionContext) fieldContext__UserMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__CategoryMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_UserMin", + Object: "_CategoryMin", Field: field, IsMethod: false, IsResolver: false, @@ -5420,12 +6042,12 @@ func (ec *executionContext) fieldContext__UserMin_id(_ context.Context, field gr return fc, nil } -func (ec *executionContext) __UserMin_name(ctx context.Context, field graphql.CollectedField, obj *model.UserMin) (ret graphql.Marshaler) { +func (ec *executionContext) __CategoryMin_name(ctx context.Context, field graphql.CollectedField, obj *model.CategoryMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__UserMin_name, + ec.fieldContext__CategoryMin_name, func(ctx context.Context) (any, error) { return obj.Name, nil }, @@ -5436,9 +6058,9 @@ func (ec *executionContext) __UserMin_name(ctx context.Context, field graphql.Co ) } -func (ec *executionContext) fieldContext__UserMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__CategoryMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_UserMin", + Object: "_CategoryMin", Field: field, IsMethod: false, IsResolver: false, @@ -5449,12 +6071,12 @@ func (ec *executionContext) fieldContext__UserMin_name(_ context.Context, field return fc, nil } -func (ec *executionContext) __UserSum_id(ctx context.Context, field graphql.CollectedField, obj *model.UserSum) (ret graphql.Marshaler) { +func (ec *executionContext) __CategorySum_id(ctx context.Context, field graphql.CollectedField, obj *model.CategorySum) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext__UserSum_id, + ec.fieldContext__CategorySum_id, func(ctx context.Context) (any, error) { return obj.ID, nil }, @@ -5465,9 +6087,9 @@ func (ec *executionContext) __UserSum_id(ctx context.Context, field graphql.Coll ) } -func (ec *executionContext) fieldContext__UserSum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__CategorySum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "_UserSum", + Object: "_CategorySum", Field: field, IsMethod: false, IsResolver: false, @@ -5478,226 +6100,201 @@ func (ec *executionContext) fieldContext__UserSum_id(_ context.Context, field gr return fc, nil } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { +func (ec *executionContext) __PostAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.PostAvg) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Directive_name, + ec.fieldContext__PostAvg_id, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.ID, nil }, nil, - ec.marshalNString2string, + ec.marshalNFloat2float64, true, true, ) } -func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "_PostAvg", 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 nil, errors.New("field of type Float 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) { +func (ec *executionContext) __PostAvg_user_id(ctx context.Context, field graphql.CollectedField, obj *model.PostAvg) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Directive_description, + ec.fieldContext__PostAvg_user_id, func(ctx context.Context) (any, error) { - return obj.Description(), nil + return obj.UserID, nil }, nil, - ec.marshalOString2ᚖstring, + ec.marshalNFloat2float64, + true, true, - false, ) } -func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostAvg_user_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "_PostAvg", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type Float 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) { +func (ec *executionContext) __PostMax_id(ctx context.Context, field graphql.CollectedField, obj *model.PostMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Directive_isRepeatable, + ec.fieldContext__PostMax_id, func(ctx context.Context) (any, error) { - return obj.IsRepeatable, nil + return obj.ID, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "_PostMax", 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 nil, errors.New("field of type Int 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) { +func (ec *executionContext) __PostMax_name(ctx context.Context, field graphql.CollectedField, obj *model.PostMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Directive_locations, + ec.fieldContext__PostMax_name, func(ctx context.Context) (any, error) { - return obj.Locations, nil + return obj.Name, nil }, nil, - ec.marshalN__DirectiveLocation2ᚕstringᚄ, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "_PostMax", 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 nil, errors.New("field of type String 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) { +func (ec *executionContext) __PostMax_user_id(ctx context.Context, field graphql.CollectedField, obj *model.PostMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Directive_args, + ec.fieldContext__PostMax_user_id, func(ctx context.Context) (any, error) { - return obj.Args, nil + return obj.UserID, nil }, nil, - ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostMax_user_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "_PostMax", 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) + return nil, errors.New("field of type Int does not have child fields") }, } - 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) { +func (ec *executionContext) __PostMin_id(ctx context.Context, field graphql.CollectedField, obj *model.PostMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_name, + ec.fieldContext__PostMin_id, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.ID, nil }, nil, - ec.marshalNString2string, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "_PostMin", 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 nil, errors.New("field of type Int 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) { +func (ec *executionContext) __PostMin_name(ctx context.Context, field graphql.CollectedField, obj *model.PostMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_description, + ec.fieldContext__PostMin_name, func(ctx context.Context) (any, error) { - return obj.Description(), nil + return obj.Name, nil }, nil, - ec.marshalOString2ᚖstring, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "_PostMin", Field: field, - IsMethod: true, + 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") @@ -5706,279 +6303,230 @@ func (ec *executionContext) fieldContext___EnumValue_description(_ context.Conte return fc, nil } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { +func (ec *executionContext) __PostMin_user_id(ctx context.Context, field graphql.CollectedField, obj *model.PostMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_isDeprecated, + ec.fieldContext__PostMin_user_id, func(ctx context.Context) (any, error) { - return obj.IsDeprecated(), nil + return obj.UserID, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostMin_user_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "_PostMin", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type Int 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) { +func (ec *executionContext) __PostSum_id(ctx context.Context, field graphql.CollectedField, obj *model.PostSum) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___EnumValue_deprecationReason, + ec.fieldContext__PostSum_id, func(ctx context.Context) (any, error) { - return obj.DeprecationReason(), nil + return obj.ID, nil }, nil, - ec.marshalOString2ᚖstring, + ec.marshalNFloat2float64, + true, true, - false, ) } -func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostSum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "_PostSum", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type Float 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) { +func (ec *executionContext) __PostSum_user_id(ctx context.Context, field graphql.CollectedField, obj *model.PostSum) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Field_name, + ec.fieldContext__PostSum_user_id, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.UserID, nil }, nil, - ec.marshalNString2string, + ec.marshalNFloat2float64, true, true, ) } -func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__PostSum_user_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "_PostSum", 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 nil, errors.New("field of type Float 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) { +func (ec *executionContext) __ProductAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.ProductAvg) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Field_description, + ec.fieldContext__ProductAvg_id, func(ctx context.Context) (any, error) { - return obj.Description(), nil + return obj.ID, nil }, nil, - ec.marshalOString2ᚖstring, + ec.marshalNFloat2float64, + true, true, - false, ) } -func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__ProductAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "_ProductAvg", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type Float 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) { +func (ec *executionContext) __ProductMax_id(ctx context.Context, field graphql.CollectedField, obj *model.ProductMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Field_args, + ec.fieldContext__ProductMax_id, func(ctx context.Context) (any, error) { - return obj.Args, nil + return obj.ID, nil }, nil, - ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__ProductMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "_ProductMax", 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) + return nil, errors.New("field of type Int does not have child fields") }, } - 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) { +func (ec *executionContext) __ProductMax_name(ctx context.Context, field graphql.CollectedField, obj *model.ProductMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Field_type, + ec.fieldContext__ProductMax_name, func(ctx context.Context) (any, error) { - return obj.Type, nil + return obj.Name, nil }, nil, - ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__ProductMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "_ProductMax", 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { +func (ec *executionContext) __ProductMin_id(ctx context.Context, field graphql.CollectedField, obj *model.ProductMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Field_isDeprecated, + ec.fieldContext__ProductMin_id, func(ctx context.Context) (any, error) { - return obj.IsDeprecated(), nil + return obj.ID, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__ProductMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "_ProductMin", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type Int 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) { +func (ec *executionContext) __ProductMin_name(ctx context.Context, field graphql.CollectedField, obj *model.ProductMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Field_deprecationReason, + ec.fieldContext__ProductMin_name, func(ctx context.Context) (any, error) { - return obj.DeprecationReason(), nil + return obj.Name, nil }, nil, - ec.marshalOString2ᚖstring, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__ProductMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "_ProductMin", Field: field, - IsMethod: true, + 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") @@ -5987,136 +6535,112 @@ func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Con return fc, nil } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { +func (ec *executionContext) __ProductSum_id(ctx context.Context, field graphql.CollectedField, obj *model.ProductSum) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_name, + ec.fieldContext__ProductSum_id, func(ctx context.Context) (any, error) { - return obj.Name, nil + return obj.ID, nil }, nil, - ec.marshalNString2string, + ec.marshalNFloat2float64, true, true, ) } -func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__ProductSum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "_ProductSum", 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 nil, errors.New("field of type Float 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) { +func (ec *executionContext) __UserAvg_id(ctx context.Context, field graphql.CollectedField, obj *model.UserAvg) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_description, + ec.fieldContext__UserAvg_id, func(ctx context.Context) (any, error) { - return obj.Description(), nil + return obj.ID, nil }, nil, - ec.marshalOString2ᚖstring, + ec.marshalNFloat2float64, + true, true, - false, ) } -func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__UserAvg_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "_UserAvg", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type Float 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) { +func (ec *executionContext) __UserMax_id(ctx context.Context, field graphql.CollectedField, obj *model.UserMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_type, + ec.fieldContext__UserMax_id, func(ctx context.Context) (any, error) { - return obj.Type, nil + return obj.ID, nil }, nil, - ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__UserMax_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "_UserMax", 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 nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { +func (ec *executionContext) __UserMax_name(ctx context.Context, field graphql.CollectedField, obj *model.UserMax) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_defaultValue, + ec.fieldContext__UserMax_name, func(ctx context.Context) (any, error) { - return obj.DefaultValue, nil + return obj.Name, nil }, nil, - ec.marshalOString2ᚖstring, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__UserMax_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "_UserMax", Field: field, IsMethod: false, IsResolver: false, @@ -6127,56 +6651,56 @@ func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Con return fc, nil } -func (ec *executionContext) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { +func (ec *executionContext) __UserMin_id(ctx context.Context, field graphql.CollectedField, obj *model.UserMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_isDeprecated, + ec.fieldContext__UserMin_id, func(ctx context.Context) (any, error) { - return obj.IsDeprecated(), nil + return obj.ID, nil }, nil, - ec.marshalNBoolean2bool, + ec.marshalNInt2int, true, true, ) } -func (ec *executionContext) fieldContext___InputValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__UserMin_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "_UserMin", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type Int 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) { +func (ec *executionContext) __UserMin_name(ctx context.Context, field graphql.CollectedField, obj *model.UserMin) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___InputValue_deprecationReason, + ec.fieldContext__UserMin_name, func(ctx context.Context) (any, error) { - return obj.DeprecationReason(), nil + return obj.Name, nil }, nil, - ec.marshalOString2ᚖstring, + ec.marshalNString2string, + true, true, - false, ) } -func (ec *executionContext) fieldContext___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__UserMin_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "_UserMin", Field: field, - IsMethod: true, + 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") @@ -6185,325 +6709,242 @@ func (ec *executionContext) fieldContext___InputValue_deprecationReason(_ contex return fc, nil } -func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { +func (ec *executionContext) __UserSum_id(ctx context.Context, field graphql.CollectedField, obj *model.UserSum) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Schema_description, + ec.fieldContext__UserSum_id, func(ctx context.Context) (any, error) { - return obj.Description(), nil + return obj.ID, nil }, nil, - ec.marshalOString2ᚖstring, + ec.marshalNFloat2float64, + true, true, - false, ) } -func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext__UserSum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "_UserSum", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type Float 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) { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Schema_types, + ec.fieldContext___Directive_name, func(ctx context.Context) (any, error) { - return obj.Types(), nil + return obj.Name, nil }, nil, - ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "__Directive", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Schema_queryType, + ec.fieldContext___Directive_description, func(ctx context.Context) (any, error) { - return obj.QueryType(), nil + return obj.Description(), nil }, nil, - ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, - true, + ec.marshalOString2ᚖstring, true, + false, ) } -func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "__Directive", 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Schema_mutationType, + ec.fieldContext___Directive_isRepeatable, func(ctx context.Context) (any, error) { - return obj.MutationType(), nil + return obj.IsRepeatable, nil }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + ec.marshalNBoolean2bool, + true, true, - false, ) } -func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "__Directive", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Schema_subscriptionType, + ec.fieldContext___Directive_locations, func(ctx context.Context) (any, error) { - return obj.SubscriptionType(), nil + return obj.Locations, nil }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + ec.marshalN__DirectiveLocation2ᚕstringᚄ, + true, true, - false, ) } -func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "__Directive", Field: field, - IsMethod: true, + 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 nil, errors.New("field of type __DirectiveLocation does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Schema_directives, + ec.fieldContext___Directive_args, func(ctx context.Context) (any, error) { - return obj.Directives(), nil + return obj.Args, nil }, nil, - ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ, + ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, true, true, ) } -func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "__Directive", Field: field, - IsMethod: true, + IsMethod: false, 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) + return ec.fieldContext___InputValue_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 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 __Directive", field.Name) + 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) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_kind, + ec.fieldContext___EnumValue_name, func(ctx context.Context) (any, error) { - return obj.Kind(), nil + return obj.Name, nil }, nil, - ec.marshalN__TypeKind2string, + ec.marshalNString2string, true, true, ) } -func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__EnumValue", Field: field, - IsMethod: true, + IsMethod: false, 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 nil, errors.New("field of type String 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) { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_name, + ec.fieldContext___EnumValue_description, func(ctx context.Context) (any, error) { - return obj.Name(), nil + return obj.Description(), nil }, nil, ec.marshalOString2ᚖstring, @@ -6512,9 +6953,9 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll ) } -func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__EnumValue", Field: field, IsMethod: true, IsResolver: false, @@ -6525,14 +6966,43 @@ func (ec *executionContext) fieldContext___Type_name(_ context.Context, field gr return fc, nil } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_description, + ec.fieldContext___EnumValue_isDeprecated, func(ctx context.Context) (any, error) { - return obj.Description(), nil + return obj.IsDeprecated(), nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___EnumValue_deprecationReason, + func(ctx context.Context) (any, error) { + return obj.DeprecationReason(), nil }, nil, ec.marshalOString2ᚖstring, @@ -6541,9 +7011,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph ) } -func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__EnumValue", Field: field, IsMethod: true, IsResolver: false, @@ -6554,14 +7024,43 @@ func (ec *executionContext) fieldContext___Type_description(_ context.Context, f return fc, nil } -func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_specifiedByURL, + ec.fieldContext___Field_name, func(ctx context.Context) (any, error) { - return obj.SpecifiedByURL(), nil + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Field_description, + func(ctx context.Context) (any, error) { + return obj.Description(), nil }, nil, ec.marshalOString2ᚖstring, @@ -6570,9 +7069,9 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr ) } -func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Field", Field: field, IsMethod: true, IsResolver: false, @@ -6583,45 +7082,44 @@ func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context return fc, nil } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_fields, + ec.fieldContext___Field_args, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + return obj.Args, nil }, nil, - ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ, + ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + true, true, - false, ) } -func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Field", Field: field, - IsMethod: true, + IsMethod: false, 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) + return ec.fieldContext___InputValue_name(ctx, field) case "description": - return ec.fieldContext___Field_description(ctx, field) - case "args": - return ec.fieldContext___Field_args(ctx, field) + return ec.fieldContext___InputValue_description(ctx, field) case "type": - return ec.fieldContext___Field_type(ctx, field) + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) case "isDeprecated": - return ec.fieldContext___Field_isDeprecated(ctx, field) + return ec.fieldContext___InputValue_isDeprecated(ctx, field) case "deprecationReason": - return ec.fieldContext___Field_deprecationReason(ctx, field) + return ec.fieldContext___InputValue_deprecationReason(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } defer func() { @@ -6631,34 +7129,34 @@ func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, fiel } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + 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) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_interfaces, + ec.fieldContext___Field_type, func(ctx context.Context) (any, error) { - return obj.Interfaces(), nil + return obj.Type, nil }, nil, - ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, true, - false, ) } -func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Field", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { @@ -6691,28 +7189,144 @@ func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, fi return fc, nil } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_possibleTypes, + ec.fieldContext___Field_isDeprecated, func(ctx context.Context) (any, error) { - return obj.PossibleTypes(), nil + return obj.IsDeprecated(), nil }, nil, - ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Field_deprecationReason, + func(ctx context.Context) (any, error) { + return obj.DeprecationReason(), nil + }, + nil, + ec.marshalOString2ᚖstring, true, false, ) } -func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + 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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_name, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + ec.marshalNString2string, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_description, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_type, + func(ctx context.Context) (any, error) { + return obj.Type, nil + }, + nil, + ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + true, + ) +} + +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": @@ -6744,119 +7358,141 @@ func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, return fc, nil } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_enumValues, + ec.fieldContext___InputValue_defaultValue, func(ctx context.Context) (any, error) { - fc := graphql.GetFieldContext(ctx) - return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + return obj.DefaultValue, nil }, nil, - ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ, + ec.marshalOString2ᚖstring, true, false, ) } -func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__InputValue", Field: field, - IsMethod: true, + IsMethod: false, 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) + return nil, errors.New("field of type String does not have child fields") }, } - 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) ___InputValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___InputValue_isDeprecated, + func(ctx context.Context) (any, error) { + return obj.IsDeprecated(), nil + }, + nil, + ec.marshalNBoolean2bool, + true, + true, + ) +} + +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) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___InputValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_inputFields, + ec.fieldContext___InputValue_deprecationReason, func(ctx context.Context) (any, error) { - return obj.InputFields(), nil + return obj.DeprecationReason(), nil }, nil, - ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + ec.marshalOString2ᚖstring, true, false, ) } -func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__InputValue", 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 nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_ofType, + ec.fieldContext___Schema_description, func(ctx context.Context) (any, error) { - return obj.OfType(), nil + return obj.Description(), nil }, nil, - ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + ec.marshalOString2ᚖstring, true, false, ) } -func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + 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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_types, + func(ctx context.Context) (any, error) { + return obj.Types(), nil + }, + nil, + ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + true, + true, + ) +} + +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, @@ -6891,47 +7527,1090 @@ func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field return fc, nil } -func (ec *executionContext) ___Type_isOneOf(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, ec.OperationContext, field, - ec.fieldContext___Type_isOneOf, + ec.fieldContext___Schema_queryType, func(ctx context.Context) (any, error) { - return obj.IsOneOf(), nil + return obj.QueryType(), nil }, nil, - ec.marshalOBoolean2bool, + ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_mutationType, + func(ctx context.Context) (any, error) { + return obj.MutationType(), nil + }, + nil, + ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, true, false, ) } -func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_subscriptionType, + func(ctx context.Context) (any, error) { + return obj.SubscriptionType(), nil + }, + nil, + ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Schema_directives, + func(ctx context.Context) (any, error) { + return obj.Directives(), nil + }, + nil, + ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ, + true, + true, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_kind, + func(ctx context.Context) (any, error) { + return obj.Kind(), nil + }, + nil, + ec.marshalN__TypeKind2string, + true, + true, + ) +} + +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 Boolean does not have child fields") + return nil, errors.New("field of type __TypeKind does not have child fields") }, } return fc, nil } -// endregion **************************** field.gotpl ***************************** +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_name, + func(ctx context.Context) (any, error) { + return obj.Name(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} -// region **************************** input.gotpl ***************************** +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) unmarshalInputAnimalFilterInput(ctx context.Context, obj any) (model.AnimalFilterInput, error) { - var it model.AnimalFilterInput +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_description, + func(ctx context.Context) (any, error) { + return obj.Description(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_specifiedByURL, + func(ctx context.Context) (any, error) { + return obj.SpecifiedByURL(), nil + }, + nil, + ec.marshalOString2ᚖstring, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_fields, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }, + nil, + ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_interfaces, + func(ctx context.Context) (any, error) { + return obj.Interfaces(), nil + }, + nil, + ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_possibleTypes, + func(ctx context.Context) (any, error) { + return obj.PossibleTypes(), nil + }, + nil, + ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_enumValues, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }, + nil, + ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_inputFields, + func(ctx context.Context) (any, error) { + return obj.InputFields(), nil + }, + nil, + ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_ofType, + func(ctx context.Context) (any, error) { + return obj.OfType(), nil + }, + nil, + ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType, + true, + false, + ) +} + +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) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext___Type_isOneOf, + func(ctx context.Context) (any, error) { + return obj.IsOneOf(), nil + }, + nil, + ec.marshalOBoolean2bool, + true, + false, + ) +} + +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) unmarshalInputAnimalFilterInput(ctx context.Context, obj any) (model.AnimalFilterInput, error) { + var it model.AnimalFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name", "type", "cat", "dog", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "type": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Type = data + case "cat": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cat")) + data, err := ec.unmarshalOCatFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCatFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Cat = data + case "dog": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dog")) + data, err := ec.unmarshalODogFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐDogFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Dog = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOAnimalFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimalFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOAnimalFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimalFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOAnimalFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimalFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputAnimalOrdering(ctx context.Context, obj any) (model.AnimalOrdering, error) { + var it model.AnimalOrdering + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name", "type"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "type": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + if err != nil { + return it, err + } + it.Type = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBooleanComparator(ctx context.Context, obj any) (model.BooleanComparator, error) { + var it model.BooleanComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBooleanListComparator(ctx context.Context, obj any) (model.BooleanListComparator, error) { + var it model.BooleanListComparator + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"eq", "neq", "contains", "contained", "overlap", "isNull"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Neq = data + case "contains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Contains = data + case "contained": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contained")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Contained = data + case "overlap": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("overlap")) + data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + if err != nil { + return it, err + } + it.Overlap = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputCatFilterInput(ctx context.Context, obj any) (model.CatFilterInput, error) { + var it model.CatFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name", "type", "color", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "type": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Type = data + case "color": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("color")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Color = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOCatFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCatFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOCatFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCatFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOCatFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCatFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputCategoryFilterInput(ctx context.Context, obj any) (model.CategoryFilterInput, error) { + var it model.CategoryFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOCategoryFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOCategoryFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOCategoryFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputCategoryOrdering(ctx context.Context, obj any) (model.CategoryOrdering, error) { + var it model.CategoryOrdering + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + if err != nil { + return it, err + } + it.Name = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputCreatePostInput(ctx context.Context, obj any) (model.CreatePostInput, error) { + var it model.CreatePostInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name", "user_id"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalNInt2int(ctx, v) + if err != nil { + return it, err + } + it.ID = 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 "user_id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("user_id")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.UserID = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputDogFilterInput(ctx context.Context, obj any) (model.DogFilterInput, error) { + var it model.DogFilterInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"id", "name", "type", "cat", "dog", "AND", "OR", "NOT"} + fieldsInOrder := [...]string{"id", "name", "type", "breed", "AND", "OR", "NOT"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -6959,37 +8638,30 @@ func (ec *executionContext) unmarshalInputAnimalFilterInput(ctx context.Context, return it, err } it.Type = data - case "cat": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cat")) - data, err := ec.unmarshalOCatFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCatFilterInput(ctx, v) - if err != nil { - return it, err - } - it.Cat = data - case "dog": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dog")) - data, err := ec.unmarshalODogFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐDogFilterInput(ctx, v) + case "breed": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("breed")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) if err != nil { return it, err } - it.Dog = data + it.Breed = data case "AND": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) - data, err := ec.unmarshalOAnimalFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimalFilterInput(ctx, v) + data, err := ec.unmarshalODogFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐDogFilterInput(ctx, v) if err != nil { return it, err } it.And = data case "OR": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) - data, err := ec.unmarshalOAnimalFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimalFilterInput(ctx, v) + data, err := ec.unmarshalODogFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐDogFilterInput(ctx, v) if err != nil { return it, err } it.Or = data case "NOT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) - data, err := ec.unmarshalOAnimalFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐAnimalFilterInput(ctx, v) + data, err := ec.unmarshalODogFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐDogFilterInput(ctx, v) if err != nil { return it, err } @@ -7000,75 +8672,62 @@ func (ec *executionContext) unmarshalInputAnimalFilterInput(ctx context.Context, return it, nil } -func (ec *executionContext) unmarshalInputAnimalOrdering(ctx context.Context, obj any) (model.AnimalOrdering, error) { - var it model.AnimalOrdering +func (ec *executionContext) unmarshalInputFloatComparator(ctx context.Context, obj any) (model.FloatComparator, error) { + var it model.FloatComparator asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"id", "name", "type"} + fieldsInOrder := [...]string{"eq", "neq", "gt", "gte", "lt", "lte", "isNull"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) if err != nil { return it, err } - it.ID = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) if err != nil { return it, err } - it.Name = data - case "type": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) - data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + it.Neq = data + case "gt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gt")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) if err != nil { return it, err } - it.Type = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputBooleanComparator(ctx context.Context, obj any) (model.BooleanComparator, error) { - var it model.BooleanComparator - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"eq", "neq", "isNull"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "eq": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.Gt = data + case "gte": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gte")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) if err != nil { return it, err } - it.Eq = data - case "neq": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.Gte = data + case "lt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lt")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) if err != nil { return it, err } - it.Neq = data + it.Lt = data + case "lte": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lte")) + data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + it.Lte = data case "isNull": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -7082,8 +8741,8 @@ func (ec *executionContext) unmarshalInputBooleanComparator(ctx context.Context, return it, nil } -func (ec *executionContext) unmarshalInputBooleanListComparator(ctx context.Context, obj any) (model.BooleanListComparator, error) { - var it model.BooleanListComparator +func (ec *executionContext) unmarshalInputFloatListComparator(ctx context.Context, obj any) (model.FloatListComparator, error) { + var it model.FloatListComparator asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v @@ -7098,35 +8757,35 @@ func (ec *executionContext) unmarshalInputBooleanListComparator(ctx context.Cont switch k { case "eq": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) - data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) if err != nil { return it, err } it.Eq = data case "neq": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) - data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) if err != nil { return it, err } it.Neq = data case "contains": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) - data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) if err != nil { return it, err } it.Contains = data case "contained": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contained")) - data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) if err != nil { return it, err } it.Contained = data case "overlap": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("overlap")) - data, err := ec.unmarshalOBoolean2ᚕᚖbool(ctx, v) + data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) if err != nil { return it, err } @@ -7144,298 +8803,257 @@ func (ec *executionContext) unmarshalInputBooleanListComparator(ctx context.Cont return it, nil } -func (ec *executionContext) unmarshalInputCatFilterInput(ctx context.Context, obj any) (model.CatFilterInput, error) { - var it model.CatFilterInput +func (ec *executionContext) unmarshalInputIDComparator(ctx context.Context, obj any) (model.IDComparator, error) { + var it model.IDComparator asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"id", "name", "type", "color", "AND", "OR", "NOT"} + fieldsInOrder := [...]string{"eq", "neq", "isNull"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) - if err != nil { - return it, err - } - it.ID = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "type": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) - data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) - if err != nil { - return it, err - } - it.Type = data - case "color": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("color")) - data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) - if err != nil { - return it, err - } - it.Color = data - case "AND": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) - data, err := ec.unmarshalOCatFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCatFilterInput(ctx, v) + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) if err != nil { return it, err } - it.And = data - case "OR": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) - data, err := ec.unmarshalOCatFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCatFilterInput(ctx, v) + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) if err != nil { return it, err } - it.Or = data - case "NOT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) - data, err := ec.unmarshalOCatFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCatFilterInput(ctx, v) + it.Neq = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Not = data + it.IsNull = data } } return it, nil } -func (ec *executionContext) unmarshalInputCategoryFilterInput(ctx context.Context, obj any) (model.CategoryFilterInput, error) { - var it model.CategoryFilterInput +func (ec *executionContext) unmarshalInputIntComparator(ctx context.Context, obj any) (model.IntComparator, error) { + var it model.IntComparator asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"id", "name", "AND", "OR", "NOT"} + fieldsInOrder := [...]string{"eq", "neq", "gt", "gte", "lt", "lte", "isNull"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.ID = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.Name = data - case "AND": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) - data, err := ec.unmarshalOCategoryFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryFilterInput(ctx, v) + it.Neq = data + case "gt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gt")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.And = data - case "OR": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) - data, err := ec.unmarshalOCategoryFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryFilterInput(ctx, v) + it.Gt = data + case "gte": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gte")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.Or = data - case "NOT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) - data, err := ec.unmarshalOCategoryFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryFilterInput(ctx, v) + it.Gte = data + case "lt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lt")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.Not = data - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputCategoryOrdering(ctx context.Context, obj any) (model.CategoryOrdering, error) { - var it model.CategoryOrdering - asMap := map[string]any{} - for k, v := range obj.(map[string]any) { - asMap[k] = v - } - - fieldsInOrder := [...]string{"id", "name"} - for _, k := range fieldsInOrder { - v, ok := asMap[k] - if !ok { - continue - } - switch k { - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + it.Lt = data + case "lte": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lte")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - it.ID = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) + it.Lte = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Name = data + it.IsNull = data } } return it, nil } -func (ec *executionContext) unmarshalInputCreatePostInput(ctx context.Context, obj any) (model.CreatePostInput, error) { - var it model.CreatePostInput +func (ec *executionContext) unmarshalInputIntListComparator(ctx context.Context, obj any) (model.IntListComparator, error) { + var it model.IntListComparator asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"id", "name", "user_id"} + fieldsInOrder := [...]string{"eq", "neq", "contains", "contained", "overlap", "isNull"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } - switch k { - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalNInt2int(ctx, v) + switch k { + case "eq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) if err != nil { return it, err } - it.ID = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) + it.Eq = data + case "neq": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) if err != nil { return it, err } - it.Name = data - case "user_id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("user_id")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.Neq = data + case "contains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) if err != nil { return it, err } - it.UserID = data + it.Contains = data + case "contained": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contained")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + if err != nil { + return it, err + } + it.Contained = data + case "overlap": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("overlap")) + data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + if err != nil { + return it, err + } + it.Overlap = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.IsNull = data } } return it, nil } -func (ec *executionContext) unmarshalInputDogFilterInput(ctx context.Context, obj any) (model.DogFilterInput, error) { - var it model.DogFilterInput +func (ec *executionContext) unmarshalInputMapComparator(ctx context.Context, obj any) (model.MapComparator, error) { + var it model.MapComparator asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"id", "name", "type", "breed", "AND", "OR", "NOT"} + fieldsInOrder := [...]string{"contains", "where", "whereAny", "isNull"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) - if err != nil { - return it, err - } - it.ID = data - case "name": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) - if err != nil { - return it, err - } - it.Name = data - case "type": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) - data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) - if err != nil { - return it, err - } - it.Type = data - case "breed": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("breed")) - data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) + case "contains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) + data, err := ec.unmarshalOMap2map(ctx, v) if err != nil { return it, err } - it.Breed = data - case "AND": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) - data, err := ec.unmarshalODogFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐDogFilterInput(ctx, v) + it.Contains = data + case "where": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("where")) + data, err := ec.unmarshalOMapPathCondition2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐMapPathConditionᚄ(ctx, v) if err != nil { return it, err } - it.And = data - case "OR": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) - data, err := ec.unmarshalODogFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐDogFilterInput(ctx, v) + it.Where = data + case "whereAny": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("whereAny")) + data, err := ec.unmarshalOMapPathCondition2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐMapPathConditionᚄ(ctx, v) if err != nil { return it, err } - it.Or = data - case "NOT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) - data, err := ec.unmarshalODogFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐDogFilterInput(ctx, v) + it.WhereAny = data + case "isNull": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.Not = data + it.IsNull = data } } return it, nil } -func (ec *executionContext) unmarshalInputFloatComparator(ctx context.Context, obj any) (model.FloatComparator, error) { - var it model.FloatComparator +func (ec *executionContext) unmarshalInputMapPathCondition(ctx context.Context, obj any) (model.MapPathCondition, error) { + var it model.MapPathCondition asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"eq", "neq", "gt", "gte", "lt", "lte", "isNull"} + fieldsInOrder := [...]string{"path", "eq", "neq", "gt", "gte", "lt", "lte", "like", "isNull"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { + case "path": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("path")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Path = data case "eq": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) - data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } it.Eq = data case "neq": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) - data, err := ec.unmarshalOFloat2ᚖfloat64(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -7468,6 +9086,13 @@ func (ec *executionContext) unmarshalInputFloatComparator(ctx context.Context, o return it, err } it.Lte = data + case "like": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("like")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Like = data case "isNull": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -7481,207 +9106,248 @@ func (ec *executionContext) unmarshalInputFloatComparator(ctx context.Context, o return it, nil } -func (ec *executionContext) unmarshalInputFloatListComparator(ctx context.Context, obj any) (model.FloatListComparator, error) { - var it model.FloatListComparator +func (ec *executionContext) unmarshalInputPostFilterInput(ctx context.Context, obj any) (model.PostFilterInput, error) { + var it model.PostFilterInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"eq", "neq", "contains", "contained", "overlap", "isNull"} + fieldsInOrder := [...]string{"id", "name", "categories", "user_id", "user", "AND", "OR", "NOT"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "eq": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) - data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) if err != nil { return it, err } - it.Eq = data - case "neq": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) - data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) if err != nil { return it, err } - it.Neq = data - case "contains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) - data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + it.Name = data + case "categories": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categories")) + data, err := ec.unmarshalOCategoryFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryFilterInput(ctx, v) if err != nil { return it, err } - it.Contains = data - case "contained": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contained")) - data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + it.Categories = data + case "user_id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("user_id")) + data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) if err != nil { return it, err } - it.Contained = data - case "overlap": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("overlap")) - data, err := ec.unmarshalOFloat2ᚕᚖfloat64(ctx, v) + it.UserID = data + case "user": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("user")) + data, err := ec.unmarshalOUserFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserFilterInput(ctx, v) if err != nil { return it, err } - it.Overlap = data - case "isNull": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.User = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOPostFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostFilterInput(ctx, v) if err != nil { return it, err } - it.IsNull = data + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOPostFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOPostFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Not = data } } return it, nil } -func (ec *executionContext) unmarshalInputIntComparator(ctx context.Context, obj any) (model.IntComparator, error) { - var it model.IntComparator +func (ec *executionContext) unmarshalInputPostOrdering(ctx context.Context, obj any) (model.PostOrdering, error) { + var it model.PostOrdering asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"eq", "neq", "gt", "gte", "lt", "lte", "isNull"} + fieldsInOrder := [...]string{"id", "name", "user_id"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "eq": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) if err != nil { return it, err } - it.Eq = data - case "neq": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) if err != nil { return it, err } - it.Neq = data - case "gt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gt")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.Name = data + case "user_id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("user_id")) + data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) if err != nil { return it, err } - it.Gt = data - case "gte": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gte")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.UserID = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputProductAttributesFilterInput(ctx context.Context, obj any) (model.ProductAttributesFilterInput, error) { + var it model.ProductAttributesFilterInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"color", "size", "details", "AND", "OR", "NOT"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "color": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("color")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) if err != nil { return it, err } - it.Gte = data - case "lt": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lt")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.Color = data + case "size": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) if err != nil { return it, err } - it.Lt = data - case "lte": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lte")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.Size = data + case "details": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("details")) + data, err := ec.unmarshalOProductDetailsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, v) if err != nil { return it, err } - it.Lte = data - case "isNull": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.Details = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOProductAttributesFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, v) + if err != nil { + return it, err + } + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOProductAttributesFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, v) + if err != nil { + return it, err + } + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOProductAttributesFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, v) if err != nil { return it, err } - it.IsNull = data + it.Not = data } } return it, nil } -func (ec *executionContext) unmarshalInputIntListComparator(ctx context.Context, obj any) (model.IntListComparator, error) { - var it model.IntListComparator +func (ec *executionContext) unmarshalInputProductDetailsFilterInput(ctx context.Context, obj any) (model.ProductDetailsFilterInput, error) { + var it model.ProductDetailsFilterInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"eq", "neq", "contains", "contained", "overlap", "isNull"} + fieldsInOrder := [...]string{"manufacturer", "model", "AND", "OR", "NOT"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "eq": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eq")) - data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) - if err != nil { - return it, err - } - it.Eq = data - case "neq": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("neq")) - data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + case "manufacturer": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("manufacturer")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) if err != nil { return it, err } - it.Neq = data - case "contains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contains")) - data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + it.Manufacturer = data + case "model": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("model")) + data, err := ec.unmarshalOStringComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐStringComparator(ctx, v) if err != nil { return it, err } - it.Contains = data - case "contained": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contained")) - data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + it.Model = data + case "AND": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) + data, err := ec.unmarshalOProductDetailsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, v) if err != nil { return it, err } - it.Contained = data - case "overlap": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("overlap")) - data, err := ec.unmarshalOInt2ᚕᚖint(ctx, v) + it.And = data + case "OR": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) + data, err := ec.unmarshalOProductDetailsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, v) if err != nil { return it, err } - it.Overlap = data - case "isNull": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isNull")) - data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + it.Or = data + case "NOT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) + data, err := ec.unmarshalOProductDetailsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, v) if err != nil { return it, err } - it.IsNull = data + it.Not = data } } return it, nil } -func (ec *executionContext) unmarshalInputPostFilterInput(ctx context.Context, obj any) (model.PostFilterInput, error) { - var it model.PostFilterInput +func (ec *executionContext) unmarshalInputProductFilterInput(ctx context.Context, obj any) (model.ProductFilterInput, error) { + var it model.ProductFilterInput asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"id", "name", "categories", "user_id", "user", "AND", "OR", "NOT"} + fieldsInOrder := [...]string{"id", "name", "attributes", "metadata", "AND", "OR", "NOT"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -7702,44 +9368,37 @@ func (ec *executionContext) unmarshalInputPostFilterInput(ctx context.Context, o return it, err } it.Name = data - case "categories": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("categories")) - data, err := ec.unmarshalOCategoryFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryFilterInput(ctx, v) - if err != nil { - return it, err - } - it.Categories = data - case "user_id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("user_id")) - data, err := ec.unmarshalOIntComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐIntComparator(ctx, v) + case "attributes": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("attributes")) + data, err := ec.unmarshalOProductAttributesFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, v) if err != nil { return it, err } - it.UserID = data - case "user": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("user")) - data, err := ec.unmarshalOUserFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserFilterInput(ctx, v) + it.Attributes = data + case "metadata": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("metadata")) + data, err := ec.unmarshalOMapComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐMapComparator(ctx, v) if err != nil { return it, err } - it.User = data + it.Metadata = data case "AND": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("AND")) - data, err := ec.unmarshalOPostFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostFilterInput(ctx, v) + data, err := ec.unmarshalOProductFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductFilterInput(ctx, v) if err != nil { return it, err } it.And = data case "OR": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("OR")) - data, err := ec.unmarshalOPostFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostFilterInput(ctx, v) + data, err := ec.unmarshalOProductFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductFilterInput(ctx, v) if err != nil { return it, err } it.Or = data case "NOT": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("NOT")) - data, err := ec.unmarshalOPostFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostFilterInput(ctx, v) + data, err := ec.unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductFilterInput(ctx, v) if err != nil { return it, err } @@ -7750,14 +9409,14 @@ func (ec *executionContext) unmarshalInputPostFilterInput(ctx context.Context, o return it, nil } -func (ec *executionContext) unmarshalInputPostOrdering(ctx context.Context, obj any) (model.PostOrdering, error) { - var it model.PostOrdering +func (ec *executionContext) unmarshalInputProductOrdering(ctx context.Context, obj any) (model.ProductOrdering, error) { + var it model.ProductOrdering asMap := map[string]any{} for k, v := range obj.(map[string]any) { asMap[k] = v } - fieldsInOrder := [...]string{"id", "name", "user_id"} + fieldsInOrder := [...]string{"id", "name", "metadata"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -7778,13 +9437,13 @@ func (ec *executionContext) unmarshalInputPostOrdering(ctx context.Context, obj return it, err } it.Name = data - case "user_id": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("user_id")) + case "metadata": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("metadata")) data, err := ec.unmarshalO_OrderingTypes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐOrderingTypes(ctx, v) if err != nil { return it, err } - it.UserID = data + it.Metadata = data } } @@ -8588,6 +10247,193 @@ func (ec *executionContext) _PostsPayload(ctx context.Context, sel ast.Selection return out } +var productImplementors = []string{"Product"} + +func (ec *executionContext) _Product(ctx context.Context, sel ast.SelectionSet, obj *model.Product) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, productImplementors) + + 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("Product") + case "id": + out.Values[i] = ec._Product_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._Product_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "attributes": + out.Values[i] = ec._Product_attributes(ctx, field, obj) + case "metadata": + out.Values[i] = ec._Product_metadata(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 productAttributesImplementors = []string{"ProductAttributes"} + +func (ec *executionContext) _ProductAttributes(ctx context.Context, sel ast.SelectionSet, obj *model.ProductAttributes) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, productAttributesImplementors) + + 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("ProductAttributes") + case "color": + out.Values[i] = ec._ProductAttributes_color(ctx, field, obj) + case "size": + out.Values[i] = ec._ProductAttributes_size(ctx, field, obj) + case "details": + out.Values[i] = ec._ProductAttributes_details(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 productDetailsImplementors = []string{"ProductDetails"} + +func (ec *executionContext) _ProductDetails(ctx context.Context, sel ast.SelectionSet, obj *model.ProductDetails) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, productDetailsImplementors) + + 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("ProductDetails") + case "manufacturer": + out.Values[i] = ec._ProductDetails_manufacturer(ctx, field, obj) + case "model": + out.Values[i] = ec._ProductDetails_model(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 productsAggregateImplementors = []string{"ProductsAggregate"} + +func (ec *executionContext) _ProductsAggregate(ctx context.Context, sel ast.SelectionSet, obj *model.ProductsAggregate) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, productsAggregateImplementors) + + 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("ProductsAggregate") + case "group": + out.Values[i] = ec._ProductsAggregate_group(ctx, field, obj) + case "count": + out.Values[i] = ec._ProductsAggregate_count(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "max": + out.Values[i] = ec._ProductsAggregate_max(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "min": + out.Values[i] = ec._ProductsAggregate_min(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "avg": + out.Values[i] = ec._ProductsAggregate_avg(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "sum": + out.Values[i] = ec._ProductsAggregate_sum(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 queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { @@ -8673,7 +10519,48 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query_animals(ctx, field) + res = ec._Query_animals(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 "products": + 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_products(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 "_postsAggregate": + 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__postsAggregate(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } return res } @@ -8683,7 +10570,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "_postsAggregate": + case "_usersAggregate": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -8692,7 +10579,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query__postsAggregate(ctx, field) + res = ec._Query__usersAggregate(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -8705,7 +10592,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "_usersAggregate": + case "_categoriesAggregate": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -8714,7 +10601,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query__usersAggregate(ctx, field) + res = ec._Query__categoriesAggregate(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -8727,7 +10614,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "_categoriesAggregate": + case "_animalsAggregate": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -8736,7 +10623,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query__categoriesAggregate(ctx, field) + res = ec._Query__animalsAggregate(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -8749,7 +10636,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "_animalsAggregate": + case "_productsAggregate": field := field innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { @@ -8758,7 +10645,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Query__animalsAggregate(ctx, field) + res = ec._Query__productsAggregate(ctx, field) if res == graphql.Null { atomic.AddUint32(&fs.Invalids, 1) } @@ -9481,6 +11368,172 @@ func (ec *executionContext) __PostSum(ctx context.Context, sel ast.SelectionSet, return out } +var _ProductAvgImplementors = []string{"_ProductAvg"} + +func (ec *executionContext) __ProductAvg(ctx context.Context, sel ast.SelectionSet, obj *model.ProductAvg) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ProductAvgImplementors) + + 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("_ProductAvg") + case "id": + out.Values[i] = ec.__ProductAvg_id(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 _ProductMaxImplementors = []string{"_ProductMax"} + +func (ec *executionContext) __ProductMax(ctx context.Context, sel ast.SelectionSet, obj *model.ProductMax) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ProductMaxImplementors) + + 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("_ProductMax") + case "id": + out.Values[i] = ec.__ProductMax_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.__ProductMax_name(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 _ProductMinImplementors = []string{"_ProductMin"} + +func (ec *executionContext) __ProductMin(ctx context.Context, sel ast.SelectionSet, obj *model.ProductMin) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ProductMinImplementors) + + 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("_ProductMin") + case "id": + out.Values[i] = ec.__ProductMin_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.__ProductMin_name(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 _ProductSumImplementors = []string{"_ProductSum"} + +func (ec *executionContext) __ProductSum(ctx context.Context, sel ast.SelectionSet, obj *model.ProductSum) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, _ProductSumImplementors) + + 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("_ProductSum") + case "id": + out.Values[i] = ec.__ProductSum_id(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 _UserAvgImplementors = []string{"_UserAvg"} func (ec *executionContext) __UserAvg(ctx context.Context, sel ast.SelectionSet, obj *model.UserAvg) graphql.Marshaler { @@ -10166,6 +12219,11 @@ func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.Selecti return res } +func (ec *executionContext) unmarshalNMapPathCondition2githubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐMapPathCondition(ctx context.Context, v any) (model.MapPathCondition, error) { + res, err := ec.unmarshalInputMapPathCondition(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalNPostGroupBy2githubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostGroupBy(ctx context.Context, v any) (model.PostGroupBy, error) { var res model.PostGroupBy err := res.UnmarshalGQL(v) @@ -10224,6 +12282,64 @@ func (ec *executionContext) marshalNPostsAggregate2ᚕgithubᚗcomᚋroneliᚋfa return ret } +func (ec *executionContext) unmarshalNProductGroupBy2githubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductGroupBy(ctx context.Context, v any) (model.ProductGroupBy, error) { + var res model.ProductGroupBy + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNProductGroupBy2githubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductGroupBy(ctx context.Context, sel ast.SelectionSet, v model.ProductGroupBy) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNProductsAggregate2githubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductsAggregate(ctx context.Context, sel ast.SelectionSet, v model.ProductsAggregate) graphql.Marshaler { + return ec._ProductsAggregate(ctx, sel, &v) +} + +func (ec *executionContext) marshalNProductsAggregate2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductsAggregateᚄ(ctx context.Context, sel ast.SelectionSet, v []model.ProductsAggregate) 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.marshalNProductsAggregate2githubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductsAggregate(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) unmarshalNString2string(ctx context.Context, v any) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) @@ -10380,77 +12496,117 @@ func (ec *executionContext) marshalN_CategoryAvg2ᚖgithubᚗcomᚋroneliᚋfast } return graphql.Null } - return ec.__CategoryAvg(ctx, sel, v) + return ec.__CategoryAvg(ctx, sel, v) +} + +func (ec *executionContext) marshalN_CategoryMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryMax(ctx context.Context, sel ast.SelectionSet, v *model.CategoryMax) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.__CategoryMax(ctx, sel, v) +} + +func (ec *executionContext) marshalN_CategoryMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryMin(ctx context.Context, sel ast.SelectionSet, v *model.CategoryMin) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.__CategoryMin(ctx, sel, v) +} + +func (ec *executionContext) marshalN_CategorySum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategorySum(ctx context.Context, sel ast.SelectionSet, v *model.CategorySum) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.__CategorySum(ctx, sel, v) +} + +func (ec *executionContext) marshalN_PostAvg2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostAvg(ctx context.Context, sel ast.SelectionSet, v *model.PostAvg) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.__PostAvg(ctx, sel, v) } -func (ec *executionContext) marshalN_CategoryMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryMax(ctx context.Context, sel ast.SelectionSet, v *model.CategoryMax) graphql.Marshaler { +func (ec *executionContext) marshalN_PostMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostMax(ctx context.Context, sel ast.SelectionSet, v *model.PostMax) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec.__CategoryMax(ctx, sel, v) + return ec.__PostMax(ctx, sel, v) } -func (ec *executionContext) marshalN_CategoryMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategoryMin(ctx context.Context, sel ast.SelectionSet, v *model.CategoryMin) graphql.Marshaler { +func (ec *executionContext) marshalN_PostMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostMin(ctx context.Context, sel ast.SelectionSet, v *model.PostMin) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec.__CategoryMin(ctx, sel, v) + return ec.__PostMin(ctx, sel, v) } -func (ec *executionContext) marshalN_CategorySum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐCategorySum(ctx context.Context, sel ast.SelectionSet, v *model.CategorySum) graphql.Marshaler { +func (ec *executionContext) marshalN_PostSum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostSum(ctx context.Context, sel ast.SelectionSet, v *model.PostSum) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec.__CategorySum(ctx, sel, v) + return ec.__PostSum(ctx, sel, v) } -func (ec *executionContext) marshalN_PostAvg2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostAvg(ctx context.Context, sel ast.SelectionSet, v *model.PostAvg) graphql.Marshaler { +func (ec *executionContext) marshalN_ProductAvg2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAvg(ctx context.Context, sel ast.SelectionSet, v *model.ProductAvg) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec.__PostAvg(ctx, sel, v) + return ec.__ProductAvg(ctx, sel, v) } -func (ec *executionContext) marshalN_PostMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostMax(ctx context.Context, sel ast.SelectionSet, v *model.PostMax) graphql.Marshaler { +func (ec *executionContext) marshalN_ProductMax2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductMax(ctx context.Context, sel ast.SelectionSet, v *model.ProductMax) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec.__PostMax(ctx, sel, v) + return ec.__ProductMax(ctx, sel, v) } -func (ec *executionContext) marshalN_PostMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostMin(ctx context.Context, sel ast.SelectionSet, v *model.PostMin) graphql.Marshaler { +func (ec *executionContext) marshalN_ProductMin2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductMin(ctx context.Context, sel ast.SelectionSet, v *model.ProductMin) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec.__PostMin(ctx, sel, v) + return ec.__ProductMin(ctx, sel, v) } -func (ec *executionContext) marshalN_PostSum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPostSum(ctx context.Context, sel ast.SelectionSet, v *model.PostSum) graphql.Marshaler { +func (ec *executionContext) marshalN_ProductSum2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductSum(ctx context.Context, sel ast.SelectionSet, v *model.ProductSum) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec.__PostSum(ctx, sel, v) + return ec.__ProductSum(ctx, sel, v) } func (ec *executionContext) marshalN_UserAvg2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐUserAvg(ctx context.Context, sel ast.SelectionSet, v *model.UserAvg) graphql.Marshaler { @@ -11245,6 +13401,24 @@ func (ec *executionContext) marshalOFloat2ᚖfloat64(ctx context.Context, sel as return graphql.WrapContextMarshaler(ctx, res) } +func (ec *executionContext) unmarshalOID2ᚖstring(ctx context.Context, v any) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalID(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOID2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalID(*v) + return res +} + func (ec *executionContext) unmarshalOInt2ᚕᚖint(ctx context.Context, v any) ([]*int, error) { if v == nil { return nil, nil @@ -11319,6 +13493,32 @@ func (ec *executionContext) marshalOMap2map(ctx context.Context, sel ast.Selecti return res } +func (ec *executionContext) unmarshalOMapComparator2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐMapComparator(ctx context.Context, v any) (*model.MapComparator, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputMapComparator(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOMapPathCondition2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐMapPathConditionᚄ(ctx context.Context, v any) ([]model.MapPathCondition, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]model.MapPathCondition, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNMapPathCondition2githubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐMapPathCondition(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + func (ec *executionContext) marshalOPost2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐPost(ctx context.Context, sel ast.SelectionSet, v []*model.Post) graphql.Marshaler { if v == nil { return graphql.Null @@ -11491,6 +13691,237 @@ func (ec *executionContext) marshalOPostsPayload2ᚖgithubᚗcomᚋroneliᚋfast return ec._PostsPayload(ctx, sel, v) } +func (ec *executionContext) marshalOProduct2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProduct(ctx context.Context, sel ast.SelectionSet, v []*model.Product) 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.marshalOProduct2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProduct(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOProduct2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProduct(ctx context.Context, sel ast.SelectionSet, v *model.Product) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Product(ctx, sel, v) +} + +func (ec *executionContext) marshalOProductAttributes2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAttributes(ctx context.Context, sel ast.SelectionSet, v *model.ProductAttributes) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ProductAttributes(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOProductAttributesFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx context.Context, v any) ([]*model.ProductAttributesFilterInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.ProductAttributesFilterInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOProductAttributesFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOProductAttributesFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductAttributesFilterInput(ctx context.Context, v any) (*model.ProductAttributesFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputProductAttributesFilterInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOProductDetails2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductDetails(ctx context.Context, sel ast.SelectionSet, v *model.ProductDetails) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ProductDetails(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOProductDetailsFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx context.Context, v any) ([]*model.ProductDetailsFilterInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.ProductDetailsFilterInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOProductDetailsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOProductDetailsFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductDetailsFilterInput(ctx context.Context, v any) (*model.ProductDetailsFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputProductDetailsFilterInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOProductFilterInput2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductFilterInput(ctx context.Context, v any) ([]*model.ProductFilterInput, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.ProductFilterInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOProductFilterInput2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductFilterInput(ctx context.Context, v any) (*model.ProductFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputProductFilterInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOProductGroupBy2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductGroupByᚄ(ctx context.Context, v any) ([]model.ProductGroupBy, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]model.ProductGroupBy, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNProductGroupBy2githubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductGroupBy(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOProductGroupBy2ᚕgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductGroupByᚄ(ctx context.Context, sel ast.SelectionSet, v []model.ProductGroupBy) 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.marshalNProductGroupBy2githubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductGroupBy(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) unmarshalOProductOrdering2ᚕᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductOrdering(ctx context.Context, v any) ([]*model.ProductOrdering, error) { + if v == nil { + return nil, nil + } + var vSlice []any + vSlice = graphql.CoerceList(v) + var err error + res := make([]*model.ProductOrdering, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOProductOrdering2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductOrdering(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOProductOrdering2ᚖgithubᚗcomᚋroneliᚋfastgqlᚋpkgᚋexecutionᚋ__test__ᚋgraphᚋmodelᚐProductOrdering(ctx context.Context, v any) (*model.ProductOrdering, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputProductOrdering(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 diff --git a/pkg/execution/__test__/graph/model/models_gen.go b/pkg/execution/__test__/graph/model/models_gen.go index 326e8a1..2b09cae 100644 --- a/pkg/execution/__test__/graph/model/models_gen.go +++ b/pkg/execution/__test__/graph/model/models_gen.go @@ -187,6 +187,12 @@ type FloatListComparator struct { IsNull *bool `json:"isNull,omitempty" db:"is_null"` } +type IDComparator struct { + Eq *string `json:"eq,omitempty" db:"eq"` + Neq *string `json:"neq,omitempty" db:"neq"` + IsNull *bool `json:"isNull,omitempty" db:"is_null"` +} + type IntComparator struct { Eq *int `json:"eq,omitempty" db:"eq"` Neq *int `json:"neq,omitempty" db:"neq"` @@ -206,6 +212,25 @@ type IntListComparator struct { IsNull *bool `json:"isNull,omitempty" db:"is_null"` } +type MapComparator struct { + Contains map[string]any `json:"contains,omitempty" db:"contains"` + Where []MapPathCondition `json:"where,omitempty" db:"where"` + WhereAny []MapPathCondition `json:"whereAny,omitempty" db:"where_any"` + IsNull *bool `json:"isNull,omitempty" db:"is_null"` +} + +type MapPathCondition struct { + Path string `json:"path" db:"path"` + Eq *string `json:"eq,omitempty" db:"eq"` + Neq *string `json:"neq,omitempty" db:"neq"` + Gt *float64 `json:"gt,omitempty" db:"gt"` + Gte *float64 `json:"gte,omitempty" db:"gte"` + Lt *float64 `json:"lt,omitempty" db:"lt"` + Lte *float64 `json:"lte,omitempty" db:"lte"` + Like *string `json:"like,omitempty" db:"like"` + IsNull *bool `json:"isNull,omitempty" db:"is_null"` +} + // Graphql Mutations type Mutation struct { } @@ -269,6 +294,88 @@ type PostsPayload struct { Posts []*Post `json:"posts,omitempty" db:"posts"` } +type Product struct { + ID int `json:"id" db:"id"` + Name string `json:"name" db:"name"` + Attributes *ProductAttributes `json:"attributes,omitempty" db:"attributes"` + Metadata map[string]any `json:"metadata,omitempty" db:"metadata"` +} + +type ProductAttributes struct { + Color *string `json:"color,omitempty" db:"color"` + Size *int `json:"size,omitempty" db:"size"` + Details *ProductDetails `json:"details,omitempty" db:"details"` +} + +// Filter input for JSON type ProductAttributes +type ProductAttributesFilterInput struct { + Color *StringComparator `json:"color,omitempty" db:"color"` + Size *IntComparator `json:"size,omitempty" db:"size"` + Details *ProductDetailsFilterInput `json:"details,omitempty" db:"details"` + // Logical AND of FilterInput + And []*ProductAttributesFilterInput `json:"AND,omitempty" db:"and"` + // Logical OR of FilterInput + Or []*ProductAttributesFilterInput `json:"OR,omitempty" db:"or"` + // Logical NOT of FilterInput + Not *ProductAttributesFilterInput `json:"NOT,omitempty" db:"not"` +} + +type ProductDetails struct { + Manufacturer *string `json:"manufacturer,omitempty" db:"manufacturer"` + Model *string `json:"model,omitempty" db:"model"` +} + +// Filter input for JSON type ProductDetails +type ProductDetailsFilterInput struct { + Manufacturer *StringComparator `json:"manufacturer,omitempty" db:"manufacturer"` + Model *StringComparator `json:"model,omitempty" db:"model"` + // Logical AND of FilterInput + And []*ProductDetailsFilterInput `json:"AND,omitempty" db:"and"` + // Logical OR of FilterInput + Or []*ProductDetailsFilterInput `json:"OR,omitempty" db:"or"` + // Logical NOT of FilterInput + Not *ProductDetailsFilterInput `json:"NOT,omitempty" db:"not"` +} + +type ProductFilterInput struct { + ID *IntComparator `json:"id,omitempty" db:"id"` + Name *StringComparator `json:"name,omitempty" db:"name"` + Attributes *ProductAttributesFilterInput `json:"attributes,omitempty" db:"attributes"` + Metadata *MapComparator `json:"metadata,omitempty" db:"metadata"` + // Logical AND of FilterInput + And []*ProductFilterInput `json:"AND,omitempty" db:"and"` + // Logical OR of FilterInput + Or []*ProductFilterInput `json:"OR,omitempty" db:"or"` + // Logical NOT of FilterInput + Not *ProductFilterInput `json:"NOT,omitempty" db:"not"` +} + +// Ordering for Product +type ProductOrdering struct { + // Order Product by id + ID *OrderingTypes `json:"id,omitempty" db:"id"` + // Order Product by name + Name *OrderingTypes `json:"name,omitempty" db:"name"` + // Order Product by metadata + Metadata *OrderingTypes `json:"metadata,omitempty" db:"metadata"` +} + +// Aggregate Product +type ProductsAggregate struct { + // Group + Group map[string]any `json:"group,omitempty" db:"group"` + // Count results + Count int `json:"count" db:"count"` + // Max Aggregate + Max *ProductMax `json:"max" db:"max"` + // Min Aggregate + Min *ProductMin `json:"min" db:"min"` + // Avg Aggregate + Avg *ProductAvg `json:"avg" db:"avg"` + // Sum Aggregate + Sum *ProductSum `json:"sum" db:"sum"` +} + type Query struct { } @@ -444,6 +551,34 @@ type PostSum struct { UserID float64 `json:"user_id" db:"user_id"` } +// avg Aggregate +type ProductAvg struct { + // Compute the avg for id + ID float64 `json:"id" db:"id"` +} + +// max Aggregate +type ProductMax struct { + // Compute the max for id + ID int `json:"id" db:"id"` + // Compute the max for name + Name string `json:"name" db:"name"` +} + +// min Aggregate +type ProductMin struct { + // Compute the min for id + ID int `json:"id" db:"id"` + // Compute the min for name + Name string `json:"name" db:"name"` +} + +// sum Aggregate +type ProductSum struct { + // Compute the sum for id + ID float64 `json:"id" db:"id"` +} + // avg Aggregate type UserAvg struct { // Compute the avg for id @@ -652,6 +787,67 @@ func (e PostGroupBy) MarshalJSON() ([]byte, error) { return buf.Bytes(), nil } +// Group by Product +type ProductGroupBy string + +const ( + // Group by id + ProductGroupByID ProductGroupBy = "ID" + // Group by name + ProductGroupByName ProductGroupBy = "NAME" + // Group by metadata + ProductGroupByMetadata ProductGroupBy = "METADATA" +) + +var AllProductGroupBy = []ProductGroupBy{ + ProductGroupByID, + ProductGroupByName, + ProductGroupByMetadata, +} + +func (e ProductGroupBy) IsValid() bool { + switch e { + case ProductGroupByID, ProductGroupByName, ProductGroupByMetadata: + return true + } + return false +} + +func (e ProductGroupBy) String() string { + return string(e) +} + +func (e *ProductGroupBy) UnmarshalGQL(v any) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ProductGroupBy(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ProductGroupBy", str) + } + return nil +} + +func (e ProductGroupBy) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +func (e *ProductGroupBy) UnmarshalJSON(b []byte) error { + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + return e.UnmarshalGQL(s) +} + +func (e ProductGroupBy) MarshalJSON() ([]byte, error) { + var buf bytes.Buffer + e.MarshalGQL(&buf) + return buf.Bytes(), nil +} + // Group by User type UserGroupBy string diff --git a/pkg/execution/__test__/graph/schema.graphql b/pkg/execution/__test__/graph/schema.graphql index 63d9c80..9cc79ce 100644 --- a/pkg/execution/__test__/graph/schema.graphql +++ b/pkg/execution/__test__/graph/schema.graphql @@ -1,39 +1,58 @@ -interface Animal @table(name: "animals") @typename(name: "type") @generateFilterInput { - id: Int! - name: String! - type: String! -} -type Cat implements Animal { - id: Int! - name: String! - type: String! - color: String! -} -type Category @generateFilterInput @table(name: "category") { - id: Int! - name: String -} -type Dog implements Animal { - id: Int! - name: String! - type: String! - breed: String! -} -type Post @generateFilterInput @table(name: "post") @generateMutations { - id: Int! - name: String - categories: [Category] @relation(type: MANY_TO_MANY, fields: ["id"], references: ["id"], manyToManyTable: "posts_to_categories", manyToManyFields: ["post_id"], manyToManyReferences: ["category_id"]) - user_id: Int - user: User @relation(type: ONE_TO_ONE, fields: ["user_id"], references: ["id"]) -} -type Query { - posts: [Post] @generate - users: [User] @generate - categories: [Category] @generate - animals: [Animal] @generate -} -type User @table(name: "user") @generateFilterInput { - id: Int! - name: String! - posts: [Post] @relation(type: ONE_TO_MANY, fields: ["id"], references: ["user_id"]) -} +interface Animal @table(name: "animals") @typename(name: "type") @generateFilterInput { + id: Int! + name: String! + type: String! +} +type Cat implements Animal { + id: Int! + name: String! + type: String! + color: String! +} +type Category @generateFilterInput @table(name: "category") { + id: Int! + name: String +} +type Dog implements Animal { + id: Int! + name: String! + type: String! + breed: String! +} +type Post @generateFilterInput @table(name: "post") @generateMutations { + id: Int! + name: String + categories: [Category] @relation(type: MANY_TO_MANY, fields: ["id"], references: ["id"], manyToManyTable: "posts_to_categories", manyToManyFields: ["post_id"], manyToManyReferences: ["category_id"]) + user_id: Int + user: User @relation(type: ONE_TO_ONE, fields: ["user_id"], references: ["id"]) +} +type Query { + posts: [Post] @generate + users: [User] @generate + categories: [Category] @generate + animals: [Animal] @generate + products: [Product] @generate +} +type User @table(name: "user") @generateFilterInput { + id: Int! + name: String! + posts: [Post] @relation(type: ONE_TO_MANY, fields: ["id"], references: ["user_id"]) +} + +type ProductAttributes { + color: String + size: Int + details: ProductDetails +} + +type ProductDetails { + manufacturer: String + model: String +} + +type Product @generateFilterInput @table(name: "product") { + id: Int! + name: String! + attributes: ProductAttributes @json(column: "attributes") + metadata: Map +} \ No newline at end of file diff --git a/pkg/execution/__test__/graph/schema.resolvers.go b/pkg/execution/__test__/graph/schema.resolvers.go index 8579c5d..11f6a7d 100644 --- a/pkg/execution/__test__/graph/schema.resolvers.go +++ b/pkg/execution/__test__/graph/schema.resolvers.go @@ -51,6 +51,15 @@ func (r *queryResolver) Animals(ctx context.Context, limit *int, offset *int, or return data, nil } +// Products is the resolver for the products field. +func (r *queryResolver) Products(ctx context.Context, limit *int, offset *int, orderBy []*model.ProductOrdering, filter *model.ProductFilterInput) ([]*model.Product, error) { + var data []*model.Product + if err := r.Executor.Query(ctx, &data); err != nil { + return nil, err + } + return data, nil +} + // PostsAggregate is the resolver for the _postsAggregate field. func (r *queryResolver) PostsAggregate(ctx context.Context, groupBy []model.PostGroupBy, filter *model.PostFilterInput) ([]model.PostsAggregate, error) { var data []model.PostsAggregate @@ -87,7 +96,16 @@ func (r *queryResolver) AnimalsAggregate(ctx context.Context, groupBy []model.An return data, nil } -// Query returns generated1.QueryResolver implementation. +// ProductsAggregate is the resolver for the _productsAggregate field. +func (r *queryResolver) ProductsAggregate(ctx context.Context, groupBy []model.ProductGroupBy, filter *model.ProductFilterInput) ([]model.ProductsAggregate, error) { + var data []model.ProductsAggregate + if err := r.Executor.Query(ctx, &data); err != nil { + return nil, err + } + return data, nil +} + +// Query returns generated.QueryResolver implementation. func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} } type queryResolver struct{ *Resolver } diff --git a/pkg/execution/builders/field.go b/pkg/execution/builders/field.go index 757c6ed..72dc22c 100644 --- a/pkg/execution/builders/field.go +++ b/pkg/execution/builders/field.go @@ -21,6 +21,7 @@ const ( TypeRelation fieldType = "Relation" TypeAggregate fieldType = "Aggregate" TypeObject fieldType = "Object" + TypeJson fieldType = "Json" ) type OperationType string @@ -321,6 +322,9 @@ func parseFieldType(field *ast.Field, typeDef *ast.Definition) fieldType { case strings.HasSuffix(field.Name, "Aggregate"): return TypeAggregate case typeDef.IsCompositeType(): + if d := field.Definition.Directives.ForName("json"); d != nil { + return TypeJson + } if d := field.Definition.Directives.ForName("relation"); d != nil { return TypeRelation } diff --git a/pkg/execution/builders/sql/builder.go b/pkg/execution/builders/sql/builder.go index f7882ab..2af6845 100644 --- a/pkg/execution/builders/sql/builder.go +++ b/pkg/execution/builders/sql/builder.go @@ -296,6 +296,11 @@ func (b Builder) buildQuery(tableDef tableDefinition, field builders.Field) (*qu if err := b.buildRelationAggregate(&query, childField); err != nil { return nil, fmt.Errorf("failed to build relation for %s", childField.Name) } + case builders.TypeJson: + b.Logger.Debug("adding JSON field", "tableDefinition", tableDef.name, "fieldName", childField.Name) + if err := b.buildJsonField(&query, childField); err != nil { + return nil, fmt.Errorf("failed to build JSON field for %s: %w", childField.Name, err) + } default: b.Logger.Error("unknown field type", "tableDefinition", tableDef.name, "fieldName", childField.Name, "fieldType", childField.FieldType) panic("unknown field type") @@ -503,9 +508,21 @@ func (b Builder) buildFilterExp(table tableHelper, astDefinition *ast.Definition expBuilder = expBuilder.Append(b.buildInterfaceFilter(table, astDefinition, b.Schema.Types[strcase.ToCamel(k)], kv)) continue } - ffd := astDefinition.Fields.ForName(k) - // Create a Builder + // Check if field has @json directive - use JSONPath filter instead of EXISTS subquery + jsonDir := schema.GetJSONDirective(ffd) + if jsonDir != nil { + col := table.table.Col(b.CaseConverter(k)) + // Use new expression-based conversion + jsonExp, err := ConvertFilterMapToExpression(col, kv, GetSQLDialect(b.Dialect)) + if err != nil { + return nil, fmt.Errorf("building JSON filter for @json field %s: %w", k, err) + } + expBuilder = expBuilder.Append(jsonExp) + continue + } + + // Create a Builder for relational filter rel := schema.GetRelationDirective(ffd) if rel == nil { return nil, fmt.Errorf("missing directive relation") @@ -525,6 +542,7 @@ func (b Builder) buildFilterExp(table tableHelper, astDefinition *ast.Definition for op := range opMap { opKeys = append(opKeys, op) } + // sort keys for consistency in query building slices.Sort(opKeys) for _, op := range opKeys { @@ -589,6 +607,45 @@ func (b Builder) buildRelation(parentQuery *queryHelper, rf builders.Field) erro return nil } +// buildJsonField builds a JSON field from a JSON directive, uses jsonb_build_object for JSON field extraction +func (b Builder) buildJsonField(query *queryHelper, jsonField builders.Field) error { + // Get @json directive to find the column name + jsonDir := schema.GetJSONDirective(jsonField.Definition) + if jsonDir == nil { + return fmt.Errorf("field %s missing @json directive", jsonField.Name) + } + if jsonDir.Column == "" { + return fmt.Errorf("@json directive missing 'column' argument") + } + jsonColumnName := jsonDir.Column + + // Get the JSONB column reference from the parent table + jsonCol := query.table.Col(b.CaseConverter(jsonColumnName)) + + // Build expression using PostgreSQL -> operator and jsonb_build_object for JSON field extraction + jsonObjExpr, err := BuildJsonFieldObject(jsonCol, jsonField.Selections, b.Dialect) + if err != nil { + return fmt.Errorf("building JSON object for field %s: %w", jsonField.Name, err) + } + + // Apply alias to the expression + aliaseableExpr, ok := jsonObjExpr.(exp.Aliaseable) + if !ok { + return fmt.Errorf("expression for field %s does not implement exp.Aliaseable", jsonField.Name) + } + aliasedExpr := aliaseableExpr.As(jsonField.Name) + + // Add as a single column with the field name as alias + query.selects = append(query.selects, column{ + table: query.alias, + name: jsonField.Name, + alias: jsonField.Name, + expression: aliasedExpr, + }) + + return nil +} + func (b Builder) buildRelationAggregate(parentQuery *queryHelper, rf builders.Field) error { // Build aggregate query aggQuery, err := b.buildAggregate(getAggregateTableName(b.Schema, rf.Field), rf, false) diff --git a/pkg/execution/builders/sql/builder_test.go b/pkg/execution/builders/sql/builder_test.go index f9d26b9..4eaae36 100644 --- a/pkg/execution/builders/sql/builder_test.go +++ b/pkg/execution/builders/sql/builder_test.go @@ -401,6 +401,281 @@ func TestBuilder_Capabilities(t *testing.T) { assert.Equal(t, -1, caps.MaxRelationDepth) } +func TestBuilder_Query_JsonFiltering(t *testing.T) { + testCases := []TestBuilderCase{ + { + Name: "typed_json_filter", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {color: {eq: "red"}}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath, $2::jsonb) LIMIT $3`, + ExpectedArguments: []interface{}{`$ ? (@.color == $v0)`, `{"v0":"red"}`, int64(100)}, + }, + { + Name: "typed_json_filter_multiple_fields", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {color: {eq: "blue"}, size: {gt: 10}}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath, $2::jsonb) LIMIT $3`, + ExpectedArguments: []interface{}{`$ ? (@.color == $v0 && @.size > $v1)`, `{"v0":"blue","v1":10}`, int64(100)}, + }, + { + Name: "typed_json_filter_with_AND", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {AND: [{color: {eq: "red"}}, {size: {gt: 5}}]}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath, $2::jsonb) LIMIT $3`, + ExpectedArguments: []interface{}{`$ ? (@.color == $v0 && @.size > $v1)`, `{"v0":"red","v1":5}`, int64(100)}, + }, + { + Name: "typed_json_filter_with_OR", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {OR: [{color: {eq: "red"}}, {color: {eq: "blue"}}]}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath, $2::jsonb) LIMIT $3`, + ExpectedArguments: []interface{}{`$ ? ((@.color == $v0 || @.color == $v1))`, `{"v0":"red","v1":"blue"}`, int64(100)}, + }, + { + Name: "typed_json_filter_with_NOT", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {NOT: {color: {eq: "red"}}}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath, $2::jsonb) LIMIT $3`, + ExpectedArguments: []interface{}{`$ ? (!(@.color == $v0))`, `{"v0":"red"}`, int64(100)}, + }, + { + Name: "typed_json_filter_with_nested_logical_operators", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {AND: [{color: {eq: "red"}}, {OR: [{size: {gt: 10}}, {size: {lt: 5}}]}]}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath, $2::jsonb) LIMIT $3`, + ExpectedArguments: []interface{}{`$ ? (@.color == $v0 && (@.size > $v1 || @.size < $v2))`, `{"v0":"red","v1":10,"v2":5}`, int64(100)}, + }, + { + Name: "typed_json_filter_prefix", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {color: {prefix: "red"}}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath) LIMIT $2`, + ExpectedArguments: []interface{}{`$ ? (@.color like_regex "^red")`, int64(100)}, + }, + { + Name: "typed_json_filter_suffix", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {color: {suffix: "blue"}}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath) LIMIT $2`, + ExpectedArguments: []interface{}{`$ ? (@.color like_regex "blue$")`, int64(100)}, + }, + { + Name: "typed_json_filter_ilike", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {color: {ilike: "red"}}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath) LIMIT $2`, + ExpectedArguments: []interface{}{`$ ? (@.color like_regex "red" flag "i")`, int64(100)}, + }, + { + Name: "typed_json_filter_contains", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {color: {contains: "ed"}}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath) LIMIT $2`, + ExpectedArguments: []interface{}{`$ ? (@.color like_regex "ed")`, int64(100)}, + }, + { + Name: "typed_json_filter_multiple_new_operators", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products(filter: {attributes: {color: {prefix: "red"}, size: {gt: 10}}}) { + name + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name" FROM "app"."products" AS "sq0" WHERE jsonb_path_exists("sq0"."attributes", $1::jsonpath, $2::jsonb) LIMIT $3`, + ExpectedArguments: []interface{}{`$ ? (@.color like_regex "^red" && @.size > $v0)`, `{"v0":10}`, int64(100)}, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.Name, func(t *testing.T) { + builderTester(t, testCase, func(b sql.Builder, f builders.Field) (string, []interface{}, error) { + return b.Query(f) + }) + }) + } +} + +func TestBuilder_Query_JsonFieldSelection(t *testing.T) { + testCases := []TestBuilderCase{ + { + Name: "json_field_simple_scalar", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products { + name + attributes { + color + } + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name", jsonb_build_object('color', "sq0"."attributes"->$1) AS "attributes" FROM "app"."products" AS "sq0" LIMIT $2`, + ExpectedArguments: []interface{}{"color", int64(100)}, + }, + { + Name: "json_field_multiple_scalars", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products { + name + attributes { + color + size + } + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name", jsonb_build_object('color', "sq0"."attributes"->$1, 'size', "sq0"."attributes"->$2) AS "attributes" FROM "app"."products" AS "sq0" LIMIT $3`, + ExpectedArguments: []interface{}{"color", "size", int64(100)}, + }, + { + Name: "json_field_nested_object", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products { + name + attributes { + color + details { + manufacturer + model + } + } + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name", jsonb_build_object('color', "sq0"."attributes"->$1, 'details', jsonb_build_object('manufacturer', "sq0"."attributes"->$2->$3, 'model', "sq0"."attributes"->$4->$5)) AS "attributes" FROM "app"."products" AS "sq0" LIMIT $6`, + ExpectedArguments: []interface{}{"color", "details", "manufacturer", "details", "model", int64(100)}, + }, + { + Name: "json_field_deep_nesting", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products { + name + attributes { + details { + warranty { + years + provider + } + } + } + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name", jsonb_build_object('details', jsonb_build_object('warranty', jsonb_build_object('years', "sq0"."attributes"->$1->$2->$3, 'provider', "sq0"."attributes"->$4->$5->$6))) AS "attributes" FROM "app"."products" AS "sq0" LIMIT $7`, + ExpectedArguments: []interface{}{"details", "warranty", "years", "details", "warranty", "provider", int64(100)}, + }, + { + Name: "json_field_mixed_scalar_and_nested", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products { + name + attributes { + color + size + details { + manufacturer + } + specs { + weight + } + } + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name", jsonb_build_object('color', "sq0"."attributes"->$1, 'size', "sq0"."attributes"->$2, 'details', jsonb_build_object('manufacturer', "sq0"."attributes"->$3->$4), 'specs', jsonb_build_object('weight', "sq0"."attributes"->$5->$6)) AS "attributes" FROM "app"."products" AS "sq0" LIMIT $7`, + ExpectedArguments: []interface{}{"color", "size", "details", "manufacturer", "specs", "weight", int64(100)}, + }, + { + Name: "json_field_three_level_nesting", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products { + name + attributes { + specs { + dimensions { + width + height + depth + } + } + } + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name", jsonb_build_object('specs', jsonb_build_object('dimensions', jsonb_build_object('width', "sq0"."attributes"->$1->$2->$3, 'height', "sq0"."attributes"->$4->$5->$6, 'depth', "sq0"."attributes"->$7->$8->$9))) AS "attributes" FROM "app"."products" AS "sq0" LIMIT $10`, + ExpectedArguments: []interface{}{"specs", "dimensions", "width", "specs", "dimensions", "height", "specs", "dimensions", "depth", int64(100)}, + }, + { + Name: "json_field_nested_object_all_fields", + SchemaFile: "testdata/schema_json.graphql", + GraphQLQuery: `query { + products { + name + attributes { + details { + manufacturer + model + warranty { + years + provider + } + } + } + } + }`, + ExpectedSQL: `SELECT "sq0"."name" AS "name", jsonb_build_object('details', jsonb_build_object('manufacturer', "sq0"."attributes"->$1->$2, 'model', "sq0"."attributes"->$3->$4, 'warranty', jsonb_build_object('years', "sq0"."attributes"->$5->$6->$7, 'provider', "sq0"."attributes"->$8->$9->$10))) AS "attributes" FROM "app"."products" AS "sq0" LIMIT $11`, + ExpectedArguments: []interface{}{"details", "manufacturer", "details", "model", "details", "warranty", "years", "details", "warranty", "provider", int64(100)}, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.Name, func(t *testing.T) { + builderTester(t, testCase, func(b sql.Builder, f builders.Field) (string, []interface{}, error) { + return b.Query(f) + }) + }) + } +} + func builderTester(t *testing.T, testCase TestBuilderCase, caller func(b sql.Builder, f builders.Field) (string, []interface{}, error)) { fs := afero.NewOsFs() data, err := afero.ReadFile(fs, testCase.SchemaFile) diff --git a/pkg/execution/builders/sql/dialect.go b/pkg/execution/builders/sql/dialect.go index 8ffbeca..5e64b72 100644 --- a/pkg/execution/builders/sql/dialect.go +++ b/pkg/execution/builders/sql/dialect.go @@ -1,6 +1,8 @@ package sql import ( + "encoding/json" + "github.com/doug-martin/goqu/v9" "github.com/doug-martin/goqu/v9/exp" ) @@ -14,6 +16,8 @@ type Dialect interface { JSONAgg(expr exp.Expression) exp.SQLFunctionExpression // CoalesceJSON returns a fallback value if the expression is null CoalesceJSON(expr exp.Expression, fallback string) exp.SQLFunctionExpression + // JSONPathExists JSON filtering methods, and checks if a JSONPath expression matches + JSONPathExists(col exp.Expression, path string, vars map[string]any) exp.Expression } // PostgresDialect implements Dialect for PostgreSQL. @@ -31,6 +35,22 @@ func (PostgresDialect) CoalesceJSON(expr exp.Expression, fallback string) exp.SQ return goqu.COALESCE(expr, goqu.L(fallback)) } +func (PostgresDialect) JSONPathExists(col exp.Expression, path string, vars map[string]any) exp.Expression { + if len(vars) == 0 { + // No variables - simple form + return goqu.L("jsonb_path_exists(?, ?::jsonpath)", col, path) + } + + // Marshal variables to JSON + varsJSON, err := json.Marshal(vars) + if err != nil { + // Fallback to empty vars if marshal fails + return goqu.L("jsonb_path_exists(?, ?::jsonpath)", col, path) + } + + return goqu.L("jsonb_path_exists(?, ?::jsonpath, ?::jsonb)", col, path, string(varsJSON)) +} + // dialectRegistry maps dialect names to their implementations var dialectRegistry = map[string]Dialect{ "postgres": PostgresDialect{}, diff --git a/pkg/execution/builders/sql/json_builder.go b/pkg/execution/builders/sql/json_builder.go new file mode 100644 index 0000000..8cdae0d --- /dev/null +++ b/pkg/execution/builders/sql/json_builder.go @@ -0,0 +1,274 @@ +package sql + +import ( + "fmt" + "strings" + + "github.com/doug-martin/goqu/v9/exp" +) + +// JSONPathExpr is a marker interface for JSONPath expression nodes +type JSONPathExpr interface { + jsonPathExpr() +} + +// ConditionExpr represents a single condition: @.path op $var +type ConditionExpr struct { + Path string + Op JSONPathOp + Value any + IsNull *bool // nil = not null check, true/false for null checks + Regex string // for like_regex (value embedded) +} + +func (ConditionExpr) jsonPathExpr() {} + +// LogicalExpr combines expressions with AND/OR +type LogicalExpr struct { + Op JSONPathOp // JSONPathAnd or JSONPathOr + Children []JSONPathExpr + Negate bool +} + +func (LogicalExpr) jsonPathExpr() {} + +// Expression constructors - goqu style + +// JsonExpr creates a condition expression from path, operator, and value +func JsonExpr(path, op string, value any) (JSONPathExpr, error) { + return newCondition(path, op, value) +} + +// JsonOr combines expressions with OR +func JsonOr(exprs ...JSONPathExpr) JSONPathExpr { + return &LogicalExpr{Op: JSONPathOr, Children: exprs} +} + +// JsonAnd combines expressions with AND +func JsonAnd(exprs ...JSONPathExpr) JSONPathExpr { + return &LogicalExpr{Op: JSONPathAnd, Children: exprs} +} + +// JsonNot negates an expression +func JsonNot(expr JSONPathExpr) JSONPathExpr { + return &LogicalExpr{Op: JSONPathAnd, Children: []JSONPathExpr{expr}, Negate: true} +} + +// JsonAny creates an array "any" filter - matches if any element satisfies conditions +func JsonAny(arrayPath string, exprs ...JSONPathExpr) JSONPathExpr { + inner := &LogicalExpr{Op: JSONPathAnd, Children: exprs} + return convertToArrayExpr(arrayPath, inner, false) +} + +// JsonAll creates an array "all" filter - matches if all elements satisfy conditions +func JsonAll(arrayPath string, exprs ...JSONPathExpr) JSONPathExpr { + inner := &LogicalExpr{Op: JSONPathAnd, Children: exprs} + return convertToArrayExpr(arrayPath, inner, true) +} + +// JSONPathBuilder walks expression tree and produces JSONPath string + vars +type JSONPathBuilder struct { + vars map[string]any + offset int +} + +// NewJSONPathBuilder creates a new builder +func NewJSONPathBuilder() *JSONPathBuilder { + return &JSONPathBuilder{ + vars: make(map[string]any), + offset: 0, + } +} + +// Build converts an expression tree to a JSONPath condition string +func (b *JSONPathBuilder) Build(expr JSONPathExpr) string { + switch e := expr.(type) { + case *ConditionExpr: + return b.buildCondition(e) + case *LogicalExpr: + return b.buildLogical(e) + default: + return "" + } +} + +func (b *JSONPathBuilder) buildCondition(c *ConditionExpr) string { + if c.IsNull != nil { + if *c.IsNull { + return fmt.Sprintf("@.%s == null", c.Path) + } + return fmt.Sprintf("@.%s != null", c.Path) + } + + if c.Regex != "" { + return fmt.Sprintf("@.%s %s %s", c.Path, JSONPathLikeRegex, c.Regex) + } + + varName := fmt.Sprintf("v%d", b.offset) + b.vars[varName] = c.Value + b.offset++ + return fmt.Sprintf("@.%s %s $%s", c.Path, c.Op, varName) +} + +func (b *JSONPathBuilder) buildLogical(l *LogicalExpr) string { + if len(l.Children) == 0 { + return "" + } + + parts := make([]string, 0, len(l.Children)) + for _, child := range l.Children { + if part := b.Build(child); part != "" { + parts = append(parts, part) + } + } + + if len(parts) == 0 { + return "" + } + + result := strings.Join(parts, fmt.Sprintf(" %s ", l.Op)) + + if l.Op == JSONPathOr && len(parts) > 1 { + result = "(" + result + ")" + } + + if l.Negate { + result = "!(" + result + ")" + } + + return result +} + +// Vars returns the collected variables +func (b *JSONPathBuilder) Vars() map[string]any { + return b.vars +} + +// JSONFilterBuilder builds JSON filter expressions. +// All conditions are combined into a single jsonb_path_exists() call. +type JSONFilterBuilder struct { + column exp.IdentifierExpression + dialect Dialect + exprs []JSONPathExpr +} + +// NewJSONFilterBuilder creates a new JSON filter builder +func NewJSONFilterBuilder(col exp.IdentifierExpression, dialect Dialect) *JSONFilterBuilder { + return &JSONFilterBuilder{ + column: col, + dialect: dialect, + exprs: make([]JSONPathExpr, 0), + } +} + +// Where adds one or more expressions (AND'd together by default) +func (b *JSONFilterBuilder) Where(exprs ...JSONPathExpr) *JSONFilterBuilder { + b.exprs = append(b.exprs, exprs...) + return b +} + +// Build finalizes and returns the goqu expression +func (b *JSONFilterBuilder) Build() (exp.Expression, error) { + if len(b.exprs) == 0 { + return nil, fmt.Errorf("no conditions to build") + } + + // Wrap all expressions in AND + root := &LogicalExpr{Op: JSONPathAnd, Children: b.exprs} + + builder := NewJSONPathBuilder() + condStr := builder.Build(root) + + if condStr == "" { + return nil, fmt.Errorf("no valid conditions") + } + + jsonPath := fmt.Sprintf("$ ? (%s)", condStr) + return b.dialect.JSONPathExists(b.column, jsonPath, builder.Vars()), nil +} + +func convertToArrayExpr(arrayPath string, expr *LogicalExpr, invert bool) JSONPathExpr { + children := make([]JSONPathExpr, 0, len(expr.Children)) + + for _, child := range expr.Children { + switch c := child.(type) { + case *ConditionExpr: + newPath := arrayPath + "[*]" + if c.Path != "" { + newPath = arrayPath + "[*]." + c.Path + } + + newCond := &ConditionExpr{ + Path: newPath, + Op: c.Op, + Value: c.Value, + IsNull: c.IsNull, + Regex: c.Regex, + } + + if invert && c.Op != "" { + if inverted, ok := invertedJSONPathOp[c.Op]; ok { + newCond.Op = inverted + } + } + + children = append(children, newCond) + + case *LogicalExpr: + children = append(children, convertToArrayExpr(arrayPath, c, invert)) + } + } + + return &LogicalExpr{ + Op: expr.Op, + Children: children, + Negate: invert, + } +} + +// newCondition creates a ConditionExpr for a field and operator +func newCondition(fieldPath, op string, value any) (*ConditionExpr, error) { + switch op { + case "isNull": + isNull, ok := value.(bool) + if !ok { + return nil, fmt.Errorf("isNull value must be a boolean") + } + return &ConditionExpr{Path: fieldPath, IsNull: &isNull}, nil + + case "prefix": + strVal, ok := value.(string) + if !ok { + return nil, fmt.Errorf("prefix value must be a string") + } + return &ConditionExpr{Path: fieldPath, Regex: `"^` + escapeRegexPattern(strVal) + `"`}, nil + + case "suffix": + strVal, ok := value.(string) + if !ok { + return nil, fmt.Errorf("suffix value must be a string") + } + return &ConditionExpr{Path: fieldPath, Regex: `"` + escapeRegexPattern(strVal) + `$"`}, nil + + case "ilike": + strVal, ok := value.(string) + if !ok { + return nil, fmt.Errorf("ilike value must be a string") + } + return &ConditionExpr{Path: fieldPath, Regex: `"` + escapeRegexPattern(strVal) + `" flag "i"`}, nil + + case "contains": + strVal, ok := value.(string) + if !ok { + return nil, fmt.Errorf("contains value must be a string") + } + return &ConditionExpr{Path: fieldPath, Regex: `"` + escapeRegexPattern(strVal) + `"`}, nil + + default: + jpOp, ok := graphqlToJSONPathOp[op] + if !ok { + return nil, fmt.Errorf("unsupported operator: %s", op) + } + return &ConditionExpr{Path: fieldPath, Op: jpOp, Value: value}, nil + } +} diff --git a/pkg/execution/builders/sql/json_convert.go b/pkg/execution/builders/sql/json_convert.go new file mode 100644 index 0000000..9574405 --- /dev/null +++ b/pkg/execution/builders/sql/json_convert.go @@ -0,0 +1,275 @@ +package sql + +import ( + "fmt" + "slices" + + "github.com/doug-martin/goqu/v9/exp" +) + +// ConvertFilterMapToExpression converts a FilterInput-style map to a goqu Expression +// by building JSONPath expressions and combining them. +// +// Example: +// +// Input: {color: {eq: "red"}, size: {gt: 5}, tags: {any: {eq: "featured"}}} +// Output: jsonb_path_exists(col, '$ ? (@.color == $v0 && @.size > $v1 && @.tags[*] == $v2)', vars) +func ConvertFilterMapToExpression(col exp.IdentifierExpression, filterMap map[string]any, dialect Dialect) (exp.Expression, error) { + if len(filterMap) == 0 { + return nil, fmt.Errorf("empty filter map") + } + + exprs, err := buildExprs(filterMap) + if err != nil { + return nil, err + } + + if len(exprs) == 0 { + return nil, fmt.Errorf("no conditions to build") + } + + // Wrap all expressions in AND + root := &LogicalExpr{Op: JSONPathAnd, Children: exprs} + + pathBuilder := NewJSONPathBuilder() + condStr := pathBuilder.Build(root) + + if condStr == "" { + return nil, fmt.Errorf("no valid conditions") + } + + jsonPath := fmt.Sprintf("$ ? (%s)", condStr) + return dialect.JSONPathExists(col, jsonPath, pathBuilder.Vars()), nil +} + +// buildExprs recursively converts a filter map to JSONPathExpr slice +func buildExprs(filterMap map[string]any) ([]JSONPathExpr, error) { + var exprs []JSONPathExpr + keys := sortedKeys(filterMap) + + for _, field := range keys { + value := filterMap[field] + + switch field { + case "AND": + expr, err := buildAND(value) + if err != nil { + return nil, err + } + exprs = append(exprs, expr) + + case "OR": + expr, err := buildOR(value) + if err != nil { + return nil, err + } + exprs = append(exprs, expr) + + case "NOT": + expr, err := buildNOT(value) + if err != nil { + return nil, err + } + exprs = append(exprs, expr) + + default: + fieldExprs, err := buildField(field, value) + if err != nil { + return nil, err + } + exprs = append(exprs, fieldExprs...) + } + } + + return exprs, nil +} + +func buildAND(value any) (JSONPathExpr, error) { + filters, ok := value.([]any) + if !ok { + return nil, fmt.Errorf("AND must be an array") + } + + var children []JSONPathExpr + for _, f := range filters { + fMap, ok := f.(map[string]any) + if !ok { + return nil, fmt.Errorf("AND element must be a map") + } + exprs, err := buildExprs(fMap) + if err != nil { + return nil, err + } + children = append(children, exprs...) + } + return JsonAnd(children...), nil +} + +func buildOR(value any) (JSONPathExpr, error) { + filters, ok := value.([]any) + if !ok { + return nil, fmt.Errorf("OR must be an array") + } + + var children []JSONPathExpr + for _, f := range filters { + fMap, ok := f.(map[string]any) + if !ok { + return nil, fmt.Errorf("OR element must be a map") + } + exprs, err := buildExprs(fMap) + if err != nil { + return nil, err + } + // Wrap each OR branch in AND if multiple conditions + if len(exprs) == 1 { + children = append(children, exprs[0]) + } else { + children = append(children, JsonAnd(exprs...)) + } + } + return JsonOr(children...), nil +} + +func buildNOT(value any) (JSONPathExpr, error) { + notMap, ok := value.(map[string]any) + if !ok { + return nil, fmt.Errorf("NOT must be a map") + } + + exprs, err := buildExprs(notMap) + if err != nil { + return nil, err + } + + if len(exprs) == 1 { + return JsonNot(exprs[0]), nil + } + return JsonNot(JsonAnd(exprs...)), nil +} + +func buildField(field string, value any) ([]JSONPathExpr, error) { + opMap, ok := value.(map[string]any) + if !ok { + return nil, fmt.Errorf("field %s value must be a map", field) + } + + if isOperatorMap(opMap) { + return buildOperators(field, opMap) + } + + // Nested object - build path + return buildNestedField(field, opMap) +} + +func buildOperators(path string, opMap map[string]any) ([]JSONPathExpr, error) { + var exprs []JSONPathExpr + + for _, op := range sortedKeys(opMap) { + value := opMap[op] + + switch op { + case "any": + anyMap, ok := value.(map[string]any) + if !ok { + return nil, fmt.Errorf("'any' operator value must be a map") + } + expr, err := buildArrayFilter(path, anyMap, false) + if err != nil { + return nil, err + } + exprs = append(exprs, expr) + + case "all": + allMap, ok := value.(map[string]any) + if !ok { + return nil, fmt.Errorf("'all' operator value must be a map") + } + expr, err := buildArrayFilter(path, allMap, true) + if err != nil { + return nil, err + } + exprs = append(exprs, expr) + + default: + expr, err := JsonExpr(path, op, value) + if err != nil { + return nil, err + } + exprs = append(exprs, expr) + } + } + return exprs, nil +} + +// buildNestedField recursively builds expressions for nested JSON fields +func buildNestedField(basePath string, filterMap map[string]any) ([]JSONPathExpr, error) { + var exprs []JSONPathExpr + + for _, field := range sortedKeys(filterMap) { + value := filterMap[field] + var fullPath string + if basePath == "" { + fullPath = field + } else { + fullPath = basePath + "." + field + } + + opMap, ok := value.(map[string]any) + if !ok { + return nil, fmt.Errorf("field %s value must be a map", field) + } + + if isOperatorMap(opMap) { + fieldExprs, err := buildOperators(fullPath, opMap) + if err != nil { + return nil, err + } + exprs = append(exprs, fieldExprs...) + } else { + fieldExprs, err := buildNestedField(fullPath, opMap) + if err != nil { + return nil, err + } + exprs = append(exprs, fieldExprs...) + } + } + return exprs, nil +} + +func buildArrayFilter(arrayPath string, filterMap map[string]any, isAll bool) (JSONPathExpr, error) { + var innerExprs []JSONPathExpr + + if isOperatorMap(filterMap) { + // Simple: {eq: "value"} + for _, op := range sortedKeys(filterMap) { + expr, err := JsonExpr("", op, filterMap[op]) + if err != nil { + return nil, err + } + innerExprs = append(innerExprs, expr) + } + } else { + // Nested: {field: {eq: "value"}} + // Use buildNestedField with empty base path since we're inside an array + nestedExprs, err := buildNestedField("", filterMap) + if err != nil { + return nil, err + } + innerExprs = append(innerExprs, nestedExprs...) + } + + if isAll { + return JsonAll(arrayPath, innerExprs...), nil + } + return JsonAny(arrayPath, innerExprs...), nil +} + +func sortedKeys(m map[string]any) []string { + keys := make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + slices.Sort(keys) + return keys +} diff --git a/pkg/execution/builders/sql/json_convert_array_test.go b/pkg/execution/builders/sql/json_convert_array_test.go new file mode 100644 index 0000000..477de1c --- /dev/null +++ b/pkg/execution/builders/sql/json_convert_array_test.go @@ -0,0 +1,236 @@ +package sql + +import ( + "testing" + + "github.com/doug-martin/goqu/v9/exp" + "github.com/stretchr/testify/require" +) + +func TestJSONPathBuilder_BuildCondition(t *testing.T) { + tests := []struct { + name string + condition *ConditionExpr + wantCond string + wantVars map[string]any + }{ + { + name: "eq_condition", + condition: &ConditionExpr{ + Path: "color", + Op: JSONPathEq, + Value: "red", + }, + wantCond: "@.color == $v0", + wantVars: map[string]any{"v0": "red"}, + }, + { + name: "neq_condition", + condition: &ConditionExpr{ + Path: "status", + Op: JSONPathNeq, + Value: "inactive", + }, + wantCond: "@.status != $v0", + wantVars: map[string]any{"v0": "inactive"}, + }, + { + name: "is_null_true", + condition: &ConditionExpr{ + Path: "field", + IsNull: ptrBool(true), + }, + wantCond: "@.field == null", + wantVars: map[string]any{}, + }, + { + name: "is_null_false", + condition: &ConditionExpr{ + Path: "field", + IsNull: ptrBool(false), + }, + wantCond: "@.field != null", + wantVars: map[string]any{}, + }, + { + name: "regex_pattern", + condition: &ConditionExpr{ + Path: "name", + Regex: `"^test"`, + }, + wantCond: `@.name like_regex "^test"`, + wantVars: map[string]any{}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + builder := NewJSONPathBuilder() + cond := builder.Build(tt.condition) + require.Equal(t, tt.wantCond, cond) + require.Equal(t, tt.wantVars, builder.Vars()) + }) + } +} + +func TestJSONPathBuilder_BuildLogical(t *testing.T) { + tests := []struct { + name string + expr *LogicalExpr + wantCond string + }{ + { + name: "and_two_conditions", + expr: &LogicalExpr{ + Op: JSONPathAnd, + Children: []JSONPathExpr{ + &ConditionExpr{Path: "a", Op: JSONPathEq, Value: 1}, + &ConditionExpr{Path: "b", Op: JSONPathGt, Value: 2}, + }, + }, + wantCond: "@.a == $v0 && @.b > $v1", + }, + { + name: "or_two_conditions", + expr: &LogicalExpr{ + Op: JSONPathOr, + Children: []JSONPathExpr{ + &ConditionExpr{Path: "a", Op: JSONPathEq, Value: 1}, + &ConditionExpr{Path: "b", Op: JSONPathEq, Value: 2}, + }, + }, + wantCond: "(@.a == $v0 || @.b == $v1)", + }, + { + name: "negated_and", + expr: &LogicalExpr{ + Op: JSONPathAnd, + Children: []JSONPathExpr{ + &ConditionExpr{Path: "status", Op: JSONPathEq, Value: "active"}, + }, + Negate: true, + }, + wantCond: "!(@.status == $v0)", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + builder := NewJSONPathBuilder() + cond := builder.Build(tt.expr) + require.Equal(t, tt.wantCond, cond) + }) + } +} + +func TestInvertedJSONPathOps(t *testing.T) { + tests := []struct { + op JSONPathOp + expected JSONPathOp + exists bool + }{ + {JSONPathEq, JSONPathNeq, true}, + {JSONPathNeq, JSONPathEq, true}, + {JSONPathGt, JSONPathLte, true}, + {JSONPathGte, JSONPathLt, true}, + {JSONPathLt, JSONPathGte, true}, + {JSONPathLte, JSONPathGt, true}, + {JSONPathLikeRegex, "", false}, + } + + for _, tt := range tests { + t.Run(string(tt.op), func(t *testing.T) { + result, ok := invertedJSONPathOp[tt.op] + require.Equal(t, tt.exists, ok) + if tt.exists { + require.Equal(t, tt.expected, result) + } + }) + } +} + +func TestConvertFilterMapWithArrayOperators(t *testing.T) { + dialect := GetSQLDialect("postgres") + col := exp.NewIdentifierExpression("", "test", "data") + + filterMap := map[string]any{ + "tags": map[string]any{ + "any": map[string]any{ + "eq": "featured", + }, + }, + } + + expr, err := ConvertFilterMapToExpression(col, filterMap, dialect) + require.NoError(t, err) + require.NotNil(t, expr) +} + +func TestConvertFilterMapCombinesFieldsAndArrays(t *testing.T) { + dialect := GetSQLDialect("postgres") + col := exp.NewIdentifierExpression("", "test", "data") + + complexFilter := map[string]any{ + "color": map[string]any{ + "eq": "red", + }, + "tags": map[string]any{ + "any": map[string]any{ + "eq": "featured", + }, + }, + } + + expr, err := ConvertFilterMapToExpression(col, complexFilter, dialect) + require.NoError(t, err) + require.NotNil(t, expr) +} + +func TestConvertFilterMapAndWithArrayOperators(t *testing.T) { + dialect := GetSQLDialect("postgres") + col := exp.NewIdentifierExpression("", "test", "data") + + filterMap := map[string]any{ + "AND": []any{ + map[string]any{ + "color": map[string]any{ + "eq": "red", + }, + }, + map[string]any{ + "tags": map[string]any{ + "any": map[string]any{ + "eq": "featured", + }, + }, + }, + }, + } + + expr, err := ConvertFilterMapToExpression(col, filterMap, dialect) + require.NoError(t, err) + require.NotNil(t, expr) +} + +func TestConvertFilterMapAllOperator(t *testing.T) { + dialect := GetSQLDialect("postgres") + col := exp.NewIdentifierExpression("", "test", "data") + + filterMap := map[string]any{ + "items": map[string]any{ + "all": map[string]any{ + "status": map[string]any{ + "eq": "active", + }, + }, + }, + } + + expr, err := ConvertFilterMapToExpression(col, filterMap, dialect) + require.NoError(t, err) + require.NotNil(t, expr) +} + +func ptrBool(b bool) *bool { + return &b +} diff --git a/pkg/execution/builders/sql/json_expr.go b/pkg/execution/builders/sql/json_expr.go new file mode 100644 index 0000000..b636b75 --- /dev/null +++ b/pkg/execution/builders/sql/json_expr.go @@ -0,0 +1,95 @@ +package sql + +import ( + "fmt" + "regexp" +) + +// pathValidationRegex validates JSON paths with support for multiple array indices +var pathValidationRegex = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_]*(\[[0-9]+\])*(\.[a-zA-Z_][a-zA-Z0-9_]*(\[[0-9]+\])*)*$`) + +// JSONPathOp represents a JSONPath operator +type JSONPathOp string + +// JSONPath comparison operators +const ( + JSONPathEq JSONPathOp = "==" + JSONPathNeq JSONPathOp = "!=" + JSONPathGt JSONPathOp = ">" + JSONPathGte JSONPathOp = ">=" + JSONPathLt JSONPathOp = "<" + JSONPathLte JSONPathOp = "<=" +) + +// JSONPath regex operator +const JSONPathLikeRegex JSONPathOp = "like_regex" + +// JSONPath logical operators +const ( + JSONPathAnd JSONPathOp = "&&" + JSONPathOr JSONPathOp = "||" +) + +// graphqlToJSONPathOp maps GraphQL operators to JSONPath operators +var graphqlToJSONPathOp = map[string]JSONPathOp{ + "eq": JSONPathEq, + "neq": JSONPathNeq, + "gt": JSONPathGt, + "gte": JSONPathGte, + "lt": JSONPathLt, + "lte": JSONPathLte, + "like": JSONPathLikeRegex, + "prefix": JSONPathLikeRegex, + "suffix": JSONPathLikeRegex, + "ilike": JSONPathLikeRegex, + "contains": JSONPathLikeRegex, +} + +// invertedJSONPathOp maps operators to their logical inverses for 'all' array filter +var invertedJSONPathOp = map[JSONPathOp]JSONPathOp{ + JSONPathEq: JSONPathNeq, + JSONPathNeq: JSONPathEq, + JSONPathGt: JSONPathLte, + JSONPathGte: JSONPathLt, + JSONPathLt: JSONPathGte, + JSONPathLte: JSONPathGt, +} + +// knownOperators detects if a map contains operators vs nested field filters +var knownOperators = map[string]bool{ + "eq": true, "neq": true, "gt": true, "gte": true, + "lt": true, "lte": true, "like": true, + "ilike": true, + "prefix": true, + "suffix": true, + "contains": true, + "isNull": true, + "any": true, + "all": true, +} + +// validatePath validates a JSON path +func validatePath(path string) error { + if path == "" { + return fmt.Errorf("path cannot be empty") + } + if !pathValidationRegex.MatchString(path) { + return fmt.Errorf("invalid path format: %s", path) + } + return nil +} + +// isOperatorMap checks if a map contains operators vs nested field filters +func isOperatorMap(m map[string]any) bool { + for k := range m { + if knownOperators[k] { + return true + } + } + return false +} + +// escapeRegexPattern escapes special regex characters +func escapeRegexPattern(pattern string) string { + return regexp.QuoteMeta(pattern) +} diff --git a/pkg/execution/builders/sql/json_expr_test.go b/pkg/execution/builders/sql/json_expr_test.go new file mode 100644 index 0000000..c766f9f --- /dev/null +++ b/pkg/execution/builders/sql/json_expr_test.go @@ -0,0 +1,173 @@ +package sql_test + +import ( + "testing" + + "github.com/doug-martin/goqu/v9/exp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/roneli/fastgql/pkg/execution/builders/sql" +) + +func TestJSONFilterBuilder_SimpleConditions(t *testing.T) { + dialect := sql.GetSQLDialect("postgres") + col := exp.NewIdentifierExpression("", "test", "attributes") + + tests := []struct { + name string + build func(*sql.JSONFilterBuilder) *sql.JSONFilterBuilder + wantErr bool + }{ + { + name: "single eq condition", + build: func(b *sql.JSONFilterBuilder) *sql.JSONFilterBuilder { + expr, _ := sql.JsonExpr("color", "eq", "red") + return b.Where(expr) + }, + wantErr: false, + }, + { + name: "single neq condition", + build: func(b *sql.JSONFilterBuilder) *sql.JSONFilterBuilder { + expr, _ := sql.JsonExpr("color", "neq", "blue") + return b.Where(expr) + }, + wantErr: false, + }, + { + name: "comparison operators", + build: func(b *sql.JSONFilterBuilder) *sql.JSONFilterBuilder { + gt, _ := sql.JsonExpr("size", "gt", 10) + gte, _ := sql.JsonExpr("count", "gte", 5) + lt, _ := sql.JsonExpr("price", "lt", 100) + lte, _ := sql.JsonExpr("weight", "lte", 50) + return b.Where(gt, gte, lt, lte) + }, + wantErr: false, + }, + { + name: "string operators", + build: func(b *sql.JSONFilterBuilder) *sql.JSONFilterBuilder { + prefix, _ := sql.JsonExpr("name", "prefix", "test") + suffix, _ := sql.JsonExpr("email", "suffix", ".com") + contains, _ := sql.JsonExpr("desc", "contains", "hello") + return b.Where(prefix, suffix, contains) + }, + wantErr: false, + }, + { + name: "null checks", + build: func(b *sql.JSONFilterBuilder) *sql.JSONFilterBuilder { + isNull, _ := sql.JsonExpr("field1", "isNull", true) + isNotNull, _ := sql.JsonExpr("field2", "isNull", false) + return b.Where(isNull, isNotNull) + }, + wantErr: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + builder := sql.NewJSONFilterBuilder(col, dialect) + tt.build(builder) + + expr, err := builder.Build() + if tt.wantErr { + assert.Error(t, err) + return + } + + require.NoError(t, err) + assert.NotNil(t, expr) + }) + } +} + +func TestJSONFilterBuilder_LogicalOperators(t *testing.T) { + dialect := sql.GetSQLDialect("postgres") + col := exp.NewIdentifierExpression("", "test", "attributes") + + t.Run("or conditions", func(t *testing.T) { + colorRed, _ := sql.JsonExpr("color", "eq", "red") + colorBlue, _ := sql.JsonExpr("color", "eq", "blue") + + builder := sql.NewJSONFilterBuilder(col, dialect) + expr, err := builder. + Where(sql.JsonOr(colorRed, colorBlue)). + Build() + + require.NoError(t, err) + assert.NotNil(t, expr) + }) + + t.Run("not condition", func(t *testing.T) { + statusDeleted, _ := sql.JsonExpr("status", "eq", "deleted") + + builder := sql.NewJSONFilterBuilder(col, dialect) + expr, err := builder. + Where(sql.JsonNot(statusDeleted)). + Build() + + require.NoError(t, err) + assert.NotNil(t, expr) + }) + + t.Run("complex and/or", func(t *testing.T) { + typeProduct, _ := sql.JsonExpr("type", "eq", "product") + priceGt100, _ := sql.JsonExpr("price", "gt", 100) + typeService, _ := sql.JsonExpr("type", "eq", "service") + priceGt50, _ := sql.JsonExpr("price", "gt", 50) + + builder := sql.NewJSONFilterBuilder(col, dialect) + expr, err := builder. + Where(sql.JsonOr( + sql.JsonAnd(typeProduct, priceGt100), + sql.JsonAnd(typeService, priceGt50), + )). + Build() + + require.NoError(t, err) + assert.NotNil(t, expr) + }) +} + +func TestJSONFilterBuilder_ArrayOperators(t *testing.T) { + dialect := sql.GetSQLDialect("postgres") + col := exp.NewIdentifierExpression("", "test", "attributes") + + t.Run("any array condition", func(t *testing.T) { + eqFeatured, _ := sql.JsonExpr("", "eq", "featured") + + builder := sql.NewJSONFilterBuilder(col, dialect) + expr, err := builder. + Where(sql.JsonAny("tags", eqFeatured)). + Build() + + require.NoError(t, err) + assert.NotNil(t, expr) + }) + + t.Run("all array condition", func(t *testing.T) { + statusActive, _ := sql.JsonExpr("status", "eq", "active") + + builder := sql.NewJSONFilterBuilder(col, dialect) + expr, err := builder. + Where(sql.JsonAll("items", statusActive)). + Build() + + require.NoError(t, err) + assert.NotNil(t, expr) + }) +} + +func TestJSONFilterBuilder_EmptyBuilder(t *testing.T) { + dialect := sql.GetSQLDialect("postgres") + col := exp.NewIdentifierExpression("", "test", "attributes") + + builder := sql.NewJSONFilterBuilder(col, dialect) + _, err := builder.Build() + + assert.Error(t, err) + assert.Contains(t, err.Error(), "no conditions") +} diff --git a/pkg/execution/builders/sql/json_select.go b/pkg/execution/builders/sql/json_select.go new file mode 100644 index 0000000..2ec3e27 --- /dev/null +++ b/pkg/execution/builders/sql/json_select.go @@ -0,0 +1,65 @@ +package sql + +import ( + "fmt" + + "github.com/doug-martin/goqu/v9" + "github.com/doug-martin/goqu/v9/exp" + "github.com/roneli/fastgql/pkg/execution/builders" +) + +// BuildJsonFieldObject builds an expression to extract selected JSON fields +// Uses jsonb_path_query_first for efficient extraction, jsonb_build_object for construction +func BuildJsonFieldObject( + baseCol exp.Expression, + selections builders.Fields, + dialect string, +) (exp.Expression, error) { + if len(selections) == 0 { + // No selections - this is invalid for field selection + // If you want the entire JSON object, you should select it as a Map scalar, not as a typed JSON field + return nil, fmt.Errorf("no field selections provided for JSON object") + } + + // For multiple fields or mixed types, use jsonb_build_object with jsonb_path_query_first + args := make([]interface{}, 0, len(selections)*2) + for _, sel := range selections { + args = append(args, goqu.L(fmt.Sprintf("'%s'", sel.Name))) + + var valueExpr exp.Expression + + switch sel.FieldType { + case builders.TypeScalar: + // Extract scalar: use native -> operator for efficiency (faster than jsonb_path_query_first) + // For simple paths, -> is more efficient as it's a native operator + if err := validatePath(sel.Name); err != nil { + return nil, fmt.Errorf("invalid JSON field name %s: %w", sel.Name, err) + } + // Build path using -> operator: col->'field' for JSONB, or col->>'field' for text + // We use -> to get JSONB, which works well with jsonb_build_object + valueExpr = goqu.L("?->?", baseCol, sel.Name) + + case builders.TypeObject, builders.TypeJson: + // Nested object: extract the nested JSON object first, then recursively build + if err := validatePath(sel.Name); err != nil { + return nil, fmt.Errorf("invalid JSON field name %s: %w", sel.Name, err) + } + // Extract the nested object using -> operator (more efficient than jsonb_path_query_first for simple paths) + nestedCol := goqu.L("?->?", baseCol, sel.Name) + // Recursively build the nested object structure + nestedObj, err := BuildJsonFieldObject(nestedCol, sel.Selections, dialect) + if err != nil { + return nil, fmt.Errorf("building nested JSON for %s: %w", sel.Name, err) + } + valueExpr = nestedObj + + default: + return nil, fmt.Errorf("unsupported field type %s in JSON selection", sel.FieldType) + } + + args = append(args, valueExpr) + } + + sqlDialect := GetSQLDialect(dialect) + return sqlDialect.JSONBuildObject(args...), nil +} diff --git a/pkg/execution/builders/sql/json_select_test.go b/pkg/execution/builders/sql/json_select_test.go new file mode 100644 index 0000000..672a5ab --- /dev/null +++ b/pkg/execution/builders/sql/json_select_test.go @@ -0,0 +1,200 @@ +package sql + +import ( + "testing" + + "github.com/doug-martin/goqu/v9" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/vektah/gqlparser/v2/ast" + + "github.com/roneli/fastgql/pkg/execution/builders" +) + +func TestBuildJsonFieldObject(t *testing.T) { + tests := []struct { + name string + selections builders.Fields + wantSQL string + wantErr bool + }{ + { + name: "empty selections returns error", + selections: builders.Fields{}, + wantSQL: ``, + wantErr: true, + }, + { + name: "single scalar field", + selections: builders.Fields{ + {Field: &ast.Field{Name: "color"}, FieldType: builders.TypeScalar}, + }, + wantSQL: `SELECT jsonb_build_object('color', "test"."attributes"->'color') FROM "test"`, + wantErr: false, + }, + { + name: "multiple scalar fields", + selections: builders.Fields{ + {Field: &ast.Field{Name: "color"}, FieldType: builders.TypeScalar}, + {Field: &ast.Field{Name: "size"}, FieldType: builders.TypeScalar}, + }, + wantSQL: `SELECT jsonb_build_object('color', "test"."attributes"->'color', 'size', "test"."attributes"->'size') FROM "test"`, + wantErr: false, + }, + { + name: "nested object field", + selections: builders.Fields{ + { + Field: &ast.Field{Name: "details"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + {Field: &ast.Field{Name: "brand"}, FieldType: builders.TypeScalar}, + }, + }, + }, + wantSQL: `SELECT jsonb_build_object('details', jsonb_build_object('brand', "test"."attributes"->'details'->'brand')) FROM "test"`, + wantErr: false, + }, + { + name: "mixed scalar and nested", + selections: builders.Fields{ + {Field: &ast.Field{Name: "color"}, FieldType: builders.TypeScalar}, + { + Field: &ast.Field{Name: "specs"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + {Field: &ast.Field{Name: "weight"}, FieldType: builders.TypeScalar}, + }, + }, + }, + wantSQL: `SELECT jsonb_build_object('color', "test"."attributes"->'color', 'specs', jsonb_build_object('weight', "test"."attributes"->'specs'->'weight')) FROM "test"`, + wantErr: false, + }, + { + name: "deeply nested object", + selections: builders.Fields{ + { + Field: &ast.Field{Name: "outer"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + { + Field: &ast.Field{Name: "inner"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + {Field: &ast.Field{Name: "value"}, FieldType: builders.TypeScalar}, + }, + }, + }, + }, + }, + wantSQL: `SELECT jsonb_build_object('outer', jsonb_build_object('inner', jsonb_build_object('value', "test"."attributes"->'outer'->'inner'->'value'))) FROM "test"`, + wantErr: false, + }, + { + name: "nested object with multiple fields", + selections: builders.Fields{ + { + Field: &ast.Field{Name: "details"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + {Field: &ast.Field{Name: "brand"}, FieldType: builders.TypeScalar}, + {Field: &ast.Field{Name: "model"}, FieldType: builders.TypeScalar}, + {Field: &ast.Field{Name: "year"}, FieldType: builders.TypeScalar}, + }, + }, + }, + wantSQL: `SELECT jsonb_build_object('details', jsonb_build_object('brand', "test"."attributes"->'details'->'brand', 'model', "test"."attributes"->'details'->'model', 'year', "test"."attributes"->'details'->'year')) FROM "test"`, + wantErr: false, + }, + { + name: "multiple top-level fields with multiple nested fields", + selections: builders.Fields{ + {Field: &ast.Field{Name: "color"}, FieldType: builders.TypeScalar}, + {Field: &ast.Field{Name: "size"}, FieldType: builders.TypeScalar}, + { + Field: &ast.Field{Name: "specs"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + {Field: &ast.Field{Name: "weight"}, FieldType: builders.TypeScalar}, + {Field: &ast.Field{Name: "height"}, FieldType: builders.TypeScalar}, + }, + }, + { + Field: &ast.Field{Name: "details"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + {Field: &ast.Field{Name: "brand"}, FieldType: builders.TypeScalar}, + {Field: &ast.Field{Name: "model"}, FieldType: builders.TypeScalar}, + }, + }, + }, + wantSQL: `SELECT jsonb_build_object('color', "test"."attributes"->'color', 'size', "test"."attributes"->'size', 'specs', jsonb_build_object('weight', "test"."attributes"->'specs'->'weight', 'height', "test"."attributes"->'specs'->'height'), 'details', jsonb_build_object('brand', "test"."attributes"->'details'->'brand', 'model', "test"."attributes"->'details'->'model')) FROM "test"`, + wantErr: false, + }, + { + name: "multiple nested objects at top level", + selections: builders.Fields{ + { + Field: &ast.Field{Name: "specs"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + {Field: &ast.Field{Name: "weight"}, FieldType: builders.TypeScalar}, + {Field: &ast.Field{Name: "height"}, FieldType: builders.TypeScalar}, + }, + }, + { + Field: &ast.Field{Name: "details"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + {Field: &ast.Field{Name: "brand"}, FieldType: builders.TypeScalar}, + {Field: &ast.Field{Name: "model"}, FieldType: builders.TypeScalar}, + }, + }, + }, + wantSQL: `SELECT jsonb_build_object('specs', jsonb_build_object('weight', "test"."attributes"->'specs'->'weight', 'height', "test"."attributes"->'specs'->'height'), 'details', jsonb_build_object('brand', "test"."attributes"->'details'->'brand', 'model', "test"."attributes"->'details'->'model')) FROM "test"`, + wantErr: false, + }, + { + name: "deeply nested with multiple fields at each level", + selections: builders.Fields{ + { + Field: &ast.Field{Name: "outer"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + { + Field: &ast.Field{Name: "inner"}, + FieldType: builders.TypeObject, + Selections: builders.Fields{ + {Field: &ast.Field{Name: "value1"}, FieldType: builders.TypeScalar}, + {Field: &ast.Field{Name: "value2"}, FieldType: builders.TypeScalar}, + }, + }, + {Field: &ast.Field{Name: "other"}, FieldType: builders.TypeScalar}, + }, + }, + }, + wantSQL: `SELECT jsonb_build_object('outer', jsonb_build_object('inner', jsonb_build_object('value1', "test"."attributes"->'outer'->'inner'->'value1', 'value2', "test"."attributes"->'outer'->'inner'->'value2'), 'other', "test"."attributes"->'outer'->'other')) FROM "test"`, + wantErr: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + col := goqu.T("test").Col("attributes") + expr, err := BuildJsonFieldObject(col, tt.selections, "postgres") + + if tt.wantErr { + assert.Error(t, err) + return + } + + require.NoError(t, err) + + // Build a query to get the SQL + query := goqu.From("test").Select(expr) + sqlStr, _, err := query.ToSQL() + require.NoError(t, err) + assert.Equal(t, tt.wantSQL, sqlStr) + }) + } +} diff --git a/pkg/execution/builders/sql/scan.go b/pkg/execution/builders/sql/scan.go index 33395d5..7ec2828 100644 --- a/pkg/execution/builders/sql/scan.go +++ b/pkg/execution/builders/sql/scan.go @@ -88,3 +88,4 @@ func getTypeName(row pgx.CollectableRow, i int, typeName string) (string, int) { return "", -1 } + diff --git a/pkg/execution/builders/sql/testdata/json_integration_data.sql b/pkg/execution/builders/sql/testdata/json_integration_data.sql new file mode 100644 index 0000000..781d4e9 --- /dev/null +++ b/pkg/execution/builders/sql/testdata/json_integration_data.sql @@ -0,0 +1,118 @@ +-- SQL fixtures for JSON integration tests +-- This file contains comprehensive test data for testing JSON filtering + +-- Create test schema +CREATE SCHEMA IF NOT EXISTS app; + +-- Products table for JSON filtering tests +CREATE TABLE IF NOT EXISTS app.products ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + attributes JSONB, + metadata JSONB, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +-- Insert comprehensive test data +INSERT INTO app.products (name, attributes, metadata) VALUES +-- Product with all attributes +('Red Widget Pro', + '{"color": "red", "size": 10, "price": 99.99, "tags": ["sale", "featured"], "details": {"manufacturer": "Acme", "model": "Pro", "warranty": {"years": 2, "provider": "Acme"}}, "specs": {"weight": 1.5, "dimensions": {"width": 10.0, "height": 5.0, "depth": 3.0}}}'::jsonb, + '{"category": "electronics", "sku": "RWP-001", "stock": 50}'::jsonb), + +-- Product with different attributes +('Blue Gadget Basic', + '{"color": "blue", "size": 20, "price": 149.99, "tags": ["new"], "details": {"manufacturer": "TechCorp", "model": "Basic", "warranty": {"years": 1, "provider": "TechCorp"}}, "specs": {"weight": 2.5, "dimensions": {"width": 15.0, "height": 8.0, "depth": 4.0}}}'::jsonb, + '{"category": "gadgets", "sku": "BGB-002", "stock": 30}'::jsonb), + +-- Product with Acme manufacturer +('Green Tool Deluxe', + '{"color": "green", "size": 5, "price": 29.99, "tags": [], "details": {"manufacturer": "Acme", "model": "Deluxe", "warranty": {"years": 3, "provider": "Extended"}}, "specs": {"weight": 0.5, "dimensions": {"width": 5.0, "height": 3.0, "depth": 2.0}}}'::jsonb, + '{"category": "tools", "sku": "GTD-003", "stock": 100}'::jsonb), + +-- Product with null attributes +('Basic Item', + NULL, + '{"category": "misc", "sku": "BI-004", "stock": 10}'::jsonb), + +-- Product with empty JSON object +('Empty Attributes Product', + '{}'::jsonb, + '{}'::jsonb), + +-- Product for testing special characters +('Special Chars Product', + '{"name": "O''Brien''s Item", "description": "Line1\nLine2", "path": "C:\\Users\\test", "unicode": "Hello 世界", "emoji": "Test 🚀 emoji"}'::jsonb, + '{"notes": "Contains \"quotes\" and ''apostrophes''"}'::jsonb), + +-- Product with edge case values +('Edge Case Product', + '{"zero": 0, "negative": -10, "large": 999999, "decimal": 123.456789, "boolean_true": true, "boolean_false": false, "null_value": null, "empty_string": "", "empty_array": [], "empty_object": {}}'::jsonb, + NULL), + +-- Products for testing arrays +('Array Test 1', + '{"items": [{"name": "widget", "qty": 5, "price": 10.0}, {"name": "gadget", "qty": 2, "price": 20.0}]}'::jsonb, + '{"order_id": "ORD-001"}'::jsonb), + +('Array Test 2', + '{"items": [{"name": "tool", "qty": 1, "price": 15.0}, {"name": "widget", "qty": 3, "price": 10.0}]}'::jsonb, + '{"order_id": "ORD-002"}'::jsonb), + +('Array Test 3', + '{"items": [{"name": "gadget", "qty": 10, "price": 20.0}]}'::jsonb, + '{"order_id": "ORD-003"}'::jsonb), + +-- Products for testing deep nesting (5 levels) +('Deep Nesting Test', + '{"level1": {"level2": {"level3": {"level4": {"level5": "deep_value", "number": 42}}}}}'::jsonb, + NULL), + +-- Product with multiple array indices test data +('Matrix Test', + '{"matrix": [[{"value": "00"}, {"value": "01"}], [{"value": "10"}, {"value": "11"}]], "grid": {"rows": [{"cols": [{"val": 1}, {"val": 2}]}, {"cols": [{"val": 3}, {"val": 4}]}]}}'::jsonb, + NULL), + +-- Products for testing ranges +('Small Size', '{"size": 1}'::jsonb, NULL), +('Medium Size', '{"size": 15}'::jsonb, NULL), +('Large Size', '{"size": 100}'::jsonb, NULL); + +-- Additional table for MapComparator tests +CREATE TABLE IF NOT EXISTS app.configurations ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + settings JSONB +); + +INSERT INTO app.configurations (name, settings) VALUES +('Production Config', '{"timeout": 30, "enabled": true, "mode": "production", "max_connections": 100}'::jsonb), +('Staging Config', '{"timeout": 60, "enabled": false, "mode": "staging", "max_connections": 50}'::jsonb), +('Dev Config', '{"timeout": 10, "enabled": true, "mode": "development", "debug": true}'::jsonb), +('Null Config', NULL), +('Empty Config', '{}'::jsonb); + +-- Table for testing complex queries +CREATE TABLE IF NOT EXISTS app.orders ( + id SERIAL PRIMARY KEY, + customer_name TEXT NOT NULL, + order_data JSONB, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +INSERT INTO app.orders (customer_name, order_data) VALUES +('Alice Johnson', '{"total": 150.50, "status": "shipped", "items": [{"id": 1, "name": "Widget", "qty": 3, "price": 25.00}, {"id": 2, "name": "Gadget", "qty": 2, "price": 37.75}], "shipping": {"address": {"street": "123 Main St", "city": "Springfield", "state": "IL", "zip": "62701"}, "method": "express"}}'::jsonb), +('Bob Smith', '{"total": 89.99, "status": "processing", "items": [{"id": 3, "name": "Tool", "qty": 1, "price": 89.99}], "shipping": {"address": {"street": "456 Oak Ave", "city": "Portland", "state": "OR", "zip": "97201"}, "method": "standard"}}'::jsonb), +('Charlie Brown', '{"total": 250.00, "status": "delivered", "items": [{"id": 1, "name": "Widget", "qty": 10, "price": 25.00}], "shipping": {"address": {"street": "789 Elm Dr", "city": "Austin", "state": "TX", "zip": "78701"}, "method": "express"}}'::jsonb), +('Diana Prince', NULL); + +-- Create indexes for performance testing +CREATE INDEX IF NOT EXISTS idx_products_attributes ON app.products USING GIN (attributes); +CREATE INDEX IF NOT EXISTS idx_products_metadata ON app.products USING GIN (metadata); +CREATE INDEX IF NOT EXISTS idx_configurations_settings ON app.configurations USING GIN (settings); +CREATE INDEX IF NOT EXISTS idx_orders_data ON app.orders USING GIN (order_data); + +-- Add some comments for documentation +COMMENT ON TABLE app.products IS 'Test table for JSON filtering with typed attributes'; +COMMENT ON TABLE app.configurations IS 'Test table for MapComparator filtering'; +COMMENT ON TABLE app.orders IS 'Test table for complex nested JSON queries'; diff --git a/pkg/execution/builders/sql/testdata/schema_json.graphql b/pkg/execution/builders/sql/testdata/schema_json.graphql new file mode 100644 index 0000000..2abd8e5 --- /dev/null +++ b/pkg/execution/builders/sql/testdata/schema_json.graphql @@ -0,0 +1,165 @@ +# Test schema for JSON/JSONB filtering + +# Product with typed JSON attributes +type ProductDetails { + manufacturer: String + model: String + warranty: WarrantyInfo +} + +type WarrantyInfo { + years: Int + provider: String +} + +type ProductAttributes { + color: String + size: Int + tags: [String] + details: ProductDetails + specs: Specs +} + +type Specs { + weight: Float + dimensions: Dimensions +} + +type Dimensions { + width: Float + height: Float + depth: Float +} + +type Product @generateFilterInput @table(name: "products", schema: "app") { + id: Int! + name: String! + # Typed JSON field - filters like a relation but uses JSONPath under the hood + attributes: ProductAttributes @json(column: "attributes") +} + +type Query { + products: [Product] @generate +} + +# ================== schema generation fastgql directives ================== + +directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION + +directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT + +directive @generateFilterInput(description: String) repeatable on OBJECT + +# ================== Directives supported by fastgql for Querying ================== + +directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE + +directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION + +directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION + +directive @typename(name: String!) on INTERFACE + +# JSON directive marks a field as stored in a JSONB column +directive @json(column: String!) on FIELD_DEFINITION + +# =================== Default Scalar types supported by fastgql =================== +scalar Map + +# ================== Default Filter input types supported by fastgql ================== + +enum _relationType { + ONE_TO_ONE + ONE_TO_MANY + MANY_TO_MANY +} + +enum _OrderingTypes { + ASC + DESC + ASC_NULL_FIRST + DESC_NULL_FIRST + ASC_NULL_LAST + DESC_NULL_LAST +} + +type _AggregateResult { + count: Int! +} + +input StringComparator { + eq: String + neq: String + contains: [String] + notContains: [String] + like: String + ilike: String + suffix: String + prefix: String + isNull: Boolean +} + +input IntComparator { + eq: Int + neq: Int + gt: Int + gte: Int + lt: Int + lte: Int + isNull: Boolean +} + +# Filter input for ProductAttributes (typed JSON) +input ProductAttributesFilterInput { + color: StringComparator + size: IntComparator + details: ProductDetailsFilterInput + AND: [ProductAttributesFilterInput] + OR: [ProductAttributesFilterInput] + NOT: ProductAttributesFilterInput +} + +input ProductDetailsFilterInput { + manufacturer: StringComparator + model: StringComparator + warranty: WarrantyInfoFilterInput + AND: [ProductDetailsFilterInput] + OR: [ProductDetailsFilterInput] + NOT: ProductDetailsFilterInput +} + +input WarrantyInfoFilterInput { + years: IntComparator + provider: StringComparator + AND: [WarrantyInfoFilterInput] + OR: [WarrantyInfoFilterInput] + NOT: WarrantyInfoFilterInput +} + +input SpecsFilterInput { + weight: FloatComparator + dimensions: DimensionsFilterInput + AND: [SpecsFilterInput] + OR: [SpecsFilterInput] + NOT: SpecsFilterInput +} + +input DimensionsFilterInput { + width: FloatComparator + height: FloatComparator + depth: FloatComparator + AND: [DimensionsFilterInput] + OR: [DimensionsFilterInput] + NOT: DimensionsFilterInput +} + +input FloatComparator { + eq: Float + neq: Float + gt: Float + gte: Float + lt: Float + lte: Float + isNull: Boolean +} + diff --git a/pkg/execution/builders/sql/testdata/schema_json_test_data.sql b/pkg/execution/builders/sql/testdata/schema_json_test_data.sql new file mode 100644 index 0000000..b78a09e --- /dev/null +++ b/pkg/execution/builders/sql/testdata/schema_json_test_data.sql @@ -0,0 +1,50 @@ +-- Test data for JSON field selection tests +-- This file contains example INSERT statements for testing JSON field extraction +-- +-- Usage: These can be used in integration tests or as reference for expected JSON structure +-- +-- Example product data with nested JSON attributes: + +INSERT INTO app.products (id, name, attributes, metadata) VALUES +-- Simple case: basic attributes +(1, 'Product 1', + '{"color": "red", "size": 10}'::jsonb, + '{"type": "premium", "price": 100}'::jsonb), + +-- Nested object: with details +(2, 'Product 2', + '{"color": "blue", "size": 20, "details": {"manufacturer": "Acme Corp", "model": "X-2000"}}'::jsonb, + '{"type": "standard", "price": 50}'::jsonb), + +-- Deep nesting: with warranty info +(3, 'Product 3', + '{"color": "green", "size": 15, "details": {"manufacturer": "Tech Inc", "model": "Y-3000", "warranty": {"years": 3, "provider": "TechCare"}}}'::jsonb, + '{"type": "premium", "price": 200}'::jsonb), + +-- Three-level nesting: with specs and dimensions +(4, 'Product 4', + '{"color": "black", "size": 25, "specs": {"weight": 2.5, "dimensions": {"width": 10.0, "height": 20.0, "depth": 5.0}}}'::jsonb, + '{"type": "premium", "price": 300}'::jsonb), + +-- Complex: all fields including nested objects +(5, 'Product 5', + '{"color": "white", "size": 30, "tags": ["new", "featured"], "details": {"manufacturer": "MegaCorp", "model": "Z-4000", "warranty": {"years": 5, "provider": "MegaCare"}}, "specs": {"weight": 3.0, "dimensions": {"width": 15.0, "height": 25.0, "depth": 8.0}}}'::jsonb, + '{"type": "premium", "price": 500, "featured": true}'::jsonb); + +-- Expected query results for reference: +-- +-- Query: { products { name, attributes { color, size } } } +-- Product 1: { name: "Product 1", attributes: { color: "red", size: 10 } } +-- Product 2: { name: "Product 2", attributes: { color: "blue", size: 20 } } +-- +-- Query: { products { name, attributes { color, details { manufacturer, model } } } } +-- Product 2: { name: "Product 2", attributes: { color: "blue", details: { manufacturer: "Acme Corp", model: "X-2000" } } } +-- +-- Query: { products { name, attributes { details { warranty { years, provider } } } } } +-- Product 3: { name: "Product 3", attributes: { details: { warranty: { years: 3, provider: "TechCare" } } } } +-- +-- Query: { products { name, attributes { specs { dimensions { width, height, depth } } } } } +-- Product 4: { name: "Product 4", attributes: { specs: { dimensions: { width: 10.0, height: 20.0, depth: 5.0 } } } } + + + diff --git a/pkg/execution/e2e_test.go b/pkg/execution/e2e_test.go index 81b6e69..426deb8 100644 --- a/pkg/execution/e2e_test.go +++ b/pkg/execution/e2e_test.go @@ -266,6 +266,68 @@ func TestE2E(t *testing.T) { assert.Equal(t, 1, result.DeletePosts.RowsAffected) }, }, + + // JSON Filtering Tests - Typed JSON (@json directive) + { + Name: "json/typed_filter_simple_field", + Query: `query { products(filter: { attributes: { color: { eq: "red" } } }) { name } }`, + Validate: func(t *testing.T, data json.RawMessage) { + var result struct { + Products []struct{ Name string } `json:"products"` + } + require.NoError(t, json.Unmarshal(data, &result)) + assert.Len(t, result.Products, 2) // Widget and Gizmo + names := []string{result.Products[0].Name, result.Products[1].Name} + assert.Contains(t, names, "Widget") + assert.Contains(t, names, "Gizmo") + }, + }, + { + Name: "json/typed_filter_nested_object", + Query: `query { products(filter: { attributes: { details: { manufacturer: { eq: "Acme" } } } }) { name } }`, + Validate: func(t *testing.T, data json.RawMessage) { + var result struct { + Products []struct{ Name string } `json:"products"` + } + require.NoError(t, json.Unmarshal(data, &result)) + assert.Len(t, result.Products, 2) // Widget and Gizmo + }, + }, + { + Name: "json/typed_filter_multiple_fields", + Query: `query { products(filter: { attributes: { color: { eq: "blue" }, size: { gt: 15 } } }) { name } }`, + Validate: func(t *testing.T, data json.RawMessage) { + var result struct { + Products []struct{ Name string } `json:"products"` + } + require.NoError(t, json.Unmarshal(data, &result)) + assert.Len(t, result.Products, 2) // Gadget (size 20) and Device (size 25) + }, + }, + { + Name: "json/typed_filter_with_AND", + Query: `query { products(filter: { attributes: { AND: [{ color: { eq: "red" } }, { size: { gt: 12 } }] } }) { name } }`, + Validate: func(t *testing.T, data json.RawMessage) { + var result struct { + Products []struct{ Name string } `json:"products"` + } + require.NoError(t, json.Unmarshal(data, &result)) + assert.Len(t, result.Products, 1) // Only Gizmo (red, size 15) + assert.Equal(t, "Gizmo", result.Products[0].Name) + }, + }, + { + Name: "json/typed_filter_with_OR", + Query: `query { products(filter: { attributes: { OR: [{ color: { eq: "green" } }, { size: { lt: 10 } }] } }) { name } }`, + Validate: func(t *testing.T, data json.RawMessage) { + var result struct { + Products []struct{ Name string } `json:"products"` + } + require.NoError(t, json.Unmarshal(data, &result)) + assert.Len(t, result.Products, 1) // Only Tool (green, size 5) + assert.Equal(t, "Tool", result.Products[0].Name) + }, + }, } for _, tc := range tests { diff --git a/pkg/schema/fastgql.go b/pkg/schema/fastgql.go index 4165ab4..313ddd6 100644 --- a/pkg/schema/fastgql.go +++ b/pkg/schema/fastgql.go @@ -27,7 +27,8 @@ var ( FastGQLSchema string //go:embed server.gotpl fastGqlServerTpl string - FastGQLDirectives = []string{tableDirectiveName, generateDirectiveName, "generateFilterInput", "isInterfaceFilter", skipGenerateDirectiveName, "generateMutations", relationDirectiveName} + FastGQLDirectives = []string{tableDirectiveName, generateDirectiveName, "generateFilterInput", "isInterfaceFilter", + skipGenerateDirectiveName, "generateMutations", jsonDirectiveName, relationDirectiveName} defaultAugmenters = []Augmenter{ MutationsAugmenter, PaginationAugmenter, diff --git a/pkg/schema/fastgql.graphql b/pkg/schema/fastgql.graphql index 053a1c9..2c7db77 100644 --- a/pkg/schema/fastgql.graphql +++ b/pkg/schema/fastgql.graphql @@ -1,131 +1,195 @@ -# ================== schema generation fastgql directives ================== - -# Generate Resolver directive tells fastgql to generate an automatic resolver for a given field -# @generateResolver can only be defined on Query and Mutation fields. -# adding pagination, ordering, aggregate, filter to false will disable the generation of the corresponding arguments -# for filter to work @generateFilterInput must be defined on the object, if its missing you will get an error -# recursive will generate pagination, filtering, ordering and aggregate for all the relations of the object, -# this will modify the object itself and add arguments to the object fields. -directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION - -# Generate mutations for an object -directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT - -# Generate filter input on an object -directive @generateFilterInput(description: String) repeatable on OBJECT | INTERFACE - -directive @isInterfaceFilter on INPUT_FIELD_DEFINITION - -# ================== Directives supported by fastgql for Querying ================== - -# Table directive is defined on OBJECTS, if no table directive is defined defaults are assumed -# i.e , "postgres", "" -directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE - -# Relation directive defines relations cross tables and dialects -directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION - -# This will make the field skipped in select, this is useful for fields that are not columns in the database, and you want to resolve it manually -directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION - -# Typename is the field name that will be used to resolve the type of the interface, -# default model is the default model that will be used to resolve the interface if none is found. -directive @typename(name: String!) on INTERFACE - -# =================== Default Scalar types supported by fastgql =================== -scalar Map -# ================== Default Filter input types supported by fastgql ================== - -enum _relationType { - ONE_TO_ONE - ONE_TO_MANY - MANY_TO_MANY -} - -enum _OrderingTypes { - ASC - DESC - ASC_NULL_FIRST - DESC_NULL_FIRST - ASC_NULL_LAST - DESC_NULL_LAST -} - -type _AggregateResult { - count: Int! -} - -input StringComparator { - eq: String - neq: String - contains: [String] - notContains: [String] - like: String - ilike: String - suffix: String - prefix: String - isNull: Boolean -} - -input StringListComparator { - eq: [String] - neq: [String] - contains: [String] - containedBy: [String] - overlap: [String] - isNull: Boolean -} - -input IntComparator { - eq: Int - neq: Int - gt: Int - gte: Int - lt: Int - lte: Int - isNull: Boolean -} - -input IntListComparator { - eq: [Int] - neq: [Int] - contains: [Int] - contained: [Int] - overlap: [Int] - isNull: Boolean -} - -input FloatComparator { - eq: Float - neq: Float - gt: Float - gte: Float - lt: Float - lte: Float - isNull: Boolean -} - -input FloatListComparator { - eq: [Float] - neq: [Float] - contains: [Float] - contained: [Float] - overlap: [Float] - isNull: Boolean -} - - -input BooleanComparator { - eq: Boolean - neq: Boolean - isNull: Boolean -} - -input BooleanListComparator { - eq: [Boolean] - neq: [Boolean] - contains: [Boolean] - contained: [Boolean] - overlap: [Boolean] - isNull: Boolean +# ================== schema generation fastgql directives ================== + +# Generate Resolver directive tells fastgql to generate an automatic resolver for a given field +# @generateResolver can only be defined on Query and Mutation fields. +# adding pagination, ordering, aggregate, filter to false will disable the generation of the corresponding arguments +# for filter to work @generateFilterInput must be defined on the object, if its missing you will get an error +# recursive will generate pagination, filtering, ordering and aggregate for all the relations of the object, +# this will modify the object itself and add arguments to the object fields. +directive @generate(filter: Boolean = True, pagination: Boolean = True, ordering: Boolean = True, aggregate: Boolean = True, recursive: Boolean = True, filterTypeName: String) on FIELD_DEFINITION + +# Generate mutations for an object +directive @generateMutations(create: Boolean = True, delete: Boolean = True, update: Boolean = True) on OBJECT + +# Generate filter input on an object +directive @generateFilterInput(description: String) repeatable on OBJECT | INTERFACE + +directive @isInterfaceFilter on INPUT_FIELD_DEFINITION + +# ================== Directives supported by fastgql for Querying ================== + +# Table directive is defined on OBJECTS, if no table directive is defined defaults are assumed +# i.e , "postgres", "" +directive @table(name: String!, dialect: String! = "postgres", schema: String = "") on OBJECT | INTERFACE + +# Relation directive defines relations cross tables and dialects +directive @relation(type: _relationType!, fields: [String!]!, references: [String!]!, manyToManyTable: String = "", manyToManyFields: [String] = [], manyToManyReferences: [String] = []) on FIELD_DEFINITION + +# This will make the field skipped in select, this is useful for fields that are not columns in the database, and you want to resolve it manually +directive @fastgqlField(skipSelect: Boolean = True) on FIELD_DEFINITION + +# Typename is the field name that will be used to resolve the type of the interface, +# default model is the default model that will be used to resolve the interface if none is found. +directive @typename(name: String!) on INTERFACE + +# JSON directive marks a field as stored in a JSONB column +directive @json(column: String!) on FIELD_DEFINITION + +# =================== Default Scalar types supported by fastgql =================== +scalar Map +# ================== Default Filter input types supported by fastgql ================== + +input IDComparator { + eq: ID + neq: ID + isNull: Boolean +} + +enum _relationType { + ONE_TO_ONE + ONE_TO_MANY + MANY_TO_MANY +} + +enum _OrderingTypes { + ASC + DESC + ASC_NULL_FIRST + DESC_NULL_FIRST + ASC_NULL_LAST + DESC_NULL_LAST +} + +type _AggregateResult { + count: Int! +} + +input StringComparator { + eq: String + neq: String + contains: [String] + notContains: [String] + like: String + ilike: String + suffix: String + prefix: String + isNull: Boolean +} + +input StringListComparator { + eq: [String] + neq: [String] + contains: [String] + containedBy: [String] + overlap: [String] + isNull: Boolean +} + +input IntComparator { + eq: Int + neq: Int + gt: Int + gte: Int + lt: Int + lte: Int + isNull: Boolean +} + +input IntListComparator { + eq: [Int] + neq: [Int] + contains: [Int] + contained: [Int] + overlap: [Int] + isNull: Boolean +} + +input FloatComparator { + eq: Float + neq: Float + gt: Float + gte: Float + lt: Float + lte: Float + isNull: Boolean +} + +input FloatListComparator { + eq: [Float] + neq: [Float] + contains: [Float] + contained: [Float] + overlap: [Float] + isNull: Boolean +} + + +input BooleanComparator { + eq: Boolean + neq: Boolean + isNull: Boolean +} + +input BooleanListComparator { + eq: [Boolean] + neq: [Boolean] + contains: [Boolean] + contained: [Boolean] + overlap: [Boolean] + isNull: Boolean +} + +# JSONPath-specific comparators (for @json directive fields) +# These comparators only include operators that can be implemented in PostgreSQL JSONPath +input JsonPathStringComparator { + eq: String + neq: String + gt: String + gte: String + lt: String + lte: String + like: String + ilike: String # Implemented using like_regex with "i" flag + prefix: String # Implemented using like_regex "^pattern" + suffix: String # Implemented using like_regex "pattern$" + contains: String # Implemented using like_regex "pattern" (substring) + isNull: Boolean + any: JsonPathStringComparator # Array operator + all: JsonPathStringComparator # Array operator +} + +input JsonPathIntComparator { + eq: Int + neq: Int + gt: Int + gte: Int + lt: Int + lte: Int + isNull: Boolean + any: JsonPathIntComparator + all: JsonPathIntComparator +} + +input JsonPathFloatComparator { + eq: Float + neq: Float + gt: Float + gte: Float + lt: Float + lte: Float + isNull: Boolean + any: JsonPathFloatComparator + all: JsonPathFloatComparator +} + +input JsonPathBooleanComparator { + eq: Boolean + neq: Boolean + isNull: Boolean +} + +input JsonPathIDComparator { + eq: ID + neq: ID + isNull: Boolean } \ No newline at end of file diff --git a/pkg/schema/fastgql.tpl b/pkg/schema/fastgql.tpl index c751e03..2aed9a6 100644 --- a/pkg/schema/fastgql.tpl +++ b/pkg/schema/fastgql.tpl @@ -1,25 +1,25 @@ -{{- if or (hasPrefix .Field.Name "create") (hasPrefix .Field.Name "delete") (hasPrefix .Field.Name "update") -}} -var data {{.Field.TypeReference.GO | deref}} -if err := r.Executor.Mutate(ctx, &data); err != nil { - return nil, err -} -return &data, nil -{{- else if eq .Field.TypeReference.Definition.Kind "INTERFACE" -}} -{{- reserveImport "reflect" -}} -var data {{.Field.TypeReference.GO | ref}} -if err := r.Executor.QueryWithTypes(ctx, &data, map[string]reflect.Type{ -{{- range $key, $value := .Implementors }} - {{$key|quote}}: reflect.TypeOf({{$value.Type | deref}}{}), -{{- end -}} -}, {{.ImplementorsTypeName|quote}}); err != nil { - return nil, err -} -return data, nil -{{- else -}} -var data {{.Field.TypeReference.GO | ref}} -if err := r.Executor.Query(ctx, &data); err != nil { - return nil, err -} -return data, nil -{{- end -}} - +{{- if or (hasPrefix .Field.Name "create") (hasPrefix .Field.Name "delete") (hasPrefix .Field.Name "update") -}} +var data {{.Field.TypeReference.GO | deref}} +if err := r.Executor.Mutate(ctx, &data); err != nil { + return nil, err +} +return &data, nil +{{- else if eq .Field.TypeReference.Definition.Kind "INTERFACE" -}} +{{- reserveImport "reflect" -}} +var data {{.Field.TypeReference.GO | ref}} +if err := r.Executor.QueryWithTypes(ctx, &data, map[string]reflect.Type{ +{{- range $key, $value := .Implementors }} + {{$key|quote}}: reflect.TypeOf({{$value.Type | deref}}{}), +{{- end -}} +}, {{.ImplementorsTypeName|quote}}); err != nil { + return nil, err +} +return data, nil +{{- else -}} +var data {{.Field.TypeReference.GO | ref}} +if err := r.Executor.Query(ctx, &data); err != nil { + return nil, err +} +return data, nil +{{- end -}} + diff --git a/pkg/schema/filter.go b/pkg/schema/filter.go index 51fcde6..e878a0a 100644 --- a/pkg/schema/filter.go +++ b/pkg/schema/filter.go @@ -3,6 +3,7 @@ package schema import ( "fmt" "log" + "sort" "strings" "github.com/iancoleman/strcase" @@ -111,6 +112,86 @@ func addFilterToQueryFieldArgs(s *ast.Schema, obj *ast.Definition, field *ast.Fi return nil } +// resolveScalarOrEnumComparator resolves comparators for scalar and enum types +func resolveScalarOrEnumComparator(s *ast.Schema, field *ast.FieldDefinition, fieldType *ast.Type) *ast.Definition { + if IsListType(field.Type) { + return s.Types[fmt.Sprintf("%sListComparator", fieldType.Name())] + } + return s.Types[fmt.Sprintf("%sComparator", fieldType.Name())] +} + +// resolveJsonPathScalarOrEnumComparator resolves JSONPath-specific comparators for JSON fields +func resolveJsonPathScalarOrEnumComparator(s *ast.Schema, field *ast.FieldDefinition, fieldType *ast.Type) *ast.Definition { + if IsListType(field.Type) { + // For arrays, we might need JsonPath*ListComparator in the future + // For now, return nil or handle differently + return nil + } + // Return JsonPath*Comparator types + comparatorName := fmt.Sprintf("JsonPath%sComparator", fieldType.Name()) + return s.Types[comparatorName] +} + +// resolveObjectFilterInput resolves filter input for object types in regular (non-JSON) context +func resolveObjectFilterInput(s *ast.Schema, fieldType *ast.Type) *ast.Definition { + return s.Types[fmt.Sprintf("%sFilterInput", fieldType.Name())] +} + +// resolveJsonObjectFilterInput resolves filter input for object types in JSON context +// Recursively creates nested JSON filter inputs if they don't exist +func resolveJsonObjectFilterInput(s *ast.Schema, fieldType *ast.Type, def *ast.Definition) *ast.Definition { + nestedFilterInputName := fmt.Sprintf("%sFilterInput", fieldType.Name()) + if _, exists := s.Types[nestedFilterInputName]; !exists { + createJsonTypeFilterInput(s, def, nestedFilterInputName) + } + return s.Types[nestedFilterInputName] +} + +// resolveFieldComparator resolves the appropriate comparator or filter input for a field type in regular context +// Returns nil if no comparator/filter input can be resolved +func resolveFieldComparator(s *ast.Schema, field *ast.FieldDefinition, fieldType *ast.Type, def *ast.Definition) *ast.Definition { + switch def.Kind { + case ast.Scalar, ast.Enum: + return resolveScalarOrEnumComparator(s, field, fieldType) + case ast.Object: + return resolveObjectFilterInput(s, fieldType) + case ast.Interface: + return resolveObjectFilterInput(s, fieldType) + } + return nil +} + +// addLogicalOperators adds AND, OR, and NOT logical operators to a filter input +func addLogicalOperators(input *ast.Definition, filterInputName string) { + input.Fields = append(input.Fields, []*ast.FieldDefinition{ + { + Name: "AND", + Description: "Logical AND of FilterInput", + Type: &ast.Type{ + Elem: &ast.Type{ + NamedType: filterInputName, + }, + }, + }, + { + Name: "OR", + Description: "Logical OR of FilterInput", + Type: &ast.Type{ + Elem: &ast.Type{ + NamedType: filterInputName, + }, + }, + }, + { + Name: "NOT", + Description: "Logical NOT of FilterInput", + Type: &ast.Type{ + NamedType: filterInputName, + }, + }, + }...) +} + func buildFilterInput(s *ast.Schema, input *ast.Definition, object *ast.Definition) { for _, field := range object.Fields { fieldType := GetType(field.Type) @@ -118,16 +199,23 @@ func buildFilterInput(s *ast.Schema, input *ast.Definition, object *ast.Definiti if !ok { continue } + + // Check if field has @json directive + hasJsonDirective := field.Directives.ForName("json") != nil + var fieldDef *ast.Definition - switch def.Kind { - case ast.Scalar, ast.Enum: - if IsListType(field.Type) { - fieldDef = s.Types[fmt.Sprintf("%sListComparator", fieldType.Name())] - } else { - fieldDef = s.Types[fmt.Sprintf("%sComparator", fieldType.Name())] + if hasJsonDirective && (def.Kind == ast.Object || def.Kind == ast.Interface) { + // For @json fields with object types, create a FilterInput for the JSON type + // This allows filtering like: attributes: { color: { eq: "red" } } + filterInputName := fmt.Sprintf("%sFilterInput", fieldType.Name()) + if _, exists := s.Types[filterInputName]; !exists { + // Create the FilterInput for this JSON type + createJsonTypeFilterInput(s, def, filterInputName) } - case ast.Object, ast.Interface: - fieldDef = s.Types[fmt.Sprintf("%sFilterInput", fieldType.Name())] + fieldDef = s.Types[filterInputName] + } else { + // Use the shared resolver for regular fields + fieldDef = resolveFieldComparator(s, field, fieldType, def) } if fieldDef == nil { @@ -142,48 +230,77 @@ func buildFilterInput(s *ast.Schema, input *ast.Definition, object *ast.Definiti // if object is an interface, we need to create a filter input for each of its implementations if object.IsAbstractType() { log.Printf("adding filter input for interface %s\n", object.Name) + // Collect implementation types and sort them for deterministic output + implTypes := make([]string, 0) for k, imps := range s.Implements { for _, d := range imps { if d.Name == object.Name { - log.Printf("adding filter input for interface implementation %s\n", k) - name := fmt.Sprintf("%sFilterInput", k) - input.Fields = append(input.Fields, &ast.FieldDefinition{ - Name: strcase.ToLowerCamel(k), - Type: &ast.Type{NamedType: name}, - Directives: []*ast.Directive{{Name: "isInterfaceFilter"}}, - }) - + implTypes = append(implTypes, k) } } } + sort.Strings(implTypes) + for _, k := range implTypes { + log.Printf("adding filter input for interface implementation %s\n", k) + name := fmt.Sprintf("%sFilterInput", k) + input.Fields = append(input.Fields, &ast.FieldDefinition{ + Name: strcase.ToLowerCamel(k), + Type: &ast.Type{NamedType: name}, + Directives: []*ast.Directive{{Name: "isInterfaceFilter"}}, + }) + } } - input.Fields = append(input.Fields, []*ast.FieldDefinition{ - { - Name: "AND", - Description: "Logical AND of FilterInput", - Type: &ast.Type{ - Elem: &ast.Type{ - NamedType: input.Name, - }, - }, - }, - { - Name: "OR", - Description: "Logical OR of FilterInput", - Type: &ast.Type{ - Elem: &ast.Type{ - NamedType: input.Name, - }, - }, - }, - { - Name: "NOT", - Description: "Logical NOT of FilterInput", - Type: &ast.Type{ - NamedType: input.Name, - }, - }, - }...) + addLogicalOperators(input, input.Name) +} + +// createJsonTypeFilterInput creates a FilterInput for a JSON object type +// This allows typed JSON fields to use the same filter structure as relations +func createJsonTypeFilterInput(s *ast.Schema, jsonType *ast.Definition, filterInputName string) { + log.Printf("creating filter input for JSON type %s\n", jsonType.Name) + + filterInput := &ast.Definition{ + Kind: ast.InputObject, + Description: fmt.Sprintf("Filter input for JSON type %s", jsonType.Name), + Name: filterInputName, + Fields: make([]*ast.FieldDefinition, 0), + } + + // Add field comparators for the JSON type fields + for _, field := range jsonType.Fields { + fieldType := GetType(field.Type) + def, ok := s.Types[fieldType.Name()] + if !ok { + continue + } + + var fieldDef *ast.Definition + switch def.Kind { + case ast.Scalar: + // Use JsonPath comparators for JSON fields + fieldDef = resolveJsonPathScalarOrEnumComparator(s, field, fieldType) + // If JsonPath comparator doesn't exist (e.g., for unsupported types), fall back to standard + if fieldDef == nil { + fieldDef = resolveScalarOrEnumComparator(s, field, fieldType) + } + case ast.Enum: + // For enums, use standard comparator (enums are just equality checks with ==) + fieldDef = resolveScalarOrEnumComparator(s, field, fieldType) + case ast.Object: + fieldDef = resolveJsonObjectFilterInput(s, fieldType, def) + } + + if fieldDef != nil { + filterInput.Fields = append(filterInput.Fields, &ast.FieldDefinition{ + Name: field.Name, + Type: &ast.Type{NamedType: fieldDef.Name}, + }) + } + } + + // Add logical operators + addLogicalOperators(filterInput, filterInputName) + + s.Types[filterInputName] = filterInput } // initInputs initialize all filter inputs before adding fields to avoid recursive reference diff --git a/pkg/schema/filter_test.go b/pkg/schema/filter_test.go index bdb6c32..3e93e8d 100644 --- a/pkg/schema/filter_test.go +++ b/pkg/schema/filter_test.go @@ -567,6 +567,326 @@ func Test_addFilterToMutationField(t *testing.T) { } } +// Test_FilterInput_JsonTypes tests filter generation for JSON fields +func Test_FilterInput_JsonTypes(t *testing.T) { + tests := []struct { + name string + schemaDefinition string + typeName string + expectedFilters map[string]string // field name -> filter type name + }{ + { + name: "creates_filter_input_for_json_object_type", + schemaDefinition: ` + type ProductAttributes { + color: String! + size: Int! + } + type Product @generateFilterInput { + id: ID! + name: String! + attributes: ProductAttributes @json(column: "attributes") + } + type Query { + products: [Product] + } + `, + typeName: "Product", + expectedFilters: map[string]string{ + "id": "IDComparator", + "name": "StringComparator", + "attributes": "ProductAttributesFilterInput", + }, + }, + { + name: "json_filter_input_uses_jsonpath_comparators", + schemaDefinition: ` + type ProductAttributes { + color: String! + size: Int! + isActive: Boolean! + } + type Product @generateFilterInput { + id: ID! + attributes: ProductAttributes @json(column: "attributes") + } + type Query { + products: [Product] + } + `, + typeName: "ProductAttributes", + expectedFilters: map[string]string{ + "color": "JsonPathStringComparator", + "size": "JsonPathIntComparator", + "isActive": "JsonPathBooleanComparator", + }, + }, + { + name: "creates_nested_filter_inputs_for_nested_json_types", + schemaDefinition: ` + type Address { + street: String! + city: String! + } + type UserProfile { + bio: String! + address: Address + } + type User @generateFilterInput { + id: ID! + profile: UserProfile @json(column: "profile") + } + type Query { + users: [User] + } + `, + typeName: "User", + expectedFilters: map[string]string{ + "id": "IDComparator", + "profile": "UserProfileFilterInput", + }, + }, + { + name: "handles_json_directive_fields", + schemaDefinition: ` + type ProductAttributes { + color: String! + } + type Product @generateFilterInput { + id: ID! + name: String! + attributes: ProductAttributes @json(column: "attributes") + } + type Query { + products: [Product] + } + `, + typeName: "Product", + expectedFilters: map[string]string{ + "id": "IDComparator", + "name": "StringComparator", + "attributes": "ProductAttributesFilterInput", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + schema := buildTestSchema(t, tt.schemaDefinition) + + // Run FilterInputAugmenter + err := FilterInputAugmenter(schema) + require.NoError(t, err) + + // Get the generated filter input + filterInputName := tt.typeName + "FilterInput" + filterInput, exists := schema.Types[filterInputName] + require.True(t, exists, "Filter input %s should exist", filterInputName) + + // Check expected filter fields + for fieldName, expectedFilterType := range tt.expectedFilters { + field := filterInput.Fields.ForName(fieldName) + assert.NotNil(t, field, "Expected field %s to exist in %s", fieldName, filterInputName) + if field != nil { + assert.Equal(t, expectedFilterType, field.Type.Name(), + "Field %s should have filter type %s", fieldName, expectedFilterType) + } + } + + // Verify logical operators are present + assert.NotNil(t, filterInput.Fields.ForName("AND"), "Expected AND operator") + assert.NotNil(t, filterInput.Fields.ForName("OR"), "Expected OR operator") + assert.NotNil(t, filterInput.Fields.ForName("NOT"), "Expected NOT operator") + }) + } +} + +// Test_createJsonTypeFilterInput tests the creation of filter inputs for JSON object types +func Test_createJsonTypeFilterInput(t *testing.T) { + tests := []struct { + name string + schemaDefinition string + jsonTypeName string + expectedFields []string + checkLogicalOps bool + }{ + { + name: "creates_filter_with_basic_scalar_fields", + schemaDefinition: ` + type ProductAttributes { + color: String! + size: Int! + available: Boolean! + } + `, + jsonTypeName: "ProductAttributes", + expectedFields: []string{ + "color", + "size", + "available", + "AND", + "OR", + "NOT", + }, + checkLogicalOps: true, + }, + { + name: "creates_filter_with_nested_object", + schemaDefinition: ` + type Address { + street: String! + city: String! + } + type UserProfile { + bio: String! + address: Address + } + `, + jsonTypeName: "UserProfile", + expectedFields: []string{ + "bio", + "address", + "AND", + "OR", + "NOT", + }, + checkLogicalOps: true, + }, + { + name: "handles_list_types", + schemaDefinition: ` + type Tags { + names: [String!] + counts: [Int!] + } + `, + jsonTypeName: "Tags", + expectedFields: []string{ + "names", + "counts", + "AND", + "OR", + "NOT", + }, + checkLogicalOps: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + schema := buildTestSchema(t, tt.schemaDefinition) + + jsonType := schema.Types[tt.jsonTypeName] + require.NotNil(t, jsonType, "JSON type %s should exist", tt.jsonTypeName) + + filterInputName := tt.jsonTypeName + "FilterInput" + + // Call createJsonTypeFilterInput + createJsonTypeFilterInput(schema, jsonType, filterInputName) + + // Verify the filter input was created + filterInput, exists := schema.Types[filterInputName] + require.True(t, exists, "Filter input %s should be created", filterInputName) + assert.Equal(t, ast.InputObject, filterInput.Kind) + + // Check expected fields + for _, fieldName := range tt.expectedFields { + field := filterInput.Fields.ForName(fieldName) + assert.NotNil(t, field, "Expected field %s to exist in %s", fieldName, filterInputName) + } + + // Verify logical operators if requested + if tt.checkLogicalOps { + andField := filterInput.Fields.ForName("AND") + orField := filterInput.Fields.ForName("OR") + notField := filterInput.Fields.ForName("NOT") + + assert.NotNil(t, andField, "AND operator should exist") + assert.NotNil(t, orField, "OR operator should exist") + assert.NotNil(t, notField, "NOT operator should exist") + + // Verify AND/OR are arrays and NOT is single + if andField != nil { + assert.NotNil(t, andField.Type.Elem, "AND should be an array type") + } + if orField != nil { + assert.NotNil(t, orField.Type.Elem, "OR should be an array type") + } + if notField != nil { + assert.Nil(t, notField.Type.Elem, "NOT should be a single type, not an array") + } + } + }) + } +} + +// Test_JsonFilter_NestedObjects tests deeply nested JSON object filter generation +func Test_JsonFilter_NestedObjects(t *testing.T) { + schemaDefinition := ` + type Location { + lat: Float! + lng: Float! + } + type Address { + street: String! + location: Location + } + type UserProfile { + bio: String! + address: Address + } + type User @generateFilterInput { + id: ID! + profile: UserProfile @json(column: "profile") + } + type Query { + users: [User] + } + ` + + schema := buildTestSchema(t, schemaDefinition) + + // Run FilterInputAugmenter + err := FilterInputAugmenter(schema) + require.NoError(t, err) + + // Verify all nested filter inputs were created + filterInputs := []string{ + "UserFilterInput", + "UserProfileFilterInput", + "AddressFilterInput", + "LocationFilterInput", + } + + for _, inputName := range filterInputs { + filterInput, exists := schema.Types[inputName] + assert.True(t, exists, "Filter input %s should exist", inputName) + if exists { + assert.Equal(t, ast.InputObject, filterInput.Kind) + // Verify logical operators + assert.NotNil(t, filterInput.Fields.ForName("AND")) + assert.NotNil(t, filterInput.Fields.ForName("OR")) + assert.NotNil(t, filterInput.Fields.ForName("NOT")) + } + } + + // Verify the field references are correct + userFilter := schema.Types["UserFilterInput"] + profileField := userFilter.Fields.ForName("profile") + require.NotNil(t, profileField) + assert.Equal(t, "UserProfileFilterInput", profileField.Type.Name()) + + profileFilter := schema.Types["UserProfileFilterInput"] + addressField := profileFilter.Fields.ForName("address") + require.NotNil(t, addressField) + assert.Equal(t, "AddressFilterInput", addressField.Type.Name()) + + addressFilter := schema.Types["AddressFilterInput"] + locationField := addressFilter.Fields.ForName("location") + require.NotNil(t, locationField) + assert.Equal(t, "LocationFilterInput", locationField.Type.Name()) +} + // buildTestSchema is a helper to build a schema from a GraphQL SDL string func buildTestSchema(t *testing.T, schemaSDL string) *ast.Schema { t.Helper() diff --git a/pkg/schema/gql_test.go b/pkg/schema/gql_test.go index ee2169e..c18eb94 100644 --- a/pkg/schema/gql_test.go +++ b/pkg/schema/gql_test.go @@ -308,3 +308,5 @@ func Test_GetDirectiveValue_NilDirective(t *testing.T) { result := GetDirectiveValue(nil, "anyArg") assert.Nil(t, result, "Should return nil for nil directive") } + + diff --git a/pkg/schema/schema.go b/pkg/schema/schema.go index c009eb7..8e70669 100644 --- a/pkg/schema/schema.go +++ b/pkg/schema/schema.go @@ -20,6 +20,7 @@ const ( skipGenerateDirectiveName = "skipGenerate" tableDirectiveName = "table" relationDirectiveName = "relation" + jsonDirectiveName = "json" ) type TableDirective struct { @@ -50,6 +51,10 @@ type RelationDirective struct { ManyToManyFields []string } +type JSONDirective struct { + Column string +} + func GetTableDirective(def *ast.Definition) (*TableDirective, error) { d := def.Directives.ForName("table") if d == nil { @@ -80,6 +85,16 @@ func GetRelationDirective(field *ast.FieldDefinition) *RelationDirective { } } +func GetJSONDirective(field *ast.FieldDefinition) *JSONDirective { + d := field.Directives.ForName(jsonDirectiveName) + if d == nil { + return nil + } + return &JSONDirective{ + Column: cast.ToString(GetDirectiveValue(d, "column")), + } +} + func getArgumentValue(args ast.ArgumentList, name string) string { arg := args.ForName(name) if arg == nil { diff --git a/pkg/schema/testdata/base_filter_only_fastgql_expected.graphql b/pkg/schema/testdata/base_filter_only_fastgql_expected.graphql index 49745cb..a873373 100644 --- a/pkg/schema/testdata/base_filter_only_fastgql_expected.graphql +++ b/pkg/schema/testdata/base_filter_only_fastgql_expected.graphql @@ -1,15 +1,16 @@ -input ObjectFilterInput { - name: StringComparator - """ - Logical AND of FilterInput - """ - AND: [ObjectFilterInput] - """ - Logical OR of FilterInput - """ - OR: [ObjectFilterInput] - """ - Logical NOT of FilterInput - """ - NOT: ObjectFilterInput +input ObjectFilterInput { + id: IDComparator + name: StringComparator + """ + Logical AND of FilterInput + """ + AND: [ObjectFilterInput] + """ + Logical OR of FilterInput + """ + OR: [ObjectFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: ObjectFilterInput } \ No newline at end of file diff --git a/pkg/schema/testdata/mutations_fastgql_filter_expected.graphql b/pkg/schema/testdata/mutations_fastgql_filter_expected.graphql index 6f5963b..16076aa 100644 --- a/pkg/schema/testdata/mutations_fastgql_filter_expected.graphql +++ b/pkg/schema/testdata/mutations_fastgql_filter_expected.graphql @@ -1,68 +1,69 @@ -""" -Graphql Mutations -""" -type Mutation { - """ - AutoGenerated input for Object - """ - createObjects(inputs: [CreateObjectInput!]!): ObjectsPayload - """ - AutoGenerated input for Object - """ - deleteObjects( - """ - cascade on delete - """ - cascade: Boolean, - """ - Filter deleteObjects - """ - filter: ObjectFilterInput): ObjectsPayload @generate(filter: true, filterTypeName: "ObjectFilterInput") - """ - AutoGenerated input for Object - """ - updateObjects(input: UpdateObjectInput!, - """ - Filter updateObjects - """ - filter: ObjectFilterInput): ObjectsPayload @generate(filter: true, filterTypeName: "ObjectFilterInput") -} -input ObjectFilterInput { - name: StringComparator - """ - Logical AND of FilterInput - """ - AND: [ObjectFilterInput] - """ - Logical OR of FilterInput - """ - OR: [ObjectFilterInput] - """ - Logical NOT of FilterInput - """ - NOT: ObjectFilterInput -} -""" -Autogenerated payload object -""" -type ObjectsPayload { - """ - rows affection by mutation - """ - rows_affected: Int! - objects: [Object] -} -""" -AutoGenerated input for Object -""" -input CreateObjectInput { - id: ID! - name: String! -} -""" -AutoGenerated update input for Object -""" -input UpdateObjectInput { - id: ID - name: String +""" +Graphql Mutations +""" +type Mutation { + """ + AutoGenerated input for Object + """ + createObjects(inputs: [CreateObjectInput!]!): ObjectsPayload + """ + AutoGenerated input for Object + """ + deleteObjects( + """ + cascade on delete + """ + cascade: Boolean, + """ + Filter deleteObjects + """ + filter: ObjectFilterInput): ObjectsPayload @generate(filter: true, filterTypeName: "ObjectFilterInput") + """ + AutoGenerated input for Object + """ + updateObjects(input: UpdateObjectInput!, + """ + Filter updateObjects + """ + filter: ObjectFilterInput): ObjectsPayload @generate(filter: true, filterTypeName: "ObjectFilterInput") +} +input ObjectFilterInput { + id: IDComparator + name: StringComparator + """ + Logical AND of FilterInput + """ + AND: [ObjectFilterInput] + """ + Logical OR of FilterInput + """ + OR: [ObjectFilterInput] + """ + Logical NOT of FilterInput + """ + NOT: ObjectFilterInput +} +""" +Autogenerated payload object +""" +type ObjectsPayload { + """ + rows affection by mutation + """ + rows_affected: Int! + objects: [Object] +} +""" +AutoGenerated input for Object +""" +input CreateObjectInput { + id: ID! + name: String! +} +""" +AutoGenerated update input for Object +""" +input UpdateObjectInput { + id: ID + name: String } \ No newline at end of file