From 8fe3f3c2595679941c2c609dbe18e8ed5da779ab Mon Sep 17 00:00:00 2001 From: Judsen Hembree Date: Fri, 13 Dec 2024 23:40:08 -0500 Subject: Update README.md Use suggested code edit. Co-authored-by: Vincent Rischmann --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4454e9c..07a9845 100644 --- a/README.md +++ b/README.md @@ -228,7 +228,9 @@ const row = try stmt.one( .{ .id = 20 }, ); if (row) |r| { - std.log.debug("name: {}, age: {}", .{std.mem.span((&row.name).ptr), row.age}); + const name_ptr: [*:0]const u8 = &r.name; + std.log.debug("name: {s}, age: {}", .{ std.mem.span(name_ptr), r.age }); +} } ``` Notice that to read text we need to use a 0-terminated array; if the `name` column is bigger than 127 bytes the call to `one` will fail. -- cgit v1.2.3