Copyright | (c) digitally induced GmbH 2021 |
---|---|
Safe Haskell | None |
IHP.DataSync.DynamicQuery
Contents
Description
Synopsis
- data Field = Field {}
- data DynamicValue
- = IntValue !Int
- | DoubleValue !Double
- | TextValue !Text
- | BoolValue !Bool
- | UUIDValue !UUID
- | DateTimeValue !UTCTime
- | PointValue !Point
- | IntervalValue !PGInterval
- | ArrayValue ![DynamicValue]
- | Null
- newtype UndecodedJSON = UndecodedJSON ByteString
- data DynamicSQLQuery = DynamicSQLQuery {
- table :: !Text
- selectedColumns :: SelectedColumns
- whereCondition :: !(Maybe ConditionExpression)
- orderByClause :: ![OrderByClause]
- distinctOnColumn :: !(Maybe ByteString)
- limit :: !(Maybe Int)
- offset :: !(Maybe Int)
- data OrderByClause
- = OrderByClause { }
- | OrderByTSRank { }
- data ConditionExpression
- = ColumnExpression { }
- | InfixOperatorExpression { }
- | LiteralExpression {
- value :: !DynamicValue
- | CallExpression { }
- | ListExpression {
- values :: ![DynamicValue]
- data FunctionCall = ToTSQuery {}
- data ConditionOperator
- data SelectedColumns
- = SelectAll
- | SelectSpecific [Text]
- recordIds :: [[Field]] -> [UUID]
- transformColumnNamesToFieldNames :: Value -> Value
Documentation
Constructors
Field | |
Fields
|
data DynamicValue Source #
Constructors
IntValue !Int | |
DoubleValue !Double | |
TextValue !Text | |
BoolValue !Bool | |
UUIDValue !UUID | |
DateTimeValue !UTCTime | |
PointValue !Point | |
IntervalValue !PGInterval | |
ArrayValue ![DynamicValue] | |
Null |
Instances
FromJSON DynamicValue Source # | |
Defined in IHP.DataSync.DynamicQuery | |
ToJSON DynamicValue Source # | |
Defined in IHP.DataSync.DynamicQuery Methods toJSON :: DynamicValue -> Value # toEncoding :: DynamicValue -> Encoding # toJSONList :: [DynamicValue] -> Value # toEncodingList :: [DynamicValue] -> Encoding # omitField :: DynamicValue -> Bool # | |
Show DynamicValue Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> DynamicValue -> ShowS # show :: DynamicValue -> String showList :: [DynamicValue] -> ShowS # | |
Eq DynamicValue Source # | |
Defined in IHP.DataSync.DynamicQuery | |
FromField DynamicValue Source # | |
Defined in IHP.DataSync.DynamicQuery Methods fromField :: FieldParser DynamicValue | |
ToField DynamicValue | |
Defined in IHP.DataSync.DynamicQueryCompiler Methods toField :: DynamicValue -> Action |
newtype UndecodedJSON Source #
Constructors
UndecodedJSON ByteString |
Instances
ToJSON UndecodedJSON Source # | |
Defined in IHP.DataSync.REST.Controller Methods toJSON :: UndecodedJSON -> Value # toEncoding :: UndecodedJSON -> Encoding # toJSONList :: [UndecodedJSON] -> Value # toEncodingList :: [UndecodedJSON] -> Encoding # omitField :: UndecodedJSON -> Bool # | |
Show UndecodedJSON Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> UndecodedJSON -> ShowS # show :: UndecodedJSON -> String showList :: [UndecodedJSON] -> ShowS # | |
Eq UndecodedJSON Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: UndecodedJSON -> UndecodedJSON -> Bool # (/=) :: UndecodedJSON -> UndecodedJSON -> Bool # | |
FromField UndecodedJSON Source # | |
Defined in IHP.DataSync.DynamicQuery Methods fromField :: FieldParser UndecodedJSON |
data DynamicSQLQuery Source #
Similiar to IHP.QueryBuilder.SQLQuery, but is designed to be accessed by external users
When compiling to SQL we have to be extra careful to escape all identifers and variables in the query. The normal IHP.QueryBuilder doesn't need to be that careful as parts of the input are derived from generated code from the Schema.sql.
Constructors
DynamicSQLQuery | |
Fields
|
Instances
FromJSON DynamicSQLQuery Source # | |
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser DynamicSQLQuery # parseJSONList :: Value -> Parser [DynamicSQLQuery] # | |
Show DynamicSQLQuery Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> DynamicSQLQuery -> ShowS # show :: DynamicSQLQuery -> String showList :: [DynamicSQLQuery] -> ShowS # | |
Eq DynamicSQLQuery Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: DynamicSQLQuery -> DynamicSQLQuery -> Bool # (/=) :: DynamicSQLQuery -> DynamicSQLQuery -> Bool # |
data OrderByClause Source #
Constructors
OrderByClause | |
Fields | |
OrderByTSRank | |
Instances
FromJSON OrderByClause Source # | |||||
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser OrderByClause # parseJSONList :: Value -> Parser [OrderByClause] # | |||||
Generic OrderByClause Source # | |||||
Defined in IHP.DataSync.DynamicQuery Associated Types
| |||||
Show OrderByClause Source # | |||||
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> OrderByClause -> ShowS # show :: OrderByClause -> String showList :: [OrderByClause] -> ShowS # | |||||
NFData OrderByClause Source # | |||||
Defined in IHP.DataSync.DynamicQuery Methods rnf :: OrderByClause -> () # | |||||
Eq OrderByClause Source # | |||||
Defined in IHP.DataSync.DynamicQuery Methods (==) :: OrderByClause -> OrderByClause -> Bool # (/=) :: OrderByClause -> OrderByClause -> Bool # | |||||
ParamReader OrderByClause Source # | |||||
Defined in IHP.DataSync.REST.Controller Methods readParameter :: ByteString -> Either ByteString OrderByClause Source # readParameterJSON :: Value -> Either ByteString OrderByClause Source # | |||||
type Rep OrderByClause Source # | |||||
Defined in IHP.DataSync.DynamicQuery type Rep OrderByClause = D1 ('MetaData "OrderByClause" "IHP.DataSync.DynamicQuery" "main" 'False) (C1 ('MetaCons "OrderByClause" 'PrefixI 'True) (S1 ('MetaSel ('Just "orderByColumn") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Just "orderByDirection") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 OrderByDirection)) :+: C1 ('MetaCons "OrderByTSRank" 'PrefixI 'True) (S1 ('MetaSel ('Just "tsvector") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "tsquery") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text))) |
data ConditionExpression Source #
Represents a WHERE conditions of a DynamicSQLQuery
Constructors
ColumnExpression | |
InfixOperatorExpression | |
Fields
| |
LiteralExpression | |
Fields
| |
CallExpression | |
Fields | |
ListExpression | |
Fields
|
Instances
FromJSON ConditionExpression Source # | |
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser ConditionExpression # parseJSONList :: Value -> Parser [ConditionExpression] # | |
Show ConditionExpression Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> ConditionExpression -> ShowS # show :: ConditionExpression -> String showList :: [ConditionExpression] -> ShowS # | |
Eq ConditionExpression Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: ConditionExpression -> ConditionExpression -> Bool # (/=) :: ConditionExpression -> ConditionExpression -> Bool # |
data FunctionCall Source #
Instances
FromJSON FunctionCall Source # | |||||
Defined in IHP.DataSync.DynamicQuery | |||||
Generic FunctionCall Source # | |||||
Defined in IHP.DataSync.DynamicQuery Associated Types
| |||||
Show FunctionCall Source # | |||||
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> FunctionCall -> ShowS # show :: FunctionCall -> String showList :: [FunctionCall] -> ShowS # | |||||
NFData FunctionCall Source # | |||||
Defined in IHP.DataSync.DynamicQuery Methods rnf :: FunctionCall -> () # | |||||
Eq FunctionCall Source # | |||||
Defined in IHP.DataSync.DynamicQuery | |||||
type Rep FunctionCall Source # | |||||
Defined in IHP.DataSync.DynamicQuery type Rep FunctionCall = D1 ('MetaData "FunctionCall" "IHP.DataSync.DynamicQuery" "main" 'False) (C1 ('MetaCons "ToTSQuery" 'PrefixI 'True) (S1 ('MetaSel ('Just "text") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text))) |
data ConditionOperator Source #
Operators available in WHERE conditions
Constructors
OpEqual | a = b |
OpGreaterThan | a > b |
OpLessThan | a < b |
OpGreaterThanOrEqual | a >= b |
OpLessThanOrEqual | a <= b |
OpNotEqual | a <> b |
OpAnd | a AND b |
OpOr | a OR b |
OpIs | a IS b |
OpIsNot | a IS NOT b |
OpTSMatch | tsvec_a @@ tsvec_b |
OpIn | a IN b |
Instances
FromJSON ConditionOperator Source # | |
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser ConditionOperator # parseJSONList :: Value -> Parser [ConditionOperator] # | |
Show ConditionOperator Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> ConditionOperator -> ShowS # show :: ConditionOperator -> String showList :: [ConditionOperator] -> ShowS # | |
Eq ConditionOperator Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: ConditionOperator -> ConditionOperator -> Bool # (/=) :: ConditionOperator -> ConditionOperator -> Bool # |
data SelectedColumns Source #
Constructors
SelectAll | SELECT * FROM table |
SelectSpecific [Text] | SELECT a, b, c FROM table |
Instances
FromJSON SelectedColumns Source # | |
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser SelectedColumns # parseJSONList :: Value -> Parser [SelectedColumns] # | |
Show SelectedColumns Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> SelectedColumns -> ShowS # show :: SelectedColumns -> String showList :: [SelectedColumns] -> ShowS # | |
Eq SelectedColumns Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: SelectedColumns -> SelectedColumns -> Bool # (/=) :: SelectedColumns -> SelectedColumns -> Bool # | |
ParamReader SelectedColumns Source # | |
Defined in IHP.DataSync.REST.Controller Methods readParameter :: ByteString -> Either ByteString SelectedColumns Source # readParameterJSON :: Value -> Either ByteString SelectedColumns Source # |
transformColumnNamesToFieldNames :: Value -> Value Source #
Transforms the keys of a JSON object from field name to column name
>>>
transformColumnNamesToFieldNames [json|{"isCompleted": true}|]
[json|{"is_completed": true}|]
Orphan instances
FromJSON ByteString Source # | |
FromJSON Condition Source # | |
FromJSON Join Source # | |
FromJSON OrderByClause Source # | |
Methods parseJSON :: Value -> Parser OrderByClause # parseJSONList :: Value -> Parser [OrderByClause] # | |
FromJSON OrderByDirection Source # | |
Methods parseJSON :: Value -> Parser OrderByDirection # parseJSONList :: Value -> Parser [OrderByDirection] # | |
FromJSON Action Source # | |
Methods parseJSON :: Value -> Parser Action # parseJSONList :: Value -> Parser [Action] # omittedField :: Maybe Action # |