Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendUserMessage ¶
func SendUserMessage(messageService MessageService, message Message) error
Formats and sends a user message
Types ¶
type Message ¶
Encapsulates a message from a User to her or his Friend with message Text
func CheckMessages ¶
func CheckMessages(messageService MessageService, userTo string) ([]Message, error)
Checks user messages, with the given MessageService and user id
type MessageService ¶
type MessageService interface { // Gets the messages that have been sent to a user GetMessages(userTo string) ([]Message, error) // Send a message to a user SendMessage(userFrom, userTo, formattedMessage string) error }
Interface for sending messages
func GetMessageService ¶
func GetMessageService() MessageService
Gets an the MessageService if already instantiated, or creates a new one
type MockMessageService ¶
Mock object that saves the messages in app memory
func (MockMessageService) GetMessages ¶
func (service MockMessageService) GetMessages(userTo string) ([]Message, error)
Gets messages from app memory
func (MockMessageService) SendMessage ¶
func (service MockMessageService) SendMessage(userFrom, userTo, text string) error
Saves messages to app memory
type SQLMessagingService ¶
An implemementation of MessageService using a SQL database
func (SQLMessagingService) GetMessages ¶
func (service SQLMessagingService) GetMessages(userTo string) ([]Message, error)
Gets messages from a SQL database
func (SQLMessagingService) SendMessage ¶
func (service SQLMessagingService) SendMessage(userFrom, userTo, text string) error
Saves a message to the SQL database
Click to show internal directories.
Click to hide internal directories.