Skip to content

SQL builder fro JSON_CONTAINS to search multiple values in a JSON array #139

Open
@avishbran

Description

@avishbran

Your Question

Is there a way to build an SQL query that searches multiple-values (not multiple keys) in a JSON array?

SELECT * FROM table WHERE JSON_CONTAINS(obj->'$.array_of_ints', [1,2,3]);

for: { "obj": {"array_of_ints":[1,2,3,4]} } the result will be TRUE.

Or:

SELECT * FROM table WHERE JSON_CONTAINS(obj->'$.array_of_ints', 2);

for: { "obj":{"array_of_ints":[1,2,3,4]} } the result will be TRUE.

The document you expected this should be explained

https://gorm.io/docs/data_types.html

Expected answer

Would like to know the methods to generate a JSON_CONTAINS SQL query using SQLBuilder

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions