user

package
v0.0.0-...-bd5e2c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 9 Imported by: 0

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)
}

type Users

type Users []User

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL