pg-schema
Safe HaskellNone
LanguageGHC2021

PgSchema.Import

Description

Shared import surface for generated schema modules only.

Do not import this module from handwritten application or library code.

pg-schema tooling emits a schema module (per database or slice) that imports PgSchema.Import to pull in the type classes, type families, and promoted data that describe your schema at compile time. That generated module is what your application should import alongside PgSchema.DML (and optionally PgSchema.Generation for the codegen executable).

PgSchema.Import is a thin re-export hub: it exists so generated files stay short and stable across pg-schema versions, and so the generator does not need to duplicate long import lists from internal modules. It is part of the package’s exposed-modules only so those generated modules (which live in your project, not inside this package) can depend on it via ordinary package imports.

If you import PgSchema.Import directly, you bypass the intended layering, gain no extra capability, and risk silent breakage when the re-export set changes. Treat it as an implementation detail of codegen output, not as a public API to build on.

Synopsis

CSchema class

class (ToStar (TTabs sch), ToStar (TTabRelFroms sch), ToStar (TTabRelTos sch), ToStar (TTabFldDefs sch), ToStar (TTabFlds sch), ToStar (TTabDefs sch), ToStar (TTypes sch), ToStar (Map1 (TTypDefSym1 sch) (TTypes sch))) => CSchema (sch :: k) Source #

The main class for schema. All DML operations are based on this class. It contains all the information about the schema: tables, relations, fields, types.

This class guarantees that we can demote all the necessary information about the schema from type level to value level.

Instances will be generated by code generation

Associated Types

type TTabs (sch :: k) :: [NameNSK] Source #

type TTypes (sch :: k) :: [NameNSK] Source #

Instances

Instances details
CSchema PgCatalog Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTabs PgCatalog 
Instance details

Defined in PgSchema.Schema.Catalog

type TTabs PgCatalog = '[PGC "pg_attribute", PGC "pg_class", PGC "pg_constraint", PGC "pg_enum", PGC "pg_namespace", PGC "pg_type"]
type TTypes PgCatalog 
Instance details

Defined in PgSchema.Schema.Catalog

type TTypes PgCatalog = '[PGC "oid", PGC "int2", PGC "int2[]", PGC "float4", PGC "bool", PGC "name", PGC "char"]

CTabDef class

class (ToStar name, ToStar (TTabDef sch name)) => CTabDef (sch :: k) (name :: NameNSK) Source #

instances will be generated by code generation

Associated Types

type TTabDef (sch :: k) (name :: NameNSK) :: TabDefK Source #

Instances

Instances details
CTabDef PgCatalog (PGC "pg_attribute") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTabDef PgCatalog (PGC "pg_attribute") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTabDef PgCatalog (PGC "pg_attribute") = 'TabDef '["oid", "attrelid", "attname", "atttypid", "attnum", "attnotnull", "atthasdef"] '["oid"] '['["attrelid", "attname"], '["attrelid", "attnum"]]
CTabDef PgCatalog (PGC "pg_class") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTabDef PgCatalog (PGC "pg_class") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTabDef PgCatalog (PGC "pg_class") = 'TabDef '["oid", "relnamespace", "relname", "relkind"] '["oid"] '['["relnamespace", "relname"]]
CTabDef PgCatalog (PGC "pg_constraint") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTabDef PgCatalog (PGC "pg_constraint") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTabDef PgCatalog (PGC "pg_constraint") = 'TabDef '["oid", "connamespace", "conname", "contype", "conrelid", "confrelid", "conkey", "confkey", "confupdtypeid", "confdeltypeid"] '["oid"] '['["connamespace", "conname"]]
CTabDef PgCatalog (PGC "pg_enum") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTabDef PgCatalog (PGC "pg_enum") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTabDef PgCatalog (PGC "pg_enum") = 'TabDef '["oid", "enumtypid", "enumlabel", "enumsortorder"] '["oid"] '['["enumtypid", "enumlabel"], '["enumtypid", "enumsortorder"]]
CTabDef PgCatalog (PGC "pg_namespace") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTabDef PgCatalog (PGC "pg_namespace") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTabDef PgCatalog (PGC "pg_namespace") = 'TabDef '["oid", "nspname"] '["oid"] '['["nspname"]]
CTabDef PgCatalog (PGC "pg_type") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTabDef PgCatalog (PGC "pg_type") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTabDef PgCatalog (PGC "pg_type") = 'TabDef '["oid", "typnamespace", "typname", "typcategory", "typelem"] '["oid"] '['["typnamespace", "typname"]]

data TabDef' s Source #

Table shape: ordered column names, primary key, unique constraints.

Constructors

TabDef 

Fields

  • tdFlds :: [s]

    Physical column names in order.

  • tdKey :: [s]

    Primary key column names.

  • tdUniq :: [[s]]

    Unique constraints as lists of column names.

Instances

Instances details
Show s => Show (TabDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

showsPrec :: Int -> TabDef' s -> ShowS #

show :: TabDef' s -> String #

showList :: [TabDef' s] -> ShowS #

SingKind s => SingKind (TabDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Associated Types

type Demote (TabDef' s) 
Instance details

Defined in PgSchema.Schema

type Demote (TabDef' s) = TabDef' (Demote s)

Methods

fromSing :: forall (a :: TabDef' s). Sing a -> Demote (TabDef' s) #

toSing :: Demote (TabDef' s) -> SomeSing (TabDef' s) #

SingI n => SingI2 ('TabDef n :: [s] -> [[s]] -> TabDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: [s]) (y :: [[s]]). Sing x -> Sing y -> Sing ('TabDef n x y) #

(SingI n1, SingI n2) => SingI1 ('TabDef n1 n2 :: [[s]] -> TabDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: [[s]]). Sing x -> Sing ('TabDef n1 n2 x) #

(SingI n1, SingI n2, SingI n3) => SingI ('TabDef n1 n2 n3 :: TabDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('TabDef n1 n2 n3) #

type Demote (TabDef' s) Source # 
Instance details

Defined in PgSchema.Schema

type Demote (TabDef' s) = TabDef' (Demote s)
type Sing Source # 
Instance details

Defined in PgSchema.Schema

type Sing

CDBFieldInfo class

class (ToStar (TDBFieldInfo sch tab name), ToStar tab, ToStar name) => CDBFieldInfo (sch :: k) (tab :: NameNSK) (name :: Symbol) Source #

Schema-level field kind for (sch, tab, field name). Instances are generated by codegen (Gen) or defined manually (e.g. Catalog).

Associated Types

type TDBFieldInfo (sch :: k) (tab :: NameNSK) (name :: Symbol) :: RecFieldK NameNSK Source #

Instances

Instances details
(ToStar (TDBFieldInfoPgCatalog t f), ToStar t, ToStar f) => CDBFieldInfo PgCatalog t f Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TDBFieldInfo PgCatalog t f 
Instance details

Defined in PgSchema.Schema.Catalog

data FldDef' s Source #

Column-level type and nullability/default flags.

Constructors

FldDef 

Fields

Instances

Instances details
SingI n => SingI2 ('FldDef n :: Bool -> Bool -> FldDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: Bool) (y :: Bool). Sing x -> Sing y -> Sing ('FldDef n x y) #

(SingI n1, SingI n2) => SingI2 ('Ref n1 n2 :: s -> FldDef' s -> Ref' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: s) (y :: FldDef' s). Sing x -> Sing y -> Sing ('Ref n1 n2 x y) #

(SingI n1, SingI n2) => SingI1 ('FldDef n1 n2 :: Bool -> FldDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: Bool). Sing x -> Sing ('FldDef n1 n2 x) #

Show s => Show (FldDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

showsPrec :: Int -> FldDef' s -> ShowS #

show :: FldDef' s -> String #

showList :: [FldDef' s] -> ShowS #

SingKind s => SingKind (FldDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Associated Types

type Demote (FldDef' s) 
Instance details

Defined in PgSchema.Schema

type Demote (FldDef' s) = FldDef' (Demote s)

Methods

fromSing :: forall (a :: FldDef' s). Sing a -> Demote (FldDef' s) #

toSing :: Demote (FldDef' s) -> SomeSing (FldDef' s) #

(SingI n1, SingI n2, SingI n3) => SingI1 ('Ref n1 n2 n3 :: FldDef' s -> Ref' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: FldDef' s). Sing x -> Sing ('Ref n1 n2 n3 x) #

SingI1 ('RFPlain :: FldDef' s -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: FldDef' s). Sing x -> Sing ('RFPlain x :: RecField' s p) #

(SingI n1, SingI n2, SingI n3) => SingI ('FldDef n1 n2 n3 :: FldDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('FldDef n1 n2 n3) #

type Demote (FldDef' s) Source # 
Instance details

Defined in PgSchema.Schema

type Demote (FldDef' s) = FldDef' (Demote s)
type Sing Source # 
Instance details

Defined in PgSchema.Schema

type Sing

data RelDef' s Source #

Foreign-key-style link between two qualified tables and column mapping.

Constructors

RelDef 

Fields

Instances

Instances details
Show s => Show (RelDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

showsPrec :: Int -> RelDef' s -> ShowS #

show :: RelDef' s -> String #

showList :: [RelDef' s] -> ShowS #

SingKind s => SingKind (RelDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Associated Types

type Demote (RelDef' s) 
Instance details

Defined in PgSchema.Schema

type Demote (RelDef' s) = RelDef' (Demote s)

Methods

fromSing :: forall (a :: RelDef' s). Sing a -> Demote (RelDef' s) #

toSing :: Demote (RelDef' s) -> SomeSing (RelDef' s) #

SingI n => SingI2 ('RelDef n :: NameNS' s -> [(s, s)] -> RelDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: NameNS' s) (y :: [(s, s)]). Sing x -> Sing y -> Sing ('RelDef n x y) #

(SingI n1, SingI n2) => SingI1 ('RelDef n1 n2 :: [(s, s)] -> RelDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: [(s, s)]). Sing x -> Sing ('RelDef n1 n2 x) #

(SingI n1, SingI n2, SingI n3) => SingI ('RelDef n1 n2 n3 :: RelDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('RelDef n1 n2 n3) #

type Demote (RelDef' s) Source # 
Instance details

Defined in PgSchema.Schema

type Demote (RelDef' s) = RelDef' (Demote s)
type Sing Source # 
Instance details

Defined in PgSchema.Schema

type Sing

CTypDef class

class (ToStar name, ToStar (TTypDef sch name)) => CTypDef (sch :: k) (name :: NameNSK) Source #

instances will be generated by code generation

Associated Types

type TTypDef (sch :: k) (name :: NameNSK) :: TypDefK Source #

Instances

Instances details
CTypDef PgCatalog (PGC "bool") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTypDef PgCatalog (PGC "bool") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTypDef PgCatalog (PGC "bool")
CTypDef PgCatalog (PGC "char") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTypDef PgCatalog (PGC "char") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTypDef PgCatalog (PGC "char")
CTypDef PgCatalog (PGC "float4") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTypDef PgCatalog (PGC "float4") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTypDef PgCatalog (PGC "float4")
CTypDef PgCatalog (PGC "int2") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTypDef PgCatalog (PGC "int2") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTypDef PgCatalog (PGC "int2")
CTypDef PgCatalog (PGC "int2[]") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTypDef PgCatalog (PGC "int2[]") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTypDef PgCatalog (PGC "int2[]") = 'TypDef "A" ('Just (PGC "int2")) ('[] :: [Symbol])
CTypDef PgCatalog (PGC "name") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTypDef PgCatalog (PGC "name") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTypDef PgCatalog (PGC "name")
CTypDef PgCatalog (PGC "oid") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TTypDef PgCatalog (PGC "oid") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTypDef PgCatalog (PGC "oid")

data TypDef' s Source #

Description of a PostgreSQL type (category, array element, enum labels).

Constructors

TypDef 

Fields

Instances

Instances details
Show s => Show (TypDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

showsPrec :: Int -> TypDef' s -> ShowS #

show :: TypDef' s -> String #

showList :: [TypDef' s] -> ShowS #

SingKind s => SingKind (TypDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Associated Types

type Demote (TypDef' s) 
Instance details

Defined in PgSchema.Schema

type Demote (TypDef' s) = TypDef' (Demote s)

Methods

fromSing :: forall (a :: TypDef' s). Sing a -> Demote (TypDef' s) #

toSing :: Demote (TypDef' s) -> SomeSing (TypDef' s) #

SingI n => SingI2 ('TypDef n :: Maybe (NameNS' s) -> [s] -> TypDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: Maybe (NameNS' s)) (y :: [s]). Sing x -> Sing y -> Sing ('TypDef n x y) #

(SingI n1, SingI n2) => SingI1 ('TypDef n1 n2 :: [s] -> TypDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: [s]). Sing x -> Sing ('TypDef n1 n2 x) #

(SingI n1, SingI n2, SingI n3) => SingI ('TypDef n1 n2 n3 :: TypDef' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('TypDef n1 n2 n3) #

type Demote (TypDef' s) Source # 
Instance details

Defined in PgSchema.Schema

type Demote (TypDef' s) = TypDef' (Demote s)
type Sing Source # 
Instance details

Defined in PgSchema.Schema

type Sing

RecField class

data RecField' s p Source #

Field of a logical record: plain column, aggregate, or relation hop.

Constructors

RFEmpty s

Placeholder / unnamed slot (depending on schema codegen).

RFPlain (FldDef' s)

Ordinary column with FldDef'.

RFAggr (FldDef' s) AggrFun Bool

Aggregate field: FldDef', which aggregate, and whether it is allowed outside GROUP BY (when True: any select; when False: only with GROUP BY).

RFToHere p [Ref' s]

Relation: navigate p toward the current table (“to here”).

RFFromHere p [Ref' s]

Relation: navigate p away from the current table (“from here”).

RFSelfRef p [Ref' s]

Self-referential relation through path p.

Instances

Instances details
SingI n => SingI2 ('RFAggr n :: AggrFun -> Bool -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: AggrFun) (y :: Bool). Sing x -> Sing y -> Sing ('RFAggr n x y :: RecField' s p) #

SingI2 ('RFFromHere :: k1 -> [Ref' s] -> RecField' s k1) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: k1) (y :: [Ref' s]). Sing x -> Sing y -> Sing ('RFFromHere x y) #

SingI2 ('RFSelfRef :: k1 -> [Ref' s] -> RecField' s k1) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: k1) (y :: [Ref' s]). Sing x -> Sing y -> Sing ('RFSelfRef x y) #

SingI2 ('RFToHere :: k1 -> [Ref' s] -> RecField' s k1) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: k1) (y :: [Ref' s]). Sing x -> Sing y -> Sing ('RFToHere x y) #

SingI1 ('RFEmpty :: k1 -> RecField' k1 p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: k1). Sing x -> Sing ('RFEmpty x :: RecField' k1 p) #

(SingI n1, SingI n2) => SingI1 ('RFAggr n1 n2 :: Bool -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: Bool). Sing x -> Sing ('RFAggr n1 n2 x :: RecField' s p) #

SingI1 ('RFPlain :: FldDef' s -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: FldDef' s). Sing x -> Sing ('RFPlain x :: RecField' s p) #

SingI n => SingI1 ('RFFromHere n :: [Ref' s] -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: [Ref' s]). Sing x -> Sing ('RFFromHere n x) #

SingI n => SingI1 ('RFSelfRef n :: [Ref' s] -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: [Ref' s]). Sing x -> Sing ('RFSelfRef n x) #

SingI n => SingI1 ('RFToHere n :: [Ref' s] -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: [Ref' s]). Sing x -> Sing ('RFToHere n x) #

(Show s, Show p) => Show (RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

showsPrec :: Int -> RecField' s p -> ShowS #

show :: RecField' s p -> String #

showList :: [RecField' s p] -> ShowS #

(SingKind s, SingKind p) => SingKind (RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Associated Types

type Demote (RecField' s p) 
Instance details

Defined in PgSchema.Schema

type Demote (RecField' s p) = RecField' (Demote s) (Demote p)

Methods

fromSing :: forall (a :: RecField' s p). Sing a -> Demote (RecField' s p) #

toSing :: Demote (RecField' s p) -> SomeSing (RecField' s p) #

SingI n => SingI ('RFEmpty n :: RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('RFEmpty n :: RecField' s p) #

SingI n => SingI ('RFPlain n :: RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('RFPlain n :: RecField' s p) #

(SingI n1, SingI n2) => SingI ('RFFromHere n1 n2 :: RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('RFFromHere n1 n2) #

(SingI n1, SingI n2) => SingI ('RFSelfRef n1 n2 :: RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('RFSelfRef n1 n2) #

(SingI n1, SingI n2) => SingI ('RFToHere n1 n2 :: RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('RFToHere n1 n2) #

(SingI n1, SingI n2, SingI n3) => SingI ('RFAggr n1 n2 n3 :: RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('RFAggr n1 n2 n3 :: RecField' s p) #

type Demote (RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

type Demote (RecField' s p) = RecField' (Demote s) (Demote p)
type Sing Source # 
Instance details

Defined in PgSchema.Schema

type Sing

data Ref' s Source #

One step of a join path: source column, types, target column.

Constructors

Ref 

Fields

Instances

Instances details
(SingI n1, SingI n2) => SingI2 ('Ref n1 n2 :: s -> FldDef' s -> Ref' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: s) (y :: FldDef' s). Sing x -> Sing y -> Sing ('Ref n1 n2 x y) #

SingI2 ('RFFromHere :: k1 -> [Ref' s] -> RecField' s k1) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: k1) (y :: [Ref' s]). Sing x -> Sing y -> Sing ('RFFromHere x y) #

SingI2 ('RFSelfRef :: k1 -> [Ref' s] -> RecField' s k1) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: k1) (y :: [Ref' s]). Sing x -> Sing y -> Sing ('RFSelfRef x y) #

SingI2 ('RFToHere :: k1 -> [Ref' s] -> RecField' s k1) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing2 :: forall (x :: k1) (y :: [Ref' s]). Sing x -> Sing y -> Sing ('RFToHere x y) #

Show s => Show (Ref' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

showsPrec :: Int -> Ref' s -> ShowS #

show :: Ref' s -> String #

showList :: [Ref' s] -> ShowS #

SingKind s => SingKind (Ref' s) Source # 
Instance details

Defined in PgSchema.Schema

Associated Types

type Demote (Ref' s) 
Instance details

Defined in PgSchema.Schema

type Demote (Ref' s) = Ref' (Demote s)

Methods

fromSing :: forall (a :: Ref' s). Sing a -> Demote (Ref' s) #

toSing :: Demote (Ref' s) -> SomeSing (Ref' s) #

(SingI n1, SingI n2, SingI n3) => SingI1 ('Ref n1 n2 n3 :: FldDef' s -> Ref' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: FldDef' s). Sing x -> Sing ('Ref n1 n2 n3 x) #

SingI n => SingI1 ('RFFromHere n :: [Ref' s] -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: [Ref' s]). Sing x -> Sing ('RFFromHere n x) #

SingI n => SingI1 ('RFSelfRef n :: [Ref' s] -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: [Ref' s]). Sing x -> Sing ('RFSelfRef n x) #

SingI n => SingI1 ('RFToHere n :: [Ref' s] -> RecField' s p) Source # 
Instance details

Defined in PgSchema.Schema

Methods

liftSing :: forall (x :: [Ref' s]). Sing x -> Sing ('RFToHere n x) #

(SingI n1, SingI n2, SingI n3, SingI n4) => SingI ('Ref n1 n2 n3 n4 :: Ref' s) Source # 
Instance details

Defined in PgSchema.Schema

Methods

sing :: Sing ('Ref n1 n2 n3 n4) #

type Demote (Ref' s) Source # 
Instance details

Defined in PgSchema.Schema

type Demote (Ref' s) = Ref' (Demote s)
type Sing Source # 
Instance details

Defined in PgSchema.Schema

type Sing

TRelDef type family

class (ToStar (TRelDef sch ref), CTabDef sch (RdFrom (TRelDef sch ref)), CTabDef sch (RdTo (TRelDef sch ref))) => CRelDef (sch :: k) (ref :: NameNSK) Source #

Relation definition for relation name ref.

Associated Types

type TRelDef (sch :: k) (ref :: NameNSK) :: RelDefK Source #

Instances

Instances details
CRelDef PgCatalog (PGC "attribute__class") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TRelDef PgCatalog (PGC "attribute__class") 
Instance details

Defined in PgSchema.Schema.Catalog

type TRelDef PgCatalog (PGC "attribute__class") = 'RelDef (PGC "pg_attribute") (PGC "pg_class") '['("attrelid", "oid")]
CRelDef PgCatalog (PGC "attribute__type") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TRelDef PgCatalog (PGC "attribute__type") 
Instance details

Defined in PgSchema.Schema.Catalog

type TRelDef PgCatalog (PGC "attribute__type") = 'RelDef (PGC "pg_attribute") (PGC "pg_type") '['("atttypid", "oid")]
CRelDef PgCatalog (PGC "class__namespace") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TRelDef PgCatalog (PGC "class__namespace") 
Instance details

Defined in PgSchema.Schema.Catalog

type TRelDef PgCatalog (PGC "class__namespace") = 'RelDef (PGC "pg_class") (PGC "pg_namespace") '['("relnamespace", "oid")]
CRelDef PgCatalog (PGC "constraint__class") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TRelDef PgCatalog (PGC "constraint__class") 
Instance details

Defined in PgSchema.Schema.Catalog

type TRelDef PgCatalog (PGC "constraint__class") = 'RelDef (PGC "pg_constraint") (PGC "pg_class") '['("conrelid", "oid")]
CRelDef PgCatalog (PGC "constraint__fclass") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TRelDef PgCatalog (PGC "constraint__fclass") 
Instance details

Defined in PgSchema.Schema.Catalog

type TRelDef PgCatalog (PGC "constraint__fclass") = 'RelDef (PGC "pg_constraint") (PGC "pg_class") '['("confrelid", "oid")]
CRelDef PgCatalog (PGC "constraint__namespace") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TRelDef PgCatalog (PGC "constraint__namespace") 
Instance details

Defined in PgSchema.Schema.Catalog

type TRelDef PgCatalog (PGC "constraint__namespace") = 'RelDef (PGC "pg_constraint") (PGC "pg_namespace") '['("connamespace", "oid")]
CRelDef PgCatalog (PGC "enum__type") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TRelDef PgCatalog (PGC "enum__type") 
Instance details

Defined in PgSchema.Schema.Catalog

type TRelDef PgCatalog (PGC "enum__type") = 'RelDef (PGC "pg_enum") (PGC "pg_type") '['("enumtypid", "oid")]
CRelDef PgCatalog (PGC "type__namespace") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TRelDef PgCatalog (PGC "type__namespace") 
Instance details

Defined in PgSchema.Schema.Catalog

type TRelDef PgCatalog (PGC "type__namespace") = 'RelDef (PGC "pg_type") (PGC "pg_namespace") '['("typnamespace", "oid")]

CTabRels class

class CTabRels (sch :: k) (tab :: NameNSK) Source #

Associated Types

type TFrom (sch :: k) (tab :: NameNSK) :: [NameNSK] Source #

type TTo (sch :: k) (tab :: NameNSK) :: [NameNSK] Source #

Instances

Instances details
CTabRels PgCatalog (PGC "pg_attribute") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TFrom PgCatalog (PGC "pg_attribute") 
Instance details

Defined in PgSchema.Schema.Catalog

type TFrom PgCatalog (PGC "pg_attribute") = '[PGC "attribute__class", PGC "attribute__type"]
type TTo PgCatalog (PGC "pg_attribute") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTo PgCatalog (PGC "pg_attribute") = '[] :: [NameNSK]
CTabRels PgCatalog (PGC "pg_class") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TFrom PgCatalog (PGC "pg_class") 
Instance details

Defined in PgSchema.Schema.Catalog

type TFrom PgCatalog (PGC "pg_class") = '[PGC "class__namespace"]
type TTo PgCatalog (PGC "pg_class") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTo PgCatalog (PGC "pg_class") = '[PGC "attribute__class", PGC "constraint__class", PGC "constraint__fclass"]
CTabRels PgCatalog (PGC "pg_constraint") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TFrom PgCatalog (PGC "pg_constraint") 
Instance details

Defined in PgSchema.Schema.Catalog

type TFrom PgCatalog (PGC "pg_constraint") = '[PGC "constraint__class", PGC "constraint__fclass", PGC "constraint__namespace"]
type TTo PgCatalog (PGC "pg_constraint") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTo PgCatalog (PGC "pg_constraint") = '[] :: [NameNSK]
CTabRels PgCatalog (PGC "pg_enum") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TFrom PgCatalog (PGC "pg_enum") 
Instance details

Defined in PgSchema.Schema.Catalog

type TFrom PgCatalog (PGC "pg_enum") = '[PGC "enum__type"]
type TTo PgCatalog (PGC "pg_enum") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTo PgCatalog (PGC "pg_enum") = '[] :: [NameNSK]
CTabRels PgCatalog (PGC "pg_namespace") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TFrom PgCatalog (PGC "pg_namespace") 
Instance details

Defined in PgSchema.Schema.Catalog

type TFrom PgCatalog (PGC "pg_namespace") = '[] :: [NameNSK]
type TTo PgCatalog (PGC "pg_namespace") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTo PgCatalog (PGC "pg_namespace") = '[PGC "type__namespace", PGC "class__namespace", PGC "constraint__namespace"]
CTabRels PgCatalog (PGC "pg_type") Source # 
Instance details

Defined in PgSchema.Schema.Catalog

Associated Types

type TFrom PgCatalog (PGC "pg_type") 
Instance details

Defined in PgSchema.Schema.Catalog

type TFrom PgCatalog (PGC "pg_type") = '[PGC "type__namespace"]
type TTo PgCatalog (PGC "pg_type") 
Instance details

Defined in PgSchema.Schema.Catalog

type TTo PgCatalog (PGC "pg_type") = '[PGC "enum__type", PGC "attribute__type"]

PGEnum type

data family PGEnum sch (name :: NameNSK) Source #

Introduce enum database types. Data instances are produced by schema generation. You can use these data instances in you records to SELECTINSERTUPSERT data

Instances

Instances details
(Read (PGEnum sch t), ToStar t) => FromJSON (PGEnum sch t) Source # 
Instance details

Defined in PgSchema.Types

Methods

parseJSON :: Value -> Parser (PGEnum sch t) #

parseJSONList :: Value -> Parser [PGEnum sch t] #

omittedField :: Maybe (PGEnum sch t) #

(Show (PGEnum sch t), ToStar t) => ToJSON (PGEnum sch t) Source # 
Instance details

Defined in PgSchema.Types

Methods

toJSON :: PGEnum sch t -> Value #

toEncoding :: PGEnum sch t -> Encoding #

toJSONList :: [PGEnum sch t] -> Value #

toEncodingList :: [PGEnum sch t] -> Encoding #

omitField :: PGEnum sch t -> Bool #

(Read (PGEnum sch n), ToStar n, Typeable sch, Typeable n) => FromField (PGEnum sch n) Source # 
Instance details

Defined in PgSchema.Types

Methods

fromField :: FieldParser (PGEnum sch n) #

(Show (PGEnum sch n), ToStar n) => ToField (PGEnum sch n) Source # 
Instance details

Defined in PgSchema.Types

Methods

toField :: PGEnum sch n -> Action #

type CanConvert1 sch tab fld n ('TypDef "E" ('Nothing :: Maybe (NameNS' Symbol)) es) (PGEnum sch n) Source # 
Instance details

Defined in PgSchema.Types

type CanConvert1 sch tab fld n ('TypDef "E" ('Nothing :: Maybe (NameNS' Symbol)) es) (PGEnum sch n)

NameNS type classes

type (->>) (ns :: s) (name :: s) = 'NameNS ns name infixr 9 Source #

type ToStar (a :: k) = (SingKind (KindOf a), SingI a) Source #