diff --git a/src/conditions.zig b/src/conditions.zig index c8cea4d..6e0a365 100644 --- a/src/conditions.zig +++ b/src/conditions.zig @@ -1,6 +1,6 @@ const std = @import("std"); const _sql = @import("sql.zig"); -const errors = @import("errors.zig"); +const ZrmError = @import("errors.zig").ZrmError; const Static = @This(); @@ -78,7 +78,7 @@ pub fn in(comptime ValueType: type, allocator: std.mem.Allocator, _column: []con fn conditionsCombiner(comptime keyword: []const u8, allocator: std.mem.Allocator, subconditions: []const _sql.RawQuery) !_sql.RawQuery { if (subconditions.len == 0) { // At least one condition is required. - return errors.ZrmError.AtLeastOneConditionRequired; + return ZrmError.AtLeastOneConditionRequired; } // Full keyword constant. diff --git a/src/insert.zig b/src/insert.zig index c83fbc5..55e00a7 100644 --- a/src/insert.zig +++ b/src/insert.zig @@ -1,7 +1,7 @@ const std = @import("std"); const pg = @import("pg"); const zollections = @import("zollections"); -const errors = @import("errors.zig"); +const ZrmError = @import("errors.zig").ZrmError; const database = @import("database.zig"); const postgresql = @import("postgresql.zig"); const _sql = @import("sql.zig"); @@ -198,7 +198,7 @@ pub fn RepositoryInsert(comptime Model: type, comptime TableShape: type, comptim /// Set selected columns for RETURNING clause. pub fn returningColumns(self: *Self, _select: []const []const u8) void { if (_select.len == 0) { - return errors.AtLeastOneSelectionRequired; + return ZrmError.AtLeastOneSelectionRequired; } self.returning(.{ @@ -220,7 +220,7 @@ pub fn RepositoryInsert(comptime Model: type, comptime TableShape: type, comptim pub fn buildSql(self: *Self) !void { if (self.insertConfig.values.len == 0) { // At least one value is required to insert. - return errors.ZrmError.AtLeastOneValueRequired; + return ZrmError.AtLeastOneValueRequired; } // Compute VALUES parameters count. diff --git a/src/postgresql.zig b/src/postgresql.zig index 299ec7a..5fdbc90 100644 --- a/src/postgresql.zig +++ b/src/postgresql.zig @@ -2,7 +2,7 @@ const std = @import("std"); const pg = @import("pg"); const zollections = @import("zollections"); const global = @import("global.zig"); -const errors = @import("errors.zig"); +const ZrmError = @import("errors.zig").ZrmError; const database = @import("database.zig"); const _sql = @import("sql.zig"); const _relationships = @import("relationships.zig"); @@ -51,7 +51,7 @@ pub fn handleRawPostgresqlError(err: anyerror, connection: *pg.Conn) anyerror { } // Return that an error happened in query execution. - return errors.ZrmError.QueryFailed; + return ZrmError.QueryFailed; } else { // Not an SQL error, just return it. return err; diff --git a/src/query.zig b/src/query.zig index 1526822..29f4eb8 100644 --- a/src/query.zig +++ b/src/query.zig @@ -1,7 +1,7 @@ const std = @import("std"); const pg = @import("pg"); const zollections = @import("zollections"); -const errors = @import("errors.zig"); +const ZrmError = @import("errors.zig").ZrmError; const database = @import("database.zig"); const postgresql = @import("postgresql.zig"); const _sql = @import("sql.zig"); @@ -105,7 +105,7 @@ pub fn RepositoryQuery(comptime Model: type, comptime TableShape: type, comptime /// Set selected columns for SELECT clause. pub fn selectColumns(self: *Self, _select: []const []const u8) !void { if (_select.len == 0) { - return errors.AtLeastOneSelectionRequired; + return ZrmError.AtLeastOneSelectionRequired; } self.select(.{ diff --git a/src/sql.zig b/src/sql.zig index 11b9e10..9847139 100644 --- a/src/sql.zig +++ b/src/sql.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const errors = @import("errors.zig"); +const ZrmError = @import("errors.zig").ZrmError; /// A structure with SQL and its parameters. pub const RawQuery = struct { @@ -120,7 +120,7 @@ pub const RawQueryParameter = union(enum) { null: void, /// Convert any value to a query parameter. - pub fn fromValue(value: anytype) errors.ZrmError!RawQueryParameter { + pub fn fromValue(value: anytype) ZrmError!RawQueryParameter { // Get given value type. const valueType = @typeInfo(@TypeOf(value)); @@ -138,7 +138,7 @@ pub const RawQueryParameter = union(enum) { if (pointer.child == u8) { return .{ .string = value }; } else { - return errors.ZrmError.UnsupportedTableType; + return ZrmError.UnsupportedTableType; } } }, @@ -154,7 +154,7 @@ pub const RawQueryParameter = union(enum) { return .{ .null = true }; } }, - else => return errors.ZrmError.UnsupportedTableType + else => return ZrmError.UnsupportedTableType }; } }; diff --git a/src/update.zig b/src/update.zig index 5add4d3..29f50fb 100644 --- a/src/update.zig +++ b/src/update.zig @@ -1,7 +1,7 @@ const std = @import("std"); const pg = @import("pg"); const zollections = @import("zollections"); -const errors = @import("errors.zig"); +const ZrmError = @import("errors.zig").ZrmError; const database = @import("database.zig"); const postgresql = @import("postgresql.zig"); const _sql = @import("sql.zig"); @@ -155,7 +155,7 @@ pub fn RepositoryUpdate(comptime Model: type, comptime TableShape: type, comptim /// Set selected columns for RETURNING clause. pub fn returningColumns(self: *Self, _select: []const []const u8) void { if (_select.len == 0) { - return errors.AtLeastOneSelectionRequired; + return ZrmError.AtLeastOneSelectionRequired; } self.returning(.{ @@ -177,7 +177,7 @@ pub fn RepositoryUpdate(comptime Model: type, comptime TableShape: type, comptim pub fn buildSql(self: *Self) !void { if (self.updateConfig.value) |_| {} else { // Updated values must be set. - return errors.ZrmError.UpdatedValuesRequired; + return ZrmError.UpdatedValuesRequired; } // Start parameter counter at 1.