[gardening] remove Alias from Backend

### Description

In our haste to generalize everything for MSSQL, we put every single "suspicious" type in Backend, including ones that weren't required. `Alias` is one of those: it's only used in a type alias, and is actually just an implementation detail of the translation layer. This PR removes it.

https://github.com/hasura/graphql-engine-mono/pull/1759

GitOrigin-RevId: fb348934ec65a51aae7f95d93c83c3bb704587b5
This commit is contained in:
Antoine Leblanc 2021-07-09 16:53:55 +01:00 committed by hasura-bot
parent 66f09eeaab
commit 0a9382f2dc
7 changed files with 10 additions and 9 deletions

View File

@ -21,7 +21,6 @@ instance Backend 'BigQuery where
type SourceConfig 'BigQuery = BigQuery.BigQuerySourceConfig
type SourceConnConfiguration 'BigQuery = BigQuery.BigQueryConnSourceConfig
type Identifier 'BigQuery = Void
type Alias 'BigQuery = BigQuery.EntityAlias
type TableName 'BigQuery = BigQuery.TableName
type FunctionName 'BigQuery = BigQuery.FunctionName
type FunctionArgType 'BigQuery = Void

View File

@ -22,7 +22,6 @@ instance Backend 'MSSQL where
type SourceConfig 'MSSQL = MSSQL.MSSQLSourceConfig
type SourceConnConfiguration 'MSSQL = MSSQL.MSSQLConnConfiguration
type Identifier 'MSSQL = Void
type Alias 'MSSQL = MSSQL.EntityAlias
type TableName 'MSSQL = MSSQL.TableName
type FunctionName 'MSSQL = MSSQL.FunctionName
type FunctionArgType 'MSSQL = Void

View File

@ -59,7 +59,6 @@ instance
type SourceConfig ('Postgres pgKind) = PG.PGSourceConfig
type SourceConnConfiguration ('Postgres pgKind) = PG.PostgresConnConfiguration
type Identifier ('Postgres pgKind) = PG.Identifier
type Alias ('Postgres pgKind) = PG.Alias
type TableName ('Postgres pgKind) = PG.QualifiedTable
type FunctionName ('Postgres pgKind) = PG.QualifiedFunction
type FunctionArgType ('Postgres pgKind) = PG.QualifiedPGType

View File

@ -697,7 +697,9 @@ processOrderByItems sourcePrefix' fieldAlias' similarArrayFields orderByItems =
cursor = mkCursorExp $ toList orderByItemExps
pure (orderByExtractors, orderByExp, cursor)
where
processAnnOrderByItem :: AnnOrderByItem ('Postgres pgKind) -> m (OrderByItemExp ('Postgres pgKind))
processAnnOrderByItem
:: AnnOrderByItem ('Postgres pgKind)
-> m (OrderByItemG ('Postgres pgKind) (AnnOrderByElement ('Postgres pgKind) (SQLExpression ('Postgres pgKind)), (S.Alias, SQLExpression ('Postgres pgKind))))
processAnnOrderByItem orderByItem =
forM orderByItem $ \ordByCol -> (ordByCol,) <$>
processAnnOrderByElement sourcePrefix' fieldAlias' ordByCol
@ -743,12 +745,16 @@ processOrderByItems sourcePrefix' fieldAlias' similarArrayFields orderByItems =
, S.mkQIdenExp relSourcePrefix (mkAggregateOrderByAlias aggOrderBy)
)
toOrderByExp :: OrderByItemExp ('Postgres pgKind) -> S.OrderByItem
toOrderByExp
:: OrderByItemG ('Postgres pgKind) (AnnOrderByElement ('Postgres pgKind) (SQLExpression ('Postgres pgKind)), (S.Alias, SQLExpression ('Postgres pgKind)))
-> S.OrderByItem
toOrderByExp orderByItemExp =
let OrderByItemG obTyM expAlias obNullsM = fst . snd <$> orderByItemExp
in S.OrderByItem (S.SEIdentifier $ toIdentifier expAlias) obTyM obNullsM
mkCursorExp :: [OrderByItemExp ('Postgres pgKind)] -> S.SQLExp
mkCursorExp
:: [OrderByItemG ('Postgres pgKind) (AnnOrderByElement ('Postgres pgKind) (SQLExpression ('Postgres pgKind)), (S.Alias, SQLExpression ('Postgres pgKind)))]
-> S.SQLExp
mkCursorExp orderByItemExps =
S.applyJsonBuildObj $ flip concatMap orderByItemExps $
\orderByItemExp ->

View File

@ -31,7 +31,7 @@ import Hasura.GraphQL.Parser hiding (field)
import Hasura.GraphQL.RemoteServer (execRemoteGQ)
import Hasura.GraphQL.Transport.HTTP.Protocol
import Hasura.RQL.IR.Select
import Hasura.RQL.Types hiding (Alias)
import Hasura.RQL.Types
import Hasura.Server.Version (HasVersion)
import Hasura.Session

View File

@ -176,7 +176,6 @@ instance (Backend b) => Hashable (AnnAggregateOrderBy b)
type AnnOrderByElement b v = AnnOrderByElementG b (AnnBoolExp b v)
type AnnOrderByItemG b v = OrderByItemG b (AnnOrderByElement b v)
type AnnOrderByItem b = AnnOrderByItemG b (SQLExpression b)
type OrderByItemExp b = OrderByItemG b (AnnOrderByElement b (SQLExpression b), (Alias b, SQLExpression b))
-- Fields

View File

@ -109,7 +109,6 @@ class
type SourceConfig b :: Type
type SourceConnConfiguration b :: Type
type Identifier b :: Type
type Alias b :: Type
type TableName b :: Type
type FunctionName b :: Type
type FunctionArgType b :: Type