schemaDataRepo

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropertyType = "property_type"
)

Variables

View Source
var DeviceStables []string

Functions

func GetArrayID

func GetArrayID(id string, num int) string

func ToEventData

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

func ToPropertyData

func ToPropertyData(id string, p *schema.Property, db map[string]any) *msgThing.PropertyData

Types

type DeviceDataRepo

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

func NewDeviceDataRepo

func NewDeviceDataRepo(dataSource conf.TSDB, getProductSchemaModel schema.GetSchemaModel, getDeviceSchemaModel schema.GetSchemaModel, kv kv.Store) *DeviceDataRepo

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 added in v1.0.4

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) 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 added in v1.0.4

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

type SchemaStore

type SchemaStore struct {
}

func (*SchemaStore) GetDeviceStableBoolName added in v1.0.4

func (S *SchemaStore) GetDeviceStableBoolName() string

func (*SchemaStore) GetDeviceStableEnumName added in v1.0.4

func (S *SchemaStore) GetDeviceStableEnumName() string

func (*SchemaStore) GetDeviceStableFloatName added in v1.0.4

func (S *SchemaStore) GetDeviceStableFloatName() string

func (*SchemaStore) GetDeviceStableIntName added in v1.0.4

func (S *SchemaStore) GetDeviceStableIntName() string

func (*SchemaStore) GetDeviceStableStringName added in v1.0.4

func (S *SchemaStore) GetDeviceStableStringName() string

func (*SchemaStore) GetDeviceStableTimestampName added in v1.0.4

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, deviceName, 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) 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