Documentation ¶
Index ¶
- Constants
- Variables
- func CheckEncodingSupported(encodingType string) (bool, error)
- func CheckMandatoryParam(errorList *[]error, param interface{}, entityType EntityType, paramName string)
- func CreateEntityLink(isNil bool, externalURI string, entityType1 string, entityType2 string, ...) string
- func CreateEntitySelfLink(externalURI string, entityLink string, id interface{}) string
- func GetSupportedEncodings() string
- type ArrayResponse
- type ArrayResponseDatastreams
- type ArrayResponseEndpoint
- type ArrayResponseFeaturesOfInterest
- type ArrayResponseHistoricalLocations
- type ArrayResponseLocations
- type ArrayResponseObservations
- type ArrayResponseObservedProperty
- type ArrayResponseSensors
- type ArrayResponseThings
- type BaseEntity
- func (b BaseEntity) ClearNav()
- func (b *BaseEntity) ContainsMandatoryParams() (bool, []error)
- func (b *BaseEntity) GetEntityType() EntityType
- func (b *BaseEntity) GetID() interface{}
- func (b *BaseEntity) GetPropertyNames() []string
- func (b *BaseEntity) GetSelfLink() string
- func (b *BaseEntity) GetSupportedEncoding() map[int]EncodingType
- func (b *BaseEntity) ParseEntity(data []byte) error
- func (b *BaseEntity) SetID(newID interface{})
- func (b *BaseEntity) SetLinks(externalURL string) error
- type CreateObservations
- func (c *CreateObservations) ContainsMandatoryParams() (bool, []error)
- func (c CreateObservations) GetEntityType() EntityType
- func (c *CreateObservations) ParseEntity(data []byte) error
- func (c *CreateObservations) SetAllLinks(externalURL string)
- func (c *CreateObservations) SetLinks(externalURL string)
- func (c *CreateObservations) SetSelfLink(externalURL string)
- type Datastream
- func (d *Datastream) ClearNav()
- func (d *Datastream) ContainsMandatoryParams() (bool, []error)
- func (d Datastream) GetEntityType() EntityType
- func (d *Datastream) GetPropertyNames() []string
- func (d Datastream) GetSupportedEncoding() map[int]EncodingType
- func (d *Datastream) ParseEntity(data []byte) error
- func (d *Datastream) SetAllLinks(externalURL string)
- func (d *Datastream) SetLinks(externalURL string)
- func (d *Datastream) SetSelfLink(externalURL string)
- type EncodingType
- type Endpoint
- type Entity
- type EntityLink
- type EntityType
- type FeatureOfInterest
- func (f *FeatureOfInterest) ClearNav()
- func (f *FeatureOfInterest) ContainsMandatoryParams() (bool, []error)
- func (f FeatureOfInterest) GetEntityType() EntityType
- func (f *FeatureOfInterest) GetPropertyNames() []string
- func (f *FeatureOfInterest) ParseEntity(data []byte) error
- func (f *FeatureOfInterest) SetAllLinks(externalURL string)
- func (f *FeatureOfInterest) SetLinks(externalURL string)
- func (f *FeatureOfInterest) SetSelfLink(externalURL string)
- type HistoricalLocation
- func (h *HistoricalLocation) ClearNav()
- func (h *HistoricalLocation) ContainsMandatoryParams() (bool, []error)
- func (h HistoricalLocation) GetEntityType() EntityType
- func (h *HistoricalLocation) GetPropertyNames() []string
- func (h HistoricalLocation) GetSupportedEncoding() map[int]EncodingType
- func (h *HistoricalLocation) ParseEntity(data []byte) error
- func (h *HistoricalLocation) SetAllLinks(externalURL string)
- func (h *HistoricalLocation) SetLinks(externalURL string)
- func (h *HistoricalLocation) SetSelfLink(externalURL string)
- type Location
- func (l *Location) ClearNav()
- func (l *Location) ContainsMandatoryParams() (bool, []error)
- func (l Location) GetEntityType() EntityType
- func (l *Location) GetPropertyNames() []string
- func (l *Location) ParseEntity(data []byte) error
- func (l *Location) SetAllLinks(externalURL string)
- func (l *Location) SetLinks(externalURL string)
- func (l *Location) SetSelfLink(externalURL string)
- type Observation
- func (o *Observation) ClearNav()
- func (o *Observation) ContainsMandatoryParams() (bool, []error)
- func (o Observation) GetEntityType() EntityType
- func (o *Observation) GetPropertyNames() []string
- func (o Observation) GetSupportedEncoding() map[int]EncodingType
- func (o *Observation) MarshalJSON() ([]byte, error)
- func (o Observation) MarshalPostgresJSON() ([]byte, error)
- func (o *Observation) ParseEntity(data []byte) error
- func (o *Observation) SetAllLinks(externalURL string)
- func (o *Observation) SetLinks(externalURL string)
- func (o *Observation) SetSelfLink(externalURL string)
- type ObservationType
- type ObservedProperty
- func (o *ObservedProperty) ClearNav()
- func (o *ObservedProperty) ContainsMandatoryParams() (bool, []error)
- func (o ObservedProperty) GetEntityType() EntityType
- func (o *ObservedProperty) GetPropertyNames() []string
- func (o ObservedProperty) GetSupportedEncoding() map[int]EncodingType
- func (o *ObservedProperty) ParseEntity(data []byte) error
- func (o *ObservedProperty) SetAllLinks(externalURL string)
- func (o *ObservedProperty) SetLinks(externalURL string)
- func (o *ObservedProperty) SetSelfLink(externalURL string)
- type RawCreateObservations
- type Sensor
- func (s *Sensor) ClearNav()
- func (s *Sensor) ContainsMandatoryParams() (bool, []error)
- func (s Sensor) GetEntityType() EntityType
- func (s *Sensor) GetPropertyNames() []string
- func (s *Sensor) ParseEntity(data []byte) error
- func (s *Sensor) SetAllLinks(externalURL string)
- func (s *Sensor) SetLinks(externalURL string)
- func (s *Sensor) SetSelfLink(externalURL string)
- type Thing
- func (t *Thing) ClearNav()
- func (t *Thing) ContainsMandatoryParams() (bool, []error)
- func (t Thing) GetEntityType() EntityType
- func (t *Thing) GetPropertyNames() []string
- func (t Thing) GetSupportedEncoding() map[int]EncodingType
- func (t *Thing) ParseEntity(data []byte) error
- func (t *Thing) SetAllLinks(externalURL string)
- func (t *Thing) SetLinks(externalURL string)
- func (t *Thing) SetSelfLink(externalURL string)
Constants ¶
const (
// ISO8601 defines the ISO8601 date time format
ISO8601 = "2006-01-02T15:04:05.999Z07:00"
)
Variables ¶
var ( EncodingUnknown = EncodingType{0, "unknown"} EncodingGeoJSON = EncodingType{1, "application/vnd.geo+json"} EncodingPDF = EncodingType{2, "application/pdf"} EncodingSensorML = EncodingType{3, "http://www.opengis.net/doc/IS/SensorML/2.0"} )
List of supported EncodingTypes, do not change!!
var ( OMCategoryUnknown = ObservationType{0, ""} OMCategoryObservation = ObservationType{1, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CategoryObservation"} // IRI OMCountObservation = ObservationType{2, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CountObservation"} // integer OMMeasurement = ObservationType{3, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"} // double OMObservation = ObservationType{4, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Observation"} // any OMTruthObservation = ObservationType{5, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_TruthObservation"} // boolean )
List of supported ObservationTypes
var EncodingValues = []EncodingType{ EncodingUnknown, EncodingGeoJSON, EncodingPDF, EncodingSensorML, }
EncodingValues is a list of names mapped to their EncodingValue
var EntityTypeList = []EntityType{EntityTypeThing, EntityTypeLocation, EntityTypeHistoricalLocation, EntityTypeDatastream, EntityTypeSensor, EntityTypeObservedProperty, EntityTypeObservation, EntityTypeFeatureOfInterest, EntityTypeUnknown, EntityTypeCreateObservations, }
EntityTypeList is a list for all known entity types
var ObservationTypes = []ObservationType{ OMCategoryUnknown, OMCategoryObservation, OMCountObservation, OMMeasurement, OMObservation, OMTruthObservation}
ObservationTypes is a list of names mapped to their ObservationType Value
var StringEntityMap = map[string]EntityType{ "thing": EntityTypeThing, "things": EntityTypeThing, "location": EntityTypeLocation, "locations": EntityTypeLocation, "historicallocation": EntityTypeHistoricalLocation, "historicallocations": EntityTypeHistoricalLocation, "datastream": EntityTypeDatastream, "datastreams": EntityTypeDatastream, "sensor": EntityTypeSensor, "sensors": EntityTypeSensor, "observedproperty": EntityTypeObservedProperty, "observedproperties": EntityTypeObservedProperty, "observation": EntityTypeObservation, "observations": EntityTypeObservation, "featureofinterest": EntityTypeFeatureOfInterest, "featuresofinterest": EntityTypeFeatureOfInterest, }
StringEntityMap is a map of strings that map a string to an EntityType
Functions ¶
func CheckEncodingSupported ¶
CheckEncodingSupported returns true of the Location entity supports the given encoding type
func CheckMandatoryParam ¶
func CheckMandatoryParam(errorList *[]error, param interface{}, entityType EntityType, paramName string)
CheckMandatoryParam checks if the given parameter is nil, if true then an ApiError will be added to the given list of errors.
func CreateEntityLink ¶
func CreateEntityLink(isNil bool, externalURI string, entityType1 string, entityType2 string, id interface{}) string
CreateEntityLink formats the given parameters into a relative navigationlink path for example: http://example.org/OGCSensorThings/v1.0/Things(27815)/Datastreams
func CreateEntitySelfLink ¶
CreateEntitySelfLink formats the given parameters into an external navigationlink to the entity for example: http://example.org/OGCSensorThings/v1.0/Things(27815)
func GetSupportedEncodings ¶
func GetSupportedEncodings() string
GetSupportedEncodings returns a list of supported encodings
Types ¶
type ArrayResponse ¶
type ArrayResponse struct { Count int `json:"@iot.count,omitempty"` NextLink string `json:"@iot.nextLink,omitempty"` Data *interface{} `json:"value"` }
ArrayResponse is the default response format for sending content back used by the server
type ArrayResponseDatastreams ¶
type ArrayResponseDatastreams struct { ArrayResponse Data []*Datastream `json:"value"` }
ArrayResponseDatastreams can be used to parse an array response containing datastreams
type ArrayResponseEndpoint ¶
type ArrayResponseEndpoint struct { ArrayResponse Data []*Endpoint `json:"value"` }
ArrayResponseEndpoint can be used to parse an array response containing endpoint information
type ArrayResponseFeaturesOfInterest ¶
type ArrayResponseFeaturesOfInterest struct { ArrayResponse Data []*FeatureOfInterest `json:"value"` }
ArrayResponseFeaturesOfInterest can be used to parse an array response containing features of interest
type ArrayResponseHistoricalLocations ¶
type ArrayResponseHistoricalLocations struct { ArrayResponse Data []*HistoricalLocation `json:"value"` }
ArrayResponseHistoricalLocations can be used to parse an array response containing historical locations
type ArrayResponseLocations ¶
type ArrayResponseLocations struct { ArrayResponse Data []*Location `json:"value"` }
ArrayResponseLocations can be used to parse an array response containing locations
type ArrayResponseObservations ¶
type ArrayResponseObservations struct { ArrayResponse Data []*Observation `json:"value"` }
ArrayResponseObservations can be used to parse an array response containing observations
type ArrayResponseObservedProperty ¶
type ArrayResponseObservedProperty struct { ArrayResponse Data []*ObservedProperty `json:"value"` }
ArrayResponseObservedProperty can be used to parse an array response containing observed properties
type ArrayResponseSensors ¶
type ArrayResponseSensors struct { ArrayResponse Data []*Sensor `json:"value"` }
ArrayResponseSensors can be used to parse an array response containing sensors
type ArrayResponseThings ¶
type ArrayResponseThings struct { ArrayResponse Data []*Thing `json:"value"` }
ArrayResponseThings can be used to parse an array response containing things
type BaseEntity ¶
type BaseEntity struct { ID interface{} `json:"@iot.id,omitempty"` }
BaseEntity is the entry point for an entity
func (BaseEntity) ClearNav ¶
func (b BaseEntity) ClearNav()
func (*BaseEntity) ContainsMandatoryParams ¶
func (b *BaseEntity) ContainsMandatoryParams() (bool, []error)
ContainsMandatoryParams defined to implement Entity
func (*BaseEntity) GetEntityType ¶
func (b *BaseEntity) GetEntityType() EntityType
GetEntityType defined to implement Entity
func (*BaseEntity) GetID ¶
func (b *BaseEntity) GetID() interface{}
GetID return the ID of the entity
func (*BaseEntity) GetPropertyNames ¶
func (b *BaseEntity) GetPropertyNames() []string
GetPropertyNames returns the available properties of an entity
func (*BaseEntity) GetSelfLink ¶
func (b *BaseEntity) GetSelfLink() string
GetSelfLink returns the self link of the entity
func (*BaseEntity) GetSupportedEncoding ¶
func (b *BaseEntity) GetSupportedEncoding() map[int]EncodingType
GetSupportedEncoding defined to implement Entity
func (*BaseEntity) ParseEntity ¶
func (b *BaseEntity) ParseEntity(data []byte) error
ParseEntity defined to implement Entity
func (*BaseEntity) SetID ¶
func (b *BaseEntity) SetID(newID interface{})
SetID sets a newID on the entity
func (*BaseEntity) SetLinks ¶
func (b *BaseEntity) SetLinks(externalURL string) error
SetLinks defined to implement Entity
type CreateObservations ¶
type CreateObservations struct { BaseEntity Datastreams []*Datastream `json:"Observations,omitempty"` }
CreateObservations is used to POST multiple observations at once
func (*CreateObservations) ContainsMandatoryParams ¶
func (c *CreateObservations) ContainsMandatoryParams() (bool, []error)
ContainsMandatoryParams checks if all mandatory params for a Datastream are available before posting
func (CreateObservations) GetEntityType ¶
func (c CreateObservations) GetEntityType() EntityType
GetEntityType returns the EntityType for Datastream
func (*CreateObservations) ParseEntity ¶
func (c *CreateObservations) ParseEntity(data []byte) error
ParseEntity tries to parse the given json byte array into the current entity
func (*CreateObservations) SetAllLinks ¶
func (c *CreateObservations) SetAllLinks(externalURL string)
SetAllLinks sets the self link and relational links
func (*CreateObservations) SetLinks ¶
func (c *CreateObservations) SetLinks(externalURL string)
SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil
func (*CreateObservations) SetSelfLink ¶
func (c *CreateObservations) SetSelfLink(externalURL string)
SetSelfLink sets the self link for the entity
type Datastream ¶
type Datastream struct { BaseEntity Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` UnitOfMeasurement map[string]interface{} `json:"unitOfMeasurement,omitempty"` ObservationType string `json:"observationType,omitempty"` ObservedArea map[string]interface{} `json:"observedArea,omitempty"` Thing *Thing `json:"Thing,omitempty"` Sensor *Sensor `json:"Sensor,omitempty"` Observations []*Observation `json:"Observations,omitempty"` ObservedProperty *ObservedProperty `json:"ObservedProperty,omitempty"` PhenomenonTime string `json:"phenomenonTime,omitempty"` ResultTime string `json:"resultTime,omitempty"` }
Datastream in SensorThings represents a collection of Observations from a Sensor. A physical Sensor will send its data (Observations) to a single Datastream. A Datastream can have only one Sensor and that Sensor can only sense one ObservedProperty.
func (*Datastream) ClearNav ¶
func (d *Datastream) ClearNav()
func (*Datastream) ContainsMandatoryParams ¶
func (d *Datastream) ContainsMandatoryParams() (bool, []error)
ContainsMandatoryParams checks if all mandatory params for a Datastream are available before posting
func (Datastream) GetEntityType ¶
func (d Datastream) GetEntityType() EntityType
GetEntityType returns the EntityType for Datastream
func (*Datastream) GetPropertyNames ¶
func (d *Datastream) GetPropertyNames() []string
GetPropertyNames returns the available properties for a Datastream
func (Datastream) GetSupportedEncoding ¶
func (d Datastream) GetSupportedEncoding() map[int]EncodingType
GetSupportedEncoding returns the supported encoding tye for this entity
func (*Datastream) ParseEntity ¶
func (d *Datastream) ParseEntity(data []byte) error
ParseEntity tries to parse the given json byte array into the current entity
func (*Datastream) SetAllLinks ¶
func (d *Datastream) SetAllLinks(externalURL string)
SetAllLinks sets the self link and relational links
func (*Datastream) SetLinks ¶
func (d *Datastream) SetLinks(externalURL string)
SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil
func (*Datastream) SetSelfLink ¶
func (d *Datastream) SetSelfLink(externalURL string)
SetSelfLink sets the self link for the entity
type EncodingType ¶
EncodingType holds the information on a EncodingType
func CreateEncodingType ¶
func CreateEncodingType(encoding string) (EncodingType, error)
CreateEncodingType returns the int representation for a given encoding, returns an error when encoding is not supported
type Endpoint ¶
Endpoint describes the name and url of an SensorThings endpoint an array of endpoints is returned by the server by requesting the base path host/v1.0
type Entity ¶
type Entity interface { ParseEntity(data []byte) error ContainsMandatoryParams() (bool, []error) GetID() interface{} SetID(newID interface{}) SetAllLinks(externalURL string) SetSelfLink(externalURL string) SetLinks(externalURL string) GetSelfLink() string GetEntityType() EntityType GetPropertyNames() []string GetSupportedEncoding() map[int]EncodingType }
Entity is the base interface for all SensorThings entities.
func EntityFromString ¶
EntityFromString returns an empty entity based on a string, returns error if string cannot be mapped to an entity
func EntityFromType ¶
func EntityFromType(e EntityType) Entity
EntityFromType returns an empty entity belonging to the type returns nil if type cannot be mapped to an entity
type EntityLink ¶
type EntityLink string
EntityLink holds the name and type of a SensorThings entity link.
const ( EntityLinkThings EntityLink = "Things" EntityLinkLocations EntityLink = "Locations" EntityLinkHistoricalLocations EntityLink = "HistoricalLocations" EntityLinkDatastreams EntityLink = "Datastreams" EntityLinkSensors EntityLink = "Sensors" EntityLinkObservedProperties EntityLink = "ObservedProperties" EntityLinkObservations EntityLink = "Observations" EntityLinkFeatureOfInterests EntityLink = "FeaturesOfInterest" EntityLinkCreateObservations EntityLink = "CreateObservations" )
List of all EntityLinks.
func (EntityLink) ToString ¶
func (e EntityLink) ToString() string
ToString return the string representation of the EntityLink.
type EntityType ¶
type EntityType string
EntityType holds the name and type of a SensorThings entity.
const ( EntityTypeVersion EntityType = "Version" EntityTypeThing EntityType = "Thing" EntityTypeLocation EntityType = "Location" EntityTypeHistoricalLocation EntityType = "HistoricalLocation" EntityTypeDatastream EntityType = "Datastream" EntityTypeSensor EntityType = "Sensor" EntityTypeObservedProperty EntityType = "ObservedProperty" EntityTypeObservation EntityType = "Observation" EntityTypeFeatureOfInterest EntityType = "FeatureOfInterest" EntityTypeThingToLocation EntityType = "ThingToLocation" EntityTypeLocationToHistoricalLocation EntityType = "LocationToHistoricalLocation" EntityTypeCreateObservations EntityType = "CreateObservations" EntityTypeUnknown EntityType = "Unknown" )
List of all EntityTypes.
func EntityTypeFromString ¶
func EntityTypeFromString(e string) (EntityType, error)
EntityTypeFromString returns the EntityType for a given string function is case-insensitive
func (EntityType) GetArrayEndpoint ¶
func (e EntityType) GetArrayEndpoint() string
GetArrayEndpoint returns the (array) endpoint name for the current EntityType
func (EntityType) GetEndpoint ¶
func (e EntityType) GetEndpoint() string
GetEndpoint returns the single entity endpoint name
func (EntityType) ToString ¶
func (e EntityType) ToString() string
ToString return the string representation of the EntityType.
type FeatureOfInterest ¶
type FeatureOfInterest struct { BaseEntity Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` EncodingType string `json:"encodingType,omitempty"` Feature map[string]interface{} `json:"feature,omitempty"` Observations []*Observation `json:"Observations,omitempty"` OriginalLocationID interface{} `json:"-"` }
FeatureOfInterest in SensorThings represents the phenomena an Observation is detecting. In some cases a FeatureOfInterest can be the Location of the Sensor and therefore of the Observation. A FeatureOfInterest is linked to a single Observation
func (*FeatureOfInterest) ClearNav ¶
func (f *FeatureOfInterest) ClearNav()
func (*FeatureOfInterest) ContainsMandatoryParams ¶
func (f *FeatureOfInterest) ContainsMandatoryParams() (bool, []error)
ContainsMandatoryParams checks if all mandatory params for a FeatureOfInterest are available before posting
func (FeatureOfInterest) GetEntityType ¶
func (f FeatureOfInterest) GetEntityType() EntityType
GetEntityType returns the EntityType for FeatureOfInterest
func (*FeatureOfInterest) GetPropertyNames ¶
func (f *FeatureOfInterest) GetPropertyNames() []string
GetPropertyNames returns the available properties for a FeatureOfInterest
func (*FeatureOfInterest) ParseEntity ¶
func (f *FeatureOfInterest) ParseEntity(data []byte) error
ParseEntity tries to parse the given json byte array into the current entity
func (*FeatureOfInterest) SetAllLinks ¶
func (f *FeatureOfInterest) SetAllLinks(externalURL string)
SetAllLinks sets the self link and relational links
func (*FeatureOfInterest) SetLinks ¶
func (f *FeatureOfInterest) SetLinks(externalURL string)
SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil
func (*FeatureOfInterest) SetSelfLink ¶
func (f *FeatureOfInterest) SetSelfLink(externalURL string)
SetSelfLink sets the self link for the entity
type HistoricalLocation ¶
type HistoricalLocation struct { BaseEntity Time string `json:"time,omitempty"` Thing *Thing `json:"Thing,omitempty"` Locations []*Location `json:"Locations,omitempty"` }
HistoricalLocation in sensorthings represents the current and previous locations of a thing including time
func (*HistoricalLocation) ClearNav ¶
func (h *HistoricalLocation) ClearNav()
func (*HistoricalLocation) ContainsMandatoryParams ¶
func (h *HistoricalLocation) ContainsMandatoryParams() (bool, []error)
ContainsMandatoryParams checks if all mandatory params for a HistoricalLocation are available before posting
func (HistoricalLocation) GetEntityType ¶
func (h HistoricalLocation) GetEntityType() EntityType
GetEntityType returns the EntityType for HistoricalLocation
func (*HistoricalLocation) GetPropertyNames ¶
func (h *HistoricalLocation) GetPropertyNames() []string
GetPropertyNames returns the available properties for a HistoricalLocation
func (HistoricalLocation) GetSupportedEncoding ¶
func (h HistoricalLocation) GetSupportedEncoding() map[int]EncodingType
GetSupportedEncoding returns the supported encoding tye for this entity
func (*HistoricalLocation) ParseEntity ¶
func (h *HistoricalLocation) ParseEntity(data []byte) error
ParseEntity tries to parse the given json byte array into the current entity
func (*HistoricalLocation) SetAllLinks ¶
func (h *HistoricalLocation) SetAllLinks(externalURL string)
SetAllLinks sets the self link and relational links
func (*HistoricalLocation) SetLinks ¶
func (h *HistoricalLocation) SetLinks(externalURL string)
SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil
func (*HistoricalLocation) SetSelfLink ¶
func (h *HistoricalLocation) SetSelfLink(externalURL string)
SetSelfLink sets the self link for the entity
type Location ¶
type Location struct { BaseEntity Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` EncodingType string `json:"encodingType,omitempty"` Location map[string]interface{} `json:"location,omitempty"` Things []*Thing `json:"Things,omitempty"` HistoricalLocations []*HistoricalLocation `json:"HistoricalLocations,omitempty"` }
Location entity locates the Thing or the Things it associated with. A Thing’s Location entity is defined as the last known location of the Thing. A Thing’s Location may be identical to the Thing’s Observations’ FeatureOfInterest. In the context of the IoT, the principle location of interest is usually associated with the location of the Thing, especially for in-situ sensing applications. For example, the location of interest of a wifi-connected thermostat should be the building or the room in which the smart thermostat is located. And the FeatureOfInterest of the Observations made by the thermostat (e.g., room temperature readings) should also be the building or the room. In this case, the content of the smart thermostat’s location should be the same as the content of the temperature readings’ feature of interest.
func (*Location) ContainsMandatoryParams ¶
ContainsMandatoryParams checks if all mandatory params for Location are available before posting.
func (Location) GetEntityType ¶
func (l Location) GetEntityType() EntityType
GetEntityType returns the EntityType for Location
func (*Location) GetPropertyNames ¶
GetPropertyNames returns the available properties for a Location
func (*Location) ParseEntity ¶
ParseEntity tries to parse the given json byte array into the current entity
func (*Location) SetAllLinks ¶
SetAllLinks sets the self link and relational links
func (*Location) SetLinks ¶
SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil
func (*Location) SetSelfLink ¶
SetSelfLink sets the self link for the entity
type Observation ¶
type Observation struct { BaseEntity PhenomenonTime string `json:"phenomenonTime,omitempty"` Result json.RawMessage `json:"result,omitempty"` ResultTime *string `json:"resultTime,omitempty"` ResultQuality string `json:"resultQuality,omitempty"` ValidTime string `json:"validTime,omitempty"` Parameters map[string]interface{} `json:"parameters,omitempty"` Datastream *Datastream `json:"Datastream,omitempty"` FeatureOfInterest *FeatureOfInterest `json:"FeatureOfInterest,omitempty"` }
Observation in SensorThings represents a single Sensor reading of an ObservedProperty. A physical device, a Sensor, sends Observations to a specified Datastream. An Observation requires a FeatureOfInterest entity, if none is provided in the request, the Location of the Thing associated with the Datastream, will be assigned to the new Observation as the FeaturOfInterest.
func (*Observation) ClearNav ¶
func (o *Observation) ClearNav()
func (*Observation) ContainsMandatoryParams ¶
func (o *Observation) ContainsMandatoryParams() (bool, []error)
ContainsMandatoryParams checks if all mandatory params for Observation are available before posting.
func (Observation) GetEntityType ¶
func (o Observation) GetEntityType() EntityType
GetEntityType returns the EntityType for Observation
func (*Observation) GetPropertyNames ¶
func (o *Observation) GetPropertyNames() []string
GetPropertyNames returns the available properties for an Observation
func (Observation) GetSupportedEncoding ¶
func (o Observation) GetSupportedEncoding() map[int]EncodingType
GetSupportedEncoding returns the supported encoding tye for this entity
func (*Observation) MarshalJSON ¶
func (o *Observation) MarshalJSON() ([]byte, error)
MarshalJSON marshalls the observation into a JSON byte array
func (Observation) MarshalPostgresJSON ¶
func (o Observation) MarshalPostgresJSON() ([]byte, error)
MarshalPostgresJSON marshalls an observation entity for saving into PostgreSQL
func (*Observation) ParseEntity ¶
func (o *Observation) ParseEntity(data []byte) error
ParseEntity tries to parse the given json byte array into the current entity
func (*Observation) SetAllLinks ¶
func (o *Observation) SetAllLinks(externalURL string)
SetAllLinks sets the self link and relational links
func (*Observation) SetLinks ¶
func (o *Observation) SetLinks(externalURL string)
SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil
func (*Observation) SetSelfLink ¶
func (o *Observation) SetSelfLink(externalURL string)
SetSelfLink sets the self link for the entity
type ObservationType ¶
ObservationType holds the information on a ObservationType
func GetObservationTypeByID ¶
func GetObservationTypeByID(observationType int64) (ObservationType, error)
GetObservationTypeByID Get the observationType based on value, returns error
func GetObservationTypeByValue ¶
func GetObservationTypeByValue(observationType string) (ObservationType, error)
GetObservationTypeByValue Get the observationType based on value, returns error
type ObservedProperty ¶
type ObservedProperty struct { BaseEntity Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Definition string `json:"definition,omitempty"` Datastreams []*Datastream `json:"Datastreams,omitempty"` }
ObservedProperty in SensorThings represents the physical phenomenon being observed by the Sensor. An ObserveProperty is linked to a Datastream which can only have one ObserveProperty
func (*ObservedProperty) ClearNav ¶
func (o *ObservedProperty) ClearNav()
func (*ObservedProperty) ContainsMandatoryParams ¶
func (o *ObservedProperty) ContainsMandatoryParams() (bool, []error)
ContainsMandatoryParams checks if all mandatory params for ObservedProperty are available before posting.
func (ObservedProperty) GetEntityType ¶
func (o ObservedProperty) GetEntityType() EntityType
GetEntityType returns the EntityType for ObservedProperty
func (*ObservedProperty) GetPropertyNames ¶
func (o *ObservedProperty) GetPropertyNames() []string
GetPropertyNames returns the available properties for a ObservedProperty
func (ObservedProperty) GetSupportedEncoding ¶
func (o ObservedProperty) GetSupportedEncoding() map[int]EncodingType
GetSupportedEncoding returns the supported encoding tye for this entity
func (*ObservedProperty) ParseEntity ¶
func (o *ObservedProperty) ParseEntity(data []byte) error
ParseEntity tries to parse the given json byte array into the current entity
func (*ObservedProperty) SetAllLinks ¶
func (o *ObservedProperty) SetAllLinks(externalURL string)
SetAllLinks sets the self link and relational links
func (*ObservedProperty) SetLinks ¶
func (o *ObservedProperty) SetLinks(externalURL string)
SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil
func (*ObservedProperty) SetSelfLink ¶
func (o *ObservedProperty) SetSelfLink(externalURL string)
SetSelfLink sets the self link for the entity
type RawCreateObservations ¶
type RawCreateObservations struct { Datastream *Datastream `json:"Datastream,omitempty"` Components []string `json:"components,omitempty"` Count int64 `json:"dataArray@iot.count,omitempty"` Data [][]json.RawMessage `json:"dataArray,omitempty"` }
RawCreateObservations is used to POST multiple observations at once
type Sensor ¶
type Sensor struct { BaseEntity Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` EncodingType string `json:"encodingType,omitempty"` Metadata string `json:"metadata,omitempty"` Datastreams []*Datastream `json:"Datastreams,omitempty"` }
Sensor in SensorThings represents the physical device capable of observing a physical property and converting it to an electrical impulse and be converted to a empirical value to represent a measurement value of the physical property
func (*Sensor) ContainsMandatoryParams ¶
ContainsMandatoryParams checks if all mandatory params for Sensor are available before posting.
func (Sensor) GetEntityType ¶
func (s Sensor) GetEntityType() EntityType
GetEntityType returns the EntityType for Sensor
func (*Sensor) GetPropertyNames ¶
GetPropertyNames returns the available properties for a Sensor
func (*Sensor) ParseEntity ¶
ParseEntity tries to parse the given json byte array into the current entity
func (*Sensor) SetAllLinks ¶
SetAllLinks sets the self link and relational links
func (*Sensor) SetLinks ¶
SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil
func (*Sensor) SetSelfLink ¶
SetSelfLink sets the self link for the entity
type Thing ¶
type Thing struct { BaseEntity Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Properties map[string]interface{} `json:"properties,omitempty"` Locations []*Location `json:"Locations,omitempty"` Datastreams []*Datastream `json:"Datastreams,omitempty"` HistoricalLocations []*HistoricalLocation `json:"HistoricalLocations,omitempty"` }
Thing in SensorThings represents a physical object in the real world. A Thing is a good starting point in which to start creating the SensorThings model structure. A Thing has a Location and one or more Datastreams to collect Observations. A minimal Thing can be created without a Location and Datastream and there are options to create a Things with a nested linked Location and Datastream.
func (*Thing) ContainsMandatoryParams ¶
ContainsMandatoryParams checks if all mandatory params for Thing are available before posting.
func (Thing) GetEntityType ¶
func (t Thing) GetEntityType() EntityType
GetEntityType returns the EntityType for Thing
func (*Thing) GetPropertyNames ¶
GetPropertyNames returns the available properties for a Thing
func (Thing) GetSupportedEncoding ¶
func (t Thing) GetSupportedEncoding() map[int]EncodingType
GetSupportedEncoding returns the supported encoding tye for this entity
func (*Thing) ParseEntity ¶
ParseEntity tries to parse the given json byte array into the current entity
func (*Thing) SetAllLinks ¶
SetAllLinks sets the self link and relational links
func (*Thing) SetLinks ¶
SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil
func (*Thing) SetSelfLink ¶
SetSelfLink sets the self link for the entity