memory

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound      = errors.New("user not found")
	ErrUserAlreadyExists = errors.New("user already exists")
)

Functions

This section is empty.

Types

type MemoryStorage

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

MemoryStorage is a thread-safe in-memory implementation of the Storage interface

func New

func New() *MemoryStorage

New creates a new in-memory storage instance

func (*MemoryStorage) Clear

func (m *MemoryStorage) Clear()

Clear removes all users from storage (useful for testing)

func (*MemoryStorage) Count

func (m *MemoryStorage) Count() int

Count returns the total number of users in storage

func (*MemoryStorage) CreateUser

func (m *MemoryStorage) CreateUser(user *core.User) error

CreateUser creates a new user in memory

func (*MemoryStorage) DeleteUser

func (m *MemoryStorage) DeleteUser(id string) error

DeleteUser removes a user from storage

func (*MemoryStorage) GetUserByEmail

func (m *MemoryStorage) GetUserByEmail(email string) (*core.User, error)

GetUserByEmail retrieves a user by email address

func (*MemoryStorage) GetUserById

func (m *MemoryStorage) GetUserById(id string) (*core.User, error)

GetUserById retrieves a user by ID

func (*MemoryStorage) UpdateUser

func (m *MemoryStorage) UpdateUser(user *core.User) error

UpdateUser updates an existing user

Jump to

Keyboard shortcuts

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