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

Method IoInput

server/types/type.go:603–619  ·  view source on GitHub ↗

IoInput converts input string value to given type value.

(ctx *sql.Context, input string)

Source from the content-addressed store, hash-verified

601
602// IoInput converts input string value to given type value.
603func (t *DoltgresType) IoInput(ctx *sql.Context, input string) (any, error) {
604 if t.TypType == TypeType_Domain {
605 return globalFunctionRegistry.GetFunction(ctx, t.InputFunc).CallVariadic(ctx, input, t.BaseTypeType.ID.AsId(), t.attTypMod)
606 } else if t.ModInFunc != 0 || t.IsArrayType() {
607 if t.Elem.ID != id.NullType {
608 return globalFunctionRegistry.GetFunction(ctx, t.InputFunc).CallVariadic(ctx, input, t.Elem.ID.AsId(), t.attTypMod)
609 } else {
610 return globalFunctionRegistry.GetFunction(ctx, t.InputFunc).CallVariadic(ctx, input, t.ID.AsId(), t.attTypMod)
611 }
612 } else if t.TypType == TypeType_Enum {
613 return globalFunctionRegistry.GetFunction(ctx, t.InputFunc).CallVariadic(ctx, input, t.ID.AsId())
614 } else if t.IsCompositeType() {
615 return ParseCompositeLiteral(ctx, input, t)
616 } else {
617 return globalFunctionRegistry.GetFunction(ctx, t.InputFunc).CallVariadic(ctx, input)
618 }
619}
620
621// IoOutput converts given type value to output string.
622func (t *DoltgresType) IoOutput(ctx *sql.Context, val any) (string, error) {

Callers 15

ConvertToTypeMethod · 0.95
nextRowMethod · 0.80
nextRowMethod · 0.80
DiffFromRowFunction · 0.80
EvalMethod · 0.80
convertBindParametersMethod · 0.80
ParseCompositeLiteralFunction · 0.80
varchar.goFile · 0.80
to_regtype.goFile · 0.80
bpchar.goFile · 0.80
jsonb.goFile · 0.80
array.goFile · 0.80

Calls 6

IsArrayTypeMethod · 0.95
IsCompositeTypeMethod · 0.95
ParseCompositeLiteralFunction · 0.85
CallVariadicMethod · 0.65
GetFunctionMethod · 0.45
AsIdMethod · 0.45

Tested by

no test coverage detected