From 882511dc8c0abded18ba6abdca64938db2652771 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Wed, 23 Sep 2026 03:32:15 -0300 Subject: lift retaining, membership and mode checks out of ephemeral relation --- lib/protocols/Cursor.ml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/protocols/Cursor.ml') diff --git a/lib/protocols/Cursor.ml b/lib/protocols/Cursor.ml index 36db97d..75dc77d 100644 --- a/lib/protocols/Cursor.ml +++ b/lib/protocols/Cursor.ml @@ -26,6 +26,13 @@ let rec next i = | Some (_, tuple) -> Ok (Some tuple) | None -> if batch.exhausted then Ok None else next i +let rec exists i p = + let open Utilities.Result in + let* found = next i in + match found with + | None -> Ok false + | Some tuple -> if p tuple then Ok true else exists i p + let drain i ?(limit = 256) () = let open Utilities.Result in let rec loop tuples = -- cgit v1.2.3