user

package
v0.0.0-...-222756a Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 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 Handler

type Handler struct {
	Logger      *log.Logger
	UserService Service
}

func (*Handler) GetAllUsers

func (h *Handler) GetAllUsers(w http.ResponseWriter, r *http.Request) error

func (*Handler) GetUser

func (h *Handler) GetUser(w http.ResponseWriter, r *http.Request) error

func (*Handler) GetUsersRaing

func (h *Handler) GetUsersRaing(w http.ResponseWriter, r *http.Request) error

func (*Handler) Register

func (h *Handler) Register(router *http.ServeMux)

type Service

type Service interface {
	GetById(ctx context.Context, uuid string) (User, error)
	GetByName(ctx context.Context, lastName string) (User, error)
	GetAll(ctx context.Context, limit, page int64) ([]User, error)
	GetUsersRating(ctx context.Context, limit, page int64) ([]UserRating, error)
}

func NewService

func NewService(storage Storage, logger *log.Logger) (Service, error)

type Storage

type Storage interface {
	FindById(ctx context.Context, uuid string) (User, error)
	FindByName(ctx context.Context, lastName string) (User, error)
	FindAll(ctx context.Context, limit, page int64) ([]User, error)
	AggregateRatingUsers(ctx context.Context, limit, page int64) ([]UserRating, error)
}

type User

type User struct {
	UUID      primitive.ObjectID `json:"UUID,omitempty" bson:"_id,omitempty"`
	Email     string             `json:"email,omitempty" bson:"email,omitempty"`
	LastName  string             `json:"last_name,omitempty" bson:"last_name,omitempty"`
	Country   string             `json:"country,omitempty" bson:"country,omitempty"`
	City      string             `json:"city,omitempty" bson:"city,omitempty"`
	Gender    string             `json:"gender,omitempty" bson:"gender,omitempty"`
	BirthDate primitive.DateTime `json:"birth_date,omitempty" bson:"birth_date,omitempty"`
}

type UserRating

type UserRating struct {
	User   User  `json:"user"`
	Rating int64 `json:"rating"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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