MCPcopy Create free account
hub / github.com/dolthub/doltgresql / VectorToString

Function VectorToString

server/types/utils.go:223–240  ·  view source on GitHub ↗

VectorToString is used for *vectorout functions, to serialize vector values for wire transfer.

(ctx *sql.Context, arr []any, baseType *DoltgresType)

Source from the content-addressed store, hash-verified

221
222// VectorToString is used for *vectorout functions, to serialize vector values for wire transfer.
223func VectorToString(ctx *sql.Context, arr []any, baseType *DoltgresType) (string, error) {
224 sb := strings.Builder{}
225 for i, v := range arr {
226 if i > 0 {
227 sb.WriteString(" ")
228 }
229 if v != nil {
230 str, err := baseType.IoOutput(ctx, v)
231 if err != nil {
232 return "", err
233 }
234 sb.WriteString(quoteString(str))
235 } else {
236 sb.WriteString("NULL")
237 }
238 }
239 return sb.String(), nil
240}
241
242// ParseCompositeLiteral parses a Postgres composite literal string like "(1,2,hello)" into a slice
243// of RecordValues using the field types from |compositeType|.

Callers

nothing calls this directly

Calls 4

quoteStringFunction · 0.85
WriteStringMethod · 0.80
IoOutputMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected