Documentation ¶
Index ¶
- Variables
- type Keeper
- type Log
- type MemoryStorage
- func (s *MemoryStorage) GetMessages(ctx context.Context, filter models.Filter, pagination models.Pagination) ([]models.Message, error)
- func (s *MemoryStorage) InsertMessage(ctx context.Context, message models.Message) error
- func (s *MemoryStorage) UpdateMessagesProcessed(ctx context.Context, ids []int) error
- type StorageMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrConflict = errors.New("data conflict") ErrNotFound = errors.New("not found") )
ErrConflict indicates a data conflict in the store.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper interface { LoadMessages(context.Context) (StorageMessage, error) InsertMessage(context.Context, models.Message) (int, error) GetMessages(context.Context, models.Filter, models.Pagination) ([]models.Message, error) UpdateMessagesProcessed(ctx context.Context, ids []int) error Ping(context.Context) bool Close() bool }
Keeper interface for database operations
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage represents an in-memory storage with locking mechanisms
func NewMemoryStorage ¶
func NewMemoryStorage(ctx context.Context, keeper Keeper, log Log) *MemoryStorage
NewMemoryStorage creates a new MemoryStorage instance
func (*MemoryStorage) GetMessages ¶
func (s *MemoryStorage) GetMessages(ctx context.Context, filter models.Filter, pagination models.Pagination) ([]models.Message, error)
GetMessages retrieves processed messages from the database based on the provided filter and pagination
func (*MemoryStorage) InsertMessage ¶
InsertMessage inserts a new message into the storage and database
func (*MemoryStorage) UpdateMessagesProcessed ¶
func (s *MemoryStorage) UpdateMessagesProcessed(ctx context.Context, ids []int) error
UpdateMessagesProcessed updates the processed status of messages in the database
type StorageMessage ¶
Click to show internal directories.
Click to hide internal directories.