╭ Issue.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1 const std = @import("std"); 2 const evt = @import("../event.zig"); 3 const xit = @import("xit"); 4 const hash = xit.hash; 5 6 title: []const u8, 7 description: []const u8, 8 tags: []const u8, 9 10 pub fn consume( 11 comptime DB: type, 12 comptime hash_kind: hash.HashKind, 13 haxy_moment: DB.HashMap(.read_write), 14 event_id: *const [evt.event_id_size]u8, 15 event_maybe: ?@This(), 16 ) !void { 17 const issue_key = hash.hashInt(hash_kind, event_id); 18 19 const event_id_to_issue_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "event-id->issue")); 20 const event_id_to_issue = try DB.HashMap(.read_write).init(event_id_to_issue_cursor); 21 22 if (event_maybe) |event| { 23 const issue_cursor = try event_id_to_issue.putCursor(issue_key); 24 const issue = try DB.HashMap(.read_write).init(issue_cursor); 25 try evt.upsert(@This(), DB, hash_kind, issue, event); 26 } else { 27 if (!try event_id_to_issue.remove(issue_key)) return error.EventNotFound; 28 } 29 } 30