mysqlPath writes the JSON path in MySQL (or SQLite) format.
(b *sql.Builder)
| 554 | |
| 555 | // mysqlPath writes the JSON path in MySQL (or SQLite) format. |
| 556 | func (p *PathOptions) mysqlPath(b *sql.Builder) { |
| 557 | b.WriteString(`'$`) |
| 558 | for _, p := range p.Path { |
| 559 | switch _, isIndex := isJSONIdx(p); { |
| 560 | case isIndex: |
| 561 | b.WriteString(p) |
| 562 | case p == "*" || isQuoted(p) || isIdentifier(p): |
| 563 | b.WriteString("." + p) |
| 564 | default: |
| 565 | b.WriteString(`."` + p + `"`) |
| 566 | } |
| 567 | } |
| 568 | b.WriteByte('\'') |
| 569 | } |
| 570 | |
| 571 | // pgTextPath writes the JSON path in PostgreSQL text format: `"a"->'b'->>'c'`. |
| 572 | func (p *PathOptions) pgTextPath(b *sql.Builder) { |
no test coverage detected