Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Codec-based decoding via `CodecRegistry.decode(oid, format_code, data)`. Extende
`Codec` interface with `encode`/`decode`/`format` methods. Built-in codecs are primitives:
- Binary codecs (`_binary_codecs.pony`): `_BoolBinaryCodec`, `_ByteaBinaryCodec`, `_Int2BinaryCodec`, `_Int4BinaryCodec`, `_Int8BinaryCodec`, `_Float4BinaryCodec`, `_Float8BinaryCodec`, `_DateBinaryCodec`, `_TimeBinaryCodec`, `_TimestampBinaryCodec`, `_IntervalBinaryCodec`, `_OidBinaryCodec`, `_NumericBinaryCodec` (encode implemented: parses decimal string → base-10000 digit format; handles positive/negative integers, fractional values, zero, NaN, Infinity/-Infinity), `_UuidBinaryCodec`, `_JsonbBinaryCodec` — big-endian wire encoding
- Text passthrough binary codec (`_text_passthrough_binary_codec.pony`): `_TextPassthroughBinaryCodec` — for text-like OIDs (char, name, text, json, xml, bpchar, varchar) where PostgreSQL binary format is raw UTF-8
- Text codecs (`_text_codecs.pony`): `_BoolTextCodec`, `_ByteaTextCodec`, `_Int2TextCodec`, `_Int4TextCodec`, `_Int8TextCodec`, `_Float4TextCodec`, `_Float8TextCodec`, `_DateTextCodec`, `_TimeTextCodec`, `_TimestampTextCodec`, `_TimestamptzTextCodec`, `_IntervalTextCodec`, `_TextPassthroughTextCodec`, `_OidTextCodec`, `_NumericTextCodec`, `_UuidTextCodec`, `_JsonbTextCodec`
- Text codecs (`_text_codecs.pony`): `_BoolTextCodec`, `_ByteaTextCodec`, `_Int2TextCodec`, `_Int4TextCodec`, `_Int8TextCodec`, `_Float4TextCodec`, `_Float8TextCodec`, `_DateTextCodec`, `_TimeTextCodec`, `_TimestampTextCodec`, `_TimestamptzTextCodec`, `_IntervalTextCodec` (supports all four `intervalstyle` formats: `postgres`, `postgres_verbose`, `iso_8601`, `sql_standard` — detected via heuristic in `decode()`), `_TextPassthroughTextCodec`, `_OidTextCodec`, `_NumericTextCodec`, `_UuidTextCodec`, `_JsonbTextCodec`
- `_ArrayOidMap` (`_array_oid_map.pony`): static bidirectional mapping between element OIDs and array OIDs (23 entries). Methods: `element_oid_for(array_oid)`, `array_oid_for(element_oid)`, `is_array_oid(oid)`
- `_ArrayEncoder` (`_array_encoder.pony`): encodes `PgArray` to binary array wire format. Dispatches element encoding on Pony runtime types. String elements routed by `element_oid`: uuid → `_UuidBinaryCodec`, jsonb → `_JsonbBinaryCodec`, oid → `_OidBinaryCodec`, numeric → `_NumericBinaryCodec`; all others → raw UTF-8 bytes. Coupling: element encoding must stay in sync with `_FrontendMessage.bind()` and `_binary_codecs.pony`
- `CodecRegistry` (`codec_registry.pony`): maps OIDs to codecs. Adds `_custom_array_element_oids: Map[U32, U32] val` field for custom array type registrations. Default constructor populates all built-ins. `with_codec(oid, codec)` returns a new registry with the codec added/replaced. `with_array_type(array_oid, element_oid)` returns a new registry with the custom array mapping added. `array_oid_for(element_oid): U32` returns the array OID for the given element OID. `decode()` intercepts array OIDs before normal codec dispatch. `has_binary_codec()` checks array OIDs too. `_with_codec` constructor (type-private) used internally by `with_codec`
Expand Down
27 changes: 27 additions & 0 deletions postgres/_test.pony
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,33 @@ actor \nodoc\ Main is TestList
test(_TestIntervalTextCodecNegativeDays)
test(_TestIntervalTextCodecFractionalSeconds)
test(_TestIntervalTextCodecEncode)
test(_TestIntervalTextCodecPostgresMixedSign)
test(_TestIntervalTextCodecISO8601Full)
test(_TestIntervalTextCodecISO8601YearOnly)
test(_TestIntervalTextCodecISO8601TimeOnly)
test(_TestIntervalTextCodecISO8601DaysOnly)
test(_TestIntervalTextCodecISO8601Negative)
test(_TestIntervalTextCodecISO8601Fractional)
test(_TestIntervalTextCodecISO8601Zero)
test(_TestIntervalTextCodecISO8601FullFractional)
test(_TestIntervalTextCodecISO8601NegativeFractional)
test(_TestIntervalTextCodecVerboseFull)
test(_TestIntervalTextCodecVerboseAgo)
test(_TestIntervalTextCodecVerboseMixedAgo)
test(_TestIntervalTextCodecVerboseZero)
test(_TestIntervalTextCodecVerboseFractional)
test(_TestIntervalTextCodecVerboseDaysOnly)
test(_TestIntervalTextCodecVerboseNegNoAgo)
test(_TestIntervalTextCodecVerboseNegFractional)
test(_TestIntervalTextCodecSQLFullMixed)
test(_TestIntervalTextCodecSQLYearMonthOnly)
test(_TestIntervalTextCodecSQLNegYearMonth)
test(_TestIntervalTextCodecSQLDayTime)
test(_TestIntervalTextCodecSQLTimeOnly)
test(_TestIntervalTextCodecSQLZero)
test(_TestIntervalTextCodecSQLNegDayTime)
test(_TestIntervalTextCodecSQLFractional)
test(_TestIntervalTextCodecSQLZeroYM)
test(_TestPgTimestampString)
test(_TestPgDateString)
test(_TestPgTimeString)
Expand Down
Loading
Loading