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

Update middleware example with direct context

This commit is contained in:
Ed Yu 2023-06-21 15:21:42 -07:00
parent 5611026479
commit cc0680d6e3

View file

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