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

Function ExampleExtractFunctions

pkg/gosqlx/example_test.go:178–189  ·  view source on GitHub ↗

ExampleExtractFunctions demonstrates extracting function names from a query.

()

Source from the content-addressed store, hash-verified

176
177// ExampleExtractFunctions demonstrates extracting function names from a query.
178func ExampleExtractFunctions() {
179 sql := "SELECT COUNT(*), AVG(salary), UPPER(name) FROM employees"
180
181 ast, err := gosqlx.Parse(sql)
182 if err != nil {
183 log.Fatal(err)
184 }
185
186 functions := gosqlx.ExtractFunctions(ast)
187 fmt.Printf("Found %d functions\n", len(functions))
188 // Output: Found 3 functions
189}
190
191// ExampleExtractMetadata demonstrates extracting comprehensive metadata from a query.
192func ExampleExtractMetadata() {

Callers

nothing calls this directly

Calls 2

ParseFunction · 0.92
ExtractFunctionsFunction · 0.92

Tested by

no test coverage detected