Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Err string
}
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(client *storage.MySQLStorage) (*Repository, error)
func (*Repository) AddUser ¶
func (r *Repository) AddUser(user *User) error
func (*Repository) FindUserByEmail ¶
func (r *Repository) FindUserByEmail(email string) (*User, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(repository *Repository) *Service
func (*Service) CreateUserHandler ¶
func (s *Service) CreateUserHandler(w http.ResponseWriter, r *http.Request)
func (*Service) LoginHandler ¶
func (s *Service) LoginHandler(w http.ResponseWriter, r *http.Request)
func (*Service) TestHandler ¶
func (s *Service) TestHandler(w http.ResponseWriter, r *http.Request)
type User ¶
type User struct { ID *int64 `json:"id,omitempty"` Name string `json:"name"` Email string `json:"email"` Password string `json:"password"` Type *string `json:"type,omitempty"` }
User defines the structure for the user
type UserManager ¶
type UserManager interface { AddUser(ctx context.Context, user User) error UpdateUser(ctx context.Context, userID int64, user User) error DeleteUser(ctx context.Context, userID int64) error FindUserByID(ctx context.Context, userID int64) (*User, error) FindUserByEmail(ctx context.Context, userID int64) (*User, error) GetAllUsers(ctx context.Context) (*Users, error) }
Click to show internal directories.
Click to hide internal directories.