-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Part 2|*] Implement First Part for SQL Backend functions #10287
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
base: elle-payment-sql-series-new
Are you sure you want to change the base?
[Part 2|*] Implement First Part for SQL Backend functions #10287
Conversation
fe51267
to
63aa866
Compare
938443e
to
b0361a2
Compare
b0361a2
to
ed283fa
Compare
ed283fa
to
aa560da
Compare
aa560da
to
08464ea
Compare
08464ea
to
da3603e
Compare
da3603e
to
069f7c6
Compare
1f7d395
to
ef6ef5c
Compare
/gemini review |
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.
Code Review
This pull request implements the QueryPayments
and FetchPayment
functions for the new SQL backend of the payments database. The changes include new SQL queries, Go functions to execute them, and converters to transform database results into application-level types.
The implementation is well-structured, making good use of batching for efficient data fetching. I have a few suggestions to improve code clarity and adhere to best practices:
- Simplify time value handling in
sql_converters.go
by using direct type assertions where the type is guaranteed. - Consider updating the
DB
interface to accept acontext.Context
inFetchPayment
to avoid usingcontext.TODO()
. - I also found a minor typo in a comment.
Overall, this is a solid contribution towards the SQL backend migration.
// | ||
// This is part of the DB interface. | ||
func (s *SQLStore) FetchPayment(paymentHash lntypes.Hash) (*MPPayment, error) { | ||
ctx := context.TODO() |
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.
The use of context.TODO()
is not ideal. The FetchPayment
method in the DB
interface should probably accept a context.Context
to allow for cancellation and deadlines to be propagated. This would be a good improvement for a follow-up PR to align it with QueryPayments
and other context-aware functions.
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.
will be done in a separate PR
ef6ef5c
to
0849296
Compare
Depends on #9147
This PR implements the QueryPayments and FetchPayment SQL Payments DB backend functions.
It does not yet add testing for these functions which will be added in followup PRs once we have the ability to add payments and attempts to the database which we then can fetch.