Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseAsNeeded ¶ added in v0.3.0
func CloseAsNeeded(c CloseableWithCheck, lf misc.LoggerFunc)
CloseAsNeeded closes the resource if it is not already closed. It logs any errors that occur during the closing process.
func CloseResource ¶
func CloseResource(c Closeable, lf misc.LoggerFunc)
CloseResource attempts to close the resource and logs any errors that occur.
func WaitForShutdown ¶
func WaitForShutdown(ctx context.Context, shutdown ShutdownFunc)
WaitForShutdown waits for an interrupt or context cancellation signal to perform a shutdown.
Types ¶
type Closeable ¶
type Closeable interface {
Close() error
}
Closeable is an interface that defines a resource with a Close method.
type CloseableWithCheck ¶ added in v0.3.0
CloseableWithCheck extends Closeable, adding the IsClosed method to check if the resource is already closed.
type ShutdownFunc ¶
type ShutdownFunc func() error
ShutdownFunc defines the function signature for shutdown procedures.
Click to show internal directories.
Click to hide internal directories.