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

Function AddWhereFromSQL

pkg/transform/where.go:109–117  ·  view source on GitHub ↗

AddWhereFromSQL returns a Rule that parses a SQL condition string and adds it as an AND condition to the existing WHERE clause. WARNING: sql parameter must not contain untrusted user input. This function parses raw SQL - passing unsanitized input could produce unintended query modifications. Use pa

(sql string)

Source from the content-addressed store, hash-verified

107// produce unintended query modifications. Use parameterized queries
108// or construct AST nodes directly for untrusted input.
109func AddWhereFromSQL(sql string) Rule {
110 return RuleFunc(func(stmt ast.Statement) error {
111 condition, err := parseCondition(sql)
112 if err != nil {
113 return err
114 }
115 return AddWhere(condition).Apply(stmt)
116 })
117}

Callers 7

mainFunction · 0.92
TestComposabilityFunction · 0.85

Calls 4

RuleFuncFuncType · 0.85
parseConditionFunction · 0.85
AddWhereFunction · 0.85
ApplyMethod · 0.65