MCPcopy
hub / github.com/ent/ent / mysqlPath

Method mysqlPath

dialect/sql/sqljson/sqljson.go:556–569  ·  view source on GitHub ↗

mysqlPath writes the JSON path in MySQL (or SQLite) format.

(b *sql.Builder)

Source from the content-addressed store, hash-verified

554
555// mysqlPath writes the JSON path in MySQL (or SQLite) format.
556func (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'`.
572func (p *PathOptions) pgTextPath(b *sql.Builder) {

Callers 6

mysqlFuncMethod · 0.95
ValueIsNullFunction · 0.80
ValueIsNotNullFunction · 0.80
ValueContainsFunction · 0.80
AppendMethod · 0.80
AppendMethod · 0.80

Calls 5

isJSONIdxFunction · 0.85
isQuotedFunction · 0.85
isIdentifierFunction · 0.85
WriteStringMethod · 0.80
WriteByteMethod · 0.80

Tested by

no test coverage detected