From a6d8795c791257358a6965015cae74191b90cf49 Mon Sep 17 00:00:00 2001 From: "Lucas F." Date: Thu, 22 Jan 2026 09:32:30 -0300 Subject: [PATCH] fix: slice of structs --- src/context.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/context.zig b/src/context.zig index a555794..267e2ca 100644 --- a/src/context.zig +++ b/src/context.zig @@ -42,6 +42,20 @@ pub const Context = struct { return Value{ .string = try time.formatDateTime(self.allocator(), value, "Y-m-d H:i:s") }; } + if (@typeInfo(T) == .pointer) { + if (@typeInfo(T).pointer.size == .slice) { + std.debug.print("slice: {any}\n", .{@typeInfo(T).pointer.child}); + if (@typeInfo(@typeInfo(T).pointer.child) == .@"struct") { + std.debug.print("struct: {s}\n", .{@typeName(@typeInfo(T).pointer.child)}); + var list = try self.allocator().alloc(Value, value.len); + for (value, 0..) |item, i| { + list[i] = try self.toValue(item); + } + return Value{ .list = list }; + } + } + } + return switch (@typeInfo(T)) { .bool => Value{ .bool = value }, .int, .comptime_int => Value{ .int = @intCast(value) },