Skip to content

Allow to query database without knowing table structure

License

Notifications You must be signed in to change notification settings

mysiar-org/go_sql_raw

Repository files navigation

go-sql-raw

Tests Gosec Go Reference GitHub go.mod Go version (branch)

The main reason that this module has been created was generic querying database without knowing table structure.

How to use it

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

TODO

  • update type converting from DB to go in function convertType

Credits