Skip to content

Lifetime Methods

Roman edited this page Jan 11, 2023 · 2 revisions

Lifetime Methods

There are a few methods available which can be used to setup and teardown things.

Global Methods

To register a global setup or teardown method which is just run once, just register one of the following method with your logic:

gotaskr.Setup(func() error {
    ...
})
// or
gotaskr.Teardown(func() error {
    ...
})

Task Methods

To add a method which does a setup and/or teardown before/after each task, register the one of the following methods:

gotaskr.TaskSetup(func() error {
    ...
})
// or
gotaskr.TaskTeardown(func() error {
    ...
})
Clone this wiki locally