Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type InMemorySessionStore ¶
type InMemorySessionStore struct {
// contains filtered or unexported fields
}
InMemorySessionStore provides a thread-safe in-memory implementation of SessionStore.
func NewInMemorySessionStore ¶
func NewInMemorySessionStore() *InMemorySessionStore
NewInMemorySessionStore creates a new in-memory session store.
func (*InMemorySessionStore) Create ¶
func (s *InMemorySessionStore) Create() *Session
Create generates a new session with a unique ID and adds it to the store.
func (*InMemorySessionStore) Delete ¶
func (s *InMemorySessionStore) Delete(sessionID SessionID)
Delete removes a session from the store.
func (*InMemorySessionStore) Get ¶
func (s *InMemorySessionStore) Get(sessionID SessionID) (*Session, bool)
Get retrieves a session by its ID.
func (*InMemorySessionStore) Update ¶
func (s *InMemorySessionStore) Update(session *Session)
Update stores the potentially modified session state. For this in-memory store using pointers, changes to the retrieved session are inherently reflected. This method ensures the session exists.
type Session ¶
type Session struct { ID SessionID State SessionState // contains filtered or unexported fields }
Session represents a client session.
func GetSessionFromContext ¶
GetSessionFromContext retrieves the Session stored in the context, if any.
func NewSession ¶
func NewSession() *Session
func (*Session) DeleteData ¶
DeleteData removes a key-value pair from the session's state. It is thread-safe.
type SessionState ¶
type SessionState map[string]interface{}
SessionState holds arbitrary data for a session.