memory

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 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 SessionStore

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

SessionStore implements core.SessionStore in memory

func NewSessionStore

func NewSessionStore() *SessionStore

NewSessionStore creates a new in-memory session store

func (*SessionStore) Create

func (s *SessionStore) Create(ctx context.Context, userID string) (*core.Session, error)

Create stores a new session

func (*SessionStore) GetByRefreshToken

func (s *SessionStore) GetByRefreshToken(ctx context.Context, refreshToken string) (*core.Session, error)

GetByRefreshToken retrieves a session by its refresh token

func (*SessionStore) ListForUser

func (s *SessionStore) ListForUser(ctx context.Context, userID string) ([]core.Session, error)

ListForUser returns all sessions for a user

func (*SessionStore) Revoke

func (s *SessionStore) Revoke(ctx context.Context, sessionID string) error

Revoke removes a specific session

func (*SessionStore) RevokeAllForUser

func (s *SessionStore) RevokeAllForUser(ctx context.Context, userID string) error

RevokeAllForUser removes all sessions for a user

type UserStore

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

UserStore implements core.userStore using in-memory map Good for testing and development

func NewUserStore

func NewUserStore() *UserStore

NewUserStore creates new in-memory user

func (*UserStore) Close

func (s *UserStore) Close() error

func (*UserStore) Create

func (s *UserStore) Create(ctx context.Context, email, passwordHash string) (*core.User, error)

Create stores a user

func (*UserStore) Delete

func (s *UserStore) Delete(ctx context.Context, id string) error

Delete removes a user

func (*UserStore) GetByEmail

func (s *UserStore) GetByEmail(ctx context.Context, email string) (*core.User, error)

GetByEmail retrieves a user by email

func (*UserStore) GetByID

func (s *UserStore) GetByID(ctx context.Context, id string) (*core.User, error)

GetByID retrieve a user by ID

func (*UserStore) UpdateEmail

func (s *UserStore) UpdateEmail(ctx context.Context, id, newEmail string) error

UpdateEmail changes a user's email

func (*UserStore) UpdatePassword

func (s *UserStore) UpdatePassword(ctx context.Context, id, newPasswordHash string) error

UpdatePassword changes user's password

Jump to

Keyboard shortcuts

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