Partial upgrade to ZMPL v2

This commit is contained in:
Samuel Webb 2024-04-07 16:19:35 -04:00
parent fee65c4b9d
commit 199dc0ca49
4 changed files with 14 additions and 11 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ zig-cache/
*.core *.core
static/ static/
.jetzig .jetzig
src/app/database/

View file

@ -1,4 +1,4 @@
// Renders the `message` response data value. <!--// Renders the `message` response data value.-->
<h3 class="message text-[#39b54a]">{.message}</h3> <h3 class="message text-[#39b54a]">{.message}</h3>
<div><img class="p-3 mx-auto" src="/jetzig.png" /></div> <div><img class="p-3 mx-auto" src="/jetzig.png" /></div>

View file

@ -9,12 +9,14 @@
<body> <body>
<div class="text-center pt-10 m-auto"> <div class="text-center pt-10 m-auto">
// If present, renders the `message_param` response data value, add `?message=hello` to the <!-- If present, renders the `message_param` response data value, add `?message=hello` to the
// URL to see the output: // URL to see the output: -->
<h2 class="param text-3xl text-[#f7931e]">{.message_param}</h2> <h2 class="param text-3xl text-[#f7931e]">{.message_param}</h2>
// Renders `src/app/views/root/_content.zmpl` with the same template data available: <!--// Renders `src/app/views/root/_content.zmpl` with the same template data available:-->
<div>{^root/content}</div> <div>
@partial root/content
</div>
</div> </div>
</body> </body>
</html> </html>

View file

@ -96,18 +96,18 @@ pub fn main() !void {
.threading_mode = .MultiThread, .threading_mode = .MultiThread,
}); });
const create = //const create =
\\CREATE TABLE artists ('artist', 'plays') // \\CREATE TABLE artists ('artist', 'plays')
; //;
const query = const query =
\\INSERT INTO artists ('artist', 'plays') VALUES (?,?) \\INSERT INTO artists ('artist', 'plays') VALUES (?,?)
; ;
var build = try db.prepare(create); //var build = try db.prepare(create);
defer build.deinit(); //defer build.deinit();
try build.exec(.{},.{}); //try build.exec(.{},.{});
var stmt = try db.prepare(query); var stmt = try db.prepare(query);
defer stmt.deinit(); defer stmt.deinit();