mergectx

package
v0.0.0-...-0bfd988 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2018 License: MIT Imports: 4 Imported by: 1

README

mergectx

Package mergectx provides utilities for merging context.Context objects such that the resulting child context contains the union of the parent context's values.

Functions Join and Link behave analogously to their counterparts in the ctx package.

Documentation

Overview

Package mergectx provides a utility for merging two context.Context objects, creating a child context that contains the union of both context's values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Join

func Join(c0, c1 context.Context) context.Context

Join returns a new context which is the child of two parents. It behaves analogously to ctx.Join.Deadline

Done() channel is closed when both parent contexts are done.

Deadline() returns the latest deadline of the two parent contexts.

Err() returns the first error it finds. Note that this is not reliable.

Value(key) looks for key in parent contexts. First found is returned.

func Link(c0, c1 context.Context) context.Context

Link returns new context which is the child of child of two parents. It is analogous to ctx.Link

Done() channel is closed when one of parents contexts is done.

Deadline() returns earliest deadline between parent contexts.

Err() returns error from first done parent context.

Value(key) looks for key in parent contexts. First found is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL