Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCommentDoesNotExist = errors.New("Comment does not exist")
View Source
var ErrConversationDoesNotExist = errors.New("Conversation does not exist")
View Source
var ErrGroupDoesNotExist = errors.New("Group does not exist")
View Source
var ErrMessageDoesNotExist = errors.New("Message does not exist")
View Source
var ErrUserNotFound = errors.New("User not found")
Functions ¶
This section is empty.
Types ¶
type AppDatabase ¶
type AppDatabase interface {
Ping() error
FindUserByName(name string) (User, error)
AddUser(u User) (User, error)
ChangeUserName(userId string, newName string) (User, error)
ChangeUserPhoto(userID string, photo []byte) error
FindUsersByName(username string) ([]User, error)
GetPrivateConversation(senderID, recipientID string) (string, error)
StartDirectConversation(conversationID, senderID, recipientID string) error
StoreMessage(conversationID, senderID, messageID, content string, attachment []byte, replyTo string) (Message, error)
AddDeliveryReceipt(messageID, userID, deliveredAt string) error
HasUserJoinedConversation(conversationID, userID string) (bool, error)
FetchConversation(conversationID, currentUserID string) (Conversation, error)
FetchConversationMessages(conversationID string) ([]Message, error)
FetchUserConversations(userID string) ([]Conversation, error)
FetchConversationMembers(conversationID string) ([]string, error)
RetrieveUsersPhotos(userID string) (User, error)
RemoveMessage(conversationID, messageID, userID string) error
FetchMessage(messageID, userID string) (Message, error)
StartGroupConversation(conversationID string, memberIDs []string, name string, photo []byte) error
FetchUserGroups(userID string) ([]Conversation, error)
FetchGroup(groupID string) (Conversation, error)
ChangeGroupName(groupId, newName string) error
SetGroupPhoto(groupID string, photo []byte) error
ExitGroup(groupID, userID string) error
AddGroupMember(conversationID string, userID string) error
AddComment(commentID, messageID, authorID string) error
UnaddComment(messageID, authorID string) error
SetMessagesAsRead(conversationID, userID string) error
}
type Conversation ¶
type Conversation struct {
Id string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
CreatedAt string `json:"createdAt"`
Members []string `json:"members"`
LastMessage *Message `json:"lastMessage,omitempty"`
Messages []Message `json:"messages,omitempty"`
ConversationPhoto sql.NullString `json:"conversationPhoto,omitempty"`
}
type Message ¶
type Message struct {
Id string `json:"id"`
ConversationId string `json:"conversationId"`
SenderId string `json:"senderId"`
SenderName string `json:"senderName"`
Content string `json:"content"`
Timestamp string `json:"timestamp"`
Attachment []byte `json:"attachment"`
SenderPhoto string `json:"senderPhoto,omitempty"`
ReactionCount int `json:"reactionCount"`
ReactingUserNames []string `json:"reactingUserNames"`
Status string `json:"status"`
ReplyTo string `json:"replyTo,omitempty"`
ReplyContent string `json:"replyContent,omitempty"`
ReplySenderName string `json:"replySenderName,omitempty"`
ReplyAttachment []byte `json:"replyAttachment,omitempty"`
}
type ReadReceipt ¶
Click to show internal directories.
Click to hide internal directories.