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

Add JSON structure to where clause. #877

Open
1 task
josephmancuso opened this issue Mar 12, 2024 · 0 comments
Open
1 task

Add JSON structure to where clause. #877

josephmancuso opened this issue Mar 12, 2024 · 0 comments
Assignees
Labels
enhancement A feature that exists, works as intended but needs to be improved feature request A feature that does not yet exist but will be a good addition to the library major This issue can only be done in a major release because there are some breaking changes

Comments

@josephmancuso
Copy link
Member

josephmancuso commented Mar 12, 2024

Describe the feature as you'd like to see it
We should be able to query JSON column data.

i think we can use the arrow -> here to compile something like.

# Masonite
ModelName.select("meta->active", 1).get()
# MySQL
SELECT json_column->'field_name' FROM your_table;

Postgres is similar

# Postgres
SELECT json_column->'field_name' FROM your_table;

SQLite is a little different

# SQLite
SELECT json_extract(column_name, '$.field_name') FROM your_table;

What do we currently have to do now?
dont have anything

Additional context
https://laravel.com/docs/10.x/queries#json-where-clauses

  • Is this a breaking change?
@josephmancuso josephmancuso added enhancement A feature that exists, works as intended but needs to be improved feature request A feature that does not yet exist but will be a good addition to the library labels Mar 12, 2024
@josephmancuso josephmancuso added the major This issue can only be done in a major release because there are some breaking changes label Apr 7, 2024
@eaguad1337 eaguad1337 self-assigned this Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature that exists, works as intended but needs to be improved feature request A feature that does not yet exist but will be a good addition to the library major This issue can only be done in a major release because there are some breaking changes
Projects
Status: No status
Development

No branches or pull requests

2 participants