elgris / sqrl

Fluent SQL generation for golang
MIT License
279 stars 38 forks source link

Cannot QueryRow() with MySQL driver #8

Closed michael2m closed 7 years ago

michael2m commented 7 years ago

Executing QueryRow() against a SelectBuilder doesn't work for MySQL, because it is not a QueryRower.

elgris commented 7 years ago

thanks @michael2m! I'll check ASAP

elgris commented 7 years ago

Hi @michael2m! You're right, sql.DB does not implement QueryRow(). But you can wrap it in order to provide necessary functionality. The wrapper may look like this:

type SqlWrapper struct {
    db *sql.DB
}

func (w SqlWrapper) QueryRow(query string, args ...interface{}) RowScanner {
    return w.db.QueryRow(query, args...)
}
michael2m commented 7 years ago

Acceptable.

elgris commented 7 years ago

closing for now