mongo

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateCollections = []func(db *Mongo) error{}
View Source
var DeviceTypeCriteriaBson = getBsonFieldObject[model.DeviceTypeCriteria]()
View Source
var ErrNoRightsFound = errors.New("no rights found")
View Source
var RightsEntryBson = getBsonFieldObject[RightsEntry]()

Functions

This section is empty.

Types

type Kind added in v0.0.12

type Kind string

type Mongo

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

func New

func New(conf config.Config) (*Mongo, error)

func (*Mongo) AspectIsUsed

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

func (*Mongo) CharacteristicIsUsed

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

func (*Mongo) CharacteristicIsUsedWithConceptInDeviceType

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

func (*Mongo) CheckBool added in v0.0.12

func (this *Mongo) CheckBool(token string, topic string, id string, action model.AuthAction) (allowed bool, err error)

func (*Mongo) CheckMultiple added in v0.0.12

func (this *Mongo) CheckMultiple(token string, topic string, ids []string, action model.AuthAction) (result map[string]bool, err error)

func (*Mongo) ConceptIsUsed

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

func (*Mongo) CreateId

func (this *Mongo) CreateId() string

func (*Mongo) DeviceClassIsUsed

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

func (*Mongo) Disconnect

func (this *Mongo) Disconnect()

func (*Mongo) EnsureInitialRights added in v0.0.12

func (this *Mongo) EnsureInitialRights(topic string, resourceId string, owner string) error

func (*Mongo) FunctionIsUsed

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

func (*Mongo) GetAdminUsers added in v0.0.18

func (this *Mongo) GetAdminUsers(token string, topic string, resourceId string) (admins []string, err error)

func (*Mongo) GetAspect

func (this *Mongo) GetAspect(ctx context.Context, id string) (aspect models.Aspect, exists bool, err error)

func (*Mongo) GetAspectNode

func (this *Mongo) GetAspectNode(ctx context.Context, id string) (aspectNode models.AspectNode, exists bool, err error)

func (*Mongo) GetCharacteristic

func (this *Mongo) GetCharacteristic(ctx context.Context, id string) (characteristic models.Characteristic, exists bool, err error)

func (*Mongo) GetConceptWithCharacteristics

func (this *Mongo) GetConceptWithCharacteristics(ctx context.Context, id string) (concept models.ConceptWithCharacteristics, exists bool, err error)

func (*Mongo) GetConceptWithoutCharacteristics

func (this *Mongo) GetConceptWithoutCharacteristics(ctx context.Context, id string) (concept models.Concept, exists bool, err error)

func (*Mongo) GetConfigurableCandidates

func (this *Mongo) GetConfigurableCandidates(ctx context.Context, serviceId string) (result []model.DeviceTypeCriteria, err error)

func (*Mongo) GetDevice

func (this *Mongo) GetDevice(ctx context.Context, id string) (device models.Device, exists bool, err error)

func (*Mongo) GetDeviceByLocalId

func (this *Mongo) GetDeviceByLocalId(ctx context.Context, ownerId string, localId string) (device models.Device, exists bool, err error)

func (*Mongo) GetDeviceClass

func (this *Mongo) GetDeviceClass(ctx context.Context, id string) (deviceClass models.DeviceClass, exists bool, err error)

func (*Mongo) GetDeviceGroup

func (this *Mongo) GetDeviceGroup(ctx context.Context, id string) (deviceGroup models.DeviceGroup, exists bool, err error)

func (*Mongo) GetDeviceType

func (this *Mongo) GetDeviceType(ctx context.Context, id string) (deviceType models.DeviceType, exists bool, err error)

func (*Mongo) GetDeviceTypeCriteriaByAspectIds added in v0.0.6

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

func (*Mongo) GetDeviceTypeCriteriaByCharacteristicIds added in v0.0.6

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

func (*Mongo) GetDeviceTypeCriteriaByDeviceClassIds added in v0.0.6

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

func (*Mongo) GetDeviceTypeCriteriaByFunctionIds added in v0.0.6

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

func (*Mongo) GetDeviceTypeCriteriaForDeviceTypeIdsAndFilterCriteria

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

func (*Mongo) GetDeviceTypeIdsByFilterCriteria

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

all criteria must match; if interactionsFilter is used (len > 0), at least one must match

func (*Mongo) GetDeviceTypeIdsByFilterCriteriaV2

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

func (*Mongo) GetDeviceTypesByServiceId

func (this *Mongo) GetDeviceTypesByServiceId(ctx context.Context, serviceId string) (result []models.DeviceType, err error)

func (*Mongo) GetFunction

func (this *Mongo) GetFunction(ctx context.Context, id string) (function models.Function, exists bool, err error)

func (*Mongo) GetHub

func (this *Mongo) GetHub(ctx context.Context, id string) (hub models.Hub, exists bool, err error)

func (*Mongo) GetHubsByDeviceId added in v0.0.20

func (this *Mongo) GetHubsByDeviceId(ctx context.Context, id string) (hubs []models.Hub, err error)

func (*Mongo) GetLocation

func (this *Mongo) GetLocation(ctx context.Context, id string) (location models.Location, exists bool, err error)

func (*Mongo) GetProtocol

func (this *Mongo) GetProtocol(ctx context.Context, id string) (protocol models.Protocol, exists bool, err error)

func (*Mongo) ListAccessibleResourceIds added in v0.0.20

func (this *Mongo) ListAccessibleResourceIds(token string, topic string, limit int64, offset int64, action model.AuthAction) (result []string, err error)

func (*Mongo) ListAllAspectNodes

func (this *Mongo) ListAllAspectNodes(ctx context.Context) (result []models.AspectNode, err error)

func (*Mongo) ListAllAspects

func (this *Mongo) ListAllAspects(ctx context.Context) (result []models.Aspect, err error)

func (*Mongo) ListAllCharacteristics

func (this *Mongo) ListAllCharacteristics(ctx context.Context) (result []models.Characteristic, err error)

func (*Mongo) ListAllControllingFunctionsByDeviceClass

func (this *Mongo) ListAllControllingFunctionsByDeviceClass(ctx context.Context, class string) (result []models.Function, err error)

func (*Mongo) ListAllDeviceClasses

func (this *Mongo) ListAllDeviceClasses(ctx context.Context) (result []models.DeviceClass, err error)

func (*Mongo) ListAllDeviceClassesUsedWithControllingFunctions

func (this *Mongo) ListAllDeviceClassesUsedWithControllingFunctions(ctx context.Context) (result []models.DeviceClass, err error)

func (*Mongo) ListAllFunctionsByDeviceClass

func (this *Mongo) ListAllFunctionsByDeviceClass(ctx context.Context, class string) (result []models.Function, err error)

func (*Mongo) ListAllFunctionsByType

func (this *Mongo) ListAllFunctionsByType(ctx context.Context, rdfType string) (result []models.Function, err error)

func (*Mongo) ListAllMeasuringFunctionsByAspect

func (this *Mongo) ListAllMeasuringFunctionsByAspect(ctx context.Context, aspect string, ancestors bool, descendants bool) (result []models.Function, err error)

returns all measuring functions used in combination with given aspect (and optional its descendants and ancestors)

func (*Mongo) ListAspectNodesByIdList

func (this *Mongo) ListAspectNodesByIdList(ctx context.Context, ids []string) (result []models.AspectNode, err error)

func (*Mongo) ListAspectNodesWithMeasuringFunction

func (this *Mongo) ListAspectNodesWithMeasuringFunction(ctx context.Context, ancestors bool, descendants bool) (result []models.AspectNode, err error)

returns all aspects used in combination with measuring functions (usage may optionally be by its descendants or ancestors)

func (*Mongo) ListAspectsWithMeasuringFunction

func (this *Mongo) ListAspectsWithMeasuringFunction(ctx context.Context, ancestors bool, descendants bool) (result []models.Aspect, err error)

returns all aspects used in combination with measuring functions (usage may optionally be by its descendants or ancestors)

func (*Mongo) ListDeviceGroups

func (this *Mongo) ListDeviceGroups(ctx context.Context, limit int64, offset int64, sort string) (result []models.DeviceGroup, err error)

func (*Mongo) ListDeviceTypes

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

func (*Mongo) ListDeviceTypesV2

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

func (*Mongo) ListProtocols

func (this *Mongo) ListProtocols(ctx context.Context, limit int64, offset int64, sort string) (result []models.Protocol, err error)

func (*Mongo) ListResourcesByPermissions added in v0.0.20

func (this *Mongo) ListResourcesByPermissions(topic string, userId string, groupIds []string, limit int64, offset int64, permissions ...model.AuthAction) (result []RightsEntry, err error)

func (*Mongo) RemoveAspect

func (this *Mongo) RemoveAspect(ctx context.Context, id string) error

func (*Mongo) RemoveAspectNodesByRootId

func (this *Mongo) RemoveAspectNodesByRootId(ctx context.Context, id string) error

func (*Mongo) RemoveCharacteristic

func (this *Mongo) RemoveCharacteristic(ctx context.Context, id string) error

func (*Mongo) RemoveConcept

func (this *Mongo) RemoveConcept(ctx context.Context, id string) error

func (*Mongo) RemoveDevice

func (this *Mongo) RemoveDevice(ctx context.Context, id string) error

func (*Mongo) RemoveDeviceClass

func (this *Mongo) RemoveDeviceClass(ctx context.Context, id string) error

func (*Mongo) RemoveDeviceGroup

func (this *Mongo) RemoveDeviceGroup(ctx context.Context, id string) error

func (*Mongo) RemoveDeviceType

func (this *Mongo) RemoveDeviceType(ctx context.Context, id string) error

func (*Mongo) RemoveFunction

func (this *Mongo) RemoveFunction(ctx context.Context, id string) error

func (*Mongo) RemoveHub

func (this *Mongo) RemoveHub(ctx context.Context, id string) error

func (*Mongo) RemoveLocation

func (this *Mongo) RemoveLocation(ctx context.Context, id string) error

func (*Mongo) RemoveProtocol

func (this *Mongo) RemoveProtocol(ctx context.Context, id string) error

func (*Mongo) RemoveRights added in v0.0.12

func (this *Mongo) RemoveRights(topic string, id string) error

func (*Mongo) RunStartupMigrations added in v0.0.15

func (this *Mongo) RunStartupMigrations(producer model.MigrationPublisher) error

func (*Mongo) SetAspect

func (this *Mongo) SetAspect(ctx context.Context, aspect models.Aspect) error

func (*Mongo) SetAspectNode

func (this *Mongo) SetAspectNode(ctx context.Context, aspectNode models.AspectNode) error

func (*Mongo) SetCharacteristic

func (this *Mongo) SetCharacteristic(ctx context.Context, characteristic models.Characteristic) error

func (*Mongo) SetConcept

func (this *Mongo) SetConcept(ctx context.Context, concept models.Concept) error

func (*Mongo) SetDevice

func (this *Mongo) SetDevice(ctx context.Context, device models.Device) error

func (*Mongo) SetDeviceClass

func (this *Mongo) SetDeviceClass(ctx context.Context, deviceClass models.DeviceClass) error

func (*Mongo) SetDeviceGroup

func (this *Mongo) SetDeviceGroup(ctx context.Context, deviceGroup models.DeviceGroup) error

func (*Mongo) SetDeviceType

func (this *Mongo) SetDeviceType(ctx context.Context, deviceType models.DeviceType) error

func (*Mongo) SetFunction

func (this *Mongo) SetFunction(ctx context.Context, function models.Function) error

func (*Mongo) SetHub

func (this *Mongo) SetHub(ctx context.Context, hub models.Hub) error

func (*Mongo) SetLocation

func (this *Mongo) SetLocation(ctx context.Context, location models.Location) error

func (*Mongo) SetProtocol

func (this *Mongo) SetProtocol(ctx context.Context, protocol models.Protocol) error

func (*Mongo) SetRights added in v0.0.12

func (this *Mongo) SetRights(topic string, resourceId string, rights model.ResourceRights) (err error)

func (*Mongo) Transaction

func (this *Mongo) Transaction(ctx context.Context) (resultCtx context.Context, close func(success bool) error, err error)

type RightsEntry added in v0.0.12

type RightsEntry struct {
	Kind          Kind     `json:"kind" bson:"kind"`
	Id            string   `json:"id" bson:"id"`
	AdminUsers    []string `json:"admin_users" bson:"admin_users"`
	AdminGroups   []string `json:"admin_groups" bson:"admin_groups"`
	ReadUsers     []string `json:"read_users" bson:"read_users"`
	ReadGroups    []string `json:"read_groups" bson:"read_groups"`
	WriteUsers    []string `json:"write_users" bson:"write_users"`
	WriteGroups   []string `json:"write_groups" bson:"write_groups"`
	ExecuteUsers  []string `json:"execute_users" bson:"execute_users"`
	ExecuteGroups []string `json:"execute_groups" bson:"execute_groups"`
}

func (*RightsEntry) ToResourceRights added in v0.0.18

func (this *RightsEntry) ToResourceRights() model.ResourceRights

Jump to

Keyboard shortcuts

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