storage

package
v0.0.0-...-5ca4fef Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type InMemoryStorage

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

func NewInMemoryStorage

func NewInMemoryStorage() *InMemoryStorage

NewInMemoryStorage returns a new in-memory storage.

func (*InMemoryStorage) DeleteMessage

func (s *InMemoryStorage) DeleteMessage(sessionID, participantID string) error

DeleteMessage deletes a message from a session and a participant.

func (*InMemoryStorage) DeleteSession

func (s *InMemoryStorage) DeleteSession(sessionID string) error

DeleteSession deletes a session.

func (*InMemoryStorage) GetMessage

func (s *InMemoryStorage) GetMessage(sessionID, participantID string) ([]model.Message, error)

GetMessage gets a message from a session and a participant.

func (*InMemoryStorage) GetSession

func (s *InMemoryStorage) GetSession(sessionID string) ([]string, error)

GetSession gets a session with a list of participants.

func (*InMemoryStorage) SetMessage

func (s *InMemoryStorage) SetMessage(sessionID, participantID string, message model.Message) error

SetMessage sets a message to a session and a participant.

func (*InMemoryStorage) SetSession

func (s *InMemoryStorage) SetSession(sessionID string, participants []string) error

SetSession sets a session with a list of participants.

type Storage

type Storage interface {
	SetSession(sessionID string, participants []string) error
	GetSession(sessionID string) ([]string, error)
	DeleteSession(sessionID string) error
	GetMessage(sessionID, participantID string) ([]model.Message, error)
	SetMessage(sessionID, participantID string, message model.Message) error
	DeleteMessage(sessionID, participantID string) error
}

Storage is an interface that defines the methods to be implemented by a storage.

Jump to

Keyboard shortcuts

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