Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hasura.Backends.MySQL.DataLoader.Execute
Description
Execute the plan given from .Plan.
Synopsis
- data RecordSet = RecordSet {
- origin :: Maybe PlannedAction
- rows :: Vector (InsOrdHashMap FieldName OutputValue)
- wantedFields :: Maybe [Text]
- data ExecuteReader = ExecuteReader {
- recordSets :: IORef (InsOrdHashMap Ref RecordSet)
- credentials :: SourceConfig
- data ExecuteProblem
- newtype Execute a = Execute {}
- data OutputValue
- = ArrayOutputValue (Vector OutputValue)
- | RecordOutputValue (InsOrdHashMap FieldName OutputValue)
- | ScalarOutputValue Value
- | NullOutputValue
- runExecute :: MonadIO m => SourceConfig -> HeadAndTail -> Execute a -> m (Either ExecuteProblem RecordSet)
- execute :: Forest PlannedAction -> Execute ()
- executePlannedAction :: PlannedAction -> Execute ()
- fetchRecordSetForAction :: Action -> Execute RecordSet
- makeRecordSet :: Vector (InsOrdHashMap FieldName Value) -> RecordSet
- saveRecordSet :: Ref -> RecordSet -> Execute ()
- getRecordSet :: Ref -> Execute RecordSet
- getFinalRecordSet :: HeadAndTail -> Execute RecordSet
- leftObjectJoin :: Maybe [Text] -> Text -> [(FieldName, FieldName)] -> RecordSet -> RecordSet -> Either ExecuteProblem RecordSet
- leftArrayJoin :: Maybe [Text] -> Text -> [(FieldName, FieldName)] -> Top -> Maybe Int -> RecordSet -> RecordSet -> Either ExecuteProblem RecordSet
- joinArrayRows :: Maybe [Text] -> Text -> InsOrdHashMap FieldName OutputValue -> Vector (InsOrdHashMap FieldName OutputValue) -> InsOrdHashMap FieldName OutputValue
- joinObjectRows :: Maybe [Text] -> Text -> InsOrdHashMap FieldName OutputValue -> Vector (InsOrdHashMap FieldName OutputValue) -> Either ExecuteProblem (InsOrdHashMap FieldName OutputValue)
Documentation
A set of records produced by the database. These are joined together. There are all sorts of optimizations possible here, from using a matrix/flat vector, unboxed sums for Value, etc. Presently we choose a naive implementation in the interest of getting other work done.
Constructors
RecordSet | |
Fields
|
Instances
Show RecordSet Source # | |
(TypeError ('Text "Aeson loses key order, so you can't use this instance.") :: Constraint) => ToJSON RecordSet Source # | |
Defined in Hasura.Backends.MySQL.DataLoader.Execute Methods toEncoding :: RecordSet -> Encoding toJSONList :: [RecordSet] -> Value toEncodingList :: [RecordSet] -> Encoding |
data ExecuteReader Source #
The read-only info. used by the Execute monad. Later, this IORef may become either atomically modified or in an STM or MVar so that jobs can be executed in parallel.
Constructors
ExecuteReader | |
Fields
|
data ExecuteProblem Source #
Any problem encountered while executing the plan.
Constructors
GetJobDecodeProblem String | |
CreateQueryJobDecodeProblem String | |
JoinProblem ExecuteProblem | |
UnsupportedJoinBug JoinType | |
MissingRecordSetBug Ref | |
BrokenJoinInvariant [FieldName] |
Instances
Show ExecuteProblem Source # | |
Defined in Hasura.Backends.MySQL.DataLoader.Execute Methods showsPrec :: Int -> ExecuteProblem -> ShowS # show :: ExecuteProblem -> String # showList :: [ExecuteProblem] -> ShowS # |
Execute monad; as queries are performed, the record sets are stored in the map.
Constructors
Execute | |
Fields |
data OutputValue Source #
A value outputted by this execute module in a record set.
Constructors
ArrayOutputValue (Vector OutputValue) | |
RecordOutputValue (InsOrdHashMap FieldName OutputValue) | |
ScalarOutputValue Value | |
NullOutputValue |
Instances
runExecute :: MonadIO m => SourceConfig -> HeadAndTail -> Execute a -> m (Either ExecuteProblem RecordSet) Source #
Using the config, run the execute action. Finally, resolve the head-and-tail to a record set.
executePlannedAction :: PlannedAction -> Execute () Source #
Execute an action, then store its result in the ref assigned to it.
fetchRecordSetForAction :: Action -> Execute RecordSet Source #
Fetch the record set for the given action.
makeRecordSet :: Vector (InsOrdHashMap FieldName Value) -> RecordSet Source #
Make a record set from a flat record from the DB.
getFinalRecordSet :: HeadAndTail -> Execute RecordSet Source #
See documentation for HeadAndTail
.
leftObjectJoin :: Maybe [Text] -> Text -> [(FieldName, FieldName)] -> RecordSet -> RecordSet -> Either ExecuteProblem RecordSet Source #
Inefficient but clean left object join.
leftArrayJoin :: Maybe [Text] -> Text -> [(FieldName, FieldName)] -> Top -> Maybe Int -> RecordSet -> RecordSet -> Either ExecuteProblem RecordSet Source #
A naive, exponential reference implementation of a left join. It serves as a trivial sample implementation for correctness checking of more efficient ones.
joinArrayRows :: Maybe [Text] -> Text -> InsOrdHashMap FieldName OutputValue -> Vector (InsOrdHashMap FieldName OutputValue) -> InsOrdHashMap FieldName OutputValue Source #
Join a row with another as an array join.
joinObjectRows :: Maybe [Text] -> Text -> InsOrdHashMap FieldName OutputValue -> Vector (InsOrdHashMap FieldName OutputValue) -> Either ExecuteProblem (InsOrdHashMap FieldName OutputValue) Source #
Join a row with another as an object join.
If rightRow is not a single row, we throw BrokenJoinInvariant
.