component

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Plugin

func Plugin(
	module string,
	factory Factory,
) map[string][]interface{}

func Register

func Register(name string, factory Factory) error

Types

type Component

type Component interface {
	// 组件实例配置
	SampleConfig() string

	// 组件描述
	Description() string

	// 获取组件实例对象
	Instance() Instance

	// 组件启动
	Start() error

	// 组件停止
	Stop() error
}

type Factory

type Factory = func(config string) (Component, error)

func GetFactory

func GetFactory(name string) (Factory, error)

type Instance

type Instance interface {
	Name() string
	// 组件的Go Type
	Type() reflect.Type
	// 组件的Go Type
	Value() reflect.Value
	// 组件的实例
	Interface() interface{}
}

func NewInstance

func NewInstance(name string, typ reflect.Type, value reflect.Value, iface interface{}) Instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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