╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │442 const event_id_to_repo = try DB.HashMap(.read_write).init(event_id_to_repo_cursor); │ │443 │ │383 - if (data_maybe) |data| { │ │444 + if (event.data) |data| { │ │445 const repo_cursor = try event_id_to_repo.putCursor(repo_key); │ │446 const repo_map = try DB.HashMap(.read_write).init(repo_cursor); │ │386 - try upsert(DB, repo_opts.hash, repo_map, @TypeOf(data), data); │ │447 + try upsert(DB, repo_opts.hash, repo_map, EventData.Repo, data.repo); │ │448 │ │449 const user_id_to_repos_cursor = try haxy_moment.putCursor(hash.hashInt(repo_opts.hash, "user-id->repos"));│ │450 const user_id_to_repos = try DB.HashMap(.read_write).init(user_id_to_repos_cursor); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │451 │ │391 - const user_repos_cursor = try user_id_to_repos.putCursor(hash.hashInt(repo_opts.hash, data.user_id)); │ │452 + const user_repos_cursor = try user_id_to_repos.putCursor(hash.hashInt(repo_opts.hash, data.repo.user_id));│ │453 const user_repos = try DB.CountedHashSet(.read_write).init(user_repos_cursor); │ │454 try user_repos.put(repo_key, .{ .bytes = &current_event_id }); │ │455 } else { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │456 if (try event_id_to_repo.getCursor(repo_key)) |existing_repo_cursor| { │ │457 const existing_repo_map = try DB.HashMap(.read_only).init(existing_repo_cursor); │ │458 const existing_repo = try EventData.read(DB, repo_opts.hash, arena.allocator(), existing_repo_map, .repo);│ │398 - const data = existing_repo.repo orelse return error.InvalidEventData; │ │459 + const data = existing_repo.repo; │ │460 │ │461 const user_id_to_repos_cursor = try haxy_moment.putCursor(hash.hashInt(repo_opts.hash, "user-id->repos"));│ │462 const user_id_to_repos = try DB.HashMap(.read_write).init(user_id_to_repos_cursor); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │469 if (!try event_id_to_repo.remove(repo_key)) return error.EventNotFound; │ │470 } │ │471 }, │ │411 - .issue => |data_maybe| { │ │472 + .issue => { │ │473 const issue_key = hash.hashInt(repo_opts.hash, &current_event_id); │ │474 │ │475 const event_id_to_issue_cursor = try haxy_moment.putCursor(hash.hashInt(repo_opts.hash, "event-id->issue"));│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │476 const event_id_to_issue = try DB.HashMap(.read_write).init(event_id_to_issue_cursor);│ │477 │ │417 - if (data_maybe) |data| { │ │478 + if (event.data) |data| { │ │479 const issue_cursor = try event_id_to_issue.putCursor(issue_key); │ │480 const issue = try DB.HashMap(.read_write).init(issue_cursor); │ │420 - try upsert(DB, repo_opts.hash, issue, @TypeOf(data), data); │ │481 + try upsert(DB, repo_opts.hash, issue, EventData.Issue, data.issue); │ │482 } else { │ │483 if (!try event_id_to_issue.remove(issue_key)) return error.EventNotFound; │ │484 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────╮ │src/test/event.zig│ ╰──────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │47 const events_to_consume = [_]evt.Event{ │ │48 .{ │ │49 .id = std.fmt.bytesToHex(first_event_id, .lower), │ │50 + .kind = .issue, │ │51 .data = .{ │ │52 .issue = .{ │ │53 .title = "Login form clears password on validation error",│ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │59 // this event edits the previous one because it has the same id │ │60 .{ │ │61 .id = std.fmt.bytesToHex(first_event_id, .lower), │ │62 + .kind = .issue, │ │63 .data = .{ │ │64 .issue = .{ │ │65 .title = "Login form clears password on validation error",│ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │70 }, │ │71 .{ │ │72 .id = std.fmt.bytesToHex(evt.randomId(prng.random()), .lower), │ │73 + .kind = .issue, │ │74 .data = .{ │ │75 .issue = .{ │ │76 .title = "Search results ignore archived project filter",│ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │81 }, │ │82 .{ │ │83 .id = std.fmt.bytesToHex(evt.randomId(prng.random()), .lower), │ │84 + .kind = .issue, │ │85 .data = .{ │ │86 .issue = .{ │ │87 .title = "Issue list does not persist selected sort order",│ ╰───────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │154 const first_issue = try evt.EventData.read(Repo.DB, repo_opts.hash, arena.allocator(), first_issue_map, .issue); │ │155 │ │156 // the description was correctly edited │ │153 - try std.testing.expectEqualStrings(events_to_consume[1].data.issue.?.description, first_issue.issue.?.description);│ │157 + try std.testing.expectEqualStrings(events_to_consume[1].data.?.issue.description, first_issue.issue.description); │ │158 │ │159 // the tags were correctly edited │ │156 - try std.testing.expectEqualStrings(events_to_consume[1].data.issue.?.tags, first_issue.issue.?.tags); │ │160 + try std.testing.expectEqualStrings(events_to_consume[1].data.?.issue.tags, first_issue.issue.tags); │ │161 } │ │162 │ │163 // │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯