-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get sqlite set up in zig; split ffi off from core rose zig module (#127)
- Loading branch information
Showing
12 changed files
with
103 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ | |
nodePackages.prettier | ||
zig | ||
zls | ||
zon2nix | ||
]; | ||
}) | ||
]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.{ | ||
.name = "rose", | ||
.version = "0.5.0", | ||
.dependencies = .{ | ||
.sqlite = .{ | ||
.url = "https://github.com/vrischmann/zig-sqlite/archive/dc339b7cf3bca82a12c2169231dd247587766781.tar.gz", | ||
.hash = "1220e0961c135c5aa3af77a043dbc5890a18235a157238df0e2882fe84a8c8439c7a", | ||
}, | ||
}, | ||
.paths = .{""}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# generated by zon2nix (https://github.com/nix-community/zon2nix) | ||
|
||
{ linkFarm, fetchzip }: | ||
|
||
linkFarm "zig-packages" [ | ||
{ | ||
name = "1220e0961c135c5aa3af77a043dbc5890a18235a157238df0e2882fe84a8c8439c7a"; | ||
path = fetchzip { | ||
url = "https://github.com/vrischmann/zig-sqlite/archive/dc339b7cf3bca82a12c2169231dd247587766781.tar.gz"; | ||
hash = "sha256-YouCVidJqhI5+joTSe1aSbnjVC+qVG2aIz6MyibRmQk="; | ||
}; | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const std = @import("std"); | ||
const sqlite = @import("sqlite"); | ||
const testing = std.testing; | ||
|
||
pub fn getRelease(allocator: std.mem.Allocator) ![:0]const u8 { | ||
return try allocator.dupeZ(u8, "hello"); | ||
} | ||
|
||
pub fn getTrack(allocator: std.mem.Allocator) void { | ||
const db = try sqlite.Db.init(.{ | ||
.mode = sqlite.Db.Mode{ .File = "/home/blissful/.cache/rose/cache.sqlite3" }, | ||
.open_flags = .{ | ||
.write = true, | ||
.create = true, | ||
}, | ||
.threading_mode = .MultiThread, | ||
}); | ||
_ = db; | ||
_ = allocator; | ||
} | ||
|
||
test "basic add functionality" { | ||
const message = try getRelease(testing.allocator); | ||
try testing.expect(std.mem.eql(u8, message, "hello")); | ||
testing.allocator.free(message); | ||
} |
This file was deleted.
Oops, something went wrong.