Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(query): support complex SQL where conditions #2878

Merged
merged 1 commit into from
Nov 29, 2024
Merged

Conversation

farnabaz
Copy link
Member

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Introduce orWhere and andWhere query functions to create complex where conditions

queryCollection('docs')
    .where('extension', '=', 'md')
    .or(group => group
      .where('navigation', '<>', 'false')
      .where('navigation', 'IS NULL'),
    )

Result will be:
select * from _content_docs where extension = 'md' AND (navigation <> 'false' OR navigation IS NULL)

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

pkg-pr-new bot commented Nov 29, 2024

npm i https://pkg.pr.new/@nuxt/content@2878

commit: 0acfe83

@farnabaz farnabaz merged commit 7f8f128 into v3 Nov 29, 2024
3 of 4 checks passed
@farnabaz farnabaz deleted the feat/query-or-and branch November 29, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant