G      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None%&,/059;<=?DI[&An InfluxDB query.&A spec of the format is available at  >https://docs.influxdata.com/influxdb/v1.2/query_language/spec/.A  can be constructed using eitherthe  instance with -XOverloadedStringsor  .:set -XOverloadedStrings"SELECT * FROM series" :: Query"SELECT * FROM series".import qualified Database.InfluxDB.Format as F-formatQuery ("SELECT * FROM "%F.key) "series""SELECT * FROM \"series\""JNOTE: Currently this library doesn't support type-safe query construction.Default server settings.Default parameters::  "localhost": 8086: User credentialsHost name of the serverPort number of the serverIf SSL is enabledDUser name and password to be used when sending requests to InfluxDB.*HTTP manager settings or a manager itself.If it's set to , the library will create a  from the settings for you.Time precision parameter.Database name to work on. 7InfluxDB server address and port that to interact with.! Exceptions used in this library.sIn general, the library tries to convert exceptions from the dependent libraries to the following types of errors."Server side error.[You can expect to get a successful response once the issue is resolved on the server side.#Client side error.8You need to fix your query to get a successful response.$%Received an unexpected response. The  field is a message and the , field is a possibly-empty relevant payload.This can happen e.g. when the response from InfluxDB is incompatible with what this library expects due to an upstream format change etc.%HTTP communication error.1Typical HTTP errors (4xx and 5xx) are covered by # and "D. So this exception means something unusual happened. Note that if  is overridden to throw an E on an unsuccessful HTTP code, this exception is thrown instead of # or ".&A &m is something that can be converted to a valid InfluxDB timestamp, which is represented as a 64-bit integer.'?Round a time to the given precision and scale it to nanoseconds(#Scale a time to the given precision)!Predefined set of time precision.0 is only available for 2s.*POSIX time in ns+POSIX time in s,POSIX time in ms-POSIX time in s.POSIX time in minutes/POSIX time in hours0<Nanosecond precision time in a human readable format, like 2016-01-04T00:00:23.135623Z!. This is the default format for /query.1Type of a request2 Request for /query3 Request for /write:PField type for the line protocol. The line protocol doesn't accept null values.;8Field type for queries. Queries can contain null values.?CString type that is used for measurements, tag keys and field keys.  can be used to construct a ?.ADatabase name.  can be used to construct a A.DPassword to access InfluxDBEUser name to access InfluxDB.)let creds = credentials "john" "passw0rd" creds ^. user"john"GName of the time precision.precisionName Nanosecond"n"IScale of the type precision.precisionScale RFC33391.0e-9precisionScale Microsecond1.0e-6L User namePassword !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQC !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHILEDABC?@QPFON<=>;:456789M123)*+,-./0G&'(HILK!"#$%J & !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQNone!" [+The full set of parameters for the ping APIHTTP connection managerTimeout\Smart constructor for [Default parameters:  ]Response of a ping requestRound-trip time of the ping#Version string returned by InfluxDB^9The number of seconds to wait before returning a responsepingParams ^. timeoutNothing!let p = pingParams & timeout ?~ 1_>let p = pingParams & manager .~ Left HC.defaultManagerSettings`pingParams ^. server.host "localhost"d#Version string returned by InfluxDBeRound-trip time of the pingfSend a ping to InfluxDB.It may throw an !.[\]^_`def  [\]^def f[\ ^]ed [\]^_`defNone !"DT[ g!Placeholder for the Line ProtocolSee  Qhttps://docs.influxdata.com/influxdb/v1.2/write_protocols/line_protocol_tutorial/ for the concrete syntax.Measurement nameSet of tags (optional) Set of fieldsIt shouldn't be empty.Timestamp (optional)muField(s) for your data point. Every data point requires at least one field in the Line Protocol, so it shouldn't be empty.n<Name of the measurement that you want to write your data to.oqTag(s) that you want to include with your data point. Tags are optional in the Line Protocol, so you can set it empty.pbTimestamp for your data point. You can put whatever type of timestamp that is an instance of the & class.ghijklmnop ghijklmnop ghnompklij ghijklmnopNone!"#,<=q.The full set of parameters for the UDP writer.rSmart constructor for qDefault parameters: *sWrite a gtWrite g s in a batchThis is more efficient than s.u Write a raw vUDP endopoint of the databasewOpen UDP socketxTimestamp precision.In the UDP API, all timestamps are sent in nanosecond but you can specify lower precision. The writer just rounds timestamps to the specified precision. qrstuvwxqrstuvwstuqrwv qrstuvwxNone !"$%&9;ATyDecoder settings{_How to turn a parser for each element into another. For example, a failure can be turned into .|"How to aggregate all results from { into a vector of results.}/A helper function to parse a JSON response in .~6Parse a JSON response with specified decoder settings..Fail immediately if there's any parse failure.4Ignore parse failures and return successful results.$Get a field value from a column nameGet a tag value from a tag nameParse a result response.Parse a series response.8Parse the common JSON structure used in query responses.9Parse the common JSON structure used in failure response.AParse either a POSIX timestamp or RFC3339 formatted timestamp as .BParse either a POSIX timestamp or RFC3339 formatted timestamp as .$Parse a RFC3339-formatted timestamp./Note that this parser is slow as it converts a  input to a  before parsing.Parse a ;.yz{|}A parser that takes an optional name of the series a map of tagsan array of field namesan array of valuesto construct a value.~A parser that takes an optional name of the series a map of tagsan array of field namesan array of valuesto construct a value. Column nameColumns Field valuesTag nameTagsyz|{}~}~yz{|yz{|}~None !"#$,<=T/The full set of parameters for the HTTP writer.Database to be written5 means the default retention policy for the database.Timestamp precision>In the HTTP API, timestamps are scaled by the given precision.No authentication by defaultHTTP connection managerSmart constructor for Default parameters: * Write a g.let p = writeParams "test-db"jwrite p $ Line "room_temp" Map.empty (Map.fromList [("temp", FieldFloat 25.0)]) (Nothing :: Maybe UTCTime)Write multiple g s in a batch.$This is more efficient than calling  multiple times.let p = writeParams "test-db":{ writeBatch pt [ Line "temp" (Map.singleton "city" "tokyo") (Map.fromList [("temp", FieldFloat 25.0)]) (Nothing :: Maybe UTCTime)t , Line "temp" (Map.singleton "city" "osaka") (Map.fromList [("temp", FieldFloat 25.2)]) (Nothing :: Maybe UTCTime) ]:} Write a raw &Target retention policy for the write.InfluxDB writes to the default/ retention policy if this parameter is set to .?let p = writeParams "foo" & retentionPolicy .~ Just "two_hours"p ^. retentionPolicyJust "two_hours"!Authentication info for the writelet p = writeParams "foo"p ^. authenticationNothing<let p' = p & authentication ?~ credentials "john" "passw0rd"&p' ^. authentication . traverse . user"john"Elet p = writeParams "foo" & manager .~ Left HC.defaultManagerSettingslet p = writeParams "foo"p ^. precision Nanosecondlet p = writeParams "foo" p ^. database"foo"let p = writeParams "foo"p ^. server.host "localhost"  None%&[A typed format string.  Format a r means that a' is the type of formatted string, and r is the type of the formatter.:t formatQuery"formatQuery :: Format Query r -> r:t keykey :: Format r (Key -> r):t "SELECT * FROM "%key+"SELECT * FROM "%key :: Format a (Key -> a)%:t formatQuery ("SELECT * FROM "%key)2formatQuery ("SELECT * FROM "%key) :: Key -> Query+formatQuery ("SELECT * FROM "%key) "series""SELECT * FROM \"series\"" Serialize a  to a . specific synonym of ().%This is typically easier to use than ()& is because it doesn't conflict with  Prelude.(.). Format a ."formatQuery "SELECT * FROM series""SELECT * FROM series"+formatQuery ("SELECT * FROM "%key) "series""SELECT * FROM \"series\"" Format a A.formatDatabase "test-db" "test-db" Format a ?.formatKey "test-key" "test-key"0Convenience function to make a custom formatter.Format a database name.3formatQuery ("CREATE DATABASE "%database) "test-db""CREATE DATABASE \"test-db\""2Format a key (e.g. series names, field names etc).0formatQuery ("SELECT * FROM "%key) "test-series""SELECT * FROM \"test-series\""Format multiple keys.@formatQuery ("SELECT "%keys%" FROM series") ["field1", "field2"]*"SELECT \"field1\",\"field2\" FROM series"Format ;.NformatQuery ("SELECT * FROM series WHERE "%key%" = "%field) "location" "tokyo"3"SELECT * FROM series WHERE \"location\" = 'tokyo'"Format a decimal number.HformatQuery ("SELECT * FROM series WHERE time < now() - "%decimal%"h") 1."SELECT * FROM series WHERE time < now() - 1h"Format a floating-point number.AformatQuery ("SELECT * FROM series WHERE value > "%realFloat) 0.1("SELECT * FROM series WHERE value > 0.1"Format a text..Note that this doesn't escape the string. Use fieldKey$ to format field values in a query.:t formatKey textformatKey text :: T.Text -> KeyFormat a string..Note that this doesn't escape the string. Use fieldKey$ to format field values in a query.:t formatKey string!formatKey string :: String -> Key#Format a UTF-8 encoded byte string..Note that this doesn't escape the string. Use fieldKey$ to format field values in a query.:t formatKey byteString8,formatKey byteString8 :: B.ByteString -> KeyFormat a time.import Data.TimeIlet Just t = parseTimeM False defaultTimeLocale "%s" "0" :: Maybe UTCTime:formatQuery ("SELECT * FROM series WHERE time >= "%time) t:"SELECT * FROM series WHERE time >= '1970-01-01 00:00:00'"SWith the OverloadedStrings exension, string literals can be used to write queries."SELECT * FROM series" :: Query"SELECT * FROM series"s can be composed using () from Control.Category.import Control.Category ((.))import Prelude hiding ((.))-formatQuery ("SELECT * FROM " . key) "series""SELECT * FROM \"series\""None!"$%&,9;<=I[,The full set of parameters for the query APITimestamp precision;InfluxDB uses nanosecond precision if nothing is specified.No authentication by defaultHTTP connection managerETypes that can be converted from an JSON object returned by InfluxDB.For example the h2o_feet series in  Jhttps://docs.influxdata.com/influxdb/v1.2/query_language/data_exploration/the official document can be encoded as follows::{data H2OFeet = H2OFeet { time :: UTCTime , levelDesc :: T.Text , location :: T.Text , waterLevel :: Double }#instance QueryResults H2OFeet whereB parseResults prec = parseResultsWith $ \_ _ columns fields -> do@ time <- getField "time" columns fields >>= parseUTCTime precC String levelDesc <- getField "level_description" columns fields9 String location <- getField "location" columns fields FieldFloat waterLevel <-? getField "water_level" columns fields >>= parseQueryField return H2OFeet {..}:};Parse a JSON object as an array of values of expected type.Smart constructor for Default parameters: 0 Query data from InfluxDB. It may throw !.Same as  but it instructs InfluxDB to stream chunked responses rather than returning a huge JSON object. This can be lot more efficient than  if the result is huge. It may throw !.!Authentication info for the querylet p = queryParams "foo"p ^. authenticationNothing<let p' = p & authentication ?~ credentials "john" "passw0rd""p' ^. authentication.traverse.user"john"Elet p = queryParams "foo" & manager .~ Left HC.defaultManagerSettingsOReturning JSON responses contain timestamps in the specified precision/format.let p = queryParams "foo"p ^. precisionRFC3339let p = queryParams "foo" p ^. database"foo"let p = queryParams "foo"p ^. server.host "localhost"# Chunk sizeBy i, InfluxDB chunks responses by series or by every 10,000 points, whichever occurs first. If it set to a I value, InfluxDB chunks responses by series or by that number of points. Chunk sizeBy 9, InfluxDB returns all matching data points at once. By  i, InfluxDB chunks responses by series or by every 10,000 points, whichever occurs first. If it set to a I value, InfluxDB chunks responses by series or by that number of points.       }  }      None !"$TNv <- query (queryParams "_internal") "SHOW QUERIES" :: IO (V.Vector ShowQuery)-Send a database management query to InfluxDB.let db = "manage-test"let p = queryParams db;manage p $ F.formatQuery ("CREATE DATABASE "%F.database) dbDuration of the query q> v <- query (queryParams "_internal") "SHOW QUERIES" :: IO (V.Vector ShowQuery) > v ^.. each.duration [0.06062s]Query ID j> v <- query (queryParams "_internal") "SHOW QUERIES" :: IO (V.Vector ShowQuery) > v ^.. each.qid [149250] Query text x> v <- query (queryParams "_internal") "SHOW QUERIES" :: IO (V.Vector ShowQuery) > v ^.. each.queryText ["SHOW QUERIES"] t> v <- query (queryParams "_internal") "SHOW QUERIES" :: IO (V.Vector ShowQuery) > v ^.. each.database ["_internal"] Series name n> v <- query (queryParams "_internal") "SHOW SERIES" :: IO (V.Vector ShowSeries) > length $ v ^.. each.key 755     experimentalGHCNoneL !"#$%&'()*+,-./0456789:;?ADEGIghmnop}Lghnomp456789:;&'(IG})*+,-./0A?ED!"#$%  !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNNOOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsstuvwxyz{|}~|}~   .   hj||                 %influxdb-1.2.2-I9vnSq8Pxec2ZNv3b3bkLBDatabase.InfluxDB.TypesDatabase.InfluxDB.PingDatabase.InfluxDB.LineDatabase.InfluxDB.Write.UDPDatabase.InfluxDB.JSONDatabase.InfluxDB.WriteDatabase.InfluxDB.FormatDatabase.InfluxDB.QueryDatabase.InfluxDB.Manage formatQueryDatabase.InfluxDB formatKeyformatDatabaseLservermanagertimeout precision ByteString parseResultsauthenticationServer_host_port_sslQuery defaultServer $fShowQuery$fIsStringQuery $fShowServer$fGenericServer $fEqServer $fOrdServer Credentials_user _passwordhostportssl credentials$fShowCredentialsHasCredentials HasManager HasPrecision HasDatabasedatabase HasServerInfluxException ServerError ClientErrorUnexpectedResponse HTTPException TimestamproundToscaleTo Precision Nanosecond Microsecond MillisecondSecondMinuteHourRFC3339 RequestType QueryRequest WriteRequestFieldFieldInt FieldFloat FieldString FieldBool FieldNull LineField QueryField NullabilityNullable NonNullableKeyDatabase databaseNamepassworduserfromNonEmptyString precisionNameroundAtprecisionScale$fExceptionInfluxException$fTimestampNominalDiffTime$fTimestampUTCTime$fIsStringField $fShowKey$fShowDatabase $fIsStringKey$fIsStringDatabase $fEqDatabase $fOrdDatabase$fEqKey$fOrdKey$fShowRequestType$fShowInfluxException$fShowPrecision $fShowField $fEqField PingParams pingParamsPong$fHasManagerPingParams$fHasServerPingParams $fShowPong$fEqPong $fOrdPonginfluxdbVersion roundtripTimepingLine encodeLine encodeLines buildLine buildLinesfieldSet measurementtagSet timestamp WriteParams writeParamswrite writeBatchwriteByteStringsockAddrsocket%$fHasPrecisionWriteRequestWriteParamsDecoder decodeEach decodeFoldparseResultsWithparseResultsWithDecoder strictDecoderlenientDecodergetFieldgetTagparseResultsObjectparseSeriesObjectparseSeriesBodyparseErrorObject parseUTCTimeparsePOSIXTime parseRFC3339parseQueryFieldretentionPolicy$fHasCredentialsWriteParams$fHasManagerWriteParams$fHasDatabaseWriteParams$fHasServerWriteParamsFormat fromQuery% makeFormatkeykeysfielddecimal realFloattextstring byteString8time$fIsStringFormat$fCategoryTYPEFormat QueryParams QueryResults queryParamsquery queryChunkedwithQueryResponse$fQueryResults(,,,,,,,)$fQueryResults(,,,,,,)$fQueryResults(,,,,,)$fQueryResults(,,,,)$fQueryResults(,,,)$fQueryResults(,,)$fQueryResults(,)$fQueryResultsVoid$fHasCredentialsQueryParams$fHasManagerQueryParams%$fHasPrecisionQueryRequestQueryParams$fHasDatabaseQueryParams$fHasServerQueryParams ShowSeries ShowQuerymanage$fQueryResultsShowSeries$fQueryResultsShowQuerydurationqid queryText$fHasDatabaseShowQuerybase Data.StringIsStringghc-prim GHC.TypesFalse*http-client-0.5.7.0-JBInpFuOYcJGiTvTuJkNSJNetwork.HTTP.Client.TypesManagerSettingsManagerGHC.BaseStringbytestring-0.10.8.1Data.ByteString.Lazy.Internal checkResponse HttpException pingManager pingTimeout Data.EitherLeftNetwork.HTTP.Client.ManagerdefaultManagerSettingsNothing_roundtripTime_influxdbVersion pingServer_manager_server pingRequest _measurement_tagSet _fieldSet _timestampbuildKey escapeKeybuildFieldValue_socket _sockAddr _precision time-1.6.0.1Data.Time.Clock.UTCUTCTimeData.Time.Clock.POSIX POSIXTime#text-1.2.2.2-KC7dWoG09dA1F6jKj5GSqhData.Text.InternalText writeDatabasewriteRetentionPolicywritePrecisionwriteAuthentication writeManager writeServer writeRequest_authentication _databaseData.ByteString.InternalControl.Category. runFormat keyBuilderqueryPrecisionqueryAuthentication queryManager queryServer queryDatabase setPrecisionprecisionParam*optional-args-1.0.1-5AJ5OjRkffb7RAwPRPUJYx Data.OptionalDefaultSpecificJust queryRequest errorQuery_key showQueryQid showQueryTextshowQueryDatabaseshowQueryDuration manageRequest parseDuration