Is there any third-party tool for validate SQL query before I execute it with the database/sql pacakge or any way to check the SQL query is right without getting a panic from database/sql that the query is invalid?
Finally, I found this SQL parser package. I colud use it for validate it.
func isSQLValid(sql string) (bool, error) {
_, err := sqlparser.Parse(sql)
if err != nil {
return false, err
}
return true, nil
}