Get returns the Database attached to the given context.
(ctx context.Context)
| 87 | |
| 88 | // Get returns the Database attached to the given context. |
| 89 | func Get(ctx context.Context) Database { |
| 90 | if val := ctx.Value(databaseKey); val != nil { |
| 91 | return val.(Database) |
| 92 | } |
| 93 | panic("database missing from context") |
| 94 | } |
| 95 | |
| 96 | // Put amends a Context by attaching a Database reference to it. |
| 97 | func Put(ctx context.Context, d Database) context.Context { |
no test coverage detected