Documentation ¶
Index ¶
- func NewHandler(logger *logger.Logger, service IService, cfg *config.Config) *handler
- type IService
- type Repository
- type Service
- func (s Service) ChatStart(ctx context.Context, token string) (u *models.User, code int, err error)
- func (s Service) Create(ctx context.Context, user models.UserDTO) (id string, err error)
- func (s Service) CreateToken(ctx context.Context, u *models.User) (hash string, err error)
- func (s Service) FindByUUID(ctx context.Context, uid string) (u *models.User, err error)
- func (s Service) GetOnlineUsers(ctx context.Context) (count int, err error)
- func (s *Service) InitSocketConnection(w http.ResponseWriter, r *http.Request, u *models.User) error
- func (s Service) Login(ctx context.Context, dto *models.UserDTO) (u *models.User, err error)
- func (s Service) RevokeToken(ctx context.Context, u *models.User) (ok bool)
- func (s *Service) StartWS(w http.ResponseWriter, r *http.Request, u *models.User) error
- type UserCreateResponse
- type UserLoginResponse
- type UserOnlineResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IService ¶
type IService interface { Create(ctx context.Context, user models.UserDTO) (id string, err error) Login(ctx context.Context, dto *models.UserDTO) (u *models.User, err error) FindByUUID(ctx context.Context, uid string) (u *models.User, err error) RevokeToken(ctx context.Context, u *models.User) (ok bool) CreateToken(ctx context.Context, u *models.User) (hash string, err error) GetOnlineUsers(ctx context.Context) (count int, err error) StartWS(w http.ResponseWriter, r *http.Request, u *models.User) error ChatStart(ctx context.Context, token string) (u *models.User, code int, err error) InitSocketConnection(w http.ResponseWriter, r *http.Request, u *models.User) error }
func NewService ¶
type Repository ¶
type Repository interface { Create(ctx context.Context, user *models.User) (id string, err error) StoreMessage(ctx context.Context, message *models.Message) (id int, err error) GetUnreadMessages(ctx context.Context, u *models.User, unreadMC int) (messages []models.Message, err error) GetUnreadMessagesCount(ctx context.Context, u *models.User) (count int, err error) FindOneUser(ctx context.Context, username string) (u *models.User, err error) FindOneMessage(ctx context.Context, mid int) (m *models.Message, err error) FindByUUID(ctx context.Context, uuid string) (u *models.User, err error) UpdateKey(ctx context.Context, user *models.User, key string) (err error) UpdateOnline(ctx context.Context, user *models.User, isOnline bool) (err error) GetOnline(ctx context.Context) (count int, err error) }
type Service ¶
func (Service) CreateToken ¶
func (Service) FindByUUID ¶
func (Service) GetOnlineUsers ¶
func (*Service) InitSocketConnection ¶
func (Service) RevokeToken ¶
type UserCreateResponse ¶
type UserLoginResponse ¶
type UserLoginResponse struct {
Url string `json:"url" example:"ws://fancy-chat.io/ws&token=one-time-token"`
}
type UserOnlineResponse ¶
type UserOnlineResponse struct {
Count int `json:"count" example:"0"`
}
Click to show internal directories.
Click to hide internal directories.