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

Function Apply

pkg/transform/transform.go:84–91  ·  view source on GitHub ↗

Apply executes one or more rules against an AST statement in the order they are provided. If any rule returns a non-nil error the function stops immediately and returns that error without applying subsequent rules. This is the primary entry point for composing transforms: err := transform.Apply(s

(stmt ast.Statement, rules ...Rule)

Source from the content-addressed store, hash-verified

82// transform.AddOrderBy("created_at", true),
83// )
84func Apply(stmt ast.Statement, rules ...Rule) error {
85 for _, rule := range rules {
86 if err := rule.Apply(stmt); err != nil {
87 return err
88 }
89 }
90 return nil
91}
92
93// ErrUnsupportedStatement is returned when a transform rule is applied to a statement
94// type it does not support. For example, AddColumn only supports SelectStatement; applying

Callers 15

mainFunction · 0.92
TestAddColumnFunction · 0.85
TestRemoveColumnFunction · 0.85
TestReplaceColumnFunction · 0.85
TestAddSelectStarFunction · 0.85

Calls 1

ApplyMethod · 0.65

Tested by 15

TestAddColumnFunction · 0.68
TestRemoveColumnFunction · 0.68
TestReplaceColumnFunction · 0.68
TestAddSelectStarFunction · 0.68
TestRemoveWhereFunction · 0.68