User retrieves a user from the given context. It returns a pointer to a user. If the context does not contain a user, it returns nil.
(ctx context.Context)
| 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. |
| 43 | func User(ctx context.Context) *database.User { |
| 44 | if temp := ctx.Value(userKey); temp != nil { |
| 45 | if user, ok := temp.(*database.User); ok { |
| 46 | return user |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | // Token retrieves a token from the given context. |
| 54 | func Token(ctx context.Context) *database.Token { |
no outgoing calls
no test coverage detected