From fe94b3a39664e9cabc7851f68108e39587632e2e Mon Sep 17 00:00:00 2001 From: Juraj Bubniak Date: Mon, 30 Dec 2019 09:02:06 +0100 Subject: [PATCH] Rename store.NewSQLStore to store.NewSQL. --- cmd/health.go | 2 +- cmd/server.go | 2 +- internal/store/mock.go | 2 +- internal/store/sql.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/health.go b/cmd/health.go index ea98552..fd6e94d 100644 --- a/cmd/health.go +++ b/cmd/health.go @@ -19,7 +19,7 @@ var Health = &cli.Command{ func checkHealth(ctx *cli.Context) error { cfg := config.LoadFromCLI(ctx) - st, err := store.NewSQLStore(cfg.DatabaseURL) + st, err := store.NewSQL(cfg.DatabaseURL) if err != nil { return fmt.Errorf("unable to initialize store: %v", err) } diff --git a/cmd/server.go b/cmd/server.go index a9b520c..39cf0ef 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -23,7 +23,7 @@ var Server = &cli.Command{ func runServer(ctx *cli.Context) error { cfg := config.LoadFromCLI(ctx) - st, err := store.NewSQLStore(cfg.DatabaseURL) + st, err := store.NewSQL(cfg.DatabaseURL) if err != nil { return fmt.Errorf("unable to initialize store: %v", err) } diff --git a/internal/store/mock.go b/internal/store/mock.go index a727a08..2236172 100644 --- a/internal/store/mock.go +++ b/internal/store/mock.go @@ -51,7 +51,7 @@ func (s *MockStore) GetLists(ctx context.Context) ([]domain.List, error) { } // Check checks the health of the store. -func (s *MockStore) Check() error { +func (s *MockStore) Check(ctx context.Context) error { s.CheckCalled = true return nil } diff --git a/internal/store/sql.go b/internal/store/sql.go index 4bf1867..3f3f570 100644 --- a/internal/store/sql.go +++ b/internal/store/sql.go @@ -65,8 +65,8 @@ type list struct { Items int64 `db:"items"` } -// NewSQLStore returns new SQLStore. -func NewSQLStore(dataSource string) (*SQLStore, error) { +// NewSQL returns a new SQLStore. +func NewSQL(dataSource string) (*SQLStore, error) { db, err := sqlx.Open("postgres", dataSource) if err != nil { return nil, err