napkin-0.5.8
Copyright(c) Soostone Inc 2020
LicenseAllRightsReserved
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Napkin.Render.Types

Description

 
Synopsis

Documentation

sqlToFile :: RenderSql a b => b -> a -> FilePath -> IO () #

Render to a local SQL file, mainly for debugging/devel help.

sqlToFileCollapsed :: RenderSql a b => b -> a -> FilePath -> IO () #

printSql :: RenderSql a b => b -> a -> IO () #

renderSql' :: RenderSql a b => b -> a -> String #

renderSqlWith :: RenderSql a b => Style -> b -> a -> String #

renderSqlCollapsed :: RenderSql a b => b -> a -> String #

class RenderSql a backend where #

If one day we support multiple backends, one option would be for this typeclass to take a (Proxy backend) argument to dispatch on the right backend.

Methods

renderSql :: backend -> a -> Doc #

Instances

Instances details
RenderSql String Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> String -> Doc #

RenderSql String Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> String -> Doc #

RenderSql String Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> String -> Doc #

RenderSql String BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

Methods

renderSql :: BigQuery -> String -> Doc #

RenderSql Query Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> Query -> Doc #

RenderSql Query Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> Query -> Doc #

RenderSql Query Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> Query -> Doc #

RenderSql Query BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

Methods

renderSql :: BigQuery -> Query -> Doc #

RenderSql From Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> From -> Doc #

RenderSql From Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> From -> Doc #

RenderSql From Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> From -> Doc #

RenderSql From BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

Methods

renderSql :: BigQuery -> From -> Doc #

RenderSql Relation Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> Relation -> Doc #

RenderSql Relation Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> Relation -> Doc #

RenderSql Relation Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> Relation -> Doc #

RenderSql Relation BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

Methods

renderSql :: BigQuery -> Relation -> Doc #

RenderSql SExp Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> SExp -> Doc #

RenderSql SExp Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> SExp -> Doc #

RenderSql SExp Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> SExp -> Doc #

RenderSql SExp BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

Methods

renderSql :: BigQuery -> SExp -> Doc #

RenderSql Grant Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> Grant -> Doc #

RenderSql Grant Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> Grant -> Doc #

RenderSql Actor Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> Actor -> Doc #

RenderSql Actor Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> Actor -> Doc #

RenderSql Object Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> Object -> Doc #

RenderSql Object Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> Object -> Doc #

RenderSql Object Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> Object -> Doc #

RenderSql Privilege Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> Privilege -> Doc #

RenderSql Privilege Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> Privilege -> Doc #

RenderSql ML_Predict BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

RenderSql CreateModel BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

RenderSql ModelOptions BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

RenderSql ModelType BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

Methods

renderSql :: BigQuery -> ModelType -> Doc #

RenderSql Replacement BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

RenderSql DeleteFrom Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> DeleteFrom -> Doc #

RenderSql DeleteFrom Redshift # 
Instance details

Defined in Napkin.Render.Redshift

RenderSql DeleteFrom Postgres # 
Instance details

Defined in Napkin.Render.Postgres

RenderSql DeleteFrom BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

RenderSql InsertIntoQuery Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

RenderSql InsertIntoQuery Redshift # 
Instance details

Defined in Napkin.Render.Redshift

RenderSql InsertIntoQuery Postgres # 
Instance details

Defined in Napkin.Render.Postgres

RenderSql InsertIntoQuery BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

RenderSql DropTable Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> DropTable -> Doc #

RenderSql DropTable Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> DropTable -> Doc #

RenderSql DropTable Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> DropTable -> Doc #

RenderSql DropView Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> DropView -> Doc #

RenderSql DropView Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> DropView -> Doc #

RenderSql DropView Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> DropView -> Doc #

RenderSql CreateViewAs Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

RenderSql CreateViewAs Redshift # 
Instance details

Defined in Napkin.Render.Redshift

RenderSql CreateViewAs Postgres # 
Instance details

Defined in Napkin.Render.Postgres

RenderSql CreateViewAs BigQuery #

Debug the underlying query; BigQuery can't create views via SQL.

Instance details

Defined in Napkin.Render.BigQuery

RenderSql RenameTable Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> RenameTable -> Doc #

RenderSql RenameTable Redshift # 
Instance details

Defined in Napkin.Render.Redshift

RenderSql RenameTable Postgres # 
Instance details

Defined in Napkin.Render.Postgres

RenderSql SortKey Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> SortKey -> Doc #

RenderSql SortStyle Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> SortStyle -> Doc #

RenderSql DistStyle Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> DistStyle -> Doc #

RenderSql (Alias SExp) backend => RenderSql [Alias SExp] backend # 
Instance details

Defined in Napkin.Render.Common

Methods

renderSql :: backend -> [Alias SExp] -> Doc #

RenderSql a backend => RenderSql (Maybe a) backend # 
Instance details

Defined in Napkin.Render.Types

Methods

renderSql :: backend -> Maybe a -> Doc #

RenderSql a Sqlite => RenderSql (Alias a) Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> Alias a -> Doc #

RenderSql a Redshift => RenderSql (Alias a) Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> Alias a -> Doc #

RenderSql a Postgres => RenderSql (Alias a) Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> Alias a -> Doc #

RenderSql a BigQuery => RenderSql (Alias a) BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

Methods

renderSql :: BigQuery -> Alias a -> Doc #

RenderSql Query backend => RenderSql (Q a) backend #

Monadic query interface

Instance details

Defined in Napkin.Render.Types

Methods

renderSql :: backend -> Q a -> Doc #

RenderSql (CreateTableAs ()) Sqlite #

Commands

Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> CreateTableAs () -> Doc #

RenderSql (CreateTableAs ()) Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> CreateTableAs () -> Doc #

RenderSql (CreateTableAs ()) Postgres #

Commands

Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> CreateTableAs () -> Doc #

RenderSql (CreateTableAs ()) BigQuery #

Debug the underlying query; BigQuery can't create tables via SQL.

Instance details

Defined in Napkin.Render.BigQuery

Methods

renderSql :: BigQuery -> CreateTableAs () -> Doc #

RenderSql (CreateTableAs TableMeta) Redshift #

Commands

Instance details

Defined in Napkin.Render.Redshift

RenderSql (CreateTableAs TableMeta) BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

RenderSql (Ref t) Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

Methods

renderSql :: Sqlite -> Ref t -> Doc #

RenderSql (Ref t) Redshift # 
Instance details

Defined in Napkin.Render.Redshift

Methods

renderSql :: Redshift -> Ref t -> Doc #

RenderSql (Ref t) Postgres # 
Instance details

Defined in Napkin.Render.Postgres

Methods

renderSql :: Postgres -> Ref t -> Doc #

RenderSql (Ref t) BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

Methods

renderSql :: BigQuery -> Ref t -> Doc #

class CommandDescr a backend where #

Methods

commandDescr :: backend -> a -> String #

Instances

Instances details
CommandDescr Grant Redshift # 
Instance details

Defined in Napkin.Render.Redshift

CommandDescr Grant Postgres # 
Instance details

Defined in Napkin.Render.Postgres

CommandDescr DeleteFrom Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

CommandDescr DeleteFrom Redshift # 
Instance details

Defined in Napkin.Render.Redshift

CommandDescr DeleteFrom Postgres # 
Instance details

Defined in Napkin.Render.Postgres

CommandDescr DeleteFrom BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

CommandDescr InsertIntoQuery Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

CommandDescr InsertIntoQuery Redshift # 
Instance details

Defined in Napkin.Render.Redshift

CommandDescr InsertIntoQuery Postgres # 
Instance details

Defined in Napkin.Render.Postgres

CommandDescr InsertIntoQuery BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

CommandDescr DropTable Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

CommandDescr DropTable Redshift # 
Instance details

Defined in Napkin.Render.Redshift

CommandDescr DropTable Postgres # 
Instance details

Defined in Napkin.Render.Postgres

CommandDescr DropTable BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

CommandDescr DropView Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

CommandDescr DropView Redshift # 
Instance details

Defined in Napkin.Render.Redshift

CommandDescr DropView Postgres # 
Instance details

Defined in Napkin.Render.Postgres

CommandDescr DropView BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

CommandDescr CreateViewAs Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

CommandDescr CreateViewAs Redshift # 
Instance details

Defined in Napkin.Render.Redshift

CommandDescr CreateViewAs Postgres # 
Instance details

Defined in Napkin.Render.Postgres

CommandDescr CreateViewAs BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

CommandDescr RenameTable Sqlite # 
Instance details

Defined in Napkin.Render.Sqlite

CommandDescr RenameTable Redshift # 
Instance details

Defined in Napkin.Render.Redshift

CommandDescr RenameTable Postgres # 
Instance details

Defined in Napkin.Render.Postgres

CommandDescr (CreateTableAs ()) Sqlite #

Command descriptions

Instance details

Defined in Napkin.Render.Sqlite

CommandDescr (CreateTableAs ()) Redshift # 
Instance details

Defined in Napkin.Render.Redshift

CommandDescr (CreateTableAs ()) Postgres #

Command descriptions

Instance details

Defined in Napkin.Render.Postgres

CommandDescr (CreateTableAs ()) BigQuery # 
Instance details

Defined in Napkin.Render.BigQuery

CommandDescr (CreateTableAs TableMeta) Redshift #

Command descriptions

Instance details

Defined in Napkin.Render.Redshift

data RenderedSql #

Constructors

forall a backend.RenderSql a backend => RenderedSql backend a 

class ReplaceReference backend where #

Ability to hackishly replace references to a given table within a SQL string blob. Enables namespacing and we wouldn't need it if we could comprehensively parse each backend's SQL.

Minimal complete definition

Nothing

Methods

replaceReference #

Arguments

:: Proxy backend 
-> Ref Table

Search for this table

-> Ref Table

Replace with this table

-> Text

I give you a whole SQL blob fixer

-> Text 

Instances

Instances details
ReplaceReference Sqlite #

Reference replacement

Instance details

Defined in Napkin.Render.Sqlite

ReplaceReference Redshift #

Reference replacement

Instance details

Defined in Napkin.Render.Redshift

ReplaceReference Postgres #

Reference replacement

Instance details

Defined in Napkin.Render.Postgres

ReplaceReference BigQuery #

Reference replacement

Instance details

Defined in Napkin.Render.BigQuery