store

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: GPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BHChat

type BHChat struct {
	Name    string
	ID      string `badgerhold:"unique"`
	Members []BHContact
	Type    entity.ChatType
	Admins  []BHContact
}

type BHContact

type BHContact struct {
	ID   string `badgerhold:"unique"`
	Name string
}

type BHIdentity

type BHIdentity struct {
	ID   string `badgerhold:"unique"`
	Name string
	Key  string
}

type BHTextMessage

type BHTextMessage struct {
	// BID       int64 `badgerhold:"key"`
	ID        string `badgerhold:"unique"`
	ChatID    string `badgerhold:"index"`
	CreatedAt int64
	Text      string
	Status    entity.Status
	Author    BHContact
}

type Store

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

func NewStore

func NewStore(path string) (*Store, error)

func (*Store) AllContacts

func (s *Store) AllContacts(skip int, limit int) ([]BHContact, error)

func (*Store) ChatByID

func (s *Store) ChatByID(id string) (BHChat, error)

func (*Store) ChatList

func (s *Store) ChatList(skip int, limit int) ([]BHChat, error)

func (*Store) ChatMessages

func (s *Store) ChatMessages(id string, skip int, limit int, statuses ...entity.Status) ([]BHTextMessage, error)

func (*Store) ChatUnreadCount added in v0.2.0

func (s *Store) ChatUnreadCount(id string) (uint64, error)

func (*Store) Close added in v0.1.0

func (s *Store) Close()

func (*Store) ContactByID

func (s *Store) ContactByID(id string) (BHContact, error)

func (*Store) ContactByIDs

func (s *Store) ContactByIDs(ids []string) ([]BHContact, error)

func (*Store) GetIdentity

func (s *Store) GetIdentity() (BHIdentity, error)

func (*Store) InsertChat

func (s *Store) InsertChat(ch BHChat) error

func (*Store) InsertContact

func (s *Store) InsertContact(contact BHContact) error

func (*Store) InsertTextMessage

func (s *Store) InsertTextMessage(tm BHTextMessage) error

func (*Store) MsgByID added in v0.1.0

func (s *Store) MsgByID(id string) (BHTextMessage, error)

func (*Store) PutContact added in v0.2.0

func (s *Store) PutContact(contact BHContact) error

func (*Store) SetIdentity

func (s *Store) SetIdentity(id BHIdentity) error

func (*Store) UpdateMessage added in v0.1.0

func (s *Store) UpdateMessage(msg BHTextMessage) error

Jump to

Keyboard shortcuts

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