dtclient

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 12

Documentation

Index

Constants

View Source
const (
	//DeviceTableName device table
	DeviceTableName = "device"
	//DeviceAttrTableName device table
	DeviceAttrTableName = "device_attr"
	//DeviceTwinTableName device table
	DeviceTwinTableName = "device_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

func DeleteDeviceAttr(obm orm.Ormer, deviceID string, name string) error

DeleteDeviceAttr delete device attr

func DeleteDeviceAttrByDeviceID

func DeleteDeviceAttrByDeviceID(obm orm.Ormer, deviceID string) error

DeleteDeviceAttrByDeviceID delete device attr

func DeleteDeviceByID

func DeleteDeviceByID(obm orm.Ormer, id string) error

DeleteDeviceByID delete device by id

func DeleteDeviceTrans

func DeleteDeviceTrans(deletes []string) error

DeleteDeviceTrans the transaction of delete device

func DeleteDeviceTwin

func DeleteDeviceTwin(obm orm.Ormer, deviceID string, name string) error

DeleteDeviceTwin delete device twin

func DeleteDeviceTwinByDeviceID

func DeleteDeviceTwinByDeviceID(obm orm.Ormer, deviceID string) error

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 InitDBTable

func InitDBTable(module core.Module)

InitDBTable create table

func QueryDevice

func QueryDevice(key string, condition string) (*[]Device, error)

QueryDevice query Device

func QueryDeviceAll

func QueryDeviceAll() (*[]Device, error)

QueryDeviceAll query twin

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 SaveDevice

func SaveDevice(obm orm.Ormer, doc *Device) error

SaveDevice save device

func SaveDeviceAttr

func SaveDeviceAttr(obm orm.Ormer, doc *DeviceAttr) error

SaveDeviceAttr save device attributes

func SaveDeviceTwin

func SaveDeviceTwin(obm orm.Ormer, doc *DeviceTwin) error

SaveDeviceTwin save device twin

func UpdateDeviceAttrField

func UpdateDeviceAttrField(deviceID string, name string, col string, value interface{}) error

UpdateDeviceAttrField update special field

func UpdateDeviceAttrFields

func UpdateDeviceAttrFields(obm orm.Ormer, deviceID string, name string, cols map[string]interface{}) error

UpdateDeviceAttrFields update special fields

func UpdateDeviceAttrMulti

func UpdateDeviceAttrMulti(updates []DeviceAttrUpdate) error

UpdateDeviceAttrMulti update device attr multi

func UpdateDeviceField

func UpdateDeviceField(deviceID string, col string, value interface{}) error

UpdateDeviceField update special field

func UpdateDeviceFields

func UpdateDeviceFields(deviceID string, cols map[string]interface{}) error

UpdateDeviceFields update special fields

func UpdateDeviceMulti

func UpdateDeviceMulti(updates []DeviceUpdate) error

UpdateDeviceMulti update device multi

func UpdateDeviceTwinField

func UpdateDeviceTwinField(deviceID string, name string, col string, value interface{}) error

UpdateDeviceTwinField update special field

func UpdateDeviceTwinFields

func UpdateDeviceTwinFields(obm orm.Ormer, deviceID string, name string, cols map[string]interface{}) error

UpdateDeviceTwinFields update special fields

func UpdateDeviceTwinMulti

func UpdateDeviceTwinMulti(updates []DeviceTwinUpdate) error

UpdateDeviceTwinMulti update device twin multi

Types

type CasesDeleteStr added in v1.15.0

type CasesDeleteStr []struct {
	// contains filtered or unexported fields
}

CasesDeleteStr is a struct for cases of delete

func GetCasesDelete added in v1.15.0

func GetCasesDelete(t *testing.T) (*beego.MockOrmer, *beego.MockQuerySeter, CasesDeleteStr)

GetCasesDelete get cases for delete

type CasesQueryStr added in v1.15.0

type CasesQueryStr []struct {
	// contains filtered or unexported fields
}

CasesQueryStr is a struct for cases of query

func GetCasesQuery added in v1.15.0

func GetCasesQuery(t *testing.T) (*beego.MockOrmer, *beego.MockQuerySeter, CasesQueryStr)

GetCasesQuery get cases for query

type CasesSaveStr added in v1.15.0

type CasesSaveStr []struct {
	// contains filtered or unexported fields
}

CasesSaveStr is a struct for cases of save

func GetCasesSave added in v1.15.0

func GetCasesSave(t *testing.T) (*beego.MockOrmer, CasesSaveStr)

GetCasesSave get cases for save

type CasesTransStr added in v1.15.0

type CasesTransStr []struct {
	// contains filtered or unexported fields
}

CasesTransStr is a struct for cases of trans

func GetCasesTrans added in v1.15.0

func GetCasesTrans(caseName string, t *testing.T) (*beego.MockOrmer, *beego.MockQuerySeter, CasesTransStr)

GetCasesTrans get cases for trans

type CasesUpdateStr added in v1.15.0

type CasesUpdateStr []struct {
	// contains filtered or unexported fields
}

CasesUpdateStr is a struct for cases of update

func GetCasesUpdate added in v1.15.0

func GetCasesUpdate(t *testing.T) (*beego.MockOrmer, *beego.MockQuerySeter, CasesUpdateStr)

GetCasesUpdate get cases for update

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

type DeviceAttrUpdate struct {
	DeviceID string
	Name     string
	Cols     map[string]interface{}
}

DeviceAttrUpdate the struct for updating device attr

type DeviceDelete

type DeviceDelete struct {
	DeviceID string
	Name     string
}

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

type DeviceTwinUpdate struct {
	DeviceID string
	Name     string
	Cols     map[string]interface{}
}

DeviceTwinUpdate the struct for updating device twin

type DeviceUpdate

type DeviceUpdate struct {
	DeviceID string
	Cols     map[string]interface{}
}

DeviceUpdate the struct for updating device

Jump to

Keyboard shortcuts

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