schemaDataRepo

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropertyType = "property_type"
)

Variables

This section is empty.

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, getSchemaModel 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) 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) (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) 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) error

func (*DeviceDataRepo) InsertPropertyData

func (d *DeviceDataRepo) InsertPropertyData(ctx context.Context, t *schema.Property, productID string, deviceName string, property *msgThing.Param, timestamp time.Time) 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) GetEventStableName

func (S *SchemaStore) GetEventStableName() string

func (*SchemaStore) GetEventTableName

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

func (*SchemaStore) GetPropertyStableName

func (S *SchemaStore) GetPropertyStableName(tag schema.Tag, 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) 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