From 08aa39814d14e6c491ba7d860f0dea5fe6b19f4e Mon Sep 17 00:00:00 2001 From: Lyra Naeseth Date: Sat, 26 Mar 2022 03:33:50 -0700 Subject: [PATCH] Support Postgres jsonb in entity generation (#51) --- src/postgres/def/types.rs | 3 +++ src/postgres/writer/column.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/postgres/def/types.rs b/src/postgres/def/types.rs index c7b168ce3a..f644ffdd1e 100644 --- a/src/postgres/def/types.rs +++ b/src/postgres/def/types.rs @@ -106,6 +106,8 @@ pub enum Type { /// JSON data checked for validity and with additional functions Json, + /// JSON data stored in a decomposed binary format that can be subscripted and used in indexes + JsonBinary, /// Variable-length multidimensional array Array, @@ -186,6 +188,7 @@ impl Type { "uuid" => Type::Uuid, "xml" => Type::Xml, "json" => Type::Json, + "jsonb" => Type::JsonBinary, "array" => Type::Array, // "" => Type::Composite, "int4range" => Type::Int4Range, diff --git a/src/postgres/writer/column.rs b/src/postgres/writer/column.rs index 89e11e796c..f4215da215 100644 --- a/src/postgres/writer/column.rs +++ b/src/postgres/writer/column.rs @@ -200,6 +200,9 @@ impl ColumnInfo { Type::Json => { col_def.json(); } + Type::JsonBinary => { + col_def.json_binary(); + } Type::Array => { col_def.custom(Alias::new("array")); }