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

Update middleware_with_endpoint example with direct context

This commit is contained in:
Ed Yu 2023-06-21 20:44:05 -07:00
parent f5292c3669
commit 71fb5d945e

View file

@ -20,10 +20,10 @@ const SharedAllocator = struct {
}; };
// create a combined context struct // create a combined context struct
const Context = zap.Middleware.MixContexts(.{ const Context = struct {
.{ .name = "?user", .type = UserMiddleWare.User }, user: ?UserMiddleWare.User = null,
.{ .name = "?session", .type = SessionMiddleWare.Session }, session: ?SessionMiddleWare.Session = null,
}); };
// 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);