Copyright | (c) Ole Krüger 2016 |
---|---|
License | BSD3 |
Maintainer | Ole Krüger <ole@vprsm.de> |
Safe Haskell | None |
Language | Haskell2010 |
- data QueryGenerator a
- = Gen Oid (a -> Maybe ByteString)
- | Code ByteString
- | With (a -> b) (QueryGenerator b)
- | Merge (QueryGenerator a) (QueryGenerator a)
- assemble :: QueryGenerator a -> a -> Query r
- assemblePrep :: ByteString -> QueryGenerator (Tuple p) -> PrepQuery p r
- withOther :: a -> QueryGenerator a -> QueryGenerator b
- genIdentifier :: ByteString -> QueryGenerator a
- genNestedIdentifier :: ByteString -> ByteString -> QueryGenerator a
- genQuote :: ByteString -> QueryGenerator a
- joinGens :: ByteString -> [QueryGenerator a] -> QueryGenerator a
- withParamN :: forall n r ts. HasElement n ts r => QueryGenerator r -> Tagged n (QueryGenerator (Tuple ts))
- withParam0 :: QueryGenerator r -> QueryGenerator (Tuple (r ': ts))
- withParam1 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (r ': ts)))
- withParam2 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (r ': ts))))
- withParam3 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (r ': ts)))))
- withParam4 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (r ': ts))))))
- withParam5 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (r ': ts)))))))
- withParam6 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (r ': ts))))))))
- withParam7 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (t6 ': (r ': ts)))))))))
- withParam8 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (t6 ': (t7 ': (r ': ts))))))))))
- withParam9 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (t6 ': (t7 ': (t8 ': (r ': ts)))))))))))
Documentation
data QueryGenerator a Source #
Generator for queries, its type parameter hints the type needed to generate the attached values
Gen Oid (a -> Maybe ByteString) | |
Code ByteString | |
With (a -> b) (QueryGenerator b) | |
Merge (QueryGenerator a) (QueryGenerator a) |
IsString (QueryGenerator a) Source # | |
Semigroup (QueryGenerator a) Source # | |
Monoid (QueryGenerator a) Source # | |
Hashable (QueryGenerator a) Source # | |
assemble :: QueryGenerator a -> a -> Query r Source #
Assemble the query object.
assemblePrep :: ByteString -> QueryGenerator (Tuple p) -> PrepQuery p r Source #
Assemble for query preparation.
withOther :: a -> QueryGenerator a -> QueryGenerator b Source #
Embed a generator which requires an external parameter.
genIdentifier :: ByteString -> QueryGenerator a Source #
Insert an identifying name. Takes care of proper quotation.
genNestedIdentifier :: ByteString -> ByteString -> QueryGenerator a Source #
Connect two identifiers with a dot. Each identifier is surrounded by quotes if necessary.
genQuote :: ByteString -> QueryGenerator a Source #
Surround with quotes and escape delimiting characters.
joinGens :: ByteString -> [QueryGenerator a] -> QueryGenerator a Source #
Join multiple query generators with a piece of code.
withParamN :: forall n r ts. HasElement n ts r => QueryGenerator r -> Tagged n (QueryGenerator (Tuple ts)) Source #
Redirect the n
-th parameter for the given query
withParam0 :: QueryGenerator r -> QueryGenerator (Tuple (r ': ts)) Source #
Redirect the 0th paramter to the given query generator.
withParam1 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (r ': ts))) Source #
Redirect the 1st paramter to the given query generator.
withParam2 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (r ': ts)))) Source #
Redirect the 2nd paramter to the given query generator.
withParam3 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (r ': ts))))) Source #
Redirect the 3rd paramter to the given query generator.
withParam4 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (r ': ts)))))) Source #
Redirect the 4th paramter to the given query generator.
withParam5 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (r ': ts))))))) Source #
Redirect the 5th paramter to the given query generator.
withParam6 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (r ': ts)))))))) Source #
Redirect the 6th paramter to the given query generator.
withParam7 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (t6 ': (r ': ts))))))))) Source #
Redirect the 7th paramter to the given query generator.
withParam8 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (t6 ': (t7 ': (r ': ts)))))))))) Source #
Redirect the 8th paramter to the given query generator.
withParam9 :: QueryGenerator r -> QueryGenerator (Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (t6 ': (t7 ': (t8 ': (r ': ts))))))))))) Source #
Redirect the 9th paramter to the given query generator.