| ... | @@ -40,3 +40,9 @@ pub fn exec(self: *Self, comptime query: []const u8, args: anytype) !void { | ... | @@ -40,3 +40,9 @@ pub fn exec(self: *Self, comptime query: []const u8, args: anytype) !void { |
| 40 | defer stmt.deinit(); | 40 | defer stmt.deinit(); |
| 41 | try stmt.exec(args); | 41 | try stmt.exec(args); |
| 42 | } | 42 | } |
| | 43 | |
| | 44 | pub fn first(self: *Self, alloc: *std.mem.Allocator, comptime T: type, comptime query: []const u8, args: anytype) !?T { |
| | 45 | var stmt = try self.db.prepare(query); |
| | 46 | defer stmt.deinit(); |
| | 47 | return try stmt.oneAlloc(T, alloc, .{}, args); |
| | 48 | } |