The main reason that this module has been created was generic querying database without knowing table structure.
Install
go get github.com/mysiar-org/go-sql-raw
Example use
rows, err: = Db.Query("SELECT * FROM album")
defer rows.Close()
var data []go_sql_raw.RawSqlType
for rows.Next() {
rec := go_sql_raw.Rows2Map(rows)
data = append(data, rec)
}
check also go_sql_raw_test.go
- update type converting from DB to go in function
convertType
- module inspired by https://gist.github.com/SchumacherFM/69a167bec7dea644a20e