Repository navigation
Print every type as its asText and read and write every format - #36
Merged
estebanzimanyi merged 2 commits intoNov 1, 2026
Merged
Conversation
The flat functions and the object layer are those tools/codegen.py and tools/objectgen.py write from the catalog of MobilityDB 91f8d676e7 and MEOS-API 9069a08: 4702 wrappers and 150 classes with 1781 methods. Every temporal and set type MEOS holds by pointer has its class: TH3Index, TQuadbin and TS2Cell under TCellIndex, TPcpoint, TPcpatch and TPoseChain under TSpatial, the cell, point cloud and pose chain sets under SpatialSet, GeomSet and GeogSet under GeoSet, and JsonbSet under Set; and each format method takes its portable spelling, AsHexWKB, AsHexEWKB, FromHexWKB, FromHexEWKB, AsGeoJSON and FromGeoJSON. A method may not share the name of the struct its class embeds, so a method whose name is its parent's takes the name of its SQL function: jsonbset_set, which reads set on JsonbSet, whose parent is Set, is JsonbsetSet, as its SQL function jsonbsetSet. Measured: the functions and types packages build with no go vet finding, the parity tests pass, and the 122 examples of the root package pass under TZ=UTC, as the workflow runs them.
A generated type's String writes the text the catalog's typeEncodings names for its type, the function behind the SQL asText: AsText for a spatial value, tspatial_as_text, spatialset_as_text, cbuffer_as_text and their siblings, which write the points as WKT, and the type's Out for the others; a type writing what it inherits states no String of its own, and a MEOS error is written as fmt writes a failure, %!s(MEOS error: ...). Every type reads and writes each format the catalog gives it under the portable name: As<Format> and <Class>From<Format> for Text, EWKT, WKB, HexWKB, EWKB, HexEWKB and MFJSON, each the function readers and writers name for the type's SQL name, else the one decoders and encoders name for its C type, the class or an ancestor having no method of that name. Each forwards to the method or function the catalog function backs, and a reader answers its own class, so TGeomPointFromEWKB is TemporalFromWKB answering a *TGeomPoint: 285 methods over 150 classes, 59 of which print through String. The classes are emitted parents first, so a class reaches what its ancestors emit, as MEOS.NET's tools/objectgen.py does. Measured: the root examples, 127 of them under TZ=UTC with example_types_io_test.go reading a temporal point from its text, EWKT and hex EWKB and printing it, a circular buffer and a span, pass; the functions and types packages build with no go vet finding, and the parity tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A generated type's String writes the text the catalog's typeEncodings
names for its type, the function behind the SQL asText: AsText for a
spatial value, tspatial_as_text, spatialset_as_text, cbuffer_as_text and
their siblings, which write the points as WKT, and the type's Out for the
others; a type writing what it inherits states no String of its own, and
a MEOS error is written as fmt writes a failure, %!s(MEOS error: ...).
Every type reads and writes each format the catalog gives it under the
portable name: As and From for Text, EWKT, WKB,
HexWKB, EWKB, HexEWKB and MFJSON, each the function readers and writers
name for the type's SQL name, else the one decoders and encoders name
for its C type, the class or an ancestor having no method of that name.
Each forwards to the method or function the catalog function backs, and
a reader answers its own class, so TGeomPointFromEWKB is TemporalFromWKB
answering a *TGeomPoint: 285 methods over 150 classes, 59 of which print
through String. The classes are emitted parents first, so a class reaches
what its ancestors emit, as MEOS.NET's tools/objectgen.py does.
Measured: the root examples, 127 of them under TZ=UTC with
example_types_io_test.go reading a temporal point from its text, EWKT
and hex EWKB and printing it, a circular buffer and a span, pass; the
functions and types packages build with no go vet finding, and the
parity tests pass.