surrealdb_types/kind/
geometry.rs1use std::fmt::Display;
2
3use serde::{Deserialize, Serialize};
4
5use crate::{SqlFormat, ToSql};
6
7#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
12pub enum GeometryKind {
13 Point,
15 Line,
17 Polygon,
19 MultiPoint,
21 MultiLine,
23 MultiPolygon,
25 Collection,
27}
28
29impl ToSql for GeometryKind {
30 fn fmt_sql(&self, f: &mut String, _fmt: SqlFormat) {
31 match self {
32 GeometryKind::Point => f.push_str("point"),
33 GeometryKind::Line => f.push_str("line"),
34 GeometryKind::Polygon => f.push_str("polygon"),
35 GeometryKind::MultiPoint => f.push_str("multipoint"),
36 GeometryKind::MultiLine => f.push_str("multiline"),
37 GeometryKind::MultiPolygon => f.push_str("multipolygon"),
38 GeometryKind::Collection => f.push_str("collection"),
39 }
40 }
41}
42
43impl Display for GeometryKind {
44 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45 f.write_str(&self.to_sql())
46 }
47}