Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃 [Question]: what is the way ot use mysql connection in handler function #1127

Open
3 tasks done
kousherAlam opened this issue Dec 5, 2023 · 1 comment
Open
3 tasks done
Labels
馃 Question Further information is requested

Comments

@kousherAlam
Copy link

Question Description

Hi guys,
I may be wrong, please help me to understand !

In the docs there are example code of how we can setup a mysql connection but i can't find any docs of how should i use those connection in the handler function.

Although i find this text "Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares."

So is it only to used in middleware ? If i can use those in middleware then why not in handler as i understand middleware is nothing but stack of handler function.

Thanks

Code Snippet (optional)

No response

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my questions prior to opening this one.
  • I understand that improperly formatted questions may be closed without explanation.
@kousherAlam kousherAlam added the 馃 Question Further information is requested label Dec 5, 2023
@ReneWerner87
Copy link
Member

here is the documentation
https://docs.gofiber.io/storage/mysql_v1.x.x/mysql/

initialize the storage outside the handler and use the storage instance in the middlewares or simply in the handler to use the functionality of our key value store

you can also do more complex things with the connection, which you get via the Conn method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃 Question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants