Documentation
¶
Overview ¶
Package types provides common interface contracts and function adapters used across the foomo ecosystem.
Index ¶
- type Causer
- type CauserFunc
- type CloseFunc
- type CloseFuncCtx
- type CloseFuncCtxErr
- type CloseFuncErr
- type Closer
- type Namer
- type PingFunc
- type PingFuncCtx
- type PingFuncCtxErr
- type PingFuncErr
- type Pinger
- type ShutdownFunc
- type ShutdownFuncCtx
- type ShutdownFuncCtxErr
- type ShutdownFuncErr
- type Shutdowner
- type StartFunc
- type StartFuncCtx
- type StartFuncCtxErr
- type StartFuncErr
- type Starter
- type StopFunc
- type StopFuncCtx
- type StopFuncCtxErr
- type StopFuncErr
- type Stopper
- type Stringer
- type UnsubscribeFunc
- type UnsubscribeFuncCtx
- type UnsubscribeFuncCtxErr
- type UnsubscribeFuncErr
- type Unsubscriber
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.
type CloseFuncCtx ¶
CloseFuncCtx adapts a func(context.Context) to a Closer, always returning nil.
type CloseFuncCtxErr ¶
CloseFuncCtxErr adapts a func(context.Context) error to a Closer.
type CloseFuncErr ¶
type CloseFuncErr func() error
CloseFuncErr adapts a func() error to a Closer, ignoring ctx.
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.
type PingFuncCtx ¶
PingFuncCtx adapts a func(context.Context) to a Pinger, always returning nil.
type PingFuncCtxErr ¶
PingFuncCtxErr adapts a func(context.Context) error to a Pinger.
type PingFuncErr ¶
type PingFuncErr func() error
PingFuncErr adapts a func() error to a Pinger, ignoring ctx.
type Pinger ¶
Pinger is implemented by types that can check liveness of a connection or dependency on demand.
type ShutdownFunc ¶
type ShutdownFunc func()
ShutdownFunc adapts a func() to a Shutdowner, ignoring ctx and always returning nil.
type ShutdownFuncCtx ¶
ShutdownFuncCtx adapts a func(context.Context) to a Shutdowner, always returning nil.
type ShutdownFuncCtxErr ¶
ShutdownFuncCtxErr adapts a func(context.Context) error to a Shutdowner.
type ShutdownFuncErr ¶
type ShutdownFuncErr func() error
ShutdownFuncErr adapts a func() error to a Shutdowner, ignoring ctx.
type Shutdowner ¶
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.
type StartFuncCtx ¶ added in v0.11.0
StartFuncCtx adapts a func(context.Context) to a Starter, always returning nil.
type StartFuncCtxErr ¶ added in v0.11.0
StartFuncCtxErr adapts a func(context.Context) error to a Starter.
type StartFuncErr ¶ added in v0.11.0
type StartFuncErr func() error
StartFuncErr adapts a func() error to a Starter, ignoring ctx.
type StopFunc ¶
type StopFunc func()
StopFunc adapts a func() to a Stopper, ignoring ctx and always returning nil.
type StopFuncCtx ¶
StopFuncCtx adapts a func(context.Context) to a Stopper, always returning nil.
type StopFuncCtxErr ¶
StopFuncCtxErr adapts a func(context.Context) error to a Stopper.
type StopFuncErr ¶
type StopFuncErr func() error
StopFuncErr adapts a func() error to a Stopper, ignoring ctx.
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 ¶
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 ¶
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 ¶
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.