cleanup

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2025 License: AGPL-3.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCleanupTimeout = 10 * time.Minute

Functions

This section is empty.

Types

type Cleanup

type Cleanup struct {
	// contains filtered or unexported fields
}

Cleanup is a type that can be used to run deferred cleanup logic with error handling. If the timeout is not set, it will default to 10 minutes. Cleanup logic uses the background context to ensure it runs even if the original context was canceled. Usage: defer cleanup.To(func() error { return nil }).WithErrMessage("some message").WithOriginalErr(&err).Done()

func To

func To(cleanupLogic func(*contexts.Context) error) *Cleanup

func (*Cleanup) Run

func (c *Cleanup) Run() error

func (*Cleanup) WithErrMessage

func (c *Cleanup) WithErrMessage(errMessage string, args ...interface{}) *Cleanup

func (*Cleanup) WithOriginalErr

func (c *Cleanup) WithOriginalErr(err *error) *Cleanup

func (*Cleanup) WithParentCtx

func (c *Cleanup) WithParentCtx(ctx *contexts.Context) *Cleanup

func (*Cleanup) WithTimeout

func (c *Cleanup) WithTimeout(timeout time.Duration) *Cleanup

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL