Postgres: JSON and custom payload serializers - #164
Merged
Conversation
Non-string Listen/Notify payloads round-trip via System.Text.Json by default, with PostgresPayloadSerializers registration for custom formats on both R3 and Reactive paths (#158).
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.
Summary
T, Mqtt/Nats-shapedPostgresPayloadSerializersregistration)FromListen<T>/FromNotify<T>while keeping the string golden-path overloads unchangedCloses #158
Test plan
dotnet run --project build/_build.csproj -- --target Test --configuration Release --test-domains postgresNote
Medium Risk
Expands the public contract and NOTIFY wire format for typed interfaces (JSON by default); deserialization errors surface on the observable stream. Trimming/AOT callers must heed
RequiresUnreferencedCodeon JSON paths—mitigated by preserving string behavior and test coverage.Overview
Adds payload serialization for PostgreSQL LISTEN/NOTIFY:
PostgresPayloadSerializers(global default + per-type registration), with UTF-8 strings and System.Text.Json for other types by default, and hooks for custom wire formats.R3 (
PostgresObservable) and System.Reactive (SystemReactivePostgresAdapter) gain genericFromListen<T>/FromNotify<T>that serialize/deserialize through that pipeline; existing string overloads are unchanged.The source generator now allows non-
stringpayload types on[Listen]/[Notify]and emits the matching generic bridge calls (verified snapshots for R3 and Reactive). E2E and unit tests cover JSON round-trips and a custom colon-delimited serializer.Reviewed by Cursor Bugbot for commit a3eeda1. Configure here.