sql-builder
sql-builder copied to clipboard
Is there any support for Postgres Array?
Hey, can we add a function for postgres array text, something similar or better than this?
use serde::Serialize;
use sql_builder::quote;
use std::fmt::Display;
pub fn pg_array<T: Display + Serialize>(value: &[T]) -> String {
quote(
serde_json::to_string(value)
.expect("Failed to serialize value")
.replace("[", "{")
.replace("]", "}"),
)
}