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

Function serializeTypeBytea

server/types/bytea.go:64–73  ·  view source on GitHub ↗

serializeTypeBytea handles serialization from the standard representation to our serialized representation that is written in Dolt.

(ctx *sql.Context, t *DoltgresType, val any)

Source from the content-addressed store, hash-verified

62// serializeTypeBytea handles serialization from the standard representation to our serialized representation that is
63// written in Dolt.
64func serializeTypeBytea(ctx *sql.Context, t *DoltgresType, val any) ([]byte, error) {
65 res, err := sql.UnwrapAny(ctx, val)
66 if err != nil {
67 return nil, err
68 }
69 str := res.([]byte)
70 writer := utils.NewWriter(uint64(len(str) + 4))
71 writer.ByteSlice(str)
72 return writer.Data(), nil
73}
74
75// deserializeTypeBytea handles deserialization from the Dolt serialized format to our standard representation used by
76// expressions and nodes.

Callers

nothing calls this directly

Calls 4

ByteSliceMethod · 0.95
DataMethod · 0.95
NewWriterFunction · 0.92
UnwrapAnyMethod · 0.80

Tested by

no test coverage detected