dig
dig copied to clipboard
question. Reinitialization provide
hello. I have such a code
container.Provide(func(clientCfg *config.Ignite) database.Db {
ignite, err := database.NewIgnite(ctx, clientCfg)
if err != nil {
logger.Error(fmt.Errorf("container provide error: %w", err))
return nil
} else {
return ignite
}
})
if the database is not available at the time of initialization, further calls will return nil
container.Invoke(func(ignite database.Db) error {
//....
})
is it possible to make it so that when an error occurs atabase.NewIgnite(ctx, clientCfg)
the container didn't remember the response, but the code went to container.Provide
again?