Fix returningColumns.
All checks were successful
/ build_docs (push) Successful in 30s

This commit is contained in:
Madeorsk 2025-01-14 11:52:04 +01:00
parent db6b019b5d
commit 8dede5fad6
Signed by: Madeorsk
GPG key ID: 677E51CA765BB79F
2 changed files with 4 additions and 4 deletions

View file

@ -196,14 +196,14 @@ pub fn RepositoryInsert(comptime Model: type, comptime TableShape: type, comptim
} }
/// Set selected columns for RETURNING clause. /// Set selected columns for RETURNING clause.
pub fn returningColumns(self: *Self, _select: []const []const u8) void { pub fn returningColumns(self: *Self, _select: []const []const u8) !void {
if (_select.len == 0) { if (_select.len == 0) {
return ZrmError.AtLeastOneSelectionRequired; return ZrmError.AtLeastOneSelectionRequired;
} }
self.returning(.{ self.returning(.{
// Join selected columns. // Join selected columns.
.sql = std.mem.join(self.arena.allocator(), ", ", _select), .sql = try std.mem.join(self.arena.allocator(), ", ", _select),
.params = &[_]_sql.RawQueryParameter{}, // No parameters. .params = &[_]_sql.RawQueryParameter{}, // No parameters.
}); });
} }

View file

@ -153,14 +153,14 @@ pub fn RepositoryUpdate(comptime Model: type, comptime TableShape: type, comptim
} }
/// Set selected columns for RETURNING clause. /// Set selected columns for RETURNING clause.
pub fn returningColumns(self: *Self, _select: []const []const u8) void { pub fn returningColumns(self: *Self, _select: []const []const u8) !void {
if (_select.len == 0) { if (_select.len == 0) {
return ZrmError.AtLeastOneSelectionRequired; return ZrmError.AtLeastOneSelectionRequired;
} }
self.returning(.{ self.returning(.{
// Join selected columns. // Join selected columns.
.sql = std.mem.join(self.arena.allocator(), ", ", _select), .sql = try std.mem.join(self.arena.allocator(), ", ", _select),
.params = &[_]_sql.RawQueryParameter{}, // No parameters. .params = &[_]_sql.RawQueryParameter{}, // No parameters.
}); });
} }