Closed vitash closed 3 months ago
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.
QueryFirstOrDefault
option
I think it's rather about personal taste so I'll keep that for custom project-specific wrappers.
Got it. Thanks.
The following code queries the first data by id:
It would be simpler to have something like
QueryFirstOrDefault
and want the return value to be ofoption
type.