From 483adb5c5657f409654c9145cc13ca752ba84f83 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Sun, 10 Dec 2017 21:02:17 -0500 Subject: [PATCH] Don't leak non-interface type from database module This removes the last place I used *db.DbStore instead of store.Store outside the 'db' package. --- internal/handlers/handlers.go | 3 +-- internal/store/db/db.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 88a11fd..ce904ad 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -3,7 +3,6 @@ package handlers import ( "github.com/aclindsa/moneygo/internal/models" "github.com/aclindsa/moneygo/internal/store" - "github.com/aclindsa/moneygo/internal/store/db" "log" "net/http" "path" @@ -47,7 +46,7 @@ func (c *Context) LastLevel() bool { type Handler func(*http.Request, *Context) ResponseWriterWriter type APIHandler struct { - Store *db.DbStore + Store store.Store } func (ah *APIHandler) txWrapper(h Handler, r *http.Request, context *Context) (writer ResponseWriterWriter) { diff --git a/internal/store/db/db.go b/internal/store/db/db.go index ba01e61..5daa9aa 100644 --- a/internal/store/db/db.go +++ b/internal/store/db/db.go @@ -84,7 +84,7 @@ func (db *DbStore) Close() error { return err } -func GetStore(dbtype config.DbType, dsn string) (store *DbStore, err error) { +func GetStore(dbtype config.DbType, dsn string) (store store.Store, err error) { dsn = getDSN(dbtype, dsn) database, err := sql.Open(dbtype.String(), dsn) if err != nil {