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.PropertyData
- 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) GetLatestPropertyDataByID(ctx context.Context, p *schema.Property, filter msgThing.LatestFilter) (*msgThing.PropertyData, 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.PropertyData, 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) UpdateProperty(ctx context.Context, oldP *schema.Property, newP *schema.Property, ...) error
- type Event
- type Property
- type PropertyBool
- type PropertyBoolArray
- type PropertyEnum
- type PropertyEnumArray
- type PropertyFloat
- type PropertyFloatArray
- type PropertyInt
- type PropertyIntArray
- 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) 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) GetLatestPropertyDataByID ¶
func (d *DeviceDataRepo) GetLatestPropertyDataByID(ctx context.Context, p *schema.Property, filter msgThing.LatestFilter) (*msgThing.PropertyData, error)
func (*DeviceDataRepo) GetPropertyCountByID ¶
func (*DeviceDataRepo) GetPropertyDataByID ¶
func (d *DeviceDataRepo) GetPropertyDataByID( ctx context.Context, p *schema.Property, filter msgThing.FilterOpt) ([]*msgThing.PropertyData, error)
func (*DeviceDataRepo) InitDevice ¶
func (*DeviceDataRepo) InitProduct ¶
func (*DeviceDataRepo) InsertEventData ¶
func (*DeviceDataRepo) InsertPropertiesData ¶
func (*DeviceDataRepo) InsertPropertyData ¶
type Event ¶
type Event struct { ProductID string `gorm:"column:product_id;type:varchar(100);NOT NULL"` // 产品id DeviceName string `gorm:"column:device_name;type:varchar(100);NOT NULL"` // 设备名称 Identifier string `gorm:"column:identifier;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;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 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.