mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-12-26 07:33:21 -05:00
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.
This commit is contained in:
parent
d5bea1102d
commit
483adb5c56
@ -3,7 +3,6 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
"github.com/aclindsa/moneygo/internal/models"
|
"github.com/aclindsa/moneygo/internal/models"
|
||||||
"github.com/aclindsa/moneygo/internal/store"
|
"github.com/aclindsa/moneygo/internal/store"
|
||||||
"github.com/aclindsa/moneygo/internal/store/db"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
@ -47,7 +46,7 @@ func (c *Context) LastLevel() bool {
|
|||||||
type Handler func(*http.Request, *Context) ResponseWriterWriter
|
type Handler func(*http.Request, *Context) ResponseWriterWriter
|
||||||
|
|
||||||
type APIHandler struct {
|
type APIHandler struct {
|
||||||
Store *db.DbStore
|
Store store.Store
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ah *APIHandler) txWrapper(h Handler, r *http.Request, context *Context) (writer ResponseWriterWriter) {
|
func (ah *APIHandler) txWrapper(h Handler, r *http.Request, context *Context) (writer ResponseWriterWriter) {
|
||||||
|
@ -84,7 +84,7 @@ func (db *DbStore) Close() error {
|
|||||||
return err
|
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)
|
dsn = getDSN(dbtype, dsn)
|
||||||
database, err := sql.Open(dbtype.String(), dsn)
|
database, err := sql.Open(dbtype.String(), dsn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user