{-# LANGUAGE TemplateHaskell #-}

-- | Postgres Types CitusExtraTableMetadata
--
-- Additional metadata information for Citus tables.
--
-- See https://www.citusdata.com/blog/2017/07/27/database-table-types-with-citus-and-postgres/
-- for more details on the Citus table types.
module Hasura.Backends.Postgres.Types.CitusExtraTableMetadata
  ( ExtraTableMetadata (..),
  )
where

import Data.Aeson.Casing qualified as JC
import Data.Aeson.TH qualified as J
import Data.Typeable (Typeable)
import Hasura.Incremental (Cacheable)
import Hasura.Prelude

data ExtraTableMetadata
  = Local
  | Reference
  | Distributed {ExtraTableMetadata -> Text
distributionColumn :: Text}
  deriving stock (Int -> ExtraTableMetadata -> ShowS
[ExtraTableMetadata] -> ShowS
ExtraTableMetadata -> String
(Int -> ExtraTableMetadata -> ShowS)
-> (ExtraTableMetadata -> String)
-> ([ExtraTableMetadata] -> ShowS)
-> Show ExtraTableMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExtraTableMetadata] -> ShowS
$cshowList :: [ExtraTableMetadata] -> ShowS
show :: ExtraTableMetadata -> String
$cshow :: ExtraTableMetadata -> String
showsPrec :: Int -> ExtraTableMetadata -> ShowS
$cshowsPrec :: Int -> ExtraTableMetadata -> ShowS
Show, ExtraTableMetadata -> ExtraTableMetadata -> Bool
(ExtraTableMetadata -> ExtraTableMetadata -> Bool)
-> (ExtraTableMetadata -> ExtraTableMetadata -> Bool)
-> Eq ExtraTableMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExtraTableMetadata -> ExtraTableMetadata -> Bool
$c/= :: ExtraTableMetadata -> ExtraTableMetadata -> Bool
== :: ExtraTableMetadata -> ExtraTableMetadata -> Bool
$c== :: ExtraTableMetadata -> ExtraTableMetadata -> Bool
Eq, (forall x. ExtraTableMetadata -> Rep ExtraTableMetadata x)
-> (forall x. Rep ExtraTableMetadata x -> ExtraTableMetadata)
-> Generic ExtraTableMetadata
forall x. Rep ExtraTableMetadata x -> ExtraTableMetadata
forall x. ExtraTableMetadata -> Rep ExtraTableMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExtraTableMetadata x -> ExtraTableMetadata
$cfrom :: forall x. ExtraTableMetadata -> Rep ExtraTableMetadata x
Generic, Typeable)

instance Hashable ExtraTableMetadata

instance Cacheable ExtraTableMetadata

instance NFData ExtraTableMetadata

$(J.deriveJSON J.defaultOptions {J.constructorTagModifier = JC.snakeCase, J.fieldLabelModifier = JC.snakeCase} ''ExtraTableMetadata)