WithToken creates a new context with the given user
(ctx context.Context, tok *database.Token)
| 35 | |
| 36 | // WithToken creates a new context with the given user |
| 37 | func WithToken(ctx context.Context, tok *database.Token) context.Context { |
| 38 | return context.WithValue(ctx, tokenKey, tok) |
| 39 | } |
| 40 | |
| 41 | // User retrieves a user from the given context. It returns a pointer to |
| 42 | // a user. If the context does not contain a user, it returns nil. |