resource

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 5 Imported by: ? modules, 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

This section is empty.

Functions

This section is empty.

Types

type Closer

type Closer func(ctx context.Context) error

Closer 关闭持有外部资源的回调(谁创建谁关闭)。

type Group

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

Group 按注册逆序关闭资源,供 Provider / 测试复用。

func NewGroup

func NewGroup() *Group

func (*Group) Add

func (g *Group) Add(name string, fn Closer)

Add 注册关闭回调;name 用于错误信息。

func (*Group) Close

func (g *Group) Close(ctx context.Context) error

Close 逆序执行关闭;合并错误。

Source Files

  • group.go

Jump to

Keyboard shortcuts

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