MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / RemoveWhere

Function RemoveWhere

pkg/transform/where.go:72–81  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

70//
71// Returns ErrUnsupportedStatement for INSERT or DDL statements.
72func 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,

Callers 1

TestRemoveWhereFunction · 0.85

Calls 2

RuleFuncFuncType · 0.85
getWhereFunction · 0.85

Tested by 1

TestRemoveWhereFunction · 0.68