Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions dbmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"bytes"
"database/sql"
"fmt"
"log"
"reflect"
"strings"

Expand Down Expand Up @@ -44,11 +43,16 @@ type DbMap struct {
Dialect Dialect

tables []*TableMap
logger *log.Logger
logger Logger
logPrefix string
mapper *reflectx.Mapper
}

// Logger is an interface to the limited logging functions used
type Logger interface {
Printf(format string, v ...interface{})
}

// NewDbMap returns a new DbMap using the db connection and dialect.
func NewDbMap(db *sql.DB, dialect Dialect) *DbMap {
return &DbMap{
Expand All @@ -66,7 +70,7 @@ func NewDbMap(db *sql.DB, dialect Dialect) *DbMap {
//
// Use TraceOn if you want to spy on the SQL statements that modl
// generates.
func (m *DbMap) TraceOn(prefix string, logger *log.Logger) {
func (m *DbMap) TraceOn(prefix string, logger Logger) {
m.logger = logger
if len(prefix) == 0 {
m.logPrefix = prefix
Expand Down