Copyright | 2017 Kei Hibino |
---|---|
License | BSD3 |
Maintainer | ex8k.hibino@gmail.com |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
Deprecated: Should switch namespace to Database.Relational
This module contains backword compatibility interface of relational-query <= 0.9.*
Synopsis
- data Unique
- data NotNull
- data Primary
- data Config
- data IdentifierQuotation
- data SchemaNameMode
- data ProductUnitSupport
- data NameConfig = NameConfig {
- recordConfig :: NameConfig
- relationVarName :: String -> String -> VarName
- defaultNameConfig :: NameConfig
- defaultConfig :: Config
- data Power
- data SetList
- data Set
- data OverWindow
- data Exists
- data Aggregated
- data Flat
- type StringSQL = Keyword
- data Pi r0 r1
- (<.>) :: Pi a b -> Pi b c -> Pi a c
- (<?.>) :: Pi a (Maybe b) -> Pi b c -> Pi a (Maybe c)
- (<?.?>) :: Pi a (Maybe b) -> Pi b (Maybe c) -> Pi a (Maybe c)
- id' :: Pi a a
- class PersistableWidth ct => HasConstraintKey c r ct where
- constraintKey :: Key c r ct
- data Key c r ct
- tableConstraint :: Key c r ct -> KeyConstraint c r
- projectionKey :: Key c r ct -> Pi r ct
- uniqueKey :: PersistableWidth ct => Key Primary r ct -> Key Unique r ct
- derivedUniqueKey :: HasConstraintKey Primary r ct => Key Unique r ct
- class ShowConstantTermsSQL a where
- showConstantTermsSQL' :: a -> DList StringSQL
- showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL]
- class PersistableWidth ct => ScalarDegree ct
- type PI c a b = Record c a -> Record c b
- type Predicate c = Record c (Maybe Bool)
- data Record c t
- data SubQuery
- data AggregateKey a
- data Nulls
- data Order
- queryWidth :: Qualified SubQuery -> Int
- unitSQL :: SubQuery -> String
- data PlaceHolders p
- class SqlContext c
- data Relation p r
- type ConfigureQuery = Qualify (QueryConfig Identity)
- configureQuery :: ConfigureQuery q -> Config -> q
- qualifyQuery :: a -> ConfigureQuery (Qualified a)
- askConfig :: ConfigureQuery Config
- unsafeTypeRelation :: ConfigureQuery SubQuery -> Relation p r
- untypeRelation :: Relation p r -> ConfigureQuery SubQuery
- relationWidth :: Relation p r -> PersistableRecordWidth r
- rightPh :: Relation ((), p) r -> Relation p r
- leftPh :: Relation (p, ()) r -> Relation p r
- sqlFromRelationWith :: Relation p r -> Config -> StringSQL
- sqlFromRelation :: Relation p r -> StringSQL
- dump :: Relation p r -> String
- class PersistableWidth r => TableDerivable r where
- derivedTable :: Table r
- data Table r
- data RecordList p t
- list :: [p t] -> RecordList p t
- type QuerySuffix = [Keyword]
- updateOtherThanKeySQL :: Table r -> Pi r p -> String
- tuplePi2_0' :: forall a1 a2. (PersistableWidth a1, PersistableWidth a2) => Pi (a1, a2) a1
- tuplePi2_1' :: forall a1 a2. (PersistableWidth a1, PersistableWidth a2) => Pi (a1, a2) a2
- tuplePi3_0' :: forall a1 a2 a3. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a1
- tuplePi3_1' :: forall a1 a2 a3. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a2
- tuplePi3_2' :: forall a1 a2 a3. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a3
- tuplePi4_0' :: forall a1 a2 a3 a4. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a1
- tuplePi4_1' :: forall a1 a2 a3 a4. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a2
- tuplePi4_2' :: forall a1 a2 a3 a4. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a3
- tuplePi4_3' :: forall a1 a2 a3 a4. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a4
- tuplePi5_0' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a1
- tuplePi5_1' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a2
- tuplePi5_2' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a3
- tuplePi5_3' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a4
- tuplePi5_4' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a5
- tuplePi6_0' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a1
- tuplePi6_1' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a2
- tuplePi6_2' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a3
- tuplePi6_3' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a4
- tuplePi6_4' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a5
- tuplePi6_5' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a6
- tuplePi7_0' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a1
- tuplePi7_1' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a2
- tuplePi7_2' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a3
- tuplePi7_3' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a4
- tuplePi7_4' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a5
- tuplePi7_5' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a6
- tuplePi7_6' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a7
- fst' :: (PersistableWidth a, PersistableWidth b) => Pi (a, b) a
- snd' :: (PersistableWidth a, PersistableWidth b) => Pi (a, b) b
- class ProjectableFlattenMaybe a b where
- flatten :: ProjectableMaybe p => p a -> p b
- class ProjectableMaybe p where
- type SqlBinOp = Keyword -> Keyword -> Keyword
- unsafeProjectSql' :: SqlContext c => StringSQL -> Record c t
- nothing :: (OperatorContext c, SqlContext c, PersistableWidth a) => Record c (Maybe a)
- value :: (ShowConstantTermsSQL t, OperatorContext c) => t -> Record c t
- valueTrue :: OperatorContext c => Record c (Maybe Bool)
- valueFalse :: OperatorContext c => Record c (Maybe Bool)
- values :: (ShowConstantTermsSQL t, OperatorContext c) => [t] -> RecordList (Record c) t
- unsafeUniOp :: SqlContext c2 => (Keyword -> Keyword) -> Record c1 a -> Record c2 b
- unsafeBinOp :: SqlContext k => SqlBinOp -> Record k a -> Record k b -> Record k c
- (.=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.<.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.<=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.>.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.>=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.<>.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- and' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) -> Record c (Maybe Bool)
- or' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) -> Record c (Maybe Bool)
- not' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool)
- exists :: OperatorContext c => RecordList (Record Exists) r -> Record c (Maybe Bool)
- (.||.) :: OperatorContext c => Record c a -> Record c a -> Record c a
- (?||?) :: (OperatorContext c, IsString a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- like' :: (OperatorContext c, IsString a) => Record c a -> Record c a -> Record c (Maybe Bool)
- likeMaybe' :: (OperatorContext c, IsString a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe Bool)
- like :: (OperatorContext c, IsString a, ShowConstantTermsSQL a) => Record c a -> a -> Record c (Maybe Bool)
- likeMaybe :: (OperatorContext c, IsString a, ShowConstantTermsSQL a) => Record c (Maybe a) -> a -> Record c (Maybe Bool)
- (.+.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a
- (.-.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a
- (./.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a
- (.*.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a
- negate' :: (OperatorContext c, Num a) => Record c a -> Record c a
- fromIntegral' :: (SqlContext c, Integral a, Num b) => Record c a -> Record c b
- showNum :: (SqlContext c, Num a, IsString b) => Record c a -> Record c b
- (?+?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- (?-?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- (?/?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- (?*?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- negateMaybe :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a)
- fromIntegralMaybe :: (SqlContext c, Integral a, Num b) => Record c (Maybe a) -> Record c (Maybe b)
- showNumMaybe :: (SqlContext c, Num a, IsString b) => Record c (Maybe a) -> Record c (Maybe b)
- caseSearch :: OperatorContext c => [(Predicate c, Record c a)] -> Record c a -> Record c a
- casesOrElse :: OperatorContext c => [(Predicate c, Record c a)] -> Record c a -> Record c a
- caseSearchMaybe :: (OperatorContext c, PersistableWidth a) => [(Predicate c, Record c (Maybe a))] -> Record c (Maybe a)
- case' :: OperatorContext c => Record c a -> [(Record c a, Record c b)] -> Record c b -> Record c b
- casesOrElse' :: OperatorContext c => (Record c a, [(Record c a, Record c b)]) -> Record c b -> Record c b
- caseMaybe :: (OperatorContext c, PersistableWidth b) => Record c a -> [(Record c a, Record c (Maybe b))] -> Record c (Maybe b)
- in' :: OperatorContext c => Record c t -> RecordList (Record c) t -> Record c (Maybe Bool)
- isNothing :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c (Maybe r) -> Predicate c
- isJust :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c (Maybe r) -> Predicate c
- fromMaybe :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c r -> Record c (Maybe r) -> Record c r
- rank :: Integral a => Record OverWindow a
- denseRank :: Integral a => Record OverWindow a
- rowNumber :: Integral a => Record OverWindow a
- percentRank :: Record OverWindow Double
- cumeDist :: Record OverWindow Double
- unsafeAddPlaceHolders :: Functor f => f a -> f (PlaceHolders p, a)
- unsafePlaceHolders :: PlaceHolders p
- unitPlaceHolder :: PlaceHolders ()
- unitPH :: PlaceHolders ()
- pwPlaceholder :: SqlContext c => PersistableRecordWidth a -> (Record c a -> b) -> (PlaceHolders a, b)
- placeholder' :: (PersistableWidth t, SqlContext c) => (Record c t -> a) -> (PlaceHolders t, a)
- placeholder :: (PersistableWidth t, SqlContext c, Monad m) => (Record c t -> m a) -> m (PlaceHolders t, a)
- projectZip :: ProductIsoApplicative p => p a -> p b -> p (a, b)
- (><) :: ProductIsoApplicative p => p a -> p b -> p (a, b)
- unsafeAggregateOp :: (AggregatedContext ac, SqlContext ac) => Keyword -> Record Flat a -> Record ac b
- count :: (Integral b, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac b
- sumMaybe :: (Num a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a)
- sum' :: (Num a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a)
- avgMaybe :: (Num a, Fractional b, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe b)
- avg :: (Num a, Fractional b, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe b)
- maxMaybe :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a)
- max' :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a)
- minMaybe :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a)
- min' :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a)
- every :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool)
- any' :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool)
- some' :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool)
- (!) :: PersistableWidth a => Record c a -> Pi a b -> Record c b
- (?!) :: PersistableWidth a => Record c (Maybe a) -> Pi a b -> Record c (Maybe b)
- (?!?) :: PersistableWidth a => Record c (Maybe a) -> Pi a (Maybe b) -> Record c (Maybe b)
- flattenPiMaybe :: (PersistableWidth a, ProjectableFlattenMaybe (Maybe b) c) => Record cont (Maybe a) -> Pi a b -> Record cont c
- (!??) :: (PersistableWidth a, ProjectableFlattenMaybe (Maybe b) c) => Record cont (Maybe a) -> Pi a b -> Record cont c
- (?) :: PersistableWidth a => Record c (Maybe a) -> Pi a b -> Record c (Maybe b)
- (??) :: PersistableWidth a => Record c (Maybe a) -> Pi a (Maybe b) -> Record c (Maybe b)
- class Monad m => MonadPartition c m where
- partitionBy :: Record c r -> m ()
- class MonadQuery m => MonadAggregate m where
- groupBy :: Record Flat r -> m (Record Aggregated r)
- groupBy' :: AggregateKey (Record Aggregated r) -> m (Record Aggregated r)
- class (Functor q, Monad q, Functor m, Monad m) => MonadQualify q m
- class (Functor m, Monad m, MonadQualify ConfigureQuery m) => MonadQuery m where
- query' :: Relation p r -> m (PlaceHolders p, Record Flat r)
- queryMaybe' :: Relation p r -> m (PlaceHolders p, Record Flat (Maybe r))
- class (Functor m, Monad m) => MonadRestrict c m where
- all' :: MonadQuery m => m ()
- distinct :: MonadQuery m => m ()
- on :: MonadQuery m => Predicate Flat -> m ()
- wheres :: MonadRestrict Flat m => Predicate Flat -> m ()
- having :: MonadRestrict Aggregated m => Predicate Aggregated -> m ()
- type Restrict = Restrictings Flat ConfigureQuery
- orderBy' :: Monad m => Record c t -> Order -> Nulls -> Orderings c m ()
- orderBy :: Monad m => Record c t -> Order -> Orderings c m ()
- asc :: Monad m => Record c t -> Orderings c m ()
- desc :: Monad m => Record c t -> Orderings c m ()
- type OrderedQuery c m p r = Orderings c m (PlaceHolders p, Record c r)
- type QueryCore = Restrictings Flat (QueryJoin ConfigureQuery)
- extractCore :: QueryCore a -> ConfigureQuery (((a, [Predicate Flat]), JoinProduct), Duplication)
- data QueryUnique a
- type SimpleQuery p r = OrderedQuery Flat QueryCore p r
- type QuerySimple = Orderings Flat QueryCore
- assignTo :: Monad m => Record Flat v -> AssignTarget r v -> Assignings r m ()
- (<-#) :: Monad m => AssignTarget r v -> Record Flat v -> Assignings r m ()
- type Register r = Assignings r ConfigureQuery
- type Assign r = Assignings r Restrict
- key :: Record Flat r -> AggregatingSet (Record Aggregated (Maybe r))
- key' :: AggregateKey a -> AggregatingSet a
- set :: AggregatingSet a -> AggregatingSetList a
- bkey :: Record Flat r -> AggregatingPowerSet (Record Aggregated (Maybe r))
- rollup :: AggregatingPowerSet a -> AggregateKey a
- cube :: AggregatingPowerSet a -> AggregateKey a
- groupingSets :: AggregatingSetList a -> AggregateKey a
- type Window c = Orderings c (PartitioningSet c)
- type AggregatedQuery p r = OrderedQuery Aggregated (Restrictings Aggregated (AggregatingSetT QueryCore)) p r
- type QueryAggregate = Orderings Aggregated (Restrictings Aggregated (AggregatingSetT QueryCore))
- over :: SqlContext c => Record OverWindow a -> Window c () -> Record c a
- data UniqueRelation p c r
- table :: Table r -> Relation () r
- derivedRelation :: TableDerivable r => Relation () r
- tableOf :: TableDerivable r => Relation () r -> Table r
- query :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Record Flat r)
- queryMaybe :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Record Flat (Maybe r))
- queryList' :: MonadQualify ConfigureQuery m => Relation p r -> m (PlaceHolders p, RecordList (Record c) r)
- queryList :: MonadQualify ConfigureQuery m => Relation () r -> m (RecordList (Record c) r)
- relation' :: SimpleQuery p r -> Relation p r
- relation :: QuerySimple (Record Flat r) -> Relation () r
- aggregateRelation' :: AggregatedQuery p r -> Relation p r
- aggregateRelation :: QueryAggregate (Record Aggregated r) -> Relation () r
- unsafeUnique :: Relation p r -> UniqueRelation p c r
- unUnique :: UniqueRelation p c r -> Relation p r
- uniqueQuery' :: UniqueRelation p c r -> QueryUnique (PlaceHolders p, Record c r)
- uniqueQueryMaybe' :: UniqueRelation p c r -> QueryUnique (PlaceHolders p, Record c (Maybe r))
- uniqueRelation' :: QueryUnique (PlaceHolders p, Record c r) -> UniqueRelation p c r
- aggregatedUnique :: Relation ph r -> Pi r a -> (Record Flat a -> Record Aggregated b) -> UniqueRelation ph Flat b
- queryScalar' :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation p c r -> m (PlaceHolders p, Record c (Maybe r))
- queryScalar :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation () c r -> m (Record c (Maybe r))
- type JoinRestriction a b = Record Flat a -> Record Flat b -> Predicate Flat
- inner' :: Relation pa a -> Relation pb b -> [JoinRestriction a b] -> Relation (pa, pb) (a, b)
- left' :: Relation pa a -> Relation pb b -> [JoinRestriction a (Maybe b)] -> Relation (pa, pb) (a, Maybe b)
- right' :: Relation pa a -> Relation pb b -> [JoinRestriction (Maybe a) b] -> Relation (pa, pb) (Maybe a, b)
- full' :: Relation pa a -> Relation pb b -> [JoinRestriction (Maybe a) (Maybe b)] -> Relation (pa, pb) (Maybe a, Maybe b)
- inner :: Relation () a -> Relation () b -> [JoinRestriction a b] -> Relation () (a, b)
- left :: Relation () a -> Relation () b -> [JoinRestriction a (Maybe b)] -> Relation () (a, Maybe b)
- right :: Relation () a -> Relation () b -> [JoinRestriction (Maybe a) b] -> Relation () (Maybe a, b)
- full :: Relation () a -> Relation () b -> [JoinRestriction (Maybe a) (Maybe b)] -> Relation () (Maybe a, Maybe b)
- on' :: ([JoinRestriction a b] -> Relation pc (a, b)) -> [JoinRestriction a b] -> Relation pc (a, b)
- union :: Relation () a -> Relation () a -> Relation () a
- unionAll :: Relation () a -> Relation () a -> Relation () a
- except :: Relation () a -> Relation () a -> Relation () a
- exceptAll :: Relation () a -> Relation () a -> Relation () a
- intersect :: Relation () a -> Relation () a -> Relation () a
- intersectAll :: Relation () a -> Relation () a -> Relation () a
- union' :: Relation p a -> Relation q a -> Relation (p, q) a
- unionAll' :: Relation p a -> Relation q a -> Relation (p, q) a
- except' :: Relation p a -> Relation q a -> Relation (p, q) a
- exceptAll' :: Relation p a -> Relation q a -> Relation (p, q) a
- intersect' :: Relation p a -> Relation q a -> Relation (p, q) a
- intersectAll' :: Relation p a -> Relation q a -> Relation (p, q) a
- data InsertTarget p r
- data UpdateTarget p r
- data Restriction p r
- restriction :: RestrictedStatement r () -> Restriction () r
- restriction' :: RestrictedStatement r (PlaceHolders p) -> Restriction p r
- sqlWhereFromRestriction :: Config -> Table r -> Restriction p r -> StringSQL
- updateTarget :: AssignStatement r () -> UpdateTarget () r
- updateTarget' :: AssignStatement r (PlaceHolders p) -> UpdateTarget p r
- liftTargetAllColumn :: PersistableWidth r => Restriction () r -> UpdateTarget r r
- liftTargetAllColumn' :: PersistableWidth r => Restriction p r -> UpdateTarget (r, p) r
- updateTargetAllColumn :: PersistableWidth r => RestrictedStatement r () -> UpdateTarget r r
- updateTargetAllColumn' :: PersistableWidth r => RestrictedStatement r (PlaceHolders p) -> UpdateTarget (r, p) r
- sqlFromUpdateTarget :: Config -> Table r -> UpdateTarget p r -> StringSQL
- insertTarget :: Register r () -> InsertTarget () r
- insertTarget' :: Register r (PlaceHolders p) -> InsertTarget p r
- piRegister :: PersistableWidth r => Pi r r' -> Register r (PlaceHolders r')
- sqlChunkFromInsertTarget :: Config -> Table r -> InsertTarget p r -> (StringSQL, Int)
- sqlFromInsertTarget :: Config -> Table r -> InsertTarget p r -> StringSQL
- sqlChunksFromRecordList :: ShowConstantTermsSQL r' => Config -> Table r -> Pi r r' -> [r'] -> [StringSQL]
- class UntypeableNoFetch s where
- untypeNoFetch :: s p -> String
- newtype Delete p = Delete {}
- newtype InsertQuery p = InsertQuery {}
- data Insert a = Insert {
- untypeInsert :: String
- chunkedInsert :: Maybe (String, Int)
- newtype Update p = Update {}
- data KeyUpdate p a = KeyUpdate {
- updateKey :: Pi a p
- untypeKeyUpdate :: String
- newtype Query p a = Query {}
- unsafeTypedQuery :: String -> Query p a
- relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> String
- relationalQuery' :: Relation p r -> QuerySuffix -> Query p r
- relationalQuery :: Relation p r -> Query p r
- typedKeyUpdate :: Table a -> Pi a p -> KeyUpdate p a
- typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p r
- keyUpdate :: TableDerivable r => Pi r p -> KeyUpdate p r
- derivedKeyUpdate :: TableDerivable r => Pi r p -> KeyUpdate p r
- unsafeTypedUpdate :: String -> Update p
- updateSQL :: Config -> Table r -> UpdateTarget p r -> String
- typedUpdate' :: Config -> Table r -> UpdateTarget p r -> Update p
- typedUpdate :: Table r -> UpdateTarget p r -> Update p
- update' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p
- derivedUpdate' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p
- update :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p
- updateNoPH :: TableDerivable r => AssignStatement r () -> Update ()
- derivedUpdate :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p
- typedUpdateAllColumn :: PersistableWidth r => Table r -> Restriction p r -> Update (r, p)
- updateAllColumn' :: (PersistableWidth r, TableDerivable r) => Config -> RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- derivedUpdateAllColumn' :: (PersistableWidth r, TableDerivable r) => Config -> RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- updateAllColumn :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- updateAllColumnNoPH :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r () -> Update r
- derivedUpdateAllColumn :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- untypeChunkInsert :: Insert a -> String
- chunkSizeOfInsert :: Insert a -> Int
- unsafeTypedInsert' :: String -> String -> Int -> Insert a
- typedInsert' :: PersistableWidth r => Config -> Table r -> Pi r r' -> Insert r'
- typedInsert :: PersistableWidth r => Table r -> Pi r r' -> Insert r'
- insert :: (PersistableWidth r, TableDerivable r) => Pi r r' -> Insert r'
- derivedInsert :: (PersistableWidth r, TableDerivable r) => Pi r r' -> Insert r'
- typedInsertValue' :: Config -> Table r -> InsertTarget p r -> Insert p
- typedInsertValue :: Table r -> InsertTarget p r -> Insert p
- insertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p
- derivedInsertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p
- insertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p
- insertValueNoPH :: TableDerivable r => Register r () -> Insert ()
- derivedInsertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p
- insertValueList' :: (TableDerivable r, ShowConstantTermsSQL r') => Config -> Pi r r' -> [r'] -> [Insert ()]
- insertValueList :: (TableDerivable r, ShowConstantTermsSQL r') => Pi r r' -> [r'] -> [Insert ()]
- insertQuerySQL :: Config -> Table r -> Pi r r' -> Relation p r' -> String
- typedInsertQuery' :: Config -> Table r -> Pi r r' -> Relation p r' -> InsertQuery p
- typedInsertQuery :: Table r -> Pi r r' -> Relation p r' -> InsertQuery p
- insertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p
- derivedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p
- deleteSQL :: Config -> Table r -> Restriction p r -> String
- typedDelete' :: Config -> Table r -> Restriction p r -> Delete p
- typedDelete :: Table r -> Restriction p r -> Delete p
- delete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p
- derivedDelete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p
- delete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p
- deleteNoPH :: TableDerivable r => RestrictedStatement r () -> Delete ()
- derivedDelete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p
- data Number r i
- class (TableDerivable r, SequenceDerivable s i) => Binding r s i | r -> s where
- binding :: SeqBinding r s i
- data SeqBinding r s i
- class TableDerivable s => SequenceDerivable s i | s -> i where
- derivedSequence :: Sequence s i
- data Sequence s i
- unsafeSpecifySequence :: TableDerivable s => (s -> i) -> Pi s i -> Sequence s i
- seqRelation :: TableDerivable s => Sequence s i -> Relation () s
- unsafeSpecifyBinding :: (TableDerivable r, SequenceDerivable s i) => Pi r i -> SeqBinding r s i
- primaryBinding :: (TableDerivable r, SequenceDerivable s i, HasConstraintKey Primary r i) => SeqBinding r s i
- fromRelation :: Binding r s i => Relation () r -> Sequence s i
- unsafeSpecifyNumber :: Binding r s i => i -> Number r i
- extractNumber :: Number r i -> i
- ($$!) :: (i -> r) -> Number r i -> r
- ($$) :: Binding r s i => (i -> r) -> Number r i -> r
- updateNumber' :: (PersistableWidth s, Integral i, ShowConstantTermsSQL i) => Config -> i -> Sequence s i -> Update ()
- updateNumber :: (PersistableWidth s, Integral i, ShowConstantTermsSQL i) => i -> Sequence s i -> Update ()
- specifiedKey :: PersistableWidth p => Pi a p -> Relation () a -> Relation p a
- uniqueSelect :: PersistableWidth p => Key Unique a p -> Relation () a -> Relation p a
- unique :: PersistableWidth p => Key Unique a p -> Relation () a -> Relation p a
- primary' :: PersistableWidth p => Key Primary a p -> Relation () a -> Relation p a
- primarySelect :: HasConstraintKey Primary a p => Relation () a -> Relation p a
- primary :: HasConstraintKey Primary a p => Relation () a -> Relation p a
- updateValuesWithKey :: ToSql q r => Pi r p -> r -> [q]
- updateByConstraintKey :: Table r -> Key c r p -> KeyUpdate p r
- primaryUpdate :: HasConstraintKey Primary r p => Table r -> KeyUpdate p r
- derivedUniqueRelation :: TableDerivable r => Key Unique r k -> Record c k -> UniqueRelation () c r
- module Database.Relational.Compat
Documentation
Constraint type. Not-null key.
Instances
HasColumnConstraint NotNull a => HasColumnConstraint NotNull (a, b) | Inference rule of |
Defined in Database.Record.KeyConstraint columnConstraint :: ColumnConstraint NotNull (a, b) # |
Configuration type.
data IdentifierQuotation Source #
Configuration for quotation of identifiers of SQL.
Instances
Show IdentifierQuotation Source # | |
Defined in Database.Relational.Internal.Config showsPrec :: Int -> IdentifierQuotation -> ShowS # show :: IdentifierQuotation -> String # showList :: [IdentifierQuotation] -> ShowS # |
data SchemaNameMode Source #
Schema name qualify mode in SQL string.
SchemaQualified | Schema qualified table name in SQL string |
SchemaNotQualified | Not qualified table name in SQL string |
Instances
Eq SchemaNameMode Source # | |
Defined in Database.Relational.Internal.Config (==) :: SchemaNameMode -> SchemaNameMode -> Bool # (/=) :: SchemaNameMode -> SchemaNameMode -> Bool # | |
Show SchemaNameMode Source # | |
Defined in Database.Relational.Internal.Config showsPrec :: Int -> SchemaNameMode -> ShowS # show :: SchemaNameMode -> String # showList :: [SchemaNameMode] -> ShowS # |
data ProductUnitSupport Source #
Unit of product is supported or not.
Instances
Show ProductUnitSupport Source # | |
Defined in Database.Relational.Internal.Config showsPrec :: Int -> ProductUnitSupport -> ShowS # show :: ProductUnitSupport -> String # showList :: [ProductUnitSupport] -> ShowS # |
data NameConfig Source #
NameConfig
type to customize names of expanded templates.
NameConfig | |
|
Instances
Show NameConfig Source # | |
Defined in Database.Relational.Internal.Config showsPrec :: Int -> NameConfig -> ShowS # show :: NameConfig -> String # showList :: [NameConfig] -> ShowS # |
defaultNameConfig :: NameConfig Source #
Default implementation of NameConfig
type.
defaultConfig :: Config Source #
Default configuration of Config
.
To change some behaviour of relational-query,
use record update syntax:
defaultConfig { productUnitSupport =PUSupported
, chunksInsertSize = 256 , schemaNameMode =SchemaQualified
, normalizedTableName = True , verboseAsCompilerWarning = False , disableOverloadedProjection = False , disableSpecializedProjection = False , identifierQuotation =NoQuotation
, nameConfig = defaultNameConfig { recordConfig =defaultNameConfig
, relationVarName = \schema table ->varCamelcaseName
$ table ++ "_" ++ scheme -- ^ append the table name after the schema name. e.g. "schemaTable" } }
Type tag for normal aggregatings set
Instances
data OverWindow Source #
Type tag for window function building
Instances
AggregatedContext OverWindow Source # |
|
Defined in Database.Relational.Projectable.Instances | |
SqlContext OverWindow Source # | Unsafely make |
Defined in Database.Relational.Projectable.Instances unsafeProjectSqlTerms :: [StringSQL] -> Record OverWindow t Source # |
data Aggregated Source #
Type tag for aggregated query
Instances
AggregatedContext Aggregated Source # |
|
Defined in Database.Relational.Projectable.Instances | |
OperatorContext Aggregated Source # | full SQL expression is availabe in Aggregated context |
Defined in Database.Relational.Projectable.Instances | |
SqlContext Aggregated Source # | Unsafely make |
Defined in Database.Relational.Projectable.Instances unsafeProjectSqlTerms :: [StringSQL] -> Record Aggregated t Source # | |
MonadRestrict Flat q => MonadRestrict Flat (Restrictings Aggregated q) Source # | Restricted |
Defined in Database.Relational.Monad.Aggregate restrict :: Predicate Flat -> Restrictings Aggregated q () Source # |
Type tag for flat (not-aggregated) query
Instances
OperatorContext Flat Source # | full SQL expression is availabe in Flat context |
Defined in Database.Relational.Projectable.Instances | |
SqlContext Flat Source # | Unsafely make |
Defined in Database.Relational.Projectable.Instances | |
MonadRestrict Flat q => MonadRestrict Flat (Restrictings Aggregated q) Source # | Restricted |
Defined in Database.Relational.Monad.Aggregate restrict :: Predicate Flat -> Restrictings Aggregated q () Source # |
Projection path from type r0
into type r1
.
This type also indicate key object which type is r1
for record type r0
.
Instances
HasProjection l a b => IsLabel l (Pi a b) Source # | Derive |
Defined in Database.Relational.OverloadedProjection | |
ProductIsoFunctor (Pi a) Source # | Map projection path |
Defined in Database.Relational.Pi.Unsafe (|$|) :: ProductConstructor (a0 -> b) => (a0 -> b) -> Pi a a0 -> Pi a b # | |
ProductIsoApplicative (Pi a) Source # | Compose projection path |
Defined in Database.Relational.Pi.Unsafe | |
Category Pi Source # | |
ProductIsoEmpty (Pi a) () Source # | |
PersistableWidth r0 => Show (Pi r0 r1) Source # | |
(<?.?>) :: Pi a (Maybe b) -> Pi b (Maybe c) -> Pi a (Maybe c) infixl 8 Source #
Compose projection path. Maybe
phantom functors are join
-ed like >=>
.
class PersistableWidth ct => HasConstraintKey c r ct where Source #
Constraint Key
inference interface.
constraintKey :: Key c r ct Source #
Infer constraint key.
Constraint Key proof object. Constraint type c
, record type r
and columns type ct
.
tableConstraint :: Key c r ct -> KeyConstraint c r Source #
Get table constraint KeyConstraint
proof object from constraint Key
.
projectionKey :: Key c r ct -> Pi r ct Source #
Get projection path proof object from constraint Key
.
derivedUniqueKey :: HasConstraintKey Primary r ct => Key Unique r ct Source #
class ShowConstantTermsSQL a where Source #
ShowConstantTermsSQL
a
is implicit rule to derive function to convert
from haskell record type a
into constant SQL terms.
Generic programming (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generic-programming)
with default signature is available for ShowConstantTermsSQL
class,
so you can make instance like below:
{-# LANGUAGE DeriveGeneric #-} import GHC.Generics (Generic) -- data Foo = Foo { ... } deriving Generic instance ShowConstantTermsSQL Foo
Nothing
showConstantTermsSQL' :: a -> DList StringSQL Source #
showConstantTermsSQL' :: (Generic a, GShowConstantTermsSQL (Rep a)) => a -> DList StringSQL Source #
Instances
showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL] Source #
Convert from haskell record to SQL terms list.
class PersistableWidth ct => ScalarDegree ct Source #
Constraint which represents scalar degree.
Instances
ScalarDegree ct => ScalarDegree (Maybe ct) Source # | |
Defined in Database.Relational.Scalar |
Phantom typed record. Projected into Haskell record type t
.
Instances
(PersistableWidth a, HasProjection l a b) => IsLabel l (PI c a b) Source # | Derive |
Defined in Database.Relational.OverloadedProjection | |
ProductIsoFunctor (Record c) Source # | Map |
Defined in Database.Relational.Record (|$|) :: ProductConstructor (a -> b) => (a -> b) -> Record c a -> Record c b # | |
ProductIsoApplicative (Record c) Source # | Compose |
Defined in Database.Relational.Record | |
ProjectableMaybe (Record c) Source # | |
ProjectableShowSql (Record c) Source # | |
Defined in Database.Relational.Compat unsafeShowSql' :: Record c a -> StringSQL Source # | |
SqlContext c => SqlProjectable (Record c) Source # | Unsafely make |
Defined in Database.Relational.Compat unsafeProjectSqlTerms :: [StringSQL] -> Record c t Source # | |
ProductIsoEmpty (Record c) () Source # | |
Show (Record c t) Source # | |
Sub-query type
data AggregateKey a Source #
Typeful aggregate element.
Order of null.
Order direction. Ascendant or Descendant.
data PlaceHolders p Source #
Placeholder parameter type which has real parameter type arguemnt p
.
Instances
class SqlContext c Source #
Interface to project SQL terms unsafely.
Instances
SqlContext OverWindow Source # | Unsafely make |
Defined in Database.Relational.Projectable.Instances unsafeProjectSqlTerms :: [StringSQL] -> Record OverWindow t Source # | |
SqlContext Aggregated Source # | Unsafely make |
Defined in Database.Relational.Projectable.Instances unsafeProjectSqlTerms :: [StringSQL] -> Record Aggregated t Source # | |
SqlContext Flat Source # | Unsafely make |
Defined in Database.Relational.Projectable.Instances |
Relation type with place-holder parameter p
and query result type r
.
type ConfigureQuery = Qualify (QueryConfig Identity) Source #
Thin monad type for untyped structure.
configureQuery :: ConfigureQuery q -> Config -> q Source #
Run ConfigureQuery
monad with initial state to get only result.
qualifyQuery :: a -> ConfigureQuery (Qualified a) Source #
Get qualifyed table form query.
askConfig :: ConfigureQuery Config Source #
Read configuration.
unsafeTypeRelation :: ConfigureQuery SubQuery -> Relation p r Source #
Unsafely type qualified subquery into record typed relation type.
untypeRelation :: Relation p r -> ConfigureQuery SubQuery Source #
Sub-query Qualify monad from relation.
relationWidth :: Relation p r -> PersistableRecordWidth r Source #
PersistableRecordWidth
of Relation
type.
rightPh :: Relation ((), p) r -> Relation p r Source #
Simplify placeholder type applying left identity element.
leftPh :: Relation (p, ()) r -> Relation p r Source #
Simplify placeholder type applying right identity element.
sqlFromRelationWith :: Relation p r -> Config -> StringSQL Source #
Generate SQL string from Relation
with configuration.
class PersistableWidth r => TableDerivable r where Source #
Inference rule of Table
existence.
derivedTable :: Table r Source #
data RecordList p t Source #
Projected record list type for row list.
list :: [p t] -> RecordList p t Source #
Make projected record list from Record
list.
type QuerySuffix = [Keyword] Source #
Type for query suffix words
updateOtherThanKeySQL Source #
Generate update SQL specified by single key.
tuplePi2_0' :: forall a1 a2. (PersistableWidth a1, PersistableWidth a2) => Pi (a1, a2) a1 Source #
tuplePi2_1' :: forall a1 a2. (PersistableWidth a1, PersistableWidth a2) => Pi (a1, a2) a2 Source #
tuplePi3_0' :: forall a1 a2 a3. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a1 Source #
tuplePi3_1' :: forall a1 a2 a3. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a2 Source #
tuplePi3_2' :: forall a1 a2 a3. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a3 Source #
tuplePi4_0' :: forall a1 a2 a3 a4. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a1 Source #
tuplePi4_1' :: forall a1 a2 a3 a4. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a2 Source #
tuplePi4_2' :: forall a1 a2 a3 a4. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a3 Source #
tuplePi4_3' :: forall a1 a2 a3 a4. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a4 Source #
tuplePi5_0' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a1 Source #
tuplePi5_1' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a2 Source #
tuplePi5_2' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a3 Source #
tuplePi5_3' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a4 Source #
tuplePi5_4' :: forall a1 a2 a3 a4 a5. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a5 Source #
tuplePi6_0' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a1 Source #
tuplePi6_1' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a2 Source #
tuplePi6_2' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a3 Source #
tuplePi6_3' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a4 Source #
tuplePi6_4' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a5 Source #
tuplePi6_5' :: forall a1 a2 a3 a4 a5 a6. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a6 Source #
tuplePi7_0' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a1 Source #
tuplePi7_1' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a2 Source #
tuplePi7_2' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a3 Source #
tuplePi7_3' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a4 Source #
tuplePi7_4' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a5 Source #
tuplePi7_5' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a6 Source #
tuplePi7_6' :: forall a1 a2 a3 a4 a5 a6 a7. (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a7 Source #
fst' :: (PersistableWidth a, PersistableWidth b) => Pi (a, b) a Source #
Projection path for fst of tuple.
snd' :: (PersistableWidth a, PersistableWidth b) => Pi (a, b) b Source #
Projection path for snd of tuple.
class ProjectableFlattenMaybe a b where Source #
Interface to compose phantom Maybe
nested type.
flatten :: ProjectableMaybe p => p a -> p b Source #
Instances
ProjectableFlattenMaybe (Maybe a) b => ProjectableFlattenMaybe (Maybe (Maybe a)) b Source # | Compose |
Defined in Database.Relational.Projectable | |
ProjectableFlattenMaybe (Maybe a) (Maybe a) Source # | Not |
Defined in Database.Relational.Projectable |
class ProjectableMaybe p where Source #
Interface to control Maybe
of phantom type in records.
just :: p a -> p (Maybe a) Source #
Cast record phantom type into Maybe
.
flattenMaybe :: p (Maybe (Maybe a)) -> p (Maybe a) Source #
Compose nested Maybe
phantom type on record.
Instances
ProjectableMaybe PlaceHolders Source # | Control phantom |
Defined in Database.Relational.Projectable just :: PlaceHolders a -> PlaceHolders (Maybe a) Source # flattenMaybe :: PlaceHolders (Maybe (Maybe a)) -> PlaceHolders (Maybe a) Source # | |
ProjectableMaybe (Record c) Source # | |
unsafeProjectSql' :: SqlContext c => StringSQL -> Record c t Source #
Unsafely Project single SQL term.
nothing :: (OperatorContext c, SqlContext c, PersistableWidth a) => Record c (Maybe a) Source #
Record with polymorphic phantom type of SQL null value. Semantics of comparing is unsafe.
value :: (ShowConstantTermsSQL t, OperatorContext c) => t -> Record c t Source #
Generate record with polymorphic type of SQL constant values from Haskell value.
valueTrue :: OperatorContext c => Record c (Maybe Bool) Source #
Record with polymorphic type of SQL true value.
valueFalse :: OperatorContext c => Record c (Maybe Bool) Source #
Record with polymorphic type of SQL false value.
values :: (ShowConstantTermsSQL t, OperatorContext c) => [t] -> RecordList (Record c) t Source #
RecordList with polymorphic type of SQL set value from Haskell list.
unsafeUniOp :: SqlContext c2 => (Keyword -> Keyword) -> Record c1 a -> Record c2 b Source #
Unsafely make unary operator for records from SQL keyword.
unsafeBinOp :: SqlContext k => SqlBinOp -> Record k a -> Record k b -> Record k c Source #
Unsafely make binary operator for records from string binary operator.
(.=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 Source #
Compare operator corresponding SQL = .
(.<.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 Source #
Compare operator corresponding SQL < .
(.<=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 Source #
Compare operator corresponding SQL <= .
(.>.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 Source #
Compare operator corresponding SQL > .
(.>=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 Source #
Compare operator corresponding SQL >= .
(.<>.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 Source #
Compare operator corresponding SQL <> .
and' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) -> Record c (Maybe Bool) infixr 3 Source #
Logical operator corresponding SQL AND .
or' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) -> Record c (Maybe Bool) infixr 2 Source #
Logical operator corresponding SQL OR .
not' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) Source #
Logical operator corresponding SQL NOT .
exists :: OperatorContext c => RecordList (Record Exists) r -> Record c (Maybe Bool) Source #
Logical operator corresponding SQL EXISTS .
(.||.) :: OperatorContext c => Record c a -> Record c a -> Record c a infixl 5 Source #
Concatinate operator corresponding SQL || .
(?||?) :: (OperatorContext c, IsString a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 5 Source #
Concatinate operator corresponding SQL || . Maybe type version.
like' :: (OperatorContext c, IsString a) => Record c a -> Record c a -> Record c (Maybe Bool) infix 4 Source #
String-compare operator corresponding SQL LIKE .
likeMaybe' :: (OperatorContext c, IsString a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe Bool) infix 4 Source #
String-compare operator corresponding SQL LIKE .
like :: (OperatorContext c, IsString a, ShowConstantTermsSQL a) => Record c a -> a -> Record c (Maybe Bool) infix 4 Source #
String-compare operator corresponding SQL LIKE .
likeMaybe :: (OperatorContext c, IsString a, ShowConstantTermsSQL a) => Record c (Maybe a) -> a -> Record c (Maybe Bool) infix 4 Source #
String-compare operator corresponding SQL LIKE . Maybe type version.
(.+.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a infixl 6 Source #
Number operator corresponding SQL + .
(.-.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a infixl 6 Source #
Number operator corresponding SQL - .
(./.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a infixl 7 Source #
Number operator corresponding SQL /// .
(.*.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a infixl 7 Source #
Number operator corresponding SQL * .
negate' :: (OperatorContext c, Num a) => Record c a -> Record c a Source #
Number negate uni-operator corresponding SQL -.
fromIntegral' :: (SqlContext c, Integral a, Num b) => Record c a -> Record c b Source #
Number fromIntegral uni-operator.
showNum :: (SqlContext c, Num a, IsString b) => Record c a -> Record c b Source #
Unsafely show number into string-like type in records.
(?+?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 6 Source #
Number operator corresponding SQL + .
(?-?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 6 Source #
Number operator corresponding SQL - .
(?/?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 7 Source #
Number operator corresponding SQL /// .
(?*?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 7 Source #
Number operator corresponding SQL * .
negateMaybe :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) Source #
Number negate uni-operator corresponding SQL -.
fromIntegralMaybe :: (SqlContext c, Integral a, Num b) => Record c (Maybe a) -> Record c (Maybe b) Source #
Number fromIntegral uni-operator.
showNumMaybe :: (SqlContext c, Num a, IsString b) => Record c (Maybe a) -> Record c (Maybe b) Source #
Unsafely show number into string-like type in records.
:: OperatorContext c | |
=> [(Predicate c, Record c a)] | Each when clauses |
-> Record c a | Else result record |
-> Record c a | Result record |
Search case operator correnponding SQL search CASE. Like, CASE WHEN p0 THEN a WHEN p1 THEN b ... ELSE c END
:: OperatorContext c | |
=> [(Predicate c, Record c a)] | Each when clauses |
-> Record c a | Else result record |
-> Record c a | Result record |
Same as caseSearch
, but you can write like list casesOrElse
clause.
:: (OperatorContext c, PersistableWidth a) | |
=> [(Predicate c, Record c (Maybe a))] | Each when clauses |
-> Record c (Maybe a) | Result record |
Null default version of caseSearch
.
:: OperatorContext c | |
=> Record c a | Record value to match |
-> [(Record c a, Record c b)] | Each when clauses |
-> Record c b | Else result record |
-> Record c b | Result record |
Simple case operator correnponding SQL simple CASE. Like, CASE x WHEN v THEN a WHEN w THEN b ... ELSE c END
:: OperatorContext c | |
=> (Record c a, [(Record c a, Record c b)]) | Record value to match and each when clauses list |
-> Record c b | Else result record |
-> Record c b | Result record |
Uncurry version of case'
, and you can write like ... casesOrElse'
clause.
:: (OperatorContext c, PersistableWidth b) | |
=> Record c a | Record value to match |
-> [(Record c a, Record c (Maybe b))] | Each when clauses |
-> Record c (Maybe b) | Result record |
Null default version of case'
.
in' :: OperatorContext c => Record c t -> RecordList (Record c) t -> Record c (Maybe Bool) infix 4 Source #
Binary operator corresponding SQL IN .
isNothing :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c (Maybe r) -> Predicate c Source #
Operator corresponding SQL IS NULL , and extended against record types.
isJust :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c (Maybe r) -> Predicate c Source #
Operator corresponding SQL NOT (... IS NULL) , and extended against record type.
fromMaybe :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c r -> Record c (Maybe r) -> Record c r Source #
Operator from maybe type using record extended isNull
.
percentRank :: Record OverWindow Double Source #
PERCENT_RANK() term.
unsafeAddPlaceHolders :: Functor f => f a -> f (PlaceHolders p, a) Source #
Unsafely add placeholder parameter to queries.
unsafePlaceHolders :: PlaceHolders p Source #
Unsafely get placeholder parameter
unitPlaceHolder :: PlaceHolders () Source #
No placeholder semantics
unitPH :: PlaceHolders () Source #
No placeholder semantics. Same as unitPlaceHolder
pwPlaceholder :: SqlContext c => PersistableRecordWidth a -> (Record c a -> b) -> (PlaceHolders a, b) Source #
Provide scoped placeholder from width and return its parameter object.
placeholder' :: (PersistableWidth t, SqlContext c) => (Record c t -> a) -> (PlaceHolders t, a) Source #
Provide scoped placeholder and return its parameter object.
placeholder :: (PersistableWidth t, SqlContext c, Monad m) => (Record c t -> m a) -> m (PlaceHolders t, a) Source #
Provide scoped placeholder and return its parameter object. Monadic version.
projectZip :: ProductIsoApplicative p => p a -> p b -> p (a, b) Source #
Zipping projections.
(><) :: ProductIsoApplicative p => p a -> p b -> p (a, b) infixl 1 Source #
Binary operator the same as projectZip
.
unsafeAggregateOp :: (AggregatedContext ac, SqlContext ac) => Keyword -> Record Flat a -> Record ac b Source #
Unsafely make aggregation uni-operator from SQL keyword.
count :: (Integral b, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac b Source #
Aggregation function COUNT.
sumMaybe :: (Num a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a) Source #
Aggregation function SUM.
sum' :: (Num a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a) Source #
Aggregation function SUM.
avgMaybe :: (Num a, Fractional b, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe b) Source #
Aggregation function AVG.
avg :: (Num a, Fractional b, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe b) Source #
Aggregation function AVG.
maxMaybe :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a) Source #
Aggregation function MAX.
max' :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a) Source #
Aggregation function MAX.
minMaybe :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a) Source #
Aggregation function MIN.
min' :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a) Source #
Aggregation function MIN.
every :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool) Source #
Aggregation function EVERY.
any' :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool) Source #
Aggregation function ANY.
some' :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool) Source #
Aggregation function SOME.
:: PersistableWidth a | |
=> Record c a | Source |
-> Pi a b | Record path |
-> Record c b | Narrower projected object |
Get narrower record along with projection path.
:: (PersistableWidth a, ProjectableFlattenMaybe (Maybe b) c) | |
=> Record cont (Maybe a) | |
-> Pi a b | Projection path |
-> Record cont c |
Get narrower record with flatten leaf phantom Maybe types along with projection path.
:: (PersistableWidth a, ProjectableFlattenMaybe (Maybe b) c) | |
=> Record cont (Maybe a) | |
-> Pi a b | Projection path |
-> Record cont c | Narrower flatten and projected object. |
Get narrower record with flatten leaf phantom Maybe types along with projection path.
:: PersistableWidth a | |
=> Record c (Maybe a) | |
-> Pi a b | Record path |
-> Record c (Maybe b) | Narrower projected object. |
Same as '(?!)'. Use this operator like '(? #foo) mayX'.
:: PersistableWidth a | |
=> Record c (Maybe a) | |
-> Pi a (Maybe b) | Record path. |
-> Record c (Maybe b) | Narrower projected object. |
Same as '(?!?)'. Use this operator like '(?? #foo) mayX'.
class Monad m => MonadPartition c m where Source #
Window specification building interface.
partitionBy :: Record c r -> m () Source #
Add PARTITION BY term into context.
Instances
MonadPartition c m => MonadPartition c (Orderings c m) Source # |
|
Defined in Database.Relational.Monad.Trans.Ordering partitionBy :: Record c r -> Orderings c m () Source # | |
Monad m => MonadPartition c (PartitioningSetT c m) Source # | Partition clause instance |
Defined in Database.Relational.Monad.Trans.Aggregating partitionBy :: Record c r -> PartitioningSetT c m () Source # |
class MonadQuery m => MonadAggregate m where Source #
Aggregated query building interface extends MonadQuery
.
:: Record Flat r | Record to add into group by |
-> m (Record Aggregated r) | Result context and aggregated record | Add GROUP BY term into context and get aggregated record. Non-traditional group-by version. |
Add GROUP BY term into context and get aggregated record.
:: AggregateKey (Record Aggregated r) | Key to aggretate for non-traditional group-by interface |
-> m (Record Aggregated r) | Result context and aggregated record |
Instances
MonadQuery m => MonadAggregate (AggregatingSetT m) Source # | Aggregated query instance. |
Defined in Database.Relational.Monad.Trans.Aggregating groupBy :: Record Flat r -> AggregatingSetT m (Record Aggregated r) Source # groupBy' :: AggregateKey (Record Aggregated r) -> AggregatingSetT m (Record Aggregated r) Source # | |
MonadAggregate m => MonadAggregate (Restrictings c m) Source # | Resticted |
Defined in Database.Relational.Monad.Trans.Restricting groupBy :: Record Flat r -> Restrictings c m (Record Aggregated r) Source # groupBy' :: AggregateKey (Record Aggregated r) -> Restrictings c m (Record Aggregated r) Source # | |
MonadAggregate m => MonadAggregate (Orderings c m) Source # |
|
Defined in Database.Relational.Monad.Trans.Ordering groupBy :: Record Flat r -> Orderings c m (Record Aggregated r) Source # groupBy' :: AggregateKey (Record Aggregated r) -> Orderings c m (Record Aggregated r) Source # |
class (Functor q, Monad q, Functor m, Monad m) => MonadQualify q m Source #
Lift interface from base qualify monad.
Instances
class (Functor m, Monad m, MonadQualify ConfigureQuery m) => MonadQuery m where Source #
Query building interface.
query' :: Relation p r -> m (PlaceHolders p, Record Flat r) Source #
Join sub-query with place-holder parameter p
. query result is not Maybe
.
queryMaybe' :: Relation p r -> m (PlaceHolders p, Record Flat (Maybe r)) Source #
Join sub-query with place-holder parameter p
. Query result is Maybe
.
Instances
class (Functor m, Monad m) => MonadRestrict c m where Source #
Restrict context interface
Add restriction to this context.
Instances
MonadRestrict c m => MonadRestrict c (AggregatingSetT m) Source # | Aggregated |
Defined in Database.Relational.Monad.Trans.Aggregating restrict :: Predicate c -> AggregatingSetT m () Source # | |
(Monad q, Functor q) => MonadRestrict c (Restrictings c q) Source # |
|
Defined in Database.Relational.Monad.Trans.Restricting restrict :: Predicate c -> Restrictings c q () Source # | |
MonadRestrict rc m => MonadRestrict rc (Orderings c m) Source # |
|
MonadRestrict c m => MonadRestrict c (Assignings r m) Source # |
|
Defined in Database.Relational.Monad.Trans.Assigning restrict :: Predicate c -> Assignings r m () Source # | |
MonadRestrict Flat q => MonadRestrict Flat (Restrictings Aggregated q) Source # | Restricted |
Defined in Database.Relational.Monad.Aggregate restrict :: Predicate Flat -> Restrictings Aggregated q () Source # |
all' :: MonadQuery m => m () Source #
Specify ALL attribute to query context.
distinct :: MonadQuery m => m () Source #
Specify DISTINCT attribute to query context.
on :: MonadQuery m => Predicate Flat -> m () Source #
Add restriction to last join. Record type version.
wheres :: MonadRestrict Flat m => Predicate Flat -> m () Source #
Add restriction to this not aggregated query.
having :: MonadRestrict Aggregated m => Predicate Aggregated -> m () Source #
Add restriction to this aggregated query. Aggregated Record type version.
type Restrict = Restrictings Flat ConfigureQuery Source #
Restrict only monad type used from update statement and delete statement.
:: Monad m | |
=> Record c t | Ordering terms to add |
-> Order | Order direction |
-> Nulls | Order of null |
-> Orderings c m () | Result context with ordering |
Add ordering terms with null ordering.
:: Monad m | |
=> Record c t | Ordering terms to add |
-> Order | Order direction |
-> Orderings c m () | Result context with ordering |
Add ordering terms.
Add ascendant ordering term.
Add descendant ordering term.
type OrderedQuery c m p r = Orderings c m (PlaceHolders p, Record c r) Source #
OrderedQuery monad type with placeholder type p
. Record must be the same as Orderings
context type parameter c
.
type QueryCore = Restrictings Flat (QueryJoin ConfigureQuery) Source #
Core query monad type used from flat(not-aggregated) query and aggregated query.
extractCore :: QueryCore a -> ConfigureQuery (((a, [Predicate Flat]), JoinProduct), Duplication) Source #
Extract QueryCore
computation.
data QueryUnique a Source #
Unique query monad type.
Instances
type SimpleQuery p r = OrderedQuery Flat QueryCore p r Source #
Simple (not-aggregated) query type. SimpleQuery'
p r == QuerySimple
(PlaceHolders
p, Record
r).
assignTo :: Monad m => Record Flat v -> AssignTarget r v -> Assignings r m () Source #
Add an assignment.
(<-#) :: Monad m => AssignTarget r v -> Record Flat v -> Assignings r m () infix 4 Source #
Add and assginment.
type Register r = Assignings r ConfigureQuery Source #
Target register monad type used from insert statement.
type Assign r = Assignings r Restrict Source #
Target update monad type used from update statement and merge statement.
key :: Record Flat r -> AggregatingSet (Record Aggregated (Maybe r)) Source #
Specify key of single grouping set from Record.
key' :: AggregateKey a -> AggregatingSet a Source #
Specify key of single grouping set.
set :: AggregatingSet a -> AggregatingSetList a Source #
Finalize and specify single grouping set.
bkey :: Record Flat r -> AggregatingPowerSet (Record Aggregated (Maybe r)) Source #
Specify key of rollup and cube power set.
rollup :: AggregatingPowerSet a -> AggregateKey a Source #
Finalize grouping power set as rollup power set.
cube :: AggregatingPowerSet a -> AggregateKey a Source #
Finalize grouping power set as cube power set.
groupingSets :: AggregatingSetList a -> AggregateKey a Source #
Finalize grouping set list.
type Window c = Orderings c (PartitioningSet c) Source #
Partition monad type for partition-by clause.
type AggregatedQuery p r = OrderedQuery Aggregated (Restrictings Aggregated (AggregatingSetT QueryCore)) p r Source #
Aggregated query type. AggregatedQuery
p r == QueryAggregate
(PlaceHolders
p, Record
Aggregated
r).
type QueryAggregate = Orderings Aggregated (Restrictings Aggregated (AggregatingSetT QueryCore)) Source #
Aggregated query monad type.
over :: SqlContext c => Record OverWindow a -> Window c () -> Record c a infix 8 Source #
Operator to make record of window function result using built Window
monad.
data UniqueRelation p c r Source #
Unique relation type to compose scalar queries.
derivedRelation :: TableDerivable r => Relation () r Source #
Inferred Relation
.
tableOf :: TableDerivable r => Relation () r -> Table r Source #
Interface to derive Table
type object.
query :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Record Flat r) Source #
Join sub-query. Query result is not NodeAttr
.
queryMaybe :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Record Flat (Maybe r)) Source #
Join sub-query. Query result is NodeAttr
.
The combinations of query
and queryMaybe
express
inner joins, left outer joins, right outer joins, and full outer joins.
Here is an example of a right outer join:
outerJoin = relation $ do e <- queryMaybe employee d <- query department on $ e ?! E.deptId' .=. just (d ! D.deptId') return $ (,) |$| e |*| d
queryList' :: MonadQualify ConfigureQuery m => Relation p r -> m (PlaceHolders p, RecordList (Record c) r) Source #
List sub-query, for IN and EXIST with place-holder parameter p
.
queryList :: MonadQualify ConfigureQuery m => Relation () r -> m (RecordList (Record c) r) Source #
List sub-query, for IN and EXIST.
relation' :: SimpleQuery p r -> Relation p r Source #
Finalize QuerySimple
monad and generate Relation
with place-holder parameter p
.
relation :: QuerySimple (Record Flat r) -> Relation () r Source #
Finalize QuerySimple
monad and generate Relation
.
aggregateRelation' :: AggregatedQuery p r -> Relation p r Source #
Finalize QueryAggregate
monad and geneate Relation
with place-holder parameter p
.
aggregateRelation :: QueryAggregate (Record Aggregated r) -> Relation () r Source #
Finalize QueryAggregate
monad and geneate Relation
.
unsafeUnique :: Relation p r -> UniqueRelation p c r Source #
Unsafely specify unique relation.
unUnique :: UniqueRelation p c r -> Relation p r Source #
Discard unique attribute.
uniqueQuery' :: UniqueRelation p c r -> QueryUnique (PlaceHolders p, Record c r) Source #
Join unique sub-query with place-holder parameter p
.
uniqueQueryMaybe' :: UniqueRelation p c r -> QueryUnique (PlaceHolders p, Record c (Maybe r)) Source #
Join unique sub-query with place-holder parameter p
. Query result is NodeAttr
.
uniqueRelation' :: QueryUnique (PlaceHolders p, Record c r) -> UniqueRelation p c r Source #
Finalize QueryUnique
monad and generate UniqueRelation
.
aggregatedUnique :: Relation ph r -> Pi r a -> (Record Flat a -> Record Aggregated b) -> UniqueRelation ph Flat b Source #
Aggregated UniqueRelation
.
queryScalar' :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation p c r -> m (PlaceHolders p, Record c (Maybe r)) Source #
Scalar sub-query with place-holder parameter p
.
queryScalar :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation () c r -> m (Record c (Maybe r)) Source #
Scalar sub-query.
:: Relation pa a | Left query to join |
-> Relation pb b | Right query to join |
-> [JoinRestriction a b] | Join restrictions |
-> Relation (pa, pb) (a, b) | Result joined relation |
Direct inner join with place-holder parameters.
:: Relation pa a | Left query to join |
-> Relation pb b | Right query to join |
-> [JoinRestriction a (Maybe b)] | Join restrictions |
-> Relation (pa, pb) (a, Maybe b) | Result joined relation |
Direct left outer join with place-holder parameters.
:: Relation pa a | Left query to join |
-> Relation pb b | Right query to join |
-> [JoinRestriction (Maybe a) b] | Join restrictions |
-> Relation (pa, pb) (Maybe a, b) | Result joined relation |
Direct right outer join with place-holder parameters.
:: Relation pa a | Left query to join |
-> Relation pb b | Right query to join |
-> [JoinRestriction (Maybe a) (Maybe b)] | Join restrictions |
-> Relation (pa, pb) (Maybe a, Maybe b) | Result joined relation |
Direct full outer join with place-holder parameters.
:: Relation () a | Left query to join |
-> Relation () b | Right query to join |
-> [JoinRestriction a b] | Join restrictions |
-> Relation () (a, b) | Result joined relation |
Direct inner join.
:: Relation () a | Left query to join |
-> Relation () b | Right query to join |
-> [JoinRestriction a (Maybe b)] | Join restrictions |
-> Relation () (a, Maybe b) | Result joined relation |
Direct left outer join.
:: Relation () a | Left query to join |
-> Relation () b | Right query to join |
-> [JoinRestriction (Maybe a) b] | Join restrictions |
-> Relation () (Maybe a, b) | Result joined relation |
Direct right outer join.
:: Relation () a | Left query to join |
-> Relation () b | Right query to join |
-> [JoinRestriction (Maybe a) (Maybe b)] | Join restrictions |
-> Relation () (Maybe a, Maybe b) | Result joined relation |
Direct full outer join.
on' :: ([JoinRestriction a b] -> Relation pc (a, b)) -> [JoinRestriction a b] -> Relation pc (a, b) infixl 8 Source #
Apply restriction for direct join style.
unionAll :: Relation () a -> Relation () a -> Relation () a infixl 7 Source #
Union of two relations. Not distinct.
except :: Relation () a -> Relation () a -> Relation () a infixl 7 Source #
Subtraction of two relations.
exceptAll :: Relation () a -> Relation () a -> Relation () a infixl 7 Source #
Subtraction of two relations. Not distinct.
intersect :: Relation () a -> Relation () a -> Relation () a infixl 8 Source #
Intersection of two relations.
intersectAll :: Relation () a -> Relation () a -> Relation () a infixl 8 Source #
Intersection of two relations. Not distinct.
union' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 7 Source #
Union of two relations with place-holder parameters.
unionAll' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 7 Source #
Union of two relations with place-holder parameters. Not distinct.
except' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 7 Source #
Subtraction of two relations with place-holder parameters.
exceptAll' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 7 Source #
Subtraction of two relations with place-holder parameters. Not distinct.
intersect' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 8 Source #
Intersection of two relations with place-holder parameters.
intersectAll' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 8 Source #
Intersection of two relations with place-holder parameters. Not distinct.
data InsertTarget p r Source #
InsertTarget type with place-holder parameter p
and projected record type r
.
data UpdateTarget p r Source #
UpdateTarget type with place-holder parameter p
and projected record type r
.
Instances
TableDerivable r => Show (UpdateTarget p r) Source # | |
Defined in Database.Relational.Effect showsPrec :: Int -> UpdateTarget p r -> ShowS # show :: UpdateTarget p r -> String # showList :: [UpdateTarget p r] -> ShowS # |
data Restriction p r Source #
Restriction type with place-holder parameter p
and projected record type r
.
Instances
TableDerivable r => Show (Restriction p r) Source # | Show where clause. |
Defined in Database.Relational.Effect showsPrec :: Int -> Restriction p r -> ShowS # show :: Restriction p r -> String # showList :: [Restriction p r] -> ShowS # |
restriction :: RestrictedStatement r () -> Restriction () r Source #
Finalize Restrict
monad and generate Restriction
.
restriction' :: RestrictedStatement r (PlaceHolders p) -> Restriction p r Source #
Finalize Restrict
monad and generate Restriction
with place-holder parameter p
sqlWhereFromRestriction :: Config -> Table r -> Restriction p r -> StringSQL Source #
SQL WHERE clause StringSQL
string from Restriction
.
updateTarget :: AssignStatement r () -> UpdateTarget () r Source #
Finalize Target
monad and generate UpdateTarget
.
updateTarget' :: AssignStatement r (PlaceHolders p) -> UpdateTarget p r Source #
Finalize Target
monad and generate UpdateTarget
with place-holder parameter p
.
liftTargetAllColumn :: PersistableWidth r => Restriction () r -> UpdateTarget r r Source #
Lift Restriction
to UpdateTarget
. Update target columns are all.
liftTargetAllColumn' :: PersistableWidth r => Restriction p r -> UpdateTarget (r, p) r Source #
Lift Restriction
to UpdateTarget
. Update target columns are all. With placefolder type p
.
updateTargetAllColumn :: PersistableWidth r => RestrictedStatement r () -> UpdateTarget r r Source #
Finalize Restrict
monad and generate UpdateTarget
. Update target columns are all.
updateTargetAllColumn' :: PersistableWidth r => RestrictedStatement r (PlaceHolders p) -> UpdateTarget (r, p) r Source #
Finalize Restrict
monad and generate UpdateTarget
. Update target columns are all. With placefolder type p
.
sqlFromUpdateTarget :: Config -> Table r -> UpdateTarget p r -> StringSQL Source #
SQL SET clause and WHERE clause StringSQL
string from UpdateTarget
insertTarget :: Register r () -> InsertTarget () r Source #
Finalize Register
monad and generate InsertTarget
.
insertTarget' :: Register r (PlaceHolders p) -> InsertTarget p r Source #
Finalize Target
monad and generate UpdateTarget
with place-holder parameter p
.
piRegister :: PersistableWidth r => Pi r r' -> Register r (PlaceHolders r') Source #
sqlChunkFromInsertTarget :: Config -> Table r -> InsertTarget p r -> (StringSQL, Int) Source #
Make StringSQL
string of SQL INSERT record chunk statement from InsertTarget
sqlFromInsertTarget :: Config -> Table r -> InsertTarget p r -> StringSQL Source #
Make StringSQL
string of SQL INSERT statement from InsertTarget
sqlChunksFromRecordList :: ShowConstantTermsSQL r' => Config -> Table r -> Pi r r' -> [r'] -> [StringSQL] Source #
Make StringSQL
strings of SQL INSERT strings from records list
class UntypeableNoFetch s where Source #
Untype interface for typed no-result type statments
with single type parameter which represents place-holder parameter p
.
untypeNoFetch :: s p -> String Source #
Instances
UntypeableNoFetch Delete Source # | |
Defined in Database.Relational.Type untypeNoFetch :: Delete p -> String Source # | |
UntypeableNoFetch InsertQuery Source # | |
Defined in Database.Relational.Type untypeNoFetch :: InsertQuery p -> String Source # | |
UntypeableNoFetch Insert Source # | |
Defined in Database.Relational.Type untypeNoFetch :: Insert p -> String Source # | |
UntypeableNoFetch Update Source # | |
Defined in Database.Relational.Type untypeNoFetch :: Update p -> String Source # |
Delete type with place-holder parameter p
.
Instances
UntypeableNoFetch Delete Source # | |
Defined in Database.Relational.Type untypeNoFetch :: Delete p -> String Source # | |
Show (Delete p) Source # | Show delete SQL string |
newtype InsertQuery p Source #
InsertQuery type.
Instances
UntypeableNoFetch InsertQuery Source # | |
Defined in Database.Relational.Type untypeNoFetch :: InsertQuery p -> String Source # | |
Show (InsertQuery p) Source # | Show insert SQL string. |
Defined in Database.Relational.Type showsPrec :: Int -> InsertQuery p -> ShowS # show :: InsertQuery p -> String # showList :: [InsertQuery p] -> ShowS # |
Insert type to insert record type a
.
Insert | |
|
Instances
UntypeableNoFetch Insert Source # | |
Defined in Database.Relational.Type untypeNoFetch :: Insert p -> String Source # | |
Show (Insert a) Source # | Show insert SQL string. |
Update type with place-holder parameter p
.
Instances
UntypeableNoFetch Update Source # | |
Defined in Database.Relational.Type untypeNoFetch :: Update p -> String Source # | |
Show (Update p) Source # | Show update SQL string |
Update type with key type p
and update record type a
.
Columns to update are record columns other than key columns,
So place-holder parameter type is the same as record type a
.
KeyUpdate | |
|
Query type with place-holder parameter p
and query result type a
.
Unsafely make typed Query
from SQL string.
relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> String Source #
From Relation
into untyped SQL query string.
relationalQuery' :: Relation p r -> QuerySuffix -> Query p r Source #
typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p r Source #
derivedKeyUpdate :: TableDerivable r => Pi r p -> KeyUpdate p r Source #
updateSQL :: Config -> Table r -> UpdateTarget p r -> String Source #
Make untyped update SQL string from Table
and UpdateTarget
.
typedUpdate' :: Config -> Table r -> UpdateTarget p r -> Update p Source #
Make typed Update
from Config
, Table
and UpdateTarget
.
typedUpdate :: Table r -> UpdateTarget p r -> Update p Source #
Deprecated: use typedUpdate
defaultConfig` instead of this.
Make typed Update
using defaultConfig
, Table
and UpdateTarget
.
update' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p Source #
Make typed Update
from Config
, derived table and AssignStatement
derivedUpdate' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p Source #
Deprecated: use update'
instead of this.
Make typed Update
from Config
, derived table and AssignStatement
update :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p Source #
Make typed Update
from defaultConfig
, derived table and AssignStatement
updateNoPH :: TableDerivable r => AssignStatement r () -> Update () Source #
Make typed Update
from defaultConfig
, derived table and AssignStatement
with no(unit) placeholder.
derivedUpdate :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p Source #
Deprecated: use update
instead of this.
Make typed Update
from defaultConfig
, derived table and AssignStatement
typedUpdateAllColumn :: PersistableWidth r => Table r -> Restriction p r -> Update (r, p) Source #
Make typed Update
from Table
and Restriction
.
Update target is all column.
updateAllColumn' :: (PersistableWidth r, TableDerivable r) => Config -> RestrictedStatement r (PlaceHolders p) -> Update (r, p) Source #
Make typed Update
from Config
, derived table and AssignStatement
.
Update target is all column.
derivedUpdateAllColumn' :: (PersistableWidth r, TableDerivable r) => Config -> RestrictedStatement r (PlaceHolders p) -> Update (r, p) Source #
Deprecated: use updateAllColumn'
instead of this.
Make typed Update
from Config
, derived table and AssignStatement
.
Update target is all column.
updateAllColumn :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r (PlaceHolders p) -> Update (r, p) Source #
Make typed Update
from defaultConfig
, derived table and AssignStatement
.
Update target is all column.
updateAllColumnNoPH :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r () -> Update r Source #
Make typed Update
from defaultConfig
, derived table and AssignStatement
without placeholder other than target table columns.
Update target is all column.
derivedUpdateAllColumn :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r (PlaceHolders p) -> Update (r, p) Source #
Deprecated: use updateAllColumn
instead of this.
Make typed Update
from defaultConfig
, derived table and AssignStatement
.
Update target is all column.
untypeChunkInsert :: Insert a -> String Source #
Statement to use chunked insert
chunkSizeOfInsert :: Insert a -> Int Source #
Size to use chunked insert
unsafeTypedInsert' :: String -> String -> Int -> Insert a Source #
Unsafely make typed Insert
from single insert and chunked insert SQL.
typedInsert' :: PersistableWidth r => Config -> Table r -> Pi r r' -> Insert r' Source #
typedInsert :: PersistableWidth r => Table r -> Pi r r' -> Insert r' Source #
Deprecated: use typedInsert
defaultConfig` instead of this.
insert :: (PersistableWidth r, TableDerivable r) => Pi r r' -> Insert r' Source #
Table type inferred Insert
.
derivedInsert :: (PersistableWidth r, TableDerivable r) => Pi r r' -> Insert r' Source #
typedInsertValue' :: Config -> Table r -> InsertTarget p r -> Insert p Source #
Make typed Insert
from Config
, Table
and monadic builded InsertTarget
object.
typedInsertValue :: Table r -> InsertTarget p r -> Insert p Source #
Deprecated: use typedInsertValue
defaultConfig` instead of this.
Make typed Insert
from Table
and monadic builded InsertTarget
object.
insertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p Source #
derivedInsertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p Source #
Deprecated: use insertValue'
instead of this.
Make typed Insert
from Config
, derived table and monadic builded Register
object.
insertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p Source #
Make typed Insert
from defaultConfig
, derived table and monadic builded Register
object.
insertValueNoPH :: TableDerivable r => Register r () -> Insert () Source #
Make typed Insert
from defaultConfig
, derived table and monadic builded Register
object with no(unit) placeholder.
derivedInsertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p Source #
Deprecated: use insertValue
instead of this.
Make typed Insert
from defaultConfig
, derived table and monadic builded Register
object.
insertValueList' :: (TableDerivable r, ShowConstantTermsSQL r') => Config -> Pi r r' -> [r'] -> [Insert ()] Source #
insertValueList :: (TableDerivable r, ShowConstantTermsSQL r') => Pi r r' -> [r'] -> [Insert ()] Source #
Make typed Insert
list from records list.
typedInsertQuery' :: Config -> Table r -> Pi r r' -> Relation p r' -> InsertQuery p Source #
Make typed InsertQuery
from columns selector Table
, Pi
and Relation
with configuration parameter.
typedInsertQuery :: Table r -> Pi r r' -> Relation p r' -> InsertQuery p Source #
Deprecated: use typedInsertQuery
defaultConfig` instead of this.
Make typed InsertQuery
from columns selector Table
, Pi
and Relation
.
insertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p Source #
Table type inferred InsertQuery
.
derivedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p Source #
Deprecated: use insertQuery
instead of this.
Table type inferred InsertQuery
.
deleteSQL :: Config -> Table r -> Restriction p r -> String Source #
Make untyped delete SQL string from Table
and Restriction
.
typedDelete' :: Config -> Table r -> Restriction p r -> Delete p Source #
Make typed Delete
from Config
, Table
and Restriction
.
typedDelete :: Table r -> Restriction p r -> Delete p Source #
Deprecated: use typedDelete
defaultConfig` instead of this.
Make typed Delete
from Table
and Restriction
.
delete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p Source #
derivedDelete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p Source #
delete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p Source #
Make typed Delete
from defaultConfig
, derived table and RestrictContext
deleteNoPH :: TableDerivable r => RestrictedStatement r () -> Delete () Source #
Make typed Delete
from defaultConfig
, derived table and RestrictContext
with no(unit) placeholder.
derivedDelete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p Source #
Deprecated: use delete
instead of this.
Make typed Delete
from defaultConfig
, derived table and RestrictContext
Sequence number type for record type r
Instances
Eq i => Eq (Number r i) Source # | |
Ord i => Ord (Number r i) Source # | |
Defined in Database.Relational.Sequence | |
Show i => Show (Number r i) Source # | |
class (TableDerivable r, SequenceDerivable s i) => Binding r s i | r -> s where Source #
Nothing
binding :: SeqBinding r s i Source #
binding :: HasConstraintKey Primary r i => SeqBinding r s i Source #
data SeqBinding r s i Source #
Record to express binding between normal-table and sequence-table.
class TableDerivable s => SequenceDerivable s i | s -> i where Source #
Sequence
derivation rule
derivedSequence :: Sequence s i Source #
Basic record to express sequence-table. actual sequence-table is a table which has only one column of integer type.
unsafeSpecifySequence :: TableDerivable s => (s -> i) -> Pi s i -> Sequence s i Source #
Unsafely specify sequence table.
seqRelation :: TableDerivable s => Sequence s i -> Relation () s Source #
Infer Relation
of sequence table
unsafeSpecifyBinding :: (TableDerivable r, SequenceDerivable s i) => Pi r i -> SeqBinding r s i Source #
Unsafely specify binding between normal-table and sequence-table.
primaryBinding :: (TableDerivable r, SequenceDerivable s i, HasConstraintKey Primary r i) => SeqBinding r s i Source #
Derive binding using primary key.
unsafeSpecifyNumber :: Binding r s i => i -> Number r i Source #
Unsafely specify sequence number.
extractNumber :: Number r i -> i Source #
Get untyped sequence number.
:: (i -> r) | sequence number should be passed to proper field of record |
-> Number r i | |
-> r |
Unsafely apply sequence number.
:: Binding r s i | |
=> (i -> r) | sequence number should be passed to proper field of record |
-> Number r i | |
-> r |
Unsafely apply sequence number. Only safe to build corresponding record type.
:: (PersistableWidth s, Integral i, ShowConstantTermsSQL i) | |
=> Config | |
-> i | sequence number to set. expect not SQL injectable. |
-> Sequence s i | sequence table |
-> Update () |
Update statement for sequence table
:: (PersistableWidth s, Integral i, ShowConstantTermsSQL i) | |
=> i | sequence number to set. expect not SQL injectable. |
-> Sequence s i | sequence table |
-> Update () |
Update statement for sequence table
:: PersistableWidth p | |
=> Pi a p | Projection path |
-> Relation () a |
|
-> Relation p a | Result restricted |
Query restricted with specified key.
:: PersistableWidth p | |
=> Key Unique a p | Unique key proof object which record type is |
-> Relation () a |
|
-> Relation p a | Result restricted |
Query restricted with specified unique key.
unique :: PersistableWidth p => Key Unique a p -> Relation () a -> Relation p a Source #
Deprecated: use uniqueSelect
instead of this.
Deprecated.
:: PersistableWidth p | |
=> Key Primary a p | Primary key proof object which record type is |
-> Relation () a |
|
-> Relation p a | Result restricted |
Deprecated: use primarySelect
instead of this.
Deprecated.
:: HasConstraintKey Primary a p | |
=> Relation () a |
|
-> Relation p a | Result restricted |
Query restricted with inferred primary key.
primary :: HasConstraintKey Primary a p => Relation () a -> Relation p a Source #
Deprecated: use primarySelect
instead of this.
Deprecated.
updateValuesWithKey :: ToSql q r => Pi r p -> r -> [q] Source #
Convert from Haskell type r
into SQL value q
list expected by update form like
UPDATE table SET c0 = ?, c1 = ?, ..., cn = ? WHERE key0 = ? AND key1 = ? AND key2 = ? ...
using derived RecordToSql
proof object.
updateByConstraintKey Source #
:: Table r |
|
-> Key c r p | Key with constraint |
-> KeyUpdate p r | Result typed |
Typed KeyUpdate
using specified constraint key.
:: HasConstraintKey Primary r p | |
=> Table r |
|
-> KeyUpdate p r | Result typed |
Typed KeyUpdate
using inferred primary key.
derivedUniqueRelation Source #
:: TableDerivable r | |
=> Key Unique r k | Unique key proof object which record type is |
-> Record c k | Unique key value to specify. |
-> UniqueRelation () c r | Result restricted |
UniqueRelation
inferred from table.
module Database.Relational.Compat