getWhere returns a pointer to the WHERE field for supported statements.
(stmt ast.Statement)
| 20 | |
| 21 | // getWhere returns a pointer to the WHERE field for supported statements. |
| 22 | func getWhere(stmt ast.Statement) (*ast.Expression, error) { |
| 23 | switch s := stmt.(type) { |
| 24 | case *ast.SelectStatement: |
| 25 | return &s.Where, nil |
| 26 | case *ast.UpdateStatement: |
| 27 | return &s.Where, nil |
| 28 | case *ast.DeleteStatement: |
| 29 | return &s.Where, nil |
| 30 | default: |
| 31 | return nil, &ErrUnsupportedStatement{Transform: "WHERE", Got: stmtTypeName(stmt)} |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | // AddWhere returns a Rule that appends a condition to the WHERE clause of a |
| 36 | // SELECT, UPDATE, or DELETE statement. If the statement already has a WHERE clause, |
no test coverage detected