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
- | 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 { }
- | NullExpression
- | 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
|
Instances
FromField Field Source # | |
Defined in IHP.DataSync.DynamicQuery | |
ToJSON [Field] Source # | |
Defined in IHP.DataSync.DynamicQuery |
data DynamicValue Source #
Constructors
IntValue !Int | |
DoubleValue !Double | |
TextValue !Text | |
BoolValue !Bool | |
UUIDValue !UUID | |
DateTimeValue !UTCTime | |
PointValue !Point | |
Null |
Instances
Eq DynamicValue Source # | |
Defined in IHP.DataSync.DynamicQuery | |
Show DynamicValue Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> DynamicValue -> ShowS # show :: DynamicValue -> String showList :: [DynamicValue] -> ShowS # | |
ToField DynamicValue | |
Defined in IHP.DataSync.DynamicQueryCompiler Methods toField :: DynamicValue -> Action | |
ToJSON DynamicValue Source # | |
Defined in IHP.DataSync.DynamicQuery Methods toJSON :: DynamicValue -> Value # toEncoding :: DynamicValue -> Encoding # toJSONList :: [DynamicValue] -> Value # toEncodingList :: [DynamicValue] -> Encoding # | |
FromJSON DynamicValue Source # | |
Defined in IHP.DataSync.DynamicQuery |
newtype UndecodedJSON Source #
Constructors
UndecodedJSON ByteString |
Instances
Eq UndecodedJSON Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: UndecodedJSON -> UndecodedJSON -> Bool # (/=) :: UndecodedJSON -> UndecodedJSON -> Bool # | |
Show UndecodedJSON Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> UndecodedJSON -> ShowS # show :: UndecodedJSON -> String showList :: [UndecodedJSON] -> ShowS # | |
ToJSON UndecodedJSON Source # | |
Defined in IHP.DataSync.REST.Controller Methods toJSON :: UndecodedJSON -> Value # toEncoding :: UndecodedJSON -> Encoding # toJSONList :: [UndecodedJSON] -> Value # toEncodingList :: [UndecodedJSON] -> Encoding # | |
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
Eq DynamicSQLQuery Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: DynamicSQLQuery -> DynamicSQLQuery -> Bool # (/=) :: DynamicSQLQuery -> DynamicSQLQuery -> Bool # | |
Show DynamicSQLQuery Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> DynamicSQLQuery -> ShowS # show :: DynamicSQLQuery -> String showList :: [DynamicSQLQuery] -> ShowS # | |
FromJSON DynamicSQLQuery Source # | |
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser DynamicSQLQuery # parseJSONList :: Value -> Parser [DynamicSQLQuery] # |
data OrderByClause Source #
Constructors
OrderByClause | |
Fields | |
OrderByTSRank | |
Instances
Eq OrderByClause Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: OrderByClause -> OrderByClause -> Bool # (/=) :: OrderByClause -> OrderByClause -> Bool # | |
Show OrderByClause Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> OrderByClause -> ShowS # show :: OrderByClause -> String showList :: [OrderByClause] -> ShowS # | |
Generic OrderByClause Source # | |
Defined in IHP.DataSync.DynamicQuery Associated Types type Rep OrderByClause :: Type -> Type | |
NFData OrderByClause Source # | |
Defined in IHP.DataSync.DynamicQuery Methods rnf :: OrderByClause -> () # | |
FromJSON OrderByClause Source # | |
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser OrderByClause # parseJSONList :: Value -> Parser [OrderByClause] # | |
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 | |
NullExpression | |
InfixOperatorExpression | |
Fields
| |
LiteralExpression | |
Fields
| |
CallExpression | |
Fields | |
ListExpression | |
Fields
|
Instances
Eq ConditionExpression Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: ConditionExpression -> ConditionExpression -> Bool # (/=) :: ConditionExpression -> ConditionExpression -> Bool # | |
Show ConditionExpression Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> ConditionExpression -> ShowS # show :: ConditionExpression -> String showList :: [ConditionExpression] -> ShowS # | |
FromJSON ConditionExpression Source # | |
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser ConditionExpression # parseJSONList :: Value -> Parser [ConditionExpression] # |
data FunctionCall Source #
Instances
Eq FunctionCall Source # | |
Defined in IHP.DataSync.DynamicQuery | |
Show FunctionCall Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> FunctionCall -> ShowS # show :: FunctionCall -> String showList :: [FunctionCall] -> ShowS # | |
Generic FunctionCall Source # | |
Defined in IHP.DataSync.DynamicQuery Associated Types type Rep FunctionCall :: Type -> Type | |
NFData FunctionCall Source # | |
Defined in IHP.DataSync.DynamicQuery Methods rnf :: FunctionCall -> () # | |
FromJSON 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
Eq ConditionOperator Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: ConditionOperator -> ConditionOperator -> Bool # (/=) :: ConditionOperator -> ConditionOperator -> Bool # | |
Show ConditionOperator Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> ConditionOperator -> ShowS # show :: ConditionOperator -> String showList :: [ConditionOperator] -> ShowS # | |
FromJSON ConditionOperator Source # | |
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser ConditionOperator # parseJSONList :: Value -> Parser [ConditionOperator] # |
data SelectedColumns Source #
Constructors
SelectAll | SELECT * FROM table |
SelectSpecific [Text] | SELECT a, b, c FROM table |
Instances
Eq SelectedColumns Source # | |
Defined in IHP.DataSync.DynamicQuery Methods (==) :: SelectedColumns -> SelectedColumns -> Bool # (/=) :: SelectedColumns -> SelectedColumns -> Bool # | |
Show SelectedColumns Source # | |
Defined in IHP.DataSync.DynamicQuery Methods showsPrec :: Int -> SelectedColumns -> ShowS # show :: SelectedColumns -> String showList :: [SelectedColumns] -> ShowS # | |
FromJSON SelectedColumns Source # | |
Defined in IHP.DataSync.DynamicQuery Methods parseJSON :: Value -> Parser SelectedColumns # parseJSONList :: Value -> Parser [SelectedColumns] # | |
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 Action Source # | |
FromJSON OrderByDirection Source # | |
Methods parseJSON :: Value -> Parser OrderByDirection # parseJSONList :: Value -> Parser [OrderByDirection] # | |
FromJSON Join Source # | |
FromJSON Condition Source # | |
FromJSON OrderByClause Source # | |
Methods parseJSON :: Value -> Parser OrderByClause # parseJSONList :: Value -> Parser [OrderByClause] # |