summaryrefslogtreecommitdiff
path: root/sqlite.zig
diff options
context:
space:
mode:
authorGravatar Meghan Denny2021-08-09 01:16:51 -0700
committerGravatar Meghan Denny2021-08-09 01:16:51 -0700
commit4792723ff4fcb37769c040eb3eaafb16496ad829 (patch)
treead7fdaf920c7e20b4c314325e5e5a7c246dd9721 /sqlite.zig
parentMerge pull request #33 from vrischmann/exec-with-diags (diff)
downloadzig-sqlite-4792723ff4fcb37769c040eb3eaafb16496ad829.tar.gz
zig-sqlite-4792723ff4fcb37769c040eb3eaafb16496ad829.tar.xz
zig-sqlite-4792723ff4fcb37769c040eb3eaafb16496ad829.zip
make `init` return a Self instead of updating a pointer
Diffstat (limited to 'sqlite.zig')
-rw-r--r--sqlite.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/sqlite.zig b/sqlite.zig
index b0f3216..498f83d 100644
--- a/sqlite.zig
+++ b/sqlite.zig
@@ -303,7 +303,7 @@ pub const Db = struct {
303 }; 303 };
304 304
305 /// init creates a database with the provided options. 305 /// init creates a database with the provided options.
306 pub fn init(self: *Self, options: InitOptions) !void { 306 pub fn init(options: InitOptions) !Self {
307 var dummy_diags = Diagnostics{}; 307 var dummy_diags = Diagnostics{};
308 var diags = options.diags orelse &dummy_diags; 308 var diags = options.diags orelse &dummy_diags;
309 309
@@ -339,7 +339,7 @@ pub const Db = struct {
339 return errorFromResultCode(result); 339 return errorFromResultCode(result);
340 } 340 }
341 341
342 self.db = db.?; 342 return Self{ .db = db.? };
343 }, 343 },
344 .Memory => { 344 .Memory => {
345 logger.info("opening in memory", .{}); 345 logger.info("opening in memory", .{});
@@ -357,7 +357,7 @@ pub const Db = struct {
357 return errorFromResultCode(result); 357 return errorFromResultCode(result);
358 } 358 }
359 359
360 self.db = db.?; 360 return Self{ .db = db.? };
361 }, 361 },
362 } 362 }
363 } 363 }