You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, below is my struct definition for uuid_test table:
#[derive(Debug,Serialize,Deserialize,Row)]pubstructTest{#[serde(with = "clickhouse::serde::uuid")]pubuuid:Uuid,pubname:String,}pubasyncfncreate_table(client:&Client) -> Result<(),Box<dyn std::error::Error>>{
client
.query(" CREATE TABLE IF NOT EXISTS uuid_test( uuid UUID, name LowCardinality(String) ) ENGINE = MergeTree ORDER BY name ",).execute().await.map_err(|err:Error| err.into())}pubasyncfnget_by_uuid(client:&Client,uuid:&Uuid) -> Result<Test,Box<dyn std::error::Error>>{let test = client
.query("SELECT ?fields FROM uuid_test WHERE uuid = ?").bind(uuid).fetch_one::<Test>().await?;println!("[debug]Got test: {test:#?}");Ok(test)}
I used serde_json to serialize Test into string but uuid was output in array type:
let uuid = "...";let test = get_by_uuid(&db,&uuid).await.unwrap();let s = serde_json::to_string(&test).unwrap();println(s);
Hi, below is my struct definition for
uuid_test
table:I used
serde_json
to serializeTest
into string but uuid was output in array type:Here is the output:
How could I serialize uuid into string type?
Thanks
The text was updated successfully, but these errors were encountered: