Skip to content

Commit

Permalink
db- lint file consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Jan 29, 2022
1 parent 2e88c08 commit 12e30fb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
7 changes: 3 additions & 4 deletions src/db/Package.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const Package = @This();
pub const table_name = "packages";

const std = @import("std");
const string = []const u8;
const ulid = @import("ulid");
Expand All @@ -12,8 +15,6 @@ const Remote = _db.Remote;
const _internal = @import("./_internal.zig");
const db = &_internal.db;

const Package = @This();

id: u64 = 0,
uuid: ulid.ULID,
owner: ulid.ULID,
Expand All @@ -28,8 +29,6 @@ latest_version: string,
hook_secret: string,
star_count: u64,

pub const table_name = "packages";

pub fn create(alloc: std.mem.Allocator, owner: User, name: string, remote: Remote, rm_id: string, rm_name: string, desc: string, license: string, star_count: u64) !Package {
db.mutex.lock();
defer db.mutex.unlock();
Expand Down
7 changes: 3 additions & 4 deletions src/db/Remote.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const Remote = @This();
pub const table_name = "remotes";

const std = @import("std");
const string = []const u8;
const ulid = @import("ulid");
Expand All @@ -14,15 +17,11 @@ const Package = _db.Package;
const _internal = @import("./_internal.zig");
const db = &_internal.db;

const Remote = @This();

id: u64 = 0,
uuid: ulid.ULID,
type: Type,
domain: string,

pub const table_name = "remotes";

usingnamespace _internal.TableTypeMixin(Remote);

pub var all_remotes: []const Remote = &.{};
Expand Down
4 changes: 2 additions & 2 deletions src/db/Time.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const Self = @This();

const std = @import("std");
const string = []const u8;
const time = @import("time");
Expand All @@ -6,8 +8,6 @@ const _internal = @import("./_internal.zig");

ctx: time.DateTime,

const Self = @This();

usingnamespace _internal.TableTypeMixin(Self);

pub fn formatAlloc(self: Self, alloc: std.mem.Allocator, comptime fmt: string) !string {
Expand Down
7 changes: 3 additions & 4 deletions src/db/User.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const User = @This();
pub const table_name = "users";

const std = @import("std");
const string = []const u8;
const ulid = @import("ulid");
Expand All @@ -10,17 +13,13 @@ const Time = _db.Time;
const _internal = @import("./_internal.zig");
const db = &_internal.db;

const User = @This();

id: u64 = 0,
uuid: ulid.ULID,
provider: u64,
snowflake: string,
name: string,
joined_on: Time,

pub const table_name = "users";

pub fn create(alloc: std.mem.Allocator, provider: u64, snowflake: string, name: string) !User {
db.mutex.lock();
defer db.mutex.unlock();
Expand Down
7 changes: 3 additions & 4 deletions src/db/Version.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const Version = @This();
pub const table_name = "versions";

const std = @import("std");
const string = []const u8;
const ulid = @import("ulid");
Expand All @@ -11,8 +14,6 @@ const Package = _db.Package;
const _internal = @import("./_internal.zig");
const db = &_internal.db;

const Version = @This();

id: u64 = 0,
uuid: ulid.ULID,
p_for: ulid.ULID,
Expand All @@ -32,8 +33,6 @@ root_deps: DepList,
build_deps: DepList,
readme: string,

pub const table_name = "versions";

pub fn create(alloc: std.mem.Allocator, pkg: Package, commit: string, unpackedsize: u64, totalsize: u64, files: []const string, tarsize: u64, tarhash: string, deps: []const zigmod.Dep, rootdeps: []const zigmod.Dep, builddeps: []const zigmod.Dep, readme: string) !Version {
db.mutex.lock();
defer db.mutex.unlock();
Expand Down

0 comments on commit 12e30fb

Please sign in to comment.