influxdb-1.9.1.2: InfluxDB client library for Haskell
Safe HaskellNone
LanguageHaskell2010

Database.InfluxDB.Manage

Synopsis

Management query interface

data Query Source #

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

>>> :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.

Instances

Instances details
Show Query Source # 
Instance details

Defined in Database.InfluxDB.Types

Methods

showsPrec :: Int -> Query -> ShowS #

show :: Query -> String #

showList :: [Query] -> ShowS #

IsString Query Source # 
Instance details

Defined in Database.InfluxDB.Types

Methods

fromString :: String -> Query #

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

Instances details
HasCredentials QueryParams Source #

Authentication info for the query

>>> let p = queryParams "foo"
>>> p ^. authentication
Nothing
>>> let p' = p & authentication ?~ credentials "john" "passw0rd"
>>> p' ^. authentication.traverse.user
"john"
Instance details

Defined in Database.InfluxDB.Query

HasManager QueryParams Source #
>>> let p = queryParams "foo" & manager .~ Left HC.defaultManagerSettings
Instance details

Defined in Database.InfluxDB.Query

HasDatabase QueryParams Source #
>>> let p = queryParams "foo"
>>> p ^. database
"foo"
Instance details

Defined in Database.InfluxDB.Query

HasServer QueryParams Source #
>>> let p = queryParams "foo"
>>> p ^. server.host
"localhost"
Instance details

Defined in Database.InfluxDB.Query

HasPrecision 'QueryRequest QueryParams Source #

Returning JSON responses contain timestamps in the specified precision/format.

>>> let p = queryParams "foo"
>>> p ^. precision
RFC3339
Instance details

Defined in Database.InfluxDB.Query

server :: HasServer a => Lens' a Server Source #

InfluxDB server address and port that to interact with.

database :: HasDatabase a => Lens' a Database Source #

Database name to work on.

precision :: HasPrecision ty a => Lens' a (Precision ty) Source #

Time precision parameter.

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

data ShowQuery Source #

>>> v <- query @ShowQuery (queryParams "_internal") "SHOW QUERIES"

Instances

Instances details
HasDatabase ShowQuery Source #
>>> v <- query @ShowQuery (queryParams "_internal") "SHOW QUERIES"
>>> v ^.. each.database
...
Instance details

Defined in Database.InfluxDB.Manage

QueryResults ShowQuery Source # 
Instance details

Defined in Database.InfluxDB.Manage

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

key :: Lens' ShowSeries Key Source #

Series name

>>> v <- query @ShowSeries (queryParams "_internal") "SHOW SERIES"
>>> length $ v ^.. each.key
...