{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ParallelListComp #-}
module PgSchema.Schema where
import Data.Kind
import Data.List as L
import Data.Map as M
import Data.Singletons
import Data.Singletons.TH
import Data.String
import Data.Text as T hiding (show)
import Data.Type.Bool
import Data.Type.Equality
import GHC.TypeLits
import PgSchema.Utils.Instances()
import PgSchema.Utils.Internal
import PgSchema.Utils.TF
data AggrFun = ACount | AMin | AMax | ASum | AAvg
deriving Int -> AggrFun -> ShowS
[AggrFun] -> ShowS
AggrFun -> String
(Int -> AggrFun -> ShowS)
-> (AggrFun -> String) -> ([AggrFun] -> ShowS) -> Show AggrFun
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AggrFun -> ShowS
showsPrec :: Int -> AggrFun -> ShowS
$cshow :: AggrFun -> String
show :: AggrFun -> String
$cshowList :: [AggrFun] -> ShowS
showList :: [AggrFun] -> ShowS
Show
data NameNS' s = NameNS
{ forall s. NameNS' s -> s
nnsNamespace :: s
, forall s. NameNS' s -> s
nnsName :: s
} deriving (Int -> NameNS' s -> ShowS
[NameNS' s] -> ShowS
NameNS' s -> String
(Int -> NameNS' s -> ShowS)
-> (NameNS' s -> String)
-> ([NameNS' s] -> ShowS)
-> Show (NameNS' s)
forall s. Show s => Int -> NameNS' s -> ShowS
forall s. Show s => [NameNS' s] -> ShowS
forall s. Show s => NameNS' s -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall s. Show s => Int -> NameNS' s -> ShowS
showsPrec :: Int -> NameNS' s -> ShowS
$cshow :: forall s. Show s => NameNS' s -> String
show :: NameNS' s -> String
$cshowList :: forall s. Show s => [NameNS' s] -> ShowS
showList :: [NameNS' s] -> ShowS
Show, NameNS' s -> NameNS' s -> Bool
(NameNS' s -> NameNS' s -> Bool)
-> (NameNS' s -> NameNS' s -> Bool) -> Eq (NameNS' s)
forall s. Eq s => NameNS' s -> NameNS' s -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall s. Eq s => NameNS' s -> NameNS' s -> Bool
== :: NameNS' s -> NameNS' s -> Bool
$c/= :: forall s. Eq s => NameNS' s -> NameNS' s -> Bool
/= :: NameNS' s -> NameNS' s -> Bool
Eq, Eq (NameNS' s)
Eq (NameNS' s) =>
(NameNS' s -> NameNS' s -> Ordering)
-> (NameNS' s -> NameNS' s -> Bool)
-> (NameNS' s -> NameNS' s -> Bool)
-> (NameNS' s -> NameNS' s -> Bool)
-> (NameNS' s -> NameNS' s -> Bool)
-> (NameNS' s -> NameNS' s -> NameNS' s)
-> (NameNS' s -> NameNS' s -> NameNS' s)
-> Ord (NameNS' s)
NameNS' s -> NameNS' s -> Bool
NameNS' s -> NameNS' s -> Ordering
NameNS' s -> NameNS' s -> NameNS' s
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall s. Ord s => Eq (NameNS' s)
forall s. Ord s => NameNS' s -> NameNS' s -> Bool
forall s. Ord s => NameNS' s -> NameNS' s -> Ordering
forall s. Ord s => NameNS' s -> NameNS' s -> NameNS' s
$ccompare :: forall s. Ord s => NameNS' s -> NameNS' s -> Ordering
compare :: NameNS' s -> NameNS' s -> Ordering
$c< :: forall s. Ord s => NameNS' s -> NameNS' s -> Bool
< :: NameNS' s -> NameNS' s -> Bool
$c<= :: forall s. Ord s => NameNS' s -> NameNS' s -> Bool
<= :: NameNS' s -> NameNS' s -> Bool
$c> :: forall s. Ord s => NameNS' s -> NameNS' s -> Bool
> :: NameNS' s -> NameNS' s -> Bool
$c>= :: forall s. Ord s => NameNS' s -> NameNS' s -> Bool
>= :: NameNS' s -> NameNS' s -> Bool
$cmax :: forall s. Ord s => NameNS' s -> NameNS' s -> NameNS' s
max :: NameNS' s -> NameNS' s -> NameNS' s
$cmin :: forall s. Ord s => NameNS' s -> NameNS' s -> NameNS' s
min :: NameNS' s -> NameNS' s -> NameNS' s
Ord)
data TypDef' s = TypDef
{ forall s. TypDef' s -> s
typCategory :: s
, forall s. TypDef' s -> Maybe (NameNS' s)
typElem :: Maybe (NameNS' s)
, forall s. TypDef' s -> [s]
typEnum :: [s]
} deriving Int -> TypDef' s -> ShowS
[TypDef' s] -> ShowS
TypDef' s -> String
(Int -> TypDef' s -> ShowS)
-> (TypDef' s -> String)
-> ([TypDef' s] -> ShowS)
-> Show (TypDef' s)
forall s. Show s => Int -> TypDef' s -> ShowS
forall s. Show s => [TypDef' s] -> ShowS
forall s. Show s => TypDef' s -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall s. Show s => Int -> TypDef' s -> ShowS
showsPrec :: Int -> TypDef' s -> ShowS
$cshow :: forall s. Show s => TypDef' s -> String
show :: TypDef' s -> String
$cshowList :: forall s. Show s => [TypDef' s] -> ShowS
showList :: [TypDef' s] -> ShowS
Show
data FldDef' s = FldDef
{ forall s. FldDef' s -> NameNS' s
fdType :: NameNS' s
, forall s. FldDef' s -> Bool
fdNullable :: Bool
, forall s. FldDef' s -> Bool
fdHasDefault :: Bool
} deriving Int -> FldDef' s -> ShowS
[FldDef' s] -> ShowS
FldDef' s -> String
(Int -> FldDef' s -> ShowS)
-> (FldDef' s -> String)
-> ([FldDef' s] -> ShowS)
-> Show (FldDef' s)
forall s. Show s => Int -> FldDef' s -> ShowS
forall s. Show s => [FldDef' s] -> ShowS
forall s. Show s => FldDef' s -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall s. Show s => Int -> FldDef' s -> ShowS
showsPrec :: Int -> FldDef' s -> ShowS
$cshow :: forall s. Show s => FldDef' s -> String
show :: FldDef' s -> String
$cshowList :: forall s. Show s => [FldDef' s] -> ShowS
showList :: [FldDef' s] -> ShowS
Show
data TabDef' s = TabDef
{ forall s. TabDef' s -> [s]
tdFlds :: [s]
, forall s. TabDef' s -> [s]
tdKey :: [s]
, forall s. TabDef' s -> [[s]]
tdUniq :: [[s]]
} deriving Int -> TabDef' s -> ShowS
[TabDef' s] -> ShowS
TabDef' s -> String
(Int -> TabDef' s -> ShowS)
-> (TabDef' s -> String)
-> ([TabDef' s] -> ShowS)
-> Show (TabDef' s)
forall s. Show s => Int -> TabDef' s -> ShowS
forall s. Show s => [TabDef' s] -> ShowS
forall s. Show s => TabDef' s -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall s. Show s => Int -> TabDef' s -> ShowS
showsPrec :: Int -> TabDef' s -> ShowS
$cshow :: forall s. Show s => TabDef' s -> String
show :: TabDef' s -> String
$cshowList :: forall s. Show s => [TabDef' s] -> ShowS
showList :: [TabDef' s] -> ShowS
Show
data RelDef' s = RelDef
{ forall s. RelDef' s -> NameNS' s
rdFrom :: NameNS' s
, forall s. RelDef' s -> NameNS' s
rdTo :: NameNS' s
, forall s. RelDef' s -> [(s, s)]
rdCols :: [(s, s)]
} deriving Int -> RelDef' s -> ShowS
[RelDef' s] -> ShowS
RelDef' s -> String
(Int -> RelDef' s -> ShowS)
-> (RelDef' s -> String)
-> ([RelDef' s] -> ShowS)
-> Show (RelDef' s)
forall s. Show s => Int -> RelDef' s -> ShowS
forall s. Show s => [RelDef' s] -> ShowS
forall s. Show s => RelDef' s -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall s. Show s => Int -> RelDef' s -> ShowS
showsPrec :: Int -> RelDef' s -> ShowS
$cshow :: forall s. Show s => RelDef' s -> String
show :: RelDef' s -> String
$cshowList :: forall s. Show s => [RelDef' s] -> ShowS
showList :: [RelDef' s] -> ShowS
Show
data RelType = RelOne | RelMany deriving Int -> RelType -> ShowS
[RelType] -> ShowS
RelType -> String
(Int -> RelType -> ShowS)
-> (RelType -> String) -> ([RelType] -> ShowS) -> Show RelType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RelType -> ShowS
showsPrec :: Int -> RelType -> ShowS
$cshow :: RelType -> String
show :: RelType -> String
$cshowList :: [RelType] -> ShowS
showList :: [RelType] -> ShowS
Show
data RecField' s p
= RFEmpty s
| RFPlain (FldDef' s)
| RFAggr (FldDef' s) AggrFun Bool
| RFToHere p [Ref' s]
| RFFromHere p [Ref' s]
| RFSelfRef p [Ref' s]
deriving Int -> RecField' s p -> ShowS
[RecField' s p] -> ShowS
RecField' s p -> String
(Int -> RecField' s p -> ShowS)
-> (RecField' s p -> String)
-> ([RecField' s p] -> ShowS)
-> Show (RecField' s p)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall s p. (Show s, Show p) => Int -> RecField' s p -> ShowS
forall s p. (Show s, Show p) => [RecField' s p] -> ShowS
forall s p. (Show s, Show p) => RecField' s p -> String
$cshowsPrec :: forall s p. (Show s, Show p) => Int -> RecField' s p -> ShowS
showsPrec :: Int -> RecField' s p -> ShowS
$cshow :: forall s p. (Show s, Show p) => RecField' s p -> String
show :: RecField' s p -> String
$cshowList :: forall s p. (Show s, Show p) => [RecField' s p] -> ShowS
showList :: [RecField' s p] -> ShowS
Show
data Ref' s = Ref
{ forall s. Ref' s -> s
fromName :: s
, forall s. Ref' s -> FldDef' s
fromDef :: FldDef' s
, forall s. Ref' s -> s
toName :: s
, forall s. Ref' s -> FldDef' s
toDef :: FldDef' s
} deriving Int -> Ref' s -> ShowS
[Ref' s] -> ShowS
Ref' s -> String
(Int -> Ref' s -> ShowS)
-> (Ref' s -> String) -> ([Ref' s] -> ShowS) -> Show (Ref' s)
forall s. Show s => Int -> Ref' s -> ShowS
forall s. Show s => [Ref' s] -> ShowS
forall s. Show s => Ref' s -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall s. Show s => Int -> Ref' s -> ShowS
showsPrec :: Int -> Ref' s -> ShowS
$cshow :: forall s. Show s => Ref' s -> String
show :: Ref' s -> String
$cshowList :: forall s. Show s => [Ref' s] -> ShowS
showList :: [Ref' s] -> ShowS
Show