thinkalexandria / diesel_geometry Goto Github PK
View Code? Open in Web Editor NEWAdd support for geometric types and functions to diesel
License: Apache License 2.0
Add support for geometric types and functions to diesel
License: Apache License 2.0
First, congratulations for this project! I've working for some time with diesel and postgres for radial distance computations using Point
and the earthdistance
module, but I hadn't time to isolate the API and publish a crate yet.
My question is if I should try to merge my work with earthdistance
(or something that uses extensions, such as geom os gis) on this crate or try to publish it elsewhere using only the Point data type.
Thanks,
I know there are a few good examples as tests, but it would be good if they were available on the README or the first page of the docs.
The usage is pretty straightforward besides having to include the Point
type on the table!
macro. I had some hard time having to figure out this on the first time working with custom diesel types.
Diesel now uses a diesel.toml
file that allows configuring the schema generation process:
http://diesel.rs/guides/configuring-diesel-cli/
It also allows adding use
statements:
[print_schema]
# Add types from `diesel_full_text_search` like `tsvector`
import_types = ["diesel::sql_types::*", "diesel_full_text_search::types::*"]
Would it be possible to support diesel_geometry
types with automatic schema generation this way?
Or would diesel_cli also have to be aware of the types in this crate (Point
etc.) in order to generate schemas with such columns?
I'm looking forward to using this crate with PostGIS.
Do you have plans to support the other geometry types like circle? :)
I tried to use it with geography point type geography(point, 4326) not null
in postgres and PgPoint
in my model struct, but it's not deserializing the values correctly:
When I insert
ST_SetSRID(ST_MakePoint(13.409779,52.520645), 4326)::geography
and then print it in my Rust executable, it prints:
PgPoint(0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007746818039357731, 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013770074297002852)
:/
Please add optional support for serde's Serialize/Deserialize traits.
Like this:
serde = { version = "1.0", features = ["derive"], optional = true }
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct PgPoint(pub f64, pub f64);
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.