clickhouse-haskell-0.1.2.0: A Haskell library as database client for Clickhouse
Safe HaskellNone
LanguageHaskell2010

Database.ClickHouseDriver.Client

Description

This module provides implementations of user's APIs

Synopsis

Data Fetch and Insert

query Source #

Arguments

:: Env () w

Haxl environment for connection

-> String

Query command for SELECT and SHOW only

-> IO (Either String (Vector (Vector ClickhouseType))) 

query command

queryWithInfo :: String -> Env () w -> IO (Either String CKResult) Source #

query result contains query information.

insertOneRow Source #

Arguments

:: Env () w 
-> String

SQL command

-> [ClickhouseType]

a row of local clickhouse data type to be serialized and inserted.

-> IO ByteString

The resulting bytestring indicates success or failure.

ping :: Env () w -> IO () Source #

ping pong

withQuery Source #

Arguments

:: Env () w

enviroment i.e. the database resource

-> String

sql statement

-> (Either String (Vector (Vector ClickhouseType)) -> IO a)

callback function that returns type a

-> IO a

type a wrapped in IO monad.

fetch Source #

Arguments

:: String

SQL SELECT command

-> GenHaxl u w (Either String (Vector (Vector ClickhouseType)))

result wrapped in Haxl monad for other tasks run with concurrency.

Fetch data

fetchWithInfo :: String -> GenHaxl u w (Either String CKResult) Source #

fetch data alone with query information

execute :: Env u w -> GenHaxl u w a -> IO a Source #

For general use e.g. creating table, multiple queries, multiple insertions.

Communication

client Source #

Arguments

:: Resource a 
=> Either String a 
-> IO (Env () w)

Either wrong message of resource with type a

closeClient :: Env () w -> IO () Source #

close connection

Connection pool

defaultClientPool Source #

Arguments

:: Int

number of stripes

-> NominalDiffTime

idle time for each stripe

-> Int

maximum resources for reach stripe

-> IO (Env () w)

Haxl env wrapped in IO monad.

createClientPool Source #

Arguments

:: ConnParams

parameters for connection settings

-> Int

number of stripes

-> NominalDiffTime

idle time for each stripe

-> Int

maximum resources for reach stripe

-> IO (Env () w)