getInstance reads the instance id from the context.
(ctx context.Context)
| 103 | |
| 104 | // getInstance reads the instance id from the context. |
| 105 | func getInstance(ctx context.Context) *models.Instance { |
| 106 | obj := ctx.Value(instanceKey) |
| 107 | if obj == nil { |
| 108 | return nil |
| 109 | } |
| 110 | return obj.(*models.Instance) |
| 111 | } |
| 112 | |
| 113 | // withUser adds the user id to the context. |
| 114 | func withUser(ctx context.Context, u *models.User) context.Context { |
no test coverage detected
searching dependent graphs…