-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🔥 Adding user context #1341
🔥 Adding user context #1341
Conversation
Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
|
I could implement point 1. |
This is just my suggestion, listen to the suggestions of other mainline maintainers |
@patil-kshitij please add something in the README for this or/and the docs repository only every known feature is used 😄 |
@@ -309,6 +311,17 @@ func (c *Ctx) Context() *fasthttp.RequestCtx { | |||
return c.fasthttp | |||
} | |||
|
|||
func (c *Ctx) UserContext() context.Context { |
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.
add a method docblock with description
we receive a lot of support requests and i think this could eliminate some requests from the start
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.
Done,
Kindly review
return c.userContext | ||
} | ||
|
||
func (c *Ctx) SetUserContext(ctx context.Context) { |
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.
add a method docblock with description
we receive a lot of support requests and i think this could eliminate some requests from the start
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.
Done,
Kindly 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.
Need a space after the last /
. Same with the test 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.
Done
Kindly 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.
Hi @hi019,
Added space after last /.
Please review
@ReneWerner87, please let me know if, I should add a parallel PR on docs to add documentation regarding setting and getting user-context, which could be used for observability purposes? |
Yes please add a PR in the docs repository. |
Hi @ReneWerner87 , |
Will check it in a few hours |
Hi @ReneWerner87, @hi019 |
Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Resolved #1249
This adds an additional field called
userContext
which is of typecontext.Context
.It could be set by user.