Safe Haskell | None |
---|
- class ToSeries a where
- class ToSeriesData a where
- toSeriesColumns :: Proxy a -> Vector Column
- toSeriesPoints :: a -> Vector Value
- toSeriesData :: forall a. ToSeriesData a => a -> SeriesData
- class ToValue a where
Documentation
class ToSeriesData a whereSource
A type that can be converted to a SeriesData
. A typical implementation is
as follows.
import qualified Data.Vector as V data Event = Event Text EventType data EventType = Login | Logout instance ToSeriesData Event where toSeriesColumn _ = V.fromList ["user", "type"] toSeriesPoints (Event user ty) = V.fromList [toValue user, toValue ty] instance ToValue EventType
toSeriesColumns :: Proxy a -> Vector ColumnSource
Column names. You can safely ignore the proxy agument.
toSeriesPoints :: a -> Vector ValueSource
Data points.
toSeriesData :: forall a. ToSeriesData a => a -> SeriesDataSource
A type that can be stored in InfluxDB.