go-tstr / tstr / dep / depfn

github.com/go-tstr/tstr/dep/depfn

pkg.go.dev source
go get github.com/go-tstr/tstr/dep/depfn@v0.2.2

Types

type DepFn

type DepFn struct {
	// contains filtered or unexported fields
}

func New

func New(start, ready, stop func() error) DepFn

New creates a new DepFn with the provided start, ready, and stop functions. If any of the functions is nil, it will be treated as a no-op and nil is returned when they are called. This provides a simple way to create dependencies without needing to implement the full Dependency interface.

func (DepFn) Ready

func (f DepFn) Ready() error

func (DepFn) Start

func (f DepFn) Start() error

func (DepFn) Stop

func (f DepFn) Stop() error