lang

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: MIT Imports: 6 Imported by: 49

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(t io.Closer) error

func Dispose

func Dispose(t Disposable) error

func Release

func Release(pool ReleasePool) error

Types

type Context added in v0.0.33

type Context interface {
	context.Context

	SetValue(key string, value interface{})
}

Context 是对 context.Context 的扩展,是个可编辑的上下文

type DefaultErrorCollector

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

func (*DefaultErrorCollector) Append

func (inst *DefaultErrorCollector) Append(err error)

func (*DefaultErrorCollector) AppendIfFalse

func (inst *DefaultErrorCollector) AppendIfFalse(value bool, msg string)

func (*DefaultErrorCollector) AppendIfNil

func (inst *DefaultErrorCollector) AppendIfNil(value Object, msg string)

func (*DefaultErrorCollector) LastError

func (inst *DefaultErrorCollector) LastError() error

func (*DefaultErrorCollector) Result

func (inst *DefaultErrorCollector) Result() error

type Disposable

type Disposable interface {
	Dispose() error
}

Disposable 接口用于释放对象持有的资源

type ErrorCollector

type ErrorCollector interface {
	Append(err error)
	AppendIfFalse(ok bool, msg string)
	AppendIfNil(target Object, msg string)

	LastError() error
	Result() error
}

ErrorCollector 表示一个错误收集器

func NewErrorCollector

func NewErrorCollector() ErrorCollector

NewErrorCollector 创建一个错误收集器

type ErrorHandler

type ErrorHandler interface {
	OnError(err error)
}

func DefaultErrorHandler

func DefaultErrorHandler() ErrorHandler

type Object

type Object interface {
}

type PriorityProvider

type PriorityProvider interface {
	Priority() int
}

type ReleasePool

type ReleasePool interface {
	Release() error
	Push(target Disposable)
}

func CreateReleasePool

func CreateReleasePool() ReleasePool

type SimpleReleasePool

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

func (*SimpleReleasePool) Push

func (inst *SimpleReleasePool) Push(target Disposable)

func (*SimpleReleasePool) Release

func (inst *SimpleReleasePool) Release() error

type Stringer added in v0.0.33

type Stringer interface {
	String() string
}

Stringer 是一个简单的接口,它把对象格式化为字符串

type TryChain

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

func (*TryChain) Result

func (inst *TryChain) Result() error

func (*TryChain) Try

func (inst *TryChain) Try(task func() error) *TryChain

type URI added in v0.0.39

type URI interface {
	URL() *url.URL
	String() string

	Scheme() string
	User() string // username and password information
	Host() string // host or host:port
	Port() int
	Path() string     // path (relative paths may omit leading slash)
	Query() string    // encoded query values, without '?'
	Fragment() string // fragment for references, without '#'
}

URI 提供一个只读的URI接口

func CreateURI added in v0.0.39

func CreateURI(url *url.URL) URI

CreateURI 创建URI

func ParseURI added in v0.0.39

func ParseURI(str string) (URI, error)

ParseURI 解析URI

Jump to

Keyboard shortcuts

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