Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatMsg ¶
type ChatMsg struct { ID string `json:"id" bson:"_id,omitempty"` Message string `json:"message" bson:"message,omitempty" validate:"required"` SenderName string `json:"senderName" bson:"senderName,omitempty" validate:"required"` TimeSent time.Time `json:"timeSent" bson:"timeSent,omitempty" validate:"required"` }
type ChatRoom ¶
type ChatRoom struct { ID string `json:"id" bson:"_id,omitempty"` Name string `json:"name" bson:"name,omitempty" validate:"required"` RoomPin string `json:"roomPin" bson:"roomPin,omitempty" validate:"required,min=30"` InviteCode string `json:"inviteCode" bson:"inviteCode,omitempty"` URL string `json:"url" bson:"url,omitempty" validate:"required,min=20"` TimeAdded time.Time `json:"timeAdded" bson:"timeAdded,omitempty" validate:"required"` Chats []ChatMsg `json:"chats" bson:"chats,omitempty"` }
type ChatRoomRepo ¶
type ChatRoomRepo struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(db *mongo.Database) *ChatRoomRepo
NewRepository returns a new chatroom repository object that implements the Repository interface.
func (*ChatRoomRepo) SaveChatRoom ¶
func (repo *ChatRoomRepo) SaveChatRoom(chatRoom *ChatRoom) error
SaveChatRoom saves a chat room to the database.
func (*ChatRoomRepo) SaveMessage ¶
func (repo *ChatRoomRepo) SaveMessage(chatRoomID string, msg *ChatMsg) error
SaveMessage adds a message to a chatroom.
Click to show internal directories.
Click to hide internal directories.