Copyright | (c) Soostone Inc 2020 |
---|---|
License | AllRightsReserved |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
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 :: (MonadNapkin b m, HasPostgresConn b) => b -> BackendConn b -> Set Prefix -> m (Set ListedTable)
- query :: (Katip m, RenderSql q b, HasPostgresConn b) => b -> BackendConn b -> q -> m [Map Text Value]
- query' :: forall r b q m. (Katip m, RenderSql q b, HasPostgresConn b, FromRow r) => b -> BackendConn b -> q -> m [r]
- execute :: (Katip m, RenderSql q b, HasPostgresConn b) => b -> BackendConn b -> q -> m Int64
- obtainTableKind :: (MonadNapkin b m, HasPostgresConn b) => b -> BackendConn b -> GetTableKind -> m TableKind
- annotate :: (MonadNapkin b m, HasPostgresConn b, RenderSql AnnotateTableOrView b) => b -> BackendConn b -> AnnotateCommand -> m ()
- readAnnotations :: (MonadNapkin b m, HasPostgresConn b) => b -> BackendConn b -> ReadAnnotationCommand -> m TableAnnotations
- perform :: (Katip m, RenderSql q b, HasPostgresConn b) => (Connection -> Query -> IO r) -> Text -> b -> BackendConn b -> q -> m r
- getDefaultSchema :: (MonadNapkin bk m, HasPostgresConn bk) => bk -> BackendConn bk -> m Name
- checkTableExists :: (MonadNapkin bk m, HasPostgresConn bk) => bk -> BackendConn bk -> Ref Table -> m Bool
- normalizedTableMap :: (MonadNapkin bk m, HasPostgresConn bk) => bk -> BackendConn bk -> Set (Ref Table) -> m (Map (Ref Table) NormalizedTable)
- qry_checkTable :: SrcLitStr -> SrcLitStr -> Q ()
- data PGSchemaField = PGSchemaField {}
- relationSchema :: forall bk f viewMeta. (HasPostgresConn bk, viewMeta ~ BackendViewMeta bk, Command DropView () bk, RenderSql DropView bk, Command (CreateView viewMeta) () bk, MonadNapkin bk f, Default viewMeta) => bk -> BackendConn bk -> Relation -> Ref Table -> f [PGSchemaField]
- refFqTable :: Ref a -> (String, String)
- getPostgresSchema :: (MonadNapkin b m, HasPostgresConn b) => b -> BackendConn b -> (String, String) -> m [PGSchemaField]
- renameTableAndMoveSchema :: (MonadNapkin bk m, RenderSql SetTableSchema bk, HasPostgresConn bk, RenderSql RenameTable bk) => bk -> BackendConn bk -> RenameTable -> m ()
- tellRowsAffected :: (HasBackendQueryStats bk, LocalQueryStats bk m) => bk -> Int64 -> m ()
- fieldTypeByName :: Text -> Type
Documentation
newtype PrettySqlError #
Instances
Exception PrettySqlError # | |
Defined in Napkin.Run.PGCommon | |
Show PrettySqlError # | |
Defined in Napkin.Run.PGCommon showsPrec :: Int -> PrettySqlError -> ShowS # show :: PrettySqlError -> String # showList :: [PrettySqlError] -> ShowS # |
Named | |
|
class HasPostgresConn a where #
getPostgresConn :: BackendConn a -> Pool Connection #
Instances
HasPostgresConn Postgres # | |
Defined in Napkin.Run.Postgres | |
HasPostgresConn Redshift # | |
Defined in Napkin.Run.Redshift |
listTables :: (MonadNapkin b m, HasPostgresConn b) => b -> BackendConn b -> Set Prefix -> m (Set ListedTable) #
query :: (Katip m, RenderSql q b, HasPostgresConn b) => b -> BackendConn b -> q -> m [Map Text Value] #
query' :: forall r b q m. (Katip m, RenderSql q b, HasPostgresConn b, FromRow r) => b -> BackendConn b -> q -> m [r] #
execute :: (Katip m, RenderSql q b, HasPostgresConn b) => b -> BackendConn b -> q -> m Int64 #
obtainTableKind :: (MonadNapkin b m, HasPostgresConn b) => b -> BackendConn b -> GetTableKind -> m TableKind #
annotate :: (MonadNapkin b m, HasPostgresConn b, RenderSql AnnotateTableOrView b) => b -> BackendConn b -> AnnotateCommand -> m () #
readAnnotations :: (MonadNapkin b m, HasPostgresConn b) => b -> BackendConn b -> ReadAnnotationCommand -> m TableAnnotations #
perform :: (Katip m, RenderSql q b, HasPostgresConn b) => (Connection -> Query -> IO r) -> Text -> b -> BackendConn b -> q -> m r #
getDefaultSchema :: (MonadNapkin bk m, HasPostgresConn bk) => bk -> BackendConn bk -> m Name #
:: (MonadNapkin bk m, HasPostgresConn bk) | |
=> bk | |
-> BackendConn bk | |
-> Ref Table | table |
-> m Bool |
Check if tableviewrelation exists. Schema is inferred if Ref contains multiple segments.
normalizedTableMap :: (MonadNapkin bk m, HasPostgresConn bk) => bk -> BackendConn bk -> Set (Ref Table) -> m (Map (Ref Table) NormalizedTable) #
qry_checkTable :: SrcLitStr -> SrcLitStr -> Q () #
Check if tableviewrelation exists in given schema.
http://stackoverflow.com/questions/20582500/how-to-check-if-a-table-exists-in-a-given-schema
data PGSchemaField #
Instances
Show PGSchemaField # | |
Defined in Napkin.Run.PGCommon showsPrec :: Int -> PGSchemaField -> ShowS # show :: PGSchemaField -> String # showList :: [PGSchemaField] -> ShowS # | |
Eq PGSchemaField # | |
Defined in Napkin.Run.PGCommon (==) :: PGSchemaField -> PGSchemaField -> Bool # (/=) :: PGSchemaField -> PGSchemaField -> Bool # | |
FromRow PGSchemaField # | |
Defined in Napkin.Run.PGCommon |
relationSchema :: forall bk f viewMeta. (HasPostgresConn bk, viewMeta ~ BackendViewMeta bk, Command DropView () bk, RenderSql DropView bk, Command (CreateView viewMeta) () bk, MonadNapkin bk f, Default viewMeta) => bk -> BackendConn bk -> Relation -> Ref Table -> f [PGSchemaField] #
Introspect schema of a Relation
refFqTable :: Ref a -> (String, String) #
getPostgresSchema :: (MonadNapkin b m, HasPostgresConn b) => b -> BackendConn b -> (String, String) -> m [PGSchemaField] #
renameTableAndMoveSchema :: (MonadNapkin bk m, RenderSql SetTableSchema bk, HasPostgresConn bk, RenderSql RenameTable bk) => bk -> BackendConn bk -> RenameTable -> m () #
tellRowsAffected :: (HasBackendQueryStats bk, LocalQueryStats bk m) => bk -> Int64 -> m () #
fieldTypeByName :: Text -> Type #