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 @@...@@ -3,7 +3,7 @@
3![loc](https://sloc.xyz/github/nektro/zig-zorm)3![loc](https://sloc.xyz/github/nektro/zig-zorm)
4[![license](https://img.shields.io/github/license/nektro/zig-zorm.svg)](https://github.com/nektro/zig-zorm/blob/master/LICENSE)4[![license](https://img.shields.io/github/license/nektro/zig-zorm.svg)](https://github.com/nektro/zig-zorm/blob/master/LICENSE)
5[![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro)5[![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/)
7[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)7[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)
88
9The database library for Zig.9The database library for Zig.
src/lib.zig-12
...@@ -28,18 +28,6 @@ pub const Engine = union(DriverType) {...@@ -28,18 +28,6 @@ pub const Engine = union(DriverType) {
28 };28 };
29 }29 }
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
43 pub fn exec(engine: *Engine, alloc: std.mem.Allocator, comptime query: []const u8, args: anytype) !void {31 pub fn exec(engine: *Engine, alloc: std.mem.Allocator, comptime query: []const u8, args: anytype) !void {
44 return switch (engine.*) {32 return switch (engine.*) {
45 inline else => |*e| e.exec(alloc, query, args),33 inline else => |*e| e.exec(alloc, query, args),
src/postgresql.zig+3-12
...@@ -16,7 +16,6 @@ const sys = switch (builtin.target.os.tag) {...@@ -16,7 +16,6 @@ const sys = switch (builtin.target.os.tag) {
1616
17const Driver = @This();17const Driver = @This();
1818
19mutex: std.Thread.Mutex,
20conn: net.Stream,19conn: net.Stream,
21bufw: nio.BufferedWriter(4096, net.Stream),20bufw: nio.BufferedWriter(4096, net.Stream),
22bufr: nio.BufferedReader(4096, net.Stream),21bufr: nio.BufferedReader(4096, net.Stream),
...@@ -178,7 +177,8 @@ pub fn connect(allocator: std.mem.Allocator, connect_s: [:0]const u8) !Driver {...@@ -178,7 +177,8 @@ pub fn connect(allocator: std.mem.Allocator, connect_s: [:0]const u8) !Driver {
178 const client_signature = hmacv(Hmac, &stored_key, auth_messagev);177 const client_signature = hmacv(Hmac, &stored_key, auth_messagev);
179 const client_proof = xor(client_key, client_signature);178 const client_proof = xor(client_key, client_signature);
180 try fbs.writeAll(",p=");179 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
183 try proto.SASLResponse.write(183 try proto.SASLResponse.write(
184 &bufw,184 &bufw,
...@@ -214,7 +214,6 @@ pub fn connect(allocator: std.mem.Allocator, connect_s: [:0]const u8) !Driver {...@@ -214,7 +214,6 @@ pub fn connect(allocator: std.mem.Allocator, connect_s: [:0]const u8) !Driver {
214 }214 }
215215
216 return .{216 return .{
217 .mutex = .{},
218 .conn = conn,217 .conn = conn,
219 .bufw = bufw,218 .bufw = bufw,
220 .bufr = bufr,219 .bufr = bufr,
...@@ -225,14 +224,6 @@ pub fn close(driver: *Driver) void {...@@ -225,14 +224,6 @@ pub fn close(driver: *Driver) void {
225 driver.conn.close();224 driver.conn.close();
226}225}
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
236//227//
237228
238pub fn exec(driver: *Driver, alloc: std.mem.Allocator, comptime query: []const u8, args: anytype) !void {229pub 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...@@ -442,5 +433,5 @@ fn printError(bufr: *nio.BufferedReader(4096, net.Stream), allocator: std.mem.Al
442 defer allocator.free(data);433 defer allocator.free(data);
443 var iter = std.mem.splitScalar(u8, data, 0);434 var iter = std.mem.splitScalar(u8, data, 0);
444 while (iter.next()) |f| if (f.len > 0) std.log.err("{c}: {s}", .{ f[0], f[1..] });435 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);
446}437}
src/sqlite3.zig-10
...@@ -7,7 +7,6 @@ const extras = @import("extras");...@@ -7,7 +7,6 @@ const extras = @import("extras");
7const Self = @This();7const Self = @This();
88
9db: sqlite.Db = undefined,9db: sqlite.Db = undefined,
10mutex: std.Thread.Mutex,
1110
12pub fn connect(allocator: std.mem.Allocator, path: [:0]const u8) !Self {11pub fn connect(allocator: std.mem.Allocator, path: [:0]const u8) !Self {
13 std.log.scoped(.zorm).info("connecting to {s} @ {s}", .{ "sqlite3", path });12 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 {...@@ -21,7 +20,6 @@ pub fn connect(allocator: std.mem.Allocator, path: [:0]const u8) !Self {
21 },20 },
22 .threading_mode = .SingleThread,21 .threading_mode = .SingleThread,
23 }),22 }),
24 .mutex = std.Thread.Mutex{},
25 };23 };
26}24}
2725
...@@ -29,14 +27,6 @@ pub fn close(self: *Self) void {...@@ -29,14 +27,6 @@ pub fn close(self: *Self) void {
29 self.db.deinit();27 self.db.deinit();
30}28}
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
40fn prepare(self: *Self, comptime query: string) !sqlite.StatementType(.{}, query) {30fn prepare(self: *Self, comptime query: string) !sqlite.StatementType(.{}, query) {
41 return self.db.prepare(query) catch |err| switch (err) {31 return self.db.prepare(query) catch |err| switch (err) {
42 error.SQLiteError => std.debug.panic("{f}", .{self.db.getDetailedError()}),32 error.SQLiteError => std.debug.panic("{f}", .{self.db.getDetailedError()}),