airgql-0.7.1.2: Automatically generate a GraphQL API for an SQLite database
Safe HaskellSafe-Inferred
LanguageHaskell2010

AirGQL.Utils

Synopsis

Documentation

collectAllErrorsAsText :: [Either Text b] -> Either Text [b] Source #

Similar to sequence, except it doesn't stop on the first error. What differentiates this from collectErrorList is that it also merges the errors into a single error message.

collectErrorList :: [Either e b] -> Either [e] [b] Source #

Similar to sequence, except it doesn't stop on the first error.

escDoubleQuotes :: Text -> Text Source #

Escape double quotes in SQL strings

escSingleQuotes :: Text -> Text Source #

Escape single quotes in SQL strings

getOrderOfLinkedList :: [(Text, Maybe Text)] -> [Text] Source #

Get the order of a linked list. | Each tuple is `(name, previous name in list)`. | The first's element previous name is Nothing. | Tries to find the longest chain of elements if no start element is found. | It's quite complicated to also handle incomplete orderings correctly.

quoteKeyword :: Text -> Text Source #

Quote a keyword in an SQL query

quoteText :: Text -> Text Source #

Quote literal text in an SQL query

throwErr400WithMsg :: Text -> Handler a Source #

Throw an "400 Bad Request" error with a message

throwErr404WithMsg :: Text -> Handler a Source #

Throw an "404 Not Found" error with a message

throwErr500WithMsg :: Text -> Handler a Source #

Throw an "500 Internal Server Error" error with a message

withRetryConn :: FilePath -> (Connection -> IO a) -> IO a Source #

Run an action with a connection, retrying if the database is busy. | Necessary because of WAL mode: | https://sqlite.org/wal.html#sometimes_queries_return_sqlite_busy_in_wal_mode

data DiffKind Source #

Constructors

Added 
Removed 
Kept 

Instances

Instances details
Show DiffKind Source # 
Instance details

Defined in AirGQL.Utils

Eq DiffKind Source # 
Instance details

Defined in AirGQL.Utils

Ord DiffKind Source # 
Instance details

Defined in AirGQL.Utils