Skip to content

Onload Job

The einar-cli allows you to generate custom onload jobs by automatically creating the necessary files and imports to manage your onload processes. These onload jobs will be loaded only after all their dependencies have been satisfied and will be executed just once when the application is run.

👨‍💻 Generate a New OnloadJob

Inside your project directory, run the following command to create a new custom onload job:

Terminal window
einar generate onload-job my-job-name

Here’s an example of how the generated code will look:

Terminal window
func init() {
ioc.Registry(myJobName)
}
func myJobName() {
//execute your onload job here
}