Safe Haskell | None |
---|---|
Language | Haskell2010 |
Napkin.Types
Contents
Synopsis
- data Name
- nameString :: Name -> String
- _name :: Iso' String Name
- name :: String -> Name
- newtype Ref a = Ref {}
- class IsRef a where
- refComponentCount :: Ref a -> Int
- stringRefIso :: Iso' String (Ref a)
- refStringIso :: Iso' (Ref a) String
- stringRef :: String -> Ref a
- textRef :: Text -> Ref a
- nameRef :: Name -> Ref a
- namesRef :: [Name] -> Ref a
- refString :: Ref t -> String
- refText :: Ref t -> Text
- retagRef :: Ref t -> Ref a
- appendRef :: Ref a -> Name -> Ref a
- star :: SExp
- data Table
- data Function
- data Selected a = Selected {
- _selectRef :: Ref a
- _selectItem :: a
- data Alias a = Alias {
- _aliasRef :: Maybe (Ref a)
- _aliasItem :: a
- nonAlias :: a -> Alias a
- class WithName a where
- sa :: WithName a => Ref b -> b -> a b
- selectToAlias :: Selected a -> Alias a
- data Value
- newtype Interval = Interval {
- _unInterval :: [(SExp, DatePart)]
- data IntInterval = IntInterval SExp DatePart
- data SExp
- var :: Ref a -> SExp
- varString :: String -> SExp
- nil :: SExp
- data NullStrategy
- data Distinctness
- type Partition = [SExp]
- data WOver = WOver {}
- data WindowFun = SimpleWindow (Ref Function) [SExp] WOver (Maybe NullStrategy)
- data WindowFrame
- data FrameLength
- data FunModifier
- data ExternFun
- data Type
- data DatePart
- type Order = [OrderPart]
- type GroupBy = [SExp]
- data OrderDir
- invertOrder :: OrderDir -> OrderDir
- data NullOrder
- data OrderPart = OrderPart {}
- order :: SExp -> OrderPart
- data Relation
- table :: Ref a -> Relation
- data JoinType
- data From = From (Selected Relation) [(Selected Relation, JoinType, Either (Maybe SExp) [Ref SExp])]
- fromAliases :: From -> [Ref Relation]
- true :: SExp
- false :: SExp
- data UnionType
- data RawQuery = RawQuery {
- _rawQuery_deps :: [Ref Table]
- _rawQuery_raw :: String
- type WithClauses = OMap (Ref Query) (Selected Query)
- orderWithInserted :: WithClauses -> [(Ref Query, Selected Query)]
- data Query
- emptyQuery :: Query
- mkUnion :: UnionType -> [Query] -> Query
- collectUnionQueries :: Query -> NonEmpty Query
- data DefinedRelation = forall s.(AsRelation s, HasDefinition s) => DefinedRelation s
- data DefinedQuery = forall s.HasDefinition s => DefinedQuery s
- class AsRelation s where
- asRelation :: s -> Relation
- class HasDefinition s where
- class MaybeQuery s where
- queryFullySpecified :: Data a => a -> Bool
- opOrder :: Lens' OrderPart OrderDir
- opNulls :: Lens' OrderPart (Maybe NullOrder)
- opExp :: Lens' OrderPart SExp
- rawQuery_raw :: Lens' RawQuery String
- rawQuery_deps :: Lens' RawQuery [Ref Table]
- unionWiths :: Traversal' Query WithClauses
- unionType :: Traversal' Query UnionType
- unionQuery2 :: Traversal' Query Query
- unionQuery1 :: Traversal' Query Query
- queryWith :: Traversal' Query WithClauses
- queryWhere :: Traversal' Query (Maybe SExp)
- querySelect :: Traversal' Query [Alias SExp]
- queryOrder :: Traversal' Query Order
- queryOffset :: Traversal' Query (Maybe Int)
- queryLimit :: Traversal' Query (Maybe Int)
- queryHaving :: Traversal' Query (Maybe SExp)
- queryGroup :: Traversal' Query GroupBy
- queryFrom :: Traversal' Query (Maybe From)
- queryDistinct :: Traversal' Query Distinctness
- _QueryRaw :: Prism' Query RawQuery
- _Union :: Prism' Query (UnionType, Query, Query, WithClauses)
- _Query :: Prism' Query (WithClauses, [Alias SExp], Maybe From, Maybe SExp, Maybe SExp, GroupBy, Order, Maybe Int, Maybe Int, Distinctness)
- _From :: Iso' From (Selected Relation, [(Selected Relation, JoinType, Either (Maybe SExp) [Ref SExp])])
- _Star :: Prism' Name ()
- _Specific :: Prism' Name String
- _JoinOuter :: Prism' JoinType ()
- _JoinCross :: Prism' JoinType ()
- _JoinInner :: Prism' JoinType ()
- _JoinRight :: Prism' JoinType ()
- _JoinLeft :: Prism' JoinType ()
- _RawRelation :: Prism' Relation ([Ref Table], String)
- _ArrayRelation :: Prism' Relation SExp
- _QueryRelation :: Prism' Relation Query
- _TableRelation :: Prism' Relation (Ref Table)
- unRef :: forall a a. Iso (Ref a) (Ref a) (NonEmpty Name) (NonEmpty Name)
- _VArray :: Prism' Value [SExp]
- _VDatePart :: Prism' Value DatePart
- _VNull :: Prism' Value ()
- _VInterval :: Prism' Value Interval
- _VBinary :: Prism' Value ByteString
- _VText :: Prism' Value Text
- _VDateTime :: Prism' Value UTCTime
- _VDate :: Prism' Value Day
- _VBool :: Prism' Value Bool
- _VInt :: Prism' Value Int64
- _VDouble :: Prism' Value Double
- _Microsecond :: Prism' DatePart ()
- _Millisecond :: Prism' DatePart ()
- _Second :: Prism' DatePart ()
- _Minute :: Prism' DatePart ()
- _Hour :: Prism' DatePart ()
- _Day :: Prism' DatePart ()
- _DayOfYear :: Prism' DatePart ()
- _DayOfWeek :: Prism' DatePart ()
- _Week :: Prism' DatePart ()
- _Month :: Prism' DatePart ()
- _Quarter :: Prism' DatePart ()
- _Year :: Prism' DatePart ()
- _Epoch :: Prism' DatePart ()
- _Decade :: Prism' DatePart ()
- _Century :: Prism' DatePart ()
- _Millennium :: Prism' DatePart ()
- _SubQuery :: Prism' SExp Query
- _ExceptColumns :: Prism' SExp (SExp, [Ref SExp])
- _Case :: Prism' SExp ([(SExp, SExp)], SExp)
- _Extern :: Prism' SExp ExternFun
- _Var :: Prism' SExp (Ref SExp)
- _Lit :: Prism' SExp Value
- selectRef :: forall a. Lens' (Selected a) (Ref a)
- selectItem :: forall a. Lens' (Selected a) a
- aliasRef :: forall a. Lens' (Alias a) (Maybe (Ref a))
- aliasItem :: forall a. Lens' (Alias a) a
- overPartition :: Lens' WOver Partition
- overOrder :: Lens' WOver Order
- overFrame :: Lens' WOver (Maybe WindowFrame)
- class Val a where
- convS :: Lens' Text String
- integral :: (Integral a, Integral b) => Iso' a b
- _lit :: Val a => Prism' SExp a
- lit :: Val a => a -> SExp
- interval :: [(Double, DatePart)] -> SExp
- txt :: String -> SExp
- fullWindow :: WOver
- class TableRef a where
- relationRef :: TableRef a => Getter a Relation
- class HasDeps a where
- traverseDependencies :: Traversal' a (Ref Table)
- (^...) :: Ord a => s -> Getting (Endo (Set a)) s a -> Set a
- tableDependencies :: HasDeps s => s -> Set (Ref Table)
- queryDependencies :: Data s => Traversal' s (Ref Table)
- rawRelation :: HasDeps s => (s -> String) -> s -> Relation
- varAs :: Ref a -> Selected SExp
- asSelf :: SExp -> Selected SExp
- funAs :: (SExp -> b) -> Ref b -> Selected b
- selectToRef :: Selected SExp -> SExp
- selectedExps :: Traversal' [Selected a] a
- selectedNames :: Traversal' [Selected a0] String
- refName :: Traversal (Ref a) (Ref a1) String String
- refRoot :: Lens' (Ref a) Name
- refJustRoot :: Ref a -> Ref a
- refParentRoot :: Ref a -> ([String], Maybe String)
- ne :: Iso' [a] (NonEmpty a)
- selectedName :: Traversal' (Selected a) Name
- atAlias :: (Applicative f, Choice p) => Ref t -> Optic' p f (Alias t) (Alias t)
- aliasedNames :: HasDefinition s => Traversal' s (Ref SExp)
- scopeRefs :: Data b => Ref t -> b -> b
- modifyFromTables :: Data b => (Ref Table -> Ref Table) -> b -> b
- modifyExterns :: Data b => (ExternFun -> SExp) -> b -> b
- modifyFunctions :: Data b => (Ref Function -> Ref Function) -> b -> b
- (^^.) :: Ref Relation -> Name -> SExp
- data AggLevel
- data StatsType
- data TrackingQueryStats = TrackingQueryStats {}
- queryStatsForTable :: Ref Table -> TrackingQueryStats -> (Maybe QueryStats, Maybe QueryStats)
- totalQueryStatsForTable :: Ref Table -> TrackingQueryStats -> QueryStats
- totalQueryStats :: TrackingQueryStats -> QueryStats
- data QueryStats = QueryStats {
- _queryStats_rowsAffected :: !(Maybe Int64)
- _queryStats_bytesAffected :: !(Maybe Int64)
- _queryStats_cost :: !(Maybe Int64)
- _queryStats_time :: !(Maybe Int64)
- data QueryTransformer = QueryTransformer {}
- qt_refs :: Lens' QueryTransformer (Ref Table -> Ref Table)
- qt_query :: Lens' QueryTransformer (Query -> Query)
- qt_func :: Lens' QueryTransformer (Ref Function -> Ref Function)
- applyQueryTransformerQueries :: Data b => QueryTransformer -> b -> b
- applyQueryTransformerFunctions :: Data b => QueryTransformer -> b -> b
- applyQueryTransformerToRef :: Data b => QueryTransformer -> b -> b
- applyQueryTransformerToQuery :: QueryTransformer -> Query -> Query
Documentation
Copyright : (c) Soostone Inc, 2020 License : AllRightsReserved Stability : experimental Portability : POSIX
Instances
Eq Name # | |
Data Name # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name # dataTypeOf :: Name -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Name) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) # gmapT :: (forall b. Data b => b -> b) -> Name -> Name # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r # gmapQ :: (forall d. Data d => d -> u) -> Name -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Name -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Name -> m Name # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name # | |
Ord Name # | |
Read Name # | |
Show Name # | |
IsString Name # | |
Defined in Napkin.Types Methods fromString :: String -> Name # | |
Generic Name # | |
NFData Name # | |
Defined in Napkin.Types | |
Hashable Name # | |
Defined in Napkin.Types | |
ToJSON Name # | |
Defined in Napkin.Types | |
FromJSON Name # | |
IsRef Name # | |
Defined in Napkin.Types | |
Lift Name # | |
Lift (NonEmpty Name) # | |
IsRef [Name] # | |
Defined in Napkin.Types | |
IsRef (NonEmpty Name) # | |
Cons (Ref a) (Ref a) Name Name # | |
Snoc (Ref a) (Ref a) Name Name # | |
type Rep Name # | |
Defined in Napkin.Types type Rep Name = D1 ('MetaData "Name" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) (C1 ('MetaCons "Specific" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "Star" 'PrefixI 'False) (U1 :: Type -> Type)) |
nameString :: Name -> String #
A way to refer to entities like fields, tables, schemas, etc. Namespacing is common so we keep a list here.
Instances
Class of string-like types that can be interpreted as Ref
s
Instances
IsRef String # | |
Defined in Napkin.Types | |
IsRef Text # | |
Defined in Napkin.Types | |
IsRef Name # | |
Defined in Napkin.Types | |
IsRef [Name] # | |
Defined in Napkin.Types | |
IsRef (NonEmpty Name) # | |
IsRef (Ref a) # | |
Defined in Napkin.Types |
stringRefIso :: Iso' String (Ref a) #
refStringIso :: Iso' (Ref a) String #
Instances
Data Table # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Table -> c Table # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Table # dataTypeOf :: Table -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Table) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Table) # gmapT :: (forall b. Data b => b -> b) -> Table -> Table # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Table -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Table -> r # gmapQ :: (forall d. Data d => d -> u) -> Table -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Table -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Table -> m Table # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Table -> m Table # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Table -> m Table # | |
HasDeps (Ref Table) # | |
Defined in Napkin.Types Methods traverseDependencies :: Traversal' (Ref Table) (Ref Table) # | |
TableRef (Ref Table) # | |
Instances
Data Function # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Function -> c Function # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Function # toConstr :: Function -> Constr # dataTypeOf :: Function -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Function) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Function) # gmapT :: (forall b. Data b => b -> b) -> Function -> Function # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Function -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Function -> r # gmapQ :: (forall d. Data d => d -> u) -> Function -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Function -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Function -> m Function # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Function -> m Function # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Function -> m Function # |
Select something and give it a name; e.g. (my_field as foo)
Constructors
Selected | |
Fields
|
Instances
Foldable Selected # | |
Defined in Napkin.Types Methods fold :: Monoid m => Selected m -> m # foldMap :: Monoid m => (a -> m) -> Selected a -> m # foldMap' :: Monoid m => (a -> m) -> Selected a -> m # foldr :: (a -> b -> b) -> b -> Selected a -> b # foldr' :: (a -> b -> b) -> b -> Selected a -> b # foldl :: (b -> a -> b) -> b -> Selected a -> b # foldl' :: (b -> a -> b) -> b -> Selected a -> b # foldr1 :: (a -> a -> a) -> Selected a -> a # foldl1 :: (a -> a -> a) -> Selected a -> a # elem :: Eq a => a -> Selected a -> Bool # maximum :: Ord a => Selected a -> a # minimum :: Ord a => Selected a -> a # | |
WithName Selected # | |
Defined in Napkin.Types | |
Lift a => Lift (Selected a :: Type) # | |
Eq a => Eq (Selected a) # | |
Data a => Data (Selected a) # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Selected a -> c (Selected a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Selected a) # toConstr :: Selected a -> Constr # dataTypeOf :: Selected a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Selected a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Selected a)) # gmapT :: (forall b. Data b => b -> b) -> Selected a -> Selected a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Selected a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Selected a -> r # gmapQ :: (forall d. Data d => d -> u) -> Selected a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Selected a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Selected a -> m (Selected a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Selected a -> m (Selected a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Selected a -> m (Selected a) # | |
Ord a => Ord (Selected a) # | |
Read a => Read (Selected a) # | |
Show a => Show (Selected a) # | |
Generic (Selected a) # | |
NFData a => NFData (Selected a) # | |
Defined in Napkin.Types | |
HasDeps a => HasDeps (Selected a) # | |
Defined in Napkin.Types Methods traverseDependencies :: Traversal' (Selected a) (Ref Table) # | |
type Rep (Selected a) # | |
Defined in Napkin.Types type Rep (Selected a) = D1 ('MetaData "Selected" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) (C1 ('MetaCons "Selected" 'PrefixI 'True) (S1 ('MetaSel ('Just "_selectRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Ref a)) :*: S1 ('MetaSel ('Just "_selectItem") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) |
Like selected, but aliasing is optional
Constructors
Alias | |
Fields
|
Instances
Foldable Alias # | |
Defined in Napkin.Types Methods fold :: Monoid m => Alias m -> m # foldMap :: Monoid m => (a -> m) -> Alias a -> m # foldMap' :: Monoid m => (a -> m) -> Alias a -> m # foldr :: (a -> b -> b) -> b -> Alias a -> b # foldr' :: (a -> b -> b) -> b -> Alias a -> b # foldl :: (b -> a -> b) -> b -> Alias a -> b # foldl' :: (b -> a -> b) -> b -> Alias a -> b # foldr1 :: (a -> a -> a) -> Alias a -> a # foldl1 :: (a -> a -> a) -> Alias a -> a # elem :: Eq a => a -> Alias a -> Bool # maximum :: Ord a => Alias a -> a # minimum :: Ord a => Alias a -> a # | |
WithName Alias # | |
Defined in Napkin.Types | |
Lift a => Lift (Alias a :: Type) # | |
Eq a => Eq (Alias a) # | |
Data a => Data (Alias a) # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Alias a -> c (Alias a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Alias a) # toConstr :: Alias a -> Constr # dataTypeOf :: Alias a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Alias a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Alias a)) # gmapT :: (forall b. Data b => b -> b) -> Alias a -> Alias a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Alias a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Alias a -> r # gmapQ :: (forall d. Data d => d -> u) -> Alias a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Alias a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Alias a -> m (Alias a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Alias a -> m (Alias a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Alias a -> m (Alias a) # | |
Ord a => Ord (Alias a) # | |
Read a => Read (Alias a) # | |
Show a => Show (Alias a) # | |
Generic (Alias a) # | |
NFData a => NFData (Alias a) # | |
Defined in Napkin.Types | |
RenderSql (Alias SExp) backend => RenderSql [Alias SExp] backend # | |
RenderSql a Sqlite => RenderSql (Alias a) Sqlite # | |
RenderSql a Redshift => RenderSql (Alias a) Redshift # | |
RenderSql a Postgres => RenderSql (Alias a) Postgres # | |
RenderSql a BigQuery => RenderSql (Alias a) BigQuery # | |
type Rep (Alias a) # | |
Defined in Napkin.Types type Rep (Alias a) = D1 ('MetaData "Alias" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) (C1 ('MetaCons "Alias" 'PrefixI 'True) (S1 ('MetaSel ('Just "_aliasRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Ref a))) :*: S1 ('MetaSel ('Just "_aliasItem") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) |
selectToAlias :: Selected a -> Alias a #
Constructors
VDouble Double | |
VInt Int64 | |
VBool Bool | |
VDate Day | |
VDateTime UTCTime | |
VText Text | |
VBinary ByteString | |
VInterval Interval | |
VNull | |
VDatePart DatePart | |
VArray [SExp] |
Instances
Intervals could internally make use of expressions
Constructors
Interval | |
Fields
|
Instances
Eq Interval # | |
Data Interval # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Interval -> c Interval # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Interval # toConstr :: Interval -> Constr # dataTypeOf :: Interval -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Interval) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Interval) # gmapT :: (forall b. Data b => b -> b) -> Interval -> Interval # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Interval -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Interval -> r # gmapQ :: (forall d. Data d => d -> u) -> Interval -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Interval -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Interval -> m Interval # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Interval -> m Interval # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Interval -> m Interval # | |
Ord Interval # | |
Defined in Napkin.Types | |
Read Interval # | |
Show Interval # | |
Generic Interval # | |
NFData Interval # | |
Defined in Napkin.Types | |
Lift Interval # | |
type Rep Interval # | |
Defined in Napkin.Types |
data IntInterval #
Constructors
IntInterval SExp DatePart |
Instances
Constructors
Lit Value | |
Var (Ref SExp) | |
Extern ExternFun | external function call |
Case [(SExp, SExp)] SExp | case with a final default |
ExceptColumns SExp [Ref SExp] | t.* EXCEPT(a,b,c) |
SubQuery Query |
Instances
data NullStrategy #
Constructors
IgnoreNulls | |
RespectNulls |
Instances
data Distinctness #
Constructors
Distinct | |
NonDistinct |
Instances
Constructors
WOver | |
Fields |
Instances
Eq WOver # | |
Data WOver # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WOver -> c WOver # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WOver # dataTypeOf :: WOver -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WOver) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WOver) # gmapT :: (forall b. Data b => b -> b) -> WOver -> WOver # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WOver -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WOver -> r # gmapQ :: (forall d. Data d => d -> u) -> WOver -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> WOver -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> WOver -> m WOver # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WOver -> m WOver # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WOver -> m WOver # | |
Ord WOver # | |
Read WOver # | |
Show WOver # | |
Generic WOver # | |
NFData WOver # | |
Defined in Napkin.Types | |
Default WOver # | |
Defined in Napkin.Types | |
Lift WOver # | |
type Rep WOver # | |
Defined in Napkin.Types type Rep WOver = D1 ('MetaData "WOver" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) (C1 ('MetaCons "WOver" 'PrefixI 'True) (S1 ('MetaSel ('Just "_overPartition") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Partition) :*: (S1 ('MetaSel ('Just "_overOrder") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Order) :*: S1 ('MetaSel ('Just "_overFrame") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe WindowFrame))))) |
Constructors
SimpleWindow (Ref Function) [SExp] WOver (Maybe NullStrategy) |
Instances
data WindowFrame #
Constructors
WindowBetween FrameLength FrameLength | |
WindowFrom FrameLength |
Instances
data FrameLength #
Constructors
CurrentRow | |
Unbounded | |
LimitedPreceding Int | |
LimitedFollowing Int |
Instances
data FunModifier #
Constructors
ModDistinct Distinctness | |
ModNulls NullStrategy | |
ModOrder Order | |
ModLimit Int | |
ModOver WOver |
Instances
Constructors
SimpleExtern (Ref Function) [SExp] | |
ModExtern (Ref Function) [SExp] [FunModifier] | |
Cast SExp Type | |
SafeCast SExp Type | |
ExternWindow WindowFun | |
ExternRaw String |
Instances
Constructors
TySmallInt | |
TyInteger | |
TyBigInt | |
TyDecimal | |
TyReal | |
TyDouble | |
TyBool | |
TyChar | |
TyVarChar | |
TyVarCharWithLen Int | |
TyDate | |
TyTimestamp | |
TyDatetime |
Instances
Eq Type # | |
Data Type # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type # dataTypeOf :: Type -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Type) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) # gmapT :: (forall b. Data b => b -> b) -> Type -> Type # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # | |
Ord Type # | |
Read Type # | |
Show Type # | |
Generic Type # | |
NFData Type # | |
Defined in Napkin.Types | |
Lift Type # | |
type Rep Type # | |
Defined in Napkin.Types type Rep Type = D1 ('MetaData "Type" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) (((C1 ('MetaCons "TySmallInt" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TyInteger" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TyBigInt" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "TyDecimal" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TyReal" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TyDouble" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "TyBool" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TyChar" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TyVarChar" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "TyVarCharWithLen" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "TyDate" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "TyTimestamp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TyDatetime" 'PrefixI 'False) (U1 :: Type -> Type))))) |
Constructors
Millennium | |
Century | |
Decade | |
Epoch | |
Year | |
Quarter | |
Month | |
Week | |
DayOfWeek | |
DayOfYear | |
Day | |
Hour | |
Minute | |
Second | |
Millisecond | |
Microsecond |
Instances
Eq DatePart # | |
Data DatePart # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DatePart -> c DatePart # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DatePart # toConstr :: DatePart -> Constr # dataTypeOf :: DatePart -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DatePart) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DatePart) # gmapT :: (forall b. Data b => b -> b) -> DatePart -> DatePart # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DatePart -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DatePart -> r # gmapQ :: (forall d. Data d => d -> u) -> DatePart -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DatePart -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DatePart -> m DatePart # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DatePart -> m DatePart # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DatePart -> m DatePart # | |
Ord DatePart # | |
Defined in Napkin.Types | |
Read DatePart # | |
Show DatePart # | |
Generic DatePart # | |
NFData DatePart # | |
Defined in Napkin.Types | |
Val DatePart # | |
Lift DatePart # | |
type Rep DatePart # | |
Defined in Napkin.Types type Rep DatePart = D1 ('MetaData "DatePart" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) ((((C1 ('MetaCons "Millennium" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Century" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Decade" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Epoch" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Year" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Quarter" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Month" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Week" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "DayOfWeek" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DayOfYear" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Day" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Hour" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Minute" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Second" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Millisecond" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Microsecond" 'PrefixI 'False) (U1 :: Type -> Type))))) |
Instances
Eq OrderDir # | |
Data OrderDir # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OrderDir -> c OrderDir # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OrderDir # toConstr :: OrderDir -> Constr # dataTypeOf :: OrderDir -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OrderDir) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OrderDir) # gmapT :: (forall b. Data b => b -> b) -> OrderDir -> OrderDir # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OrderDir -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OrderDir -> r # gmapQ :: (forall d. Data d => d -> u) -> OrderDir -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> OrderDir -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OrderDir -> m OrderDir # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OrderDir -> m OrderDir # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OrderDir -> m OrderDir # | |
Ord OrderDir # | |
Defined in Napkin.Types | |
Read OrderDir # | |
Show OrderDir # | |
Generic OrderDir # | |
NFData OrderDir # | |
Defined in Napkin.Types | |
Lift OrderDir # | |
type Rep OrderDir # | |
invertOrder :: OrderDir -> OrderDir #
Flip order
Constructors
NullsFirst | |
NullsLast |
Instances
Eq NullOrder # | |
Data NullOrder # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NullOrder -> c NullOrder # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c NullOrder # toConstr :: NullOrder -> Constr # dataTypeOf :: NullOrder -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c NullOrder) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NullOrder) # gmapT :: (forall b. Data b => b -> b) -> NullOrder -> NullOrder # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NullOrder -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NullOrder -> r # gmapQ :: (forall d. Data d => d -> u) -> NullOrder -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> NullOrder -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NullOrder -> m NullOrder # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NullOrder -> m NullOrder # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NullOrder -> m NullOrder # | |
Ord NullOrder # | |
Read NullOrder # | |
Show NullOrder # | |
Generic NullOrder # | |
NFData NullOrder # | |
Defined in Napkin.Types | |
Lift NullOrder # | |
type Rep NullOrder # | |
Instances
Eq OrderPart # | |
Data OrderPart # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OrderPart -> c OrderPart # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OrderPart # toConstr :: OrderPart -> Constr # dataTypeOf :: OrderPart -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OrderPart) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OrderPart) # gmapT :: (forall b. Data b => b -> b) -> OrderPart -> OrderPart # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OrderPart -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OrderPart -> r # gmapQ :: (forall d. Data d => d -> u) -> OrderPart -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> OrderPart -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OrderPart -> m OrderPart # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OrderPart -> m OrderPart # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OrderPart -> m OrderPart # | |
Ord OrderPart # | |
Read OrderPart # | |
Show OrderPart # | |
Generic OrderPart # | |
NFData OrderPart # | |
Defined in Napkin.Types | |
Lift OrderPart # | |
type Rep OrderPart # | |
Defined in Napkin.Types type Rep OrderPart = D1 ('MetaData "OrderPart" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) (C1 ('MetaCons "OrderPart" 'PrefixI 'True) (S1 ('MetaSel ('Just "_opExp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SExp) :*: (S1 ('MetaSel ('Just "_opOrder") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OrderDir) :*: S1 ('MetaSel ('Just "_opNulls") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe NullOrder))))) |
Constructors
TableRelation (Ref Table) | |
QueryRelation Query | |
ArrayRelation SExp | |
RawRelation [Ref Table] String | Escape hatch: A raw relation with its dependencies. Avoid if possible |
Instances
Instances
Eq JoinType # | |
Data JoinType # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> JoinType -> c JoinType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c JoinType # toConstr :: JoinType -> Constr # dataTypeOf :: JoinType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c JoinType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinType) # gmapT :: (forall b. Data b => b -> b) -> JoinType -> JoinType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> JoinType -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> JoinType -> r # gmapQ :: (forall d. Data d => d -> u) -> JoinType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> JoinType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> JoinType -> m JoinType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> JoinType -> m JoinType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> JoinType -> m JoinType # | |
Ord JoinType # | |
Defined in Napkin.Types | |
Read JoinType # | |
Show JoinType # | |
Generic JoinType # | |
NFData JoinType # | |
Defined in Napkin.Types | |
Lift JoinType # | |
type Rep JoinType # | |
Defined in Napkin.Types type Rep JoinType = D1 ('MetaData "JoinType" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) ((C1 ('MetaCons "JoinLeft" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "JoinRight" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "JoinInner" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "JoinCross" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "JoinOuter" 'PrefixI 'False) (U1 :: Type -> Type)))) |
Constructors
From (Selected Relation) [(Selected Relation, JoinType, Either (Maybe SExp) [Ref SExp])] |
Instances
Eq From # | |
Data From # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> From -> c From # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c From # dataTypeOf :: From -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c From) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c From) # gmapT :: (forall b. Data b => b -> b) -> From -> From # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> From -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> From -> r # gmapQ :: (forall d. Data d => d -> u) -> From -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> From -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> From -> m From # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> From -> m From # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> From -> m From # | |
Ord From # | |
Read From # | |
Show From # | |
Generic From # | |
NFData From # | |
Defined in Napkin.Types | |
HasDeps From # | |
Defined in Napkin.Types Methods | |
Lift From # | |
RenderSql From Sqlite # | |
RenderSql From Redshift # | |
RenderSql From Postgres # | |
RenderSql From BigQuery # | |
type Rep From # | |
Defined in Napkin.Types type Rep From = D1 ('MetaData "From" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) (C1 ('MetaCons "From" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Selected Relation)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Selected Relation, JoinType, Either (Maybe SExp) [Ref SExp])]))) |
fromAliases :: From -> [Ref Relation] #
Constructors
SetUnion | |
DuplicateUnion | |
IntersectUnion | |
MinusUnion |
Instances
Eq UnionType # | |
Data UnionType # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UnionType -> c UnionType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UnionType # toConstr :: UnionType -> Constr # dataTypeOf :: UnionType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UnionType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UnionType) # gmapT :: (forall b. Data b => b -> b) -> UnionType -> UnionType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UnionType -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UnionType -> r # gmapQ :: (forall d. Data d => d -> u) -> UnionType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UnionType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UnionType -> m UnionType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UnionType -> m UnionType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UnionType -> m UnionType # | |
Ord UnionType # | |
Read UnionType # | |
Show UnionType # | |
Generic UnionType # | |
NFData UnionType # | |
Defined in Napkin.Types | |
Lift UnionType # | |
type Rep UnionType # | |
Defined in Napkin.Types type Rep UnionType = D1 ('MetaData "UnionType" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) ((C1 ('MetaCons "SetUnion" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DuplicateUnion" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "IntersectUnion" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MinusUnion" 'PrefixI 'False) (U1 :: Type -> Type))) |
Constructors
RawQuery | |
Fields
|
Instances
Eq RawQuery # | |
Data RawQuery # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RawQuery -> c RawQuery # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RawQuery # toConstr :: RawQuery -> Constr # dataTypeOf :: RawQuery -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RawQuery) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RawQuery) # gmapT :: (forall b. Data b => b -> b) -> RawQuery -> RawQuery # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RawQuery -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RawQuery -> r # gmapQ :: (forall d. Data d => d -> u) -> RawQuery -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> RawQuery -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> RawQuery -> m RawQuery # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RawQuery -> m RawQuery # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RawQuery -> m RawQuery # | |
Ord RawQuery # | |
Defined in Napkin.Types | |
Read RawQuery # | |
Show RawQuery # | |
Generic RawQuery # | |
NFData RawQuery # | |
Defined in Napkin.Types | |
Lift RawQuery # | |
type Rep RawQuery # | |
Defined in Napkin.Types type Rep RawQuery = D1 ('MetaData "RawQuery" "Napkin.Types" "napkin-0.5.9-9RVzJKhltBGIJ4XYUA68gX" 'False) (C1 ('MetaCons "RawQuery" 'PrefixI 'True) (S1 ('MetaSel ('Just "_rawQuery_deps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ref Table]) :*: S1 ('MetaSel ('Just "_rawQuery_raw") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) |
orderWithInserted :: WithClauses -> [(Ref Query, Selected Query)] #
Constructors
Query | |
Fields
| |
Union | |
Fields
| |
QueryRaw RawQuery | Escape hatch: A raw query with all the dependencies contained therein. Avoid if possible. |
Instances
emptyQuery :: Query #
mkUnion :: UnionType -> [Query] -> Query #
Convenience: Combine list of queries via union of the same type
collectUnionQueries :: Query -> NonEmpty Query #
Pull apart any UNIONs and extract a flat list of non-union queries.
data DefinedRelation #
OO-style wrapper for objects that contain a full query definition
Constructors
forall s.(AsRelation s, HasDefinition s) => DefinedRelation s |
Instances
AsRelation DefinedRelation # | |
Defined in Napkin.Types Methods asRelation :: DefinedRelation -> Relation # |
data DefinedQuery #
Like DefinedRelation
, but only requires a defined query.
Constructors
forall s.HasDefinition s => DefinedQuery s |
class AsRelation s where #
Methods
asRelation :: s -> Relation #
Instances
AsRelation DefinedRelation # | |
Defined in Napkin.Types Methods asRelation :: DefinedRelation -> Relation # | |
AsRelation Query # | |
Defined in Napkin.Types Methods asRelation :: Query -> Relation # | |
AsRelation Relation # | |
Defined in Napkin.Types Methods asRelation :: Relation -> Relation # | |
AsRelation CreateViewAs # | |
Defined in Napkin.Types.Commands Methods asRelation :: CreateViewAs -> Relation # | |
AsRelation (Q a) # | |
Defined in Napkin.Untyped.Monad Methods asRelation :: Q a -> Relation # | |
AsRelation (CreateTableAs m) # | |
Defined in Napkin.Types.Commands Methods asRelation :: CreateTableAs m -> Relation # | |
AsRelation (TableSpec b) # | |
Defined in Napkin.Spec.Types Methods asRelation :: TableSpec b -> Relation # | |
AsRelation (Ref a) # | |
Defined in Napkin.Types Methods asRelation :: Ref a -> Relation # | |
AsRelation (CreateTableAs m) # | |
Defined in Napkin.Spec.Types Methods asRelation :: CreateTableAs m -> Relation # |
class HasDefinition s where #
Instances
HasDefinition Query # | |
HasDefinition (Q ()) # | |
HasDefinition (CreateTableAs m) # | |
Defined in Napkin.Types.Commands Methods defQuery :: Lens (CreateTableAs m) (CreateTableAs m) Query Query # | |
HasDefinition (CreateTableAs m) # | |
Defined in Napkin.Spec.Types Methods defQuery :: Lens (CreateTableAs m) (CreateTableAs m) Query Query # |
class MaybeQuery s where #
Things that may or may not contain an explicit Query inside
Instances
MaybeQuery Query # | |
MaybeQuery Relation # | |
MaybeQuery (Q ()) # | |
MaybeQuery (CreateTableAs m) # | |
Defined in Napkin.Types.Commands Methods getQuery :: CreateTableAs m -> Maybe Query # | |
MaybeQuery (CreateTableAs m) # | |
Defined in Napkin.Spec.Types Methods getQuery :: CreateTableAs m -> Maybe Query # |
queryFullySpecified :: Data a => a -> Bool #
Has select *
been used anywhere inside this thing? If so, False.
queryWhere :: Traversal' Query (Maybe SExp) #
querySelect :: Traversal' Query [Alias SExp] #
queryOffset :: Traversal' Query (Maybe Int) #
queryLimit :: Traversal' Query (Maybe Int) #
queryHaving :: Traversal' Query (Maybe SExp) #
_Query :: Prism' Query (WithClauses, [Alias SExp], Maybe From, Maybe SExp, Maybe SExp, GroupBy, Order, Maybe Int, Maybe Int, Distinctness) #
_From :: Iso' From (Selected Relation, [(Selected Relation, JoinType, Either (Maybe SExp) [Ref SExp])]) #
_JoinOuter :: Prism' JoinType () #
_JoinCross :: Prism' JoinType () #
_JoinInner :: Prism' JoinType () #
_JoinRight :: Prism' JoinType () #
_Microsecond :: Prism' DatePart () #
_Millisecond :: Prism' DatePart () #
_DayOfYear :: Prism' DatePart () #
_DayOfWeek :: Prism' DatePart () #
_Millennium :: Prism' DatePart () #
selectItem :: forall a. Lens' (Selected a) a #
Instances
Val Bool # | |
Val Double # | |
Val Int # | |
Val Int64 # | Auto-convert from |
Val Integer # | |
Val ByteString # | |
Defined in Napkin.Types Methods val :: Prism' Value ByteString # | |
Val String # | |
Val Text # | |
Val UTCTime # | |
Val Day # | |
Val DatePart # | |
Val IntInterval # | |
Defined in Napkin.Types Methods val :: Prism' Value IntInterval # | |
Val Value # | |
Val [SExp] # | |
Val a => Val (Maybe a) # | |
interval :: [(Double, DatePart)] -> SExp #
Shorthand for using literal Doubles in making interval expressions.
Monomorphic converter to make it easy to type string literals under OverloadedStrings
fullWindow :: WOver #
Convenient starting point for full window (unbounded) for cases where not specifying window defaults to a partial window. (E.g. BigQuery)
Instances
TableRef DeleteFrom # | |
Defined in Napkin.Types.Commands | |
TableRef InsertIntoQuery # | |
Defined in Napkin.Types.Commands | |
TableRef DropView # | |
TableRef CreateViewAs # | |
Defined in Napkin.Types.Commands | |
TableRef (CreateTableAs m) # | |
Defined in Napkin.Types.Commands | |
TableRef (TableSpec b) # | |
TableRef (Ref Table) # | |
TableRef (CreateTableAs m) # | |
Defined in Napkin.Spec.Types |
relationRef :: TableRef a => Getter a Relation #
Class of things that have external table dependencies
Methods
traverseDependencies :: Traversal' a (Ref Table) #
Instances
queryDependencies :: Data s => Traversal' s (Ref Table) #
Figure out external table dependencies within a construct - e.g. Query or one of the commands.
TODO Potential (unsure) bugs in here due to inner scopes spilling and clashing with names in outer scopes. Seems to work but can use proper extensive testing.
rawRelation :: HasDeps s => (s -> String) -> s -> Relation #
Extract deps from object, render to string and wrap into a RawRelation
asSelf :: SExp -> Selected SExp #
Deprecated: Deprecated, can cause issues if SExp is not Var. Please use varAs or as
as necessary
funAs :: (SExp -> b) -> Ref b -> Selected b #
Apply function to a Ref and select it by the same name as the ref. Common use case in SELECT queries.
selectToRef :: Selected SExp -> SExp #
Use the name of a Selected
as a reference. Typically when
you've computed a field in a subquery or a previous table, and
you're now using that computation directly via its name.
selectedExps :: Traversal' [Selected a] a #
selectedNames :: Traversal' [Selected a0] String #
refName :: Traversal (Ref a) (Ref a1) String String #
Pull the last name out of a Ref. E.g. if Ref contains a schema.table_name, pull just the table_name out.
refJustRoot :: Ref a -> Ref a #
selectedName :: Traversal' (Selected a) Name #
aliasedNames :: HasDefinition s => Traversal' s (Ref SExp) #
scopeRefs :: Data b => Ref t -> b -> b #
Attach all column references within expression to given (table) reference.
Deep traverse structure and apply given name-changing function to each table's name but only if the table has been used in a FROM statement as a source table.
modifyExterns :: Data b => (ExternFun -> SExp) -> b -> b #
Constructors
Unit | Expression is at the row level |
Agg | Aggregate functions, like |
Analytic | Analytic level (some backends) |
Instances
Eq AggLevel # | |
Data AggLevel # | |
Defined in Napkin.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AggLevel -> c AggLevel # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AggLevel # toConstr :: AggLevel -> Constr # dataTypeOf :: AggLevel -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AggLevel) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AggLevel) # gmapT :: (forall b. Data b => b -> b) -> AggLevel -> AggLevel # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AggLevel -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AggLevel -> r # gmapQ :: (forall d. Data d => d -> u) -> AggLevel -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AggLevel -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AggLevel -> m AggLevel # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AggLevel -> m AggLevel # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AggLevel -> m AggLevel # | |
Ord AggLevel # | |
Defined in Napkin.Types | |
Read AggLevel # | |
Show AggLevel # | |
Constructors
HookStats | |
ActionStats |
Instances
Eq StatsType # | |
Ord StatsType # | |
Show StatsType # | |
data TrackingQueryStats #
Used for tracking per-table and hook query statistics.
Constructors
TrackingQueryStats | |
Fields
|
Instances
Eq TrackingQueryStats # | |
Defined in Napkin.Types Methods (==) :: TrackingQueryStats -> TrackingQueryStats -> Bool # (/=) :: TrackingQueryStats -> TrackingQueryStats -> Bool # | |
Show TrackingQueryStats # | |
Defined in Napkin.Types Methods showsPrec :: Int -> TrackingQueryStats -> ShowS # show :: TrackingQueryStats -> String # showList :: [TrackingQueryStats] -> ShowS # | |
Semigroup TrackingQueryStats # | |
Defined in Napkin.Types Methods (<>) :: TrackingQueryStats -> TrackingQueryStats -> TrackingQueryStats # sconcat :: NonEmpty TrackingQueryStats -> TrackingQueryStats # stimes :: Integral b => b -> TrackingQueryStats -> TrackingQueryStats # | |
Monoid TrackingQueryStats # | |
Defined in Napkin.Types Methods mempty :: TrackingQueryStats # mappend :: TrackingQueryStats -> TrackingQueryStats -> TrackingQueryStats # mconcat :: [TrackingQueryStats] -> TrackingQueryStats # |
queryStatsForTable :: Ref Table -> TrackingQueryStats -> (Maybe QueryStats, Maybe QueryStats) #
returns QueryStats, for the table creation spec and also for the spec's tables
data QueryStats #
Used for aggregate statistics gathered from running queries.
Constructors
QueryStats | |
Fields
|
Instances
Eq QueryStats # | |
Defined in Napkin.Types | |
Show QueryStats # | |
Defined in Napkin.Types Methods showsPrec :: Int -> QueryStats -> ShowS # show :: QueryStats -> String # showList :: [QueryStats] -> ShowS # | |
Semigroup QueryStats # | |
Defined in Napkin.Types Methods (<>) :: QueryStats -> QueryStats -> QueryStats # sconcat :: NonEmpty QueryStats -> QueryStats # stimes :: Integral b => b -> QueryStats -> QueryStats # | |
Monoid QueryStats # | |
Defined in Napkin.Types Methods mempty :: QueryStats # mappend :: QueryStats -> QueryStats -> QueryStats # mconcat :: [QueryStats] -> QueryStats # |
data QueryTransformer #
Constructors
QueryTransformer | |
Instances
Semigroup QueryTransformer # | |
Defined in Napkin.Types Methods (<>) :: QueryTransformer -> QueryTransformer -> QueryTransformer # sconcat :: NonEmpty QueryTransformer -> QueryTransformer # stimes :: Integral b => b -> QueryTransformer -> QueryTransformer # | |
Monoid QueryTransformer # | |
Defined in Napkin.Types Methods mappend :: QueryTransformer -> QueryTransformer -> QueryTransformer # mconcat :: [QueryTransformer] -> QueryTransformer # | |
Default QueryTransformer # | |
Defined in Napkin.Types Methods def :: QueryTransformer # |
applyQueryTransformerQueries :: Data b => QueryTransformer -> b -> b #
Apply renamer (e.g. for namespacing) for all Query objects inside
applyQueryTransformerFunctions :: Data b => QueryTransformer -> b -> b #
applyQueryTransformerToRef :: Data b => QueryTransformer -> b -> b #
applyQueryTransformerToQuery :: QueryTransformer -> Query -> Query #
Comprehensively apply transformer to Query, including references, functions and wholesale Query transforms contained therein.