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

Function getWhere

pkg/transform/where.go:22–33  ·  view source on GitHub ↗

getWhere returns a pointer to the WHERE field for supported statements.

(stmt ast.Statement)

Source from the content-addressed store, hash-verified

20
21// getWhere returns a pointer to the WHERE field for supported statements.
22func 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,

Callers 3

AddWhereFunction · 0.85
RemoveWhereFunction · 0.85
ReplaceWhereFunction · 0.85

Calls 1

stmtTypeNameFunction · 0.70

Tested by

no test coverage detected