Documentation ¶
Index ¶
- Constants
- func NewCreateEntityHandler(ctxReg ContextRegistry) http.HandlerFunc
- func NewQueryEntitiesHandler(ctxReg ContextRegistry) http.HandlerFunc
- func NewRegisterContextSourceHandler(ctxReg ContextRegistry) http.HandlerFunc
- func NewRetrieveEntityHandler(ctxReg ContextRegistry) http.HandlerFunc
- func NewUpdateEntityAttributesHandler(ctxReg ContextRegistry) http.HandlerFunc
- type ContextRegistry
- type ContextSource
- type CsourceRegistration
- type Entity
- type GeoQuery
- type Query
- type QueryEntitiesCallback
- type Request
Constants ¶
const ( //GeoSpatialRelationNearPoint describes a relation as a max or min distance from a Point GeoSpatialRelationNearPoint = "near" //GeoSpatialRelationWithinRect describes a relation as an overlapping polygon GeoSpatialRelationWithinRect = "within" //QueryDefaultPaginationLimit defines the limit that should be used for GET operations //when the client does not supply a value QueryDefaultPaginationLimit = uint64(1000) )
Variables ¶
This section is empty.
Functions ¶
func NewCreateEntityHandler ¶
func NewCreateEntityHandler(ctxReg ContextRegistry) http.HandlerFunc
NewCreateEntityHandler handles incoming POST requests for NGSI entities
func NewQueryEntitiesHandler ¶
func NewQueryEntitiesHandler(ctxReg ContextRegistry) http.HandlerFunc
NewQueryEntitiesHandler handles GET requests for NGSI entitites
func NewRegisterContextSourceHandler ¶
func NewRegisterContextSourceHandler(ctxReg ContextRegistry) http.HandlerFunc
NewRegisterContextSourceHandler handles POST requests for csource registrations
func NewRetrieveEntityHandler ¶
func NewRetrieveEntityHandler(ctxReg ContextRegistry) http.HandlerFunc
NewRetrieveEntityHandler retrieves entity by ID.
func NewUpdateEntityAttributesHandler ¶
func NewUpdateEntityAttributesHandler(ctxReg ContextRegistry) http.HandlerFunc
NewUpdateEntityAttributesHandler handles PATCH requests for NGSI entitity attributes
Types ¶
type ContextRegistry ¶
type ContextRegistry interface { GetContextSourcesForQuery(query Query) []ContextSource GetContextSourcesForEntity(entityID string) []ContextSource GetContextSourcesForEntityType(entityType string) []ContextSource Register(source ContextSource) }
ContextRegistry is where Context Sources register the information that they can provide
func NewContextRegistry ¶
func NewContextRegistry() ContextRegistry
NewContextRegistry initializes and returns a new default context registry without any registered context sources
type ContextSource ¶
type ContextSource interface { ProvidesAttribute(attributeName string) bool ProvidesEntitiesWithMatchingID(entityID string) bool ProvidesType(typeName string) bool CreateEntity(typeName, entityID string, request Request) error GetEntities(query Query, callback QueryEntitiesCallback) error RetrieveEntity(entityID string, request Request) (Entity, error) UpdateEntityAttributes(entityID string, request Request) error }
ContextSource provides query and subscription support for a set of entities
func NewRemoteContextSource ¶
func NewRemoteContextSource(registration CsourceRegistration) (ContextSource, error)
NewRemoteContextSource creates an instance of a ContextSource by wrapping a CsourceRegistration
type CsourceRegistration ¶
type CsourceRegistration interface { Endpoint() string ProvidesAttribute(attributeName string) bool ProvidesEntitiesWithMatchingID(entityID string) bool ProvidesType(typeName string) bool }
CsourceRegistration is a wrapper for information about a registered context source
func NewCsourceRegistration ¶
func NewCsourceRegistration(entityTypeName string, attributeNames []string, endpoint string, idpattern *string) (CsourceRegistration, error)
NewCsourceRegistration creates and returns a concrete implementation of the CsourceRegistration interface
func NewCsourceRegistrationFromJSON ¶
func NewCsourceRegistrationFromJSON(jsonBytes []byte) (CsourceRegistration, error)
NewCsourceRegistrationFromJSON unpacks a byte buffer into a CsourceRegistration and validates its contents
type Entity ¶
type Entity interface { }
Entity is an informational representative of something that is supposed to exist in the real world, physically or conceptually
type GeoQuery ¶
type GeoQuery struct { Geometry string `json:"geometry"` Coordinates []float64 `json:"coordinates"` GeoRel string `json:"georel"` GeoProperty *string `json:"geoproperty,omitempty"` // contains filtered or unexported fields }
GeoQuery contains information about a geo-query that may be used for subscriptions or when querying entitites
func (*GeoQuery) Distance ¶
Distance returns the required distance in meters from a near Point and a boolean flag indicating if it is inclusive or exclusive
type Query ¶
type Query interface { HasDeviceReference() bool Device() string PaginationLimit() uint64 PaginationOffset() uint64 IsGeoQuery() bool Geo() *GeoQuery EntityAttributes() []string EntityTypes() []string Request() *http.Request }
Query is an interface to be used when passing queries to context registries and sources
type QueryEntitiesCallback ¶
QueryEntitiesCallback is used when queried context sources should pass back any entities matching the query that has been passed in