Documentation
¶
Index ¶
- type IUserRepositoryInterface
- type User
- type UserRepository
- func (usr *UserRepository) CheckToken(token string) (bool, error)
- func (usr *UserRepository) ExistsEmail(email string) (bool, error)
- func (usr *UserRepository) ExistsUsername(userName string) (bool, error)
- func (usr *UserRepository) LogIn(userName string, password string) (string, error)
- func (usr *UserRepository) LogOut(token string) error
- func (usr *UserRepository) Register(user User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IUserRepositoryInterface ¶
type IUserRepositoryInterface interface {
Register(user User) error
LogIn(userName, password string) (string, error)
LogOut(token string) error
ExistsUsername(userName string) (bool, error)
ExistsEmail(email string) (bool, error)
CheckToken(token string) (bool, error)
}
IUserRepositoryInterface interface of the User repo
type User ¶
type User struct {
UserName string `json:"username"`
Email string `json:"email"`
Password string `json:"password"`
ID string `json:"id"`
}
User represents the structure of our resource
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository struct implementation of IUserRepositoryInterface
func NewUserRepository ¶
func NewUserRepository(connString string) (*UserRepository, error)
NewUserRepository function to get new UserRepository
func (*UserRepository) CheckToken ¶
func (usr *UserRepository) CheckToken(token string) (bool, error)
CheckToken function
func (*UserRepository) ExistsEmail ¶
func (usr *UserRepository) ExistsEmail(email string) (bool, error)
ExistsEmail function checks if the given email exists
func (*UserRepository) ExistsUsername ¶
func (usr *UserRepository) ExistsUsername(userName string) (bool, error)
ExistsUsername function checks if the given userName exists
func (*UserRepository) LogIn ¶
func (usr *UserRepository) LogIn(userName string, password string) (string, error)
LogIn Logs In the user
func (*UserRepository) LogOut ¶
func (usr *UserRepository) LogOut(token string) error
LogOut function
func (*UserRepository) Register ¶
func (usr *UserRepository) Register(user User) error
Register function that registers the given user.
Click to show internal directories.
Click to hide internal directories.