MasoniteFramework / orm

Masonite ORM is a beautiful Python ORM. It's also a nearly drop in replacement of the Orator ORM
https://orm.masoniteproject.com
MIT License
160 stars 47 forks source link

Add JSON structure to where clause. #877

Open josephmancuso opened 3 months ago

josephmancuso commented 3 months ago

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