marlowe-runtime-0.0.5: Runtime system for running Marlowe financial contracts on the Cardano Computation Layer
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Marlowe.Runtime.Sync.Database.PostgreSQL.GetHeaders

Synopsis

Documentation

getHeaders :: ContractFilter -> Range ContractId -> Transaction (Maybe (Page ContractId ContractHeader)) Source #

foldPage :: (row -> id) -> (row -> item) -> Int -> Order -> Int -> Fold row (Page id item) Source #

foldItems :: (row -> item) -> Int -> Fold row [item] Source #

decodeContractHeader :: Int64 -> ByteString -> Int64 -> ByteString -> Int16 -> ByteString -> Maybe ByteString -> ByteString -> ByteString -> ContractHeader Source #

foldNextRange :: (row -> id) -> Int -> Order -> Fold row (Maybe (Range id)) Source #

data DelimiterRow Source #

Constructors

DelimiterRow 

Fields

delimiterStatement :: ContractFilter -> ContractId -> Statement () (Maybe DelimiterRow) Source #

A select statement which looks for the delimiter specified by the given contractId.

totalCountStatement :: ContractFilter -> Statement () Int Source #

A select statement which looks for the delimiter specified by the given contractId.

headersStatement :: ContractFilter -> Range ContractId -> Maybe DelimiterRow -> Statement () [ContractHeader] Source #

Tables

type PartyAddressesColumns = '['("address", SqlBytea, NotNull)] Source #

The columns of the partyAddresses CTE

type PartyRolesColumns = '['("rolesCurrency", SqlBytea, NotNull), '("role", SqlBytea, NotNull)] Source #

The columns of the partyRoles CTE

partyAddressesTable :: Table PartyAddressesColumns Source #

The partyAddresses CTE table

partyRolesTable :: Table PartyRolesColumns Source #

The partyRoles CTE table

partyAddressesCTE :: Set Address -> StatementBuilder (Maybe CommonTableExpr) Source #

SQL

 partyAddresses (address)
    ( SELECT * FROM UNNEST ($1)
    )
 

partyRolesCTE :: Set AssetId -> StatementBuilder (Maybe CommonTableExpr) Source #

SQL

 partyRoles (rolesCurrency, role)
    ( SELECT * FROM UNNEST ($1, $2)
    )
 

delimiterTables :: ContractFilter -> StatementBuilder (Maybe WithClause, TableRef) Source #

headersTables :: ContractFilter -> StatementBuilder (Maybe WithClause, TableRef) Source #

rolesTable :: Set PolicyId -> StatementBuilder TableRef Source #

Conditions

delimiterIdCond :: Param -> Param -> AExpr Source #

delimiterComparisonCond :: Order -> DelimiterRow -> StatementBuilder AExpr Source #

filterCondition :: ContractFilter -> Maybe AExpr -> StatementBuilder (Maybe AExpr) Source #

Adds additional checks to a condition as required by the contract filter.

andMaybe :: Maybe AExpr -> Maybe AExpr -> Maybe AExpr Source #

parenthesize :: IsAExpr a => a -> AExpr Source #

orMaybe :: Maybe AExpr -> Maybe AExpr -> Maybe AExpr Source #

tagExistsCond :: Set MarloweMetadataTag -> StatementBuilder (Maybe AExpr) Source #

rolePartyExists :: Set AssetId -> Maybe AExpr Source #

addressPartyExists :: Set Address -> Maybe AExpr Source #