RemoveWhere returns a Rule that removes the WHERE clause from a SELECT, UPDATE, or DELETE statement. After the rule is applied, the statement will match all rows in the target table(s). Use with care in production to avoid unintentional full table scans or mass updates. Returns ErrUnsupportedStatem
()
| 70 | // |
| 71 | // Returns ErrUnsupportedStatement for INSERT or DDL statements. |
| 72 | func RemoveWhere() Rule { |
| 73 | return RuleFunc(func(stmt ast.Statement) error { |
| 74 | where, err := getWhere(stmt) |
| 75 | if err != nil { |
| 76 | return err |
| 77 | } |
| 78 | *where = nil |
| 79 | return nil |
| 80 | }) |
| 81 | } |
| 82 | |
| 83 | // ReplaceWhere returns a Rule that unconditionally replaces the WHERE clause of a |
| 84 | // SELECT, UPDATE, or DELETE statement with the given condition. Unlike AddWhere, |