Safe Haskell | None |
---|---|
Language | Haskell2010 |
Database.InfluxDB.Encode
- 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
A type that can be converted to a Series
.
class ToSeriesData a where Source
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
Methods
toSeriesColumns :: Proxy a -> Vector Column Source
Column names. You can safely ignore the proxy agument.
toSeriesPoints :: a -> Vector Value Source
Data points.
toSeriesData :: forall a. ToSeriesData a => a -> SeriesData Source
A type that can be stored in InfluxDB.