Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Language.Marlowe.Runtime.Sync.Database.PostgreSQL.GetPayouts
Contents
Synopsis
- getPayouts :: PayoutFilter -> Range TxOutRef -> Transaction (Maybe (Page TxOutRef PayoutHeader))
- data DelimiterRow = DelimiterRow {
- delimiterTxId :: ByteString
- delimiterTxIx :: Int16
- delimiterSlotNo :: Int64
- delimiterStatement :: PayoutFilter -> TxOutRef -> Statement () (Maybe DelimiterRow)
- totalCountStatement :: PayoutFilter -> Statement () Int
- payoutsStatement :: PayoutFilter -> Range TxOutRef -> Maybe DelimiterRow -> Statement () [PayoutHeader]
- rangeSortBy :: IsAExpr a => Order -> a -> SortBy
- withdrawalTxInTable :: Table (AllNull WithdrawalTxInColumns)
- type ContractIdsColumns = '['("createTxId", SqlBytea, NotNull), '("createTxIx", SqlInt2, NotNull)]
- contractIdsTable :: Table ContractIdsColumns
- contractIdsCTE :: Param -> Param -> CommonTableExpr
- type RoleTokensColumns = '['("rolesCurrency", SqlBytea, NotNull), '("role", SqlBytea, NotNull)]
- roleTokensTable :: Table RoleTokensColumns
- roleTokensCTE :: Param -> Param -> CommonTableExpr
- tables :: Bool -> PayoutFilter -> StatementBuilder (Maybe WithClause, TableRef)
- baseTables :: Bool -> PayoutFilter -> (TableRef -> TableRef) -> TableRef
- contractIdsTables :: Set ContractId -> StatementBuilder (Maybe CommonTableExpr, TableRef -> TableRef)
- roleTokensTables :: Set AssetId -> StatementBuilder (Maybe CommonTableExpr, TableRef -> TableRef)
- payoutWithdrawalJoinCond :: AExpr
- delimiterIdCond :: Param -> Param -> AExpr
- delimiterComparisonCond :: Order -> DelimiterRow -> StatementBuilder AExpr
- strictComparisonCond :: (IsAExpr a, IsAExpr b) => Order -> a -> b -> AExpr
- laxComparisonCond :: (IsAExpr a, IsAExpr b) => Order -> a -> b -> AExpr
- filterCondition :: PayoutFilter -> Maybe AExpr -> Maybe AExpr
- payoutIsWithdrawnCond :: AExpr
- payoutNotWithdrawnCond :: AExpr
Documentation
Arguments
:: PayoutFilter | The filter, which controls which payouts are included in the result set. |
-> Range TxOutRef | The page range, which controls which results from the result set are returned, and in what order. |
-> Transaction (Maybe (Page TxOutRef PayoutHeader)) |
Fetch a page of payouts for a given filter and range.
Statements
data DelimiterRow Source #
Constructors
DelimiterRow | |
Fields
|
delimiterStatement :: PayoutFilter -> TxOutRef -> Statement () (Maybe DelimiterRow) Source #
A select statement which looks for the delimiter specified by the given payoutId.
totalCountStatement :: PayoutFilter -> Statement () Int Source #
A select statement which counts the total number of results matching the filter.
payoutsStatement :: PayoutFilter -> Range TxOutRef -> Maybe DelimiterRow -> Statement () [PayoutHeader] Source #
A select statement which fetches the page of payouts.
rangeSortBy :: IsAExpr a => Order -> a -> SortBy Source #
Tables
withdrawalTxInTable :: Table (AllNull WithdrawalTxInColumns) Source #
A modified withdrawal tx in table with all columns null, for left joins.
type ContractIdsColumns = '['("createTxId", SqlBytea, NotNull), '("createTxIx", SqlInt2, NotNull)] Source #
The columns of the contract IDs CTE
contractIdsTable :: Table ContractIdsColumns Source #
The contract IDs CTE table
contractIdsCTE :: Param -> Param -> CommonTableExpr Source #
SQL
contractIds (createTxId, createTxIx) ( SELECT * FROM UNNEST ($1, $2) )
type RoleTokensColumns = '['("rolesCurrency", SqlBytea, NotNull), '("role", SqlBytea, NotNull)] Source #
The columns of the role tokens CTE
roleTokensTable :: Table RoleTokensColumns Source #
The role tokens CTE table
roleTokensCTE :: Param -> Param -> CommonTableExpr Source #
SQL
roleTokens (rolesCurrency, role) ( SELECT * FROM UNNEST ($1, $2) )
tables :: Bool -> PayoutFilter -> StatementBuilder (Maybe WithClause, TableRef) Source #
Compiles the CTEs and FROM clause table ref for a query given a filter.
baseTables :: Bool -> PayoutFilter -> (TableRef -> TableRef) -> TableRef Source #
The joined tables from the marlowe schema used in the FROM clause for a given filter.
contractIdsTables :: Set ContractId -> StatementBuilder (Maybe CommonTableExpr, TableRef -> TableRef) Source #
The CTE and a modification to the FROM clause for the filtered contract IDs.
roleTokensTables :: Set AssetId -> StatementBuilder (Maybe CommonTableExpr, TableRef -> TableRef) Source #
The CTE and a modification to the FROM clause for the filtered role tokens.
conditions
payoutWithdrawalJoinCond :: AExpr Source #
SQL
payoutTxOut.txId = withdrawalTxIn.payoutTxId AND payoutTxOut.txIx = withdrawalTxIn.payoutTxIx
delimiterIdCond :: Param -> Param -> AExpr Source #
SQL
payoutTxOut.txId = $1 AND payoutTxOut.txIx = $2
delimiterComparisonCond :: Order -> DelimiterRow -> StatementBuilder AExpr Source #
strictComparisonCond :: (IsAExpr a, IsAExpr b) => Order -> a -> b -> AExpr Source #
laxComparisonCond :: (IsAExpr a, IsAExpr b) => Order -> a -> b -> AExpr Source #
filterCondition :: PayoutFilter -> Maybe AExpr -> Maybe AExpr Source #
Adds additional checks to a condition as required by the payout filter.
payoutIsWithdrawnCond :: AExpr Source #
SQL
withdrawalTxIn.txId NOTNULL
payoutNotWithdrawnCond :: AExpr Source #
SQL
withdrawalTxIn.txId ISNULL