Skip to content
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

Support mapping jsonpath #3334

Merged
merged 1 commit into from
Oct 28, 2024
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: 2 additions & 0 deletions src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ static NpgsqlTypeMappingSource()
private readonly NpgsqlCharacterCharTypeMapping _singleChar = new("character(1)");
private readonly NpgsqlStringTypeMapping _xml = new("xml", NpgsqlDbType.Xml);
private readonly NpgsqlStringTypeMapping _citext = new("citext", NpgsqlDbType.Citext);
private readonly NpgsqlStringTypeMapping _jsonpath = new("jsonpath", NpgsqlDbType.JsonPath);

// JSON mappings - EF owned entity support
private readonly NpgsqlOwnedJsonTypeMapping _jsonbOwned = new("jsonb");
Expand Down Expand Up @@ -234,6 +235,7 @@ public NpgsqlTypeMappingSource(
{ "text", [_text] },
{ "jsonb", [_jsonbString, _jsonbDocument, _jsonbElement] },
{ "json", [_jsonString, _jsonDocument, _jsonElement] },
{ "jsonpath", [_jsonpath] },
{ "xml", [_xml] },
{ "citext", [_citext] },
{ "character varying", [_varchar] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class NpgsqlTypeMappingSourceTest
[InlineData("geometry(POLYGONM)", typeof(Polygon), null, null, null, false)]
[InlineData("xid", typeof(uint), null, null, null, false)]
[InlineData("xid8", typeof(ulong), null, null, null, false)]
[InlineData("jsonpath", typeof(string), null, null, null, false)]
public void By_StoreType(string typeName, Type type, int? size, int? precision, int? scale, bool fixedLength)
{
var mapping = CreateTypeMappingSource().FindMapping(typeName);
Expand Down