| Safe Haskell | None |
|---|
Database.InfluxDB.Decode
- class FromSeries a where
- parseSeries :: Series -> Parser a
- fromSeries :: FromSeries a => Series -> Either String a
- class FromSeriesData a where
- fromSeriesData :: FromSeriesData a => SeriesData -> Either String [a]
- withValues :: (Vector Value -> ValueParser a) -> Vector Column -> Vector Value -> Parser a
- (.:) :: FromValue a => Vector Value -> Column -> ValueParser a
- class FromValue a where
- parseValue :: Value -> Parser a
- fromValue :: FromValue a => Value -> Either String a
- data Parser a
- data ValueParser a
- typeMismatch :: String -> Value -> Parser a
Documentation
class FromSeries a whereSource
A type that can be converted from a Series.
Methods
parseSeries :: Series -> Parser aSource
Instances
fromSeries :: FromSeries a => Series -> Either String aSource
Converte a value from a Series, failing if the types do not match.
class FromSeriesData a whereSource
A type that can be converted from a SeriesData. A typical implementation
is as follows.
import Control.Applicative ((<$>), (<*>))
import qualified Data.Vector as V
data Event = Event Text EventType
data EventType = Login | Logout
instance FromSeriesData where
parseSeriesData = withValues $ values -> Event
<$> values .: "user"
<*> values .: "type"
instance FromValue EventType
Instances
fromSeriesData :: FromSeriesData a => SeriesData -> Either String [a]Source
Converte a value from a SeriesData, failing if the types do not match.
withValues :: (Vector Value -> ValueParser a) -> Vector Column -> Vector Value -> Parser aSource
A type that can be converted from a Value.
Methods
parseValue :: Value -> Parser aSource
fromValue :: FromValue a => Value -> Either String aSource
Converte a value from a Value, failing if the types do not match.
data ValueParser a Source
Instances
typeMismatch :: String -> Value -> Parser aSource