Fix string concatenation

This commit is contained in:
jaina heartles 2022-10-11 19:28:36 -07:00
parent 46e71d8b44
commit d852a3d153

View file

@ -261,7 +261,7 @@ pub fn query(db: anytype, args: QueryArgs, alloc: std.mem.Allocator) !QueryResul
const max_items = if (args.max_items > max_max_items) max_max_items else args.max_items;
if (args.owner_id != null) try builder.andWhere("owner_id = $1");
if (args.like != null) try builder.andWhere("(host LIKE ('%' + $2 + '%') OR name LIKE ('%' + $2 + '%'))");
if (args.like != null) try builder.andWhere("(host LIKE ('%' || $2 || '%') OR name LIKE ('%' || $2 || '%'))");
if (args.created_before != null) try builder.andWhere("created_at < $3");
if (args.created_after != null) try builder.andWhere("created_at > $4");
if (args.prev) |prev| {
@ -345,7 +345,7 @@ pub fn query(db: anytype, args: QueryArgs, alloc: std.mem.Allocator) !QueryResul
.order_val = getOrderVal(result_buf[count - 1], args.order_by),
};
}
// TODO: This will give an incorrect previous page link on an empty page
// TODO: This will give incorrect links on an empty page
return QueryResult{
.items = result_buf[0..count],