Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Query
- manage :: QueryParams -> Query -> IO ()
- data QueryParams
- queryParams :: Database -> QueryParams
- server :: HasServer a => Lens' a Server
- database :: HasDatabase a => Lens' a Database
- precision :: HasPrecision ty a => Lens' a (Precision ty)
- manager :: HasManager a => Lens' a (Either ManagerSettings Manager)
- data ShowQuery
- qid :: Lens' ShowQuery Int
- queryText :: Lens' ShowQuery Query
- duration :: Lens' ShowQuery NominalDiffTime
- data ShowSeries
- key :: Lens' ShowSeries Key
Management query interface
An InfluxDB query.
A spec of the format is available at https://docs.influxdata.com/influxdb/v1.7/query_language/spec/.
A Query
can be constructed using either
- the
IsString
instance with-XOverloadedStrings
- or
formatQuery
.
>>>
: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\""
NOTE: Currently this library doesn't support type-safe query construction.
manage :: QueryParams -> Query -> IO () Source #
Send a database management query to InfluxDB.
>>>
let db = "manage-test"
>>>
let p = queryParams db
>>>
manage p $ F.formatQuery ("CREATE DATABASE "%F.database) db
Query parameters
data QueryParams Source #
The full set of parameters for the query API
Following lenses are available to access its fields:
Instances
HasCredentials QueryParams Source # | Authentication info for the query
|
Defined in Database.InfluxDB.Query | |
HasManager QueryParams Source # |
|
Defined in Database.InfluxDB.Query | |
HasDatabase QueryParams Source # |
|
Defined in Database.InfluxDB.Query | |
HasServer QueryParams Source # |
|
Defined in Database.InfluxDB.Query | |
HasPrecision QueryRequest QueryParams Source # | Returning JSON responses contain timestamps in the specified precision/format.
|
Defined in Database.InfluxDB.Query |
queryParams :: Database -> QueryParams Source #
Smart constructor for QueryParams
Default parameters:
server :: HasServer a => Lens' a Server Source #
InfluxDB server address and port that to interact with.
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.
Management query results
SHOW QUERIES
>>>
v <- query @ShowQuery (queryParams "_internal") "SHOW QUERIES"
Instances
HasDatabase ShowQuery Source # |
|
QueryResults ShowQuery Source # | |
qid :: Lens' ShowQuery Int Source #
Query ID
>>>
v <- query @ShowQuery (queryParams "_internal") "SHOW QUERIES"
>>>
v ^.. each.qid
...
queryText :: Lens' ShowQuery Query Source #
Query text
>>>
v <- query @ShowQuery (queryParams "_internal") "SHOW QUERIES"
>>>
v ^.. each.queryText
...
duration :: Lens' ShowQuery NominalDiffTime Source #
Duration of the query
>>>
v <- query @ShowQuery (queryParams "_internal") "SHOW QUERIES"
>>>
v ^.. each.duration
...
SHOW SERIES
data ShowSeries Source #
Instances
QueryResults ShowSeries Source # | |
Defined in Database.InfluxDB.Manage parseMeasurement :: Precision QueryRequest -> Maybe Text -> HashMap Text Text -> Vector Text -> Array -> Parser ShowSeries Source # coerceDecoder :: proxy ShowSeries -> Maybe Decoder Source # |