objective categorical abstract machine language personal data server
65
fork

Configure Feed

Select the types of activity you want to include in your feed.

Always get records by path

futurGH 492b0512 9276173c

+7 -18
+4 -5
pegasus/lib/repository.ml
··· 163 163 let%lwt map = get_map t in 164 164 Lwt.return @@ String_map.find_opt path map 165 165 166 - let get_record t path : record option Lwt.t = 167 - User_store.get_record_by_path t.db path 166 + let get_record t path : record option Lwt.t = User_store.get_record t.db path 168 167 169 168 let list_collections t : string list Lwt.t = 170 169 let module Set = Set.Make (String) in ··· 184 183 String.starts_with ~prefix:(path ^ "/") collection ) 185 184 |> Lwt_list.fold_left_s 186 185 (fun acc (path, cid) -> 187 - match%lwt User_store.get_record_by_cid t.db cid with 186 + match%lwt User_store.get_record t.db path with 188 187 | Some record -> 189 188 Lwt.return 190 189 ((Format.sprintf "at://%s/%s" t.did path, cid, record) :: acc) ··· 321 320 let%lwt () = 322 321 match old_cid with 323 322 | Some _ -> ( 324 - match%lwt User_store.get_record_by_path t.db path with 323 + match%lwt User_store.get_record t.db path with 325 324 | Some record -> 326 325 let refs = 327 326 Util.find_blob_refs record.value ··· 366 365 (Format.sprintf "attempted to delete record %s with cid %s" 367 366 path cid_str ) ) ; 368 367 let%lwt () = 369 - match%lwt User_store.get_record_by_path t.db path with 368 + match%lwt User_store.get_record t.db path with 370 369 | Some record -> 371 370 let refs = 372 371 Util.find_blob_refs record.value
+3 -13
pegasus/lib/user_store.ml
··· 162 162 |sql}] 163 163 () conn 164 164 165 - let get_record_by_path = 165 + let get_record = 166 166 [%rapper 167 167 get_opt 168 168 {sql| SELECT @CID{cid}, @Blob{data}, @string{since} FROM records WHERE path = %string{path} |sql}] 169 - 170 - let get_record_by_cid = 171 - [%rapper 172 - get_opt 173 - {sql| SELECT @string{path}, @Blob{data}, @string{since} FROM records WHERE cid = %CID{cid} |sql}] 174 169 175 170 let list_records = 176 171 [%rapper ··· 388 383 389 384 (* records *) 390 385 391 - let get_record_by_path t path : record option Lwt.t = 392 - Util.use_pool t.db @@ Queries.get_record_by_path ~path 386 + let get_record t path : record option Lwt.t = 387 + Util.use_pool t.db @@ Queries.get_record ~path 393 388 >|= Option.map (fun (cid, data, since) -> 394 - {path; cid; value= Lex.of_cbor data; since} ) 395 - 396 - let get_record_by_cid t cid : record option Lwt.t = 397 - Util.use_pool t.db @@ Queries.get_record_by_cid ~cid 398 - >|= Option.map (fun (path, data, since) -> 399 389 {path; cid; value= Lex.of_cbor data; since} ) 400 390 401 391 let list_records t ?(limit = 100) ?(cursor = "") ?(reverse = false) collection :