forked from ebhomengo/niki
add grpc repo
This commit is contained in:
parent
564b021a7c
commit
01909b366a
|
|
@ -8,9 +8,10 @@ import (
|
|||
|
||||
func NewPatientAnalyticRouter(s *echo.Group) {
|
||||
|
||||
repo := mysql.NewPatientRepo()
|
||||
mysqlRepo := mysql.NewPatientRepo()
|
||||
//rpcRepo := grpc.NewPatientRepo()
|
||||
|
||||
analyticService := analytic2.NewPatientAnalyticService(repo)
|
||||
analyticService := analytic2.NewPatientAnalyticService(mysqlRepo)
|
||||
|
||||
h := NewHandler(analyticService)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.gocasts.ir/ebhomengo/niki/patientapp/service/analytic"
|
||||
"git.gocasts.ir/ebhomengo/niki/patientapp/service/entity"
|
||||
)
|
||||
|
||||
type AnalyticRepository struct{}
|
||||
|
||||
func NewPatientRepo() *AnalyticRepository {
|
||||
|
||||
return &AnalyticRepository{}
|
||||
}
|
||||
|
||||
func (db *AnalyticRepository) GetPatients(ctx context.Context, f analytic.PatientFilter) ([]entity.Patient, error) {
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (db *AnalyticRepository) CountPatients(ctx context.Context, f analytic.PatientFilter) (int, error) {
|
||||
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (db *AnalyticRepository) SummaryByCity(ctx context.Context, provinceID uint, f analytic.PatientMapFilter) (map[uint][]entity.MapSummaryItem, error) {
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (db *AnalyticRepository) SummaryByProvince(ctx context.Context, f analytic.PatientMapFilter) (map[uint][]entity.MapSummaryItem, error) {
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
|
@ -7,40 +7,30 @@ import (
|
|||
"git.gocasts.ir/ebhomengo/niki/patientapp/service/entity"
|
||||
)
|
||||
|
||||
type DataBase struct {
|
||||
//conn *mysql.DB
|
||||
patients []entity.Patient
|
||||
}
|
||||
type DataBase struct{}
|
||||
|
||||
func NewPatientRepo( /*conn *mysql.DB*/ ) *DataBase {
|
||||
patients := make([]entity.Patient, 0)
|
||||
func NewPatientRepo() *DataBase {
|
||||
|
||||
return &DataBase{
|
||||
//conn: conn,
|
||||
patients: patients,
|
||||
}
|
||||
return &DataBase{}
|
||||
}
|
||||
|
||||
func (db *DataBase) GetPatients(ctx context.Context, f analytic.PatientFilter) ([]entity.Patient, error) {
|
||||
|
||||
return db.patients, nil
|
||||
return nil, nil
|
||||
|
||||
}
|
||||
|
||||
func (db *DataBase) CountPatients(ctx context.Context, f analytic.PatientFilter) (int, error) {
|
||||
|
||||
return len(db.patients), nil
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (db *DataBase) SummaryByCity(ctx context.Context, provinceID uint, f analytic.PatientMapFilter) (map[uint][]entity.MapSummaryItem, error) {
|
||||
|
||||
var out map[uint][]entity.MapSummaryItem
|
||||
|
||||
return out, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (db *DataBase) SummaryByProvince(ctx context.Context, f analytic.PatientMapFilter) (map[uint][]entity.MapSummaryItem, error) {
|
||||
result := make(map[uint][]entity.MapSummaryItem, 0)
|
||||
|
||||
return result, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue