Discover Packages
github.com/dracory/neat
examples
json-queries
command
Version:
v0.48.0
Opens a new window with list of versions in this module.
Published: Sep 15, 2026
License: AGPL-3.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: ? modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
README
README
¶
JSON Queries
This example demonstrates JSON query functionality for querying and updating JSON columns in your database.
Features Demonstrated
Querying JSON fields for specific values using WhereJsonContains
Querying JSON arrays for values
Checking if JSON keys exist using WhereJsonContainsKey
Checking JSON array length using WhereJsonLength
Array indexing in JSON queries
Updating JSON fields with path notation
Combining multiple JSON query conditions
Running the Example
cd examples/json-queries
go run main.go
Running Tests
cd examples/json-queries
go test -v
Prerequisites
SQLite database (or modify the DSN to use your preferred database)
The example creates a products table with a JSON attributes column
Database Support
JSON query functions are supported for:
SQLite : Uses json_extract, json_type, and json_array_length functions
MySQL : Uses JSON_CONTAINS, JSON_CONTAINS_PATH, and JSON_LENGTH functions
PostgreSQL : Uses JSON functions (implementation may vary)
Example JSON Path Syntax
column->field - Access nested field
column->field->nested - Access deeply nested field
column->array->0 - Access array element by index
Expand ▾
Collapse ▴
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.