Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extractor: use daml-lf transaction Value ADT instead of bespoke ADT #1117

Merged
merged 21 commits into from
May 16, 2019

Conversation

S11001001
Copy link
Contributor

@S11001001 S11001001 commented May 13, 2019

extractor uses its own LedgerValue ADT as a pivot from the ledger-api Value type; instead, we should recycle the Value ADT from daml-lf/transaction library. This rewrites all the codecs and things to use that ADT instead, with some behavioral changes informed by the new ADT, such as proper handling of missing record field labels.

  • compile extractor
    • alias LedgerValue
    • ledger-api decoders
    • JSON encoders
    • doobie cases
  • compile extractor tests
  • extractor tests

Pull Request Checklist

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@S11001001 S11001001 added this to the Maintenance milestone May 13, 2019
@S11001001 S11001001 self-assigned this May 13, 2019
@S11001001 S11001001 marked this pull request as ready for review May 14, 2019 22:33
Encoder[String].contramap(identity)

// TODO SC this matches the prior behavior of JSON-ing the dates and timestamps
// as days-since and micros-since epoch, but maybe we'd like something else?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @bitonic @remyhaemmerle-da @leo-da for JSON-pinions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i think we should change this to use string representations, as we did with the old JSON-through-LfTypeEncoding. Feel free to change this in the next PR though.

Copy link
Collaborator

@remyhaemmerle-da remyhaemmerle-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@@ -269,54 +268,52 @@ object Queries {

private def toFragmentNullable(valueSum: LedgerValue): Fragment = {
valueSum match {
case LedgerValue.Optional(None) => Fragment.const("NULL")
case LedgerValue.Optional(Some(innerVal)) => toFragment(innerVal)
case V.ValueOptional(None) => Fragment.const("NULL")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a constant, don't know if Fragment.const is actually heavy or not.

@S11001001 S11001001 merged commit 5709fd0 into master May 16, 2019
@S11001001 S11001001 deleted the extractor-use-transaction-value-adt branch May 16, 2019 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants