Skip to content

Commit

Permalink
Fix golint erros in drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaelzer committed Feb 10, 2016
1 parent d74f0c2 commit a8af309
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import (
"github.com/jmoiron/sqlx"
)

// SQLConnector provides a type alias for a db initialize function
type SQLConnector func(driverName, dataSourceName string) (*sqlx.DB, error)
2 changes: 2 additions & 0 deletions drivers/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package drivers

import (
"github.com/Masterminds/squirrel"
// Bring in the mysql driver
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
)

// InitMySQL sets up squirrel and creates a MySQL connection
func InitMySQL(connect SQLConnector, dbtype, dsn string) (*sqlx.DB, squirrel.StatementBuilderType, error) {
sq := squirrel.StatementBuilder.PlaceholderFormat(squirrel.Question)
db, err := connect(dbtype, dsn)
Expand Down
2 changes: 2 additions & 0 deletions drivers/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package drivers
import (
"github.com/Masterminds/squirrel"
"github.com/jmoiron/sqlx"
// Import postgres driver
_ "github.com/lib/pq"
)

// InitPostgres sets up squirrel and creates a Postgres connection
func InitPostgres(connect SQLConnector, dbtype, dsn string) (*sqlx.DB, squirrel.StatementBuilderType, error) {
sq := squirrel.StatementBuilder.PlaceholderFormat(squirrel.Dollar)
db, err := connect(dbtype, dsn)
Expand Down
5 changes: 3 additions & 2 deletions drivers/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package drivers

import (
"github.com/Masterminds/squirrel"
_ "github.com/mattn/go-sqlite3"

"github.com/jmoiron/sqlx"
// Import sqlite driver
_ "github.com/mattn/go-sqlite3"
)

// InitSQLite sets up squirrel and creates a SQLite connection
func InitSQLite(connect SQLConnector, dbtype, dsn string) (*sqlx.DB, squirrel.StatementBuilderType, error) {
sq := squirrel.StatementBuilder.PlaceholderFormat(squirrel.Question)
db, err := connect(dbtype, dsn)
Expand Down

0 comments on commit a8af309

Please sign in to comment.