jschaf / pggen

Generate type-safe Go for any Postgres query. If Postgres can run the query, pggen can generate code for it.
MIT License
282 stars 26 forks source link

Add mostly working postgis example #10

Closed jschaf closed 3 years ago

jschaf commented 3 years ago

This example is broken because there's no Go type for geography. The implementation of geography would look a lot like the existing geographic points in pgtype, like Point.

I'm not going to merge this PR because including Postgis by default is a bit too broad of a change for my liking. Instead, end users should run their own Postgres instances and use the --postgres-connection string:

docker --rm --detach postgis/postgis

pggen gen go \
    --postgres-connection "host=localhost user=postgres dbname=postgres" \
    --schema-glob example/postgis/schema.sql \
    --query-glob example/postgis/query.sql \
    --go-type 'geography=github.com/TODO.Geography'
jschaf commented 3 years ago

Closing. See first comment.

I'm not going to merge this PR because including Postgis by default is a bit too broad of a change for my liking.