cobradig

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 4 Imported by: 0

README

GoDoc reference

CobraDig

CobraDig allows cobra and dig to be used together

Import as "go.ptx.dk/cobradig""

Example

See Demos

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Invoke

func Invoke(c *dig.Container, f interface{}) func(cmd *cobra.Command, args []string) error

func ProvideContext

func ProvideContext(cc *dig.Container) error

ProvideContext this will look for a ContextBuilder and invoke it if a context is needed. the cancel function is added as a post hook

Types

type ContextBuilder

type ContextBuilder func() (context.Context, context.CancelFunc)

ContextBuilder must be provided in the container

type Hook

type Hook struct {
	// Pre func () error
	Post func() error
}

Directories

Path Synopsis
demos

Jump to

Keyboard shortcuts

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