CtxUser pulls the current User out of the context, or AnonymousUser if not set.
(ctx context.Context)
| 54 | // CtxUser pulls the current User out of the context, or AnonymousUser if not |
| 55 | // set. |
| 56 | func CtxUser(ctx context.Context) *User { |
| 57 | if u, ok := ctx.Value(contextKeyUser).(*User); ok { |
| 58 | return u |
| 59 | } |
| 60 | |
| 61 | return AnonymousUser |
| 62 | } |
| 63 | |
| 64 | // WithLogger takes a parent context and a logger and returns a new context |
| 65 | // with that logger. |
no outgoing calls