session

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceSessionManager = "service.session.manager"
	ServiceSessionStorage = "service.session.storage"
)
View Source
const (
	SessionCookieName = "MELODYSESSID"
)

Variables

This section is empty.

Functions

func SessionMustFromContainer

func SessionMustFromContainer(serviceContainer containercontract.Container) sessioncontract.Manager

func SessionStorageMustFromContainer

func SessionStorageMustFromContainer(serviceContainer containercontract.Container) sessioncontract.Storage

func SessionStorageMustFromResolver

func SessionStorageMustFromResolver(resolver containercontract.Resolver) sessioncontract.Storage

Types

type FileStorage

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

* @important recommended for dev only

func NewFileStorageFromFile

func NewFileStorageFromFile(fileInstance *os.File) (*FileStorage, error)

func NewFileStorageFromPath

func NewFileStorageFromPath(path string) (*FileStorage, error)

func (*FileStorage) Close

func (instance *FileStorage) Close() error

func (*FileStorage) Delete

func (instance *FileStorage) Delete(sessionId string) error

func (*FileStorage) Load

func (instance *FileStorage) Load(sessionId string) (map[string]any, bool, error)

func (*FileStorage) Save

func (instance *FileStorage) Save(sessionId string, data map[string]any, ttl time.Duration) error

type InMemoryStorage

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

func NewInMemoryStorage

func NewInMemoryStorage() *InMemoryStorage

func NewInMemoryStorageWithCleanupInterval

func NewInMemoryStorageWithCleanupInterval(cleanupInterval time.Duration) *InMemoryStorage

func (*InMemoryStorage) Clear

func (instance *InMemoryStorage) Clear() error

func (*InMemoryStorage) Close

func (instance *InMemoryStorage) Close() error

func (*InMemoryStorage) Delete

func (instance *InMemoryStorage) Delete(sessionId string) error

func (*InMemoryStorage) Load

func (instance *InMemoryStorage) Load(sessionId string) (map[string]any, bool, error)

func (*InMemoryStorage) Save

func (instance *InMemoryStorage) Save(sessionId string, data map[string]any, ttl time.Duration) error

type Manager

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

func NewManager

func NewManager(storage sessioncontract.Storage, ttl time.Duration) *Manager

func (*Manager) Close

func (instance *Manager) Close() error

func (*Manager) DeleteSession

func (instance *Manager) DeleteSession(sessionId string) error

func (*Manager) NewSession

func (instance *Manager) NewSession() sessioncontract.Session

func (*Manager) SaveSession

func (instance *Manager) SaveSession(sessionInstance sessioncontract.Session) error

func (*Manager) Session

func (instance *Manager) Session(sessionId string) sessioncontract.Session

type Session

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

func (*Session) All

func (instance *Session) All() map[string]any

func (*Session) Clear

func (instance *Session) Clear()

func (*Session) Delete

func (instance *Session) Delete(key string)

func (*Session) Get

func (instance *Session) Get(key string) any

func (*Session) Has

func (instance *Session) Has(key string) bool

func (*Session) Id

func (instance *Session) Id() string

func (*Session) IsCleared

func (instance *Session) IsCleared() bool

func (*Session) IsModified

func (instance *Session) IsModified() bool

func (*Session) Set

func (instance *Session) Set(key string, value any)

func (*Session) String

func (instance *Session) String(key string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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