Skip to content

(VDB-1279) LogSortedOffer + LogUnsortedOffer transformers#169

Merged
gslaughl merged 2 commits intostagingfrom
vdb-1279-log-sorted-offer
Apr 17, 2020
Merged

(VDB-1279) LogSortedOffer + LogUnsortedOffer transformers#169
gslaughl merged 2 commits intostagingfrom
vdb-1279-log-sorted-offer

Conversation

@gslaughl
Copy link
Copy Markdown
Contributor

2 nearly-identical transformers in 2 separate commits

@gslaughl gslaughl force-pushed the vdb-1279-log-sorted-offer branch 2 times, most recently from 573ca59 to bac6af6 Compare April 16, 2020 15:13
Copy link
Copy Markdown
Contributor

@rmulhol rmulhol left a comment

Choose a reason for hiding this comment

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

:shipit:


Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].OfferID).To(Equal("717050"))
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assuming we haven't seen any of these on the second contract?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

correct 👍

type logUnsortedOfferModel struct {
OfferID string `db:"offer_id"`
HeaderID int64
LogID int64 `db:"log_id"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nbd but I think we can remove the HeaderID and LogID from this model if we're only querying for the OfferID. For that matter, we may not even need a model if we can just scan that value directly into a string or int64

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call!

)

var (
logSortedOfferOfferID, _ = new(big.Int).SetString("811648", 10)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what's the motivation for putting this string into a big int? Seems like the only usage is calling String() on it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂️

ColumnValues: event.ColumnValues{
event.HeaderFK: LogSortedOfferEventLog.HeaderID,
event.LogFK: LogSortedOfferEventLog.ID,
constants.OfferId: logSortedOfferOfferID.String(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this won't work 99% of the time but in this case we might be able to do new(big.Int).SetBytes(logSortedOfferRawLog.Data).String()

@rmulhol
Copy link
Copy Markdown
Contributor

rmulhol commented Apr 17, 2020

Paranoid me checking in to request a migration timestamp bump if #170 is merged first 😅

@gslaughl gslaughl force-pushed the vdb-1279-log-sorted-offer branch from bac6af6 to 72e5542 Compare April 17, 2020 15:36
@gslaughl gslaughl merged commit ee28ac8 into staging Apr 17, 2020
@gslaughl gslaughl deleted the vdb-1279-log-sorted-offer branch April 17, 2020 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants