From dcab3994b2517a2ea57e82e7548f47f763bc2c41 Mon Sep 17 00:00:00 2001 From: Urko Date: Mon, 24 Apr 2023 12:03:15 +0200 Subject: [PATCH] feat: rename --- cmd/etl/main.go | 2 +- cmd/server/main.go | 2 +- config/config.go | 22 +++++++++++----------- internal/etl/etl_benchmark_test.go | 14 +++++++------- internal/services/employee_wi.go | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cmd/etl/main.go b/cmd/etl/main.go index 2e945f1..12253f6 100644 --- a/cmd/etl/main.go +++ b/cmd/etl/main.go @@ -78,7 +78,7 @@ func main() { log.Fatalln("client.Connect", err) } - employeeWICollection := client.Database(cfg.DbName).Collection(cfg.EmployeeWorkInformationCollection) + employeeWICollection := client.Database(cfg.DbName).Collection(cfg.WorkInformationCollection) if err = employeeWICollection.Drop(ctx); err != nil { log.Fatalln("employeeWICollection.Drop", err) } diff --git a/cmd/server/main.go b/cmd/server/main.go index fc622bb..950dfcb 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -71,7 +71,7 @@ func main() { log.Fatalln("client.Connect", err) } - employeeWICollection := client.Database(cfg.DbName).Collection(cfg.EmployeeWorkInformationCollection) + employeeWICollection := client.Database(cfg.DbName).Collection(cfg.WorkInformationCollection) professionalRepo := employee_wi.NewRepo(employeeWICollection) restServer := apihttp. diff --git a/config/config.go b/config/config.go index 3f51a76..f27bd78 100644 --- a/config/config.go +++ b/config/config.go @@ -13,17 +13,17 @@ func RootDir() string { } type Config struct { - ApiPort string `required:"true" split_words:"true"` - AmsApi string `required:"true" split_words:"true"` - AmsApiKey string `required:"true" split_words:"true"` - DbAddress string `required:"true" split_words:"true"` - DbName string `required:"true" split_words:"true"` - EmployeeWorkInformationCollection string `required:"true" split_words:"true"` - EmployeeIdList []string `required:"true" split_words:"true"` - TestGoHost string `required:"true" split_words:"true"` - TestGoEmployee string `required:"true" split_words:"true"` - TestNestHost string `required:"true" split_words:"true"` - TestNestEmployee int `required:"true" split_words:"true"` + ApiPort string `required:"true" split_words:"true"` + AmsApi string `required:"true" split_words:"true"` + AmsApiKey string `required:"true" split_words:"true"` + DbAddress string `required:"true" split_words:"true"` + DbName string `required:"true" split_words:"true"` + WorkInformationCollection string `required:"true" split_words:"true"` + EmployeeIdList []string `required:"true" split_words:"true"` + TestGoHost string `required:"true" split_words:"true"` + TestGoEmployee string `required:"true" split_words:"true"` + TestNestHost string `required:"true" split_words:"true"` + TestNestEmployee int `required:"true" split_words:"true"` } func NewConfig(envFile string) *Config { diff --git a/internal/etl/etl_benchmark_test.go b/internal/etl/etl_benchmark_test.go index f0a9d3e..588cd52 100644 --- a/internal/etl/etl_benchmark_test.go +++ b/internal/etl/etl_benchmark_test.go @@ -41,7 +41,7 @@ func BenchmarkETLFanout(b *testing.B) { require.NoError(b, client.Connect(ctx), "client.Connect") - employeeWICollection := client.Database(cfg.DbName).Collection(cfg.EmployeeWorkInformationCollection) + employeeWICollection := client.Database(cfg.DbName).Collection(cfg.WorkInformationCollection) require.NoError(b, employeeWICollection.Drop(ctx), "employeeWICollection.Drop") repo := employee_wi.NewRepo(employeeWICollection) @@ -79,7 +79,7 @@ func BenchmarkETLFanout2(b *testing.B) { require.NoError(b, client.Connect(ctx), "client.Connect") - employeeWICollection := client.Database(cfg.DbName).Collection(cfg.EmployeeWorkInformationCollection) + employeeWICollection := client.Database(cfg.DbName).Collection(cfg.WorkInformationCollection) require.NoError(b, employeeWICollection.Drop(ctx), "employeeWICollection.Drop") repo := employee_wi.NewRepo(employeeWICollection) @@ -115,7 +115,7 @@ func BenchmarkETLMain(b *testing.B) { require.NoError(b, client.Connect(ctx), "client.Connect") - employeeWICollection := client.Database(cfg.DbName).Collection(cfg.EmployeeWorkInformationCollection) + employeeWICollection := client.Database(cfg.DbName).Collection(cfg.WorkInformationCollection) require.NoError(b, employeeWICollection.Drop(ctx), "employeeWICollection.Drop") repo := employee_wi.NewRepo(employeeWICollection) @@ -154,7 +154,7 @@ func TestETLFanout(t *testing.T) { require.NoError(t, client.Connect(ctx), "client.Connect") - employeeWICollection := client.Database(cfg.DbName).Collection(cfg.EmployeeWorkInformationCollection) + employeeWICollection := client.Database(cfg.DbName).Collection(cfg.WorkInformationCollection) require.NoError(t, employeeWICollection.Drop(ctx), "employeeWICollection.Drop") repo := employee_wi.NewRepo(employeeWICollection) @@ -191,7 +191,7 @@ func TestETLFanOut2(t *testing.T) { require.NoError(t, client.Connect(ctx), "client.Connect") - employeeWICollection := client.Database(cfg.DbName).Collection(cfg.EmployeeWorkInformationCollection) + employeeWICollection := client.Database(cfg.DbName).Collection(cfg.WorkInformationCollection) require.NoError(t, employeeWICollection.Drop(ctx), "employeeWICollection.Drop") repo := employee_wi.NewRepo(employeeWICollection) @@ -227,7 +227,7 @@ func TestETLMain(t *testing.T) { require.NoError(t, client.Connect(ctx), "client.Connect") - employeeWICollection := client.Database(cfg.DbName).Collection(cfg.EmployeeWorkInformationCollection) + employeeWICollection := client.Database(cfg.DbName).Collection(cfg.WorkInformationCollection) require.NoError(t, employeeWICollection.Drop(ctx), "employeeWICollection.Drop") repo := employee_wi.NewRepo(employeeWICollection) @@ -251,7 +251,7 @@ func TestLoad(t *testing.T) { require.NoError(t, client.Connect(ctx), "client.Connect") - employeeWICollection := client.Database(cfg.DbName).Collection(cfg.EmployeeWorkInformationCollection) + employeeWICollection := client.Database(cfg.DbName).Collection(cfg.WorkInformationCollection) if err = employeeWICollection.Drop(ctx); err != nil { log.Fatalln("employeeWICollection.Drop", err) } diff --git a/internal/services/employee_wi.go b/internal/services/employee_wi.go index 5d598f1..2e26c8a 100644 --- a/internal/services/employee_wi.go +++ b/internal/services/employee_wi.go @@ -44,7 +44,7 @@ func (p *EmployeeWIService) GetByAll(ctx context.Context, id string) (*domain.Em func (p *EmployeeWIService) InsertMany(ctx context.Context, ei []domain.EmployeeWorkInformation) error { err := p.repo.InsertMany(ctx, ei) if err != nil { - return fmt.Errorf("repo.AddAppointmentTo: %s", err) + return fmt.Errorf("repo.InsertMany: %s", err) } return nil }