在DAML中,如果我有一个称为“提交”的选择,则它可能导致新合同的认可请求或拒绝请求。我应该如何管理选择中的返回值?
template Request
with
content : Text
anyone : Party
where
signatory anyone
--what to return ? ApprovedRequest or RejectedRequest
controller anyone can
Submit : ContractId ApprovedRequest
do
-- passed all the checks and approved
create ApprovedRequest with request = Request
答案 0 :(得分:1)
也许Maybe (ContractId ApprovedRequest)
将在这里工作?或者,也许Either (ContractId RejectedRequest, ContractId ApprovedRequest)
?