Documentation
¶
Overview ¶
Package views define views for Clarify resources.
Index ¶
- type CreateSummary
- type DataFrame
- type DataFrameInclude
- type DataSeries
- type Identifier
- type Item
- type ItemAttributes
- type ItemInclude
- type ItemRelationships
- type ItemSave
- type ItemSaveAttributes
- type Meta
- type MetaSave
- type Normalizer
- type NullIdentifier
- type Resource
- type SaveSummary
- type Selection
- type SelectionFormat
- type SelectionMeta
- type Signal
- type SignalAttributes
- type SignalInclude
- type SignalReadOnlyAttributes
- type SignalRelationships
- type SignalSave
- type SignalSaveAttributes
- type SourceType
- type ToMany
- type ToOne
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateSummary ¶ added in v0.3.0
CreateSummary holds the identity of a resource, and describes weather it was created due to your operation.
type DataFrame ¶
type DataFrame map[string]DataSeries
DataFrame provides JSON encoding and decoding for a map of series identified by a series key.
func (DataFrame) MarshalJSON ¶
func (DataFrame) Timestamps ¶ added in v0.3.0
Timestamps returns an ordered set of all timestamps in the data-frame where there is at least one non-empty (not NaN) value.
func (*DataFrame) UnmarshalJSON ¶
type DataFrameInclude ¶ added in v0.3.0
type DataFrameInclude struct {
Items []Item
}
type DataSeries ¶
DataSeries contain a map of timestamps in micro seconds since the epoch to a floating point value.
func (DataSeries) Timestamps ¶ added in v0.3.0
func (s DataSeries) Timestamps() []fields.Timestamp
Timestamps returns an ordered set of all timestamps in the data-series where there is at least one NaN value.
type Identifier ¶ added in v0.3.0
Identifier uniquely identifies a resource entry.
type Item ¶
type Item = Resource[ItemAttributes, ItemRelationships]
Item describe the select view for an item.
type ItemAttributes ¶
type ItemAttributes struct {
ItemSaveAttributes
}
ItemAttributes contains attributes for the item select view.
type ItemInclude ¶
type ItemInclude struct{}
type ItemRelationships ¶
type ItemRelationships struct {
CreatedBy ToOne `json:"createdBy"`
UpdatedBy ToOne `json:"updatedBy"`
Organization ToOne `json:"organization"`
}
ItemRelationships describe the item relationships that's exposed by the API.
type ItemSave ¶
type ItemSave struct {
ItemSaveAttributes
MetaSave
}
ItemSave describe the save view for an item.
func PublishedItem ¶
PublishedItem constructs a view for an item based on the passed in signal, including a set of base annotations referring the item back to the signal it was generated from. The passed in transforms, if any, are run in order.
type ItemSaveAttributes ¶
type ItemSaveAttributes struct {
Name string `json:"name"`
Description string `json:"description"`
ValueType ValueType `json:"valueType"`
SourceType SourceType `json:"sourceType"`
EngUnit string `json:"engUnit"`
SampleInterval fields.FixedDurationNullZero `json:"sampleInterval"`
GapDetection fields.FixedDurationNullZero `json:"gapDetection"`
Labels fields.Labels `json:"labels"`
EnumValues fields.EnumValues `json:"enumValues"`
Visible bool `json:"visible"`
}
ItemSaveAttributes contains attributes that are part of the item save view.
type Meta ¶ added in v0.3.0
type Meta struct {
Annotations fields.Annotations `json:"annotations,omitempty"`
AttributesHash fields.Hexadecimal `json:"attributesHash,omitempty"`
RelationshipsHash fields.Hexadecimal `json:"relationshipsHash,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Meta holds the meta data fields for a resource entry select view.
type MetaSave ¶ added in v0.2.0
type MetaSave struct {
Annotations fields.Annotations `json:"annotations,omitempty"`
}
MetaSave holds the mutable meta fields for a resource entry.
type Normalizer ¶ added in v0.3.0
type Normalizer interface {
Normalize()
}
Normalizer describes a type that should be normalized before encoding.
type NullIdentifier ¶ added in v0.3.0
type NullIdentifier Identifier
NullIdentifier is a version of Identifier where the zero-value is encoded as null in JSON.
func (NullIdentifier) MarshalJSON ¶ added in v0.3.0
func (id NullIdentifier) MarshalJSON() ([]byte, error)
func (*NullIdentifier) UnmarshalJSON ¶ added in v0.3.0
func (id *NullIdentifier) UnmarshalJSON(data []byte) error
type Resource ¶ added in v0.3.0
type Resource[A, R any] struct { Identifier Meta Meta `json:"meta"` Attributes A `json:"attributes"` Relationships R `json:"relationships"` }
Resource describes a generic resource entry select view.
func (Resource[A, R]) MarshalJSON ¶ added in v0.3.0
type SaveSummary ¶ added in v0.3.0
type SaveSummary struct {
ID string `json:"id"`
Created bool `json:"created"`
Updated bool `json:"updated"`
}
SaveSummary holds the identity of a resource, and describes weather it was updated or created due to your operation.
type Selection ¶ added in v0.3.0
type Selection[D, I any] struct { Meta SelectionMeta `json:"meta"` Data D `json:"data"` Included I `json:"included"` }
Selection holds resource selection results.
type SelectionFormat ¶ added in v0.3.0
type SelectionFormat struct {
DataAsArray bool `json:"dataAsArray"`
GroupIncludedByType bool `json:"groupIncludedByType"`
}
SelectionFormat contains configuration for how a resource selection is formatted.
type SelectionMeta ¶ added in v0.3.0
type SelectionMeta struct {
Total int `json:"total"`
Format SelectionFormat `json:"format"`
}
SelectionMeta contains top-level meta information about a resource selection.
type Signal ¶
type Signal = Resource[SignalAttributes, SignalRelationships]
Signal describe the select view for a signal.
type SignalAttributes ¶
type SignalAttributes struct {
SignalSaveAttributes
SignalReadOnlyAttributes
}
SignalAttributes contains attributes for the signal select view.
type SignalInclude ¶
type SignalInclude struct {
Items []Item `json:"items"`
}
type SignalReadOnlyAttributes ¶
type SignalReadOnlyAttributes struct {
Input string `json:"input"`
}
SignalReadOnlyAttributes contains read-only signal attributes.
type SignalRelationships ¶
SignalRelationships declare the available relationships for the signal model.
type SignalSave ¶
type SignalSave struct {
MetaSave
SignalSaveAttributes
}
SignalSave describe the save view for a signal.
type SignalSaveAttributes ¶
type SignalSaveAttributes struct {
Name string `json:"name"`
Description string `json:"description"`
ValueType ValueType `json:"valueType"`
SourceType SourceType `json:"sourceType"`
EngUnit string `json:"engUnit"`
SampleInterval fields.FixedDurationNullZero `json:"sampleInterval"`
GapDetection fields.FixedDurationNullZero `json:"gapDetection"`
Labels fields.Labels `json:"labels"`
EnumValues fields.EnumValues `json:"enumValues"`
}
SignalSaveAttributes contains attributes that are part of the signal save view.
type SourceType ¶
type SourceType string
SourceType describe how data values where produced.
const ( // Measurement indicates that values are retrieved "directly" from a sensor. Measurement SourceType = "measurement" // Aggregation indicates that values are aggregated from one or more // sources. Aggregation SourceType = "aggregation" // Prediction indicates that values are predictions or forecasts. Prediction SourceType = "prediction" )
Allowed signal/item source types.
type ToMany ¶ added in v0.3.0
type ToMany struct {
Meta map[string]json.RawMessage `json:"meta,omitempty"`
Data []Identifier `json:"data"`
}
ToMany describes a to-many relationship entry.
type ToOne ¶ added in v0.3.0
type ToOne struct {
Meta map[string]json.RawMessage `json:"meta,omitempty"`
Data NullIdentifier `json:"data"`
}
ToOne describes a to-one relationship entry.