fun

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 0 Imported by: 0

README

fun

Functional types for Golang

build version report coverage tag reference

The Roadmap

  • Basic functional types
    • Supplier
    • Consumer
    • BiConsumer
    • Runnable
    • Predicate
    • Function
    • BiFunction
    • UnaryOperator
    • BinaryOperator
  • Infrastructure
    • Makefile
    • CI/CD
      • Run lints
      • Build artifacts
      • Run tests
      • Coverage report (codecov)
      • Add badges to the README
  • Documentation
    • Review codebase docs
    • Document codebase
    • Add examples to the README
  • Complex function types
    • Optional

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

func (c Consumer) AndThen(after Consumer) Consumer

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

Directories

Path Synopsis
codegen module

Jump to

Keyboard shortcuts

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