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