Safe Haskell | None |
---|---|
Language | GHC2024 |
Napkin.Run.PGCommon
Contents
Synopsis
- newtype PrettySqlError = PrettySqlError SqlError
- data Named a = Named {
- _namedName :: Text
- _namedItem :: a
- namedMap :: [Named a] -> Map Text a
- class HasPostgresConn a where
- getPostgresConn :: BackendConn a -> Pool Connection
- listTables :: (HasPostgresConn b, MonadNapkin b m) => Set Prefix -> BackendConn b -> m (Set ListedTable)
- query :: (HasPostgresConn b, MonadNapkin b m, RenderSql q b) => BackendConn b -> q -> m [Map Text Value]
- query' :: forall r b q m. (HasPostgresConn b, MonadNapkin b m, FromRow r, RenderSql q b) => BackendConn b -> q -> m [r]
- execute :: forall b q m. (HasPostgresConn b, MonadNapkin b m, RenderSql q b) => BackendConn b -> q -> m ()
- obtainTableKind :: (HasPostgresConn b, MonadNapkin b m) => BackendConn b -> Ref Table -> m TableKind
- annotate :: (HasPostgresConn b, MonadNapkin b m, RenderSql AnnotateTableOrView b) => BackendConn b -> Ref Table -> Annotation -> m ()
- readAnnotations :: (HasPostgresConn b, MonadNapkin b m) => BackendConn b -> Ref Table -> m TableAnnotations
- perform :: forall b q r m. (HasPostgresConn b, MonadNapkin b m, RenderSql q b) => (Connection -> Query -> IO r) -> Text -> BackendConn b -> q -> m r
- getDefaultSchema :: (HasPostgresConn bk, MonadNapkin bk m) => BackendConn bk -> m Name
- checkTableExists :: (HasPostgresConn bk, MonadNapkin bk m) => BackendConn bk -> Ref Table -> m Bool
- normalizedTableMap :: (HasPostgresConn bk, MonadNapkin bk m) => Set (Ref Table) -> BackendConn bk -> m (Map (Ref Table) NormalizedTable)
- data PGSchemaField = PGSchemaField {}
- relationSchema :: (Backend bk, Default (BackendMeta 'KindView bk), HasPostgresConn bk, MonadNapkin bk f, FromRow (BackendSchemaField bk), RenderSql (CreateRelation bk) bk, RenderSql DropRelation bk) => BackendConn bk -> Ref Table -> Relation -> f [BackendSchemaField bk]
- refFqTable :: forall {k} (a :: k). Ref a -> (Text, Text)
- getPostgresSchema :: (HasPostgresConn b, MonadNapkin b m, FromRow (BackendSchemaField b)) => BackendConn b -> (Text, Text) -> m [BackendSchemaField b]
- renameTableAndMoveSchema :: (HasPostgresConn bk, MonadNapkin bk m, RenderSql RenameRelation bk, RenderSql SetTableSchema bk) => BackendConn bk -> RenameRelation -> m ()
- tellRowsAffected :: forall {k} (bk :: k) m. MonadNapkin bk m => Proxy bk -> Int64 -> m ()
- fieldTypeByName :: Text -> Type
Documentation
newtype PrettySqlError #
Constructors
PrettySqlError SqlError |
Instances
Exception PrettySqlError # | |
Defined in Napkin.Run.PGCommon Methods toException :: PrettySqlError -> SomeException # fromException :: SomeException -> Maybe PrettySqlError # displayException :: PrettySqlError -> String # backtraceDesired :: PrettySqlError -> Bool # | |
Show PrettySqlError # | |
Defined in Napkin.Run.PGCommon Methods showsPrec :: Int -> PrettySqlError -> ShowS # show :: PrettySqlError -> String # showList :: [PrettySqlError] -> ShowS # |
Constructors
Named | |
Fields
|
class HasPostgresConn a where #
Methods
getPostgresConn :: BackendConn a -> Pool Connection #
Instances
HasPostgresConn Postgres # | |
Defined in Napkin.Run.Postgres Methods getPostgresConn :: BackendConn Postgres -> Pool Connection # | |
HasPostgresConn Redshift # | |
Defined in Napkin.Run.Redshift Methods getPostgresConn :: BackendConn Redshift -> Pool Connection # |
listTables :: (HasPostgresConn b, MonadNapkin b m) => Set Prefix -> BackendConn b -> m (Set ListedTable) #
query :: (HasPostgresConn b, MonadNapkin b m, RenderSql q b) => BackendConn b -> q -> m [Map Text Value] #
query' :: forall r b q m. (HasPostgresConn b, MonadNapkin b m, FromRow r, RenderSql q b) => BackendConn b -> q -> m [r] #
execute :: forall b q m. (HasPostgresConn b, MonadNapkin b m, RenderSql q b) => BackendConn b -> q -> m () #
obtainTableKind :: (HasPostgresConn b, MonadNapkin b m) => BackendConn b -> Ref Table -> m TableKind #
annotate :: (HasPostgresConn b, MonadNapkin b m, RenderSql AnnotateTableOrView b) => BackendConn b -> Ref Table -> Annotation -> m () #
readAnnotations :: (HasPostgresConn b, MonadNapkin b m) => BackendConn b -> Ref Table -> m TableAnnotations #
perform :: forall b q r m. (HasPostgresConn b, MonadNapkin b m, RenderSql q b) => (Connection -> Query -> IO r) -> Text -> BackendConn b -> q -> m r #
getDefaultSchema :: (HasPostgresConn bk, MonadNapkin bk m) => BackendConn bk -> m Name #
checkTableExists :: (HasPostgresConn bk, MonadNapkin bk m) => BackendConn bk -> Ref Table -> m Bool #
Check if tableviewrelation exists. Schema is inferred if Ref contains multiple segments.
normalizedTableMap :: (HasPostgresConn bk, MonadNapkin bk m) => Set (Ref Table) -> BackendConn bk -> m (Map (Ref Table) NormalizedTable) #
data PGSchemaField #
Constructors
PGSchemaField | |
Instances
Show PGSchemaField # | |
Defined in Napkin.Run.PGCommon Methods showsPrec :: Int -> PGSchemaField -> ShowS # show :: PGSchemaField -> String # showList :: [PGSchemaField] -> ShowS # | |
Eq PGSchemaField # | |
Defined in Napkin.Run.PGCommon Methods (==) :: PGSchemaField -> PGSchemaField -> Bool # (/=) :: PGSchemaField -> PGSchemaField -> Bool # | |
FromRow PGSchemaField # | |
Defined in Napkin.Run.PGCommon Methods |
relationSchema :: (Backend bk, Default (BackendMeta 'KindView bk), HasPostgresConn bk, MonadNapkin bk f, FromRow (BackendSchemaField bk), RenderSql (CreateRelation bk) bk, RenderSql DropRelation bk) => BackendConn bk -> Ref Table -> Relation -> f [BackendSchemaField bk] #
Introspect schema of a Relation
refFqTable :: forall {k} (a :: k). Ref a -> (Text, Text) #
getPostgresSchema :: (HasPostgresConn b, MonadNapkin b m, FromRow (BackendSchemaField b)) => BackendConn b -> (Text, Text) -> m [BackendSchemaField b] #
renameTableAndMoveSchema :: (HasPostgresConn bk, MonadNapkin bk m, RenderSql RenameRelation bk, RenderSql SetTableSchema bk) => BackendConn bk -> RenameRelation -> m () #
tellRowsAffected :: forall {k} (bk :: k) m. MonadNapkin bk m => Proxy bk -> Int64 -> m () #
fieldTypeByName :: Text -> Type #