mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 增加 pgsql 表达式树解析 hstore[""];
This commit is contained in:
parent
44e6eb2979
commit
441309e0d0
@ -175,9 +175,10 @@ namespace FreeSql.Tests.PostgreSQLExpression
|
||||
[Fact]
|
||||
public void HStore()
|
||||
{
|
||||
|
||||
var sql1 = select.Where(a => a.testFieldHStore.ContainsKey("a")).ToList();
|
||||
var sql2 = select.Where(a => a.testFieldHStore.ContainsKey("a") == false).ToList();
|
||||
|
||||
var sql3 = select.Where(a => a.testFieldHStore["a"] == "xxx").ToList();
|
||||
}
|
||||
|
||||
[Table(Name = "tb_alltype")]
|
||||
|
@ -118,11 +118,12 @@ namespace FreeSql.KingbaseES
|
||||
if (objType != null || objType.IsArrayOrList())
|
||||
{
|
||||
string left = null;
|
||||
if (objType.FullName == typeof(Dictionary<string, string>).FullName)
|
||||
if (objType == typeof(Dictionary<string, string>))
|
||||
{
|
||||
left = objExp == null ? null : getExp(objExp);
|
||||
switch (callExp.Method.Name)
|
||||
{
|
||||
case "get_Item": return $"{left}->{getExp(callExp.Arguments[argIndex])}";
|
||||
case "Contains":
|
||||
var right = getExp(callExp.Arguments[argIndex]);
|
||||
return $"({left} @> ({right}))";
|
||||
|
@ -118,11 +118,12 @@ namespace FreeSql.Odbc.KingbaseES
|
||||
if (objType != null || objType.IsArrayOrList())
|
||||
{
|
||||
string left = null;
|
||||
if (objType.FullName == typeof(Dictionary<string, string>).FullName)
|
||||
if (objType == typeof(Dictionary<string, string>))
|
||||
{
|
||||
left = objExp == null ? null : getExp(objExp);
|
||||
switch (callExp.Method.Name)
|
||||
{
|
||||
case "get_Item": return $"{left}->{getExp(callExp.Arguments[argIndex])}";
|
||||
case "Contains":
|
||||
var right = getExp(callExp.Arguments[argIndex]);
|
||||
return $"({left} @> ({right}))";
|
||||
|
@ -118,11 +118,12 @@ namespace FreeSql.Odbc.PostgreSQL
|
||||
if (objType != null || objType.IsArrayOrList())
|
||||
{
|
||||
string left = null;
|
||||
if (objType.FullName == typeof(Dictionary<string, string>).FullName)
|
||||
if (objType == typeof(Dictionary<string, string>))
|
||||
{
|
||||
left = objExp == null ? null : getExp(objExp);
|
||||
switch (callExp.Method.Name)
|
||||
{
|
||||
case "get_Item": return $"{left}->{getExp(callExp.Arguments[argIndex])}";
|
||||
case "Contains":
|
||||
var right = getExp(callExp.Arguments[argIndex]);
|
||||
return $"({left} @> ({right}))";
|
||||
@ -206,7 +207,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (memParentExp.FullName == typeof(Dictionary<string, string>).FullName)
|
||||
if (memParentExp == typeof(Dictionary<string, string>))
|
||||
{
|
||||
var left = getExp(memExp.Expression);
|
||||
switch (memExp.Member.Name)
|
||||
|
@ -149,11 +149,12 @@ namespace FreeSql.PostgreSQL
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (objType.FullName == typeof(Dictionary<string, string>).FullName)
|
||||
if (objType == typeof(Dictionary<string, string>))
|
||||
{
|
||||
left = objExp == null ? null : getExp(objExp);
|
||||
switch (callExp.Method.Name)
|
||||
{
|
||||
case "get_Item": return $"{left}->{getExp(callExp.Arguments[argIndex])}";
|
||||
case "Contains":
|
||||
var right = getExp(callExp.Arguments[argIndex]);
|
||||
return $"({left} @> ({right}))";
|
||||
@ -237,7 +238,7 @@ namespace FreeSql.PostgreSQL
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (memParentExp.FullName == typeof(Dictionary<string, string>).FullName)
|
||||
if (memParentExp == typeof(Dictionary<string, string>))
|
||||
{
|
||||
var left = getExp(memExp.Expression);
|
||||
switch (memExp.Member.Name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user