Support custom user types
- Dominant language
- Go
- Stars
- 141
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
I have a use case that requires a non-built-in type to read geo data from a database and output it into GeoJSON, but this extends to any user type. I think that support can be restricted to custom types that match one of the following.
1. Supports `sql.Valuer` AND `sql.Scanner`
OR
2. Is an alias of a built-in type
https://godoc.org/github.com/paulmach/go.geo#Path
### Sample Postgres data (requires PostGIS)
```
CREATE TABLE roads ( id int4, geom geometry(LINESTRING,4326), name varchar(25) );
BEGIN;
INSERT INTO roads (id, geom, name)
VALUES (1,ST_GeomFromText('LINESTRING(191232 243118,191108 243242)',-1),'Jeff Rd');
INSERT INTO roads (id, geom, name)
VALUES (2,ST_GeomFromText('LINESTRING(189141 244158,189265 244817)',-1),'Geordie Rd');
INSERT INTO roads (id, geom, name)
VALUES (3,ST_GeomFromText('LINESTRING(192783 228138,192612 229814)',-1),'Paul St');
INSERT INTO roads (id, geom, name)
VALUES (4,ST_GeomFromText('LINESTRING(189412 252431,189631 259122)',-1),'Graeme Ave');
INSERT INTO roads (id, geom, name)
VALUES (5,ST_GeomFromText('LINESTRING(190131 224148,190871 228134)',-1),'Phil Tce');
INSERT INTO roads (id, geom, name)
VALUES (6,ST_GeomFromText('LINESTRING(198231 263418,198213 268322)',-1),'Dave Cres');
COMMIT;
```
### Expected struct
```
type Road struct {
ID int
Name *string
Geom *geo.Path // import "github.com/paulmach/go.geo"
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.