package hsync
import "github.com/gohugoio/hugo/common/hsync"
Index ¶
- type FuncResetter
- func OnceMoreFunc(f func(context.Context) error) FuncResetter
- func (v *FuncResetter) Do(ctx context.Context) error
- func (v *FuncResetter) Reset()
- type OnceMore
- type ValueResetter
Types ¶
type FuncResetter ¶
type FuncResetter struct {
// contains filtered or unexported fields
}
func OnceMoreFunc ¶
func OnceMoreFunc(f func(context.Context) error) FuncResetter
func (*FuncResetter) Do ¶
func (v *FuncResetter) Do(ctx context.Context) error
func (*FuncResetter) Reset ¶
func (v *FuncResetter) Reset()
type OnceMore ¶
type OnceMore struct {
// contains filtered or unexported fields
}
OnceMore is similar to sync.Once.
Additional features are: * it can be reset, so the action can be repeated if needed * it has methods to check if it's done or in progress
func (*OnceMore) Do ¶
func (t *OnceMore) Do(f func())
func (*OnceMore) Done ¶
func (*OnceMore) Reset ¶
func (t *OnceMore) Reset()
type ValueResetter ¶
type ValueResetter[T any] struct { // contains filtered or unexported fields }
func OnceMoreValue ¶
func OnceMoreValue[T any](f func(context.Context) T) ValueResetter[T]
OnceMoreValue returns a function that invokes f only once and returns the value returned by f. The returned function may be called concurrently.
If f panics, the returned function will panic with the same value on every call.
func (*ValueResetter[T]) Reset ¶
func (v *ValueResetter[T]) Reset()
func (*ValueResetter[T]) Value ¶
func (v *ValueResetter[T]) Value(ctx context.Context) T
Source Files ¶
- Version
- v0.153.4 (latest)
- Published
- Dec 28, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 4 months ago –
Tools for package owners.