-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
REFACTOR: support custom order by column #1668
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1668 +/- ##
==========================================
+ Coverage 22.77% 22.85% +0.08%
==========================================
Files 622 621 -1
Lines 44809 44857 +48
==========================================
+ Hits 10204 10254 +50
+ Misses 33865 33851 -14
- Partials 740 752 +12
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
pkg/service/trade.go
Outdated
@@ -304,11 +309,24 @@ func (s *TradeService) Query(options QueryTradesOptions) ([]types.Trade, error) | |||
sel = sel.Where(sq.Eq{"exchange": options.Sessions}) | |||
} | |||
|
|||
orderByColumn := "traded_at" | |||
if options.OrderByColumn != "" { | |||
if options.OrderByColumn != "traded_at" && options.OrderByColumn != "gid" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using switch case might be better here?
pkg/service/trade.go
Outdated
sel = sel.OrderBy("traded_at " + options.Ordering) | ||
} else { | ||
sel = sel.OrderBy("traded_at ASC") | ||
if options.Ordering != "ASC" && options.Ordering != "DESC" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
8a3ef17
to
bce68ff
Compare
bce68ff
to
9fb273e
Compare
Re-estimated karma: this pull request may get 297 BBG |
Hi @ycdesu, Well done! 302 BBG has been sent to your polygon wallet. Please check the following tx: https://polygonscan.com/tx/0x6c0ca1cfbdd7ee27e52a41f0cb41377dafe2302010f04960849a475df87dfdb8 Thank you for your contribution! |
Now user is able to specify the ordering column.