Skip to content

Commit

Permalink
完善 DuckDB
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Aug 21, 2024
1 parent 109ad58 commit 8ab5372
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 28 deletions.
13 changes: 13 additions & 0 deletions Extensions/FreeSql.Extensions.JsonMap/JsonMapCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public static void UseJsonMap(this IFreeSql fsql, JsonSerializerSettings setting
case DataType.OdbcOracle:
case DataType.CustomOracle:
case DataType.Dameng:
case DataType.DuckDB:
fsql.Aop.ParseExpression += (_, e) =>
{
//if (e.Expression is MethodCallExpression callExp)
Expand Down Expand Up @@ -164,6 +165,9 @@ public static void UseJsonMap(this IFreeSql fsql, JsonSerializerSettings setting
case DataType.Dameng:
StyleJsonValue();
return;
case DataType.DuckDB:
StyleDotAccess();
return;
}
StylePgJson();
return;
Expand All @@ -186,6 +190,15 @@ void StyleJsonValue()
}
e.Result = $"json_value({result},'${jsonPath}')";
}
void StyleDotAccess()
{
while (parentMemExps.Any())
{
memExp = parentMemExps.Pop();
result = $"{result}['{memExp.Member.Name}']";
}
e.Result = result;
}
void StylePgJson()
{
while (parentMemExps.Any())
Expand Down
Loading

0 comments on commit 8ab5372

Please sign in to comment.