1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00

Revert Context changes in middleware_with_endpoint by fixing middleware MixContexts

This commit is contained in:
Ed Yu 2023-06-22 11:54:01 -07:00
parent 1559fbd2c3
commit c047d9dc9b
2 changed files with 5 additions and 5 deletions

View file

@ -20,10 +20,10 @@ const SharedAllocator = struct {
}; };
// create a combined context struct // create a combined context struct
const Context = struct { const Context = zap.Middleware.MixContexts(.{
user: ?UserMiddleWare.User = null, .{ .name = "?user", .type = UserMiddleWare.User },
session: ?SessionMiddleWare.Session = null, .{ .name = "?session", .type = SessionMiddleWare.Session },
}; });
// we create a Handler type based on our Context // we create a Handler type based on our Context
const Handler = zap.Middleware.Handler(Context); const Handler = zap.Middleware.Handler(Context);

View file

@ -22,7 +22,7 @@ pub fn MixContexts(comptime context_tuple: anytype) type {
fields[i] = .{ fields[i] = .{
.name = fieldName, .name = fieldName,
.type = fieldType, .type = fieldType,
.default_value = if (isOptional) &null else null, .default_value = if (isOptional) &@as(fieldType, null) else null,
.is_comptime = false, .is_comptime = false,
.alignment = 0, .alignment = 0,
}; };