testdb

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var STRICT = true

Functions

func NewTestDB

func NewTestDB(config configuration.Config) database.Database

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func (*DB) AddAspectNode

func (db *DB) AddAspectNode(_ context.Context, node models.AspectNode) error

func (*DB) AspectIsUsed

func (db *DB) AspectIsUsed(ctx context.Context, id string) (result bool, where []string, err error)

func (*DB) CharacteristicIsUsed

func (db *DB) CharacteristicIsUsed(ctx context.Context, id string) (result bool, where []string, err error)

func (*DB) CharacteristicIsUsedWithConceptInDeviceType

func (db *DB) CharacteristicIsUsedWithConceptInDeviceType(ctx context.Context, characteristicId string, conceptId string) (result bool, where []string, err error)

func (*DB) ConceptIsUsed

func (db *DB) ConceptIsUsed(ctx context.Context, id string) (result bool, where []string, err error)

func (*DB) DeviceClassIsUsed

func (db *DB) DeviceClassIsUsed(ctx context.Context, id string) (result bool, where []string, err error)

func (*DB) DeviceLocalIdsToIds added in v0.1.24

func (db *DB) DeviceLocalIdsToIds(ctx context.Context, owner string, localIds []string) (ids []string, err error)

func (*DB) Disconnect

func (db *DB) Disconnect()

func (*DB) FunctionIsUsed

func (db *DB) FunctionIsUsed(ctx context.Context, id string) (result bool, where []string, err error)

func (*DB) GetAspect

func (db *DB) GetAspect(_ context.Context, id string) (result models.Aspect, exists bool, err error)

func (*DB) GetAspectNode

func (db *DB) GetAspectNode(_ context.Context, id string) (result models.AspectNode, exists bool, err error)

func (*DB) GetCharacteristic

func (db *DB) GetCharacteristic(_ context.Context, id string) (result models.Characteristic, exists bool, err error)

func (*DB) GetConceptWithCharacteristics

func (db *DB) GetConceptWithCharacteristics(_ context.Context, id string) (result models.ConceptWithCharacteristics, exists bool, err error)

func (*DB) GetConceptWithoutCharacteristics

func (db *DB) GetConceptWithoutCharacteristics(_ context.Context, id string) (result models.Concept, exists bool, err error)

func (*DB) GetConfigurableCandidates

func (db *DB) GetConfigurableCandidates(_ context.Context, serviceId string) (result []model.DeviceTypeCriteria, err error)

func (*DB) GetDevice

func (db *DB) GetDevice(_ context.Context, id string) (device model.DeviceWithConnectionState, exists bool, err error)

func (*DB) GetDeviceByLocalId

func (db *DB) GetDeviceByLocalId(_ context.Context, ownerId string, localId string) (device model.DeviceWithConnectionState, exists bool, err error)

func (*DB) GetDeviceClass

func (db *DB) GetDeviceClass(_ context.Context, id string) (result models.DeviceClass, exists bool, err error)

func (*DB) GetDeviceGroup

func (db *DB) GetDeviceGroup(_ context.Context, id string) (deviceGroup models.DeviceGroup, exists bool, err error)

func (*DB) GetDeviceType

func (db *DB) GetDeviceType(_ context.Context, id string) (deviceType models.DeviceType, exists bool, err error)

func (*DB) GetDeviceTypeCriteriaByAspectIds added in v0.0.6

func (db *DB) GetDeviceTypeCriteriaByAspectIds(ctx context.Context, ids []string, includeModified bool) (result []model.DeviceTypeCriteria, err error)

func (*DB) GetDeviceTypeCriteriaByCharacteristicIds added in v0.0.6

func (db *DB) GetDeviceTypeCriteriaByCharacteristicIds(ctx context.Context, ids []string, includeModified bool) (result []model.DeviceTypeCriteria, err error)

func (*DB) GetDeviceTypeCriteriaByDeviceClassIds added in v0.0.6

func (db *DB) GetDeviceTypeCriteriaByDeviceClassIds(ctx context.Context, ids []string, includeModified bool) (result []model.DeviceTypeCriteria, err error)

func (*DB) GetDeviceTypeCriteriaByFunctionIds added in v0.0.6

func (db *DB) GetDeviceTypeCriteriaByFunctionIds(ctx context.Context, ids []string, includeModified bool) (result []model.DeviceTypeCriteria, err error)

func (*DB) GetDeviceTypeCriteriaForDeviceTypeIdsAndFilterCriteria

func (db *DB) GetDeviceTypeCriteriaForDeviceTypeIdsAndFilterCriteria(ctx context.Context, deviceTypeIds []interface{}, criteria model.FilterCriteria, includeModified bool) (result []model.DeviceTypeCriteria, err error)

func (*DB) GetDeviceTypeIdsByFilterCriteria

func (db *DB) GetDeviceTypeIdsByFilterCriteria(ctx context.Context, criteria []model.FilterCriteria, interactionsFilter []string, includeModified bool) (result []interface{}, err error)

func (*DB) GetDeviceTypeIdsByFilterCriteriaV2

func (db *DB) GetDeviceTypeIdsByFilterCriteriaV2(ctx context.Context, criteria []model.FilterCriteria, includeModified bool) (result []interface{}, err error)

func (*DB) GetDeviceTypesByServiceId

func (db *DB) GetDeviceTypesByServiceId(_ context.Context, serviceId string) (result []models.DeviceType, err error)

func (*DB) GetFunction

func (db *DB) GetFunction(_ context.Context, id string) (result models.Function, exists bool, err error)

func (*DB) GetHub

func (db *DB) GetHub(_ context.Context, id string) (hub model.HubWithConnectionState, exists bool, err error)

func (*DB) GetHubsByDeviceId added in v0.0.20

func (db *DB) GetHubsByDeviceId(_ context.Context, id string) (hubs []model.HubWithConnectionState, err error)

func (*DB) GetLocation

func (db *DB) GetLocation(_ context.Context, id string) (result models.Location, exists bool, err error)

func (*DB) GetProtocol

func (db *DB) GetProtocol(_ context.Context, id string) (result models.Protocol, exists bool, err error)

func (*DB) ListAllAspectNodes

func (db *DB) ListAllAspectNodes(_ context.Context) ([]models.AspectNode, error)

func (*DB) ListAllAspects

func (db *DB) ListAllAspects(_ context.Context) ([]models.Aspect, error)

func (*DB) ListAllCharacteristics

func (db *DB) ListAllCharacteristics(_ context.Context) ([]models.Characteristic, error)

func (*DB) ListAllControllingFunctionsByDeviceClass

func (db *DB) ListAllControllingFunctionsByDeviceClass(_ context.Context, class string) ([]models.Function, error)

func (*DB) ListAllDeviceClasses

func (db *DB) ListAllDeviceClasses(_ context.Context) ([]models.DeviceClass, error)

func (*DB) ListAllDeviceClassesUsedWithControllingFunctions

func (db *DB) ListAllDeviceClassesUsedWithControllingFunctions(_ context.Context) ([]models.DeviceClass, error)

func (*DB) ListAllFunctionsByDeviceClass

func (db *DB) ListAllFunctionsByDeviceClass(_ context.Context, class string) ([]models.Function, error)

func (*DB) ListAllFunctionsByType

func (db *DB) ListAllFunctionsByType(_ context.Context, rdfType string) (result []models.Function, err error)

func (*DB) ListAllMeasuringFunctionsByAspect

func (db *DB) ListAllMeasuringFunctionsByAspect(_ context.Context, aspect string, ancestors bool, descendants bool) ([]models.Function, error)

func (*DB) ListAspectNodes added in v0.1.40

func (db *DB) ListAspectNodes(ctx context.Context, options model.AspectListOptions) (result []models.AspectNode, total int64, err error)

func (*DB) ListAspectNodesByIdList

func (db *DB) ListAspectNodesByIdList(_ context.Context, ids []string) (result []models.AspectNode, err error)

func (*DB) ListAspectNodesWithMeasuringFunction

func (db *DB) ListAspectNodesWithMeasuringFunction(_ context.Context, ancestors bool, descendants bool) ([]models.AspectNode, error)

func (*DB) ListAspects added in v0.1.40

func (db *DB) ListAspects(ctx context.Context, options model.AspectListOptions) (result []models.Aspect, total int64, err error)

func (*DB) ListAspectsWithMeasuringFunction

func (db *DB) ListAspectsWithMeasuringFunction(_ context.Context, ancestors bool, descendants bool) ([]models.Aspect, error)

func (*DB) ListCharacteristics added in v0.1.48

func (db *DB) ListCharacteristics(ctx context.Context, options model.CharacteristicListOptions) (result []models.Characteristic, total int64, err error)

func (*DB) ListConcepts added in v0.1.41

func (db *DB) ListConcepts(ctx context.Context, options model.ConceptListOptions) (result []models.Concept, total int64, err error)

func (*DB) ListConceptsWithCharacteristics added in v0.1.41

func (db *DB) ListConceptsWithCharacteristics(ctx context.Context, options model.ConceptListOptions) ([]models.ConceptWithCharacteristics, int64, error)

func (*DB) ListDeviceClasses added in v0.1.43

func (db *DB) ListDeviceClasses(ctx context.Context, options model.DeviceClassListOptions) (result []models.DeviceClass, total int64, err error)

func (*DB) ListDeviceGroups

func (db *DB) ListDeviceGroups(_ context.Context, options model.DeviceGroupListOptions) (result []models.DeviceGroup, total int64, err error)

func (*DB) ListDeviceTypes

func (db *DB) ListDeviceTypes(ctx context.Context, limit int64, offset int64, sort string, filter []model.FilterCriteria, interactionsFilter []string, includeModified bool) (result []models.DeviceType, err error)

func (*DB) ListDeviceTypesV2

func (db *DB) ListDeviceTypesV2(ctx context.Context, limit int64, offset int64, sort string, filter []model.FilterCriteria, includeModified bool) (result []models.DeviceType, err error)

func (*DB) ListDeviceTypesV3 added in v0.1.12

func (db *DB) ListDeviceTypesV3(ctx context.Context, listOptions model.DeviceTypeListOptions) (result []models.DeviceType, total int64, err error)

func (*DB) ListDevices added in v0.1.0

func (db *DB) ListDevices(ctx context.Context, options model.DeviceListOptions, withTotal bool) (devices []model.DeviceWithConnectionState, total int64, err error)

func (*DB) ListFunctions added in v0.1.38

func (db *DB) ListFunctions(ctx context.Context, options model.FunctionListOptions) (result []models.Function, total int64, err error)

func (*DB) ListHubs added in v0.1.0

func (db *DB) ListHubs(ctx context.Context, options model.HubListOptions, withTotal bool) (hubs []model.HubWithConnectionState, total int64, err error)

func (*DB) ListLocations added in v0.1.30

func (db *DB) ListLocations(ctx context.Context, options model.LocationListOptions) (locations []models.Location, total int64, err error)

func (*DB) ListProtocols

func (db *DB) ListProtocols(_ context.Context, limit int64, offset int64, sort string) ([]models.Protocol, error)

func (*DB) RemoveAspect

func (db *DB) RemoveAspect(ctx context.Context, id string, syncDeleteHandler func(models.Aspect) error) error

func (*DB) RemoveAspectNodesByRootId

func (db *DB) RemoveAspectNodesByRootId(_ context.Context, id string) error

func (*DB) RemoveCharacteristic

func (db *DB) RemoveCharacteristic(ctx context.Context, id string, syncDeleteHandler func(models.Characteristic) error) error

func (*DB) RemoveConcept

func (db *DB) RemoveConcept(ctx context.Context, id string, syncDeleteHandler func(models.Concept) error) error

func (*DB) RemoveDevice

func (db *DB) RemoveDevice(_ context.Context, id string, syncDeleteHandler func(model.DeviceWithConnectionState) error) error

func (*DB) RemoveDeviceClass

func (db *DB) RemoveDeviceClass(ctx context.Context, id string, syncDeleteHandler func(models.DeviceClass) error) error

func (*DB) RemoveDeviceGroup

func (db *DB) RemoveDeviceGroup(ctx context.Context, id string, syncDeleteHandler func(models.DeviceGroup) error) error

func (*DB) RemoveDeviceType

func (db *DB) RemoveDeviceType(ctx context.Context, id string, syncDeleteHandler func(models.DeviceType) error) error

func (*DB) RemoveFunction

func (db *DB) RemoveFunction(ctx context.Context, id string, syncDeleteHandler func(models.Function) error) error

func (*DB) RemoveHub

func (db *DB) RemoveHub(ctx context.Context, id string, syncDeleteHandler func(model.HubWithConnectionState) error) error

func (*DB) RemoveLocation

func (db *DB) RemoveLocation(ctx context.Context, id string, syncDeleteHandler func(models.Location) error) error

func (*DB) RemoveProtocol

func (db *DB) RemoveProtocol(ctx context.Context, id string, syncDeleteHandler func(models.Protocol) error) error

func (*DB) RetryAspectSync added in v0.1.53

func (db *DB) RetryAspectSync(lockduration time.Duration, syncDeleteHandler func(models.Aspect) error, syncHandler func(models.Aspect) error) error

func (*DB) RetryCharacteristicSync added in v0.1.53

func (db *DB) RetryCharacteristicSync(lockduration time.Duration, syncDeleteHandler func(models.Characteristic) error, syncHandler func(models.Characteristic) error) error

func (*DB) RetryConceptSync added in v0.1.53

func (db *DB) RetryConceptSync(lockduration time.Duration, syncDeleteHandler func(models.Concept) error, syncHandler func(models.Concept) error) error

func (*DB) RetryDeviceClassSync added in v0.1.53

func (db *DB) RetryDeviceClassSync(lockduration time.Duration, syncDeleteHandler func(models.DeviceClass) error, syncHandler func(models.DeviceClass) error) error

func (*DB) RetryDeviceGroupSync added in v0.1.53

func (db *DB) RetryDeviceGroupSync(lockduration time.Duration, syncDeleteHandler func(models.DeviceGroup) error, syncHandler func(dg models.DeviceGroup, user string) error) error

func (*DB) RetryDeviceSync added in v0.1.53

func (db *DB) RetryDeviceSync(lockduration time.Duration, syncDeleteHandler func(model.DeviceWithConnectionState) error, syncHandler func(model.DeviceWithConnectionState) error) error

func (*DB) RetryDeviceTypeSync added in v0.1.53

func (db *DB) RetryDeviceTypeSync(lockduration time.Duration, syncDeleteHandler func(models.DeviceType) error, syncHandler func(models.DeviceType) error) error

func (*DB) RetryFunctionSync added in v0.1.53

func (db *DB) RetryFunctionSync(lockduration time.Duration, syncDeleteHandler func(models.Function) error, syncHandler func(models.Function) error) error

func (*DB) RetryHubSync added in v0.1.53

func (db *DB) RetryHubSync(lockduration time.Duration, syncDeleteHandler func(model.HubWithConnectionState) error, syncHandler func(model.HubWithConnectionState) error) error

func (*DB) RetryLocationSync added in v0.1.53

func (db *DB) RetryLocationSync(lockduration time.Duration, syncDeleteHandler func(models.Location) error, syncHandler func(l models.Location, user string) error) error

func (*DB) RetryProtocolSync added in v0.1.53

func (db *DB) RetryProtocolSync(lockduration time.Duration, syncDeleteHandler func(models.Protocol) error, syncHandler func(models.Protocol) error) error

func (*DB) RunStartupMigrations added in v0.0.15

func (db *DB) RunStartupMigrations(methods mongo.GeneratedDeviceGroupMigrationMethods) error

func (*DB) SetAspect

func (db *DB) SetAspect(ctx context.Context, aspect models.Aspect, syncHandler func(models.Aspect) error) error

func (*DB) SetAspectNode

func (db *DB) SetAspectNode(_ context.Context, node models.AspectNode) error

func (*DB) SetCharacteristic

func (db *DB) SetCharacteristic(ctx context.Context, characteristic models.Characteristic, syncHandler func(models.Characteristic) error) error

func (*DB) SetConcept

func (db *DB) SetConcept(ctx context.Context, concept models.Concept, syncHandler func(models.Concept) error) error

func (*DB) SetDevice

func (db *DB) SetDevice(_ context.Context, device model.DeviceWithConnectionState, syncHandler func(model.DeviceWithConnectionState) error) error

func (*DB) SetDeviceClass

func (db *DB) SetDeviceClass(ctx context.Context, class models.DeviceClass, syncHandler func(models.DeviceClass) error) error

func (*DB) SetDeviceConnectionState added in v0.1.0

func (db *DB) SetDeviceConnectionState(ctx context.Context, id string, state models.ConnectionState) error

func (*DB) SetDeviceGroup

func (db *DB) SetDeviceGroup(ctx context.Context, deviceGroup models.DeviceGroup, syncHandler func(dg models.DeviceGroup, user string) error, user string) error

func (*DB) SetDeviceType

func (db *DB) SetDeviceType(ctx context.Context, deviceType models.DeviceType, syncHandler func(models.DeviceType) error) error

func (*DB) SetFunction

func (db *DB) SetFunction(ctx context.Context, function models.Function, syncHandler func(models.Function) error) error

func (*DB) SetHub

func (db *DB) SetHub(ctx context.Context, hub model.HubWithConnectionState, syncHandler func(model.HubWithConnectionState) error) error

func (*DB) SetHubConnectionState added in v0.1.0

func (db *DB) SetHubConnectionState(ctx context.Context, id string, state models.ConnectionState) error

func (*DB) SetLocation

func (db *DB) SetLocation(ctx context.Context, location models.Location, syncHandler func(l models.Location, user string) error, user string) error

func (*DB) SetProtocol

func (db *DB) SetProtocol(ctx context.Context, protocol models.Protocol, syncHandler func(models.Protocol) error) error

type Resource added in v0.0.20

type Resource struct {
	Id      string `json:"id"`
	TopicId string `json:"topic_id"`
	model.ResourceRights
}

Jump to

Keyboard shortcuts

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