Documentation
¶
Overview ¶
Package fun contains functional types with useful helper methods.
For more information, please visit https://github.com/alebabai/fun
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer func(v interface{}) error
Consumer represents an operation that accepts a single input argument or returns an error.
func (Consumer) AndThen ¶
AndThen returns a composed Consumer that performs, in sequence, this operation followed by the after operation. If performing this operation returns an error, the after operation will not be performed. If after is nil, it returns original consumer.
func (Consumer) ToMustConsumer ¶
func (c Consumer) ToMustConsumer() MustConsumer
ToMustConsumer transforms Consumer into MustConsumer
func (Consumer) ToSilentConsumer ¶
func (c Consumer) ToSilentConsumer() SilentConsumer
ToSilentConsumer transforms Consumer into SilentConsumer
type MustConsumer ¶
type MustConsumer func(v interface{})
MustConsumer represents an operation that accepts a single input argument without returning an error. In case of an error it should panic with error value.
func (MustConsumer) AndThen ¶
func (mc MustConsumer) AndThen(after MustConsumer) MustConsumer
AndThen returns a composed MustConsumer that performs, in sequence, this operation followed by the after operation. If performing this operation returns an error, the after operation will not be performed. If after is nil, it returns original consumer.
func (MustConsumer) ToConsumer ¶
func (mc MustConsumer) ToConsumer() Consumer
ToConsumer transforms MustConsumer into Consumer
func (MustConsumer) ToSilentConsumer ¶
func (mc MustConsumer) ToSilentConsumer() SilentConsumer
ToSilentConsumer transforms MustConsumer into SilentConsumer
type MustSupplier ¶
type MustSupplier func() interface{}
MustSupplier represents a supplier of results without returning an error. In case of an error it should panic with error value.
func (MustSupplier) ToSilentSupplier ¶
func (ms MustSupplier) ToSilentSupplier() SilentSupplier
ToSilentSupplier transforms MustSupplier into SilentSupplier
func (MustSupplier) ToSupplier ¶
func (ms MustSupplier) ToSupplier() Supplier
ToSupplier transforms MustSupplier into Supplier
type SilentConsumer ¶
type SilentConsumer func(v interface{})
SilentConsumer represents an operation that accepts a single input argument without returning an error.
func (SilentConsumer) AndThen ¶
func (sc SilentConsumer) AndThen(after SilentConsumer) SilentConsumer
AndThen returns a composed SilentConsumer that performs, in sequence, this operation followed by the after operation. If after is nil, it returns original consumer.
type SilentSupplier ¶
type SilentSupplier func() interface{}
SilentSupplier represents a supplier of results without returning an error. In case of an error it should just return the default value of the type.
type Supplier ¶
type Supplier func() (interface{}, error)
Supplier represents a supplier of results or an error.
func (Supplier) ToMustSupplier ¶
func (s Supplier) ToMustSupplier() MustSupplier
ToMustSupplier transforms Supplier into MustSupplier
func (Supplier) ToSilentSupplier ¶
func (s Supplier) ToSilentSupplier() SilentSupplier
ToSilentSupplier transforms Supplier into SilentSupplier