cleanup

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

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