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

Function Example_extractFunctions

pkg/gosqlx/example_test.go:554–565  ·  view source on GitHub ↗

Example_extractFunctions demonstrates extracting function names from a query.

()

Source from the content-addressed store, hash-verified

552
553// Example_extractFunctions demonstrates extracting function names from a query.
554func Example_extractFunctions() {
555 sql := "SELECT COUNT(*), AVG(salary), UPPER(name) FROM employees"
556
557 ast, err := gosqlx.Parse(sql)
558 if err != nil {
559 log.Fatal(err)
560 }
561
562 functions := gosqlx.ExtractFunctions(ast)
563 fmt.Printf("Found %d functions\n", len(functions))
564 // Output: Found 3 functions
565}
566
567// Example_extractMetadata demonstrates extracting comprehensive metadata from a query.
568func Example_extractMetadata() {

Callers

nothing calls this directly

Calls 2

ParseFunction · 0.92
ExtractFunctionsFunction · 0.92

Tested by

no test coverage detected