A simple Go CLI tool that connects to a PostgreSQL database and returns the count of users.
- Go 1.25+
- PostgreSQL database
go build -o usercount .Set the DATABASE_URL environment variable and run the tool:
DATABASE_URL="postgres://user:password@localhost:5432/dbname" ./usercountThe tool will output the number of users in the public.users table.
| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | Yes |