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:
parent
f5292c3669
commit
71fb5d945e
1 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue