session

package
v1.10.12 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieIdHandler added in v1.9.2

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

A CookieIdHandler to handle session id by http cookie header

func NewCookieIdHandler added in v1.9.2

func NewCookieIdHandler(cookieName string) *CookieIdHandler

NewCookieIdHandler returns a new CookieIdHandler

func (*CookieIdHandler) CookieName added in v1.9.2

func (s *CookieIdHandler) CookieName() string

CookieName returns cookie name

func (*CookieIdHandler) Get added in v1.9.2

func (s *CookieIdHandler) Get(r *http.Request) string

Get return seesion id by http cookie

func (*CookieIdHandler) Put added in v1.9.2

func (s *CookieIdHandler) Put(w http.ResponseWriter, id string)

Put sets seesion id by http cookie

type IdHandler added in v1.9.2

type IdHandler interface {
	Get(r *http.Request) string
	Put(w http.ResponseWriter, id string)
}

A IdHandler to handle session id

type MemorySession

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

func (*MemorySession) Delete

func (ms *MemorySession) Delete(key string) error

Delete removes a session value

func (*MemorySession) Flush

func (ms *MemorySession) Flush() error

Flush flushes all session values

func (*MemorySession) Get

func (ms *MemorySession) Get(key string) (value []byte, err error)

Get returns a session value

func (*MemorySession) Has

func (ms *MemorySession) Has(key string) (ok bool, err error)

Has checks a value exists

func (*MemorySession) SID

func (ms *MemorySession) SID() string

SID returns the sid

func (*MemorySession) Set

func (ms *MemorySession) Set(key string, value []byte) error

Set sets a session value

type MemorySessionPool added in v0.6.1

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

func NewMemorySessionPool added in v0.6.1

func NewMemorySessionPool(lifetime time.Duration) *MemorySessionPool

NewMemorySessionPool returns a new MemorySessionPool

func (*MemorySessionPool) Destroy added in v0.6.1

func (pool *MemorySessionPool) Destroy(sid string) error

Destroy destroys a session by sid

func (*MemorySessionPool) GetSession added in v0.6.1

func (pool *MemorySessionPool) GetSession(sid string) (session Session, err error)

GetSession returns a session by sid

type Pool added in v0.6.1

type Pool interface {
	GetSession(sid string) (Session, error)
	Destroy(sid string) error
}

A Pool to handle sessions.

type Session

type Session interface {
	// SID returns the sid.
	SID() string
	// Has checks a value exists.
	Has(key string) (ok bool, err error)
	// Get returns a session valuen.
	Get(key string) (value []byte, err error)
	// Set sets a session value.
	Set(key string, value []byte) error
	// Delete removes a session value.
	Delete(key string) error
	// Flush flushes all session values.
	Flush() error
}

Session interface to handle session.

Jump to

Keyboard shortcuts

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