indexer: add pagination metadata for deposit, withdrawal endpoints#2305
Conversation
|
mslipper
left a comment
There was a problem hiding this comment.
Comments are non-blocking. Additional cleanup items:
- Separate migrations into a standalone command rather than running them every time the daemon starts.
- Separate the server and the background process into separate daemons.
|
|
||
| return withdrawals, nil | ||
| } | ||
| const selectWithdrawalCountStatement = ` |
There was a problem hiding this comment.
I'd pull these constants out of the method definition. Will avoid them being recreated on every method call.
There was a problem hiding this comment.
Cool, yeah they can be part of sql.go
| var count uint64 | ||
|
|
||
| err = txn(d.db, func(tx *sql.Tx) error { | ||
| queryStmt, err := tx.Prepare(selectWithdrawalCountStatement) |
There was a problem hiding this comment.
Separately - I don't think you need to do an explicit Prepare here, tx.QueryRow(selectWithdrawalCountStatement) will work fine. Prepared statements allow the DB engine to avoid re-parsing the query, which can improve performance somewhat but is a no-op here since the statement is re-prepared on every invocation of this method.
Description
This PR adds pagination metadata to the
/depositsand/withdrawalsendpoints.The indexer REST server host/port is now configurable via the vars
REST_HOSTNAME,REST_PORTbut defaults to127.0.0.1:8080like before.Also a general cleanup, test fixes and docs. Most notably the file
db.gois split by topic into different files.