Documentation
¶
Index ¶
- Variables
- type AuthentificationInteractor
- type ChatInteractor
- func (ci *ChatInteractor) Channels(clientId int64) (map[int64]*domain.Channel, int64, error)
- func (ci *ChatInteractor) CreateChannel(clientId int64, name string) error
- func (ci *ChatInteractor) Disconnect(clientId int64) error
- func (ci *ChatInteractor) GetMessages(channelId int64) ([]*domain.Message, error)
- func (ci *ChatInteractor) JoinChannel(clientId int64, channelId int64) error
- func (ci *ChatInteractor) JoinServer(clientId int64) (*domain.Client, error)
- func (ci *ChatInteractor) SendMessage(clientId int64, body string) error
- type Crypto
- type GoogleRegisterInfo
- type HomeInteractor
- type Logger
- type LoginInfo
- type RegisterInfo
- type User
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Registration ErrUserAlreadyExists = errors.New("Username unavailable") ErrInvalidRegisterInfo = errors.New("Invalid registration info") // Invalid ids ErrInvalidChannelId = errors.New("Invalid channel id") ErrInvalidClientId = errors.New("Invalid client id") // Others ErrAccessDenied = errors.New("Access denied") ErrNoChannel = errors.New("User is not in any channel") )
Functions ¶
This section is empty.
Types ¶
type AuthentificationInteractor ¶
type AuthentificationInteractor struct { UserRepository UserRepository Crypto Crypto Logger Logger // contains filtered or unexported fields }
AuthentificationInteractor use cases for authentification
func NewAuthentificationInteractor ¶
func NewAuthentificationInteractor(userRepository UserRepository, crypto Crypto, logger Logger) *AuthentificationInteractor
NewAuthentificationInteractor ctor
func (*AuthentificationInteractor) GoogleLogin ¶
func (ai *AuthentificationInteractor) GoogleLogin(info *GoogleRegisterInfo) (*User, error)
GoogleLogin logs the user using google+ profile
func (*AuthentificationInteractor) Login ¶
func (ai *AuthentificationInteractor) Login(info *LoginInfo) (*User, error)
Login logs in the user
func (*AuthentificationInteractor) Register ¶
func (ai *AuthentificationInteractor) Register(info *RegisterInfo) (*User, error)
Register registers the user
type ChatInteractor ¶
type ChatInteractor struct { ServerRepository domain.ServerRepository ChannelRepository domain.ChannelRepository MessageRepository domain.MessageRepository ClientRepository domain.ClientRepository Logger Logger // contains filtered or unexported fields }
func NewChatInteractor ¶
func NewChatInteractor(serverRepo domain.ServerRepository, channelRepo domain.ChannelRepository, msgRepo domain.MessageRepository, clientRepo domain.ClientRepository, logger Logger) *ChatInteractor
func (*ChatInteractor) CreateChannel ¶
func (ci *ChatInteractor) CreateChannel(clientId int64, name string) error
func (*ChatInteractor) Disconnect ¶
func (ci *ChatInteractor) Disconnect(clientId int64) error
func (*ChatInteractor) GetMessages ¶
func (ci *ChatInteractor) GetMessages(channelId int64) ([]*domain.Message, error)
func (*ChatInteractor) JoinChannel ¶
func (ci *ChatInteractor) JoinChannel(clientId int64, channelId int64) error
func (*ChatInteractor) JoinServer ¶
func (ci *ChatInteractor) JoinServer(clientId int64) (*domain.Client, error)
func (*ChatInteractor) SendMessage ¶
func (ci *ChatInteractor) SendMessage(clientId int64, body string) error
type Crypto ¶
type Crypto interface { CompareHashAndPassword(hash string, password string) (bool, error) GenerateFromPassword(password string) (string, error) }
Crypto interfaces a crypto handler
type GoogleRegisterInfo ¶
type GoogleRegisterInfo struct { Id string DisplayName string FirstName string LastName string Email string }
GoogleRegisterInfo info for google login/registration
type HomeInteractor ¶
type HomeInteractor struct { ClientRepository domain.ClientRepository Logger Logger }
func NewHomeInteractor ¶
func NewHomeInteractor(clientRepository domain.ClientRepository, logger Logger) *HomeInteractor
type RegisterInfo ¶
type RegisterInfo struct { Username string Password string FirstName string LastName string Email string }
RegisterInfo info used during registration
type UserRepository ¶
type UserRepository interface { Create(info *RegisterInfo) (*User, error) CreateGoogle(info *GoogleRegisterInfo) (*User, error) FindByName(name string) (*User, error) FindByNameWithHash(name string) (*User, string, error) FindByGoogleId(id string) (*User, error) UpdatePasswordHash(user *User, hash string) error }
UserRepository interfaces a user repo
Click to show internal directories.
Click to hide internal directories.