ctxutils

package module
v0.0.0-...-3304141 Latest Latest
Warning

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

Go to latest
Published: May 7, 2018 License: MIT Imports: 1 Imported by: 4

README

ctxutils

GoDoc Reference Build Status Coverage Status Go Report Card

Description

ctxutils is a golang package that defines context utility functions.

Installation

This package can be installed with the go get command:

go get github.com/ebonetti/ctxutils

Documentation

API documentation can be found in the associated godoc reference

Documentation

Overview

Package ctxutils defines context utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithFail

func WithFail(parent context.Context) (ctx context.Context, fail func(error) error)

WithFail returns a copy of parent with a new Done channel. The returned context's Done channel is closed when the returned fail function is called or when the parent context's Done channel is closed, whichever happens first. Fail semantic is the following: when the context has yet to be cancelled - so fail is called for the first time - it cancel the associated context and return the error; subsequent calls to fail result in no further action, returning the first error.

Calling fail on this context releases resources associated with it, so code should call it as soon as the operations running in this Context complete. Fail is thread safe

Types

This section is empty.

Jump to

Keyboard shortcuts

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