Documentation ¶
Overview ¶
Package storage provides implementations of storage interfaces.
Index ¶
- Variables
- type Keeper
- type Log
- type MemoryStorage
- func (ms *MemoryStorage) AddData(ctx context.Context, table string, user_id int, entry_id string, ...) error
- func (ms *MemoryStorage) AddUser(ctx context.Context, username string, hashedPassword string) error
- func (ms *MemoryStorage) DeleteData(ctx context.Context, table string, user_id int, entry_id string) error
- func (ms *MemoryStorage) GetAllData(ctx context.Context, table string, user_id int, last_sync time.Time, ...) ([]map[string]string, error)
- func (ms *MemoryStorage) GetPassword(ctx context.Context, username string) (string, error)
- func (ms *MemoryStorage) GetUserID(ctx context.Context, username string) (int, error)
- func (ms *MemoryStorage) UpdateData(ctx context.Context, table string, user_id int, entry_id string, ...) error
- func (ms *MemoryStorage) UserExists(ctx context.Context, username string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConflict = errors.New("data conflict")
ErrConflict indicates a data conflict in the store.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper interface { // UserExists checks if a user exists. UserExists(ctx context.Context, username string) (bool, error) // AddUser adds a new user to the storage. AddUser(ctx context.Context, username string, hashedPassword string) error // GetPassword retrieves the password for the given username. GetPassword(ctx context.Context, username string) (string, error) // GetUserID retrieves the user ID for the given username. GetUserID(ctx context.Context, username string) (int, error) // AddData adds data to the storage. AddData(ctx context.Context, table string, user_id int, entry_id string, data map[string]string) error // UpdateData updates existing data in the storage. UpdateData(ctx context.Context, table string, user_id int, entry_id string, data map[string]string) error // DeleteData deletes data from the storage. DeleteData(ctx context.Context, table string, user_id int, entry_id string) error // GetAllData retrieves all data from the storage. GetAllData(ctx context.Context, table string, user_id int, last_sync time.Time, incl_del bool) ([]map[string]string, error) }
Keeper represents the storage keeper interface.
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage is an in-memory storage implementation with CRUD operations for URL and user data.
func NewMemoryStorage ¶
func NewMemoryStorage(keeper Keeper, log Log) *MemoryStorage
NewMemoryStorage creates a new MemoryStorage instance with the provided Keeper and logger.
func (*MemoryStorage) AddData ¶
func (ms *MemoryStorage) AddData(ctx context.Context, table string, user_id int, entry_id string, data map[string]string) error
AddData adds data to the storage.
func (*MemoryStorage) DeleteData ¶
func (ms *MemoryStorage) DeleteData(ctx context.Context, table string, user_id int, entry_id string) error
DeleteData deletes data from the storage.
func (*MemoryStorage) GetAllData ¶
func (ms *MemoryStorage) GetAllData(ctx context.Context, table string, user_id int, last_sync time.Time, incl_del bool) ([]map[string]string, error)
GetAllData retrieves all data from the storage.
func (*MemoryStorage) GetPassword ¶
GetPassword retrieves the password for the given username.
func (*MemoryStorage) UpdateData ¶
func (ms *MemoryStorage) UpdateData(ctx context.Context, table string, user_id int, entry_id string, data map[string]string) error
UpdateData updates existing data in the storage.
func (*MemoryStorage) UserExists ¶
UserExists checks if a user exists.
Click to show internal directories.
Click to hide internal directories.