store

package
v0.0.0-...-3478735 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserHandleExists = fmt.Errorf("user handle exists")

Functions

This section is empty.

Types

type Store

type Store struct {
	Backend keyvaluestore.Backend
}

Store implements the persistence layer of our application.

func (*Store) AddChannel

func (s *Store) AddChannel(channel *model.Channel) error

func (*Store) AddMessage

func (s *Store) AddMessage(message *model.Message) error

func (*Store) AddUser

func (s *Store) AddUser(user *model.User) error

Adds a user to the database. Returns ErrUserHandleExists if the handle is taken.

func (*Store) GetChannels

func (s *Store) GetChannels() ([]*model.Channel, error)

func (*Store) GetChannelsByIds

func (s *Store) GetChannelsByIds(ids ...model.Id) ([]*model.Channel, error)

func (*Store) GetMessagesByChannelIdAndTimeRange

func (s *Store) GetMessagesByChannelIdAndTimeRange(channelId model.Id, begin, end time.Time, limit int) ([]*model.Message, error)

GetMessagesByChannelIdAndTimeRange gets messages for a particular channel within an inclusive time range. If limit is non-zero, the returned messages will be limited to that number. If limit is negative, the returned messages will be the last messages in the range.

func (*Store) GetMessagesByIds

func (s *Store) GetMessagesByIds(ids ...model.Id) ([]*model.Message, error)

func (*Store) GetUserByHandle

func (s *Store) GetUserByHandle(handle string) (*model.User, error)

func (*Store) GetUsersByIds

func (s *Store) GetUsersByIds(ids ...model.Id) ([]*model.User, error)

Jump to

Keyboard shortcuts

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