objective categorical abstract machine language personal data server
65
fork

Configure Feed

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

Move blobs to last column of tables + list_records iteration

futurGH 77185095 ec99c68e

+9 -5
+9 -5
pegasus/lib/user_store.ml
··· 146 146 {sql| CREATE TABLE IF NOT EXISTS records ( 147 147 path TEXT NOT NULL PRIMARY KEY, 148 148 cid TEXT NOT NULL, 149 - data BLOB NOT NULL, 150 - since TEXT NOT NULL 149 + since TEXT NOT NULL, 150 + data BLOB NOT NULL 151 151 ); 152 152 CREATE INDEX IF NOT EXISTS records_cid_idx ON records (cid); 153 153 |sql}] ··· 166 166 let list_records = 167 167 [%rapper 168 168 get_many 169 - {sql| SELECT @string{path}, @CID{cid}, @Blob{data}, @string{since} FROM records WHERE path LIKE %string{collection}/% |sql}] 169 + {sql| SELECT @string{path}, @CID{cid}, @Blob{data}, @string{since} FROM records 170 + WHERE path LIKE %string{collection}/% 171 + ORDER BY since DESC LIMIT %int{limit} OFFSET %int{offset} 172 + |sql}] 170 173 171 174 let put_record = 172 175 [%rapper ··· 345 348 {path; cid; value= Lex.of_cbor data; since} ) 346 349 >>= Lwt.return 347 350 348 - let list_records conn collection : record list Lwt.t = 349 - Queries.list_records ~collection conn 351 + let list_records conn ?(limit = 100) ?(offset = 0) collection : 352 + record list Lwt.t = 353 + Queries.list_records ~collection ~limit ~offset conn 350 354 >$! List.map (fun (path, cid, data, since) -> 351 355 {path; cid; value= Lex.of_cbor data; since} ) 352 356 >>= Lwt.return