Example_extractFunctions demonstrates extracting function names from a query.
()
| 552 | |
| 553 | // Example_extractFunctions demonstrates extracting function names from a query. |
| 554 | func 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. |
| 568 | func Example_extractMetadata() { |
nothing calls this directly
no test coverage detected