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

Method TypModOut

server/types/type.go:1043–1056  ·  view source on GitHub ↗

TypModOut decodes type modifier in int32 format to string representation of it.

(ctx *sql.Context, val int32)

Source from the content-addressed store, hash-verified

1041
1042// TypModOut decodes type modifier in int32 format to string representation of it.
1043func (t *DoltgresType) TypModOut(ctx *sql.Context, val int32) (string, error) {
1044 if t.ModOutFunc == 0 {
1045 return "", errors.Errorf("typmodout function for type '%s' doesn't exist", t.Name())
1046 }
1047 o, err := globalFunctionRegistry.GetFunction(ctx, t.ModOutFunc).CallVariadic(ctx, val)
1048 if err != nil {
1049 return "", err
1050 }
1051 output, ok := o.(string)
1052 if !ok {
1053 return "", errors.Errorf(`expected string, got %T`, output)
1054 }
1055 return output, nil
1056}
1057
1058// ValueType implements the types.ExtendedType interface.
1059func (t *DoltgresType) ValueType() reflect.Type {

Callers 1

StringMethod · 0.95

Calls 4

NameMethod · 0.95
ErrorfMethod · 0.65
CallVariadicMethod · 0.65
GetFunctionMethod · 0.45

Tested by

no test coverage detected