repository

package
v0.0.0-...-8de5691 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChatNotFound = errors.New("chat not found")
	ErrMsgNotFound  = errors.New("message not found")
	ErrNoAccess     = errors.New("no access")
)

Functions

func NewMessageRepository

func NewMessageRepository(db *mongo.Database) message.Repository

func NewMockRepository

func NewMockRepository(existingChats []*chat.Chat) message.Repository

NewMockRepository takes the @existingChats to mock repo because we do not want to focus on creating a chat here in this mock-repository.

Types

type MockRepository

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

func (MockRepository) Delete

func (repo MockRepository) Delete(chatID primitive.ObjectID, messageID primitive.ObjectID) error

func (MockRepository) Insert

func (repo MockRepository) Insert(chatID primitive.ObjectID, msg *message.Message) (*message.Message, error)

func (MockRepository) Update

func (repo MockRepository) Update(chatID primitive.ObjectID, messageID primitive.ObjectID, fieldsToUpdate bson.M) error

Jump to

Keyboard shortcuts

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