#orm #sql

diesel-geography

支持PostGIS地理类型和函数的Diesel

2个不稳定版本

使用旧的Rust 2015

0.2.0 2018年11月24日
0.1.0 2018年11月24日

#235 in #orm

Download history 9/week @ 2024-03-08 3/week @ 2024-03-15 33/week @ 2024-03-29 9/week @ 2024-04-05 2/week @ 2024-04-19 1/week @ 2024-04-26

72 每月下载量
birdseed 中使用

MIT/Apache

5KB
53

diesel-geography   构建状态 最新版本 [文档]

支持PostGIS地理类型和函数的Diesel

如何使用

在你的sql模式中,有一个列 location geography(point, 4326) not null。当Diesel生成模式(使用 table! {})时,此列将看起来像 location -> Geography。为确保 Geography 类型在作用域内,阅读 本指南 并将 use diesel_geography::sql_types::* 添加到你的 diesel.toml 文件中的 import_types 键。

例如,它将看起来像这样

[print_schema]
file = "src/schema.rs"

import_types = ["diesel::sql_types::*", "diesel_geography::sql_types::*"]

在你的ORM结构体中,写 location: GeogPoint。现在你可以在你的Diesel查询中使用这个结构体/表。

依赖项

~8.5MB
~192K SLoC