sync

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2018 License: Apache-2.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Init

type Init struct {
	// contains filtered or unexported fields
}

Init is a helper to perform initializer function only single time and return saved error if any

func (*Init) Do

func (init *Init) Do(initializer func() error) (err error)

Do calls function initializer only for the first time for this instance of Init and saves error returned from it if any. Do returns nil if no error happened during the initializer execution or it returns error. Even in case of error during initializer execution it will not be called second time, error will be saved and return each time Do called. If initializer panics, it'll be recovered and captured as error and returned by future Do calls.

Jump to

Keyboard shortcuts

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