2个不稳定版本
使用旧的Rust 2015
0.2.0 | 2018年11月24日 |
---|---|
0.1.0 | 2018年11月24日 |
#235 in #orm
72 每月下载量
在 birdseed 中使用
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