Read Slice(UInt8) as String if given as type #221
Merged
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.
Fixes #43
In order to support the citext extension in Avram, we need to be able to treat the column as a String. Two solutions were laid out in the connected issue:
rs.read(String)
on a string-like column (citext, enum or similar), it should return a String.rs.read
on a string-like column, it should probably also return a String.B was considered the more "complete solution" but also the more complicated. Since it's been 4 years since the issue was opened and over a year since the potential solutions were laid out, I went with the more immediate option A. If the read type is
Slice(UInt8)
, which is the type of a citext column, and#read
was called with a type ofString
, then convert it to String. This helps with citext interop and I'm sure it helps with other column types as well.