types

package
v4.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator struct {
	Crontab    string `json:"crontab"`    //定时计划
	Expression string `json:"expression"` //表达式
	Type       string `json:"type"`       //聚合算法 inc dec avg count min max sum last first
	Assign     string `json:"assign"`     //赋值
}

type Broker

type Broker struct {
	Id          string    `json:"id" xorm:"pk"`
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	Port        int       `json:"port,omitempty"` //TODO 添加TLS证书
	Disabled    bool      `json:"disabled,omitempty"`
	Created     time.Time `json:"created,omitempty" xorm:"created"`
}

type BrokerHistory

type BrokerHistory struct {
	Id       int64     `json:"id"`
	BrokerId string    `json:"broker_id" xorm:"index"`
	Event    string    `json:"event"`
	Created  time.Time `json:"created,omitempty" xorm:"created"`
}

type Calculator added in v4.0.11

type Calculator struct {
	Assign     string `json:"assign"`     //赋值
	Expression string `json:"expression"` //表达式
	// contains filtered or unexported fields
}

func (*Calculator) Eval added in v4.0.11

func (c *Calculator) Eval(ctx map[string]any) (err error)

type Device

type Device struct {
	Id        string `json:"id" xorm:"pk"` //ClientID
	GatewayId string `json:"gateway_id,omitempty" xorm:"index"`
	ProductId string `json:"product_id,omitempty" xorm:"index"`
	ProjectId string `json:"project_id,omitempty" xorm:"index"`

	ProductVersion string `json:"product_version,omitempty"`

	Gateway string `json:"gateway,omitempty" xorm:"<-"`
	Product string `json:"product,omitempty" xorm:"<-"`
	Project string `json:"project,omitempty" xorm:"<-"`

	Name        string             `json:"name"`
	Description string             `json:"description,omitempty"`
	Parameters  map[string]float64 `json:"parameters,omitempty" xorm:"json"` //模型参数,用于报警检查
	Disabled    bool               `json:"disabled,omitempty"`
	Created     time.Time          `json:"created,omitempty" xorm:"created"`

	Online bool `json:"online,omitempty" xorm:"-"`
}

type DeviceEvent

type DeviceEvent struct {
	Id       int64          `json:"id"`
	DeviceId string         `json:"device_id" xorm:"index"`
	Name     string         `json:"name"`
	Label    string         `json:"label"`
	Output   map[string]any `json:"output" xorm:"json"`
	Created  time.Time      `json:"created" xorm:"created"`
}

type DeviceHistory

type DeviceHistory struct {
	Id       int64     `json:"id" xorm:"pk"`
	DeviceId string    `json:"device_id" xorm:"index"`
	Event    string    `json:"event"`
	Created  time.Time `json:"created" xorm:"created"`
}

type ExternalAggregator

type ExternalAggregator struct {
	Id string `json:"id" xorm:"pk"`

	ProjectId string `json:"project_id" xorm:"index"`
	ProductId string `json:"product_id" xorm:"index"`
	DeviceId  string `json:"device_id" xorm:"index"`

	Name        string    `json:"name"`        //名称
	Description string    `json:"description"` //说明
	Disabled    bool      `json:"disabled"`    //禁用
	Created     time.Time `json:"created" xorm:"created"`

	Aggregator `xorm:"extends"`
}

type ExternalValidator

type ExternalValidator struct {
	Id string `json:"id" xorm:"pk"`

	ProjectId string `json:"project_id" xorm:"index"`
	ProductId string `json:"product_id" xorm:"index"`
	DeviceId  string `json:"device_id" xorm:"index"`

	Disabled bool      `json:"disabled"`
	Created  time.Time `json:"created" xorm:"created"`

	Validator `xorm:"extends"`
}

type Filter added in v4.0.11

type Filter struct {
	Field      string `json:"field"`         //字段
	Expression string `json:"expression"`    //表达式
	All        bool   `json:"all,omitempty"` //
	// contains filtered or unexported fields
}

func (*Filter) Check added in v4.0.11

func (c *Filter) Check(ctx map[string]any) (ret bool, err error)

type Gateway

type Gateway struct {
	Id          string `json:"id" xorm:"pk"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Username    string `json:"username,omitempty"`
	Password    string `json:"password,omitempty"`

	ProjectId string `json:"project_id,omitempty" xorm:"index"`
	Project   string `json:"project,omitempty" xorm:"<-"`

	Disabled bool      `json:"disabled,omitempty"`
	Created  time.Time `json:"created,omitempty" xorm:"created"`
}

type History

type History struct {
	Id       int64     `json:"id"`
	DeviceId string    `json:"device_id" xorm:"index"`
	Point    string    `json:"point" xorm:"index"` //数据点
	Value    float64   `json:"value"`              //值
	Time     time.Time `json:"time"`
}

type HistoryEx

type HistoryEx struct {
	History `xorm:"extends"`
	Device  string `json:"device,omitempty"`
}

func (*HistoryEx) TableName

func (h *HistoryEx) TableName() string

type Parameters

type Parameters map[string]float64

type Password

type Password struct {
	Id       string `json:"id" xorm:"pk"`
	Password string `json:"password"`
}

Password 密码

type Product

type Product struct {
	Id          string    `json:"id" xorm:"pk"`          //ID
	Icon        string    `json:"icon,omitempty"`        //图标
	Name        string    `json:"name,omitempty"`        //名称
	Url         string    `json:"url,omitempty"`         //链接
	Description string    `json:"description,omitempty"` //说明
	Keywords    []string  `json:"keywords,omitempty"`    //关键字
	Created     time.Time `json:"created" xorm:"created"`
}

type ProductExt

type ProductExt struct {
	Product
}

func (ProductExt) TableName

func (p ProductExt) TableName() string

type ProductVersion added in v4.0.12

type ProductVersion struct {
	ProductId string    `json:"product_id,omitempty" xorm:"PK"`
	Name      string    `json:"name,omitempty" xorm:"PK"` //版本 semver.Version
	Created   time.Time `json:"created" xorm:"created"`
}

type Project

type Project struct {
	Id          string    `json:"id" xorm:"pk"`
	Icon        string    `json:"icon,omitempty"`        //图标
	Name        string    `json:"name,omitempty"`        //名称
	Description string    `json:"description,omitempty"` //说明
	Keywords    []string  `json:"keywords,omitempty"`    //关键字
	Disabled    bool      `json:"disabled,omitempty"`
	Created     time.Time `json:"created" xorm:"created"`
}

type ProjectExt

type ProjectExt struct {
	Project
}

func (ProjectExt) TableName

func (p ProjectExt) TableName() string

type ProjectPlugin

type ProjectPlugin struct {
	ProjectId string    `json:"project_id" xorm:"pk"`
	PluginId  string    `json:"plugin_id" xorm:"pk"`
	Disabled  bool      `json:"disabled,omitempty"`
	Created   time.Time `json:"created" xorm:"created"`
}

type ProjectUser

type ProjectUser struct {
	ProjectId string    `json:"project_id" xorm:"pk"`
	UserId    string    `json:"user_id" xorm:"pk"`
	User      string    `json:"user,omitempty" xorm:"<-"`
	Admin     bool      `json:"admin,omitempty"`
	Disabled  bool      `json:"disabled,omitempty"`
	Created   time.Time `json:"created" xorm:"created"`
}

type Space

type Space struct {
	Id          string    `json:"id" xorm:"pk"`
	Name        string    `json:"name,omitempty"`        //名称
	Description string    `json:"description,omitempty"` //说明
	ProjectId   string    `json:"project_id,omitempty" xorm:"index"`
	Project     string    `json:"project,omitempty" xorm:"<-"`
	Disabled    bool      `json:"disabled,omitempty"`
	Created     time.Time `json:"created" xorm:"created"`
}

type SpaceDevice

type SpaceDevice struct {
	SpaceId  string    `json:"space_id" xorm:"pk"`
	DeviceId string    `json:"device_id" xorm:"pk"`
	Device   string    `json:"device,omitempty" xorm:"<-"`
	Name     string    `json:"name,omitempty"` //编程别名
	Created  time.Time `json:"created" xorm:"created"`
}

type Time

type Time time.Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (Time) MarshalText

func (t Time) MarshalText() ([]byte, error)

func (Time) Now

func (t Time) Now() Time

func (Time) ParseTime

func (t Time) ParseTime(tm time.Time) Time

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

type Type

type Type int

Type 数据类型

const (
	//TypeNONE 空类型
	TypeNONE Type = iota
	TypeBIT
	TypeBYTE
	TypeWORD
	TypeDWORD
	TypeQWORD
	TypeSHORT
	TypeINTEGER
	TypeLONG
	TypeFLOAT
	TypeDOUBLE
)

func (*Type) Decode

func (dt *Type) Decode(buf []byte, le bool, precision int) (val interface{}, err error)

Decode 解码

func (*Type) Default

func (dt *Type) Default() interface{}

func (*Type) Encode

func (dt *Type) Encode(value interface{}, le bool, precision int) []byte

Encode 编码

func (*Type) MarshalJSON

func (dt *Type) MarshalJSON() ([]byte, error)

MarshalJSON 序列化

func (*Type) Normalize

func (dt *Type) Normalize(val interface{}) interface{}

func (*Type) Parse

func (dt *Type) Parse(tp string) error

Parse 解析类型

func (*Type) Size

func (dt *Type) Size() int

Size 宽度

func (*Type) String

func (dt *Type) String() string

String 转化成字符串

func (*Type) UnmarshalJSON

func (dt *Type) UnmarshalJSON(buf []byte) error

UnmarshalJSON 解析

type User

type User struct {
	Id        string    `json:"id" xorm:"pk"`
	Name      string    `json:"name,omitempty"`
	Email     string    `json:"email,omitempty"`
	Cellphone string    `json:"cellphone,omitempty"`
	Admin     bool      `json:"admin,omitempty"`
	Disabled  bool      `json:"disabled,omitempty"`
	Created   time.Time `json:"created,omitempty" xorm:"created"`
}

User 用户

type UserHistory

type UserHistory struct {
	Id      int64     `json:"id"`
	UserId  string    `json:"user_id"`
	Event   string    `json:"event"`
	Created time.Time `json:"created" xorm:"created"`
}

type Validator

type Validator struct {
	Expression  string `json:"expression"`
	Type        string `json:"type"`
	Title       string `json:"title"`
	Level       uint   `json:"level"`
	Template    string `json:"template"`
	Delay       uint   `json:"delay,omitempty"`        //延迟时间s
	Repeat      bool   `json:"repeat,omitempty"`       //重启报警
	RepeatDelay uint   `json:"repeat_delay,omitempty"` //再次提醒间隔s
	RepeatTotal uint   `json:"repeat_total,omitempty"` //总提醒次数
}

type Variables

type Variables map[string]any

Jump to

Keyboard shortcuts

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