I would like to use string as part of query.
func GetAll(id int) {
var queryPart string
if id != 0 {
queryPart = fmt.Sprintf("WHERE id = %d", id)
} else {
queryPart = ""
}
database.DB.Query("SELECT name FROM table ?, queryPart)
}
In database.DB I've got *db.Sql instance.
How to get it work? With that code I still get "You have an error in your SQL syntax".