repository

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cassandra

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

func NewCassandraRepository

func NewCassandraRepository(log *logrus.Logger) *Cassandra

func (*Cassandra) Close

func (c *Cassandra) Close()

func (*Cassandra) Connect

func (c *Cassandra) Connect(cassandraURL, cassandraUser, cassandraPass string, initDB bool) error

func (*Cassandra) GetMessageTime

func (c *Cassandra) GetMessageTime(messageID uuid.UUID) (time.Time, error)

func (*Cassandra) GetMessages

func (c *Cassandra) GetMessages(roomID uuid.UUID, afterTime time.Time, limit uint) ([]message.Message, error)

func (*Cassandra) GetUsersFromIDs

func (c *Cassandra) GetUsersFromIDs(uuids []uuid.UUID) ([]user.User, error)

func (*Cassandra) IsRoomExist

func (c *Cassandra) IsRoomExist(roomID uuid.UUID) (bool, error)

func (*Cassandra) SaveMessage

func (c *Cassandra) SaveMessage(msg *message.Message) error

type MessageRepository

type MessageRepository interface {
	// GetMessageTime returns time when massage was sent by its id
	GetMessageTime(messageID uuid.UUID) (time.Time, error)

	// GetMessages returns limited amount of messages from specified room and after specified time
	GetMessages(roomID uuid.UUID, afterTime time.Time, limit uint) ([]message.Message, error)

	// SaveMessage saves given massage
	SaveMessage(message *message.Message) error
}

MessageRepository manages data related to messages

type Repository

type Repository interface {
	MessageRepository
	UserRepository
	RoomRepository
}

Repository manages data related to messages, users and rooms

type RoomRepository

type RoomRepository interface {
	// IsRoomExist checks if room exist
	IsRoomExist(roomID uuid.UUID) (bool, error)
}

RoomRepository manages data related to rooms

type UserRepository

type UserRepository interface {
	// GetUsersFromIDs returns slice of users by their ids
	GetUsersFromIDs([]uuid.UUID) ([]user.User, error)
}

UserRepository manages data related to users

Jump to

Keyboard shortcuts

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