models

package
v0.0.0-...-68b20d9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2017 Dell Inc.
  • Copyright (c) 2019 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

Index

Constants

View Source
const (
	ServiceTypeEnumService      = "service"
	ServiceTypeEnumDriver       = "driver"
	ServiceTypeEnumThirdPartApp = "appService"
)

服务类型,服务,驱动

Variables

This section is empty.

Functions

func GetLibrarySimpleBaseConfig

func GetLibrarySimpleBaseConfig() string

func GormScanWrap

func GormScanWrap(value interface{}, ojb interface{}) error

func GormScanWrapUseNumber

func GormScanWrapUseNumber(value interface{}, ojb interface{}) error

func GormValueWrap

func GormValueWrap(c interface{}) (driver.Value, error)

全局处理入库数据

func HmacSha1

func HmacSha1(keyStr, value string) string

Types

type Action

type Action struct {
	ProductID   string `json:"product_id"`
	ProductName string `json:"product_name"`
	DeviceID    string `json:"device_id"`
	DeviceName  string `json:"device_name"`
	Code        string `json:"code"`
	DataType    string `json:"data_type"`
	Value       string `json:"value"`
}

type Actions

type Actions struct {
	Id           string             `json:"id" gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	ProductId    string             `json:"product_id" gorm:"type:string;size:255;comment:产品ID"`
	Code         string             `json:"code" gorm:"type:string;size:255;comment:标识符"`
	Name         string             `json:"name" gorm:"type:string;size:255;comment:名字"`
	Description  string             `json:"description" gorm:"type:text;comment:描述"`
	Require      bool               `json:"require" gorm:"comment:是否必须"`
	CallType     constants.CallType `json:"call_type" gorm:"type:string;size:50;comment:调用方式"`
	InputParams  InPutParams        `json:"input_params" gorm:"type:text;comment:输入参数"`  // 输入参数
	OutputParams OutPutParams       `json:"output_params" gorm:"type:text;comment:输入参数"` // 输出参数
	Tag          string             `json:"tag" gorm:"type:string;size:50;comment:标签"`
	System       bool               `json:"system" gorm:"comment:系统内置"`
	Timestamps
}

func (*Actions) Get

func (table *Actions) Get() interface{}

func (*Actions) TableName

func (table *Actions) TableName() string

type Actions2

type Actions2 []Action

func (*Actions2) Scan

func (c *Actions2) Scan(value interface{}) error

func (Actions2) Value

func (c Actions2) Value() (driver.Value, error)

type AdvanceConfig

type AdvanceConfig struct {
	ID             int                `json:"id" gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	LogLevel       constants.LogLevel `gorm:"default:1;comment:日志等级"` // 日志级别 默认为INFO
	PersistStorage bool               `gorm:"default:0;comment:存储开关"`
	StorageHour    int32              `gorm:"default:24;comment:存储时长"`
}

func (*AdvanceConfig) Get

func (table *AdvanceConfig) Get() interface{}

func (*AdvanceConfig) TableName

func (table *AdvanceConfig) TableName() string

type AlertContent

type AlertContent struct {
	ServiceName string     `json:"name"`                        // 服务名
	Type        AlertType  `json:"type" binding:"oneof=1 2"`    // 告警类型
	Level       AlertLevel `json:"level" binding:"oneof=1 2 3"` // 告警级别
	T           int64      `json:"time"`                        // 告警时间
	Content     string     `json:"content"`                     // 告警内容
}

func (*AlertContent) Get

func (table *AlertContent) Get() interface{}

func (*AlertContent) TableName

func (table *AlertContent) TableName() string

type AlertLevel

type AlertLevel int

type AlertList

type AlertList struct {
	Timestamps  `gorm:"embedded"`
	Id          string                    `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	AlertRuleId string                    `gorm:"type:string;size:255;comment:告警记录ID"`
	TriggerTime int64                     `gorm:"comment:触发时间"`
	AlertResult MapStringInterface        `json:"alert_result" gorm:"type:string;size:255;comment:告警内容"`
	AlertRule   AlertRule                 `gorm:"foreignKey:AlertRuleId"`
	Status      constants.AlertListStatus `json:"status" gorm:"type:string;size:50;comment:状态"`
	TreatedTime int64                     `gorm:"comment:处理时间"`
	Message     string                    `gorm:"type:text;comment:处理意见"`
	IsSend      bool                      `gorm:"comment:是否发送通知"`
}

func (*AlertList) Get

func (d *AlertList) Get() interface{}

func (*AlertList) TableName

func (d *AlertList) TableName() string

type AlertRule

type AlertRule struct {
	Timestamps  `gorm:"embedded"`
	Id          string `gorm:"id;primaryKey"`
	Name        string
	DeviceId    string                    `gorm:"index"`
	AlertType   constants.AlertType       //告警类型
	AlertLevel  constants.AlertLevel      //告警级别
	Status      constants.RuleStatus      //状态 启动或者禁用
	Condition   constants.WorkerCondition //执行条件
	SubRule     SubRule
	Notify      Notify
	SilenceTime int64 //静默时间
	Description string
}

func (*AlertRule) EkuiperRule

func (a *AlertRule) EkuiperRule() bool

func (*AlertRule) Get

func (d *AlertRule) Get() interface{}

func (*AlertRule) TableName

func (d *AlertRule) TableName() string

type AlertType

type AlertType int

type CategoryTemplate

type CategoryTemplate struct {
	Timestamps   `gorm:"embedded"`
	Id           string `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	CategoryKey  string `json:"category_key" gorm:"type:string;size:255;comment:品类标识"`
	CategoryName string `json:"category_name" gorm:"type:string;size:255;comment:品类名字"`
	Scene        string `json:"scene" gorm:"type:string;size:255;comment:场景"`
}

func (*CategoryTemplate) Get

func (d *CategoryTemplate) Get() interface{}

func (*CategoryTemplate) TableName

func (d *CategoryTemplate) TableName() string

type Condition

type Condition struct {
	ConditionType string          `json:"condition_type"`
	Option        MapStringString `json:"option"`
}

type Conditions

type Conditions []Condition

func (*Conditions) Scan

func (c *Conditions) Scan(value interface{}) error

func (Conditions) Value

func (c Conditions) Value() (driver.Value, error)

type DataResource

type DataResource struct {
	Timestamps `gorm:"embedded"`
	Id         string                     `json:"id" gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Name       string                     `json:"name" gorm:"type:string;size:255;comment:名字"`
	Type       constants.DataResourceType `json:"type"  gorm:"type:string;size:50;comment:类型"`
	Health     bool                       `json:"health" gorm:"comment:验证"`
	Option     MapStringInterface         `json:"option" gorm:"type:text;comment:资源内容"`
}

func (*DataResource) Get

func (d *DataResource) Get() interface{}

func (*DataResource) TableName

func (d *DataResource) TableName() string

type Device

type Device struct {
	Timestamps      `gorm:"embedded"`
	Id              string                 `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	CloudDeviceId   string                 `gorm:"type:string;size:255;comment:云设备ID"`
	CloudProductId  string                 `gorm:"type:string;size:255;comment:云产品ID"`
	CloudInstanceId string                 `gorm:"index;type:string;size:255;comment:云实例ID"`
	DriveInstanceId string                 `gorm:"index;type:string;size:255;comment:驱动实例ID"`
	Name            string                 `gorm:"type:string;size:255;comment:名字"`
	Status          constants.DeviceStatus `gorm:"type:string;size:50;comment:设备状态"`
	Description     string                 `gorm:"type:text;comment:描述"`
	ProductId       string                 `gorm:"type:string;size:255;comment:产品ID"`
	Secret          string                 `gorm:"type:string;size:255;comment:密钥"`
	Platform        constants.IotPlatform  `gorm:"type:string;size:50;comment:平台名称"`
	InstallLocation string                 `gorm:"type:string;size:255;comment:安装地址"`
	LastSyncTime    int64                  `gorm:"comment:最后一次同步时间"`
	LastOnlineTime  int64                  `gorm:"comment:最后一次在线时间"`
	Product         Product                `gorm:"foreignKey:ProductId"`
}

func (*Device) Get

func (table *Device) Get() interface{}

func (*Device) TableName

func (table *Device) TableName() string

func (*Device) TransformToDriverDevice

func (table *Device) TransformToDriverDevice() *driverdevice.Device

type DeviceLibrary

type DeviceLibrary struct {
	Timestamps      `gorm:"embedded"`
	Id              string          `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Name            string          `gorm:"type:string;size:255;comment:名字"`
	Description     string          `gorm:"type:text;comment:描述"`
	Protocol        string          `gorm:"type:string;size:255;comment:驱动协议"`
	Version         string          `gorm:"type:string;size:255;comment:当前安装版本"`
	ContainerName   string          `gorm:"type:string;size:255;comment:容器名字"`
	DockerConfigId  string          `gorm:"type:string;size:255;comment:镜像仓库配置表id"`
	DockerRepoName  string          `gorm:"type:string;size:255;comment:镜像名称"`
	DockerImageId   string          `gorm:"type:string;size:255;comment:镜像ID"`
	SupportVersions SupportVersions `gorm:"type:text;not null;comment:可用版本"`
	IsInternal      bool            `gorm:"default:0;not null;comment:是否内置,云端内置驱动"`
	Language        string          `gorm:"type:string;size:255;comment:代码语言"`
	DeviceMarket
	OperateStatus string `gorm:"-"`
}

驱动库,驱动市场

func (DeviceLibrary) ConfigBody

func (d DeviceLibrary) ConfigBody() string

func (DeviceLibrary) DefaultVersion

func (dl DeviceLibrary) DefaultVersion() SupportVersion

func (*DeviceLibrary) Get

func (table *DeviceLibrary) Get() interface{}

func (DeviceLibrary) GetConfig

func (d DeviceLibrary) GetConfig() (DeviceLibraryConfig, error)

func (DeviceLibrary) GetConfigMap

func (d DeviceLibrary) GetConfigMap() (map[string]interface{}, error)

func (*DeviceLibrary) TableName

func (table *DeviceLibrary) TableName() string

type DeviceLibraryConfig

type DeviceLibraryConfig struct {
	DeviceServer map[string][]struct {
		Name         string      `json:"name"`
		Display      string      `json:"display"`
		Type         string      `json:"type"` // type 支持 int、string、float、bool、select、object、array
		DefaultValue string      `json:"defaultValue"`
		Options      interface{} `json:"options"`
	} `json:"deviceServer"`
	DeviceProtocols interface{}   `json:"deviceProtocols"`
	DeviceDpAttrs   []interface{} `json:"deviceDpAttrs"`
}

type DeviceMarket

type DeviceMarket struct {
	Manual     string `gorm:"type:string;size:255;comment:驱动市场使用说明手册"`
	Icon       string `gorm:"type:text;comment:图标"`
	ClassifyId int    `gorm:"comment:分类"`
}

type DeviceService

type DeviceService struct {
	Timestamps         `gorm:"embedded"`
	Id                 string             `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Name               string             `gorm:"type:string;size:255;comment:名字"`
	BaseAddress        string             `gorm:"type:string;size:255;comment:地址"`
	DeviceLibraryId    string             `gorm:"uniqueIndex;type:string;size:255;comment:驱动ID"`
	Config             MapStringInterface `gorm:"type:string;size:255;comment:配置"`
	DockerContainerId  string             `gorm:"type:string;size:255;comment:docker容器ID"`
	ExpertMode         bool               `gorm:"comment:扩展模式"`
	ExpertModeContent  string             `gorm:"comment:扩展内容"`
	DockerParamsSwitch bool               `gorm:"comment:docker启动参数开关"`
	DockerParams       string             `gorm:"type:text;comment:docker启动参数"`
	ContainerName      string             `gorm:"type:string;size:255;comment:容器名字"`
	LogLevel           constants.LogLevel `gorm:"default:1;comment:日志等级"`
	DriverType         int                `gorm:"default:1;not null;comment:驱动类别,1:驱动,2:三方应用"`
	RunStatus          int                `gorm:"-"`
	ImageExist         bool               `gorm:"-"`
	Platform           constants.IotPlatform
}

DeviceService and its properties are defined in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceService Model fields are same as the DTOs documented by this swagger. Exceptions, if any, are noted below.

func (*DeviceService) BeforeCreate

func (d *DeviceService) BeforeCreate(tx *gorm.DB) (err error)

func (*DeviceService) BeforeDelete

func (d *DeviceService) BeforeDelete(tx *gorm.DB) (err error)

func (*DeviceService) Get

func (d *DeviceService) Get() interface{}

func (*DeviceService) GetBaseAddress

func (d *DeviceService) GetBaseAddress() string

func (*DeviceService) GetPort

func (d *DeviceService) GetPort() string

func (*DeviceService) IsDriver

func (d *DeviceService) IsDriver() bool

func (*DeviceService) IsRunning

func (d *DeviceService) IsRunning() bool

func (*DeviceService) IsStopped

func (d *DeviceService) IsStopped() bool

func (*DeviceService) TableName

func (d *DeviceService) TableName() string

type DeviceServiceExtendConf

type DeviceServiceExtendConf struct {
	ConfigFilePath string
	Mount          []string
	Port           int
}

type Doc

type Doc struct {
	Timestamps `gorm:"embedded"`
	Id         string `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Name       string `gorm:"type:string;size:255;comment:名字"`
	Sort       int    `gorm:"type:int;size:8;comment:排序"`
	JumpLink   string `gorm:"type:string;size:255;comment:跳转地址"`
}

func (*Doc) Get

func (d *Doc) Get() interface{}

func (*Doc) TableName

func (d *Doc) TableName() string

type DockerConfig

type DockerConfig struct {
	Timestamps `gorm:"embedded"`
	Id         string `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Address    string `gorm:"type:string;size:255;comment:地址"`
	Account    string `gorm:"type:string;size:255;comment:用户名"`
	Password   string `gorm:"type:string;size:255;comment:密码"`
	SaltKey    string `gorm:"type:string;size:255;comment:盐值"`
}

驱动镜像配置表,alias MirrorConfig

func (*DockerConfig) Get

func (table *DockerConfig) Get() interface{}

func (*DockerConfig) TableName

func (table *DockerConfig) TableName() string

type DriverClassify

type DriverClassify struct {
	Timestamps `gorm:"embedded"`
	Id         string `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Name       string `gorm:"type:string;size:255;comment:名字"`
}

驱动市场分类

func (*DriverClassify) Get

func (table *DriverClassify) Get() interface{}

func (*DriverClassify) TableName

func (table *DriverClassify) TableName() string

type Events

type Events struct {
	Id           string       `json:"id" gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	ProductId    string       `json:"product_id" gorm:"type:string;size:255;comment:产品ID"`
	EventType    string       `json:"event_type" gorm:"type:string;size:255;comment:事件类型"`
	Code         string       `json:"code" gorm:"type:string;size:255;comment:标识符"`
	Name         string       `json:"name" gorm:"type:string;size:255;comment:名字"`
	Description  string       `json:"description" gorm:"type:text;comment:描述"`
	Require      bool         `json:"require" gorm:"comment:是否必须"`
	OutputParams OutPutParams `json:"output_params" gorm:"type:text;comment:输入参数"`
	Tag          string       `json:"tag" gorm:"type:string;size:50;comment:标签"`
	System       bool         `json:"system" gorm:"comment:系统内置"`
	Timestamps
}

func (*Events) Get

func (table *Events) Get() interface{}

func (*Events) TableName

func (table *Events) TableName() string

type Filter

type Filter struct {
	MessageSource string `json:"message_source" gorm:"type:string;size:255;comment:消息源"`
	SelectName    string `json:"select_name" gorm:"type:string;size:255;comment:选择字段"`
	Condition     string `json:"condition" gorm:"type:string;size:255;comment:条件"`
	Sql           string `json:"sql" gorm:"type:string;size:255;comment:sql"`
}

func (*Filter) Scan

func (c *Filter) Scan(value interface{}) error

func (Filter) Value

func (c Filter) Value() (driver.Value, error)

type InPutParams

type InPutParams []InputOutput

func (*InPutParams) Scan

func (c *InPutParams) Scan(value interface{}) error

func (InPutParams) Value

func (c InPutParams) Value() (driver.Value, error)

type InputOutput

type InputOutput struct {
	Code     string   `json:"code"`
	Name     string   `json:"name"`
	TypeSpec TypeSpec `json:"type_spec"`
}

type Item

type Item struct {
	Type string `json:"type,omitempty"`
}

func (*Item) Scan

func (c *Item) Scan(value interface{}) error

func (Item) Value

func (c Item) Value() (driver.Value, error)

type LanguageSdk

type LanguageSdk struct {
	Timestamps  `gorm:"embedded"`
	Id          string `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Name        string `json:"name" gorm:"type:string;size:255;comment:名字"`
	Icon        string `json:"icon" gorm:"type:text;comment:图标"`
	Addr        string `json:"addr" gorm:"type:string;size:255;comment:地址"`
	Description string `json:"description" gorm:"type:text;comment:描述"`
	Sort        int    `gorm:"type:int;size:8;comment:排序"`
}

func (*LanguageSdk) Get

func (d *LanguageSdk) Get() interface{}

func (*LanguageSdk) TableName

func (d *LanguageSdk) TableName() string

type MapStringInterface

type MapStringInterface map[string]interface{}

func (*MapStringInterface) Scan

func (c *MapStringInterface) Scan(value interface{}) error

func (MapStringInterface) Value

func (c MapStringInterface) Value() (driver.Value, error)

type MapStringInterfaceUseNumber

type MapStringInterfaceUseNumber map[string]interface{}

func (*MapStringInterfaceUseNumber) Scan

func (c *MapStringInterfaceUseNumber) Scan(value interface{}) error

func (MapStringInterfaceUseNumber) Value

type MapStringSliceString

type MapStringSliceString map[string][]string

func (*MapStringSliceString) Scan

func (c *MapStringSliceString) Scan(value interface{}) error

func (MapStringSliceString) Value

func (c MapStringSliceString) Value() (driver.Value, error)

type MapStringString

type MapStringString map[string]string

func (*MapStringString) Scan

func (c *MapStringString) Scan(value interface{}) error

func (MapStringString) Value

func (c MapStringString) Value() (driver.Value, error)

type Metrics

type Metrics struct {
	Key            string `gorm:"column:key;pk"`
	Timestamp      int64  `gorm:"column:timestamp"` // 时间戳
	CpuUsedPercent float64
	MemoryUsed     int64
}

func (*Metrics) Get

func (table *Metrics) Get() interface{}

func (*Metrics) TableName

func (table *Metrics) TableName() string

type MqttAuth

type MqttAuth struct {
	Timestamps   `gorm:"embedded"`
	Id           string                 `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	ResourceId   string                 `gorm:"type:string;size:255;comment:资源ID"`
	ResourceType constants.ResourceType `gorm:"type:string;size:255;comment:资源类型"`
	ClientId     string                 `gorm:"uniqueIndex;size:255;comment:客户端ID"`
	UserName     string                 `gorm:"type:string;size:255;comment:用户名"`
	Password     string                 `gorm:"type:string;size:255;comment:密码"`
}

func (*MqttAuth) BeforeCreate

func (d *MqttAuth) BeforeCreate(tx *gorm.DB) (err error)

func (*MqttAuth) Get

func (d *MqttAuth) Get() interface{}

func (*MqttAuth) TableName

func (d *MqttAuth) TableName() string

type MsgGather

type MsgGather struct {
	Timestamps `gorm:"embedded"`
	Id         string `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Date       string `json:"date" gorm:"type:string;size:255;comment:日期"`
	Count      int    `json:"count" gorm:"comment:数量"`
}

func (*MsgGather) Get

func (d *MsgGather) Get() interface{}

func (*MsgGather) TableName

func (d *MsgGather) TableName() string

type Notify

type Notify []SubNotify

func (*Notify) Scan

func (c *Notify) Scan(value interface{}) error

func (Notify) Value

func (c Notify) Value() (driver.Value, error)

type OutPutParams

type OutPutParams []InputOutput

func (*OutPutParams) Scan

func (c *OutPutParams) Scan(value interface{}) error

func (OutPutParams) Value

func (c OutPutParams) Value() (driver.Value, error)

type Product

type Product struct {
	Timestamps      `gorm:"embedded"`
	Id              string                    `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Name            string                    `gorm:"type:string;size:255;comment:名字"`
	Key             string                    `gorm:"type:string;size:255;comment:产品标识"`
	CloudProductId  string                    `gorm:"type:string;size:255;comment:云产品ID"`
	CloudInstanceId string                    `gorm:"index;type:string;size:255;comment:云实例ID"`
	Platform        constants.IotPlatform     `gorm:"type:string;size:255;comment:平台"`
	Protocol        string                    `gorm:"type:string;size:255;comment:协议"`
	NodeType        constants.ProductNodeType `gorm:"type:string;size:255;comment:节点类型"`
	NetType         constants.ProductNetType  `gorm:"type:string;size:255;comment:网络类型"`
	DataFormat      string                    `gorm:"type:string;size:255;comment:数据类型"`
	LastSyncTime    int64                     `gorm:"comment:最后一次同步时间"`
	Factory         string                    `gorm:"type:string;size:255;comment:工厂名称"`
	Description     string                    `gorm:"type:text;comment:描述"`
	Status          constants.ProductStatus   `gorm:"type:string;size:255;comment:产品状态"`
	Extra           MapStringString           `gorm:"type:string;size:255;comment:扩展字段"`
	Properties      []Properties              `gorm:"foreignKey:ProductId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // 物模型的属性列表
	Events          []Events                  `gorm:"foreignKey:ProductId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // 物模型的事件列表
	Actions         []Actions                 `gorm:"foreignKey:ProductId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // 物模型的动作列表
}

func (*Product) Get

func (d *Product) Get() interface{}

func (*Product) TableName

func (d *Product) TableName() string

func (*Product) TransformToDriverProduct

func (d *Product) TransformToDriverProduct() *driverproduct.Product

type Properties

type Properties struct {
	Id          string   `json:"id" gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	ProductId   string   `json:"product_id" gorm:"type:string;size:255;comment:产品ID"`
	Name        string   `json:"name" gorm:"type:string;size:255;comment:名字"`
	Code        string   `json:"code" gorm:"type:string;size:255;comment:标识符"`
	AccessMode  string   `json:"access_mode" gorm:"type:string;size:50;comment:读写模型"`
	Require     bool     `json:"require" gorm:"comment:是否必须"`
	TypeSpec    TypeSpec `json:"type_spec" gorm:"type:text;comment:属性物模型详情"`
	Description string   `json:"description" gorm:"type:text;comment:描述"`
	Tag         string   `json:"tag" gorm:"type:string;size:50;comment:标签"`
	System      bool     `json:"system" gorm:"comment:系统内置"`
	Timestamps
}

func (*Properties) Get

func (p *Properties) Get() interface{}

func (*Properties) TableName

func (p *Properties) TableName() string

type ProtocolProperties

type ProtocolProperties map[string]string

ProtocolProperties contains the device connection information in key/value pair

type Protocols

type Protocols map[string]ProtocolProperties

func (*Protocols) Scan

func (c *Protocols) Scan(value interface{}) error

func (Protocols) Value

func (c Protocols) Value() (driver.Value, error)

type QuickNavigation

type QuickNavigation struct {
	Timestamps `gorm:"embedded"`
	Id         string `gorm:"id;primaryKey"`
	Name       string `json:"name"`
	Icon       string `json:"icon"`
	Sort       int    `json:"sort"`
	JumpLink   string `json:"jump_link"`
}

func (*QuickNavigation) Get

func (d *QuickNavigation) Get() interface{}

func (*QuickNavigation) TableName

func (d *QuickNavigation) TableName() string

type Rule

type Rule struct {
	Trigger   constants.Trigger `json:"trigger"` //触发方式
	ProductId string            `json:"product_id"`
	DeviceId  string            `json:"device_id"`
	Option    MapStringString   `json:"option"`
}

type RuleEngine

type RuleEngine struct {
	Timestamps     `gorm:"embedded"`
	Id             string                     `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Name           string                     `gorm:"type:string;size:255;comment:名字"`
	Description    string                     `gorm:"type:text;comment:描述"`
	Status         constants.RuleEngineStatus `gorm:"type:string;size:50;comment:状态"`
	Filter         Filter
	DataResourceId string       `gorm:"type:string;size:255;comment:资源ID"`
	DataResource   DataResource `gorm:"foreignKey:DataResourceId"`
}

func (*RuleEngine) Get

func (d *RuleEngine) Get() interface{}

func (*RuleEngine) TableName

func (d *RuleEngine) TableName() string

type Scene

type Scene struct {
	Timestamps  `gorm:"embedded"`
	Id          string                `json:"id" gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Name        string                `json:"name" gorm:"type:string;size:255;comment:名字"`
	Description string                `json:"description" gorm:"type:text;comment:描述"`
	Status      constants.SceneStatus `json:"status" gorm:"type:string;size:50;comment:状态"`
	Conditions  Conditions            `json:"conditions" gorm:"type:text;comment:条件"`
	Actions     Actions2              `json:"actions" gorm:"type:text;comment:动作"`
}

func (*Scene) Get

func (d *Scene) Get() interface{}

func (*Scene) TableName

func (d *Scene) TableName() string

func (*Scene) ToRuntimeJob

func (d *Scene) ToRuntimeJob() (schedule *jobs.JobSchedule, err error)

type SceneLog

type SceneLog struct {
	Timestamps `gorm:"embedded"`
	Id         string `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	SceneId    string `gorm:"index;type:string;size:255;comment:场景ID" json:"scene_id"`
	Name       string `json:"name" gorm:"type:string;size:255;comment:名字"`
	ExecRes    string `json:"exec_res" gorm:"type:text;comment:执行结果"`
}

func (*SceneLog) Get

func (pj *SceneLog) Get() interface{}

func (*SceneLog) TableName

func (pj *SceneLog) TableName() string

type ServiceStats

type ServiceStats struct {
	Id          string `gorm:"column:id" json:"id"`        // 服务标识
	Name        string `gorm:"column:name;pk" json:"name"` // 容器名称
	LogPath     string `json:"log_path"`                   // 日志地址, 宿主主机日志路径
	ServiceType string `json:"service_type"`               // 服务类型,服务,驱动,应用
	Healthy     bool   `json:"healthy"`                    // 状态, docker.inspect.State.Running
	Created     string `json:"created"`                    // 创建时间, docker.inspect.Created
	Started     string `json:"started"`                    // 启动时间, docker.inspect.State.StartedAt
}

func (*ServiceStats) Get

func (s *ServiceStats) Get() interface{}

func (*ServiceStats) TableName

func (s *ServiceStats) TableName() string

func (ServiceStats) ToJSON

func (s ServiceStats) ToJSON() string

type SliceString

type SliceString []string

func (*SliceString) Scan

func (c *SliceString) Scan(value interface{}) error

func (SliceString) Value

func (c SliceString) Value() (driver.Value, error)

type SubNotify

type SubNotify struct {
	Name            constants.AlertWay `json:"name"` //告警方式
	Option          MapStringString    `json:"option"`
	StartEffectTime string             `json:"start_effect_time"` //生效开始时间
	EndEffectTime   string             `json:"end_effect_time"`   //生效结束时间
}

type SubRule

type SubRule []Rule

func (*SubRule) Scan

func (c *SubRule) Scan(value interface{}) error

func (SubRule) Value

func (c SubRule) Value() (driver.Value, error)

type SupportVersion

type SupportVersion struct {
	Version            string
	ConfigFile         string
	IsDefault          bool // 是否为默认版本
	DockerParamsSwitch bool
	DockerParams       string
	ExpertMode         bool
	ExpertModeContent  string
	ConfigJson         string
}

type SupportVersions

type SupportVersions []SupportVersion

func (*SupportVersions) Scan

func (c *SupportVersions) Scan(value interface{}) error

func (SupportVersions) Value

func (c SupportVersions) Value() (driver.Value, error)

type SystemMetrics

type SystemMetrics struct {
	ID        int64  `gorm:"column:id;pk;autoIncrement"`
	Data      string `gorm:"column:data"`
	Timestamp int64  `gorm:"column:timestamp"` // 时间戳
}

func (*SystemMetrics) Get

func (table *SystemMetrics) Get() interface{}

func (*SystemMetrics) TableName

func (table *SystemMetrics) TableName() string

type ThingModelTemplate

type ThingModelTemplate struct {
	Timestamps     `gorm:"embedded"`
	Id             string `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	CategoryKey    string `gorm:"type:string;size:255;comment:品类key"`
	CategoryName   string `gorm:"type:string;size:255;comment:品类名字"`
	ThingModelJSON string `gorm:"type:text;comment:物模型信息"`
}

func (*ThingModelTemplate) Get

func (d *ThingModelTemplate) Get() interface{}

func (*ThingModelTemplate) TableName

func (d *ThingModelTemplate) TableName() string

type Timestamps

type Timestamps struct {
	Created  int64 `json:"created" gorm:"comment:创建时间"`  // Created is a timestamp indicating when the entity was created.
	Modified int64 `json:"modified" gorm:"comment:更新时间"` // Modified is a timestamp indicating when the entity was last modified.
}

type TypeSpec

type TypeSpec struct {
	Type  constants.SpecsType `json:"type,omitempty"`
	Specs string              `json:"specs,omitempty"`
}

TypeSpec 物模型的属性、事件、动作的基础信息字段

func (*TypeSpec) Scan

func (c *TypeSpec) Scan(value interface{}) error

func (TypeSpec) Value

func (c TypeSpec) Value() (driver.Value, error)

type TypeSpecArray

type TypeSpecArray struct {
	Size string `json:"size,omitempty"`
	Item Item   `json:"item,omitempty"`
}

func (*TypeSpecArray) TransformTostring

func (t *TypeSpecArray) TransformTostring() string

type TypeSpecBool

type TypeSpecBool map[string]string

func (*TypeSpecBool) TransformTostring

func (t *TypeSpecBool) TransformTostring() string

type TypeSpecDate

type TypeSpecDate struct {
}

func (*TypeSpecDate) TransformTostring

func (t *TypeSpecDate) TransformTostring() string

type TypeSpecEnum

type TypeSpecEnum map[string]string

func (*TypeSpecEnum) TransformTostring

func (t *TypeSpecEnum) TransformTostring() string

type TypeSpecIntOrFloat

type TypeSpecIntOrFloat struct {
	Min      string `json:"min,omitempty"`
	Max      string `json:"max,omitempty"`
	Step     string `json:"step,omitempty"`
	Unit     string `json:"unit,omitempty"`
	UnitName string `json:"unitName,omitempty"`
}

func (*TypeSpecIntOrFloat) TransformTostring

func (t *TypeSpecIntOrFloat) TransformTostring() string

type TypeSpecStruct

type TypeSpecStruct struct {
	Code     string   `json:"code"`
	Name     string   `json:"name"`
	DataType TypeSpec `json:"data_type"`
}

func (*TypeSpecStruct) TransformTostring

func (t *TypeSpecStruct) TransformTostring() string

type TypeSpecText

type TypeSpecText struct {
	Length string `json:"length,omitempty"`
}

func (*TypeSpecText) TransformTostring

func (t *TypeSpecText) TransformTostring() string

type Unit

type Unit struct {
	Timestamps `gorm:"embedded"`
	Id         string `gorm:"id;primaryKey;not null;type:string;size:255;comment:主键"`
	Symbol     string `json:"symbol" gorm:"type:string;size:255;comment:符号"`
	UnitName   string `json:"unit_name" gorm:"type:string;size:255;comment:单位名字"`
}

func (*Unit) Get

func (table *Unit) Get() interface{}

func (*Unit) TableName

func (table *Unit) TableName() string

type User

type User struct {
	Username   string `gorm:"index;type:string;size:255;comment:名字"`
	Password   string `gorm:"type:string;size:255;comment:密码"`
	Lang       string `gorm:"type:string;size:50;comment:语言"`
	GatewayKey string `gorm:"type:string;size:255;comment:密钥"`
	OpenAPIKey string `gorm:"type:string;size:255;comment:密钥"`
}

func (*User) Get

func (table *User) Get() interface{}

func (*User) TableName

func (table *User) TableName() string

Jump to

Keyboard shortcuts

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