Map hstore to ImmutableDictionary#1492
Merged
roji merged 1 commit intonpgsql:mainfrom Oct 3, 2020
Merged
Conversation
roji
commented
Sep 8, 2020
| protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters) | ||
| => new NpgsqlImmutableHstoreTypeMapping(parameters); | ||
|
|
||
| sealed class HstoreComparer : ValueComparer<ImmutableDictionary<string, string>> |
Member
Author
There was a problem hiding this comment.
/cc @ajcvickers for a really nice use of a .NET immutable type for version tracking purposes. tl;dr PG has a type called "hstore", which corresponds to .NET Dictionary<string, string?>. This PR also allows you to map hstore to .NET ImmutableDictionary<string, string?>, which (hopefully) efficiently creates copies on updates. This means we can do simple reference comparisons, and skip actually snapshotting altogether.
Could be interesting to think about for other types (e.g. ImmutableArray for mapping blobs/varbinary??).
2b3be6f to
56e7007
Compare
03814c1 to
ca162bf
Compare
ca162bf to
41b3664
Compare
YohDeadfall
reviewed
Oct 3, 2020
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.
Closes #1491
Replaces #1184
Note: this PR currently fails since the provider uses Npgsql 4.1, which doesn't yet have support for ImmutableDictionary (npgsql/npgsql#2776). Once we take a dependency on a newer 5.0 preview everything should work.
/cc @Quogu