Documentation
¶
Overview ¶
This example demonstrates generating code from a live Postgres database using DSN-based introspection.
Prerequisites:
- A running Postgres instance
- Create a database and apply the schema: createdb sqlgen_example psql sqlgen_example < schema.sql
- Set DATABASE_URL: export DATABASE_URL="postgres://localhost:5432/sqlgen_example?sslmode=disable"
Then generate and run:
go run ../../cmd/sqlgen generate go run .
Click to show internal directories.
Click to hide internal directories.