Giter VIP home page Giter VIP logo

diesel_geometry's Introduction

Support for geometric types and geometric functions for Diesel.

Crates.io

API Documentation latest release

diesel_geometry provides geometric types and geometric functions.

License

Licensed under either of these:

Contributing

Unless you explicitly state otherwise, any contribution you intentionally submit for inclusion in the work, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.

Testing

To run the integration tests on your machine, you need to have read and write access to a running instance of Postgres. The database is not permanently altered because all tests are wrapped in a single transaction that is rolled back.

When running cargo test set the environment variable PG_DATABASE_URL with the Postgres connection string for your database.

Example

You can start a Postgres database locally using docker with:

docker run -d --rm --name postgres -p 5432:5432 postgres:10

And then run:

PG_DATABASE_URL=postgres://postgres:postgres@localhost:5432 cargo test

diesel_geometry's People

Contributors

gabisurita avatar yetanotherminion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

diesel_geometry's Issues

Support for diesel schema generation with diesel.toml?

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?

Serde support

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!

Question on supporting extensions

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,

Add a working example

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.

Invalid use of mem::uninitialized

Setup

Versions

  • Rust:
  • Diesel Geometry: 1.4.0
  • Database:
  • Operating System

Feature Flags

  • diesel_geometry:

Problem Description

attempted to leave type &diesel::pg::metadata_lookup::PgMetadataLookup uninitialized, which is invalid

What are you trying to accomplish?

What is the expected output?

What is the actual output?

https://asan.saethlin.dev/ub?crate=diesel_geometry&version=1.4.0

Are you seeing any additional errors?

Steps to reproduce

Run the test suite with AddressSanitizer and no database running.

Checklist

  • I have already looked over the issue tracker for similar issues.

Fixed by #9

Support for circle?

I'm looking forward to using this crate with PostGIS.
Do you have plans to support the other geometry types like circle? :)

Geography point support

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)

:/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.