MCPcopy
hub / github.com/ent/ent / pgTextPath

Method pgTextPath

dialect/sql/sqljson/sqljson.go:572–585  ·  view source on GitHub ↗

pgTextPath writes the JSON path in PostgreSQL text format: `"a"->'b'->>'c'`.

(b *sql.Builder)

Source from the content-addressed store, hash-verified

570
571// pgTextPath writes the JSON path in PostgreSQL text format: `"a"->'b'->>'c'`.
572func (p *PathOptions) pgTextPath(b *sql.Builder) {
573 b.Ident(p.Ident)
574 for i, s := range p.Path {
575 b.WriteString("->")
576 if p.Unquote && i == len(p.Path)-1 {
577 b.WriteString(">")
578 }
579 if idx, ok := isJSONIdx(s); ok {
580 b.WriteString(idx)
581 } else {
582 b.WriteString("'" + s + "'")
583 }
584 }
585}
586
587// pgArrayPath writes the JSON path in PostgreSQL array text[] format: '{a,1,b}'.
588func (p *PathOptions) pgArrayPath(b *sql.Builder) {

Callers 2

valueMethod · 0.95
lengthMethod · 0.95

Calls 3

isJSONIdxFunction · 0.85
IdentMethod · 0.80
WriteStringMethod · 0.80

Tested by

no test coverage detected