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.5/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
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 (queryParams "_internal") "SHOW QUERIES" :: IO (V.Vector ShowQuery)
Instances
HasDatabase ShowQuery Source # |
|
QueryResults ShowQuery Source # | |
Defined in Database.InfluxDB.Manage parseResults :: Precision QueryRequest -> Value -> Parser (Vector ShowQuery) Source # |
qid :: Lens' ShowQuery Int Source #
Query ID
>>>
v <- query (queryParams "_internal") "SHOW QUERIES" :: IO (V.Vector ShowQuery)
>>>
v ^.. each.qid
...
queryText :: Lens' ShowQuery Query Source #
Query text
>>>
v <- query (queryParams "_internal") "SHOW QUERIES" :: IO (V.Vector ShowQuery)
>>>
v ^.. each.queryText
...
duration :: Lens' ShowQuery NominalDiffTime Source #
Duration of the query
>>>
v <- query (queryParams "_internal") "SHOW QUERIES" :: IO (V.Vector ShowQuery)
>>>
v ^.. each.duration
...
SHOW SERIES
data ShowSeries Source #
Instances
QueryResults ShowSeries Source # | |
Defined in Database.InfluxDB.Manage parseResults :: Precision QueryRequest -> Value -> Parser (Vector ShowSeries) Source # |