mirror of
https://github.com/Icinga/icingadb.git
synced 2026-06-06 23:32:14 -04:00
Introduce WaiterFunc type
The WaiterFunc type is an adapter to allow the use of ordinary functions as Waiter.
This commit is contained in:
parent
585d1e6bb5
commit
9ce2cff5c0
1 changed files with 9 additions and 0 deletions
|
|
@ -66,6 +66,15 @@ type Waiter interface {
|
|||
Wait() error // Wait waits for execution to complete.
|
||||
}
|
||||
|
||||
// The WaiterFunc type is an adapter to allow the use of ordinary functions as Waiter.
|
||||
// If f is a function with the appropriate signature, WaiterFunc(f) is a Waiter that calls f.
|
||||
type WaiterFunc func() error
|
||||
|
||||
// Wait implements the Waiter interface.
|
||||
func (f WaiterFunc) Wait() error {
|
||||
return f()
|
||||
}
|
||||
|
||||
// Initer implements the Init method,
|
||||
// which initializes the object in addition to zeroing.
|
||||
type Initer interface {
|
||||
|
|
|
|||
Loading…
Reference in a new issue