ExampleExtractFunctions demonstrates extracting function names from a query.
()
| 176 | |
| 177 | // ExampleExtractFunctions demonstrates extracting function names from a query. |
| 178 | func 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. |
| 192 | func ExampleExtractMetadata() { |
nothing calls this directly
no test coverage detected