Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Stuff gutted from Translate.Select.
Synopsis
- mkFirstElementExp :: SQLExp -> SQLExp
- mkLastElementExp :: SQLExp -> SQLExp
- cursorIdentifier :: Identifier
- startCursorIdentifier :: Identifier
- endCursorIdentifier :: Identifier
- hasPreviousPageIdentifier :: Identifier
- hasNextPageIdentifier :: Identifier
- pageInfoSelectAlias :: TableAlias
- pageInfoSelectAliasIdentifier :: TableIdentifier
- cursorsSelectAlias :: TableAlias
- cursorsSelectAliasIdentifier :: TableIdentifier
- encodeBase64 :: SQLExp -> SQLExp
- fromTableRowArgs :: TableIdentifier -> FunctionArgsExpG (ArgumentExp SQLExp) -> FunctionArgs
- nativeQueryNameToAlias :: NativeQueryName -> Int -> TableAlias
- functionToIdentifier :: QualifiedFunction -> Identifier
- withJsonBuildObj :: FieldName -> [SQLExp] -> (ColumnAlias, SQLExp)
- withForceAggregation :: TypeAnn -> SQLExp -> SQLExp
- selectToSelectWith :: Writer CustomSQLCTEs Select -> SelectWith
- customSQLToTopLevelCTEs :: CustomSQLCTEs -> [(TableAlias, TopLevelCTE)]
- customSQLToInnerCTEs :: CustomSQLCTEs -> [(TableAlias, InnerCTE)]
- toQuery :: SelectWithG TopLevelCTE -> Query
Documentation
mkFirstElementExp :: SQLExp -> SQLExp Source #
First element extractor expression from given record set For example:- To get first "id" column from given row set, the function generates the SQL expression AS `(array_agg("id"))[1]`
mkLastElementExp :: SQLExp -> SQLExp Source #
Last element extractor expression from given record set. For example:- To get first "id" column from given row set, the function generates the SQL expression AS `(array_agg("id"))[array_length(array_agg("id"), 1)]`
encodeBase64 :: SQLExp -> SQLExp Source #
fromTableRowArgs :: TableIdentifier -> FunctionArgsExpG (ArgumentExp SQLExp) -> FunctionArgs Source #
nativeQueryNameToAlias :: NativeQueryName -> Int -> TableAlias Source #
Given a NativeQueryName
, what should we call the CTE generated for it?
functionToIdentifier :: QualifiedFunction -> Identifier Source #
Converts a function name to an Identifier
.
If the schema name is public, it will just use its name, otherwise it will prefix it by the schema name.
withJsonBuildObj :: FieldName -> [SQLExp] -> (ColumnAlias, SQLExp) Source #
selectToSelectWith :: Writer CustomSQLCTEs Select -> SelectWith Source #
unwrap any emitted TopLevelCTEs for custom sql from the Writer and combine
them with a Select
to create a SelectWith
customSQLToTopLevelCTEs :: CustomSQLCTEs -> [(TableAlias, TopLevelCTE)] Source #
convert map of CustomSQL CTEs into named TopLevelCTEs
customSQLToInnerCTEs :: CustomSQLCTEs -> [(TableAlias, InnerCTE)] Source #
convert map of CustomSQL CTEs into named InnerCTEs
toQuery :: SelectWithG TopLevelCTE -> Query Source #