mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Add demo
This commit is contained in:
parent
02b1f1f9db
commit
509e5a003f
@ -26,6 +26,17 @@ namespace OrmTest
|
|||||||
Db.Queryable<UnitArrayTestaa>()
|
Db.Queryable<UnitArrayTestaa>()
|
||||||
.OrderBy(it=>it.Id)
|
.OrderBy(it=>it.Id)
|
||||||
.Where(it => SqlFunc.JsonArrayAny(it.ids, 1)).ToList();
|
.Where(it => SqlFunc.JsonArrayAny(it.ids, 1)).ToList();
|
||||||
|
|
||||||
|
Db.CodeFirst.InitTables<UnitArrayLongtest1>();
|
||||||
|
Db.DbMaintenance.TruncateTable<UnitArrayLongtest1>();
|
||||||
|
Db.Insertable(new UnitArrayLongtest1()
|
||||||
|
{
|
||||||
|
ids = new int[] { 1, 2 },
|
||||||
|
Name="a"
|
||||||
|
}).ExecuteCommand();
|
||||||
|
var x=Db.Queryable<UnitArrayLongtest1>()
|
||||||
|
.Where(it => SqlFunc.PgsqlArrayContains(it.ids , 1))
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +48,14 @@ namespace OrmTest
|
|||||||
[SqlSugar.SugarColumn(IsJson =true)]
|
[SqlSugar.SugarColumn(IsJson =true)]
|
||||||
public int[] ids { get; set; }
|
public int[] ids { get; set; }
|
||||||
}
|
}
|
||||||
|
public class UnitArrayLongtest1
|
||||||
|
{
|
||||||
|
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
[SqlSugar.SugarColumn(IsArray = true,ColumnDataType ="int4[]")]
|
||||||
|
public int[] ids { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class UnitJsonTest
|
public class UnitJsonTest
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user