TypModOut decodes type modifier in int32 format to string representation of it.
(ctx *sql.Context, val int32)
| 1041 | |
| 1042 | // TypModOut decodes type modifier in int32 format to string representation of it. |
| 1043 | func (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. |
| 1059 | func (t *DoltgresType) ValueType() reflect.Type { |
no test coverage detected