Can golang gin get session anywhere in the current request?

for example, when java is in the same request, you can get the information directly in the context of spring without sending the request of the current request. Can
be done in gin? The main problem now is that all the places where you want to get the session from the request have to pass the context back and forth, unlike in java, you can get it anywhere using the tool class UserUtils.getUser () without passing parameters.
gin, if there are many UserUtils.getUser (context), parameters, almost every method has to take this parameter

.
Aug.22,2021

use middleware
e: = gin.New ()
e.Use (XXX)
in this way, you can put user-related or other data into ctx
you can get data through ctx at any request, encapsulate it, and then


you can see the example of gin session package .
use sessions, can be followed directly by get session information in a gin application.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb5a35-256a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb5a35-256a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?