modulepackage
0.0.0-20231202172039-91b21a46af34
Repository: https://github.com/nakario/findqueries.git
Documentation: pkg.go.dev
# README
findqueries
findqueries
find SQL queries from .go files in a package and report them in json format.
It also reports call graph of every functions in the package specified.
Usage
$ go install github.com/nakario/findqueries/cmd/findqueries@latest
$ cd /path/to/your/package
$ findqueries . 1> queries.json
findqueries
outputs json to stdout and outputs errors and found SQL queries to stderr.
$ cat queries.json | jq .
# {
# "name": "main",
# "queries": [
# {
# "query": "SELECT id FROM users",
# "caller": "getID",
# "expr": "db.Query(query)",
# "pos": "/path/to/main.go:24:10"
# }, ...
# ],
# "calls": [
# {
# "caller": "getID",
# "callee": "(*database/sql.DB).Query"
# }, ...
# ]
# }
Test this package
To run go test
, you need to run the following command.
$ go mod download
$ go test
# Functions
No description provided by the author
# Variables
No description provided by the author
# Interfaces
No description provided by the author