Documentation ¶
Overview ¶
Package sessx reads effective parameter values from GET, POST and SESSION. It also reads consolidated request params (GET, POST). Environment variable REDIS_SESSION_STORE switches to redis storage.
Index ¶
- func Mgr() *scs.SessionManager
- func SessionGet(w http.ResponseWriter, r *http.Request)
- func SessionPut(w http.ResponseWriter, r *http.Request)
- type SessT
- func (sess *SessT) EffectiveFloat(key string, defaultVal ...float64) (float64, bool, error)
- func (sess *SessT) EffectiveInt(key string, defaultVal ...int) (int, bool, error)
- func (sess *SessT) EffectiveIsSet(key string) bool
- func (sess *SessT) EffectiveObj(key string) (obj interface{}, ok bool)
- func (sess *SessT) EffectiveStr(key string, defaultVal ...string) string
- func (sess *SessT) PutObject(key string, val interface{})
- func (sess *SessT) PutString(key, val string)
- func (sess *SessT) ReqParam(key string, defaultVal ...string) (string, bool)
- func (sess *SessT) ReqURI() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SessionGet ¶
func SessionGet(w http.ResponseWriter, r *http.Request)
SessionGet - request handler for session diagnosis via http
func SessionPut ¶
func SessionPut(w http.ResponseWriter, r *http.Request)
SessionPut - request handler for session diagnosis via http
Types ¶
type SessT ¶
type SessT struct { *scs.SessionManager // contains filtered or unexported fields }
SessT enhances the alexedwards/scs session.
func (*SessT) EffectiveFloat ¶
EffectiveFloat is a wrapper around EffectiveStr with subsequent parsing into float
func (*SessT) EffectiveInt ¶
EffectiveInt is a wrapper around EffectiveStr with subsequent parsing into an int
func (*SessT) EffectiveIsSet ¶
EffectiveIsSet checks, whether a key is set. First inside the current request via RequestParamIsSet() Then inside the session.
RequestParamIsSet returns the param value as string. But EffectiveIsSet refers to different types in session: integers, floats or objects.
If ParamPersisterMiddleWare is in action, then a few designated session params are always set.
func (*SessT) EffectiveObj ¶
EffectiveObj helps to retrieve an compound variable from the session.
func (*SessT) EffectiveStr ¶
EffectiveStr returns the corresponding value from request or session. It returns the zero value "", regardless whether the key was not set at all, or whether key was set to value "".
func (*SessT) PutObject ¶
PutObject stores an object into the session. Almost identical to PutString. val can be pointer or value.
func (*SessT) PutString ¶
PutString stores a string into the session. Almost identical to PutObject.
func (*SessT) ReqParam ¶
ReqParam searches for the effective value of the *request*, not in session. First among the POST fields. Not among the URL "path" parameters. Then among the URL GET parameters.
It checks, whether any of the above had the param key set to *empty* string.
Second return value is 'is set'