Differences From
Artifact [7305c1c258]:
693 693 return buf
694 694 end
695 695 end;
696 696 }
697 697
698 698 local sqlvars = {}
699 699 for i, n in ipairs(lib.store.noticetype.members) do
700 - sqlvars['notice:' .. n] = lib.store.noticetype[n]
700 + sqlvars['notice:' .. n] = lib.store.noticetype[n]:asvalue()
701 701 end
702 702
703 703 for i, n in ipairs(lib.store.relation.members) do
704 704 sqlvars['rel:' .. n] = lib.store.relation.idvmap[n]
705 705 end
706 706
707 707 local con = symbol(&lib.pq.PGconn)
................................................................................
847 847 else p.ptr.chgcount = r:int(uint32,row,11)
848 848 end
849 849 p.ptr.accent = r:int(int16,row,12)
850 850 p.ptr.rtdby = r:int(uint64,row,13)
851 851 p.ptr.rtact = r:int(uint64,row,14)
852 852 p.ptr.likes = r:int(uint32,row,15)
853 853 p.ptr.rts = r:int(uint32,row,16)
854 + p.ptr.isreply = r:bool(row,17)
854 855 p.ptr.localpost = r:bool(row,0)
855 856
856 857 return p
857 858 end
858 859 local terra row_to_actor(r: &pqr, row: intptr): lib.mem.ptr(lib.store.actor)
859 860 var a: lib.mem.ptr(lib.store.actor)
860 861 var av: rawstring, avlen: intptr
................................................................................
1416 1417 return r
1417 1418 end];
1418 1419
1419 1420 actor_purge_uid = [terra(
1420 1421 src: &lib.store.source,
1421 1422 uid: uint64
1422 1423 ) queries.actor_purge_uid.exec(src,uid) end];
1424 +
1425 + actor_notice_enum = [terra(
1426 + src: &lib.store.source,
1427 + uid: uint64
1428 + ): lib.mem.ptr(lib.store.notice)
1429 + var r = queries.actor_notice_enum.exec(src,uid);
1430 + if r.sz == 0 then return [lib.mem.ptr(lib.store.notice)].null() end
1431 + defer r:free()
1432 +
1433 + var notes = lib.mem.heapa(lib.store.notice, r.sz)
1434 + for i=0, r.sz do
1435 + var n = notes.ptr + i
1436 + n.kind = r:int(uint16,i,0)
1437 + n.when = r:int(int64,i,1)
1438 + n.who = r:int(int64,i,2)
1439 + n.what = r:int(uint64,i,3)
1440 + if n.kind == lib.store.noticetype.reply then
1441 + n.reply = r:int(uint64,i,4)
1442 + elseif n.kind == lib.store.noticetype.react then
1443 + var react = r:_string(i,5)
1444 + lib.str.ncpy(n.reaction, react.ptr, lib.math.smallest(react.ct,[(`n.reaction).tree.type.N]))
1445 + end
1446 + end
1447 +
1448 + return notes
1449 + end];
1423 1450
1424 1451 auth_enum_uid = [terra(
1425 1452 src: &lib.store.source,
1426 1453 uid: uint64
1427 1454 ): lib.mem.ptr(lib.mem.ptr(lib.store.auth))
1428 1455 var r = queries.auth_enum_uid.exec(src,uid)
1429 1456 if r.sz == 0 then return [lib.mem.ptr(lib.mem.ptr(lib.store.auth))].null() end