data

package
v0.1.0-M4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0, EPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const IDSeparator string = "§"

IDSeparator is used for key definition system symbol. Should be a control character, i.e. invalid namespace/entityID symbol.

Variables

This section is empty.

Functions

func FeatureKey

func FeatureKey(thingID string, featureID string) string

FeatureKey represents a feature database key.

func FeaturesKeyPrefix

func FeaturesKeyPrefix(thingID string) string

FeaturesKeyPrefix represents all thing's features database key prefix.

func SystemThingKey

func SystemThingKey(thingID string) string

SystemThingKey returns the SystemThingData key.

Types

type FeatureData

type FeatureData struct {
	// ID represents the Feature ID.
	ID string
	// ThingID matches the feature's thing ID, i.e. the ThingData.ID value.
	ThingID string
	// Definition represents model.Feature definitions string representations.
	Definition []string
	// Properties represents model.Feature properties.
	Properties map[string]interface{}
	// Properties represents model.Feature desired properties.
	DesiredProperties map[string]interface{}
}

FeatureData represents the persistable model.Feature structure.

func (*FeatureData) Data

func (data *FeatureData) Data() interface{}

Data returns the persistable data.

func (*FeatureData) Key

func (data *FeatureData) Key() string

Key returns the datatabase key.

func (*FeatureData) Value

func (data *FeatureData) Value(value interface{})

Value returns the created instance from the stored data.

type StoreData

type StoreData interface {
	// Key returns the storage key.
	Key() string
	// Data returns the persistable data.
	Data() interface{}
	// Value returns the created instance from the stored data.
	Value(interface{})
}

StoreData provides key-value persitable pair

type SystemThingData

type SystemThingData struct {
	// ThingID matches the model.Thing namespace ID string representation.
	ID string
	// Revision represents the thing local revision that is initialised with the added model.Thing
	// revision and increased on each thing's data modification, including its features modifications.
	Revision int64
	// Timestamp represents the thing local timestamp that is the timestamp of each
	// thing's data modification, including its features modifications.
	Timestamp string
	// DeletedFeatures is a system field that contains the feature IDs of locally deleted features only,
	// i.e. not synchronized with the remote feature existence state.
	DeletedFeatures map[string]interface{}
	// UnsynchronizedFeatures is a system field that contains the feature IDs of locally modified features only,
	// i.e. not synchronized with the remote feature state.
	// For each unsynchronized feature the revision for its offline change is stored.
	UnsynchronizedFeatures map[string]int64
}

SystemThingData is used for Things Storage system data representation.

func (*SystemThingData) Data

func (data *SystemThingData) Data() interface{}

Data returns the persistable data.

func (*SystemThingData) Key

func (data *SystemThingData) Key() string

Key returns the datatabase key.

func (*SystemThingData) Value

func (data *SystemThingData) Value(value interface{})

Value returns the created instance from the stored data.

type ThingData

type ThingData struct {
	// ThingID matches the model.Thing namespace ID string representation.
	ID string
	// PolicyID matches the model.Thing policy ID string representation.
	PolicyID string
	// DefinitionID represents the model.Thing definition string representation.
	DefinitionID string
	// Attributes represents the model.Thing attributes.
	Attributes map[string]interface{}
}

ThingData represents the persistable model.Thing structure.

func (*ThingData) Data

func (data *ThingData) Data() interface{}

Data returns the persistable data.

func (*ThingData) Key

func (data *ThingData) Key() string

Key retuens the datatabase key.

func (*ThingData) Value

func (data *ThingData) Value(value interface{})

Value returns the created instance from the stored data.

Jump to

Keyboard shortcuts

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