function

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package function implements some functions for control the function execution and some is for functional programming.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(n int, fn interface{}) func(args ...interface{}) []reflect.Value

After creates a function that invokes func once it's called n or more times

func Before

func Before(n int, fn interface{}) func(args ...interface{}) []reflect.Value

Before creates a function that invokes func once it's called less than n times

func Compose

func Compose(fnList ...func(...interface{}) interface{}) func(...interface{}) interface{}

Compose compose the functions from right to left

func Delay

func Delay(delay time.Duration, fn interface{}, args ...interface{})

Delay make the function execution after delayed time

func Schedule

func Schedule(d time.Duration, fn interface{}, args ...interface{}) chan bool

Schedule invoke function every duration time, util close the returned bool chan

Types

type Fn

type Fn func(...interface{}) interface{}

Fn is for curry function which is func(...interface{}) interface{}

func (Fn) Curry

func (f Fn) Curry(i interface{}) func(...interface{}) interface{}

Curry make a curry function

Jump to

Keyboard shortcuts

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