Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Adds created_at to trade resource #345

Merged
merged 4 commits into from
Mar 10, 2017
Merged

Adds created_at to trade resource #345

merged 4 commits into from
Mar 10, 2017

Conversation

nullstyle
Copy link
Contributor

  • db2/history: adds LedgersBySequence to load batch of ledgers based upon the loaded page of trades
  • resource: Trade#Populate takes a history.Ledger to populate additional data

- db2/history: adds LedgersBySequence to load batch of ledgers based upon the loaded page of trades
- resource: Trade#Populate takes a history.Ledger to populate additional data
@nullstyle nullstyle requested a review from bartekn March 9, 2017 16:06
return
}

ledgerSequences := make([]interface{}, len(action.Records))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not int32 instead of interface{}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the underlying where call accepts []interface{} and []int32 cannot be casted to []interface{}. You'd have to manually create a populate a new slice within LedgersBySequence. Since LedgersBySequence is effectively an internal only method, I'm fine with having the leniency... you'll still get a good error message if you pass an invalid value, but any numbers and strings work as expected.


if tt.Assert.NoError(err) {
tt.Assert.Len(ls, 3)
}
Copy link
Contributor

@bartekn bartekn Mar 9, 2017

Choose a reason for hiding this comment

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

This test could also check if IDs are correct.

if !found {
msg := fmt.Sprintf("could not find ledger data for sequence %d", record.LedgerSequence())
action.Err = errors.New(msg)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing return?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, thanks

@bartekn bartekn merged commit f98b911 into master Mar 10, 2017
@bartekn
Copy link
Contributor

bartekn commented Mar 10, 2017

Oops, sorry, I wanted to approve this PR. I hope you didn't plan any other changes.

@nullstyle
Copy link
Contributor Author

:) no worries, I had finished

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants