Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolRule ¶
type BoolRule struct { DefaultValue bool `json:"defaultValue"` TrueLabel string `json:"trueLabel"` // UI界面对应的label FalseLabel string `json:"falseLabel"` // UI界面对应的label }
* * 布尔规则 *
type FloatRule ¶
type FloatRule struct { DefaultValue float64 `json:"defaultValue"` Max int `json:"max"` Min int `json:"min"` Round int `json:"round"` }
* * 浮点数规则 *
type GeoRule ¶
type GeoRule struct {
DefaultValue IoTPropertyGeo `json:"defaultValue"`
}
* * 地理坐标规则 *
type IntegerRule ¶
type IntegerRule struct { DefaultValue int `json:"defaultValue"` Max int `json:"max"` Min int `json:"min"` }
* * 整数规则 *
func (IntegerRule) Validate ¶
func (V IntegerRule) Validate(Value interface{}) error
type IoTProperty ¶
type IoTProperty struct { Label string `json:"label"` // UI显示的那个文本 Name string `json:"name"` // 变量关联名 Description string `json:"description"` // 额外信息 Type IoTPropertyType `json:"type"` // 类型, 只能是上面几种 Rw string `json:"rw"` // R读 W写 RW读写 Unit string `json:"unit"` // 单位 例如:摄氏度、米、牛等等 Value any `json:"value,omitempty"` // Value 是运行时值, 前端不用填写 Rule IoTPropertyRule `json:"rule"` // 规则 }
物模型属性
func (*IoTProperty) BoolValue ¶
func (I *IoTProperty) BoolValue() bool
func (*IoTProperty) FloatValue ¶
func (I *IoTProperty) FloatValue() float64
func (*IoTProperty) IntValue ¶
func (I *IoTProperty) IntValue() int
func (*IoTProperty) StringValue ¶
func (I *IoTProperty) StringValue() string
func (IoTProperty) ValidateRule ¶
func (V IoTProperty) ValidateRule() error
* * 验证物模型本身是否合法, 包含了 IoTPropertyType,Rule 的对应关系 *
type IoTPropertyGeo ¶
type IoTPropertyGeo struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` }
地理坐标系统
type IoTPropertyRule ¶
type IoTPropertyRule struct { DefaultValue any `json:"defaultValue"` // 默认值 Max int `json:"max,omitempty"` // 最大值 Min int `json:"min,omitempty"` // 最小值 TrueLabel string `json:"trueLabel,omitempty"` // 真值label FalseLabel string `json:"falseLabel,omitempty"` // 假值label Round int `json:"round,omitempty"` // 小数点位 }
规则
type IoTPropertyType ¶
type IoTPropertyType string
const ( // 目前边缘侧暂时只支持常见类型 IoTPropertyTypeString IoTPropertyType = "STRING" IoTPropertyTypeInteger IoTPropertyType = "INTEGER" IoTPropertyTypeFloat IoTPropertyType = "FLOAT" IoTPropertyTypeBool IoTPropertyType = "BOOL" IoTPropertyTypeGeo IoTPropertyType = "GEO" )
type IoTSchema ¶
type IoTSchema struct {
IoTProperties []IoTProperty `json:"iotProperties"`
}
* 物模型,边缘端目前暂时只支持属性 *
type SchemaRule ¶
type SchemaRule interface {
Validate(Value interface{}) error
}
* * 物模型规则 : String|Float|Int|Bool *
type StringRule ¶
type StringRule struct { MaxLength int `json:"maxLength"` DefaultValue string `json:"defaultValue"` }
* * 字符串规则 *
func (StringRule) Validate ¶
func (S StringRule) Validate(Value interface{}) error
Click to show internal directories.
Click to hide internal directories.