Copyright | (c) CNRS 2017-Present |
---|---|
License | AGPL + CECILL v3 |
Maintainer | team@gargantext.org |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- class HasConnectionPool env where
- connPool :: Getter env (Pool Connection)
- class HasConfig env where
- hasConfig :: Getter env GargConfig
- type JSONB = DefaultFromField SqlJsonb
- type CmdM'' env err m = (MonadReader env m, MonadError err m, MonadBaseControl IO m, MonadRandom m)
- type CmdM' env err m = (MonadReader env m, MonadError err m, MonadBaseControl IO m)
- type DbCommon env = (HasConnectionPool env, HasConfig env)
- type CmdCommon env = (DbCommon env, HasConfig env, HasMail env, HasNLPServer env)
- type CmdM env err m = (CmdM' env err m, CmdCommon env)
- type CmdRandom env err m = (CmdM' env err m, DbCommon env, MonadRandom m, HasMail env)
- type Cmd'' env err a = forall m. CmdM'' env err m => m a
- type Cmd' env err a = forall m. CmdM' env err m => m a
- type Cmd err a = forall m env. CmdM env err m => m a
- type CmdR err a = forall m env. CmdRandom env err m => m a
- type DBCmd err a = forall m env. DbCmd' env err m => m a
- type DbCmd' env err m = (CmdM' env err m, DbCommon env)
- fromInt64ToInt :: Int64 -> Int
- mkCmd :: (Connection -> IO a) -> DBCmd err a
- runCmd :: HasConnectionPool env => env -> Cmd'' env err a -> IO (Either err a)
- runOpaQuery :: Default FromFields fields haskells => Select fields -> DBCmd err [haskells]
- runCountOpaQuery :: Select a -> DBCmd err Int
- formatPGSQuery :: ToRow a => Query -> a -> DBCmd err ByteString
- runPGSQuery' :: (ToRow a, FromRow b) => Query -> a -> DBCmd err [b]
- runPGSQuery :: (FromRow r, ToRow q) => Query -> q -> DBCmd err [r]
- runPGSQuery_ :: FromRow r => Query -> DBCmd err [r]
- execPGSQuery :: ToRow a => Query -> a -> DBCmd err Int64
- databaseParameters :: FilePath -> IO ConnectInfo
- connectGargandb :: FilePath -> IO Connection
- fromField' :: (Typeable b, FromJSON b) => Field -> Maybe ByteString -> Conversion b
- printSqlOpa :: Default Unpackspec a a => Select a -> IO ()
- dbCheck :: DBCmd err Bool
- restrictMaybe :: (Default IfPP b b, Default ToFields Bool b) => MaybeFields a -> (a -> b) -> b
Documentation
class HasConnectionPool env where #
connPool :: Getter env (Pool Connection) #
Instances
HasConnectionPool DevEnv # | |
Defined in Gargantext.API.Admin.EnvTypes | |
HasConnectionPool Env # | |
Defined in Gargantext.API.Admin.EnvTypes | |
HasConnectionPool (Pool Connection) # | |
Defined in Gargantext.Database.Prelude connPool :: Getter (Pool Connection) (Pool Connection) # |
hasConfig :: Getter env GargConfig #
Instances
HasConfig DevEnv # | |
Defined in Gargantext.API.Admin.EnvTypes | |
HasConfig Env # | |
Defined in Gargantext.API.Admin.EnvTypes | |
HasConfig GargConfig # | |
Defined in Gargantext.Database.Prelude |
type JSONB = DefaultFromField SqlJsonb #
type CmdM'' env err m = (MonadReader env m, MonadError err m, MonadBaseControl IO m, MonadRandom m) #
type CmdM' env err m = (MonadReader env m, MonadError err m, MonadBaseControl IO m) #
type DbCommon env = (HasConnectionPool env, HasConfig env) #
If possible, try to not add more constraints here. When performing
a query/update on the DB, one shouldn't need more than being able to
fetch from the underlying env
the connection pool and access the
GargConfig
for some sensible defaults to store into the DB.
type DbCmd' env err m = (CmdM' env err m, DbCommon env) #
Only the minimum amount of class constraints required to use the Gargantext Database. It's important, to ease testability, that these constraints stays as few as possible.
fromInt64ToInt :: Int64 -> Int #
mkCmd :: (Connection -> IO a) -> DBCmd err a #
runOpaQuery :: Default FromFields fields haskells => Select fields -> DBCmd err [haskells] #
runCountOpaQuery :: Select a -> DBCmd err Int #
formatPGSQuery :: ToRow a => Query -> a -> DBCmd err ByteString #
runPGSQuery_ :: FromRow r => Query -> DBCmd err [r] #
TODO catch error
databaseParameters :: FilePath -> IO ConnectInfo #
connectGargandb :: FilePath -> IO Connection #
fromField' :: (Typeable b, FromJSON b) => Field -> Maybe ByteString -> Conversion b #
printSqlOpa :: Default Unpackspec a a => Select a -> IO () #
restrictMaybe :: (Default IfPP b b, Default ToFields Bool b) => MaybeFields a -> (a -> b) -> b #