-
Notifications
You must be signed in to change notification settings - Fork 516
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
Receive context in migrations #534
Receive context in migrations #534
Conversation
Hi @mfridman, by any chance can you review this PR too so adding context support to v3 will be complete? |
if err != nil { | ||
return -1, err | ||
} | ||
|
||
return version, nil | ||
} | ||
|
||
// withContext changes the signature of a function that receives one argument to receive a context and the argument. | ||
func withContext[T any](fn func(T) error) func(context.Context, T) error { |
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.
Nice 👍
@ori-shalom Sure, can you please rebase this PR? |
Actually, I'll merge this and make a few comment updates. Thanks for a clean implementation, looks sane to me! |
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.
🎉
This PR is a follow-up to PR #517.
It's currently based on top of
piiano:feat/allow-setting-context
so when #517 will get merged I'll rebase it.This PR allows defining migrations that receive context.
Old migrations that don't receive
context.Context
will still continue to work for backward compatibility.The generation of new Go migrations changed to generate migrations that receive context.