Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- write :: Timestamp time => WriteParams -> Line time -> IO ()
- writeBatch :: (Timestamp time, Foldable f) => WriteParams -> f (Line time) -> IO ()
- writeByteString :: WriteParams -> ByteString -> IO ()
- data WriteParams
- writeParams :: Database -> WriteParams
- server :: HasServer a => Lens' a Server
- database :: HasDatabase a => Lens' a Database
- retentionPolicy :: Lens' WriteParams (Maybe Key)
- precision :: HasPrecision ty a => Lens' a (Precision ty)
- manager :: HasManager a => Lens' a (Either ManagerSettings Manager)
Writers
The code snippets in this module assume the following imports.
import qualified Data.Map as Map import Data.Time
write :: Timestamp time => WriteParams -> Line time -> IO () Source #
Write a Line
.
>>>
let p = writeParams "test-db"
>>>
write p $ Line @UTCTime "room_temp" Map.empty (Map.fromList [("temp", FieldFloat 25.0)]) Nothing
writeBatch :: (Timestamp time, Foldable f) => WriteParams -> f (Line time) -> IO () Source #
Write multiple Line
s in a batch.
This is more efficient than calling write
multiple times.
>>>
let p = writeParams "test-db"
>>>
:{
writeBatch p [ Line @UTCTime "temp" (Map.singleton "city" "tokyo") (Map.fromList [("temp", FieldFloat 25.0)]) Nothing , Line @UTCTime "temp" (Map.singleton "city" "osaka") (Map.fromList [("temp", FieldFloat 25.2)]) Nothing ] :}
writeByteString :: WriteParams -> ByteString -> IO () Source #
Write a raw ByteString
Writer parameters
data WriteParams Source #
The full set of parameters for the HTTP writer.
Following lenses are available to access its fields:
Instances
HasCredentials WriteParams Source # | Authentication info for the write
|
Defined in Database.InfluxDB.Write | |
HasManager WriteParams Source # |
|
Defined in Database.InfluxDB.Write | |
HasDatabase WriteParams Source # |
|
Defined in Database.InfluxDB.Write | |
HasServer WriteParams Source # |
|
Defined in Database.InfluxDB.Write | |
HasPrecision WriteRequest WriteParams Source # |
|
Defined in Database.InfluxDB.Write |
writeParams :: Database -> WriteParams Source #
Smart constructor for WriteParams
Default parameters:
server :: HasServer a => Lens' a Server Source #
InfluxDB server address and port that to interact with.
retentionPolicy :: Lens' WriteParams (Maybe Key) Source #
Target retention policy for the write.
InfluxDB writes to the default
retention policy if this parameter is set
to Nothing
.
>>>
let p = writeParams "foo" & retentionPolicy .~ Just "two_hours"
>>>
p ^. retentionPolicy
Just "two_hours"
manager :: HasManager a => Lens' a (Either ManagerSettings Manager) Source #
HTTP manager settings or a manager itself.
If it's set to ManagerSettings
, the library will create a Manager
from
the settings for you.