Documentation
¶
Index ¶
- Constants
- Variables
- func GetArrayID(id string, num int) string
- func NewDeviceDataRepo(dataSource conf.TSDB, getProductSchemaModel schema.GetSchemaModel, ...) msgThing.SchemaDataRepo
- func ToEventData(db map[string]any) *msgThing.EventData
- func ToPropertyData(id string, p *schema.Property, db map[string]any) *msgThing.PropertyLogData
- type DeviceDataRepo
- func (d *DeviceDataRepo) CreateProperty(ctx context.Context, p *schema.Property, productID string) error
- func (d *DeviceDataRepo) DeleteDevice(ctx context.Context, t *schema.Model, productID string, deviceName string) error
- func (d *DeviceDataRepo) DeleteDeviceProperty(ctx context.Context, productID string, deviceName string, s []schema.Property) error
- func (d *DeviceDataRepo) DeleteProduct(ctx context.Context, t *schema.Model, productID string) error
- func (d *DeviceDataRepo) DeleteProperty(ctx context.Context, p *schema.Property, productID string, identifier string) error
- func (d *DeviceDataRepo) GenInsertPropertySql(ctx context.Context, p *schema.Property, productID string, deviceName string, ...) (err error)
- func (d *DeviceDataRepo) GetEventCountByFilter(ctx context.Context, filter msgThing.FilterOpt) (int64, error)
- func (d *DeviceDataRepo) GetEventDataByFilter(ctx context.Context, filter msgThing.FilterOpt) ([]*msgThing.EventData, error)
- func (d *DeviceDataRepo) GetLatestAllPropertyData(ctx context.Context, m *schema.Model, productID, deviceName string) ([]*msgThing.PropertyLogData, error)
- func (d *DeviceDataRepo) GetLatestPropertyDataByID(ctx context.Context, p *schema.Property, filter msgThing.LatestFilter) (*msgThing.PropertyLogData, error)
- func (d *DeviceDataRepo) GetPropertyCountByID(ctx context.Context, p *schema.Property, filter msgThing.FilterOpt) (int64, error)
- func (d *DeviceDataRepo) GetPropertyDataByID(ctx context.Context, p *schema.Property, filter msgThing.FilterOpt) ([]*msgThing.PropertyLogData, error)
- func (d *DeviceDataRepo) GetPropertyLatestAgg(ctx context.Context, m *schema.Model, filter msgThing.FilterLatestAggOpt) ([]*msgThing.PropertyLatestData, error)
- func (d *DeviceDataRepo) GetPropertyLogAgg(ctx context.Context, m *schema.Model, filter msgThing.FilterLogAggOpt) ([]*msgThing.PropertyLogData2, error)
- func (d *DeviceDataRepo) Init(ctx context.Context) error
- func (d *DeviceDataRepo) InitDevice(ctx context.Context, t *schema.Model, productID string, deviceName string) error
- func (d *DeviceDataRepo) InitProduct(ctx context.Context, t *schema.Model, productID string) error
- func (d *DeviceDataRepo) InsertEventData(ctx context.Context, productID string, deviceName string, ...) error
- func (d *DeviceDataRepo) InsertPropertiesData(ctx context.Context, t *schema.Model, productID string, deviceName string, ...) error
- func (d *DeviceDataRepo) InsertPropertyData(ctx context.Context, t *schema.Property, productID string, deviceName string, ...) error
- func (d *DeviceDataRepo) ToPropertyData(ctx context.Context, noFirstTs bool, id string, p *schema.Property, ...) *msgThing.PropertyLogData
- func (d *DeviceDataRepo) ToPropertyData2(ctx context.Context, agg msgThing.PropertyAgg, m *schema.Model, ...) map[string]msgThing.PropertyLogData2
- func (d *DeviceDataRepo) UpdateDevice(ctx context.Context, dev devices.Core, t *schema.Model, ...) error
- func (d *DeviceDataRepo) UpdateProperty(ctx context.Context, oldP *schema.Property, newP *schema.Property, ...) error
- func (d *DeviceDataRepo) VersionUpdate(ctx context.Context, version string, ...) error
- type Event
- type Property
- type PropertyBool
- type PropertyBoolArray
- type PropertyEnum
- type PropertyEnumArray
- type PropertyFloat
- type PropertyFloatArray
- type PropertyInt
- type PropertyIntArray
- type PropertyMatrix
- type PropertyMatrixArray
- type PropertyString
- type PropertyStringArray
- type PropertyStruct
- type PropertyStructArray
- type PropertyTimestamp
- type PropertyTimestampArray
Constants ¶
View Source
const (
PropertyType = "property_type"
)
Variables ¶
View Source
var TableNames []string
Functions ¶
func GetArrayID ¶
func NewDeviceDataRepo ¶
func NewDeviceDataRepo(dataSource conf.TSDB, getProductSchemaModel schema.GetSchemaModel, getDeviceSchemaModel schema.GetSchemaModel, kv kv.Store, g []*deviceGroup.GroupDetail) msgThing.SchemaDataRepo
func ToPropertyData ¶
Types ¶
type DeviceDataRepo ¶
type DeviceDataRepo struct {
// contains filtered or unexported fields
}
func (*DeviceDataRepo) CreateProperty ¶
func (*DeviceDataRepo) DeleteDevice ¶
func (*DeviceDataRepo) DeleteDeviceProperty ¶
func (*DeviceDataRepo) DeleteProduct ¶
func (*DeviceDataRepo) DeleteProperty ¶
func (*DeviceDataRepo) GenInsertPropertySql ¶
func (*DeviceDataRepo) GetEventCountByFilter ¶
func (*DeviceDataRepo) GetEventDataByFilter ¶
func (*DeviceDataRepo) GetLatestAllPropertyData ¶ added in v1.5.22
func (d *DeviceDataRepo) GetLatestAllPropertyData(ctx context.Context, m *schema.Model, productID, deviceName string) ([]*msgThing.PropertyLogData, error)
func (*DeviceDataRepo) GetLatestPropertyDataByID ¶
func (d *DeviceDataRepo) GetLatestPropertyDataByID(ctx context.Context, p *schema.Property, filter msgThing.LatestFilter) (*msgThing.PropertyLogData, error)
func (*DeviceDataRepo) GetPropertyCountByID ¶
func (*DeviceDataRepo) GetPropertyDataByID ¶
func (d *DeviceDataRepo) GetPropertyDataByID( ctx context.Context, p *schema.Property, filter msgThing.FilterOpt) ([]*msgThing.PropertyLogData, error)
func (*DeviceDataRepo) GetPropertyLatestAgg ¶ added in v1.5.52
func (d *DeviceDataRepo) GetPropertyLatestAgg(ctx context.Context, m *schema.Model, filter msgThing.FilterLatestAggOpt) ([]*msgThing.PropertyLatestData, error)
func (*DeviceDataRepo) GetPropertyLogAgg ¶ added in v1.5.52
func (d *DeviceDataRepo) GetPropertyLogAgg(ctx context.Context, m *schema.Model, filter msgThing.FilterLogAggOpt) ([]*msgThing.PropertyLogData2, error)
func (*DeviceDataRepo) InitDevice ¶
func (*DeviceDataRepo) InitProduct ¶
func (*DeviceDataRepo) InsertEventData ¶
func (*DeviceDataRepo) InsertPropertiesData ¶
func (*DeviceDataRepo) InsertPropertyData ¶
func (*DeviceDataRepo) ToPropertyData ¶ added in v1.4.36
func (*DeviceDataRepo) ToPropertyData2 ¶ added in v1.4.55
func (d *DeviceDataRepo) ToPropertyData2(ctx context.Context, agg msgThing.PropertyAgg, m *schema.Model, dbs []map[string]any, retMap map[string]msgThing.PropertyLogData2) map[string]msgThing.PropertyLogData2
func (*DeviceDataRepo) UpdateDevice ¶ added in v1.4.13
func (d *DeviceDataRepo) UpdateDevice(ctx context.Context, dev devices.Core, t *schema.Model, affiliation devices.Affiliation) error
func (*DeviceDataRepo) UpdateProperty ¶
func (*DeviceDataRepo) VersionUpdate ¶ added in v1.4.13
type Event ¶
type Event struct {
ProductID string `gorm:"column:product_id;uniqueIndex:pd_dn_ts;type:varchar(100);NOT NULL"` // 产品id
DeviceName string `gorm:"column:device_name;uniqueIndex:pd_dn_ts;type:varchar(100);NOT NULL"` // 设备名称
Identifier string `gorm:"column:identifier;uniqueIndex:pd_dn_ts;type:varchar(100);NOT NULL"` // 事件id
Type string `gorm:"column:type;type:varchar(100);NOT NULL"` // 事件内容
Param string `gorm:"column:param;type:varchar(256);NOT NULL"` // 时间戳
Timestamp time.Time `gorm:"column:ts;uniqueIndex:pd_dn_ts;NOT NULL;"` // 操作时间
}
type Property ¶
type Property struct {
ProductID string `gorm:"column:product_id;type:varchar(100);NOT NULL"` // 产品id
DeviceName string `gorm:"column:device_name;type:varchar(100);NOT NULL"` // 设备名称
Timestamp time.Time `gorm:"column:ts;NOT NULL;"` // 操作时间
Identifier string `gorm:"column:identifier;type:varchar(100);NOT NULL"` // 事件id
}
type PropertyBool ¶
func (*PropertyBool) TableName ¶
func (m *PropertyBool) TableName() string
type PropertyBoolArray ¶
type PropertyBoolArray struct {
Property
Param bool `gorm:"column:param;NOT NULL"` // 时间戳
Pos int64 `gorm:"column:pos;NOT NULL;"`
}
func (*PropertyBoolArray) TableName ¶
func (m *PropertyBoolArray) TableName() string
type PropertyEnum ¶
func (*PropertyEnum) TableName ¶
func (m *PropertyEnum) TableName() string
type PropertyEnumArray ¶
type PropertyEnumArray struct {
Property
Param int64 `gorm:"column:param;NOT NULL"` // 时间戳
Pos int64 `gorm:"column:pos;NOT NULL;"`
}
func (*PropertyEnumArray) TableName ¶
func (m *PropertyEnumArray) TableName() string
type PropertyFloat ¶
func (*PropertyFloat) TableName ¶
func (m *PropertyFloat) TableName() string
type PropertyFloatArray ¶
type PropertyFloatArray struct {
Property
Param float64 `gorm:"column:param;NOT NULL"` // 时间戳
Pos int64 `gorm:"column:pos;NOT NULL;"`
}
func (*PropertyFloatArray) TableName ¶
func (m *PropertyFloatArray) TableName() string
type PropertyInt ¶
func (*PropertyInt) TableName ¶
func (m *PropertyInt) TableName() string
type PropertyIntArray ¶
type PropertyIntArray struct {
Property
Param int64 `gorm:"column:param;NOT NULL"` // 时间戳
Pos int64 `gorm:"column:pos;NOT NULL;"`
}
func (*PropertyIntArray) TableName ¶
func (m *PropertyIntArray) TableName() string
type PropertyMatrix ¶ added in v1.5.72
type PropertyMatrix struct {
Property
Param []any `gorm:"column:param;type:json;serializer:json;NOT NULL"` // 时间戳
}
func (*PropertyMatrix) TableName ¶ added in v1.5.72
func (m *PropertyMatrix) TableName() string
type PropertyMatrixArray ¶ added in v1.5.72
type PropertyMatrixArray struct {
Property
Param []any `gorm:"column:param;type:json;serializer:json;NOT NULL"` // 时间戳
Pos int64 `gorm:"column:pos;NOT NULL;"`
}
PropertyMatrixArray 矩阵数组 a.3:[123,43,54]
func (*PropertyMatrixArray) TableName ¶ added in v1.5.72
func (m *PropertyMatrixArray) TableName() string
type PropertyString ¶
type PropertyString struct {
Property
Param string `gorm:"column:param;type:varchar(256);NOT NULL"` // 时间戳
}
func (*PropertyString) TableName ¶
func (m *PropertyString) TableName() string
type PropertyStringArray ¶
type PropertyStringArray struct {
Property
Param string `gorm:"column:param;type:varchar(256);NOT NULL"` // 时间戳
Pos int64 `gorm:"column:pos;NOT NULL;"`
}
func (*PropertyStringArray) TableName ¶
func (m *PropertyStringArray) TableName() string
type PropertyStruct ¶
type PropertyStruct struct {
Property
Param map[string]any `gorm:"column:param;type:json;serializer:json;NOT NULL"` // 时间戳
}
func (*PropertyStruct) TableName ¶
func (m *PropertyStruct) TableName() string
type PropertyStructArray ¶
type PropertyStructArray struct {
Property
Param map[string]any `gorm:"column:param;type:json;serializer:json;NOT NULL"` // 时间戳
Pos int64 `gorm:"column:pos;NOT NULL;"`
}
func (*PropertyStructArray) TableName ¶
func (m *PropertyStructArray) TableName() string
type PropertyTimestamp ¶
func (*PropertyTimestamp) TableName ¶
func (m *PropertyTimestamp) TableName() string
type PropertyTimestampArray ¶
type PropertyTimestampArray struct {
Property
Param int64 `gorm:"column:param;NOT NULL"` // 时间戳
Pos int64 `gorm:"column:pos;NOT NULL;"`
}
func (*PropertyTimestampArray) TableName ¶
func (m *PropertyTimestampArray) TableName() string
Click to show internal directories.
Click to hide internal directories.