mirror of
https://github.com/minio/minio.git
synced 2024-12-27 15:45:55 -05:00
7c14cdb60e
Add support for trivial where clause cases
20 lines
499 B
Go
20 lines
499 B
Go
package sqlparser
|
|
|
|
import querypb "github.com/xwb1989/sqlparser/dependency/querypb"
|
|
|
|
// RedactSQLQuery returns a sql string with the params stripped out for display
|
|
func RedactSQLQuery(sql string) (string, error) {
|
|
bv := map[string]*querypb.BindVariable{}
|
|
sqlStripped, comments := SplitMarginComments(sql)
|
|
|
|
stmt, err := Parse(sqlStripped)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
prefix := "redacted"
|
|
Normalize(stmt, bv, prefix)
|
|
|
|
return comments.Leading + String(stmt) + comments.Trailing, nil
|
|
}
|