-
Notifications
You must be signed in to change notification settings - Fork 777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for POSTGIS geometry type #231
Comments
@rupertevill, I have fixed this particular error by doing the following. "overrides": [ am using https://github.com/twpayne/go-geom In my case am using both geometry and geography . with default of MultiPolygons Its generating below field type Boundary struct { |
I'm curious how others are dealing with the need to call |
The following worked out for me, without needing overrides:
- db_type: "geometry"
go_type: "github.com/cridenour/go-postgis.Point" Note: For geometries having an SRID, use The schema I used for testing this: CREATE TABLE city (
id serial primary key,
center geometry not null
);
-- name: GetCity :one
SELECT
id,
center
FROM city
WHERE id = $1; (sqlc playground link for this: https://play.sqlc.dev/p/bf6cdb6d5efccd911da525068d29561d822845ceee9ffc152ff8fa18b633da72) |
For completeness, here's how I was able to insert using
Then using it:
|
The following SQL:
yields the following error when using 'sqlc generate':
It would be fantastic if geometry could default to simply use the sql.NullString for now.
If it is added, it allows me to reference the geometry type from https://github.com/paulmach/go.geojson as the type override (at the package level). Rather than having to reference each geometry column separately if I want to override the type.
The text was updated successfully, but these errors were encountered: