session

package module
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: Apache-2.0 Imports: 2 Imported by: 1

README

Session

Test status Go Report Card GoDev GitHub release

Session implementation for Atreugo

Based on: fasthttp/session

Install

go get github.com/atreugo/session

How it works?

Go to examples to see how to use it.

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 *atreugo.RequestCtx) error

Destroy destroys the session of the current user.

func (*Session) Get

func (s *Session) Get(ctx *atreugo.RequestCtx) (*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 *atreugo.RequestCtx) error

Regenerate generates a new session id to the current user.

func (*Session) Save

func (s *Session) Save(ctx *atreugo.RequestCtx, 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