sql-builder icon indicating copy to clipboard operation
sql-builder copied to clipboard

Is there any support for Postgres Array?

Open TaQuanMinhLong opened this issue 2 years ago • 0 comments

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("]", "}"),
        )
    }

TaQuanMinhLong avatar Sep 24 '23 03:09 TaQuanMinhLong