{-# OPTIONS_GHC -fno-warn-orphans #-}

-- | Postgres Instances API
--
-- Defines a 'Hasura.Server.API.Backend.BackendAPI' type class instance for Postgres.
module Hasura.Backends.Postgres.Instances.API () where

import Hasura.Prelude
import Hasura.RQL.Types.BackendType
import Hasura.SQL.AnyBackend (mkAnyBackend)
import Hasura.Server.API.Backend
import Hasura.Server.API.Metadata.Types

instance BackendAPI ('Postgres 'Vanilla) where
  metadataV1CommandParsers :: [CommandParser ('Postgres 'Vanilla)]
metadataV1CommandParsers =
    [[CommandParser ('Postgres 'Vanilla)]]
-> [CommandParser ('Postgres 'Vanilla)]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
      [ forall (b :: BackendType). Backend b => [CommandParser b]
sourceCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
tableCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
tablePermissionsCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
functionCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
functionPermissionsCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
relationshipCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
remoteRelationshipCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
eventTriggerCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
computedFieldCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
nativeQueriesCommands @('Postgres 'Vanilla),
        forall (b :: BackendType). Backend b => [CommandParser b]
logicalModelsCommands @('Postgres 'Vanilla),
        [ Text
-> (SetTableIsEnum ('Postgres 'Vanilla) -> RQLMetadataV1)
-> CommandParser ('Postgres 'Vanilla)
forall a (b :: BackendType).
FromJSON a =>
Text -> (a -> RQLMetadataV1) -> CommandParser b
commandParser
            Text
"set_table_is_enum"
            ( AnyBackend SetTableIsEnum -> RQLMetadataV1
RMPgSetTableIsEnum
                (AnyBackend SetTableIsEnum -> RQLMetadataV1)
-> (SetTableIsEnum ('Postgres 'Vanilla)
    -> AnyBackend SetTableIsEnum)
-> SetTableIsEnum ('Postgres 'Vanilla)
-> RQLMetadataV1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (b :: BackendType) (i :: BackendType -> *).
HasTag b =>
i b -> AnyBackend i
mkAnyBackend @('Postgres 'Vanilla)
            )
        ],
        forall (b :: BackendType). Backend b => [CommandParser b]
connectionTemplateCommands @('Postgres 'Vanilla)
      ]

instance BackendAPI ('Postgres 'Citus) where
  metadataV1CommandParsers :: [CommandParser ('Postgres 'Citus)]
metadataV1CommandParsers =
    [[CommandParser ('Postgres 'Citus)]]
-> [CommandParser ('Postgres 'Citus)]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
      [ forall (b :: BackendType). Backend b => [CommandParser b]
sourceCommands @('Postgres 'Citus),
        forall (b :: BackendType). Backend b => [CommandParser b]
tableCommands @('Postgres 'Citus),
        forall (b :: BackendType). Backend b => [CommandParser b]
tablePermissionsCommands @('Postgres 'Citus),
        forall (b :: BackendType). Backend b => [CommandParser b]
functionCommands @('Postgres 'Citus),
        forall (b :: BackendType). Backend b => [CommandParser b]
functionPermissionsCommands @('Postgres 'Citus),
        forall (b :: BackendType). Backend b => [CommandParser b]
relationshipCommands @('Postgres 'Citus),
        forall (b :: BackendType). Backend b => [CommandParser b]
remoteRelationshipCommands @('Postgres 'Citus),
        forall (b :: BackendType). Backend b => [CommandParser b]
connectionTemplateCommands @('Postgres 'Citus),
        forall (b :: BackendType). Backend b => [CommandParser b]
nativeQueriesCommands @('Postgres 'Citus),
        forall (b :: BackendType). Backend b => [CommandParser b]
logicalModelsCommands @('Postgres 'Citus)
      ]

instance BackendAPI ('Postgres 'Cockroach) where
  metadataV1CommandParsers :: [CommandParser ('Postgres 'Cockroach)]
metadataV1CommandParsers =
    [[CommandParser ('Postgres 'Cockroach)]]
-> [CommandParser ('Postgres 'Cockroach)]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
      [ forall (b :: BackendType). Backend b => [CommandParser b]
sourceCommands @('Postgres 'Cockroach),
        forall (b :: BackendType). Backend b => [CommandParser b]
tableCommands @('Postgres 'Cockroach),
        forall (b :: BackendType). Backend b => [CommandParser b]
tablePermissionsCommands @('Postgres 'Cockroach),
        forall (b :: BackendType). Backend b => [CommandParser b]
relationshipCommands @('Postgres 'Cockroach),
        forall (b :: BackendType). Backend b => [CommandParser b]
remoteRelationshipCommands @('Postgres 'Cockroach),
        [ Text
-> (SetTableIsEnum ('Postgres 'Cockroach) -> RQLMetadataV1)
-> CommandParser ('Postgres 'Cockroach)
forall a (b :: BackendType).
FromJSON a =>
Text -> (a -> RQLMetadataV1) -> CommandParser b
commandParser
            Text
"set_table_is_enum"
            ( AnyBackend SetTableIsEnum -> RQLMetadataV1
RMPgSetTableIsEnum
                (AnyBackend SetTableIsEnum -> RQLMetadataV1)
-> (SetTableIsEnum ('Postgres 'Cockroach)
    -> AnyBackend SetTableIsEnum)
-> SetTableIsEnum ('Postgres 'Cockroach)
-> RQLMetadataV1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (b :: BackendType) (i :: BackendType -> *).
HasTag b =>
i b -> AnyBackend i
mkAnyBackend @('Postgres 'Cockroach)
            )
        ],
        forall (b :: BackendType). Backend b => [CommandParser b]
connectionTemplateCommands @('Postgres 'Cockroach),
        forall (b :: BackendType). Backend b => [CommandParser b]
nativeQueriesCommands @('Postgres 'Cockroach),
        forall (b :: BackendType). Backend b => [CommandParser b]
logicalModelsCommands @('Postgres 'Cockroach)
      ]