Safe Haskell | None |
---|
Haskell client for Cassandra's CQL protocol
This module isn't properly documented yet. For now, take a look at tests/example.hs.
Credentials are not implemented yet.
Here's the correspondence between Haskell and CQL types. Not all Cassandra data types supported as yet: Haskell types listed below have been implemented.
- ascii -
ByteString
- bigint -
Int64
- blob -
Blob
ByteString
- boolean -
Bool
- counter -
Counter
- decimal
- double
- float
- int -
Int
- text -
Text
- timestamp
- uuid -
UUID
- varchar
- varint
- timeuuid
- inet
- list<type>
- map<type, type>
- set<type>
- type Server = (HostName, ServiceName)
- createCassandraPool :: [Server] -> Keyspace -> IO CPool
- data CPool
- class MonadCatchIO m => MonadCassandra m
- data Cas a
- runCas :: CPool -> Cas a -> IO a
- data CassandraException
- = LocalProtocolError Text
- | AuthenticationException Text
- | ValueMarshallingException TransportDirection Text
- | ServerError Text
- | ProtocolError Text
- | BadCredentials Text
- | UnavailableException Text Consistency Int Int
- | Overloaded Text
- | IsBootstrapping Text
- | TruncateError Text
- | WriteTimeout Text Consistency Int Int Text
- | ReadTimeout Text Consistency Int Int Bool
- | SyntaxError Text
- | Unauthorized Text
- | Invalid Text
- | ConfigError Text
- | AlreadyExists Text Keyspace Table
- | Unprepared Text PreparedQueryID
- data TransportDirection
- newtype Keyspace = Keyspace Text
- data Result vs
- = Void
- | RowsResult Metadata [vs]
- | SetKeyspace Text
- | Prepared PreparedQueryID Metadata
- | SchemaChange Change Keyspace Table
- data TableSpec = TableSpec Keyspace Table
- data ColumnSpec = ColumnSpec TableSpec Text CType
- data Metadata = Metadata [ColumnSpec]
- data CType
- data Change
- newtype Table = Table Text
- data Consistency
- = ANY
- | ONE
- | TWO
- | THREE
- | QUORUM
- | ALL
- | LOCAL_QUORUM
- | EACH_QUORUM
- data Query
- query :: Text -> Query style values
- data Style
- execute :: (MonadCassandra m, CasValues values) => Consistency -> Query Rows values -> m [values]
- executeWrite :: (MonadCassandra m, CasValues values) => Consistency -> Query Write values -> values -> m ()
- executeSchema :: (MonadCassandra m, CasValues values) => Consistency -> Query Schema values -> values -> m (Change, Keyspace, Table)
- executeRaw :: (MonadCassandra m, CasValues values) => Query style ignored -> values -> Consistency -> m (Result [ByteString])
- class CasType a where
- class CasValues v where
- encodeValues :: v -> [CType] -> Either CodingFailure [ByteString]
- decodeValues :: [(CType, ByteString)] -> Either CodingFailure v
- newtype Blob = Blob ByteString
- newtype Counter = Counter Int64
- metadataTypes :: Metadata -> [CType]
Initialization
type Server = (HostName, ServiceName)Source
Monads
class MonadCatchIO m => MonadCassandra m Source
data CassandraException Source
Type used in operations
Void | |
RowsResult Metadata [vs] | |
SetKeyspace Text | |
Prepared PreparedQueryID Metadata | |
SchemaChange Change Keyspace Table |
data Consistency Source
Queries
Operations
execute :: (MonadCassandra m, CasValues values) => Consistency -> Query Rows values -> m [values]Source
Execute a query that returns rows
executeWrite :: (MonadCassandra m, CasValues values) => Consistency -> Query Write values -> values -> m ()Source
Execute a write operation that returns void
executeSchema :: (MonadCassandra m, CasValues values) => Consistency -> Query Schema values -> values -> m (Change, Keyspace, Table)Source
Execute a schema change, such as creating or dropping a table.
executeRaw :: (MonadCassandra m, CasValues values) => Query style ignored -> values -> Consistency -> m (Result [ByteString])Source
Value types
encodeValues :: v -> [CType] -> Either CodingFailure [ByteString]Source
decodeValues :: [(CType, ByteString)] -> Either CodingFailure vSource
metadataTypes :: Metadata -> [CType]Source