WithDB injects the request's database into the context.
(ctx stdctx.Context, db *database.DB)
| 18 | |
| 19 | // WithDB injects the request's database into the context. |
| 20 | func WithDB(ctx stdctx.Context, db *database.DB) stdctx.Context { |
| 21 | return stdctx.WithValue(ctx, dbContextKey, db) |
| 22 | } |
| 23 | |
| 24 | // DBFromContext returns the request's database from the context, or nil if not set. |
| 25 | func DBFromContext(ctx stdctx.Context) *database.DB { |