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

Method IoOutput

server/types/type.go:622–642  ·  view source on GitHub ↗

IoOutput converts given type value to output string.

(ctx *sql.Context, val any)

Source from the content-addressed store, hash-verified

620
621// IoOutput converts given type value to output string.
622func (t *DoltgresType) IoOutput(ctx *sql.Context, val any) (string, error) {
623 var o any
624 var err error
625 if t.ModInFunc != 0 || t.IsArrayType() || t.IsCompositeType() {
626 send := globalFunctionRegistry.GetFunction(ctx, t.OutputFunc)
627 resolvedTypes := send.ResolvedTypes()
628 resolvedTypes[0] = t
629 o, err = send.WithResolvedTypes(resolvedTypes).(QuickFunction).CallVariadic(ctx, val)
630 } else {
631 o, err = globalFunctionRegistry.GetFunction(ctx, t.OutputFunc).CallVariadic(ctx, val)
632 }
633 if err != nil {
634 return "", err
635 }
636 var ok bool
637 os, ok, err := sql.Unwrap[string](ctx, o)
638 if !ok {
639 return "", errors.Errorf("unexpected type for io output, expected string, got %T", val)
640 }
641 return os, err
642}
643
644// IsArrayType returns true if the type is of 'array' type.
645// It can be array category with empty its array attribute NULL and element attribute NOT NULL.

Callers 15

ToRowMethod · 0.80
EvalMethod · 0.80
sqlStringFunction · 0.80
ArrToStringFunction · 0.80
RecordToStringFunction · 0.80
VectorToStringFunction · 0.80
varchar.goFile · 0.80
bpchar.goFile · 0.80
getStringArrFromAnyArrayFunction · 0.80
nextval.goFile · 0.80
concat.goFile · 0.80

Calls 7

IsArrayTypeMethod · 0.95
IsCompositeTypeMethod · 0.95
ResolvedTypesMethod · 0.65
CallVariadicMethod · 0.65
WithResolvedTypesMethod · 0.65
ErrorfMethod · 0.65
GetFunctionMethod · 0.45

Tested by

no test coverage detected