Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data AccessMode
- data ColumnEntry = ColumnEntry {
- column_name :: Text
- column_name_gql :: Text
- datatype :: Text
- datatype_gql :: Maybe GqlTypeName
- select_options :: Maybe [Text]
- notnull :: Bool
- isGenerated :: Bool
- isUnique :: Bool
- isOmittable :: Bool
- dflt_value :: Maybe Text
- primary_key :: Bool
- data GqlTypeName = GqlTypeName {}
- getColumns :: Text -> Connection -> Text -> IO [ColumnEntry]
- getRowidColumnName :: [Text] -> Text
- getTables :: Connection -> IO [TableEntryRaw]
- getTableNames :: Connection -> IO [Text]
- getColumnNames :: Connection -> Text -> IO [Text]
- getEnrichedTables :: Connection -> IO (Either Text [TableEntry])
- data ObjectType
- parseSql :: Text -> Either ParseError Statement
- replaceCaseInsensitive :: Text -> Text -> Text -> Text
- sanitizeSql :: Text -> Text
- sqlDataToAesonValue :: Text -> SQLData -> Value
- sqlDataToText :: SQLData -> Text
- newtype SQLPost = SQLPost {}
- sqlTypeNameToGQLTypeName :: Text -> Maybe Text -> Maybe GqlTypeName
- data TableEntryRaw = TableEntryRaw {
- name :: Text
- tbl_name :: Text
- object_type :: ObjectType
- rootpage :: Int
- sql :: Text
- data TableEntry = TableEntry {}
- data UniqueConstraint = UniqueConstraint {}
- data ReferencesConstraint = ReferencesConstraint {}
- data ReferencesConstraintColumns
- = ImplicitColumns Text
- | ExplicitColumns [(Text, Text)]
- data CheckConstraint = CheckConstraint {}
- sqlite :: Dialect
- stringToGqlTypeName :: Text -> GqlTypeName
- lintTableCreationCode :: Maybe Connection -> Statement -> IO [Text]
- resolveReferencesConstraintColumns :: [TableEntry] -> ReferencesConstraint -> Maybe [(Text, Text)]
- resolveReferencesConstraint :: [TableEntry] -> Text -> Maybe Text
Documentation
data AccessMode Source #
Instances
Show AccessMode Source # | |
Defined in AirGQL.Lib showsPrec :: Int -> AccessMode -> ShowS # show :: AccessMode -> String # showList :: [AccessMode] -> ShowS # | |
Eq AccessMode Source # | |
Defined in AirGQL.Lib (==) :: AccessMode -> AccessMode -> Bool # (/=) :: AccessMode -> AccessMode -> Bool # |
data ColumnEntry Source #
Enhanced with generated information from SQL query "CREATE TABLE"
ColumnEntry | |
|
Instances
data GqlTypeName Source #
Instances
getColumns :: Text -> Connection -> Text -> IO [ColumnEntry] Source #
getRowidColumnName :: [Text] -> Text Source #
getTables :: Connection -> IO [TableEntryRaw] Source #
getTableNames :: Connection -> IO [Text] Source #
getColumnNames :: Connection -> Text -> IO [Text] Source #
getEnrichedTables :: Connection -> IO (Either Text [TableEntry]) Source #
data ObjectType Source #
Instances
replaceCaseInsensitive :: Text -> Text -> Text -> Text Source #
Case-insensitively replaces all occurrences of a substring within a string with a replacement string.
Examples:
>>>
replaceCaseInsensitive "hello" "hi" "Hello World"
"hi World"
>>>
replaceCaseInsensitive "l" "L" "Hello World"
"HeLLo WorLd"
sanitizeSql :: Text -> Text Source #
sqlDataToAesonValue :: Text -> SQLData -> Value Source #
WARNING: Also change duplicate sqlDataToGQLValue
sqlDataToText :: SQLData -> Text Source #
sqlTypeNameToGQLTypeName :: Text -> Maybe Text -> Maybe GqlTypeName Source #
Computes storage class through type affinity as described in https://www.sqlite.org/datatype3.html#affname with an extension for boolean (Order is important) TODO: Add Support for GraphQL's type ID
data TableEntryRaw Source #
TableEntryRaw | |
|
Instances
data TableEntry Source #
TableEntry | |
|
Instances
data UniqueConstraint Source #
Instances
data ReferencesConstraint Source #
Instances
data ReferencesConstraintColumns Source #
ImplicitColumns Text | The "to" column is implicit. Eg: `a TEXT REFERENCES other_table` |
ExplicitColumns [(Text, Text)] | Explicit (from, to) pairs |
Instances
data CheckConstraint Source #
Instances
lintTableCreationCode :: Maybe Connection -> Statement -> IO [Text] Source #
Lint the sql code for creating a table
An optional connection can be used to retrieve the existing db data, which is used for things like resolving implicit references constraints (where the primary key is not explicitly given)
resolveReferencesConstraintColumns :: [TableEntry] -> ReferencesConstraint -> Maybe [(Text, Text)] Source #
resolveReferencesConstraint :: [TableEntry] -> Text -> Maybe Text Source #
SQLite allows references constraints to not specify the exact column they are referencing. This functions tries to recover that information by looking for primary keys among the columns of the referenced table. Note: we currently do not support having composite primary keys referenced implicitly, as that would lead to multiple complications like: - figuring out the correct order for the references - having to perform the "enrichTableEntry" computation in two separate passes