types

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package types provides common interface contracts and function adapters used across the foomo ecosystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Causer added in v0.17.0

type Causer interface {
	Cause() error
}

Causer is implemented by errors that wrap an underlying cause, distinct from the chain unwrapped by errors.Unwrap.

type CauserFunc added in v0.17.0

type CauserFunc func() error

CauserFunc adapts a func() error to a Causer.

func (CauserFunc) Cause added in v0.17.0

func (f CauserFunc) Cause() error

Cause calls f and returns its result.

type CloseFunc

type CloseFunc func()

CloseFunc adapts a func() to a Closer, ignoring ctx and always returning nil.

func (CloseFunc) Close

func (f CloseFunc) Close(ctx context.Context) error

Close calls f and returns nil.

type CloseFuncCtx

type CloseFuncCtx func(context.Context)

CloseFuncCtx adapts a func(context.Context) to a Closer, always returning nil.

func (CloseFuncCtx) Close

func (f CloseFuncCtx) Close(ctx context.Context) error

Close calls f with ctx and returns nil.

type CloseFuncCtxErr

type CloseFuncCtxErr func(context.Context) error

CloseFuncCtxErr adapts a func(context.Context) error to a Closer.

func (CloseFuncCtxErr) Close

func (f CloseFuncCtxErr) Close(ctx context.Context) error

Close calls f with ctx and returns its result.

type CloseFuncErr

type CloseFuncErr func() error

CloseFuncErr adapts a func() error to a Closer, ignoring ctx.

func (CloseFuncErr) Close

func (f CloseFuncErr) Close(ctx context.Context) error

Close calls f and returns its result.

type Closer

type Closer interface {
	Close(ctx context.Context) error
}

Closer is implemented by types that release resources on Close.

func AsCloser

func AsCloser(v any) (Closer, bool)

AsCloser adapts v to a Closer if v is a Closer or one of func(), func() error, func(context.Context), or func(context.Context) error. It reports false if v matches none of these shapes.

type Namer

type Namer interface {
	Name() string
}

Namer is implemented by types that expose an identifying name.

type PingFunc

type PingFunc func()

PingFunc adapts a func() to a Pinger, ignoring ctx and always returning nil.

func (PingFunc) Ping

func (f PingFunc) Ping(ctx context.Context) error

Ping calls f and returns nil.

type PingFuncCtx

type PingFuncCtx func(context.Context)

PingFuncCtx adapts a func(context.Context) to a Pinger, always returning nil.

func (PingFuncCtx) Ping

func (f PingFuncCtx) Ping(ctx context.Context) error

Ping calls f with ctx and returns nil.

type PingFuncCtxErr

type PingFuncCtxErr func(context.Context) error

PingFuncCtxErr adapts a func(context.Context) error to a Pinger.

func (PingFuncCtxErr) Ping

func (f PingFuncCtxErr) Ping(ctx context.Context) error

Ping calls f with ctx and returns its result.

type PingFuncErr

type PingFuncErr func() error

PingFuncErr adapts a func() error to a Pinger, ignoring ctx.

func (PingFuncErr) Ping

func (f PingFuncErr) Ping(ctx context.Context) error

Ping calls f and returns its result.

type Pinger

type Pinger interface {
	Ping(ctx context.Context) error
}

Pinger is implemented by types that can check liveness of a connection or dependency on demand.

func AsPinger

func AsPinger(v any) (Pinger, bool)

AsPinger adapts v to a Pinger if v is a Pinger or one of func(), func() error, func(context.Context), or func(context.Context) error. It reports false if v matches none of these shapes.

type ShutdownFunc

type ShutdownFunc func()

ShutdownFunc adapts a func() to a Shutdowner, ignoring ctx and always returning nil.

func (ShutdownFunc) Shutdown

func (f ShutdownFunc) Shutdown(ctx context.Context) error

Shutdown calls f and returns nil.

type ShutdownFuncCtx

type ShutdownFuncCtx func(context.Context)

ShutdownFuncCtx adapts a func(context.Context) to a Shutdowner, always returning nil.

func (ShutdownFuncCtx) Shutdown

func (f ShutdownFuncCtx) Shutdown(ctx context.Context) error

Shutdown calls f with ctx and returns nil.

type ShutdownFuncCtxErr

type ShutdownFuncCtxErr func(context.Context) error

ShutdownFuncCtxErr adapts a func(context.Context) error to a Shutdowner.

func (ShutdownFuncCtxErr) Shutdown

func (f ShutdownFuncCtxErr) Shutdown(ctx context.Context) error

Shutdown calls f with ctx and returns its result.

type ShutdownFuncErr

type ShutdownFuncErr func() error

ShutdownFuncErr adapts a func() error to a Shutdowner, ignoring ctx.

func (ShutdownFuncErr) Shutdown

func (f ShutdownFuncErr) Shutdown(ctx context.Context) error

Shutdown calls f and returns its result.

type Shutdowner

type Shutdowner interface {
	Shutdown(ctx context.Context) error
}

Shutdowner is implemented by types that perform a graceful shutdown.

func AsShutdowner

func AsShutdowner(v any) (Shutdowner, bool)

AsShutdowner adapts v to a Shutdowner if v is a Shutdowner or one of func(), func() error, func(context.Context), or func(context.Context) error. It reports false if v matches none of these shapes.

type StartFunc added in v0.11.0

type StartFunc func()

StartFunc adapts a func() to a Starter, ignoring ctx and always returning nil.

func (StartFunc) Start added in v0.11.0

func (f StartFunc) Start(ctx context.Context) error

Start calls f and returns nil.

type StartFuncCtx added in v0.11.0

type StartFuncCtx func(context.Context)

StartFuncCtx adapts a func(context.Context) to a Starter, always returning nil.

func (StartFuncCtx) Start added in v0.11.0

func (f StartFuncCtx) Start(ctx context.Context) error

Start calls f with ctx and returns nil.

type StartFuncCtxErr added in v0.11.0

type StartFuncCtxErr func(context.Context) error

StartFuncCtxErr adapts a func(context.Context) error to a Starter.

func (StartFuncCtxErr) Start added in v0.11.0

func (f StartFuncCtxErr) Start(ctx context.Context) error

Start calls f with ctx and returns its result.

type StartFuncErr added in v0.11.0

type StartFuncErr func() error

StartFuncErr adapts a func() error to a Starter, ignoring ctx.

func (StartFuncErr) Start added in v0.11.0

func (f StartFuncErr) Start(ctx context.Context) error

Start calls f and returns its result.

type Starter added in v0.11.0

type Starter interface {
	Start(ctx context.Context) error
}

Starter is implemented by types that perform a startup action.

func AsStarter added in v0.11.0

func AsStarter(v any) (Starter, bool)

AsStarter adapts v to a Starter if v is a Starter or one of func(), func() error, func(context.Context), or func(context.Context) error. It reports false if v matches none of these shapes.

type StopFunc

type StopFunc func()

StopFunc adapts a func() to a Stopper, ignoring ctx and always returning nil.

func (StopFunc) Stop

func (f StopFunc) Stop(ctx context.Context) error

Stop calls f and returns nil.

type StopFuncCtx

type StopFuncCtx func(context.Context)

StopFuncCtx adapts a func(context.Context) to a Stopper, always returning nil.

func (StopFuncCtx) Stop

func (f StopFuncCtx) Stop(ctx context.Context) error

Stop calls f with ctx and returns nil.

type StopFuncCtxErr

type StopFuncCtxErr func(context.Context) error

StopFuncCtxErr adapts a func(context.Context) error to a Stopper.

func (StopFuncCtxErr) Stop

func (f StopFuncCtxErr) Stop(ctx context.Context) error

Stop calls f with ctx and returns its result.

type StopFuncErr

type StopFuncErr func() error

StopFuncErr adapts a func() error to a Stopper, ignoring ctx.

func (StopFuncErr) Stop

func (f StopFuncErr) Stop(ctx context.Context) error

Stop calls f and returns its result.

type Stopper

type Stopper interface {
	Stop(ctx context.Context) error
}

Stopper is implemented by types that perform a stop action.

func AsStopper

func AsStopper(v any) (Stopper, bool)

AsStopper adapts v to a Stopper if v is a Stopper or one of func(), func() error, func(context.Context), or func(context.Context) error. It reports false if v matches none of these shapes.

type Stringer

type Stringer interface {
	String() string
}

Stringer is implemented by types that can format themselves as a string. It mirrors fmt.Stringer and exists so packages that depend on the types package need not import fmt.

type UnsubscribeFunc

type UnsubscribeFunc func()

UnsubscribeFunc adapts a func() to an Unsubscriber, ignoring ctx and always returning nil.

func (UnsubscribeFunc) Unsubscribe

func (f UnsubscribeFunc) Unsubscribe(ctx context.Context) error

Unsubscribe calls f and returns nil.

type UnsubscribeFuncCtx

type UnsubscribeFuncCtx func(context.Context)

UnsubscribeFuncCtx adapts a func(context.Context) to an Unsubscriber, always returning nil.

func (UnsubscribeFuncCtx) Unsubscribe

func (f UnsubscribeFuncCtx) Unsubscribe(ctx context.Context) error

Unsubscribe calls f with ctx and returns nil.

type UnsubscribeFuncCtxErr

type UnsubscribeFuncCtxErr func(context.Context) error

UnsubscribeFuncCtxErr adapts a func(context.Context) error to an Unsubscriber.

func (UnsubscribeFuncCtxErr) Unsubscribe

func (f UnsubscribeFuncCtxErr) Unsubscribe(ctx context.Context) error

Unsubscribe calls f with ctx and returns its result.

type UnsubscribeFuncErr

type UnsubscribeFuncErr func() error

UnsubscribeFuncErr adapts a func() error to an Unsubscriber, ignoring ctx.

func (UnsubscribeFuncErr) Unsubscribe

func (f UnsubscribeFuncErr) Unsubscribe(ctx context.Context) error

Unsubscribe calls f and returns its result.

type Unsubscriber

type Unsubscriber interface {
	Unsubscribe(ctx context.Context) error
}

Unsubscriber is implemented by types that cancel a subscription.

func AsUnsubscriber

func AsUnsubscriber(v any) (Unsubscriber, bool)

AsUnsubscriber adapts v to an Unsubscriber if v is an Unsubscriber or one of func(), func() error, func(context.Context), or func(context.Context) error. It reports false if v matches none of these shapes.

Jump to

Keyboard shortcuts

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