functions

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package functions contains higher-order functions that are useful for various purposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Memoize

func Memoize[CK CacheKeyer, R any](f func(...any) R, ck CK) func(...any) R

Memoize returns a function that caches the results of f using the CacheKeyer provided for the key. The function f should return a value of type R, which will be cached.

func Negate

func Negate(f func(...any) bool) func(...any) bool

Negate returns a function that negates the result of the given function f.

Types

type CacheKeyer

type CacheKeyer interface {
	// Key returns a string that can be used as a key in a cache.
	Key(...any) string
}

CacheKeyer is an interface that represents any type that can be used as a key in a cache.

Jump to

Keyboard shortcuts

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