resource

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 5 Imported by: 0

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