authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-10 01:41:36 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-10 01:41:36 -07:00
logf2443019d035e6e913acb01a7ebd79239c305b94
tree01479a1ecb696de1065ae160c7670067393b19c7
parent0a6e76199ea3cd2165fd41f4e8330e445b5f2800
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

update to zig 0.16.0


4 files changed, 4 insertions(+), 35 deletions(-)

README.md+1-1
......@@ -3,7 +3,7 @@
33![loc](https://sloc.xyz/github/nektro/zig-zorm)
44[![license](https://img.shields.io/github/license/nektro/zig-zorm.svg)](https://github.com/nektro/zig-zorm/blob/master/LICENSE)
55[![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro)
6[![Zig](https://img.shields.io/badge/Zig-0.15-f7a41d)](https://ziglang.org/)
6[![Zig](https://img.shields.io/badge/Zig-0.16-f7a41d)](https://ziglang.org/)
77[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)
88
99The database library for Zig.
src/lib.zig-12
......@@ -28,18 +28,6 @@ pub const Engine = union(DriverType) {
2828 };
2929 }
3030
31 pub fn lock(engine: *Engine) void {
32 return switch (engine.*) {
33 inline else => |*e| e.lock(),
34 };
35 }
36
37 pub fn unlock(engine: *Engine) void {
38 return switch (engine.*) {
39 inline else => |*e| e.unlock(),
40 };
41 }
42
4331 pub fn exec(engine: *Engine, alloc: std.mem.Allocator, comptime query: []const u8, args: anytype) !void {
4432 return switch (engine.*) {
4533 inline else => |*e| e.exec(alloc, query, args),
src/postgresql.zig+3-12
......@@ -16,7 +16,6 @@ const sys = switch (builtin.target.os.tag) {
1616
1717const Driver = @This();
1818
19mutex: std.Thread.Mutex,
2019conn: net.Stream,
2120bufw: nio.BufferedWriter(4096, net.Stream),
2221bufr: nio.BufferedReader(4096, net.Stream),
......@@ -178,7 +177,8 @@ pub fn connect(allocator: std.mem.Allocator, connect_s: [:0]const u8) !Driver {
178177 const client_signature = hmacv(Hmac, &stored_key, auth_messagev);
179178 const client_proof = xor(client_key, client_signature);
180179 try fbs.writeAll(",p=");
181 try Base64Enc.encodeWriter(&fbs, &client_proof);
180 var stdw: std.Io.Writer = .fixed(fbs.written());
181 try Base64Enc.encodeWriter(&stdw, &client_proof);
182182
183183 try proto.SASLResponse.write(
184184 &bufw,
......@@ -214,7 +214,6 @@ pub fn connect(allocator: std.mem.Allocator, connect_s: [:0]const u8) !Driver {
214214 }
215215
216216 return .{
217 .mutex = .{},
218217 .conn = conn,
219218 .bufw = bufw,
220219 .bufr = bufr,
......@@ -225,14 +224,6 @@ pub fn close(driver: *Driver) void {
225224 driver.conn.close();
226225}
227226
228pub fn lock(driver: *Driver) void {
229 driver.mutex.lock();
230}
231
232pub fn unlock(driver: *Driver) void {
233 driver.mutex.unlock();
234}
235
236227//
237228
238229pub fn exec(driver: *Driver, alloc: std.mem.Allocator, comptime query: []const u8, args: anytype) !void {
......@@ -442,5 +433,5 @@ fn printError(bufr: *nio.BufferedReader(4096, net.Stream), allocator: std.mem.Al
442433 defer allocator.free(data);
443434 var iter = std.mem.splitScalar(u8, data, 0);
444435 while (iter.next()) |f| if (f.len > 0) std.log.err("{c}: {s}", .{ f[0], f[1..] });
445 std.posix.exit(1);
436 std.process.exit(1);
446437}
src/sqlite3.zig-10
......@@ -7,7 +7,6 @@ const extras = @import("extras");
77const Self = @This();
88
99db: sqlite.Db = undefined,
10mutex: std.Thread.Mutex,
1110
1211pub fn connect(allocator: std.mem.Allocator, path: [:0]const u8) !Self {
1312 std.log.scoped(.zorm).info("connecting to {s} @ {s}", .{ "sqlite3", path });
......@@ -21,7 +20,6 @@ pub fn connect(allocator: std.mem.Allocator, path: [:0]const u8) !Self {
2120 },
2221 .threading_mode = .SingleThread,
2322 }),
24 .mutex = std.Thread.Mutex{},
2523 };
2624}
2725
......@@ -29,14 +27,6 @@ pub fn close(self: *Self) void {
2927 self.db.deinit();
3028}
3129
32pub fn lock(self: *Self) void {
33 self.mutex.lock();
34}
35
36pub fn unlock(self: *Self) void {
37 self.mutex.unlock();
38}
39
4030fn prepare(self: *Self, comptime query: string) !sqlite.StatementType(.{}, query) {
4131 return self.db.prepare(query) catch |err| switch (err) {
4232 error.SQLiteError => std.debug.panic("{f}", .{self.db.getDetailedError()}),