diff --git a/src/insert.zig b/src/insert.zig index 9a320aa..e1c0c4e 100644 --- a/src/insert.zig +++ b/src/insert.zig @@ -299,7 +299,8 @@ pub fn RepositoryInsert(comptime Model: type, comptime TableShape: type, comptim if (self.sql) |_| {} else { try self.buildSql(); } // Execute query and get its result. - const queryResult = try self.execQuery(); + var queryResult = try self.execQuery(); + defer queryResult.deinit(); //TODO deduplicate this in postgresql.zig, we could do it if Mapper type was exposed. //TODO make a generic mapper and do it in repository.zig? diff --git a/src/query.zig b/src/query.zig index c804579..a462810 100644 --- a/src/query.zig +++ b/src/query.zig @@ -216,7 +216,8 @@ pub fn RepositoryQuery(comptime Model: type, comptime TableShape: type, comptime if (self.sql) |_| {} else { try self.buildSql(); } // Execute query and get its result. - const queryResult = try self.execQuery(); + var queryResult = try self.execQuery(); + defer queryResult.deinit(); //TODO deduplicate this in postgresql.zig, we could do it if Mapper type was exposed. //TODO make a generic mapper and do it in repository.zig? diff --git a/src/update.zig b/src/update.zig index 321d3b4..88b38a2 100644 --- a/src/update.zig +++ b/src/update.zig @@ -303,7 +303,8 @@ pub fn RepositoryUpdate(comptime Model: type, comptime TableShape: type, comptim if (self.sql) |_| {} else { try self.buildSql(); } // Execute query and get its result. - const queryResult = try self.execQuery(); + var queryResult = try self.execQuery(); + defer queryResult.deinit(); //TODO deduplicate this in postgresql.zig, we could do it if Mapper type was exposed. //TODO make a generic mapper and do it in repository.zig?