24 lines
539 B
Zig
24 lines
539 B
Zig
const std = @import("std");
|
|
const sqlite = @import("sqlite");
|
|
|
|
const Db = @import("Db.zig");
|
|
const Item = @import("Item.zig");
|
|
|
|
const Self = @This();
|
|
|
|
name: []const u8,
|
|
|
|
pub fn persist(self: *Self, db: *sqlite.Db) !void {
|
|
///////////////////////////////////
|
|
// ** Insert item **
|
|
/////////////////////////////////
|
|
|
|
// TODO: Test if tag exists
|
|
if (true) {
|
|
const query = "INSERT INTO tag (name) VALUES (?);";
|
|
try db.exec(query, .{}, .{ .name = self.name });
|
|
}
|
|
|
|
std.debug.print("{any}", .{self});
|
|
}
|