}
// https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding
-fn reencode(text: []const u8) !PostText {
- var result = try PostText.init(0);
+fn reencode(comptime T: type, text: []const u8) !T {
+ var result = try T.init(0);
const len = @min(text.len, 1024); // TODO: PostText length
const posts = try Db.posts(txn);
post_id = try db.Prng.gen(posts.dbi, PostId);
- const decoded_text = try reencode(text);
+ const decoded_text = try reencode(PostText, text);
try posts.put(post_id, Post{
.id = post_id,
.parent_id = parent_id,
it.idx = try parse_enum(T.Base.Key, starting_at_str, 16);
}
- if (it.idx == null) {
- return error.InvalidIterator;
- }
-
return .{
.res = res,
.view = view,
.per_page = per_page,
.it = it,
- .starting_idx = it.idx.?,
+ .starting_idx = it.idx,
};
}
pub fn next(self: *Self) IterateResult {