product

package
v4.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Boot

func Boot() error

func From

func From(product *types.Product) error

func Load

func Load(id string) error

Types

type Event

type Event struct {
	Name        string       `json:"name"`
	Label       string       `json:"label"`
	Description string       `json:"description,omitempty"` //说明
	Type        string       `json:"type"`                  //info alert error
	Level       uint8        `json:"level"`
	Output      []*Parameter `json:"output"`
}

type Function

type Function struct {
	Name        string       `json:"name"`
	Label       string       `json:"label"`
	Description string       `json:"description,omitempty"` //说明
	Async       bool         `json:"async"`                 //异步接口
	Input       []*Parameter `json:"input"`
	Output      []*Parameter `json:"output"`
}

type Manifest

type Manifest struct {

	//物模型
	Properties []*Property `json:"properties,omitempty"` //属性
	Functions  []*Function `json:"functions,omitempty"`  //接口
	Events     []*Event    `json:"events,omitempty"`     //事件

	//参数
	Parameters []*Parameter `json:"parameters,omitempty"` //参数

	Validators  []*types.Validator  `json:"validators,omitempty"`
	Aggregators []*types.Aggregator `json:"aggregators,omitempty"`
}

type Parameter

type Parameter struct {
	Name        string     `json:"name"`
	Label       string     `json:"label"`
	Description string     `json:"description,omitempty"` //说明
	Type        types.Type `json:"type"`                  //int float ....
	Unit        string     `json:"unit"`                  //单位
	Default     any        `json:"default,omitempty"`
}

type Product

type Product struct {
	*types.Product
	*Manifest

	ExternalValidators  []*types.ExternalValidator
	ExternalAggregators []*types.ExternalAggregator
}

func Ensure

func Ensure(id string) (*Product, error)

func Get

func Get(id string) *Product

func New

func New(product *types.Product) *Product

func (*Product) StoreManifest

func (p *Product) StoreManifest() error

type Property

type Property struct {
	Name        string     `json:"name"`
	Label       string     `json:"label"`
	Description string     `json:"description,omitempty"` //说明
	Type        types.Type `json:"type"`                  //int float ....
	Unit        string     `json:"unit"`                  //单位
	Mode        string     `json:"mode"`                  //读取模式 r w rw
	Store       string     `json:"store"`                 // save diff
}

Jump to

Keyboard shortcuts

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