Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SessionGet ¶
func SessionGet(name string) interface{}
SessionGet return the value stored in Session
func SessionSet ¶
func SessionSet(name string, val interface{})
SessionSet store the value to Session
func UseSession ¶
func UseSession(config *Config) gin.HandlerFunc
UseSession is a middleware which generate the session in gorouting Please be sure that all middleware use session must called after this middleware GinEngine default will use this middleware
func WithSession ¶
func WithSession(f func()) func()
WithSession will create the session key in current gorouting
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config the configuration
func SessionConfig ¶
func SessionConfig() *Config
SessionConfig return the saved *Config, it must be called after Use(UseSession(*Config))
type GinEngine ¶
type GinEngine struct { // Engine is the exposed *gin.Engine Engine *gin.Engine // contains filtered or unexported fields }
GinEngine is the configuration of gin.Engine
func NewGin ¶
NewGin will create a new GinEngine with the config file. Example config files check the config and testdata directory.
func (*GinEngine) AddTemplates ¶
AddTemplates to add templates with the specified name
func (*GinEngine) HandleSession ¶
func (ge *GinEngine) HandleSession(method string, path string, handlerFunc gin.HandlerFunc) gin.IRoutes
HandleSession will create a new session with key map to store the value for future use. For example, you can store the language define in session then use it in template or i18n. Warning: you should not use session in middleware because it will be called after the middleware