schemaDataRepo

package
v1.5.18 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropertyType = "property_type"
)

Variables

View Source
var DeviceStables []string

Functions

func GenParams added in v1.4.46

func GenParams(params map[string]msgThing.Param) (string, string, []any, error)

GenParams 返回占位符?,?,?,? 参数id名:aa,bbb,ccc 参数值列表

func GenParams2 added in v1.5.12

func GenParams2(params map[string]any) (string, string, []any, error)

func GetArrayID

func GetArrayID(id string, num int) string

func NewDeviceDataRepo

func NewDeviceDataRepo(dataSource conf.TSDB, getProductSchemaModel schema.GetSchemaModel,
	getDeviceSchemaModel schema.GetSchemaModel, kv kv.Store, g []*deviceGroup.GroupDetail) msgThing.SchemaDataRepo

func ToEventData

func ToEventData(db map[string]any) *msgThing.EventData

Types

type DeviceDataRepo

type DeviceDataRepo struct {
	SchemaStore
	// contains filtered or unexported fields
}

func (*DeviceDataRepo) CreateProperty

func (d *DeviceDataRepo) CreateProperty(ctx context.Context, p *schema.Property, productID string) error

func (*DeviceDataRepo) DeleteDevice

func (d *DeviceDataRepo) DeleteDevice(
	ctx context.Context,
	t *schema.Model,
	productID string,
	deviceName string) error

func (*DeviceDataRepo) DeleteDeviceProperty

func (d *DeviceDataRepo) DeleteDeviceProperty(ctx context.Context, productID string, deviceName string, s []schema.Property) error

func (*DeviceDataRepo) DeleteProduct

func (d *DeviceDataRepo) DeleteProduct(ctx context.Context, t *schema.Model, productID string) error

func (*DeviceDataRepo) DeleteProperty

func (d *DeviceDataRepo) DeleteProperty(ctx context.Context, p *schema.Property, productID string, identifier string) error

func (*DeviceDataRepo) GenInsertPropertySql

func (d *DeviceDataRepo) GenInsertPropertySql(ctx context.Context, p *schema.Property, productID string, deviceName string,
	property *msgThing.Param, timestamp time.Time, optional msgThing.Optional) (sql string, args []any, err error)

func (*DeviceDataRepo) GetEventCountByFilter

func (d *DeviceDataRepo) GetEventCountByFilter(
	ctx context.Context,
	filter msgThing.FilterOpt) (int64, error)

func (*DeviceDataRepo) GetEventDataByFilter

func (d *DeviceDataRepo) GetEventDataByFilter(
	ctx context.Context,
	filter msgThing.FilterOpt) ([]*msgThing.EventData, error)

func (*DeviceDataRepo) GetLatestPropertyDataByID

func (d *DeviceDataRepo) GetLatestPropertyDataByID(ctx context.Context, p *schema.Property, filter msgThing.LatestFilter) (*msgThing.PropertyData, error)

func (*DeviceDataRepo) GetPropertyAgg added in v1.4.54

func (d *DeviceDataRepo) GetPropertyAgg(ctx context.Context, m *schema.Model, filter msgThing.FilterAggOpt) ([]*msgThing.PropertyData2, error)

func (*DeviceDataRepo) GetPropertyCountByID

func (d *DeviceDataRepo) GetPropertyCountByID(
	ctx context.Context, p *schema.Property,
	filter msgThing.FilterOpt) (int64, error)

func (*DeviceDataRepo) GetPropertyDataByID

func (d *DeviceDataRepo) GetPropertyDataByID(
	ctx context.Context, p *schema.Property,
	filter msgThing.FilterOpt) ([]*msgThing.PropertyData, error)

func (*DeviceDataRepo) Init

func (d *DeviceDataRepo) Init(ctx context.Context) error

func (*DeviceDataRepo) InitDevice

func (d *DeviceDataRepo) InitDevice(ctx context.Context,
	t *schema.Model,
	productID string,
	deviceName string) error

func (*DeviceDataRepo) InitProduct

func (d *DeviceDataRepo) InitProduct(ctx context.Context, t *schema.Model, productID string) error

func (*DeviceDataRepo) InsertEventData

func (d *DeviceDataRepo) InsertEventData(ctx context.Context, productID string,
	deviceName string, event *msgThing.EventData) error

func (*DeviceDataRepo) InsertPropertiesData

func (d *DeviceDataRepo) InsertPropertiesData(ctx context.Context, t *schema.Model, productID string, deviceName string,
	params map[string]msgThing.Param, timestamp time.Time, optional msgThing.Optional) error

func (*DeviceDataRepo) InsertPropertyData

func (d *DeviceDataRepo) InsertPropertyData(ctx context.Context, t *schema.Property, productID string, deviceName string,
	property *msgThing.Param, timestamp time.Time, optional msgThing.Optional) error

func (*DeviceDataRepo) ToPropertyData added in v1.4.21

func (d *DeviceDataRepo) ToPropertyData(ctx context.Context, id string, p *schema.Property, db map[string]any) (ret *msgThing.PropertyData)

func (*DeviceDataRepo) ToPropertyData2 added in v1.4.56

func (d *DeviceDataRepo) ToPropertyData2(ctx context.Context, agg msgThing.PropertyAgg, p *schema.Define, dbs []map[string]any, retMap map[string]msgThing.PropertyData2) map[string]msgThing.PropertyData2

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) UpdateProduct

func (d *DeviceDataRepo) UpdateProduct(
	ctx context.Context, oldT *schema.Model, newt *schema.Model, productID string) error

func (*DeviceDataRepo) UpdateProperty

func (d *DeviceDataRepo) UpdateProperty(
	ctx context.Context,
	oldP *schema.Property,
	newP *schema.Property,
	productID string) error

func (*DeviceDataRepo) VersionUpdate added in v1.4.13

func (d *DeviceDataRepo) VersionUpdate(ctx context.Context, version string, dc *caches.Cache[dm.DeviceInfo, devices.Core]) error

type PropertyAgg2 added in v1.4.54

type PropertyAgg2 struct {
	P *schema.Property
	msgThing.PropertyAgg
}

type PropertyAggStu added in v1.4.54

type PropertyAggStu struct {
	NoFirstTs bool `json:"noFirstTs,optional"` //时间戳填充不填充最早的值,聚合模式使用
	Aggs      []PropertyAgg2
}

type SchemaStore

type SchemaStore struct {
}

func (*SchemaStore) GetDeviceStableBoolName

func (S *SchemaStore) GetDeviceStableBoolName() string

func (*SchemaStore) GetDeviceStableEnumName

func (S *SchemaStore) GetDeviceStableEnumName() string

func (*SchemaStore) GetDeviceStableFloatName

func (S *SchemaStore) GetDeviceStableFloatName() string

func (*SchemaStore) GetDeviceStableIntName

func (S *SchemaStore) GetDeviceStableIntName() string

func (*SchemaStore) GetDeviceStableStringName

func (S *SchemaStore) GetDeviceStableStringName() string

func (*SchemaStore) GetDeviceStableTimestampName

func (S *SchemaStore) GetDeviceStableTimestampName() string

func (*SchemaStore) GetEventStableName

func (S *SchemaStore) GetEventStableName() string

func (*SchemaStore) GetEventTableName

func (S *SchemaStore) GetEventTableName(productID, deviceName string) string

func (*SchemaStore) GetPropertyStableName

func (S *SchemaStore) GetPropertyStableName(p *schema.Property, productID, identifier string) string

func (*SchemaStore) GetPropertyTableName

func (S *SchemaStore) GetPropertyTableName(productID, deviceName, identifier string) string

func (*SchemaStore) GetPropertyTableNames

func (S *SchemaStore) GetPropertyTableNames(productID, deviceName string, p *schema.Property) (ret []string)

func (*SchemaStore) GetSpecsColumnWithArgFunc

func (S *SchemaStore) GetSpecsColumnWithArgFunc(s schema.Specs, argFunc string) string

func (*SchemaStore) GetSpecsColumnWithArgFunc2 added in v1.5.15

func (S *SchemaStore) GetSpecsColumnWithArgFunc2(s schema.Specs, agg msgThing.PropertyAgg) string

func (*SchemaStore) GetSpecsCreateColumn

func (S *SchemaStore) GetSpecsCreateColumn(s schema.Specs) string

func (*SchemaStore) GetStableNameList

func (S *SchemaStore) GetStableNameList(
	t *schema.Model,
	productID string) (tables []string)

func (*SchemaStore) GetTableNameList

func (S *SchemaStore) GetTableNameList(
	t *schema.Model,
	productID string,
	deviceName string) (tables []string)

Jump to

Keyboard shortcuts

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