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:
parent
5372e9253c
commit
cb0127ddd1
1 changed files with 49 additions and 44 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue