Closed Robbie-Perry closed 5 years ago
I left it out for a few reasons:
encoding/wkb
would need to be moved to the root to avoid a circular dependancy. ST_AsBinary
in the query. Mysql you don't. When I checked, I couldn't figure how to wrap the column names in a function with the orms in golang.So that's why they're not there. Are you using mysql? Did gorm add the ability to wrap functions in a column name?
Makes sense.
I'm using Postgres. Gorm doesn't allow the automatic function wrap, so I needed to create my own types and Scan()
/Value()
functions anyways. I ended up just getting the hex value, converting to/from binary, and adding/removing the bytes representing the projection.
@Robbie-Perry Can you give me a hint on how to do it?
I've noticed that the different geometric types don't have
Scan()
andValue()
directly implemented on them, but rather they are implemented by their wrappers.This is fine if you are able to first call
wkb.Scanner()
andwkb.Value()
before calling the database functions. However, if you are using an orm-type library that automatically callsScan()
andValue()
behind the scenes, such as gorm, then this library won't work.I'm proposing keeping the scanner and valuer wrappers for those who need them, but also implementing
Scan()
andValue()
directly onto each type, for those who don't have the luxury of wrapping their fields prior.