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
|
// 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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue