Skip to content

Commit 8fe3f3c

Browse files
Update README.md
Use suggested code edit. Co-authored-by: Vincent Rischmann <[email protected]>
1 parent eafe50f commit 8fe3f3c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ const row = try stmt.one(
228228
.{ .id = 20 },
229229
);
230230
if (row) |r| {
231-
std.log.debug("name: {}, age: {}", .{std.mem.span((&row.name).ptr), row.age});
231+
const name_ptr: [*:0]const u8 = &r.name;
232+
std.log.debug("name: {s}, age: {}", .{ std.mem.span(name_ptr), r.age });
233+
}
232234
}
233235
```
234236
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.

0 commit comments

Comments
 (0)