JSONEach returns JSON_EACH SQLite string expression with some normalizations for non-json columns.
(column string)
| 8 | // JSONEach returns JSON_EACH SQLite string expression with |
| 9 | // some normalizations for non-json columns. |
| 10 | func JSONEach(column string) string { |
| 11 | // note: we are not using the new and shorter "if(x,y)" syntax for |
| 12 | // compatibility with custom drivers that use older SQLite version |
| 13 | return fmt.Sprintf( |
| 14 | `json_each(CASE WHEN iif(json_valid([[%s]]), json_type([[%s]])='array', FALSE) THEN [[%s]] ELSE json_array([[%s]]) END)`, |
| 15 | column, column, column, column, |
| 16 | ) |
| 17 | } |
| 18 | |
| 19 | // JSONArrayLength returns JSON_ARRAY_LENGTH SQLite string expression |
| 20 | // with some normalizations for non-json columns. |
no outgoing calls
searching dependent graphs…