kunit

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fn

type Fn func(ctx kctx.Context, input ...any) (output any, err kerr.Error)

type Role

type Role string
const (
	RoleFramework Role = "Framework"
	RoleComponent Role = "Component"
	RoleModule    Role = "Module"
	RoleRouter    Role = "Router"
	RoleServer    Role = "Server"
	RoleUnit      Role = "Unit"
	RolePlugin    Role = "Plugin"
	RoleUnknown   Role = "Unknown"

	NoName = "unknown"
)

type Unit

type Unit interface {
	Cost() time.Duration
	Name() string
	Role() Role
	Call(ctx kctx.Context, input ...any) (any, kerr.Error)
	SetRole(role Role) Unit
	SetName(name string) Unit
	SetFn(fn Fn) Unit
	Setup(ctx kctx.Context) kerr.Error
}

修正后

func NewUnit

func NewUnit(name string, fn ...Fn) Unit

NewUnit 创建单元

Jump to

Keyboard shortcuts

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