Is there a query that implements something like `QueryFirst`, `QueryFirstOrDefault`?
vitash opened this issue · 2 comments
vitash commented
The following code queries the first data by id:
let findById id = task {
let! data =
select {
for u in Tbl do
where (u.id = id)
take 1
} |> conn.SelectAsync<'a>
return data |> Seq.tryHead
}
It would be simpler to have something like QueryFirstOrDefault
and want the return value to be of option
type.
Dzoukr commented
I think it's rather about personal taste so I'll keep that for custom project-specific wrappers.
vitash commented
Got it. Thanks.