MCPcopy Create free account
hub / github.com/jackc/pgx / quoteArrayElementIfNeeded

Function quoteArrayElementIfNeeded

pgtype/array.go:379–384  ·  view source on GitHub ↗
(src string)

Source from the content-addressed store, hash-verified

377}
378
379func quoteArrayElementIfNeeded(src string) string {
380 if src == "" || (len(src) == 4 && strings.EqualFold(src, "null")) || isSpace(src[0]) || isSpace(src[len(src)-1]) || strings.ContainsAny(src, `{},"\`) {
381 return quoteArrayElement(src)
382 }
383 return src
384}
385
386// Array represents a PostgreSQL array for T. It implements the [ArrayGetter] and [ArraySetter] interfaces. It preserves
387// PostgreSQL dimensions and custom lower bounds. Use [FlatArray] if these are not needed.

Callers 1

EncodeMethod · 0.85

Calls 2

isSpaceFunction · 0.85
quoteArrayElementFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…