Crates.io | diesel-mysql-spatial |
lib.rs | diesel-mysql-spatial |
version | 0.1.2 |
source | src |
created_at | 2022-05-16 02:33:38.14739 |
updated_at | 2022-05-17 00:28:15.307294 |
description | An extension for the Diesel framework to support MySQL spatial datatypes. |
homepage | |
repository | https://gitlab.com/cg909/diesel-mysql-spatial |
max_upload_size | |
id | 587414 |
size | 57,586 |
[dependencies]
diesel-mysql-spatial = "0.1"
Assuming a MySQL table defined like this
CREATE TABLE districts (
id INTEGER NOT NULL PRIMARY KEY,
center POINT NOT NULL,
area POLYGON NOT NULL
);
then the Rust code may look like this:
use diesel_mysql_spatial::data_types::{Point, Polygon};
#[derive(Insertable, Queryable)]
#[table_name = "districts"]
struct District {
id: i32,
center: Point,
area: Polygon,
}
table! {
use diesel_mysql_spatial::sql_types::*;
use diesel::sql_types::*;
districts (id) {
id -> Integer,
center -> Point,
area -> Polygon,
}
}
This crate follows semantic versioning with the additional
promise that below 1.0.0
backwards-incompatible changes will not be
introduced with only a patch-level version number change.
Licensed under Mozilla Public License, Version 2.0 (LICENSE or https://www.mozilla.org/en-US/MPL/2.0/).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above including compatibility with secondary licenses, as defined by the MPL.