7

I'd like to use the point Postgres type. I don't see this type listed here in the types list for Diesel.

What is the correct way to write a model that includes a point column?

lovelikelando
  • 7,593
  • 6
  • 32
  • 50
  • I know it is not exactly PostGIS, but I suspect the answer is similar to this one: https://github.com/diesel-rs/diesel/issues/232#issuecomment-193934393. I.e. it would require creating an extension to Diesel. – Jon Wolski Nov 25 '17 at 21:38

1 Answers1

3

Based on this Diesel GitHub issue and the types available in diesel::pg::types and diesel::types, there doesn't seem to be any support for these types.

To write a model that includes a point column, you would need to make point a value Diesel can understand. This starts by implementing the FromSql trait for a Point type and then implementing all the things needed for that. For such an extension, look at this PR.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Daniel Fath
  • 16,453
  • 7
  • 47
  • 82