DeepInsert inserts a value at a path in a JSON document. Implements the jsonb_insert builtin.
(j JSON, path []string, to JSON, insertAfter bool)
| 2312 | // DeepInsert inserts a value at a path in a JSON document. |
| 2313 | // Implements the jsonb_insert builtin. |
| 2314 | func DeepInsert(j JSON, path []string, to JSON, insertAfter bool) (JSON, error) { |
| 2315 | if j.isScalar() { |
| 2316 | return nil, errCannotSetPathInScalar |
| 2317 | } |
| 2318 | return deepInsert(j, path, to, insertAfter) |
| 2319 | } |
| 2320 | |
| 2321 | func deepInsert(j JSON, path []string, to JSON, insertAfter bool) (JSON, error) { |
| 2322 | switch len(path) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…