Documentation ¶
Index ¶
- Variables
- type FriendRequest
- type Message
- type StorageConn
- func (s *StorageConn) Close()
- func (s *StorageConn) DeleteFriendRequest(friendPublicKey string) error
- func (s *StorageConn) GetFriendRequests(limit int) []FriendRequest
- func (s *StorageConn) GetKeyValue(key string) (string, error)
- func (s *StorageConn) GetLastMessageRead(friendPublicKey string) (int64, error)
- func (s *StorageConn) GetMessages(friendPublicKey string, limit int) []Message
- func (s *StorageConn) SetLastMessageRead(friendPublicKey string) error
- func (s *StorageConn) StoreFriendRequest(friendPublicKey string, message string) error
- func (s *StorageConn) StoreFriendRequestIgnoreStatus(friendPublicKey string, isIgnored bool) error
- func (s *StorageConn) StoreKeyValue(key string, value string) error
- func (s *StorageConn) StoreMessage(friendPublicKey string, isIncoming bool, isAction bool, message string) error
Constants ¶
This section is empty.
Variables ¶
var (
KeyNotFound = errors.New("Key does not exist")
)
Functions ¶
This section is empty.
Types ¶
type FriendRequest ¶
type StorageConn ¶
type StorageConn struct {
// contains filtered or unexported fields
}
func Open ¶
func Open(filename string) (*StorageConn, error)
Open creates a connection to the database always close the connection with `defer storageConn.Close()`
func (*StorageConn) Close ¶
func (s *StorageConn) Close()
Close safely closes the connection to the database
func (*StorageConn) DeleteFriendRequest ¶
func (s *StorageConn) DeleteFriendRequest(friendPublicKey string) error
DeleteFriendRequest deletes a stored friend request friendPublicKey the publicKey of the friend request
func (*StorageConn) GetFriendRequests ¶
func (s *StorageConn) GetFriendRequests(limit int) []FriendRequest
GetFriendRequests returns previously stored friend requests. limit the number of friend requests that should be returned. Set limit to
-1 to get all messages
func (*StorageConn) GetKeyValue ¶
func (s *StorageConn) GetKeyValue(key string) (string, error)
GetKeyValue returns the value corresponding to the given key or an empty string if the value could not be determined key the key (case sensitive)
func (*StorageConn) GetLastMessageRead ¶
func (s *StorageConn) GetLastMessageRead(friendPublicKey string) (int64, error)
GetLastMessageRead returns the last message read time for a given friend friendPublicKey the publicKey of the friend
func (*StorageConn) GetMessages ¶
func (s *StorageConn) GetMessages(friendPublicKey string, limit int) []Message
GetMessages returns previously stored messages of a friend. friendPublicKey the publicKey of the friend limit the number of messages that should be returned. Set limit
to -1 to get all messages
func (*StorageConn) SetLastMessageRead ¶
func (s *StorageConn) SetLastMessageRead(friendPublicKey string) error
SetLastMessageRead sets the message read status for a given friend friendPublicKey the publicKey of the friend
func (*StorageConn) StoreFriendRequest ¶
func (s *StorageConn) StoreFriendRequest(friendPublicKey string, message string) error
StoreFriendRequest stores a friend request friendPublicKey the publicKey of the friend request message the message send with the friend request
func (*StorageConn) StoreFriendRequestIgnoreStatus ¶
func (s *StorageConn) StoreFriendRequestIgnoreStatus(friendPublicKey string, isIgnored bool) error
StoreFriendRequestIgnoreStatus updates the isIgnored attribute of a friend request friendPublicKey the publicKey of the friend request isIgnored the new value for the isIgnored attribute
func (*StorageConn) StoreKeyValue ¶
func (s *StorageConn) StoreKeyValue(key string, value string) error
StoreKeyValue stores a key-value pair of strings key the key (case sensitive) value the value
func (*StorageConn) StoreMessage ¶
func (s *StorageConn) StoreMessage(friendPublicKey string, isIncoming bool, isAction bool, message string) error
StoreMessage stores a message friendPublicKey the publicKey of the friend isIncoming specifies if the message is received (true) or sent (false) isAction specifies if the message is an action or not message the message