GetUser reads the user from the context - shared implementation
(ctx context.Context)
| 22 | |
| 23 | // GetUser reads the user from the context - shared implementation |
| 24 | func GetUser(ctx context.Context) *models.User { |
| 25 | if ctx == nil { |
| 26 | return nil |
| 27 | } |
| 28 | obj := ctx.Value(UserKey) |
| 29 | if obj == nil { |
| 30 | return nil |
| 31 | } |
| 32 | return obj.(*models.User) |
| 33 | } |
| 34 | |
| 35 | // WithUser adds the user to the context - shared implementation |
| 36 | func WithUser(ctx context.Context, u *models.User) context.Context { |
no test coverage detected
searching dependent graphs…