Skip to content

Read and write the binary formats as byte slices - #37

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:io/wkb-byte-slices
Nov 1, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:io/wkb-byte-slices

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

A generated type writes its WKB and EWKB as a []byte and reads them from
one, the length carried by the slice, as the catalog's shape states the
buffer: a size_t * the shape lists in outParams is the length of the
buffer the call answers, so it leaves the signature, and a uint8_t array
it lists in inputArrays is taken as a []byte whose length fills the
parameter the shape names. Temporal.AsWKB(variant) answers a []byte,
TemporalFromWKB(wkb []byte) and TGeomPointFromEWKB(wkb []byte) read one,
and the hex writers, AsHexWKB and AsHexEWKB, answer their string with no
size to pass. The flat layer's TakeBytes copies the buffer MEOS answers
into Go memory and frees MEOS's, as every wrapper answering a char *
frees it once C.GoString has copied it: 149 methods take the forms, 134
of them a []byte.

Examples are named Example_ where the identifier they show is
the generated package's, as go vet reads an example's name.

Measured: the 128 root examples pass under TZ=UTC, a temporal point
written as EWKB and read back from the bytes writing the same bytes; the
functions, types and root packages build with no go vet finding, and the
parity tests pass.

A generated type writes its WKB and EWKB as a []byte and reads them from
one, the length carried by the slice, as the catalog's shape states the
buffer: a size_t * the shape lists in outParams is the length of the
buffer the call answers, so it leaves the signature, and a uint8_t array
it lists in inputArrays is taken as a []byte whose length fills the
parameter the shape names. Temporal.AsWKB(variant) answers a []byte,
TemporalFromWKB(wkb []byte) and TGeomPointFromEWKB(wkb []byte) read one,
and the hex writers, AsHexWKB and AsHexEWKB, answer their string with no
size to pass. The flat layer's TakeBytes copies the buffer MEOS answers
into Go memory and frees MEOS's, as every wrapper answering a char *
frees it once C.GoString has copied it: 149 methods take the forms, 134
of them a []byte.

Examples are named Example_<suffix> where the identifier they show is
the generated package's, as go vet reads an example's name.

Measured: the 128 root examples pass under TZ=UTC, a temporal point
written as EWKB and read back from the bytes writing the same bytes; the
functions, types and root packages build with no go vet finding, and the
parity tests pass.
@estebanzimanyi
estebanzimanyi merged commit f2d91ca into MobilityDB:main Nov 1, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the io/wkb-byte-slices branch November 1, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant