Skip to content

Commit

Permalink
update to stage2 usingnamespace semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Aug 11, 2022
1 parent f57f860 commit 4ed26d0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/db/Job.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub const State = enum {

pub const BaseType = string;

usingnamespace extras.TagNameJsonStringifyMixin(@This());
pub usingnamespace extras.TagNameJsonStringifyMixin(@This());
};

pub const Arch = struct {
Expand Down Expand Up @@ -125,8 +125,8 @@ pub fn create(alloc: std.mem.Allocator, package: Package, commit: string, arch:
return j;
}

usingnamespace ox.TableTypeMixin(Self);
usingnamespace ox.ByKeyGen(Self);
pub usingnamespace ox.TableTypeMixin(Self);
pub usingnamespace ox.ByKeyGen(Self);

pub fn dupe(self: Self, alloc: std.mem.Allocator) !*Self {
var the = try alloc.create(Self);
Expand Down
6 changes: 3 additions & 3 deletions src/db/Package.zig
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ pub fn create(alloc: std.mem.Allocator, owner: User, name: string, remote: Remot
});
}

usingnamespace ox.TableTypeMixin(Package);
usingnamespace ox.ByKeyGen(Package);
usingnamespace ox.JsonStructSkipMixin(@This(), &.{ "id", "hook_secret" });
pub usingnamespace ox.TableTypeMixin(Package);
pub usingnamespace ox.ByKeyGen(Package);
pub usingnamespace ox.JsonStructSkipMixin(@This(), &.{ "id", "hook_secret" });

pub const findVersionBy = ox.FindByGen(Package, Version, .p_for, .uuid).first;

Expand Down
6 changes: 3 additions & 3 deletions src/db/Remote.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ uuid: ox.ULID,
type: Type,
domain: string,

usingnamespace ox.TableTypeMixin(Remote);
usingnamespace ox.JsonStructSkipMixin(@This(), &.{});
pub usingnamespace ox.TableTypeMixin(Remote);
pub usingnamespace ox.JsonStructSkipMixin(@This(), &.{});

pub const Type = enum {
github,
gitea,

pub const BaseType = string;

usingnamespace extras.TagNameJsonStringifyMixin(@This());
pub usingnamespace extras.TagNameJsonStringifyMixin(@This());
};

pub const Repo = struct {
Expand Down
2 changes: 1 addition & 1 deletion src/db/Time.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const extras = @import("extras");

ctx: time.DateTime,

usingnamespace extras.StringerJsonStringifyMixin(@This());
pub usingnamespace extras.StringerJsonStringifyMixin(@This());

pub fn formatAlloc(self: Self, alloc: std.mem.Allocator, comptime fmt: string) !string {
return self.ctx.formatAlloc(alloc, fmt);
Expand Down
6 changes: 3 additions & 3 deletions src/db/User.zig
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ pub fn create(alloc: std.mem.Allocator, provider: u64, snowflake: string, name:
});
}

usingnamespace ox.TableTypeMixin(User);
usingnamespace ox.ByKeyGen(User);
usingnamespace ox.JsonStructSkipMixin(@This(), &.{"id"});
pub usingnamespace ox.TableTypeMixin(User);
pub usingnamespace ox.ByKeyGen(User);
pub usingnamespace ox.JsonStructSkipMixin(@This(), &.{"id"});

pub const findPackageBy = ox.FindByGen(User, Package, .owner, .uuid).first;

Expand Down
6 changes: 3 additions & 3 deletions src/db/Version.zig
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ pub fn create(alloc: std.mem.Allocator, pkg: Package, commit: string, unpackedsi
});
}

usingnamespace ox.TableTypeMixin(Version);
usingnamespace ox.ByKeyGen(Version);
usingnamespace ox.JsonStructSkipMixin(@This(), &.{ "id", "readme", "files", "approved_by", "deps" });
pub usingnamespace ox.TableTypeMixin(Version);
pub usingnamespace ox.ByKeyGen(Version);
pub usingnamespace ox.JsonStructSkipMixin(@This(), &.{ "id", "readme", "files", "approved_by", "deps" });

pub fn latest(alloc: std.mem.Allocator) ![]const Version {
return try db.collect(alloc, Version, "select * from versions order by id desc limit 15", .{});
Expand Down

0 comments on commit 4ed26d0

Please sign in to comment.