mirror of
https://github.com/grafana/grafana.git
synced 2024-12-28 01:41:24 -06:00
Backend style guide: Document JSON guidelines (#30267)
* Backend style guide: Document JSON guidelines Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
parent
6ce5740e64
commit
4e37941cc4
@ -89,3 +89,12 @@ for context.
|
||||
### Unique columns
|
||||
|
||||
If a column, or column combination, should be unique, add a corresponding uniqueness constraint through a migration.
|
||||
|
||||
## JSON
|
||||
|
||||
The simplejson package is used a lot throughout the backend codebase, but it's legacy, so if at all possible
|
||||
avoid using it in new code. Use [json-iterator](https://github.com/json-iterator/go) instead, which is a more performant
|
||||
drop-in alternative to the standard [encoding/json](https://golang.org/pkg/encoding/json/) package. While encoding/json
|
||||
is a fine choice, profiling shows that json-iterator may be 3-4 times more efficient for encoding. We haven't profiled
|
||||
its parsing performance yet, but according to json-iterator's own benchmarks, it appears even more superior in this
|
||||
department.
|
||||
|
Loading…
Reference in New Issue
Block a user