session

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(dst *session.Dict, src []byte) error

Base64Decode base64 decode.

func Base64Encode

func Base64Encode(src session.Dict) ([]byte, error)

Base64Encode base64 encode.

func MSGPDecode

func MSGPDecode(dst *session.Dict, src []byte) error

MSGPDecode MessagePack decode.

func MSGPEncode

func MSGPEncode(src session.Dict) ([]byte, error)

MSGPEncode MessagePack encode.

Types

type Config

type Config session.Config

Config configuration of session manager.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig returns a new default configuration.

type Provider

type Provider session.Provider

Provider interface implemented by providers.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session manages the users sessions.

func New

func New(cfg Config) *Session

New returns a configured manager.

func (*Session) Destroy

func (s *Session) Destroy(ctx emir.Context) error

Destroy destroys the session of the current user.

func (*Session) Get

func (s *Session) Get(ctx emir.Context) (*session.Store, error)

Get returns the user session if it does not exist, it will be generated.

func (*Session) Regenerate

func (s *Session) Regenerate(ctx emir.Context) error

Regenerate generates a new session id to the current user.

func (*Session) Save

func (s *Session) Save(ctx emir.Context, store *session.Store) error

Save saves the user session

Warning: Don't use the store after exec this function, because, you will lose the after data For avoid it, defer this function in your request handler.

func (*Session) SetProvider

func (s *Session) SetProvider(provider Provider) error

SetProvider sets the session provider used by the sessions manager.

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

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