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

Method SerializeValue

server/types/type.go:1118–1128  ·  view source on GitHub ↗

SerializeValue implements the types.ExtendedType interface.

(ctx context.Context, val any)

Source from the content-addressed store, hash-verified

1116
1117// SerializeValue implements the types.ExtendedType interface.
1118func (t *DoltgresType) SerializeValue(ctx context.Context, val any) ([]byte, error) {
1119 if val == nil {
1120 return nil, nil
1121 }
1122 sqlCtx, _ := ctx.(*sql.Context) // There are cases where it's okay to serialize with a nil SQL context
1123 if t.SerializationFunc != nil {
1124 return t.SerializationFunc(sqlCtx, t, val)
1125 }
1126 // If there's not a built-in serialization function, then we'll use the `send` function instead
1127 return t.CallSend(sqlCtx, val)
1128}
1129
1130// DeserializeValue implements the types.ExtendedType interface.
1131func (t *DoltgresType) DeserializeValue(ctx context.Context, val []byte) (any, error) {

Callers 6

ConvertSerializedMethod · 0.95
serializeTypeRecordFunction · 0.80
serializeArrayFunction · 0.80
TestLegacyJsonBRoundTripFunction · 0.80

Calls 1

CallSendMethod · 0.95

Tested by 3

TestLegacyJsonBRoundTripFunction · 0.64