nanoapisession

package module
v0.0.0-...-c72f5fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2022 License: MIT Imports: 5 Imported by: 6

README

nanoapi-session

Session Mgmt to NanoAPI

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSessionNotFound = errors.New("session not found")
View Source
var SessionDel func(c context.Context, id string) error
View Source
var SessionExist func(c context.Context, id string) (bool, error)
View Source
var SessionLoad func(c context.Context, id string) (*Session, error)
View Source
var SessionSave func(c context.Context, s Session) error

Functions

func CtxSessionExist

func CtxSessionExist(c context.Context) bool

CtxSessionExist - checks if session exists.

func CtxSessionID

func CtxSessionID(c context.Context) string

CtxSessionID - gets session id from req cookie.

func Setup

func Setup() error

Types

type Session

type Session struct {
	ID        string
	User      string
	Perms     map[string]string
	Tenant    string
	ExtraInfo map[string]string
}

func CtxMustSession

func CtxMustSession(c context.Context) (*Session, error)

CtxMustSession - gets session and returns ErrSessionNotFound if something goes wrong.

func CtxSession

func CtxSession(c context.Context) *Session

CtxSession - gets all session data from cache.

func ReqSession

func ReqSession(r *http.Request) *Session

CtxSession - gets all session data from cache.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL