| author | |
| committer | |
| log | 342135fd758b5e955498f5776d10d2f02e22c19f |
| tree | 83b8f7ba710a3014e9d8c5929ca5768d09a5a0db |
| parent | db60f03bbd767b7bb3e87c84449ebca0b225d3c1 |
2 files changed, 0 insertions(+), 54 deletions(-)
build.zig-20| ... | ... | @@ -6,26 +6,6 @@ pub fn build(b: *std.Build) void { |
| 6 | 6 | const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug; |
| 7 | 7 | const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false; |
| 8 | 8 | |
| 9 | const exe = b.addExecutable(.{ | |
| 10 | .name = "zig-zorm", | |
| 11 | .root_source_file = b.path("src/main.zig"), | |
| 12 | .target = target, | |
| 13 | .optimize = mode, | |
| 14 | }); | |
| 15 | deps.addAllTo(exe); | |
| 16 | exe.use_llvm = !disable_llvm; | |
| 17 | exe.use_lld = !disable_llvm; | |
| 18 | b.installArtifact(exe); | |
| 19 | ||
| 20 | const run_cmd = b.addRunArtifact(exe); | |
| 21 | run_cmd.step.dependOn(b.getInstallStep()); | |
| 22 | if (b.args) |args| { | |
| 23 | run_cmd.addArgs(args); | |
| 24 | } | |
| 25 | ||
| 26 | const run_step = b.step("run", "Run the app"); | |
| 27 | run_step.dependOn(&run_cmd.step); | |
| 28 | ||
| 29 | 9 | const tests = b.addTest(.{ |
| 30 | 10 | .root_source_file = b.path("test.zig"), |
| 31 | 11 | .target = target, |
src/main.zig deleted-34| ... | ... | @@ -1,34 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const zorm = @import("zorm"); | |
| 3 | ||
| 4 | const string = []const u8; | |
| 5 | const ULID = string; | |
| 6 | const Time = string; | |
| 7 | ||
| 8 | const Package = struct { | |
| 9 | id: u64, | |
| 10 | uuid: ULID, | |
| 11 | owner: ULID, | |
| 12 | name: string, | |
| 13 | created_on: Time, | |
| 14 | remote: u64, | |
| 15 | remote_id: string, | |
| 16 | remote_name: string, | |
| 17 | description: string, | |
| 18 | license: string, | |
| 19 | latest_version: string, | |
| 20 | hook_secret: string, | |
| 21 | star_count: u64, | |
| 22 | }; | |
| 23 | ||
| 24 | pub fn main() !void { | |
| 25 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | |
| 26 | const alloc = gpa.allocator(); | |
| 27 | ||
| 28 | var db = try zorm.engine(.sqlite3).connect("/home/snuc/dev/zig-zorm/access.db"); | |
| 29 | var list = try db.collect(alloc, Package, "select * from packages order by star_count desc limit 25", .{}); | |
| 30 | ||
| 31 | for (list) |item| { | |
| 32 | std.log.info("{s}", .{item.remote_name}); | |
| 33 | } | |
| 34 | } |