TypModIn encodes given text array value to type modifier in int32 format.
(ctx *sql.Context, val []any)
| 1025 | |
| 1026 | // TypModIn encodes given text array value to type modifier in int32 format. |
| 1027 | func (t *DoltgresType) TypModIn(ctx *sql.Context, val []any) (int32, error) { |
| 1028 | if t.ModInFunc == 0 { |
| 1029 | return 0, errors.Errorf("typmodin function for type '%s' doesn't exist", t.Name()) |
| 1030 | } |
| 1031 | o, err := globalFunctionRegistry.GetFunction(ctx, t.ModInFunc).CallVariadic(ctx, val) |
| 1032 | if err != nil { |
| 1033 | return 0, err |
| 1034 | } |
| 1035 | output, ok := o.(int32) |
| 1036 | if !ok { |
| 1037 | return 0, errors.Errorf(`expected int32, got %T`, output) |
| 1038 | } |
| 1039 | return output, nil |
| 1040 | } |
| 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) { |
nothing calls this directly
no test coverage detected