Documentation ¶
Index ¶
- Constants
- func AddDeviceTrans(adds []Device, addAttrs []DeviceAttr, addTwins []DeviceTwin) error
- func DeleteDeviceAttr(deviceID string, name string) error
- func DeleteDeviceAttrByDeviceID(deviceID string) error
- func DeleteDeviceByID(id string) error
- func DeleteDeviceTrans(deletes []string) error
- func DeleteDeviceTwin(deviceID string, name string) error
- func DeleteDeviceTwinByDeviceID(deviceID string) error
- func DeleteTwinByID(id string) error
- func DeviceAttrTrans(adds []DeviceAttr, deletes []DeviceDelete, updates []DeviceAttrUpdate) error
- func DeviceTwinTrans(adds []DeviceTwin, deletes []DeviceDelete, updates []DeviceTwinUpdate) error
- func InitDBTable()
- func QueryDevice(key string, condition string) (*[]Device, error)
- func QueryDeviceAll() (*[]Device, error)
- func QueryDeviceAttr(key string, condition string) (*[]DeviceAttr, error)
- func QueryDeviceTwin(key string, condition string) (*[]DeviceTwin, error)
- func QueryTwin(key string, condition string) (*[]Twin, error)
- func QueryTwinAll() (*[]Twin, error)
- func SaveDevice(doc *Device) error
- func SaveDeviceAttr(doc *DeviceAttr) error
- func SaveDeviceTwin(doc *DeviceTwin) error
- func SaveTwin(doc *Twin) error
- func UpdateDeviceAttrField(deviceID string, name string, col string, value interface{}) error
- func UpdateDeviceAttrFields(deviceID string, name string, cols map[string]interface{}) error
- func UpdateDeviceAttrMulti(updates []DeviceAttrUpdate) error
- func UpdateDeviceField(deviceID string, col string, value interface{}) error
- func UpdateDeviceFields(deviceID string, cols map[string]interface{}) error
- func UpdateDeviceMulti(updates []DeviceUpdate) error
- func UpdateDeviceTwinField(deviceID string, name string, col string, value interface{}) error
- func UpdateDeviceTwinFields(deviceID string, name string, cols map[string]interface{}) error
- func UpdateDeviceTwinMulti(updates []DeviceTwinUpdate) error
- func UpdateTwinField(deviceID string, col string, value interface{}) error
- func UpdateTwinFields(deviceID string, cols map[string]interface{}) error
- type Device
- type DeviceAttr
- type DeviceAttrUpdate
- type DeviceDelete
- type DeviceTwin
- type DeviceTwinUpdate
- type DeviceUpdate
- type Twin
Constants ¶
const ( //DeviceTableName device table DeviceTableName = "device" //DeviceAttrTableName device table DeviceAttrTableName = "device_attr" //DeviceTwinTableName device table DeviceTwinTableName = "device_twin" )
const (
//TwinTableName twin table name
TwinTableName = "twin"
)
Variables ¶
This section is empty.
Functions ¶
func AddDeviceTrans ¶
func AddDeviceTrans(adds []Device, addAttrs []DeviceAttr, addTwins []DeviceTwin) error
AddDeviceTrans the transaction of add device
func DeleteDeviceAttr ¶
DeleteDeviceAttr delete device attr
func DeleteDeviceAttrByDeviceID ¶
DeleteDeviceAttrByDeviceID delete device attr
func DeleteDeviceTrans ¶
DeleteDeviceTrans the transaction of delete device
func DeleteDeviceTwin ¶
DeleteDeviceTwin delete device twin
func DeleteDeviceTwinByDeviceID ¶
DeleteDeviceTwinByDeviceID delete device twin
func DeviceAttrTrans ¶
func DeviceAttrTrans(adds []DeviceAttr, deletes []DeviceDelete, updates []DeviceAttrUpdate) error
DeviceAttrTrans transaction of device attr
func DeviceTwinTrans ¶
func DeviceTwinTrans(adds []DeviceTwin, deletes []DeviceDelete, updates []DeviceTwinUpdate) error
DeviceTwinTrans transaction of device twin
func QueryDevice ¶
QueryDevice query Device
func QueryDeviceAttr ¶
func QueryDeviceAttr(key string, condition string) (*[]DeviceAttr, error)
QueryDeviceAttr query Device
func QueryDeviceTwin ¶
func QueryDeviceTwin(key string, condition string) (*[]DeviceTwin, error)
QueryDeviceTwin query Device
func SaveDeviceAttr ¶
func SaveDeviceAttr(doc *DeviceAttr) error
SaveDeviceAttr save device attributes
func UpdateDeviceAttrField ¶
UpdateDeviceAttrField update special field
func UpdateDeviceAttrFields ¶
UpdateDeviceAttrFields update special fields
func UpdateDeviceAttrMulti ¶
func UpdateDeviceAttrMulti(updates []DeviceAttrUpdate) error
UpdateDeviceAttrMulti update device attr multi
func UpdateDeviceField ¶
UpdateDeviceField update special field
func UpdateDeviceFields ¶
UpdateDeviceFields update special fields
func UpdateDeviceMulti ¶
func UpdateDeviceMulti(updates []DeviceUpdate) error
UpdateDeviceMulti update device multi
func UpdateDeviceTwinField ¶
UpdateDeviceTwinField update special field
func UpdateDeviceTwinFields ¶
UpdateDeviceTwinFields update special fields
func UpdateDeviceTwinMulti ¶
func UpdateDeviceTwinMulti(updates []DeviceTwinUpdate) error
UpdateDeviceTwinMulti update device twin multi
func UpdateTwinField ¶
UpdateTwinField update special field
func UpdateTwinFields ¶
UpdateTwinFields update special fields
Types ¶
type Device ¶
type Device struct { ID string `orm:"column(id); size(64); pk"` Name string `orm:"column(name); null; type(text)"` Description string `orm:"column(description); null; type(text)"` State string `orm:"column(state); null; type(text)"` LastOnline string `orm:"column(last_online); null; type(text)"` }
Device the struct of device
type DeviceAttr ¶
type DeviceAttr struct { ID int64 `orm:"column(id);size(64);auto;pk"` DeviceID string `orm:"column(deviceid); null; type(text)"` Name string `orm:"column(name);null;type(text)"` Description string `orm:"column(description);null;type(text)"` Value string `orm:"column(value);null;type(text)"` Optional bool `orm:"column(optional);null;type(integer)"` AttrType string `orm:"column(attr_type);null;type(text)"` Metadata string `orm:"column(metadata);null;type(text)"` }
DeviceAttr the struct of device attributes
type DeviceAttrUpdate ¶
DeviceAttrUpdate the struct for updating device attr
type DeviceDelete ¶
DeviceDelete the struct for deleting device
type DeviceTwin ¶
type DeviceTwin struct { ID int64 `orm:"column(id);size(64);auto;pk"` DeviceID string `orm:"column(deviceid); null; type(text)"` Name string `orm:"column(name);null;type(text)"` Description string `orm:"column(description);null;type(text)"` Expected string `orm:"column(expected);null;type(text)"` Actual string `orm:"column(actual);null;type(text)"` ExpectedMeta string `orm:"column(expected_meta);null;type(text)"` ActualMeta string `orm:"column(actual_meta);null;type(text)"` ExpectedVersion string `orm:"column(expected_version);null;type(text)"` ActualVersion string `orm:"column(actual_version);null;type(text)"` Optional bool `orm:"column(optional);null;type(integer)"` AttrType string `orm:"column(attr_type);null;type(text)"` Metadata string `orm:"column(metadata);null;type(text)"` }
DeviceTwin the struct of device twin
type DeviceTwinUpdate ¶
DeviceTwinUpdate the struct for updating device twin
type DeviceUpdate ¶
DeviceUpdate the struct for updating device
type Twin ¶
type Twin struct { // ID int64 `orm:"pk; auto; column(id)"` DeviceID string `orm:"column(deviceid); size(64); pk"` DeviceName string `orm:"column(devicename); null; type(text)"` Expected string `orm:"column(expected); null; type(text)"` Actual string `orm:"column(actual); null; type(text)"` Metadata string `orm:"column(metadata); null; type(text)"` LastState string `orm:"column(laststate); null; type(text)"` Attributes string `orm:"column(attributes); null; type(text)"` VersionSet string `orm:"column(versionset); null; type(text)"` }
Twin object