clinics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(r *routing.RouteGroup, service Service, authHandler routing.Handler, logger log.Logger)

RegisterHandlers sets up the routing of the HTTP handlers.

Types

type ClinicSearchRequest

type ClinicSearchRequest struct {
	Name   string `json:"name" required:"true"`
	State  string `json:"state"`
	Opens  string `json:"opens"`
	Closes string `json:"closes"`
}

ClinicSearchRequest represents a clinic search request.

func (ClinicSearchRequest) Validate

func (m ClinicSearchRequest) Validate() error

Validate validates the ClinicSearchRequest fields.

type Repository

type Repository interface {
	// QueryDentalClinic returns the list of dental clinics with the given dental clinic parameters.
	QueryDentalClinics(ctx context.Context, dc entity.DentalClinic) ([]entity.DentalClinic, error)
	// QueryVetClinic returns the list of vet clinics with the given vet clinic parameters.
	QueryVetClinics(ctx context.Context, vc entity.VetClinic) ([]entity.VetClinic, error)
}

Repository encapsulates the logic to access dental clinics from the JSON file.

func NewRepository

func NewRepository(dcFile, vcFile string, logger log.Logger) Repository

NewRepository creates a new clinics repository

type Service

type Service interface {
	QueryDentalClinics(ctx context.Context, input ClinicSearchRequest) ([]entity.DentalClinic, error)
	QueryVetClinics(ctx context.Context, input ClinicSearchRequest) ([]entity.VetClinic, error)
}

Service encapsulates usecase logic for clinics.

func NewService

func NewService(repo Repository, logger log.Logger) Service

NewService creates a new clinics service.

Jump to

Keyboard shortcuts

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