From 199dc0ca49cd9c30d5e2628e1a0b2e254ecc9e93 Mon Sep 17 00:00:00 2001 From: Samuel Webb Date: Sun, 7 Apr 2024 16:19:35 -0400 Subject: [PATCH] Partial upgrade to ZMPL v2 --- .gitignore | 1 + src/app/views/root/_content.zmpl | 2 +- src/app/views/root/index.zmpl | 10 ++++++---- src/main.zig | 12 ++++++------ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index cbcae4c..1b3afe7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ zig-cache/ *.core static/ .jetzig +src/app/database/ \ No newline at end of file diff --git a/src/app/views/root/_content.zmpl b/src/app/views/root/_content.zmpl index 39bf503..088ab6b 100644 --- a/src/app/views/root/_content.zmpl +++ b/src/app/views/root/_content.zmpl @@ -1,4 +1,4 @@ -// Renders the `message` response data value. +

{.message}

diff --git a/src/app/views/root/index.zmpl b/src/app/views/root/index.zmpl index cccb8d8..9473e7a 100644 --- a/src/app/views/root/index.zmpl +++ b/src/app/views/root/index.zmpl @@ -9,12 +9,14 @@
- // If present, renders the `message_param` response data value, add `?message=hello` to the - // URL to see the output: +

{.message_param}

- // Renders `src/app/views/root/_content.zmpl` with the same template data available: -
{^root/content}
+ +
+ @partial root/content +
diff --git a/src/main.zig b/src/main.zig index 922472f..9d5b43a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -96,18 +96,18 @@ pub fn main() !void { .threading_mode = .MultiThread, }); - const create = - \\CREATE TABLE artists ('artist', 'plays') - ; + //const create = + // \\CREATE TABLE artists ('artist', 'plays') + //; const query = \\INSERT INTO artists ('artist', 'plays') VALUES (?,?) ; - var build = try db.prepare(create); - defer build.deinit(); + //var build = try db.prepare(create); + //defer build.deinit(); - try build.exec(.{},.{}); + //try build.exec(.{},.{}); var stmt = try db.prepare(query); defer stmt.deinit();