Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Detach ¶
Detach creates a detached context (without cancel and deadline) from a parent ctx. Example:
import myapp/context func home(w http.ResponseWriter, r *http.Request) { log.Println("home") // Create a Detached context detachedCtx := context.Detach(r.Context()) detachedDeadline, ok := detachedCtx.Deadline() fmt.Println("DETACHED ---") fmt.Println("Deadline():", detachedDeadline, ok) // 0001-01-01 00:00:00 +0000 UTC false fmt.Println("Err():", r.Context().Err()) // <empty> backgroundTask.Run(detachedCtx) // prevents task stop when r.Context has cancelled }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.