Skip to content
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

How to register pgxgeos on database connection? Issues inserting go-geos Geometry's #1455

Open
jdaily opened this issue Oct 6, 2024 · 0 comments

Comments

@jdaily
Copy link

jdaily commented Oct 6, 2024

I'm using the go-geos geos package for sqlc

sql_package: "pgx/v5"
        overrides:
          - db_type: "geometry"
            go_type:
              import: "github.com/twpayne/go-geos"
              package: "geos"
              pointer: true
              type: "Geom"
            nullable: true
          - db_type: "geometry"
            go_type:
              import: "github.com/twpayne/go-geos"
              package: "geos"
              type: "Geom"

and it appears to compile my queries as expected from my schema's

location geometry(Point, 4326) NOT NULL,

However I'm getting this error on Insert failed to encode args[7]: unable to encode geos.Geom{context:(*geos.Context)(0x140001be000), geom:(*geos._Ctype_struct_GEOSGeom_t)(0x6000033dc000), parent:(*geos.Geom)(nil), typeID:0, numGeometries:1, numInteriorRings:0, numPoints:0} into text format for unknown type (OID 28177): cannot find encode plan

I've assumed it's because I've not yet figured out how to configure the connection pool to use go-geos.
I don't see any functions in encore.dev/storage/sqldb that would enable me to call AfterConnect. Can you provide some guidance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant