Am I correct in saying that for read queries, you essentially translate the GraphQL query into nested jsonb_agg calls?
91 karma · joined October 2, 2019
try std.fmt.allocPrint(allocator, "problems/{}", .{ id }) |path| : allocator.free(path) {
try std.fs.cwd().openFile(path, .{}) |file| : file.close() {
try file.stat() |stat| {
try allocator.alloc(u8, stat.size) |contents| : allocator.free(contents) {
// do something with 'contents'
}
}
}
}
In Zig you can write this, and mess everything up: const path = try std.fmt.allocPrint(allocator, "problems/{}", .{ id });
var file = try std.fs.cwd().openFile(path, .{});
const stat = try file.stat();
var contents = try allocator.alloc(u8, stat.size);
defer allocator.free(contents);
defer file.close();
defer allocator.free(path); try std.fs.cwd().openFile(path, .{}) |file| : file.close()
{
// ... code ...
// file.close() is called at the end
}You can write a trigger on insert and make second insert there, or enclose first insert into CTE and then make second insert selecting from the first one