Convert ids to i64

The birthday paradox is a real problem with the size of our datasets. i64 is the largest numerical value we can use, and there's a 0.1% chance of collision with ~2,000,000 values, so I feel pretty comfortable with this
This commit is contained in:
mitteneer 2025-06-09 21:41:52 -04:00
parent c8f2ef57c8
commit 162341fb5f
9 changed files with 21 additions and 27 deletions

View file

@ -23,12 +23,6 @@ pub fn entityQueryResult(request: *jetzig.Request, query: GeneratedQuery, args:
return out.get("entity_info").?;
}
//if (query.query_type == .datestreak) {
// var out: *jetzig.Data.Value = try Data.object();
// const entity = try (try result.next()).?.to(struct { name: []const u8, id: i32, scrobbles: i64, rank: []const u8 }, .{ .dupe = true, .allocator = request.allocator });
//
//}
var out: *jetzig.Data.Value = try Data.array();
var mapper = result.mapper(UnifiedResult, .{ .dupe = true, .allocator = request.allocator });
@ -65,22 +59,22 @@ const GeneratedQuery = struct {
const UnifiedResult = struct {
album_name: ?[]const u8 = null,
album_id: ?i32 = null,
album_id: ?i64 = null,
song_name: ?[]const u8 = null,
song_id: ?i32 = null,
song_id: ?i64 = null,
artist_name: ?[]const u8 = null,
artist_id: ?i32 = null,
artist_id: ?i64 = null,
scrobbles: ?i64 = null,
date: ?[]const u8 = null,
};
const EntityInfoResult = struct {
album_name: ?[]const u8 = null,
album_id: ?i32 = null,
album_id: ?i64 = null,
song_name: ?[]const u8 = null,
song_id: ?i32 = null,
song_id: ?i64 = null,
artist_name: ?[]const u8 = null,
artist_id: ?i32 = null,
artist_id: ?i64 = null,
scrobbles: ?i64 = null,
date: ?[]const u8 = null,
rank: []const u8,