Skip to content

Support custom JSON coders #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2020

Conversation

jordanebelanger
Copy link
Contributor

@jordanebelanger jordanebelanger commented Sep 4, 2020

Add support for custom, non-Foundation, JSON encoder & decoder through global variables PostgresNIO._defaultJSONEncoder and PostgresNIO._defaultJSONDecoder (#125, fixes #126).

* add a `PostgresJSONEncoder` protocol with an API that mirrors the Foundation `JSONEncoder`'s decoding function

* add global `_defaultJSONEncoder` variable used in the JSON and JSONB type and that is defaulted to a Foundation `JSONEncoder`

* add a `PostgresJSONDecoder` protocol with an API that mirrors the Foundation `JSONDecoder`'s decoding function

* add global `_defaultJSONDecoder` variable used in the JSON and JSONB type and that is defaulted to a Foundation `JSONDecoder`
@jordanebelanger
Copy link
Contributor Author

Initial comment from previous PR by @tanner0101 #125 (review)

Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@tanner0101 tanner0101 changed the title Support custom json coders Support custom JSON coders Sep 9, 2020
@tanner0101 tanner0101 merged commit 3cf2496 into vapor:master Sep 9, 2020
@tanner0101
Copy link
Member

These changes are now available in 1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support custom json decoder and encoder when dealing with JSON/JSONB columns
2 participants