Documentation ¶
Index ¶
- type Channel
- type Client
- type CreateChannelReq
- type CreateDirectChannelReq
- type CreateRoomReq
- type DeleteChannelReq
- type DeleteRoomReq
- type FetchRoomsReq
- type FetchRoomsRes
- type Handler
- func (h *Handler) CreateChannel(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateDirectChannel(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateRoom(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteChannel(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteRoom(w http.ResponseWriter, r *http.Request)
- func (h *Handler) FetchAllMessages(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetRoomDetails(w http.ResponseWriter, r *http.Request)
- func (h *Handler) JoinChannel(w http.ResponseWriter, r *http.Request)
- func (h *Handler) JoinRoom(w http.ResponseWriter, r *http.Request)
- func (h *Handler) LeaveRoom(w http.ResponseWriter, r *http.Request)
- type Hub
- type JoinChannelReq
- type JoinOrLeaveRoomReq
- type Message
- type REPOSITORY
- type Repository
- func (r *Repository) CheckChannelMembership(ctx context.Context, username string, roomID, channelID gocql.UUID) (bool, error)
- func (r *Repository) CheckIfChannelExists(ctx context.Context, req *CreateDirectChannelReq) (*Channel, error)
- func (r *Repository) CreateChannel(ctx context.Context, new_channel *Channel, admin string) (*Room, *Channel, error)
- func (r *Repository) CreateDirectChannel(ctx context.Context, new_channel *Channel, admin gocql.UUID, reciever string) (gocql.UUID, *Channel, error)
- func (r *Repository) CreateRoom(ctx context.Context, room *Room, default_channel *Channel) (*Room, error)
- func (r *Repository) DeleteChannel(ctx context.Context, chn *Channel, admin string) (*Room, gocql.UUID, error)
- func (r *Repository) DeleteRoom(ctx context.Context, room_id gocql.UUID, user_id gocql.UUID) (*Room, error)
- func (r *Repository) FetchAllMessages(ctx context.Context, chn_id gocql.UUID, user_id gocql.UUID, limit int, ...) ([]Message, []byte, error)
- func (r *Repository) FetchAllRooms() (map[gocql.UUID]*Room, error)
- func (r *Repository) GetAllRoomDetails(ctx context.Context, room_id gocql.UUID) (*RoomDetails, error)
- func (r *Repository) JoinRoom(ctx context.Context, room_id gocql.UUID, user_id gocql.UUID, username string, ...) (*Room, error)
- func (r *Repository) LeaveRoom(ctx context.Context, room_id gocql.UUID, user_id gocql.UUID, username string, ...) (*Room, error)
- func (r *Repository) WriteMessageToDB(ctx context.Context, msg *Message) error
- type Room
- type RoomDetails
- type SERVICE
- type Service
- func (s *Service) CheckChannelMembership(c context.Context, join_channel_req *JoinChannelReq) (bool, error)
- func (s *Service) CheckIfChannelExists(c context.Context, req *CreateDirectChannelReq) (*Channel, error)
- func (s *Service) CreateChannel(c context.Context, req *CreateChannelReq) (*Room, *Channel, error)
- func (s *Service) CreateDirectChannel(c context.Context, req *CreateDirectChannelReq) (gocql.UUID, *Channel, error)
- func (s *Service) CreateRoom(c context.Context, req *CreateRoomReq) (*Room, error)
- func (s *Service) DeleteChannel(c context.Context, req *DeleteChannelReq) (*Room, gocql.UUID, error)
- func (s *Service) DeleteRoom(c context.Context, req *DeleteRoomReq) (*Room, error)
- func (s *Service) FetchAllMessages(c context.Context, chn_id gocql.UUID, user_id gocql.UUID, limit int, ...) ([]Message, []byte, error)
- func (s *Service) GetAllRoomDetails(c context.Context, room_id gocql.UUID) (*RoomDetails, error)
- func (s *Service) JoinRoom(c context.Context, req *JoinOrLeaveRoomReq) (*Room, error)
- func (s *Service) LeaveRoom(c context.Context, req *JoinOrLeaveRoomReq) (*Room, error)
- func (s *Service) WriteMessage(c context.Context, msg *Message) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateChannelReq ¶
type CreateDirectChannelReq ¶
type CreateRoomReq ¶
type DeleteChannelReq ¶
type DeleteRoomReq ¶
type FetchRoomsReq ¶
type FetchRoomsRes ¶
type Handler ¶
func NewHandler ¶
func (*Handler) CreateChannel ¶
func (h *Handler) CreateChannel(w http.ResponseWriter, r *http.Request)
func (*Handler) CreateDirectChannel ¶
func (h *Handler) CreateDirectChannel(w http.ResponseWriter, r *http.Request)
func (*Handler) CreateRoom ¶
func (h *Handler) CreateRoom(w http.ResponseWriter, r *http.Request)
func (*Handler) DeleteChannel ¶
func (h *Handler) DeleteChannel(w http.ResponseWriter, r *http.Request)
func (*Handler) DeleteRoom ¶
func (h *Handler) DeleteRoom(w http.ResponseWriter, r *http.Request)
func (*Handler) FetchAllMessages ¶
func (h *Handler) FetchAllMessages(w http.ResponseWriter, r *http.Request)
func (*Handler) GetRoomDetails ¶
func (h *Handler) GetRoomDetails(w http.ResponseWriter, r *http.Request)
func (*Handler) JoinChannel ¶
func (h *Handler) JoinChannel(w http.ResponseWriter, r *http.Request)
type Hub ¶
type Hub struct { // map of room id to room struct Rooms map[gocql.UUID]*Room Register chan *Client Unregister chan *Client Broadcast chan *Message NotifyTheSender chan *Message }
func NewHub ¶
func NewHub(repo REPOSITORY) *Hub
type JoinChannelReq ¶
type JoinOrLeaveRoomReq ¶
type REPOSITORY ¶
type REPOSITORY interface { CreateRoom(ctx context.Context, room *Room, default_channel *Channel) (*Room, error) JoinRoom(ctx context.Context, room_id gocql.UUID, user_id gocql.UUID, username string, email string) (*Room, error) LeaveRoom(ctx context.Context, room_id gocql.UUID, user_id gocql.UUID, username string, email string) (*Room, error) DeleteRoom(ctx context.Context, room_id gocql.UUID, user_id gocql.UUID) (*Room, error) CreateChannel(ctx context.Context, new_channel *Channel, admin string) (*Room, *Channel, error) DeleteChannel(ctx context.Context, chn *Channel, admin string) (*Room, gocql.UUID, error) FetchAllRooms() (map[gocql.UUID]*Room, error) WriteMessageToDB(ctx context.Context, msg *Message) error CheckChannelMembership(ctx context.Context, username string, roomID, channelID gocql.UUID) (bool, error) CreateDirectChannel(ctx context.Context, new_channel *Channel, admin gocql.UUID, reciever string) (gocql.UUID, *Channel, error) CheckIfChannelExists(ctx context.Context, req *CreateDirectChannelReq) (*Channel, error) FetchAllMessages(ctx context.Context, chn_id gocql.UUID, user_id gocql.UUID, limit int, pg_state []byte) ([]Message, []byte, error) GetAllRoomDetails(ctx context.Context, room_id gocql.UUID) (*RoomDetails, error) }
func NewRepository ¶
func NewRepository(db *gocql.Session) REPOSITORY
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func (*Repository) CheckChannelMembership ¶
func (*Repository) CheckIfChannelExists ¶
func (r *Repository) CheckIfChannelExists(ctx context.Context, req *CreateDirectChannelReq) (*Channel, error)
func (*Repository) CreateChannel ¶
func (*Repository) CreateDirectChannel ¶
func (*Repository) CreateRoom ¶
func (*Repository) DeleteChannel ¶
func (*Repository) DeleteRoom ¶
func (*Repository) FetchAllMessages ¶
func (*Repository) FetchAllRooms ¶
func (r *Repository) FetchAllRooms() (map[gocql.UUID]*Room, error)
func (*Repository) GetAllRoomDetails ¶
func (r *Repository) GetAllRoomDetails(ctx context.Context, room_id gocql.UUID) (*RoomDetails, error)
func (*Repository) WriteMessageToDB ¶
func (r *Repository) WriteMessageToDB(ctx context.Context, msg *Message) error
type Room ¶
type Room struct { ID gocql.UUID `json:"id"` RoomName string `json:"room_name"` Channels []gocql.UUID `json:"channels"` Members map[gocql.UUID][]string `json:"members"` // map of channel id to Members CreatedAt time.Time `json:"created_at"` Admin string `json:"admin"` ChannelMap map[gocql.UUID]*Channel }
type RoomDetails ¶
type RoomDetails struct { ID gocql.UUID `json:"id"` RoomName string `json:"room_name"` ChannelsList []gocql.UUID `json:"channels_list"` Channels []*Channel `json:"channels"` Members map[gocql.UUID][]string `json:"members"` // map of channel id to Members CreatedAt time.Time `json:"created_at"` Admin string `json:"admin"` }
type SERVICE ¶
type SERVICE interface { CreateRoom(c context.Context, req *CreateRoomReq) (*Room, error) JoinRoom(c context.Context, req *JoinOrLeaveRoomReq) (*Room, error) LeaveRoom(c context.Context, req *JoinOrLeaveRoomReq) (*Room, error) DeleteRoom(c context.Context, req *DeleteRoomReq) (*Room, error) CreateChannel(c context.Context, req *CreateChannelReq) (*Room, *Channel, error) DeleteChannel(c context.Context, req *DeleteChannelReq) (*Room, gocql.UUID, error) WriteMessageToDB(c context.Context, msg *Message) error CheckChannelMembership(c context.Context, join_channel_req *JoinChannelReq) (bool, error) CreateDirectChannel(c context.Context, req *CreateDirectChannelReq) (gocql.UUID, *Channel, error) CheckIfChannelExists(c context.Context, req *CreateDirectChannelReq) (*Channel, error) FetchAllMessages(c context.Context, chn_id gocql.UUID, user_id gocql.UUID, limit int, pg_state []byte) ([]Message, []byte, error) GetAllRoomDetails(c context.Context, room_id gocql.UUID) (*RoomDetails, error) }
func NewService ¶
func NewService(repository REPOSITORY) SERVICE
type Service ¶
type Service struct { REPOSITORY // contains filtered or unexported fields }
func (*Service) CheckChannelMembership ¶
func (*Service) CheckIfChannelExists ¶
func (*Service) CreateChannel ¶
func (*Service) CreateDirectChannel ¶
func (*Service) CreateRoom ¶
func (*Service) DeleteChannel ¶
func (*Service) DeleteRoom ¶
func (*Service) FetchAllMessages ¶
func (*Service) GetAllRoomDetails ¶
Click to show internal directories.
Click to hide internal directories.