<commit_before>{-# LANGUAGE PatternGuards, 
             NamedFieldPuns, 
             OverloadedStrings,
             TypeSynonymInstances, 
             RecordWildCards #-}

{-|
    A higher level module for working with Cassandra.
    
    Row and Column keys can be any string-like type implementing the
    CKey typeclass. You can add your own types by defining new instances

    Serialization and de-serialization of Column values are taken care of
    automatically using the ToJSON and FromJSON typeclasses.
    
    Also, this module currently attempts to reduce verbosity by
    throwing errors instead of returning Either types as in the
    'Database.Cassandra.Basic' module.

-}

module Database.Cassandra.JSON 
( 
  
  -- * Connection
    CPool
  , Server(..)
  , defServer
  , defServers
  , KeySpace(..)
  , createCassandraPool


  -- * Necessary Types
  , CKey(..)
  , ModifyOperation(..)
  , ColumnFamily(..)
  , ConsistencyLevel(..)

  -- * Cassandra Operations
  , insertCol
  , modify
  , modify_

) where

import           Control.Exception
import           Control.Monad
import           Data.Aeson as A
import qualified Data.Attoparsec                            as Atto (Result(..), parse)
import qualified Data.ByteString.Char8                      as B
import           Data.ByteString.Lazy.Char8                 (ByteString)
import qualified Data.ByteString.Lazy.Char8                 as LB
import           Data.Map                                   (Map)
import qualified Data.Map                                   as M
import           Network
import           Prelude                                    hiding (catch)
import qualified Data.Text                                  as T
import qualified Data.Text.Encoding                         as T
import qualified Data.Text.Lazy                             as LT
import qualified Data.Text.Lazy.Encoding                    as LT

import           Database.Cassandra.Basic
import qualified Database.Cassandra.Basic as CB
import           Database.Cassandra.Pool
import           Database.Cassandra.Types


-------------------------------------------------------------------------------
---- CKey Typeclass
-------------------------------------------------------------------------------


------------------------------------------------------------------------------
-- | A typeclass to enable using any string-like type for row and column keys<commit_msg>Ops add get to export list<commit_after>{-# LANGUAGE PatternGuards, 
             NamedFieldPuns, 
             OverloadedStrings,
             TypeSynonymInstances, 
             RecordWildCards #-}

{-|
    A higher level module for working with Cassandra.
    
    Row and Column keys can be any string-like type implementing the
    CKey typeclass. You can add your own types by defining new instances

    Serialization and de-serialization of Column values are taken care of
    automatically using the ToJSON and FromJSON typeclasses.
    
    Also, this module currently attempts to reduce verbosity by
    throwing errors instead of returning Either types as in the
    'Database.Cassandra.Basic' module.

-}

module Database.Cassandra.JSON 
( 
  
  -- * Connection
    CPool
  , Server(..)
  , defServer
  , defServers
  , KeySpace(..)
  , createCassandraPool


  -- * Necessary Types
  , CKey(..)
  , ModifyOperation(..)
  , ColumnFamily(..)
  , ConsistencyLevel(..)

  -- * Cassandra Operations
  , insertCol
  , modify
  , modify_
  , get

) where

import           Control.Exception
import           Control.Monad
import           Data.Aeson as A
import qualified Data.Attoparsec                            as Atto (Result(..), parse)
import qualified Data.ByteString.Char8                      as B
import           Data.ByteString.Lazy.Char8                 (ByteString)
import qualified Data.ByteString.Lazy.Char8                 as LB
import           Data.Map                                   (Map)
import qualified Data.Map                                   as M
import           Network
import           Prelude                                    hiding (catch)
import qualified Data.Text                                  as T
import qualified Data.Text.Encoding                         as T
import qualified Data.Text.Lazy                             as LT
import qualified Data.Text.Lazy.Encoding                    as LT

import           Database.Cassandra.Basic hiding (get)
import qualified Database.Cassandra.Basic as CB
import           Database.Cassandra.Pool
import           Database.Cassandra.Types


-------------------------------------------------------------------------------
---- CKey Typeclass
-------------------------------------------------------------------------------


------------------------------------------------------------------------------
-- | A typeclass to enable using any string-like type for row and column keys
{'fraction_non_alphanumeric': 0.14922638436482086, 'fraction_numerical': 0.0012214983713355048, 'mean_word_length': 1.3109125117591722, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2111171', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1103, 'n_words': 377}