value writes the path for getting the JSON value.
(b *sql.Builder)
| 511 | |
| 512 | // value writes the path for getting the JSON value. |
| 513 | func (p *PathOptions) value(b *sql.Builder) { |
| 514 | switch { |
| 515 | case len(p.Path) == 0: |
| 516 | b.Ident(p.Ident) |
| 517 | case b.Dialect() == dialect.Postgres: |
| 518 | if p.Cast != "" { |
| 519 | b.WriteByte('(') |
| 520 | defer b.WriteString(")::" + p.Cast) |
| 521 | } |
| 522 | p.pgTextPath(b) |
| 523 | default: |
| 524 | if p.Unquote && b.Dialect() == dialect.MySQL { |
| 525 | b.WriteString("JSON_UNQUOTE(") |
| 526 | defer b.WriteByte(')') |
| 527 | } |
| 528 | p.mysqlFunc("JSON_EXTRACT", b) |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | // value writes the path for getting the length of a JSON value. |
| 533 | func (p *PathOptions) length(b *sql.Builder) { |
nothing calls this directly
no test coverage detected