Skip to content
/ once Public

Utilities for calling functions only once.

Notifications You must be signed in to change notification settings

livebud/once

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Once

Go Reference

Utilities for calling functions only once. Safe for concurrent use. Supports generics.

Install

go get github.com/livebud/once

Usage

count := 0
fn := once.Func(func() (int, error) {
  count++
  return count, nil
})
res, err := fn()
// 1
res, err = fn()
// 1

Contributors

License

MIT

About

Utilities for calling functions only once.

Resources

Stars

Watchers

Forks

Packages

No packages published