1
Fork 0
mirror of https://github.com/Airsequel/AirGQL.git synced 2025-08-21 22:06:57 +03:00

Implement main reference following mechanism on the backend

This commit is contained in:
prescientmoon 2024-08-28 23:37:31 +02:00
commit cb0127ddd1

View file

@ -9,6 +9,8 @@ module AirGQL.Lib (
AccessMode (..),
ColumnEntry (..),
GqlTypeName (..),
getEnrichedTable,
getColumnsFromParsedTableEntry,
getColumns,
getRowidColumnName,
getTables,
@ -869,10 +871,8 @@ getColumnsFromParsedTableEntry connection tableEntry = do
pure $ rowidColumns <> entries
getColumns :: Text -> Connection -> Text -> IO [ColumnEntry]
getColumns dbId connection tableName =
let
columns = do
getEnrichedTable :: Text -> Connection -> Text -> IO TableEntry
getEnrichedTable dbId connection tableName = do
tables :: [TableEntryRaw] <-
SS.query
connection
@ -895,7 +895,7 @@ getColumns dbId connection tableName =
]
enrichmentResultEither <- enrichTableEntry connection table
enrichingResult <- case enrichmentResultEither of
case enrichmentResultEither of
Right result -> pure result
Left err ->
fail $
@ -907,9 +907,14 @@ getColumns dbId connection tableName =
, ": "
, T.unpack err
]
getColumnsFromParsedTableEntry connection enrichingResult
in
catchAll
getColumns :: Text -> Connection -> Text -> IO [ColumnEntry]
getColumns dbId conn tableName =
let columns = do
enrichingResult <- getEnrichedTable dbId conn tableName
getColumnsFromParsedTableEntry conn enrichingResult
in catchAll
columns
$ \err -> do
P.putErrText $ P.show err