在进入MySQL之前解析SQL查询

In my Go app I want to be able to analyze a SQL query before to execute it. I want to get: type (update, insert, delete etc). This is easy, but next steps not. table to be affected, columns to be updated (on insert/update) most important - condition, list of columns and values.

Is there any go library for this?

Something to pass a sql query and get back some structure with info about this query

Yes, you have sqlparser for golang.

Note that the sqlparser is been pulled out from the database clustering system vitess

You can use the sql parser like,

reader := strings.NewReader("INSERT INTO table1 VALUES (1, 'a');")

tokens := sqlparser.NewTokenizer(reader)
for {
    stmt, err := sqlparser.ParseNext(tokens)
    if err == io.EOF {
        break
    }
    // Do your logics with the statements.
}