Adding new custom operations: andWhereIf, orWhereIf.
They get bool condition as first parameter and acts as andWhere, orWhere if condition holds and do nothing otherwise.
It allows to optionally extend WHERE condition based on parameters outside of query.
let pos = Some 10
let posOr = Some 2
select {
for p in personTable do
where (p.Position > 5)
andWhereIf pos.IsSome (p.Position < pos.Value)
orWhereIf posOr.IsSome (p.Position < posOr.Value)
} |> conn.SelectAsync<Person>
Adding new custom operations:
andWhereIf
,orWhereIf
.They get
bool
condition as first parameter and acts asandWhere
,orWhere
if condition holds and do nothing otherwise.It allows to optionally extend WHERE condition based on parameters outside of query.